# Module `netapp_ontap.resources.storage_bridge`

Copyright © 2022 NetApp Inc. All rights reserved.

## Retrieving storage bridge information

The storage bridge GET API retrieves all of the bridges in the cluster.

## Examples

### 1) Retrieves a list of bridges from the cluster

#### The following example shows the response with a list of bridges from the cluster:

    from netapp_ontap import HostConnection
    from netapp_ontap.resources import StorageBridge

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

Try it out

    [
        StorageBridge({"wwn": "2000001086a18100", "name": "ATTO_2000001086a18100"}),
        StorageBridge({"wwn": "2000001086a18380", "name": "ATTO_2000001086a18380"}),
    ]

### 2) Retrieves a specific bridge from the cluster

#### The following example shows the response of the requested bridge. If there is no bridge with the requested wwn, an error is returned.

    from netapp_ontap import HostConnection
    from netapp_ontap.resources import StorageBridge

    with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
        resource = StorageBridge(wwn="2000001086a18100")
        resource.get()
        print(resource)

Try it out

    StorageBridge(
        {
            "sas_ports": [
                {
                    "data_rate_capability": 12.0,
                    "enabled": True,
                    "phy_3": {"state": "online"},
                    "wwn": "5001086000a18100",
                    "id": 1,
                    "phy_4": {"state": "online"},
                    "state": "online",
                    "negotiated_data_rate": 6.0,
                    "phy_1": {"state": "online"},
                    "cable": {
                        "vendor": "Molex Inc.",
                        "part_number": "112-00431",
                        "serial_number": "618130935",
                        "technology": "Passive Copper 5m ID:00",
                    },
                    "phy_2": {"state": "online"},
                },
                {
                    "data_rate_capability": 12.0,
                    "enabled": False,
                    "phy_3": {"state": "offline"},
                    "wwn": "5001086000a18104",
                    "phy_4": {"state": "offline"},
                    "state": "offline",
                    "negotiated_data_rate": 0.0,
                    "phy_1": {"state": "offline"},
                    "phy_2": {"state": "offline"},
                },
                {
                    "data_rate_capability": 12.0,
                    "enabled": False,
                    "phy_3": {"state": "offline"},
                    "wwn": "5001086000a18108",
                    "phy_4": {"state": "offline"},
                    "state": "offline",
                    "negotiated_data_rate": 0.0,
                    "phy_1": {"state": "offline"},
                    "phy_2": {"state": "offline"},
                },
                {
                    "data_rate_capability": 12.0,
                    "enabled": False,
                    "phy_3": {"state": "offline"},
                    "wwn": "5001086000a1810c",
                    "phy_4": {"state": "offline"},
                    "state": "offline",
                    "negotiated_data_rate": 0.0,
                    "phy_1": {"state": "offline"},
                    "phy_2": {"state": "offline"},
                },
            ],
            "temperature_sensor": {
                "minimum": 0,
                "maximum": 90,
                "reading": 54,
                "state": "ok",
                "name": "Chassis Temperature Sensor",
            },
            "last_reboot": {
                "time": "2020-12-09T00:47:58-05:00",
                "reason": {
                    "code": "39321683",
                    "message": 'Reason: "FirmwareRestart Command".',
                },
            },
            "dram_single_bit_error_count": 0,
            "serial_number": "FB7500N102450",
            "symbolic_name": "RTP-FCSAS02-41KK10",
            "managed_by": "in_band",
            "monitoring_enabled": True,
            "wwn": "2000001086a18100",
            "ip_address": "10.226.57.178",
            "vendor": "atto",
            "state": "ok",
            "chassis_throughput_state": "ok",
            "firmware_version": "3.10 007A",
            "fc_ports": [
                {
                    "data_rate_capability": 16.0,
                    "enabled": True,
                    "wwn": "2100001086a18100",
                    "id": 1,
                    "configured_data_rate": 8.0,
                    "state": "online",
                    "negotiated_data_rate": 8.0,
                    "sfp": {
                        "vendor": "FINISAR CORP.",
                        "data_rate_capability": 16.0,
                        "part_number": "FTLF8529P3BCV",
                        "serial_number": "UW106SA",
                    },
                    "peer_wwn": "0000000000000000",
                },
                {
                    "data_rate_capability": 16.0,
                    "enabled": True,
                    "wwn": "2200001086a18100",
                    "id": 2,
                    "configured_data_rate": 16.0,
                    "state": "online",
                    "negotiated_data_rate": 16.0,
                    "sfp": {
                        "vendor": "FINISAR CORP.",
                        "data_rate_capability": 16.0,
                        "part_number": "FTLF8529P3BCV",
                        "serial_number": "UW1072B",
                    },
                    "peer_wwn": "0000000000000000",
                },
            ],
            "model": "FibreBridge 7500N",
            "security_enabled": False,
            "power_supply_units": [
                {"state": "ok", "name": "A"},
                {"state": "ok", "name": "B"},
            ],
            "paths": [
                {
                    "target_port": {"wwn": "2100001086a18380"},
                    "node": {
                        "_links": {
                            "self": {
                                "href": "/api/cluster/nodes/ecc3d992-3a86-11eb-9fab-00a0985a6024"
                            }
                        },
                        "uuid": "ecc3d992-3a86-11eb-9fab-00a0985a6024",
                        "name": "sti8080mcc-htp-005",
                    },
                    "name": "0e",
                }
            ],
            "name": "ATTO_2000001086a18100",
        }
    )

## Classes

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

  Allows interaction with StorageBridge 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`

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

    ### Related ONTAP commands

    - `storage bridge show`

    ### Learn more

    - `DOC /storage/bridges`

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

    ### Related ONTAP commands

    - `storage bridge show`

    ### Learn more

    - `DOC /storage/bridges`

    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 bridge

    ### Related ONTAP commands

    - `storage bridge show`

    ### Learn more

    - `DOC /storage/bridges`

    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

  - `Resource`:
    - `from_dict`
    - `get_collection_url`
    - `get_connection`
    - `instance_location`
    - `path_keys`
    - `poll`
    - `set_connection`
    - `to_dict`
`class StorageBridgeSchema (*, 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 StorageBridge object

  ### Ancestors

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

  ### Class variables

  `chassis_throughput_state GET`

    Chassis throughput status

    Valid choices:

    - ok
    - warning
  `dram_single_bit_error_count GET`

    The dram_single_bit_error_count field of the storage_bridge.

  `errors GET`

    The errors field of the storage_bridge.

  `fc_ports GET`

    The fc_ports field of the storage_bridge.

  `firmware_version GET`

    Bridge firmware version

    Example: 4.10 007A

  `ip_address GET`

    IP Address

  `last_reboot GET`

    The last_reboot field of the storage_bridge.

  `managed_by GET`

    The managed_by field of the storage_bridge.

    Valid choices:

    - snmp
    - in_band
  `model GET`

    Bridge model

    Example: FibreBridge6500N

  `monitoring_enabled GET`

    Indicates whether monitoring is enabled for the bridge.

  `name GET`

    Bridge name

    Example: ATTO_FibreBridge6500N_1

  `paths GET`

    The paths field of the storage_bridge.

  `power_supply_units GET`

    The power_supply_units field of the storage_bridge.

  `sas_ports GET`

    The sas_ports field of the storage_bridge.

  `security_enabled GET`

    Indicates whether security is enabled for the bridge.

  `serial_number GET`

    Bridge serial number

    Example: FB7600N100004

  `state GET`

    Bridge state

    Valid choices:

    - unknown
    - ok
    - error
  `symbolic_name GET`

    Bridge symbolic name

    Example: rtp-fcsas03-41kk11

  `temperature_sensor GET`

    The temperature_sensor field of the storage_bridge.

  `vendor GET`

    Bridge vendor

    Valid choices:

    - unknown
    - atto
  `wwn GET`

    Bridge world wide name

    Example: 2000001086600476