Module netapp_ontap.resources.cifs_session

Copyright © 2022 NetApp Inc. All rights reserved.

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(return_timeout=15)))

[
    CifsSession(
        {
            "connection_id": 91842,
            "node": {
                "uuid": "85d46998-4e5d-11ea-afb1-0050568ec4e4",
                "name": "bkalyan-vsim1",
            },
            "identifier": 625718873227788300,
            "connection_count": 1,
            "svm": {"uuid": "fc824aa8-4e60-11ea-afb1-0050568ec4e4", "name": "vs1"},
        }
    ),
    CifsSession(
        {
            "connection_id": 92080,
            "node": {
                "uuid": "85d46998-4e5d-11ea-afb1-0050568ec4e4",
                "name": "bkalyan-vsim1",
            },
            "identifier": 625718873227788500,
            "connection_count": 1,
            "svm": {"uuid": "fc824aa8-4e60-11ea-afb1-0050568ec4e4", "name": "vs1"},
        }
    ),
]


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=91842,
        identifier=625718873227788300,
        **{
            "svm.uuid": "fc824aa8-4e60-11ea-afb1-0050568ec4e4",
            "node.uuid": "85d46998-4e5d-11ea-afb1-0050568ec4e4",
        }
    )
    resource.get(fields="*")
    print(resource)

CifsSession(
    {
        "connection_id": 91842,
        "node": {
            "uuid": "85d46998-4e5d-11ea-afb1-0050568ec4e4",
            "name": "bkalyan-vsim1",
        },
        "identifier": 625718873227788300,
        "connection_count": 1,
        "svm": {"uuid": "fc824aa8-4e60-11ea-afb1-0050568ec4e4", "name": "vs1"},
    }
)


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": "fc824aa8-4e60-11ea-afb1-0050568ec4e4",
            "node.uuid": "85d46998-4e5d-11ea-afb1-0050568ec4e4",
        }
    )
    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=91842,
        identifier=0,
        **{
            "svm.uuid": "fc824aa8-4e60-11ea-afb1-0050568ec4e4",
            "node.uuid": "85d46998-4e5d-11ea-afb1-0050568ec4e4",
        }
    )
    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=91842,
        identifier=625718873227788300,
        **{
            "svm.uuid": "fc824aa8-4e60-11ea-afb1-0050568ec4e4",
            "node.uuid": "85d46998-4e5d-11ea-afb1-0050568ec4e4",
        }
    )
    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

Static methods

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

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

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: Union[int, NoneType] = None, poll_timeout: Union[int, NoneType] = 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 relavant 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.

Learn more


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 find(*args, connection: HostConnection = None, **kwargs) -> Resource

Retrieves the CIFS sessions information for all SVMs.

  • vserver cifs session show -active-volumes

Learn more


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.

  • vserver cifs session show -active-volumes

Learn more


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
**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: Union[int, NoneType] = None, poll_timeout: Union[int, NoneType] = None, **kwargs) -> NetAppResponse

Deletes SMB session information on a node for an SVM. * To delete the specific SMB session information, pass the relavant 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.

Learn more


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.
**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


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

Inherited members

class CifsSessionSchema (*, only: Union[Sequence[str], Set[str]] = None, exclude: Union[Sequence[str], Set[str]] = (), many: bool = False, context: Dict = None, load_only: Union[Sequence[str], Set[str]] = (), dump_only: Union[Sequence[str], Set[str]] = (), partial: Union[bool, Sequence[str], Set[str]] = False, unknown: str = None)

The fields of the CifsSession object

Ancestors

  • netapp_ontap.resource.ResourceSchema
  • marshmallow.schema.Schema
  • marshmallow.base.SchemaABC

Class variables

authentication 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 GET

Specifies IP address of the client.

Example: 10.74.7.182

connected_duration 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 GET

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

Example: 0

connection_id GET

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

Example: 22802

continuous_availability GET

The level of continuous availabilty 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 GET

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

Example: 4622663542519103507

idle_duration 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 GET

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

Example: true

The links field of the cifs_session.

mapped_unix_user GET

Indicated that a mapped UNIX user has logged in.

Example: root

node GET POST PATCH

The node field of the cifs_session.

open_files GET

Number of files the SMB session has opened.

open_other GET

Number of other files the SMB session has opened.

open_shares GET

Number of shares the SMB session has opened.

protocol 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 GET

Specifies the IP address of the SVM.

Example: 10.140.78.248

smb_encryption 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 GET

Specifies whether or not SMB signing is enabled.

Example: false

svm GET POST PATCH

The svm field of the cifs_session.

user GET

Indicates that a Windows user has logged in.

Example: NBCIFSQA2\administrator

volumes GET POST PATCH

A group of volumes, the client is accessing.