netapp_ontap.resources.cifs_session API documentation
Description: Copyright &copy; 2026 NetApp Inc. All rights reserved …

# Module `netapp_ontap.resources.cifs_session`

Copyright © 2026 NetApp Inc. All rights reserved.

This file has been automatically generated based on the ONTAP REST API documentation.

## Overview

ONTAP CIFS sessions `show` functionality is used to provide a list of currently established CIFS sessions with SMB Clients.

### Information on the CIFS session

- List all the SMB sessions for SVM and the clients along with volume information on which the clients are using.

## Example

### Retrieves established sessions information

To retrieve the list of CIFS sessions, use the following API. Note that return_records=true.

    from netapp_ontap import HostConnection
    from netapp_ontap.resources import CifsSession

    with HostConnection(
        "<cluster-mgmt-ip>", username="admin", password="password", verify=False
    ):
        print(list(CifsSession.get_collection(fields="*", return_timeout=15)))

Try it out

    [
        CifsSession(
            {
                "idle_duration": "PT3M15S",
                "smb_encryption": "unencrypted",
                "connected_duration": "PT37M53S",
                "node": {
                    "name": "sti220-vsim-sr050u",
                    "uuid": "a5f65ec0-3550-11ee-93c5-005056ae78de",
                },
                "authentication": "ntlmv2",
                "continuous_availability": "unavailable",
                "protocol": "smb3_1",
                "server_ip": "172.29.212.166",
                "connection_count": 1,
                "mapped_unix_user": "example_user",
                "large_mtu": True,
                "client_ip": "10.249.30.206",
                "identifier": 10878444899913433000,
                "smb_signing": True,
                "open_shares": 1,
                "open_other": 0,
                "volumes": [
                    {"name": "root_vs0", "uuid": "5015c99b-3554-11ee-9f97-005056ae78de"},
                    {"name": "vol_test", "uuid": "84b94bb8-3553-11ee-a3c3-005056ae0dd5"},
                ],
                "connection_id": 103985,
                "user": "example_user",
                "open_files": 5,
                "svm": {"name": "vs0", "uuid": "80e795f4-3553-11ee-9f97-005056ae78de"},
            }
        ),
        CifsSession(
            {
                "idle_duration": "PT5S",
                "smb_encryption": "unencrypted",
                "connected_duration": "PT15S",
                "node": {
                    "name": "sti220-vsim-sr050u",
                    "uuid": "a5f65ec0-3550-11ee-93c5-005056ae78de",
                },
                "authentication": "ntlmv2",
                "continuous_availability": "unavailable",
                "protocol": "smb3_1",
                "server_ip": "172.29.212.166",
                "connection_count": 1,
                "mapped_unix_user": "example_user",
                "large_mtu": True,
                "client_ip": "10.234.157.109",
                "identifier": 10878444899913433000,
                "smb_signing": False,
                "open_shares": 1,
                "open_other": 0,
                "volumes": [
                    {"name": "root_vs0", "uuid": "84b94bb8-3553-11ee-a3c3-005056ae0dd5"}
                ],
                "connection_id": 103986,
                "user": "example_user",
                "open_files": 1,
                "svm": {"name": "vs0", "uuid": "80e795f4-3553-11ee-9f97-005056ae78de"},
            }
        ),
    ]

### Retrieving CIFS server configuration details for a specific SVM

    from netapp_ontap import HostConnection
    from netapp_ontap.resources import CifsSession

    with HostConnection(
        "<cluster-mgmt-ip>", username="admin", password="password", verify=False
    ):
        resource = CifsSession(
            connection_id=103985,
            identifier=10878444899913433090,
            **{
                "svm.uuid": "80e795f4-3553-11ee-9f97-005056ae78de",
                "node.uuid": "a5f65ec0-3550-11ee-93c5-005056ae78de",
            }
        )
        resource.get()
        print(resource)

Try it out

    CifsSession(
        {
            "idle_duration": "PT5M41S",
            "smb_encryption": "unencrypted",
            "connected_duration": "PT50M20S",
            "node": {
                "name": "sti220-vsim-sr050u",
                "uuid": "a5f65ec0-3550-11ee-93c5-005056ae78de",
            },
            "authentication": "ntlmv2",
            "continuous_availability": "unavailable",
            "protocol": "smb3_1",
            "server_ip": "172.29.212.166",
            "connection_count": 1,
            "mapped_unix_user": "example_user",
            "large_mtu": True,
            "client_ip": "10.249.30.206",
            "identifier": 10878444899913433000,
            "smb_signing": True,
            "open_shares": 1,
            "open_other": 0,
            "volumes": [
                {"name": "root_vs0", "uuid": "5015c99b-3554-11ee-9f97-005056ae78de"},
                {"name": "vol_test", "uuid": "84b94bb8-3553-11ee-a3c3-005056ae0dd5"},
            ],
            "connection_id": 103985,
            "user": "example_user",
            "open_files": 5,
            "svm": {"name": "vs0", "uuid": "80e795f4-3553-11ee-9f97-005056ae78de"},
        }
    )

### Removing all existing CIFS sessions for a specific node on a specific SVM

To delete all the existing CIFS session, pass the identifier and connection ID as zero (0) in the following API. This will delete all of the CIFS sessions for the given SVM on the node.

    from netapp_ontap import HostConnection
    from netapp_ontap.resources import CifsSession

    with HostConnection(
        "<cluster-mgmt-ip>", username="admin", password="password", verify=False
    ):
        resource = CifsSession(
            connection_id=0,
            identifier=0,
            **{
                "svm.uuid": "80e795f4-3553-11ee-9f97-005056ae78de",
                "node.uuid": "a5f65ec0-3550-11ee-93c5-005056ae78de",
            }
        )
        resource.delete()

### Removing all CIFS sessions for a specific connection on a specific node on a specific SVM

To delete a CIFS session, use the following API. This will delete the CIFS sessions for a given SVM on the node.

    from netapp_ontap import HostConnection
    from netapp_ontap.resources import CifsSession

    with HostConnection(
        "<cluster-mgmt-ip>", username="admin", password="password", verify=False
    ):
        resource = CifsSession(
            connection_id=103985,
            identifier=0,
            **{
                "svm.uuid": "80e795f4-3553-11ee-9f97-005056ae78de",
                "node.uuid": "a5f65ec0-3550-11ee-93c5-005056ae78de",
            }
        )
        resource.delete()

### Removing a specific CIFS session for a specific Node on a specific SVM

To delete a specific CIFS session, use the following API. This will delete the specific CIFS session for the given SVM on the node.

    from netapp_ontap import HostConnection
    from netapp_ontap.resources import CifsSession

    with HostConnection(
        "<cluster-mgmt-ip>", username="admin", password="password", verify=False
    ):
        resource = CifsSession(
            connection_id=103985,
            identifier=10878444899913433090,
            **{
                "svm.uuid": "80e795f4-3553-11ee-9f97-005056ae78de",
                "node.uuid": "a5f65ec0-3550-11ee-93c5-005056ae78de",
            }
        )
        resource.delete()

## Classes

`class CifsSession (*args, **kwargs)`

  Allows interaction with CifsSession objects on the host

  Initialize the instance of the resource.

  Any keyword arguments are set on the instance as properties. For example, if the class was named 'MyResource', then this statement would be true:

      MyResource(name='foo').name == 'foo'

  ## Args

  `*args`
    Each positional argument represents a parent key as used in the URL of the object. That is, each value will be used to fill in a segment of the URL which refers to some parent object. The order of these arguments must match the order they are specified in the URL, from left to right.
  `**kwargs`
    each entry will have its key set as an attribute name on the instance and its value will be the value of that attribute.

  ### Ancestors

  - Resource

  ### Static methods

  `def count_collection (*args, connection: HostConnection = None, **kwargs) -> int`

    Returns a count of all CifsSession resources that match the provided query

    This calls GET on the object to determine the number of records. It is more efficient than calling get_collection() because it will not construct any objects. Query parameters can be passed in as kwargs to determine a count of objects that match some filtered criteria.

    ## Args

    `*args`
      Each entry represents a parent key which is used to build the path to the child object. If the URL definition were /api/foos/{foo.name}/bars, then to get the count of bars for a particular foo, the foo.name value should be passed.
    `connection`
      The `HostConnection` object to use for this API call. If unset, tries to use the connection which is set globally for the library or from the current context.
    `**kwargs`
      Any key/value pairs passed will be sent as query parameters to the host. These query parameters can affect the count. A return_records query param will be ignored.

    ## Returns

    On success, returns an integer count of the objects of this type. On failure, returns -1.

    ## Raises

    `NetAppRestError`: If the API call returned a status code >= 400, or if there is no connection available to use either passed in or on the library.

  `def delete_collection (*args, records: Iterable[ForwardRef('CifsSession')] = None, body: Union[Resource, dict] = None, poll: bool = True, poll_interval: Optional[int] = None, poll_timeout: Optional[int] = None, connection: HostConnection = None, **kwargs) -> NetAppResponse`

    Deletes SMB session information on a node for an SVM. * To delete the specific SMB session information, pass the relevant SMB session's identifier and connection Id. * To delete all the SMB session information on specific node and SVM, pass the both SMB session's identifier and connection Id as zero(0) * To delete all the SMB session information on specific connection, pass the specific SMB session's Identifier value as zero(0). * To delete all the SMB session information on specific Identifier alone is not allowed.

    ### Related ONTAP commands

    - `vserver cifs session close`

    ### Learn more

    - `DOC /protocols/cifs/sessions`

    Delete all objects in a collection which match the given query.

    All records on the host which match the query will be deleted.

    ## Args

    `*args`
      Each entry represents a parent key which is used to build the path to the child object. If the URL definition were /api/foos/{foo.name}/bars, then to delete the collection of bars for a particular foo, the foo.name value should be passed.
    `records`
      Can be provided in place of a query. If so, this list of objects will be deleted from the host.
    `body`
      The body of the delete request. This could be a Resource instance or a dictionary object.
    `poll`
      If set to True, the call will not return until the asynchronous job on the host has completed. Has no effect if the host did not return a job response.
    `poll_interval`
      If the operation returns a job, this specifies how often to query the job for updates.
    `poll_timeout`
      If the operation returns a job, this specifies how long to continue monitoring the job's status for completion.
    `connection`
      The `HostConnection` object to use for this API call. If unset, tries to use the connection which is set globally for the library or from the current context.
    `**kwargs`
      Any key/value pairs passed will be sent as query parameters to the host. Only resources matching this query will be deleted.

    ## Returns

    A `NetAppResponse` object containing the details of the HTTP response.

    ## Raises

    `NetAppRestError`: If the API call returned a status code >= 400

  `def fast_get_collection (*args, connection: HostConnection = None, max_records: int = None, **kwargs) -> Iterable[RawResource]`

    Returns a list of RawResources that represent CifsSession resources that match the provided query

    Fetch a list of all objects of this type from the host.

        This is a lazy fetch, making API calls only as necessary when the result
        of this call is iterated over. For instance, if max_records is set to 5,
        then iterating over the collection causes an API call to be sent to the
        server once for every 5 records. If the client stops iterating before
        getting to the 6th record, then no additional API calls are made.

    ## Args

    `*args`
      Each entry represents a parent key which is used to build the path to the child object. If the URL definition were /api/foos/{foo.name}/bars, then to get the collection of bars for a particular foo, the foo.name value should be passed.
    `connection`
      The `HostConnection` object to use for this API call. If unset, tries to use the connection which is set globally for the library or from the current context.
    `max_records`
      The maximum number of records to return per call
    `raw`
      return a list of `netapp_ontap.resource.RawResource` objects that require to be promoted before any RESTful operations can be used on them. Setting this argument to True makes get_collection substantially quicker when many records are returned from the server.
    `**kwargs`
      Any key/value pairs passed will be sent as query parameters to the host.

    ## Returns

    A list of `Resource` objects

    ## Raises

    `NetAppRestError`: If there is no connection available to use either passed in or on the library. This would be not be raised when get_collection() is called, but rather when the result is iterated.

  `def find (*args, connection: HostConnection = None, **kwargs) -> Resource`

    Retrieves the CIFS sessions information for all SVMs.

    ### Related ONTAP commands

    - `vserver cifs session show -active-volumes`

    ### Learn more

    - `DOC /protocols/cifs/sessions`

    Find an instance of an object on the host given a query.

    The host will be queried with the provided key/value pairs to find a matching resource. If 0 are found, None will be returned. If more than 1 is found, an error will be raised or returned. If there is exactly 1 matching record, then it will be returned.

    ## Args

    `*args`
      Each entry represents a parent key which is used to build the path to the child object. If the URL definition were /api/foos/{foo.name}/bars, then to find a bar for a particular foo, the foo.name value should be passed.
    `connection`
      The `HostConnection` object to use for this API call. If unset, tries to use the connection which is set globally for the library or from the current context.
    `**kwargs`
      Any key/value pairs passed will be sent as query parameters to the host.

    ## Returns

    A `Resource` object containing the details of the object or None if no matches were found.

    ## Raises

    `NetAppRestError`: If the API call returned more than 1 matching resource.

  `def get_collection (*args, connection: HostConnection = None, max_records: int = None, **kwargs) -> Iterable[Resource]`

    Retrieves the CIFS sessions information for all SVMs.

    ### Related ONTAP commands

    - `vserver cifs session show -active-volumes`

    ### Learn more

    - `DOC /protocols/cifs/sessions`

    Fetch a list of all objects of this type from the host.

        This is a lazy fetch, making API calls only as necessary when the result
        of this call is iterated over. For instance, if max_records is set to 5,
        then iterating over the collection causes an API call to be sent to the
        server once for every 5 records. If the client stops iterating before
        getting to the 6th record, then no additional API calls are made.

    ## Args

    `*args`
      Each entry represents a parent key which is used to build the path to the child object. If the URL definition were /api/foos/{foo.name}/bars, then to get the collection of bars for a particular foo, the foo.name value should be passed.
    `connection`
      The `HostConnection` object to use for this API call. If unset, tries to use the connection which is set globally for the library or from the current context.
    `max_records`
      The maximum number of records to return per call
    `raw`
      return a list of `netapp_ontap.resource.RawResource` objects that require to be promoted before any RESTful operations can be used on them. Setting this argument to True makes get_collection substantially quicker when many records are returned from the server.
    `**kwargs`
      Any key/value pairs passed will be sent as query parameters to the host.

    ## Returns

    A list of `Resource` objects

    ## Raises

    `NetAppRestError`: If there is no connection available to use either passed in or on the library. This would be not be raised when get_collection() is called, but rather when the result is iterated.

  ### Methods

  `def delete (self, body: Union[Resource, dict] = None, poll: bool = True, poll_interval: Optional[int] = None, poll_timeout: Optional[int] = None, **kwargs) -> NetAppResponse`

    Deletes SMB session information on a node for an SVM. * To delete the specific SMB session information, pass the relevant SMB session's identifier and connection Id. * To delete all the SMB session information on specific node and SVM, pass the both SMB session's identifier and connection Id as zero(0) * To delete all the SMB session information on specific connection, pass the specific SMB session's Identifier value as zero(0). * To delete all the SMB session information on specific Identifier alone is not allowed.

    ### Related ONTAP commands

    - `vserver cifs session close`

    ### Learn more

    - `DOC /protocols/cifs/sessions`

    Send a deletion request to the host for this object.

    ## Args

    `body`
      The body of the delete request. This could be a Resource instance or a dictionary object.
    `poll`
      If set to True, the call will not return until the asynchronous job on the host has completed. Has no effect if the host did not return a job response.
    `poll_interval`
      If the operation returns a job, this specifies how often to query the job for updates.
    `poll_timeout`
      If the operation returns a job, this specifies how long to continue monitoring the job's status for completion.
    `connection`
      The `HostConnection` object to use for this API call. If unset, tries to use the connection which is set globally for the library or from the current context.
    `**kwargs`
      Any key/value pairs passed will be sent as query parameters to the host.

    ## Returns

    A `NetAppResponse` object containing the details of the HTTP response.

    ## Raises

    `NetAppRestError`: If the API call returned a status code >= 400

  `def get (self, **kwargs) -> NetAppResponse`

    Retrieves specific SMB session information for a specific SMB connection in a node on an SVM.

    ### Learn more

    - `DOC /protocols/cifs/sessions`

    Fetch the details of the object from the host.

    Requires the keys to be set (if any). After returning, new or changed properties from the host will be set on the instance.

    ## Returns

    A `NetAppResponse` object containing the details of the HTTP response.

    ## Raises

    `NetAppRestError`: If the API call returned a status code >= 400 or if not all of the keys required are present and config.STRICT_GET has been set to True.

  ### Inherited members

  - `Resource`:
    - `from_dict`
    - `get_collection_url`
    - `get_connection`
    - `instance_location`
    - `path_keys`
    - `poll`
    - `set_connection`
    - `to_dict`
    - `validate_schema`
`class CifsSessionSchema (*, only: types.StrSequenceOrSet | None = None, exclude: types.StrSequenceOrSet = (), many: bool | None = None, context: dict | None = None, load_only: types.StrSequenceOrSet = (), dump_only: types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet | None = None, unknown: str | None = None)`

  The fields of the CifsSession object

  ### Ancestors

  - netapp_ontap.resource.ResourceSchema
  - marshmallow.schema.Schema
  - marshmallow.base.SchemaABC
  - abc.ABC

  ### Class variables

  `authentication: str GET`

    SMB authentication over which the client accesses the share. The following values are supported:

    - none - No authentication
    - ntlmv1 - Ntlm version 1 mechanism
    - ntlmv2 - Ntlm version 2 mechanism
    - kerberos - Kerberos authentication
    - anonymous - Anonymous mechanism

    Valid choices:

    - none
    - ntlmv1
    - ntlmv2
    - kerberos
    - anonymous
  `client_ip: str GET`

    Specifies IP address of the client.

    Example: 10.74.7.182

  `connected_duration: str GET`

    Specifies an ISO-8601 format of date and time used to retrieve the connected time duration in hours, minutes, and seconds format.

    Example: P4DT84H30M5S

  `connection_count: Size GET`

    A counter used to track requests that are sent to the volumes to the node.

    Example: 0

  `connection_id: Size GET`

    A unique 32-bit unsigned number used to represent each SMB session's connection ID.

    Example: 22802

  `continuous_availability: str GET`

    The level of continuous availability protection provided to the SMB sessions and/or files.

    - unavailable - Open file is not continuously available. For sessions, it contains one or more open files but none of them are continuously available.
    - available - open file is continuously available. For sessions, it contains one or more open files and all of them are continuously available.
    - partial - Sessions only. Contains at least one continuously available open file with other files open but not continuously available.

    Valid choices:

    - unavailable
    - available
    - partial
  `identifier: Size GET`

    A unique 64-bit unsigned number used to represent each SMB session's identifier.

    Example: 4622663542519103507

  `idle_duration: str GET`

    Specifies an ISO-8601 format of date and time used to retrieve the idle time duration in hours, minutes, and seconds format.

    Example: P4DT84H30M5S

  `large_mtu: bool GET`

    Specifies whether the large MTU is enabled or not for an SMB session.

    Example: true

  `links: SelfLink GET`

    The links field of the cifs_session.

  `mapped_unix_user: str GET`

    Indicated that a mapped UNIX user has logged in.

    Example: root

  `node: Node GET POST PATCH`

    The node field of the cifs_session.

  `open_files: Size GET`

    Number of files the SMB session has opened.

  `open_other: Size GET`

    Number of other files the SMB session has opened.

  `open_shares: Size GET`

    Number of shares the SMB session has opened.

  `protocol: str GET`

    The SMB protocol version over which the client accesses the volumes. The following values are supported:

    - smb1 - SMB version 1
    - smb2 - SMB version 2
    - smb2_1 - SMB version 2 minor version 1
    - smb3 - SMB version 3
    - smb3_1 - SMB version 3 minor version 1

    Valid choices:

    - smb1
    - smb2
    - smb2_1
    - smb3
    - smb3_1
  `server_ip: str GET`

    Specifies the IP address of the SVM.

    Example: 10.140.78.248

  `smb_encryption: str GET`

    Indicates an SMB encryption state. The following values are supported:

    - unencrypted - SMB session is not encrypted
    - encrypted - SMB session is fully encrypted. SVM level encryption is enabled and encryption occurs for the entire session.
    - partially_encrypted - SMB session is partially encrypted. Share level encryption is enabled and encryption is initiated when the tree-connect occurs.

    Valid choices:

    - unencrypted
    - encrypted
    - partially_encrypted
  `smb_signing: bool GET`

    Specifies whether or not SMB signing is enabled.

    Example: false

  `svm: Svm GET POST PATCH`

    The svm field of the cifs_session.

  `user: str GET`

    Indicates that a Windows user has logged in.

    Example: NBCIFSQA2\administrator

  `volumes: List[Volume] GET POST PATCH`

    A group of volumes, the client is accessing.