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

# Module `netapp_ontap.resources.broadcast_domain`

Copyright © 2020 NetApp Inc. All rights reserved.

## Overview

A broadcast domain is a collection of Ethernet ports that have layer 2 connectivity. They are used to determine which Ethernet ports can host interfaces of various types. The broadcast domain REST API allows you to retrieve, create, modify, and delete broadcast domains. The broadcast domain APIs do not manage port membership. To add a port to a broadcast domain or to move a port to a different broadcast domain, use PATCH /network/ethernet/ports/.

## Retrieving network Ethernet broadcast domain information

The broadcast domains GET API retrieves and displays relevant information pertaining to the broadcast domains configured in the cluster. The API retrieves the list of all broadcast domains configured in the cluster, or a specific broadcast domain.

## Examples

### Retrieving all broadcast domains in the cluster

The following output shows the list of all broadcast domains configured in a cluster.

    from netapp_ontap import HostConnection
    from netapp_ontap.resources import BroadcastDomain

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

Try it out

    [
        BroadcastDomain(
            {
                "ipspace": {
                    "uuid": "6267eff8-f34f-11e8-8373-005056bb6b85",
                    "_links": {
                        "self": {
                            "href": "/api/network/ipspaces/6267eff8-f34f-11e8-8373-005056bb6b85"
                        }
                    },
                    "name": "Cluster",
                },
                "uuid": "6970c2a9-f34f-11e8-8373-005056bb6b85",
                "mtu": 9000,
                "_links": {
                    "self": {
                        "href": "/api/network/ethernet/broadcast-domains/6970c2a9-f34f-11e8-8373-005056bb6b85"
                    }
                },
                "ports": [
                    {
                        "uuid": "626b4d19-f34f-11e8-8373-005056bb6b85",
                        "_links": {
                            "self": {
                                "href": "/api/network/ethernet/ports/626b4d19-f34f-11e8-8373-005056bb6b85"
                            }
                        },
                        "name": "e0a",
                        "node": {"name": "examplecluster-node01"},
                    },
                    {
                        "uuid": "626b77b9-f34f-11e8-8373-005056bb6b85",
                        "_links": {
                            "self": {
                                "href": "/api/network/ethernet/ports/626b77b9-f34f-11e8-8373-005056bb6b85"
                            }
                        },
                        "name": "e0b",
                        "node": {"name": "examplecluster-node01"},
                    },
                ],
                "name": "Cluster",
            }
        ),
        BroadcastDomain(
            {
                "ipspace": {
                    "uuid": "5f650349-f34f-11e8-8373-005056bb6b85",
                    "_links": {
                        "self": {
                            "href": "/api/network/ipspaces/5f650349-f34f-11e8-8373-005056bb6b85"
                        }
                    },
                    "name": "Default",
                },
                "uuid": "6972416c-f34f-11e8-8373-005056bb6b85",
                "mtu": 1500,
                "_links": {
                    "self": {
                        "href": "/api/network/ethernet/broadcast-domains/6972416c-f34f-11e8-8373-005056bb6b85"
                    }
                },
                "ports": [
                    {
                        "uuid": "626bae19-f34f-11e8-8373-005056bb6b85",
                        "_links": {
                            "self": {
                                "href": "/api/network/ethernet/ports/626bae19-f34f-11e8-8373-005056bb6b85"
                            }
                        },
                        "name": "e0c",
                        "node": {"name": "examplecluster-node01"},
                    },
                    {
                        "uuid": "626bd677-f34f-11e8-8373-005056bb6b85",
                        "_links": {
                            "self": {
                                "href": "/api/network/ethernet/ports/626bd677-f34f-11e8-8373-005056bb6b85"
                            }
                        },
                        "name": "e0d",
                        "node": {"name": "examplecluster-node01"},
                    },
                ],
                "name": "Default",
            }
        ),
    ]

### Retrieving a specific broadcast domain

The following output shows the response returned when a specific broadcast domain is requested. The system returns an error if there is no broadcast domain with the requested UUID.

    from netapp_ontap import HostConnection
    from netapp_ontap.resources import BroadcastDomain

    with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
        resource = BroadcastDomain(uuid="4475a2c8-f8a0-11e8-8d33-005056bb986f")
        resource.get(fields="*")
        print(resource)

Try it out

    BroadcastDomain(
        {
            "ipspace": {
                "uuid": "3e518ed5-f8a0-11e8-8d33-005056bb986f",
                "_links": {
                    "self": {
                        "href": "/api/network/ipspaces/3e518ed5-f8a0-11e8-8d33-005056bb986f"
                    }
                },
                "name": "Cluster",
            },
            "uuid": "4475a2c8-f8a0-11e8-8d33-005056bb986f",
            "mtu": 9000,
            "_links": {
                "self": {
                    "href": "/api/network/ethernet/broadcast-domains/4475a2c8-f8a0-11e8-8d33-005056bb986f/"
                }
            },
            "ports": [
                {
                    "uuid": "3e539a62-f8a0-11e8-8d33-005056bb986f",
                    "_links": {
                        "self": {
                            "href": "/api/network/ethernet/ports/3e539a62-f8a0-11e8-8d33-005056bb986f"
                        }
                    },
                    "name": "e0a",
                    "node": {"name": "examplecluster-node01"},
                },
                {
                    "uuid": "3e53c94a-f8a0-11e8-8d33-005056bb986f",
                    "_links": {
                        "self": {
                            "href": "/api/network/ethernet/ports/3e53c94a-f8a0-11e8-8d33-005056bb986f"
                        }
                    },
                    "name": "e0b",
                    "node": {"name": "examplecluster-node01"},
                },
            ],
            "name": "Cluster",
        }
    )

### Retrieving all broadcast domains with a specific name

The following output shows the response returned when broadcast domains with a specific name in any IPspace are requested.

    from netapp_ontap import HostConnection
    from netapp_ontap.resources import BroadcastDomain

    with HostConnection(
        "10.224.87.121", username="admin", password="password", verify=False
    ):
        print(list(BroadcastDomain.get_collection(name="bd1")))

Try it out

    [
        BroadcastDomain(
            {
                "uuid": "66b607e5-4bee-11e9-af6a-005056bb13c0",
                "_links": {
                    "self": {
                        "href": "/api/network/ethernet/broadcast-domains/66b607e5-4bee-11e9-af6a-005056bb13c0"
                    }
                },
                "name": "bd1",
            }
        )
    ]

### Retrieving the broadcast domains for an IPspace

The following output shows the response returned when the broadcast domains for a specified IPspace are requested.

    from netapp_ontap import HostConnection
    from netapp_ontap.resources import BroadcastDomain

    with HostConnection(
        "10.224.87.121", username="admin", password="password", verify=False
    ):
        print(
            list(BroadcastDomain.get_collection(fields="*", **{"ipspace.name": "Cluster"}))
        )

Try it out

    [
        BroadcastDomain(
            {
                "ipspace": {
                    "uuid": "ac466a88-4bed-11e9-af6a-005056bb13c0",
                    "_links": {
                        "self": {
                            "href": "/api/network/ipspaces/ac466a88-4bed-11e9-af6a-005056bb13c0"
                        }
                    },
                    "name": "Cluster",
                },
                "uuid": "ae69070c-4bed-11e9-af6a-005056bb13c0",
                "mtu": 1500,
                "_links": {
                    "self": {
                        "href": "/api/network/ethernet/broadcast-domains/ae69070c-4bed-11e9-af6a-005056bb13c0"
                    }
                },
                "ports": [
                    {
                        "uuid": "acd67884-4bed-11e9-af6a-005056bb13c0",
                        "_links": {
                            "self": {
                                "href": "/api/network/ethernet/ports/acd67884-4bed-11e9-af6a-005056bb13c0"
                            }
                        },
                        "name": "e0a",
                        "node": {"name": "examplecluster-node-1"},
                    },
                    {
                        "uuid": "ace1a36f-4bed-11e9-af6a-005056bb13c0",
                        "_links": {
                            "self": {
                                "href": "/api/network/ethernet/ports/ace1a36f-4bed-11e9-af6a-005056bb13c0"
                            }
                        },
                        "name": "e0b",
                        "node": {"name": "examplecluster-node-1"},
                    },
                ],
                "name": "Cluster",
            }
        )
    ]

## Creating network Ethernet broadcast domains

You can use the POST API to create broadcast domains.

## Example

### Creating a new broadcast domain

The following example shows how to create a broadcast domain with a name of 'bd1' and an MTU of 1500.

    from netapp_ontap import HostConnection
    from netapp_ontap.resources import BroadcastDomain

    with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
        resource = BroadcastDomain()
        resource.name = "bd1"
        resource.mtu = 1500
        resource.post(hydrate=True)
        print(resource)

Try it out

    BroadcastDomain(
        {
            "mtu": 1500,
            "_links": {"self": {"href": "/api/network/ethernet/broadcast-domains/"}},
            "name": "bd1",
        }
    )

## Updating network Ethernet broadcast domains

You can use the PATCH API to update the attributes of broadcast domains.

## Examples

### Updating the name and MTU of a specific broadcast domain

The following example shows how the PATCH request changes the broadcast domain name to 'bd2' and the broadcast domain MTU to 9000.

    from netapp_ontap import HostConnection
    from netapp_ontap.resources import BroadcastDomain

    with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
        resource = BroadcastDomain(uuid="6cde03b2-f8a2-11e8-8d33-005056bb986f")
        resource.name = "bd2"
        resource.mtu = 9000
        resource.patch()

### Updating the IPspace of a specific broadcast domain

The following example shows how the PATCH request changes the IPspace of a broadcast domain to 'ipspace2'.

    from netapp_ontap import HostConnection
    from netapp_ontap.resources import BroadcastDomain

    with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
        resource = BroadcastDomain(uuid="c6fe2541-61f4-11e9-a66e-005056bbe83e")
        resource.ipspace.name = "ipspace2"
        resource.patch()

## Deleting network Ethernet broadcast domains

You can use the DELETE API to delete a broadcast domain from the cluster configuration.

## Example

### Deleting a specific broadcast domain

The following DELETE request deletes a broadcast domain.

    from netapp_ontap import HostConnection
    from netapp_ontap.resources import BroadcastDomain

    with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
        resource = BroadcastDomain(uuid="6cde03b2-f8a2-11e8-8d33-005056bb986f")
        resource.delete()

## Classes

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

  Set of ports that will receive a broadcast Ethernet packet from any of them

  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`

    Retrieves a collection of broadcast domains for the entire cluster.

    ### Related ONTAP commands

    - `network port broadcast-domain show`

    ### Learn more

    - `DOC /network/ethernet/broadcast-domains`

    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, body: typing.Union = None, connection: HostConnection = None, **kwargs) -> NetAppResponse`

    Deletes a broadcast domain.

    ### Related ONTAP commands

    - `network port broadcast-domain delete`

    ### Learn more

    - `DOC /network/ethernet/broadcast-domains`

    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.
    `body`
      The body of the delete request. This could be a Resource instance or a dictionary object.
    `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 a collection of broadcast domains for the entire cluster.

    ### Related ONTAP commands

    - `network port broadcast-domain show`

    ### Learn more

    - `DOC /network/ethernet/broadcast-domains`

    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) -> typing.Iterable`

    Retrieves a collection of broadcast domains for the entire cluster.

    ### Related ONTAP commands

    - `network port broadcast-domain show`

    ### Learn more

    - `DOC /network/ethernet/broadcast-domains`

    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.

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

    Updates the properties of a broadcast domain.

    ### Related ONTAP commands

    - `network port broadcast-domain modify`
    - `network port broadcast-domain rename`
    - `network port broadcast-domain move`

    ### Learn more

    - `DOC /network/ethernet/broadcast-domains`

    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, body: typing.Union = None, poll: bool = True, poll_interval: typing.Union = None, poll_timeout: typing.Union = None, **kwargs) -> NetAppResponse`

    Deletes a broadcast domain.

    ### Related ONTAP commands

    - `network port broadcast-domain delete`

    ### Learn more

    - `DOC /network/ethernet/broadcast-domains`

    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 details of a broadcast domain.

    ### Related ONTAP commands

    - `network port broadcast-domain show`

    ### Learn more

    - `DOC /network/ethernet/broadcast-domains`

    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 the properties of a broadcast domain.

    ### Related ONTAP commands

    - `network port broadcast-domain modify`
    - `network port broadcast-domain rename`
    - `network port broadcast-domain move`

    ### Learn more

    - `DOC /network/ethernet/broadcast-domains`

    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 normally be sent as query parameters to the host. If any of these pairs are parameters that are sent as formdata then only parameters of that type will be accepted and all others will be discarded.

    ## 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 new broadcast domain.

    ### Required properties

    - `name` - Name of the broadcast-domain to create.
    - `mtu` - Maximum transmission unit (MTU) of the broadcast domain.

    ### Recommended optional properties

    - `ipspace.name` or `ipspace.uuid` - IPspace the broadcast domain belongs to.

    ### Default property values

    If not specified in POST, the following default property values are assigned: * `ipspace` - Default

    ### Related ONTAP commands

    - `network port broadcast-domain create`

    ### Learn more

    - `DOC /network/ethernet/broadcast-domains`

    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 normally be sent as query parameters to the host. If any of these pairs are parameters that are sent as formdata then only parameters of that type will be accepted and all others will be discarded.

    ## 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 BroadcastDomainSchema (*, only: typing.Union = None, exclude: typing.Union = (), many: bool = False, context: typing.Dict = None, load_only: typing.Union = (), dump_only: typing.Union = (), partial: typing.Union = False, unknown: str = None)`

  The fields of the BroadcastDomain object

  ### Ancestors

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

  ### Class variables

  `ipspace GET POST PATCH`

    The ipspace field of the broadcast_domain.

  `links GET`

    The links field of the broadcast_domain.

  `mtu GET POST PATCH`

    Maximum transmission unit, largest packet size on this network

    Example: 1500

  `name GET POST PATCH`

    Name of the broadcast domain, scoped to its IPspace

    Example: bd1

  `ports GET`

    Ports that belong to the broadcast domain

  `uuid GET`

    Broadcast domain UUID

    Example: 1cd8a442-86d1-11e0-ae1c-123478563412