pyaoscx.interface module¶
-
pyaoscx.interface.
add_l2_interface
(interface_name, interface_desc=None, interface_admin_state='up', **kwargs)¶ Perform a POST call to create an Interface table entry for physical L2 interface.
Parameters: - interface_name – Alphanumeric Interface name
- interface_desc – Optional description for the interface. Defaults to nothing if not specified.
- interface_admin_state – Optional administratively-configured state of the interface. 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.interface.
add_l3_ipv4_interface
(interface_name, ip_address=None, interface_desc=None, interface_admin_state='up', vrf='default', **kwargs)¶ Perform a PUT or POST call to create an Interface table entry for a physical L3 Interface. If the Interface already exists, the function will enable routing on the Interface and update the IPv4 address if given.
Parameters: - interface_name – Alphanumeric Interface name
- ip_address – IPv4 address to assign to the interface. Defaults to nothing if not specified.
- interface_desc – Optional description for the interface. Defaults to nothing if not specified.
- interface_admin_state – Optional administratively-configured state of the interface. 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.interface.
add_l3_ipv6_interface
(interface_name, ip_address=None, interface_desc=None, interface_admin_state='up', vrf='default', **kwargs)¶ Perform a PUT or POST call to create an Interface table entry for a physical L3 Interface. If the Interface already exists, the function will enable routing on the Interface and update the IPv6 address if given.
Parameters: - interface_name – Alphanumeric Interface name
- ip_address – IPv6 address to assign to the interface. Defaults to nothing if not specified.
- interface_desc – Optional description for the interface. Defaults to nothing if not specified.
- interface_admin_state – Optional administratively-configured state of the interface. 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.interface.
add_port_to_lag
(int_name, lag_id, **kwargs)¶ Perform GET and PUT calls to configure a Port as a LAG member, and also enable the port. For v1, also perform DELETE call to remove the Port table entry for the port.
Parameters: - int_name – Alphanumeric name of the interface
- lag_id – Numeric ID of the LAG to which the port is to be added
- kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns: True if successful, False otherwise
-
pyaoscx.interface.
add_vlan_interface
(vlan_int_name, vlan_port_name, vlan_id, ipv4, vrf_name, vlan_port_desc, int_type='vlan', user_config=None, **kwargs)¶ Perform a POST call to add Interface table entry for a VLAN.
Parameters: - vlan_int_name – Alphanumeric name for the VLAN interface
- vlan_port_name – Alphanumeric Port name to associate with the interface
- 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.
- int_type – Type of interface; generally should be “vlan” for SVI’s. As such, defaults to “internal” if not specified.
- user_config – User configuration to apply to interface. Defaults to {“admin”: “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.interface.
create_loopback_interface
(interface_name, vrf='default', ipv4=None, interface_desc=None, **kwargs)¶ Perform a PUT and/or POST call 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: - interface_name – Alphanumeric Interface name
- vrf – VRF to attach the SVI to. Defaults to “default” if not specified
- ipv4 – IPv4 address to assign to the interface. Defaults to nothing if not specified.
- interface_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.interface.
delete_interface
(interface_name, **kwargs)¶ Perform a DELETE call to either the Interface Table or Port Table to delete an interface
Parameters: - interface_name – Name of interface’s reference entry in Interface table
- kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns: True if successful, False otherwise
-
pyaoscx.interface.
delete_ipv6_address
(interface_name, ip, **kwargs)¶ Perform a DELETE call to remove an IPv6 address from an Interface.
Parameters: - interface_name – Alphanumeric Interface name
- ip – IPv6 address assigned to the interface that will be removed.
- kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns: True if successful, False otherwise
-
pyaoscx.interface.
delete_l2_interface
(interface_name, **kwargs)¶ Perform either a PUT call to the Interface Table or DELETE call to Port Table to delete an interface If trying to re-initialize an L2 interface, use the function initialize_l2_interface()
Parameters: - interface_name – Name of interface’s reference entry in Interface table
- kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns: True if successful, False otherwise
-
pyaoscx.interface.
enable_disable_interface
(int_name, state='up', **kwargs)¶ - Perform GET and PUT calls to either enable or disable the interface by setting Interface’s admin_state to
- “up” or “down”
Parameters: - int_name – Alphanumeric name of the interface
- state – State to set the interface to
- kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns: True if successful, False otherwise
-
pyaoscx.interface.
get_all_interface_names
(**kwargs)¶ Perform a GET call to get a list of all of the names for each interface in the Interface table
Parameters: kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function Returns: List of all Interface names in the table
-
pyaoscx.interface.
get_all_interfaces
(**kwargs)¶ Perform a GET call to get a list (or dictionary) of all entries in the Interface table
Parameters: kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function Returns: List/dict of all Interfaces in the table
-
pyaoscx.interface.
get_interface
(int_name, depth=0, selector=None, **kwargs)¶ Perform a GET call to retrieve data for an Interface table entry
Parameters: - int_name – Alphanumeric name of the interface
- 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’, ‘status’, or ‘statistics’. If running v10.04 or later, an additional option ‘writable’ is included.
- kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns: Dictionary containing data for Interface entry
-
pyaoscx.interface.
get_ipv6_addresses
(int_name, depth=0, **kwargs)¶ Perform a GET call to retrieve the list of IPv6 addresses for an Interface table entry
Parameters: - int_name – Alphanumeric name of the interface
- depth – Integer deciding how many levels into the API JSON that references will be returned.
- kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns: List of all ipv6 addresses for the Interface entry
-
pyaoscx.interface.
initialize_interface
(interface_name, **kwargs)¶ Perform a PUT call to the Interface Table or Port Table to initialize an interface to factory settings
Parameters: - interface_name – Name of interface’s reference entry in Interface table
- kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns: True if successful, False otherwise
-
pyaoscx.interface.
initialize_interface_entry
(int_name, **kwargs)¶ Perform a PUT call on the interface to initialize it to it’s default state.
Parameters: - int_name – Alphanumeric name of the system interface
- kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns: True if successful, False otherwise
-
pyaoscx.interface.
remove_port_from_lag
(int_name, lag_id, **kwargs)¶ Perform GET and PUT calls to configure a Port as a LAG member, and also disable the port
Parameters: - int_name – Alphanumeric name of the interface
- lag_id – Numeric ID of the LAG to which the port is to be added
- kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns: True if successful, False otherwise
-
pyaoscx.interface.
update_interface_ipv4
(interface_name, ipv4, interface_admin_state, vrf, **kwargs)¶ Perform GET and PUT calls to update an L3 interface’s ipv4 address
Parameters: - interface_name – Alphanumeric name of the Port
- ipv4 – IPv4 address to associate with the VLAN Port
- interface_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.interface.
update_port_ipv6
(interface_name, ipv6, addr_type='global-unicast', **kwargs)¶ Perform a POST call to update an L3 interface’s ipv6 address
Parameters: - interface_name – Alphanumeric name of the Port
- ipv6 – IPv6 address to associate with the VLAN 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