# Module `netapp_ontap.resources.port`

Copyright © 2021 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, and lag (ifgrp).

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

Try it out

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

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

Try it out

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

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

Try it out

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

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

Try it out

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

### 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"}
                )
            )
        )

Try it out

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

## 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
        resource.vlan.base_port.name = "e0e"
        resource.vlan.base_port.node.name = "user-cluster-01"
        resource.post(hydrate=True)
        print(resource)

Try it out

    Port(
        {
            "enabled": True,
            "type": "vlan",
            "uuid": "88b2f682-fa42-11e8-a6d7-005056bb5b8e",
            "_links": {
                "self": {
                    "href": "/api/network/ethernet/ports/88b2f682-fa42-11e8-a6d7-005056bb5b8e"
                }
            },
            "vlan": {
                "tag": 100,
                "base_port": {
                    "uuid": "2d39df72-f70d-11e8-b145-005056bb5b8e",
                    "_links": {
                        "self": {
                            "href": "/api/network/ethernet/ports/2d39df72-f70d-11e8-b145-005056bb5b8e"
                        }
                    },
                    "node": {"name": "user-cluster-01"},
                    "name": "e0e",
                },
            },
            "node": {
                "name": "user-cluster-01",
                "uuid": "faa56898-f70c-11e8-b145-005056bb5b8e",
                "_links": {
                    "self": {
                        "href": "/api/cluster/nodes/faa56898-f70c-11e8-b145-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"
        resource.broadcast_domain.ipspace.name = "Default    "
        resource.enabled = True
        resource.vlan.tag = 100
        resource.vlan.base_port.name = "e0e"
        resource.vlan.base_port.node.name = "user-cluster-01"
        resource.post(hydrate=True)
        print(resource)

Try it out

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

Try it out

    Port(
        {
            "enabled": True,
            "type": "lag",
            "lag": {
                "mode": "singlemode",
                "distribution_policy": "mac",
                "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",
                    },
                ],
            },
            "uuid": "1807772a-fa4d-11e8-a6d7-005056bb5b8e",
            "node": {
                "name": "user-cluster-01",
                "uuid": "faa56898-f70c-11e8-b145-005056bb5b8e",
            },
        }
    )

### 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"
        resource.broadcast_domain.ipspace.name = "Default"
        resource.enabled = True
        resource.lag.mode = "singlemode"
        resource.lag.distribution_policy = "mac"
        resource.lag.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)

Try it out

    Port(
        {
            "enabled": True,
            "type": "lag",
            "lag": {
                "mode": "singlemode",
                "distribution_policy": "mac",
                "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",
                    },
                ],
            },
            "uuid": "1807772a-fa4d-11e8-a6d7-005056bb5b8e",
            "broadcast_domain": {
                "ipspace": {"name": "Default"},
                "uuid": "36434bec-f70d-11e8-b145-005056bb5b8e",
                "name": "Default",
            },
            "node": {
                "name": "user-cluster-01",
                "uuid": "faa56898-f70c-11e8-b145-005056bb5b8e",
            },
        }
    )

## 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"
        resource.broadcast_domain.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

  - Resource

  ### Static methods

  `def count_collection(*args, connection: HostConnection = None, **kwargs) -> int`

    Retrieves a collection of ports (physical, VLAN and LAG) for an entire cluster.

    ### Related ONTAP commands

    - `network port show`
    - `network port ifgrp show`
    - `network port vlan show`

    ### Learn more

    - `DOC /network/ethernet/ports`

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

    ### Related ONTAP commands

    - `network port ifgrp delete`
    - `network port vlan delete`

    ### Learn more

    - `DOC /network/ethernet/ports`

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

    ### Related ONTAP commands

    - `network port show`
    - `network port ifgrp show`
    - `network port vlan show`

    ### Learn more

    - `DOC /network/ethernet/ports`

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

    ### Related ONTAP commands

    - `network port show`
    - `network port ifgrp show`
    - `network port vlan show`

    ### Learn more

    - `DOC /network/ethernet/ports`

    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 a port.

    ### Related ONTAP commands

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

    - `DOC /network/ethernet/ports`

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

    ### Related ONTAP commands

    - `network port ifgrp delete`
    - `network port vlan delete`

    ### Learn more

    - `DOC /network/ethernet/ports`

    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.

    ### Related ONTAP commands

    - `network port show`
    - `network port ifgrp show`
    - `network port vlan show`

    ### Learn more

    - `DOC /network/ethernet/ports`

    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 a port.

    ### Related ONTAP commands

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

    - `DOC /network/ethernet/ports`

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

    ### Related ONTAP commands

    - `network port ifgrp create`
    - `network port vlan create`

    ### Learn more

    - `DOC /network/ethernet/ports`

    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 PortSchema (*, 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 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.

  `links GET`

    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)

    Example: e1b

  `node GET POST`

    The node field of the port.

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

    Valid choices:

    - up
    - down
  `statistics GET`

    The statistics field of the port.

  `type GET POST`

    Type of physical or virtual port

    Valid choices:

    - vlan
    - physical
    - lag
  `uuid GET`

    Port UUID

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

  `vlan GET POST`

    The vlan field of the port.