Module netapp_ontap.resources.port

Copyright © 2022 NetApp Inc. All rights reserved.

Overview

A port is a physical or virtual Ethernet network device. Physical ports may be combined into Link Aggregation Groups (LAGs or ifgrps), or divided into Virtual LANs (VLANs).
GET (collection), GET (instance), and PATCH APIs are available for all port types. POST and DELETE APIs are available for "lag" (ifgrp) and "vlan" port types.

Retrieving network port information

The network ports GET API retrieves and displays relevant information pertaining to the ports configured in the cluster. The API retrieves the list of all ports configured in the cluster, or specifically requested ports. The fields returned in the response vary for different ports and configurations.

Examples

Retrieving all ports in the cluster

The following output displays the UUID, name, and port type for all ports configured in a 2-node cluster. The port types are physical, vlan, lag (ifgrp), and p-vlan (available in select environments only).


from netapp_ontap import HostConnection
from netapp_ontap.resources import Port

with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
    print(list(Port.get_collection(fields="uuid,name,type")))

[
    Port(
        {
            "type": "physical",
            "uuid": "2d2c90c0-f70d-11e8-b145-005056bb5b8e",
            "name": "e0a",
            "_links": {
                "self": {
                    "href": "/api/network/ethernet/ports/2d2c90c0-f70d-11e8-b145-005056bb5b8e"
                }
            },
        }
    ),
    Port(
        {
            "type": "physical",
            "uuid": "2d3004da-f70d-11e8-b145-005056bb5b8e",
            "name": "e0b",
            "_links": {
                "self": {
                    "href": "/api/network/ethernet/ports/2d3004da-f70d-11e8-b145-005056bb5b8e"
                }
            },
        }
    ),
    Port(
        {
            "type": "physical",
            "uuid": "2d34a2cb-f70d-11e8-b145-005056bb5b8e",
            "name": "e0c",
            "_links": {
                "self": {
                    "href": "/api/network/ethernet/ports/2d34a2cb-f70d-11e8-b145-005056bb5b8e"
                }
            },
        }
    ),
    Port(
        {
            "type": "physical",
            "uuid": "2d37189f-f70d-11e8-b145-005056bb5b8e",
            "name": "e0d",
            "_links": {
                "self": {
                    "href": "/api/network/ethernet/ports/2d37189f-f70d-11e8-b145-005056bb5b8e"
                }
            },
        }
    ),
    Port(
        {
            "type": "physical",
            "uuid": "35de5d8b-f70d-11e8-abdf-005056bb7fc8",
            "name": "e0a",
            "_links": {
                "self": {
                    "href": "/api/network/ethernet/ports/35de5d8b-f70d-11e8-abdf-005056bb7fc8"
                }
            },
        }
    ),
    Port(
        {
            "type": "physical",
            "uuid": "35de78cc-f70d-11e8-abdf-005056bb7fc8",
            "name": "e0b",
            "_links": {
                "self": {
                    "href": "/api/network/ethernet/ports/35de78cc-f70d-11e8-abdf-005056bb7fc8"
                }
            },
        }
    ),
    Port(
        {
            "type": "physical",
            "uuid": "35dead3c-f70d-11e8-abdf-005056bb7fc8",
            "name": "e0c",
            "_links": {
                "self": {
                    "href": "/api/network/ethernet/ports/35dead3c-f70d-11e8-abdf-005056bb7fc8"
                }
            },
        }
    ),
    Port(
        {
            "type": "physical",
            "uuid": "35deda90-f70d-11e8-abdf-005056bb7fc8",
            "name": "e0d",
            "_links": {
                "self": {
                    "href": "/api/network/ethernet/ports/35deda90-f70d-11e8-abdf-005056bb7fc8"
                }
            },
        }
    ),
    Port(
        {
            "type": "vlan",
            "uuid": "42e25145-f97d-11e8-ade9-005056bb7fc8",
            "name": "e0c-100",
            "_links": {
                "self": {
                    "href": "/api/network/ethernet/ports/42e25145-f97d-11e8-ade9-005056bb7fc8"
                }
            },
        }
    ),
    Port(
        {
            "type": "lag",
            "uuid": "569e0abd-f97d-11e8-ade9-005056bb7fc8",
            "name": "a0a",
            "_links": {
                "self": {
                    "href": "/api/network/ethernet/ports/569e0abd-f97d-11e8-ade9-005056bb7fc8"
                }
            },
        }
    ),
]


Retrieving a specific physical port

The following output displays the response when a specific physical port is requested. The system returns an error when there is no port with the requested UUID. Also, the "speed" field for the physical port is set only if the state of the port is up.


from netapp_ontap import HostConnection
from netapp_ontap.resources import Port

with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
    resource = Port(uuid="2d37189f-f70d-11e8-b145-005056bb5b8e")
    resource.get(fields="*")
    print(resource)

Port(
    {
        "type": "physical",
        "enabled": True,
        "reachability": "not_repairable",
        "mtu": 1500,
        "uuid": "2d37189f-f70d-11e8-b145-005056bb5b8e",
        "reachable_broadcast_domains": [
            {
                "uuid": "36434bec-f70d-11e8-b145-005056bb5b8e",
                "ipspace": {"name": "Default"},
                "name": "Default",
                "_links": {
                    "self": {
                        "href": "/api/network/ethernet/broadcast-domains/36434bec-f70d-11e8-b145-005056bb5b8e"
                    }
                },
            },
            {
                "uuid": "df640ccf-72c4-11ea-b31d-005056bbfb29",
                "ipspace": {"name": "Default"},
                "name": "Default-1",
                "_links": {
                    "self": {
                        "href": "/api/network/ethernet/broadcast-domains/df640ccf-72c4-11ea-b31d-005056bbfb29"
                    }
                },
            },
        ],
        "state": "up",
        "speed": 1000,
        "node": {
            "_links": {
                "self": {
                    "href": "/api/cluster/nodes/faa56898-f70c-11e8-b145-005056bb5b8e"
                }
            },
            "uuid": "faa56898-f70c-11e8-b145-005056bb5b8e",
            "name": "user-cluster-01",
        },
        "mac_address": "00:50:56:bb:62:2d",
        "name": "e0d",
        "_links": {
            "self": {
                "href": "/api/network/ethernet/ports/2d37189f-f70d-11e8-b145-005056bb5b8e"
            }
        },
        "broadcast_domain": {
            "uuid": "36434bec-f70d-11e8-b145-005056bb5b8e",
            "ipspace": {"name": "Default"},
            "name": "Default",
            "_links": {
                "self": {
                    "href": "/api/network/ethernet/broadcast-domains/36434bec-f70d-11e8-b145-005056bb5b8e"
                }
            },
        },
    }
)


Retrieving a specific VLAN port

The following output displays the response when a specific VLAN port is requested. The system returns an error when there is no port with the requested UUID. Also, the "speed" field for a VLAN port is always set to zero if the state of the port is up. If the state of the port is down, the "speed" field is unset and not reported back.


from netapp_ontap import HostConnection
from netapp_ontap.resources import Port

with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
    resource = Port(uuid="42e25145-f97d-11e8-ade9-005056bb7fc8")
    resource.get(fields="*")
    print(resource)

Port(
    {
        "type": "vlan",
        "enabled": True,
        "reachability": "ok",
        "mtu": 1500,
        "uuid": "42e25145-f97d-11e8-ade9-005056bb7fc8",
        "reachable_broadcast_domains": [
            {
                "uuid": "36434bec-f70d-11e8-b145-005056bb5b8e",
                "ipspace": {"name": "Default"},
                "name": "Default",
                "_links": {
                    "self": {
                        "href": "/api/network/ethernet/broadcast-domains/36434bec-f70d-11e8-b145-005056bb5b8e"
                    }
                },
            }
        ],
        "vlan": {
            "base_port": {
                "uuid": "35deff03-f70d-11e8-abdf-005056bb7fc8",
                "node": {"name": "user-cluster-02"},
                "name": "e0e",
                "_links": {
                    "self": {
                        "href": "/api/network/ethernet/ports/35deff03-f70d-11e8-abdf-005056bb7fc8"
                    }
                },
            },
            "tag": 100,
        },
        "state": "up",
        "speed": 0,
        "node": {
            "_links": {
                "self": {
                    "href": "/api/cluster/nodes/6042cf47-f70c-11e8-abdf-005056bb7fc8"
                }
            },
            "uuid": "6042cf47-f70c-11e8-abdf-005056bb7fc8",
            "name": "user-cluster-02",
        },
        "mac_address": "00:50:56:bb:52:2f",
        "name": "e0e-100",
        "_links": {
            "self": {
                "href": "/api/network/ethernet/ports/42e25145-f97d-11e8-ade9-005056bb7fc8"
            }
        },
        "broadcast_domain": {
            "uuid": "36434bec-f70d-11e8-b145-005056bb5b8e",
            "ipspace": {"name": "Default"},
            "name": "Default",
            "_links": {
                "self": {
                    "href": "/api/network/ethernet/broadcast-domains/36434bec-f70d-11e8-b145-005056bb5b8e"
                }
            },
        },
    }
)


Retrieving a specific LAG port

The following output displays the response when a specific LAG port is requested. The system returns an error when there is no port with the requested UUID. The "lag.active_ports" field is set only if the state of the port is up. Also, the "speed" field for a LAG port is always set to zero if the state of the port is up. If the state of the port is down, the "speed" field is unset and not reported back.


from netapp_ontap import HostConnection
from netapp_ontap.resources import Port

with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
    resource = Port(uuid="569e0abd-f97d-11e8-ade9-005056bb7fc8")
    resource.get(fields="*")
    print(resource)

Port(
    {
        "type": "lag",
        "enabled": True,
        "reachability": "repairable",
        "mtu": 1500,
        "lag": {
            "mode": "singlemode",
            "member_ports": [
                {
                    "uuid": "35df318d-f70d-11e8-abdf-005056bb7fc8",
                    "node": {"name": "user-cluster-02"},
                    "name": "e0f",
                    "_links": {
                        "self": {
                            "href": "/api/network/ethernet/ports/35df318d-f70d-11e8-abdf-005056bb7fc8"
                        }
                    },
                },
                {
                    "uuid": "35df5bad-f70d-11e8-abdf-005056bb7fc8",
                    "node": {"name": "user-cluster-02"},
                    "name": "e0g",
                    "_links": {
                        "self": {
                            "href": "/api/network/ethernet/ports/35df5bad-f70d-11e8-abdf-005056bb7fc8"
                        }
                    },
                },
                {
                    "uuid": "35df9926-f70d-11e8-abdf-005056bb7fc8",
                    "node": {"name": "user-cluster-02"},
                    "name": "e0h",
                    "_links": {
                        "self": {
                            "href": "/api/network/ethernet/ports/35df9926-f70d-11e8-abdf-005056bb7fc8"
                        }
                    },
                },
            ],
            "distribution_policy": "mac",
            "active_ports": [
                {
                    "uuid": "35df318d-f70d-11e8-abdf-005056bb7fc8",
                    "name": "e0f",
                    "_links": {
                        "self": {
                            "href": "/api/network/ethernet/ports/35df318d-f70d-11e8-abdf-005056bb7fc8"
                        }
                    },
                }
            ],
        },
        "uuid": "569e0abd-f97d-11e8-ade9-005056bb7fc8",
        "reachable_broadcast_domains": [
            {
                "uuid": "c7934b4f-691f-11ea-87fd-005056bb1ad3",
                "ipspace": {"name": "Default"},
                "name": "Default",
                "_links": {
                    "self": {
                        "href": "/api/network/ethernet/broadcast-domains/c7934b4f-691f-11ea-87fd-005056bb1ad3"
                    }
                },
            }
        ],
        "state": "up",
        "speed": 0,
        "node": {
            "_links": {
                "self": {
                    "href": "/api/cluster/nodes/6042cf47-f70c-11e8-abdf-005056bb7fc8"
                }
            },
            "uuid": "6042cf47-f70c-11e8-abdf-005056bb7fc8",
            "name": "user-cluster-02",
        },
        "mac_address": "02:50:56:bb:7f:c8",
        "name": "a0a",
        "_links": {
            "self": {
                "href": "/api/network/ethernet/ports/569e0abd-f97d-11e8-ade9-005056bb7fc8"
            }
        },
        "broadcast_domain": {
            "uuid": "36434bec-f70d-11e8-b145-005056bb5b8e",
            "ipspace": {"name": "Default"},
            "name": "Default",
            "_links": {
                "self": {
                    "href": "/api/network/ethernet/broadcast-domains/36434bec-f70d-11e8-b145-005056bb5b8e"
                }
            },
        },
    }
)


Retrieving all LAG (ifgrp) ports in the cluster

This command retrieves all LAG ports in the cluster (that is, all ports with type=LAG). The example shows how to filter a GET collection based on type.


from netapp_ontap import HostConnection
from netapp_ontap.resources import Port

with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
    print(
        list(
            Port.get_collection(
                type="lag",
                fields="name,enabled,speed,mtu",
                **{"node.name": "user-cluster-01"}
            )
        )
    )

[
    Port(
        {
            "type": "lag",
            "enabled": True,
            "mtu": 1500,
            "uuid": "0c226db0-4b63-11e9-8113-005056bbe040",
            "speed": 0,
            "node": {"name": "user-cluster-01"},
            "name": "a0b",
            "_links": {
                "self": {
                    "href": "/api/network/ethernet/ports/0c226db0-4b63-11e9-8113-005056bbe040"
                }
            },
        }
    ),
    Port(
        {
            "type": "lag",
            "enabled": True,
            "mtu": 1500,
            "uuid": "d3a84153-4b3f-11e9-a00d-005056bbe040",
            "speed": 0,
            "node": {"name": "user-cluster-01"},
            "name": "a0a",
            "_links": {
                "self": {
                    "href": "/api/network/ethernet/ports/d3a84153-4b3f-11e9-a00d-005056bbe040"
                }
            },
        }
    ),
]


Creating VLAN and LAG ports

You can use the network ports POST API to create VLAN and LAG ports. If you supply the optional broadcast domain property, the specified broadcast domain will be assigned to the new port immediately. Otherwise, within a few minutes automatic probing will determine the correct broadcast domain and will assign it to the port. During that period of time, the port will not be capable of hosting interfaces.


Examples

Creating a VLAN port

The following output displays the record returned after the creation of a VLAN port on "e0e" and VLAN tag "100".


from netapp_ontap import HostConnection
from netapp_ontap.resources import Port

with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
    resource = Port()
    resource.type = "vlan"
    resource.node = {"name": "user-cluster-01"}
    resource.enabled = True
    resource.vlan = {
        "tag": 100,
        "base_port": {"name": "e0e", "node": {"name": "user-cluster-01"}},
    }
    resource.post(hydrate=True)
    print(resource)

Port(
    {
        "type": "vlan",
        "enabled": True,
        "uuid": "88b2f682-fa42-11e8-a6d7-005056bb5b8e",
        "vlan": {
            "base_port": {
                "uuid": "2d39df72-f70d-11e8-b145-005056bb5b8e",
                "node": {"name": "user-cluster-01"},
                "name": "e0e",
                "_links": {
                    "self": {
                        "href": "/api/network/ethernet/ports/2d39df72-f70d-11e8-b145-005056bb5b8e"
                    }
                },
            },
            "tag": 100,
        },
        "node": {
            "_links": {
                "self": {
                    "href": "/api/cluster/nodes/faa56898-f70c-11e8-b145-005056bb5b8e"
                }
            },
            "uuid": "faa56898-f70c-11e8-b145-005056bb5b8e",
            "name": "user-cluster-01",
        },
        "_links": {
            "self": {
                "href": "/api/network/ethernet/ports/88b2f682-fa42-11e8-a6d7-005056bb5b8e"
            }
        },
    }
)


Creating a VLAN port in a specific broadcast domain

The following output displays the record returned after the creation of a VLAN port on "e0e" and VLAN tag "100". Also, the VLAN port is added to the "Default" broadcast domain in the "Default" IPspace.


from netapp_ontap import HostConnection
from netapp_ontap.resources import Port

with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
    resource = Port()
    resource.type = "vlan"
    resource.node = {"name": "user-cluster-01"}
    resource.broadcast_domain = {"name": "Default", "ipspace": {"name": "Default    "}}
    resource.enabled = True
    resource.vlan = {
        "tag": 100,
        "base_port": {"name": "e0e", "node": {"name": "user-cluster-01"}},
    }
    resource.post(hydrate=True)
    print(resource)

Port(
    {
        "type": "vlan",
        "enabled": True,
        "uuid": "88b2f682-fa42-11e8-a6d7-005056bb5b8e",
        "vlan": {
            "base_port": {
                "uuid": "2d39df72-f70d-11e8-b145-005056bb5b8e",
                "node": {"name": "user-cluster-01"},
                "name": "e0e",
                "_links": {
                    "self": {
                        "href": "/api/network/ethernet/ports/2d39df72-f70d-11e8-b145-005056bb5b8e"
                    }
                },
            },
            "tag": 100,
        },
        "node": {
            "_links": {
                "self": {
                    "href": "/api/cluster/nodes/faa56898-f70c-11e8-b145-005056bb5b8e"
                }
            },
            "uuid": "faa56898-f70c-11e8-b145-005056bb5b8e",
            "name": "user-cluster-01",
        },
        "_links": {
            "self": {
                "href": "/api/network/ethernet/ports/88b2f682-fa42-11e8-a6d7-005056bb5b8e"
            }
        },
        "broadcast_domain": {
            "uuid": "36434bec-f70d-11e8-b145-005056bb5b8e",
            "ipspace": {"name": "Default"},
            "name": "Default",
            "_links": {
                "self": {
                    "href": "/api/network/ethernet/broadcast-domains/36434bec-f70d-11e8-b145-005056bb5b8e"
                }
            },
        },
    }
)


Creating a LAG (ifgrp) port

The following output displays the record returned after the creation of a LAG port with "e0f", "e0g" and "e0h" as member ports.


from netapp_ontap import HostConnection
from netapp_ontap.resources import Port

with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
    resource = Port()
    resource.type = "lag"
    resource.node = {"name": "user-cluster-01"}
    resource.enabled = True
    resource.lag = {
        "mode": "singlemode",
        "distribution_policy": "mac",
        "member_ports": [
            {"name": "e0f", "node": {"name": "user-cluster-01"}},
            {"name": "e0g", "node": {"name": "user-cluster-01"}},
            {"name": "e0h", "node": {"name": "user-cluster-01"}},
        ],
    }
    resource.post(hydrate=True)
    print(resource)

Port(
    {
        "type": "lag",
        "enabled": True,
        "lag": {
            "mode": "singlemode",
            "member_ports": [
                {
                    "uuid": "2d3c9adc-f70d-11e8-b145-005056bb5b8e",
                    "node": {"name": "user-cluster-01"},
                    "name": "e0f",
                },
                {
                    "uuid": "2d40b097-f70d-11e8-b145-005056bb5b8e",
                    "node": {"name": "user-cluster-01"},
                    "name": "e0g",
                },
                {
                    "uuid": "2d46d01e-f70d-11e8-b145-005056bb5b8e",
                    "node": {"name": "user-cluster-01"},
                    "name": "e0h",
                },
            ],
            "distribution_policy": "mac",
        },
        "uuid": "1807772a-fa4d-11e8-a6d7-005056bb5b8e",
        "node": {
            "uuid": "faa56898-f70c-11e8-b145-005056bb5b8e",
            "name": "user-cluster-01",
        },
    }
)


Creating a LAG (ifgrp) port in a specific broadcast domain

The following output displays the record returned after the creation of a LAG port with "e0f", "e0g" and "e0h" as member ports. Also, the LAG port is added to the "Default" broadcast domain in the "Default" IPspace.


from netapp_ontap import HostConnection
from netapp_ontap.resources import Port

with HostConnection("<mgmt-ip>", username="admin", password="netapp1!", verify=False):
    resource = Port()
    resource.type = "lag"
    resource.node = {"name": "user-cluster-01"}
    resource.broadcast_domain = {"name": "Default", "ipspace": {"name": "Default"}}
    resource.enabled = True
    resource.lag = {
        "mode": "singlemode",
        "distribution_policy": "mac",
        "member_ports": [
            {"name": "e0f", "node": {"name": "user-cluster-01"}},
            {"name": "e0g", "node": {"name": "user-cluster-01"}},
            {"name": "e0h", "node": {"name": "user-cluster-01"}},
        ],
    }
    resource.post(hydrate=True)
    print(resource)

Port(
    {
        "type": "lag",
        "enabled": True,
        "lag": {
            "mode": "singlemode",
            "member_ports": [
                {
                    "uuid": "2d3c9adc-f70d-11e8-b145-005056bb5b8e",
                    "node": {"name": "user-cluster-01"},
                    "name": "e0f",
                },
                {
                    "uuid": "2d40b097-f70d-11e8-b145-005056bb5b8e",
                    "node": {"name": "user-cluster-01"},
                    "name": "e0g",
                },
                {
                    "uuid": "2d46d01e-f70d-11e8-b145-005056bb5b8e",
                    "node": {"name": "user-cluster-01"},
                    "name": "e0h",
                },
            ],
            "distribution_policy": "mac",
        },
        "uuid": "1807772a-fa4d-11e8-a6d7-005056bb5b8e",
        "node": {
            "uuid": "faa56898-f70c-11e8-b145-005056bb5b8e",
            "name": "user-cluster-01",
        },
        "broadcast_domain": {
            "uuid": "36434bec-f70d-11e8-b145-005056bb5b8e",
            "ipspace": {"name": "Default"},
            "name": "Default",
        },
    }
)


Updating ports

You can use the network ports PATCH API to update the attributes of ports.


Examples

Updating the broadcast domain of a port

The following PATCH request removes the port from the current broadcast domain and adds it to the specified broadcast domain.


from netapp_ontap import HostConnection
from netapp_ontap.resources import Port

with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
    resource = Port(uuid="6867efaf-d702-11e8-994f-005056bbc994")
    resource.broadcast_domain = {"name": "Default", "ipspace": {"name": "Default"}}
    resource.patch()


Updating the admin status of a port

The following PATCH request brings the specified port down.


from netapp_ontap import HostConnection
from netapp_ontap.resources import Port

with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
    resource = Port(uuid="51d3ab39-d86d-11e8-aca6-005056bbc994")
    resource.enabled = False
    resource.patch()


Repairing a port

The following PATCH request repairs a port. Only ports that have reachability as "repairable" can be repaired. The "reachability" parameter cannot be patched in the same request as other parameters that might affect the target port's reachability status.


from netapp_ontap import HostConnection
from netapp_ontap.resources import Port

with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
    resource = Port(uuid="51d3ab39-d86d-11e8-aca6-005056bbc994")
    resource.reachability = "ok"
    resource.patch()


Deleting ports

You can use the network ports DELETE API to delete VLAN and LAG ports in the cluster. Note that physical ports cannot be deleted. Deleting a port also removes the port from the broadcast domain.


Example

Deleting a VLAN port

The network ports DELETE API is used to delete a VLAN port.


from netapp_ontap import HostConnection
from netapp_ontap.resources import Port

with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
    resource = Port(uuid="6867efaf-d702-11e8-994f-005056bbc994")
    resource.delete()


Classes

class Port (*args, **kwargs)

Allows interaction with Port 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('Port')] = 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 a VLAN or LAG.

  • network port ifgrp delete
  • network port vlan delete

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 a collection of ports (physical, VLAN and LAG) for an entire cluster.

  • network port show
  • network port ifgrp show
  • network port vlan 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 ports (physical, VLAN and LAG) for an entire cluster.

  • network port show
  • network port ifgrp show
  • network port vlan 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.

def patch_collection(body: dict, *args, records: Iterable[_ForwardRef('Port')] = None, poll: bool = True, poll_interval: Union[int, NoneType] = None, poll_timeout: Union[int, NoneType] = None, connection: HostConnection = None, **kwargs) -> NetAppResponse

Updates a port.

  • network port broadcast-domain add-ports
  • network port broadcast-domain remove-ports
  • network port ifgrp modify
  • network port modify
  • network port vlan modify
  • network port reachability repair

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. The body argument will be ignored if records is provided.
*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.
records
Can be provided in place of a query. If so, this list of objects will be patched on the host.
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 patched.

Returns

A NetAppResponse object containing the details of the HTTP response.

Raises

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

def post_collection(records: Iterable[_ForwardRef('Port')], *args, hydrate: bool = False, poll: bool = True, poll_interval: Union[int, NoneType] = None, poll_timeout: Union[int, NoneType] = None, connection: HostConnection = None, **kwargs) -> Union[List[Port], NetAppResponse]

Creates a new VLAN (such as node1:e0a-100) or LAG (ifgrp, such as node2:a0a).

Required properties

  • node - Node the port will be created on.
  • type - Defines if a VLAN or LAG will be created:
  • VLAN
    • vlan.base_port - Physical port or LAG the VLAN will be created on.
    • vlan.tag - Tag used to identify VLAN on the base port.
  • LAG
    • lag.mode - Policy for the LAG that will be created.
    • lag.distribution_policy - Indicates how the packets are distributed between ports.
    • lag.member_ports - Set of ports the LAG consists of.

Optional properties

  • broadcast_domain - The layer-2 broadcast domain the port is associated with. The port will be placed in a broadcast domain if it is not specified. It may take several minutes for the broadcast domain to be assigned. During that period the port cannot host interfaces.
  • network port ifgrp create
  • network port vlan create

Learn more


Send this collection of objects to the host as a creation request.

Args

records
A list of Resource objects to send to the server to be created.
*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 create a bar for a particular foo, the foo.name value should be passed.
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 each object. When hydrate is set to True, poll must also be set to True.
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 patched.

Returns

A list of Resource objects matching the provided
type which have been created by the host and returned. This is _not_
 
the same list that was provided, so to continue using the object, you
 

should save this list. If poll is set to False, then a NetAppResponse object is returned instead.

Raises

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

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 a VLAN or LAG.

  • network port ifgrp delete
  • network port vlan delete

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 the details of a physical port, VLAN, or LAG.

  • network port show
  • network port ifgrp show
  • network port vlan 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: Union[int, NoneType] = None, poll_timeout: Union[int, NoneType] = None, **kwargs) -> NetAppResponse

Updates a port.

  • network port broadcast-domain add-ports
  • network port broadcast-domain remove-ports
  • network port ifgrp modify
  • network port modify
  • network port vlan modify
  • network port reachability repair

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

Creates a new VLAN (such as node1:e0a-100) or LAG (ifgrp, such as node2:a0a).

Required properties

  • node - Node the port will be created on.
  • type - Defines if a VLAN or LAG will be created:
  • VLAN
    • vlan.base_port - Physical port or LAG the VLAN will be created on.
    • vlan.tag - Tag used to identify VLAN on the base port.
  • LAG
    • lag.mode - Policy for the LAG that will be created.
    • lag.distribution_policy - Indicates how the packets are distributed between ports.
    • lag.member_ports - Set of ports the LAG consists of.

Optional properties

  • broadcast_domain - The layer-2 broadcast domain the port is associated with. The port will be placed in a broadcast domain if it is not specified. It may take several minutes for the broadcast domain to be assigned. During that period the port cannot host interfaces.
  • network port ifgrp create
  • network port vlan create

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

class PortSchema (*, 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 Port object

Ancestors

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

Class variables

broadcast_domain GET POST PATCH

The broadcast_domain field of the port.

enabled GET POST PATCH

The enabled field of the port.

lag GET POST PATCH

The lag field of the port.

The links field of the port.

mac_address GET

The mac_address field of the port.

Example: 01:02:03:04:05:06

metric GET

The metric field of the port.

mtu GET

MTU of the port in bytes. Set by broadcast domain.

Example: 1500

name GET

Portname, such as e0a, e1b-100 (VLAN on Ethernet), a0c (LAG/ifgrp), a0d-200 (VLAN on LAG/ifgrp), e0a.pv1 (p-VLAN, in select environments only)

Example: e1b

node GET POST

The node field of the port.

rdma_protocols GET

Supported RDMA offload protocols

reachability GET PATCH

Reachability status of the port. Enum value "ok" is the only acceptable value for a PATCH request to repair a port.

Valid choices:

  • ok
  • repairable
  • not_repairable
reachable_broadcast_domains GET

Reachable broadcast domains.

speed GET

Link speed in Mbps

Example: 1000

state GET

Operational state of the port. The state is set to 'down' if the operational state of the port is down. The state is set to 'up' if the link state of the port is up and the port is healthy. The state is set to 'up' if the link state of the port is up and configured to ignore health status. The state is 'degraded' if the link state of the port is up, and the port is not healthy.

Valid choices:

  • up
  • down
  • degraded
statistics GET

The statistics field of the port.

type GET POST

Type of physical or virtual port

Valid choices:

  • vlan
  • physical
  • lag
  • pvlan
uuid GET

Port UUID

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

vlan GET POST

The vlan field of the port.