pyaoscx.port module

pyaoscx.port.add_l2_port(port_name, port_desc=None, port_admin_state='up', **kwargs)

Perform a POST call to create a Port table entry for physical L2 interface. If the Port table entry exists, this function will perform a PUT call to update the entry with the given parameters.

Parameters:
  • port_name – Alphanumeric Port name
  • port_desc – Optional description for the interface. Defaults to nothing if not specified.
  • port_admin_state – Optional administratively-configured state of the port. Defaults to “up” if not specified
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.port.add_l3_ipv4_port(port_name, ip_address=None, port_desc=None, port_admin_state='up', vrf='default', **kwargs)

Perform a POST call to create a Port table entry for a physical L3 interface. If the port already exists, the function will enable routing on the port and update the IPv4 address if given.

Parameters:
  • port_name – Alphanumeric Port name
  • ip_address – IPv4 address to assign to the interface. Defaults to nothing if not specified.
  • port_desc – Optional description for the interface. Defaults to nothing if not specified.
  • port_admin_state – Optional administratively-configured state of the port. Defaults to “up” if not specified
  • vrf – Name of the VRF to which the Port belongs. Defaults to “default” if not specified.
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.port.add_l3_ipv6_port(port_name, ip_address=None, port_desc=None, port_admin_state='up', vrf='default', **kwargs)

Perform a POST call to create a Port table entry for a physical L3 interface. If the port already exists, the function will perform a PUT call to update the Port table entry to enable routing on the port and update the IPv6 address if given.

Parameters:
  • port_name – Alphanumeric Port name
  • ip_address – IPv6 address to assign to the interface. Defaults to nothing if not specified.
  • port_desc – Optional description for the interface. Defaults to nothing if not specified.
  • port_admin_state – Optional administratively-configured state of the port. Defaults to “up” if not specified
  • vrf – Name of the VRF to which the Port belongs. Defaults to “default” if not specified.
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.port.add_vlan_port(vlan_port_name, vlan_id, ipv4=None, vrf_name='default', vlan_port_desc=None, port_admin_state='up', **kwargs)

Perform a POST call to create a logical VLAN Port as part of SVI creation.

Parameters:
  • vlan_port_name – Alphanumeric Port name
  • vlan_id – Numeric ID of VLAN
  • ipv4 – Optional IPv4 address to assign to the interface.Defaults to nothing if not specified.
  • vrf_name – VRF to attach the SVI to. Defaults to “default” if not specified
  • vlan_port_desc – Optional description for the interface. Defaults to nothing if not specified.
  • port_admin_state – Optional administratively-configured state of the port. Defaults to “up” if not specified
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.port.create_loopback_port(port_name, vrf, ipv4=None, port_desc=None, **kwargs)

Perform POST calls to create a Loopback Interface table entry for a logical L3 Interface. If the Loopback Interface already exists and an IPv4 address is given, the function will update the IPv4 address.

Parameters:
  • port_name – Alphanumeric Interface name
  • vrf – Alphanumeric name of the VRF that the loopback port is attached to
  • ipv4 – IPv4 address to assign to the interface. Defaults to nothing if not specified.
  • port_desc – Optional description for the interface. Defaults to nothing if not specified.
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.port.delete_port(port_name, **kwargs)

Perform a DELETE call to delete a Port table entry.

Parameters:
  • port_name – Port table entry name
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.port.get_all_ports(**kwargs)

Perform a GET call to get a list of all entries in the Port table

Parameters:kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:List of all ports in the table
pyaoscx.port.get_port(port_name, depth=0, selector=None, **kwargs)

Perform a GET call to retrieve data for a Port table entry

Parameters:
  • port_name – Alphanumeric name of the port
  • depth – Integer deciding how many levels into the API JSON that references will be returned.
  • selector – Alphanumeric option to select specific information to return. The options are ‘configuration’,
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

Dictionary containing port data

pyaoscx.port.initialize_port_entry(port_name, **kwargs)

Perform a PUT call on the Port to initialize it to it’s default state, then initialize the Interface entry.

Parameters:
  • port_name – Alphanumeric name of the system port
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.port.update_port_ipv4(port_name, ipv4, port_admin_state, vrf, **kwargs)

Perform GET and PUT calls to update an L3 interface’s ipv4 address

Parameters:
  • port_name – Alphanumeric name of the Port
  • ipv4 – IPv4 address to associate with the VLAN Port
  • port_admin_state – Administratively-configured state of the port.
  • vrf – Name of the VRF to which the Port belongs.
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.port.update_port_ipv6(port_name, ip_address, addr_type='global-unicast', **kwargs)

Perform a POST call to create an IPv6 address entry to update an L3 interface’s ipv6 address

Parameters:
  • port_name – Alphanumeric name of the Port
  • ipv6 – IPv6 address to associate with the Port
  • addr_type – Type of IPv6 address. Defaults to “global-unicast” if not specified.
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise