Module netapp_ontap.resources.storage_switch

Copyright © 2022 NetApp Inc. All rights reserved.

Retrieving storage switch information

The storage switch GET API retrieves all of the switches in the cluster.


Examples

1) Retrieves a list of storage switches from the cluster

The following example shows the response with a list of storage switches in the cluster:


from netapp_ontap import HostConnection
from netapp_ontap.resources import StorageSwitch

with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
    print(list(StorageSwitch.get_collection()))

[
    StorageSwitch({"name": "Brocade_10.226.57.206"}),
    StorageSwitch({"name": "Brocade_10.226.57.207"}),
    StorageSwitch({"name": "Brocade_10.226.57.208"}),
    StorageSwitch({"name": "Brocade_10.226.57.209"}),
]


2) Retrieves a specific storage switch from the cluster

The following example shows the response of the requested storage switch. If there is no storage switch with the requested name, an error is returned.


from netapp_ontap import HostConnection
from netapp_ontap.resources import StorageSwitch

with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
    resource = StorageSwitch(name="Brocade_10.226.57.206")
    resource.get()
    print(resource)

StorageSwitch(
    {
        "local": False,
        "fans": [
            {"state": "ok", "name": "FAN #1", "speed": 7336},
            {"state": "ok", "name": "FAN #2", "speed": 7336},
        ],
        "role": "subordinate",
        "symbolic_name": "rtp-fc01-41kk11",
        "monitoring_enabled": True,
        "wwn": "100050eb1a1ef7d7",
        "temperature_sensors": [
            {"state": "ok", "name": "SLOT #0: TEMP #1", "reading": 52}
        ],
        "ip_address": "10.226.57.206",
        "vendor": "brocade",
        "state": "ok",
        "domain_id": 5,
        "connections": [
            {
                "source_port": {
                    "mode": "f_port",
                    "wwn": "200050eb1a236efd",
                    "name": "FC port 0/0",
                },
                "peer_port": {
                    "type": "fcvi_adapter",
                    "connection": "sti8020mcc-htp-006:fcvi_device_1",
                    "unique_id": "38993dc0-4ea1-11eb-9331-00a0985bd455",
                    "wwn": "2100000e1e30ac5f",
                },
            },
            {
                "source_port": {
                    "mode": "f_port",
                    "wwn": "200150eb1a236efd",
                    "name": "FC port 0/1",
                },
                "peer_port": {
                    "type": "fcp_adapter",
                    "connection": "sti8020mcc-htp-006:2b",
                    "unique_id": "38993dc0-4ea1-11eb-9331-00a0985bd455",
                    "wwn": "21000024ff72c0c9",
                },
            },
            {
                "source_port": {
                    "mode": "f_port",
                    "wwn": "200250eb1a236efd",
                    "name": "FC port 0/2",
                },
                "peer_port": {
                    "type": "fcp_adapter",
                    "connection": "sti8020mcc-htp-006:2d",
                    "unique_id": "38993dc0-4ea1-11eb-9331-00a0985bd455",
                    "wwn": "21000024ff72c0cb",
                },
            },
        ],
        "model": "Brocade6510",
        "ports": [
            {
                "mode": "f_port",
                "enabled": True,
                "wwn": "200050eb1a1ef7d7",
                "state": "online",
                "sfp": {
                    "type": "small_form_factor",
                    "transmitter_type": "short_wave_laser",
                    "serial_number": "HAA2140310058E5",
                },
                "name": "FC port 0/0",
                "speed": 16,
            },
            {
                "mode": "f_port",
                "enabled": True,
                "wwn": "200050eb1a1ef2d7",
                "state": "online",
                "sfp": {
                    "type": "small_form_factor",
                    "transmitter_type": "short_wave_laser",
                    "serial_number": "HAA2140310058E5",
                },
                "name": "FC port 0/1",
                "speed": 16,
            },
            {
                "mode": "f_port",
                "enabled": True,
                "wwn": "200050eb1a1ef7d0",
                "state": "online",
                "sfp": {
                    "type": "small_form_factor",
                    "transmitter_type": "short_wave_laser",
                    "serial_number": "HAA2140310058E5",
                },
                "name": "FC port 0/2",
                "speed": 16,
            },
            {
                "mode": "f_port",
                "enabled": True,
                "wwn": "200050eb1a1ef7d7",
                "state": "online",
                "sfp": {
                    "type": "small_form_factor",
                    "transmitter_type": "short_wave_laser",
                    "serial_number": "HAA2140310058E5",
                },
                "name": "FC port 0/3",
                "speed": 16,
            },
            {
                "mode": "f_port",
                "enabled": True,
                "wwn": "200050eb1a1ef2d7",
                "state": "online",
                "sfp": {
                    "type": "small_form_factor",
                    "transmitter_type": "short_wave_laser",
                    "serial_number": "HAA2140310058E5",
                },
                "name": "FC port 0/4",
                "speed": 16,
            },
            {
                "mode": "f_port",
                "enabled": True,
                "wwn": "200050eb1a1ef7d0",
                "state": "online",
                "sfp": {
                    "type": "small_form_factor",
                    "transmitter_type": "short_wave_laser",
                    "serial_number": "HAA2140310058E5",
                },
                "name": "FC port 0/5",
                "speed": 16,
            },
        ],
        "power_supply_units": [
            {"state": "ok", "name": "Power Supply #1"},
            {"state": "ok", "name": "Power Supply #2"},
        ],
        "paths": [
            {
                "port": {"name": "FC port 0/4", "speed": 8},
                "node": {
                    "_links": {
                        "self": {
                            "href": "/api/cluster/nodes/382cb083-4416-11eb-ad1d-00a0985bd455"
                        }
                    },
                    "uuid": "382cb083-4416-11eb-ad1d-00a0985bd455",
                    "name": "sti8020mcc-htp-005",
                },
                "adapter": {
                    "type": "fcp_initiator",
                    "name": "2a",
                    "wwn": "21000024ff6c4bc0",
                },
            },
            {
                "port": {"name": "FC port 0/5", "speed": 8},
                "node": {
                    "_links": {
                        "self": {
                            "href": "/api/cluster/nodes/382cb083-4416-11eb-ad1d-00a0985bd455"
                        }
                    },
                    "uuid": "382cb083-4416-11eb-ad1d-00a0985bd455",
                    "name": "sti8020mcc-htp-005",
                },
                "adapter": {
                    "type": "fcp_initiator",
                    "name": "2c",
                    "wwn": "21000024ff6c4bc2",
                },
            },
            {
                "port": {"name": "FC port 0/3", "speed": 16},
                "node": {
                    "_links": {
                        "self": {
                            "href": "/api/cluster/nodes/382cb083-4416-11eb-ad1d-00a0985bd455"
                        }
                    },
                    "uuid": "382cb083-4416-11eb-ad1d-00a0985bd455",
                    "name": "sti8020mcc-htp-005",
                },
                "adapter": {
                    "type": "fc_vi",
                    "name": "fcvi_device_0",
                    "wwn": "2100000e1e09d5d2",
                },
            },
            {
                "port": {"name": "FC port 0/1", "speed": 8},
                "node": {
                    "_links": {
                        "self": {
                            "href": "/api/cluster/nodes/364fbba8-4416-11eb-8e72-00a098431045"
                        }
                    },
                    "uuid": "364fbba8-4416-11eb-8e72-00a098431045",
                    "name": "sti8020mcc-htp-006",
                },
                "adapter": {
                    "type": "fcp_initiator",
                    "name": "2a",
                    "wwn": "21000024ff72c0c8",
                },
            },
            {
                "port": {"name": "FC port 0/2", "speed": 8},
                "node": {
                    "_links": {
                        "self": {
                            "href": "/api/cluster/nodes/364fbba8-4416-11eb-8e72-00a098431045"
                        }
                    },
                    "uuid": "364fbba8-4416-11eb-8e72-00a098431045",
                    "name": "sti8020mcc-htp-006",
                },
                "adapter": {
                    "type": "fcp_initiator",
                    "name": "2c",
                    "wwn": "21000024ff72c0ca",
                },
            },
        ],
        "name": "Brocade_10.226.57.206",
    }
)


Classes

class StorageSwitch (*args, **kwargs)

The Storage switch object describes the storage switch properties, features and cabling.

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

Retrieves a collection of storage switches.

  • storage switch 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, 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 a collection of storage switches.

  • storage switch show

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 get(self, **kwargs) -> NetAppResponse

Retrieves a specific storage switch.

  • storage switch 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

Inherited members

class StorageSwitchSchema (*, 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 StorageSwitch object

Ancestors

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

Class variables

connections GET

The connections field of the storage_switch.

director_class GET

The director_class field of the storage_switch.

domain_id GET

Domain ID

errors GET

The errors field of the storage_switch.

fabric_name GET

Storage switch fabric name

fans GET

The fans field of the storage_switch.

firmware_version GET

Storage switch firmware version

ip_address GET

IP Address

local GET

Indicates whether the storage switch is directly connected to the reporting cluster.

model GET

Storage switch model.

monitored_blades GET

Indicates the blades that are being monitored for a director-class switch.

monitoring_enabled GET

Indicates whether monitoring is enabled for the storage switch.

name GET

Storage switch name

paths GET

The paths field of the storage_switch.

ports GET

The ports field of the storage_switch.

power_supply_units GET

The power_supply_units field of the storage_switch.

role GET

Storage switch role in fabric.

Valid choices:

  • unknown
  • primary
  • subordinate
state GET

Storage switch state

Valid choices:

  • ok
  • error
symbolic_name GET

Storage switch symbolic name

temperature_sensors GET

The temperature_sensors field of the storage_switch.

vendor GET

Storage switch vendor

Valid choices:

  • unknown
  • brocade
  • cisco
vsans GET

The vsans field of the storage_switch.

wwn GET

Storage switch world wide name

zones GET

The zones field of the storage_switch.