Module netapp_ontap.resources.cifs_service

Copyright © 2019 NetApp Inc. All rights reserved.

Overview

A CIFS server is necessary to provide SMB clients with access to the Storage Virtual Machine (SVM). Before you begin, the following prerequisites must be in place:

  • At least one SVM LIF must exist on the SVM.
  • The LIFs must be able to connect to the DNS servers configured on the SVM and to an Active Directory domain controller of the domain to which you want to join the CIFS server.
  • The DNS servers must contain the service location records that are needed to locate the Active Directory domain services.
  • The cluster time must be synchronized to within five minutes of the Active Directory domain controller.

Information on the CIFS server

You must keep the following in mind when creating the CIFS server:

  • The CIFS server name might or might not be the same as the SVM name.
  • The CIFS server name can be up to 15 characters in length.
  • The following characters are not allowed: @ # * ( ) = + [ ] | ; : " , < > \ / ?
  • You must use the FQDN when specifying the domain.
  • The default is to add the CIFS server machine account to the Active Directory "CN=Computer" object.
  • You can choose to add the CIFS server to a different organizational unit (OU) by specifying the "organizational_unit" parameter. When specifying the OU, do not specify the domain portion of the distinguished name; only specify the OU or CN portion of the distinguished name. ONTAP appends the value provided for the required "-domain" parameter onto the value provided for the "-ou" parameter to create the Active Directory distinguished name, which is used when joining the Active Directory domain.
  • You can optionally choose to add a text comment of up to 48 characters about the CIFS server. If there is a space in the comment text, you must enclose the entire string in quotation marks.
  • You can optionally choose to add a comma-delimited list of one or more NetBIOS aliases for the CIFS server.
  • The initial administrative status of the CIFS server is "up".
  • The large-mtu and multichannel features are enabled for the new CIFS server.
  • If LDAP is configured with the use_start_tls and session_security features, the new CIFS server will also have this property set.

Examples

Creating a CIFS server

To create a CIFS server, use the following API. Note the return_records=true query parameter used to obtain the newly created entry in the response.


# The API:
POST /api/protocols/cifs/services
# The call:
curl -X POST "https://<mgmt-ip>/api/protocols/cifs/services?return_records=true" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \"ad_domain\": { \"fqdn\": \"CIFS-2008R2-AD.GDL.ENGLAB.NETAPP.COM\", \"organizational_unit\": \"CN=Computers\", \"password\": \"cifs*123\", \"user\": \"administrator\" }, \"comment\": \"This CIFS Server Belongs to CS Department\", \"default_unix_user\": \"string\", \"enabled\": true, \"name\": \"CIFS-DOC\", \"netbios\": { \"aliases\": [ \"ALIAS_1\", \"ALIAS_2\", \"ALIAS_3\" ], \"enabled\": false, \"wins_servers\": [ \"10.224.65.20\", \"10.224.65.21\" ] }, \"security\": { \"kdc_encryption\": false, \"restrict_anonymous\": \"no_enumeration\", \"smb_encryption\": false, \"smb_signing\": false }, \"svm\": { \"name\": \"vs1\", \"uuid\": \"ef087155-f9e2-11e8-ac52-0050568ea248\" }}"
# The response:
{
  "num_records": 1,
  "records": [
    {
      "svm": {
        "uuid": "9f5ab4cb-f703-11e8-91cc-0050568eca13",
        "name": "vs1"
      },
      "name": "CIFS-DOC",
      "ad_domain": {
        "fqdn": "CIFS-2008R2-AD.GDL.ENGLAB.NETAPP.COM",
        "user": "administrator",
        "password": "cifs*123",
        "organizational_unit": "CN=Computers"
      },
      "enabled": true,
      "comment": "This CIFS Server Belongs to CS Department",
      "security": {
        "restrict_anonymous": "no_enumeration",
        "smb_signing": false,
        "smb_encryption": false,
        "kdc_encryption": false
      },
      "netbios": {
        "aliases": [
          "ALIAS_1",
          "ALIAS_2",
          "ALIAS_3"
        ],
        "wins_servers": [
          "10.224.65.20",
          "10.224.65.21"
        ],
        "enabled": false
      },
      "default_unix_user": "string"
    }
  ],
  "job": {
    "uuid": "f232b6da-00a4-11e9-a8c1-0050568eca13",
    "_links": {
      "self": {
        "href": "/api/cluster/jobs/f232b6da-00a4-11e9-a8c1-0050568eca13"
      }
    }
  }
}

Retrieving the full CIFS server configuration for all SVMs in the cluster


# The API:
GET /api/protocols/cifs/services
# The call:
curl -X GET "https://<mgmt-ip>/api/protocols/cifs/services?fields=*&return_records=true&return_timeout=15" -H "accept: application/json"
# The response:
{
  "records": [
    {
      "svm": {
        "uuid": "9f5ab4cb-f703-11e8-91cc-0050568eca13",
        "name": "vs1"
      },
      "name": "CIFS-DOC",
      "ad_domain": {
        "fqdn": "CIFS-2008R2-AD.GDL.ENGLAB.NETAPP.COM",
        "organizational_unit": "CN=Computers"
      },
      "enabled": true,
      "comment": "This CIFS Server Belongs to CS Department",
      "security": {
        "restrict_anonymous": "no_enumeration",
        "smb_signing": false,
        "smb_encryption": false,
        "kdc_encryption": false
      },
      "netbios": {
        "aliases": [
          "ALIAS_1",
          "ALIAS_2",
          "ALIAS_3"
        ],
        "wins_servers": [
          "10.224.65.20",
          "10.224.65.21"
        ],
        "enabled": false
      },
      "default_unix_user": "string"
    }
  ],
  "num_records": 1
}

Retrieving CIFS server configuration details for a specific SVM


# The API:
GET /api/protocols/cifs/services/{svm.uuid}
# The call:
curl -X GET "https://<mgmt-ip>/api/protocols/cifs/services/9f5ab4cb-f703-11e8-91cc-0050568eca13" -H "accept: application/json"
# The response:
{
  "svm": {
    "uuid": "9f5ab4cb-f703-11e8-91cc-0050568eca13",
    "name": "vs1"
  },
  "name": "CIFS-DOC",
  "ad_domain": {
    "fqdn": "CIFS-2008R2-AD.GDL.ENGLAB.NETAPP.COM",
    "organizational_unit": "CN=Computers"
  },
  "enabled": true,
  "comment": "This CIFS Server Belongs to CS Department",
  "security": {
    "restrict_anonymous": "no_enumeration",
    "smb_signing": false,
    "smb_encryption": false,
    "kdc_encryption": false
  },
  "netbios": {
    "aliases": [
      "ALIAS_1",
      "ALIAS_2",
      "ALIAS_3"
    ],
    "wins_servers": [
      "10.224.65.20",
      "10.224.65.21"
    ],
    "enabled": false
  },
  "default_unix_user": "string"
}

Updating CIFS server properties for the specified SVM


# The API:
PATCH /api/protocols/cifs/services/{svm.uuid}
# The call:
curl -X PATCH "https://<mgmt-ip>/api/protocols/cifs/services/9f5ab4cb-f703-11e8-91cc-0050568eca13" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \"comment\": \"CIFS SERVER MODIFICATION\" }"

Removing a CIFS server for a specific SVM

To delete a CIFS server, use the following API. This will delete the CIFS server along with other CIFS configurations such as CIFS share, share ACLs, homedir search-path, and so on.


# The API:
DELETE /api/protocols/cifs/services/{svm.uuid}
# The call:
curl -X DELETE "https://<mgmt-ip>/api/protocols/cifs/services/9f5ab4cb-f703-11e8-91cc-0050568eca13" -H "accept: application/json" -H "Content-Type: application/json" -d "{\"ad_domain\": { \"password\": \"cifs*123\", \"user\": \"administrator\" } }"

Classes

class CifsService (*args, **kwargs)

Allows interaction with CifsService 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 delete_collection(*args, connection: HostConnection = None, **kwargs) -> NetAppResponse

Deletes a CIFS server and related CIFS configurations.

  • vserver cifs server delete
  • vserver cifs remove-netbios-aliases

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

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 CIFS servers.

  • vserver cifs server show
  • vserver cifs server options show
  • vserver cifs server security show

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

Raises

NetAppRestError: If the API call did not return exactly 1 matching resource.

def get_collection(*args, connection: HostConnection = None, max_records: int = None, **kwargs) -> typing.Iterable

Retrieves CIFS servers.

  • vserver cifs server show
  • vserver cifs server options show
  • vserver cifs server security show

Learn more


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

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.

def patch_collection(body: dict, *args, connection: HostConnection = None, **kwargs) -> NetAppResponse

Updates both the mandatory and optional parameters of the CIFS configuration. Ensure the CIFS server is administratively disabled when renaming the CIFS server or modifying the ad_domain properties.

  • vserver cifs server modify
  • vserver cifs server options modify
  • vserver cifs security modify
  • vserver cifs server add-netbios-aliases
  • vserver cifs server remove-netbios-aliases

Learn more


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

All records on the host which match the query will be patched with the provided body.

Args

body
A dictionary of name/value pairs to set on all matching members of the collection.
*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 patch 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.
**kwargs
Any key/value pairs passed will be sent as query parameters to the host. Only resources matching this query will be patched.

Returns

A NetAppResponse object containing the details of the HTTP response.

Raises

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

Methods

def delete(self, poll: bool = True, poll_interval: typing.Union = None, poll_timeout: typing.Union = None, **kwargs) -> NetAppResponse

Deletes a CIFS server and related CIFS configurations.

  • vserver cifs server delete
  • vserver cifs remove-netbios-aliases

Learn more


Send a deletion request to the host for this object.

Args

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 a CIFS server.

  • vserver cifs server show
  • vserver cifs server options show
  • vserver cifs server security show

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

def patch(self, hydrate: bool = False, poll: bool = True, poll_interval: typing.Union = None, poll_timeout: typing.Union = None, **kwargs) -> NetAppResponse

Updates both the mandatory and optional parameters of the CIFS configuration. Ensure the CIFS server is administratively disabled when renaming the CIFS server or modifying the ad_domain properties.

  • vserver cifs server modify
  • vserver cifs server options modify
  • vserver cifs security modify
  • vserver cifs server add-netbios-aliases
  • vserver cifs server remove-netbios-aliases

Learn more


Send the difference in the object's state to the host as a modification request.

Calculates the difference in the object's state since the last time we interacted with the host and sends this in the request body.

Args

hydrate
If set to True, after the response is received from the call, a a GET call will be made to refresh all fields of the 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 post(self, hydrate: bool = False, poll: bool = True, poll_interval: typing.Union = None, poll_timeout: typing.Union = None, **kwargs) -> NetAppResponse

Creates a CIFS server. Each SVM can have one CIFS server.

Important notes

  • The CIFS server name might or might not be the same as the SVM name.
  • The CIFS server name can contain up to 15 characters.
  • The CIFS server name does not support the following characters: @ # * ( ) = + [ ] | ; : " , < > / ?

Required properties

  • svm.uuid or svm.name - Existing SVM in which to create the CIFS server.
  • name - Name of the CIFS server.
  • ad_domain.fqdn - Fully qualified domain name of the Windows Active Directory to which this CIFS server belongs.
  • ad_domain.user - User account with the access to add the CIFS server to the Active Directory.
  • ad_domain.password - Account password used to add this CIFS server to the Active Directory.
  • comment - Add a text comment of up to 48 characters about the CIFS server.
  • netbios.aliases - Add a comma-delimited list of one or more NetBIOS aliases for the CIFS server.
  • netbios.wins_servers - Add a list of Windows Internet Name Server (WINS) addresses that manage and map the NetBIOS name of the CIFS server to their network IP addresses. The IP addresses must be IPv4 addresses.

Default property values

If not specified in POST, the following default property values are assigned: * ad_domain.organizational_unit - CN=Computers * enabled - true * restrict_anonymous - no_enumeration * smb_signing - false * smb_encryption - false * kdc_encryption - false * default_unix_user - pcuser * netbios_enabled - false However, if either "netbios.wins-server" or "netbios.aliases" is set during POST and if netbios_enabled is not specified then netbios_enabled is set to true.

  • vserver cifs server create
  • vserver cifs server options modify
  • vserver cifs security modify
  • vserver cifs server add-netbios-aliases

Learn more


Send this object to the host as a creation request.

Args

hydrate
If set to True, after the response is received from the call, a a GET call will be made to refresh all fields of the 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

Inherited members

class CifsServiceSchema (only=None, exclude=(), many=False, context=None, load_only=(), dump_only=(), partial=False, unknown=None)

The fields of the CifsService object

Ancestors

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

Class variables

var ad_domain

The ad_domain field of the cifs_service.

var comment

A descriptive text comment for the CIFS server. SMB clients can see the CIFS server comment when browsing servers on the network. If there is a space in the comment, you must enclose the entire string in quotation marks.

Example: This CIFS Server Belongs to CS Department

var default_unix_user

Specifies the UNIX user to which any authenticated CIFS user is mapped to, if the normal user mapping rules fails.

var enabled

Specifies if the CIFS service is administratively enabled.

The links field of the cifs_service.

var name

The name of the CIFS server.

Example: CIFS1

var netbios

The netbios field of the cifs_service.

var opts
var security

The security field of the cifs_service.

var svm

The svm field of the cifs_service.