pyaoscx package

Submodules

pyaoscx.access_security module

pyaoscx.access_security.clear_port_access_clients_limit(port_name, **kwargs)

Perform GET and PUT calls to clear a port’s limit of maximum allowed number of authorized clients.

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

True if successful, False otherwise

pyaoscx.access_security.clear_ubt_client_vlan(**kwargs)

Perform GET and PUT calls to clear the reserved VLAN for tunneled clients.

Parameters:kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:True if successful, False otherwise
pyaoscx.access_security.configure_dot1x_interface(port_name, auth_enable=True, cached_reauth_enable=True, cached_reauth_period=None, discovery_period=None, eapol_timeout=None, max_requests=None, max_retries=None, quiet_period=None, reauth_enable=True, reauth_period=None, **kwargs)

Perform a POST call to set 802.1x authentication on a port.

Parameters:
  • port_name – Alphanumeric name of the Port on which the trust mode is to be set
  • auth_enable – True if 802.1x is to be enabled on the port, false otherwise. Defaults to True if not specified.
  • cached_reauth_enable – True if cached reauthentication is to be enabled on the port, false otherwise. Defaults to True if not specified.
  • cached_reauth_period – Time in seconds during which cached reauthentication is allowed on the port. Defaults to nothing if not specified.
  • discovery_period – Time period(in seconds) to wait before an EAPOL request identity frame re-transmission on an 802.1X enabled port with no authenticated client. Applicable for 802.1X only. Defaults to nothing if not specified.
  • eapol_timeout – Time period(in seconds) to wait for a response from a client before retransmitting an EAPOL PDU. If the value is not set the time period is calculated as per RFC 2988. Defaults to nothing if not specified.
  • max_requests – Number of EAPOL requests to supplicant before authentication fails. Applicable for 802.1X only. Defaults to nothing if not specified.
  • max_retries – Number of authentication attempts before authentication fails. Defaults to nothing if not specified.
  • quiet_period – Time period(in seconds) to wait before processing an authentication request from a client that failed authentication. Defaults to nothing if not specified.
  • reauth_enable – True if periodic reauthentication is to be enabled on the port, false otherwise. Defaults to True if not specified.
  • reauth_period – Time period(in seconds) to enforce periodic re-authentication of clients. 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.access_security.configure_mac_auth_interface(port_name, auth_enable=True, cached_reauth_enable=True, cached_reauth_period=None, discovery_period=None, max_retries=None, quiet_period=None, reauth_enable=True, reauth_period=None, **kwargs)

Perform a POST call to set MAC authentication on a port.

Parameters:
  • port_name – Alphanumeric name of the Port on which the trust mode is to be set
  • auth_enable – True if authentication is to be enabled on the port, false otherwise. Defaults to True if not specified.
  • cached_reauth_enable – True if cached reauthentication is to be enabled on the port, false otherwise. Defaults to True if not specified.
  • cached_reauth_period – Time in seconds during which cached reauthentication is allowed on the port. Defaults to nothing if not specified.
  • discovery_period – Time period(in seconds) to wait before an EAPOL request identity frame re-transmission on an 802.1X enabled port with no authenticated client. Applicable for 802.1X only. Defaults to nothing if not specified.
  • max_retries – Number of authentication attempts before authentication fails. Defaults to nothing if not specified.
  • quiet_period – Time period(in seconds) to wait before processing an authentication request from a client that failed authentication. Defaults to nothing if not specified.
  • reauth_enable – True if periodic reauthentication is to be enabled on the port, false otherwise. Defaults to True if not specified.
  • reauth_period – Time period(in seconds) to enforce periodic re-authentication of clients. 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.access_security.create_port_access_role(role_name, desc=None, gateway_zone=None, ubt_gateway_role=None, vlan_mode=None, vlan_tag=None, vlan_trunks=None, **kwargs)

Perform a POST call to create a port access role

Parameters:
  • role_name – Alphanumeric name of port access role
  • desc – Optional description for role. Defaults to nothing if not specified.
  • gateway_zone – Gateway zone associated with this role. Defaults to nothing if not specified.
  • ubt_gateway_role – Role to be assigned to tunneled clients on the UBT cluster side. Defaults to nothing if not specified.
  • vlan_mode – VLAN mode should be one of “access,” “native-tagged,” “native-untagged,” or “trunk.” Defaults to nothing if not specified.
  • vlan_tag – The untagged VLAN to which users of this access role has to be assigned to.
  • vlan_trunks – The tagged VLAN(s) to which users of this access role has to be assigned to.
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.access_security.create_radius_host_config(vrf_name, host, default_group_priority=1, groups=[], passkey=None, **kwargs)

Perform a POST call to set the RADIUS server host.

Parameters:
  • vrf_name – Alphanumeric name of VRF through which the RADIUS server is reachable
  • host – IPv4/IPv6 address or FQDN of the RADIUS server
  • default_group_priority – Integer priority within the default RADIUS server group. All RADIUS servers will be added to this default group. The priority must be at least 1, and defaults to 1 if not specified.
  • groups – Optional list of additional RADIUS server groups to which this server will be added. Defaults to empty list if not specified.
  • passkey – Optional passkey to be used between RADIUS client and server for authentication.
Returns:

True if successful, False otherwise

pyaoscx.access_security.create_ubt_zone(zone_name, vrf_name, enable=True, pri_ctrlr_ip_addr=None, backup_ctrlr_ip_addr=None, sac_heartbeat_interval=1, uac_keepalive_interval=60, papi_security_key=None, **kwargs)

Perform a POST call to create User-Based-Tunneling (UBT) zone on a VRF

Parameters:
  • zone_name – Alphanumeric name of UBT zone
  • vrf_name – Alphanumeric name of VRF
  • enable – True if UBT functionality to be enabled on this zone, False otherwise. Default to True if not specified.
  • pri_ctrlr_ip_addr – IP address of primary controller node. Defaults to nothing if not specified.
  • backup_ctrlr_ip_addr – IP address of backup controller node. Defaults to nothing if not specified.
  • sac_heartbeat_interval – Time interval (in seconds) between successive heartbeat messages to the switch anchor node. Defaults to 1 if not specified.
  • uac_keepalive_interval – Time interval (in seconds) between successive keep-alive messages sent to the user anchor node. Defaults to 60 if not specified.
  • papi_security_key – Shared security key used to encrypt UBT PAPI messages exchanged between the switch and the controller cluster corresponding to this zone. 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.access_security.delete_radius_host_config(vrf_name, host, udp_port=1812, **kwargs)

Perform a DELETE call to remove the RADIUS server host.

Parameters:
  • vrf_name – Alphanumeric name of VRF through which the RADIUS server is reachable
  • host – IPv4/IPv6 address or FQDN of the RADIUS server
  • udp_port – UDP port number used for authentication. Defaults to 1812 if not specified.
Returns:

True if successful, False otherwise

pyaoscx.access_security.enable_disable_dot1x_globally(enable=True, **kwargs)

Perform GET and PUT calls to either enable or disable 802.1X globally

Parameters:
  • enable – True if 802.1x to be enabled globally, False if 802.1x to be disabled globally. Defaults to True 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.access_security.enable_disable_mac_auth_globally(enable=True, **kwargs)

Perform GET and PUT calls to either enable or disable MAC authentication globally

Parameters:
  • enable – True if MAC authentication to be enabled globally, False if MAC authentication to be disabled globally. Defaults to True 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.access_security.enable_disable_port_security_globally(enable=True, **kwargs)

Perform GET and PUT calls to either enable or disable port security globally

Parameters:
  • enable – True if port security to be enabled globally, False if port security to be disabled globally. Defaults to True 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.access_security.get_all_auth_methods_interface(port_name, **kwargs)

Perform a GET call to get a list/dict of all authentication methods on a port

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

List/dictionary containing all authentication methods on the port

pyaoscx.access_security.remove_auth_method_interface(port_name, auth_method, **kwargs)

Perform a DELETE call to remove an authentication method from a port

Parameters:
  • port_name – Alphanumeric name of the Port on which the authentication method is to be removed
  • auth_method – Authentication method to be removed from the Port. Should be either “802.1x” or “mac-auth”
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.access_security.remove_port_access_role(role_name, **kwargs)

Perform a DELETE call to delete a port access role

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

True if successful, False otherwise

pyaoscx.access_security.remove_source_ip_ubt(vrf_name, **kwargs)

Perform GET and PUT calls to remove the source IP address for UBT on a VRF.

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

True if successful, False otherwise

pyaoscx.access_security.remove_ubt_zone(vrf_name, **kwargs)

Perform a DELETE call to delete the User-Based-Tunneling (UBT) zone on a VRF

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

True if successful, False otherwise

pyaoscx.access_security.set_port_access_clients_limit(port_name, clients_limit, **kwargs)

Perform GET and PUT calls to set a port’s maximum allowed number of authorized clients.

Parameters:
  • port_name – Alphanumeric name of Port
  • clients_limit – Numeric ID of VLAN to add to trunk port
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.access_security.set_source_ip_ubt(vrf_name, source_ip, **kwargs)

Perform GET and PUT calls to set the source IP address for UBT on a VRF.

Parameters:
  • vrf_name – Alphanumeric name of VRF
  • source_ip – IP address for UBT
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.access_security.set_ubt_client_vlan(vlan_id, **kwargs)

Perform GET and PUT calls to set the reserved VLAN for tunneled clients.

Parameters:
  • vlan_id – Numeric ID of VLAN
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.acl module

pyaoscx.acl.clear_interface_acl(interface_name, acl_type='aclv4_out', **kwargs)

Perform GET and PUT calls to clear an interface’s ACL

Parameters:
  • interface_name – Alphanumeric name of the interface
  • acl_type – Type of ACL, options are between ‘aclv4_out’, ‘aclv4_in’, and ‘aclv6_in’
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.acl.clear_port_acl_in(port_name, list_type, **kwargs)

Perform GET and PUT calls to clear a Port’s Ingress ACL

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

True if successful, False otherwise

pyaoscx.acl.create_acl(list_name, list_type, **kwargs)

Perform a POST call to create an ACL with no entries

Parameters:
  • list_name – Alphanumeric name of the ACL
  • list_type – Type should be one of “ipv4,” “ipv6,” or “mac”
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.acl.create_acl_entry(list_name, list_type, sequence_num, action, count=None, ip_protocol=None, src_ip=None, dst_ip=None, dst_l4_port_min=None, dst_l4_port_max=None, src_mac=None, dst_mac=None, ethertype=None, **kwargs)

Perform a POST call to create an ACL entry

Parameters:
  • list_name – Alphanumeric name of the ACL
  • list_type – Type should be one of “ipv4,” “ipv6,” or “mac”
  • sequence_num – Integer number of the sequence
  • action – Action should be either “permit” or “deny”
  • count – Optional boolean flag that when true, will make entry increment hit count for matched packets
  • ip_protocol – Optional integer IP protocol number
  • src_ip – Optional source IP address
  • dst_ip – Optional destination IP address
  • dst_l4_port_min – Optional minimum L4 port number in range; used in conjunction with dst_l4_port_max.
  • dst_l4_port_max – Optional maximum L4 port number in range; used in conjunction with dst_l4_port_min.
  • src_mac – Optional source MAC address
  • dst_mac – Optional destination MAC address
  • ethertype – Optional integer EtherType number
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.acl.delete_acl(list_name, list_type, **kwargs)

Perform a DELETE call to delete an ACL

Parameters:
  • list_name – Alphanumeric name of the ACL
  • list_type – Type should be one of “ipv4,” “ipv6,” or “mac”
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.acl.delete_acl_entry(list_name, list_type, sequence_num, **kwargs)

Perform a DELETE call to delete an ACL entry

Parameters:
  • list_name – Alphanumeric name of the ACL
  • list_type – Type should be one of “ipv4,” “ipv6,” or “mac”
  • sequence_num – Integer ID for the entry.
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.acl.get_acl(list_name, list_type, **kwargs)

Perform a GET call to get details of a particular ACL

Parameters:
  • list_name – Alphanumeric name of the ACL
  • list_type – Type should be one of “ipv4,” “ipv6,” or “mac”
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

Dictionary containing data about a particular ACL

pyaoscx.acl.get_all_acl_entries(list_name, list_type, **kwargs)

Perform a GET call to get all entries of an ACL

Parameters:
  • list_name – Alphanumeric name of the ACL
  • list_type – Type should be one of “ipv4,” “ipv6,” or “mac”
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

Dictionary containing queue profile entry URIs

pyaoscx.acl.get_all_acls(**kwargs)

Perform a GET call to get a list of all ACLs

Parameters:kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:List of all ACLs in the table
pyaoscx.acl.update_acl(list_name, list_type, **kwargs)

Perform a PUT call to version-up an ACL. This is required whenever entries of an ACL are changed in any way.

Parameters:
  • list_name – Alphanumeric name of the ACL
  • list_type – Type should be one of “ipv4,” “ipv6,” or “mac”
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.acl.update_port_acl_in(interface_name, acl_name, list_type, **kwargs)

Perform GET and PUT calls to apply ACL on an interface. This function specifically applies an ACL to Ingress traffic of the interface

Parameters:
  • interface_name – Alphanumeric String that is the name of the interface on which the ACL is applied to
  • acl_name – Alphanumeric String that is the name of the ACL
  • list_type – Alphanumeric String of ipv4 or ipv6 to specify the type of ACL
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.acl.update_port_acl_out(interface_name, acl_name, **kwargs)

Perform GET and PUT calls to apply ACL on an L3 interface. This function specifically applies an ACL to Egress traffic of the interface, which must be a routing interface

Parameters:
  • interface_name – Alphanumeric String that is the name of the interface on which the ACL is applied to
  • acl_name – Alphanumeric String that is the name of the ACL
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.arp module

pyaoscx.arp.get_arp_entries(vrf_name, **kwargs)

Perform a GET call on Neighbors table to get ARP entries

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

List of dictionaries each containing one ARP entry

pyaoscx.bgp module

pyaoscx.bgp.create_bgp_asn(vrf_name, asn, router_id=None, **kwargs)

Perform a POST call to create a BGP Router Autonomous System Number

Parameters:
  • vrf_name – Alphanumeric name of the VRF the BGP ASN belongs to
  • asn – Integer that represents the Autonomous System Number
  • router_id – Optional IPv4 address that functions as the BGP Router ID
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.bgp.create_bgp_neighbors(vrf_name, asn, group_ip, family_type='l2vpn_evpn', reflector=False, send_community=False, local_interface='', **kwargs)

Perform a POST call to create BGP neighbors to the associated BGP ASN. With l2vpn_evpn being True, this will also apply EVPN settings to the BGP neighbor configurations. Note that this functions has logic that works for both v1 and v10.04

Parameters:
  • vrf_name – Alphanumeric name of the VRF the BGP ASN belongs to
  • asn – Integer that represents the Autonomous System Number
  • group_ip – IPv4 address or name of group of the neighbors that functions as the BGP Router link
  • family_type – Alphanumeric to specify what type of neighbor settings to configure. The options are ‘l2vpn-evpn’, ‘ipv4-unicast’, or ‘ipv6-unicast’. When setting to l2vpn-evpn, the neighbor configurations also will add route-reflector-client and send-community settings.
  • reflector – Boolean value to determine whether this neighbor has route reflector enabled. Default is False.
  • send_community – Boolean value to determine whether this neighbor has send-community enabled. Default is False.
  • local_interface – Optional alphanumeric to specify which interface the neighbor will apply to.
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.bgp.create_bgp_vrf(vrf_name, asn, redistribute, **kwargs)

Perform a POST call to create BGP VRF settings for the associated BGP ASN. Note that this functions has logic that works for both v1 and v10.04

Parameters:
  • vrf_name – Alphanumeric name of the VRF the BGP ASN belongs to
  • asn – Integer that represents the Autonomous System Number
  • redistribute – Optional alphanumeric to specify which types of routes that should be redistributed by BGP. The options are “ipv4-unicast” or “ipv6-unicast”.
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.bgp.delete_bgp_asn(vrf_name, asn, **kwargs)

Perform a DELETE call to remove a BGP Router Autonomous System Number

Parameters:
  • vrf_name – Alphanumeric name of the VRF the BGP ASN belongs to
  • asn – Integer that represents the Autonomous System Number
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.bgp.delete_bgp_vrf(vrf_name, asn, **kwargs)

Perform a DELETE call to remove BGP VRF settings for the associated BGP ASN. Note that this functions has logic that works for both v1 and v10.04

Parameters:
  • vrf_name – Alphanumeric name of the VRF the BGP ASN belongs to
  • asn – Integer that represents the Autonomous System Number
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.bgp.get_bgp_neighbors_list(vrf_name, asn, **kwargs)

Perform a GET call to get a list of all BGP neighbors for the supplied Autonomous System Number

Parameters:
  • vrf_name – Alphanumeric name of the VRF that we are retrieving all BGP ASNs from
  • asn – Integer that represents the Autonomous System Number
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

List of all BGP neighbors in the table for the ASN

pyaoscx.bgp.get_bgp_routers(vrf_name, **kwargs)

Perform a GET call to get a list of all BGP Router Autonomous System Number references

Parameters:
  • vrf_name – Alphanumeric name of the VRF that we are retrieving all BGP ASNs from
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

List of all BGP Router ASNs in the table

pyaoscx.common_ops module

pyaoscx.common_ops.read_yaml(filename)

” Reads a YAML file and returns the data in a Python object

Parameters:filename – Name of YAML file (e.g. ‘vlan_data.yml’)
Returns:Python object

pyaoscx.config module

pyaoscx.config.copy_config(src_config_name, dst_config_name, **kwargs)

Perform a PUT call to copy contents from one config into another config

Parameters:
  • src_config_name – Name of config to copy data from
  • dst_config_name – Name of config to copy data into
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.config.get_all_configs(**kwargs)

Perform a GET call to get all configs

Parameters:kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:List of all config URIs
pyaoscx.config.get_config(config_name, **kwargs)

Perform a GET call to get contents of a config.

Parameters:
  • config_name – name of config (e.g. running-config)
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

Dictionary containing config contents

pyaoscx.config.upload_running_config(config_data, **kwargs)

Perform a PUT call to upload a new running-config

Parameters:
  • config_data – Dictionary containing config contents
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.dhcp module

pyaoscx.dhcp.add_dhcp_relays(port_name, vrf_name, ipv4_helper_addresses, **kwargs)

Perform a POST call to add IPv4 DHCP helper(s) for an L3 interface. If there are already IPv4 helpers, the new helpers are added in addition to the already existing helpers.

Parameters:
  • port_name – Alphanumeric name of the Port
  • vrf_name – Alphanumeric name of the VRF
  • ipv4_helper_addresses – List of IPv4 addresses to add as DHCP helpers
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.dhcp.delete_dhcp_relays(port_name, vrf_name='default', **kwargs)

Perform a DELETE call to delete all the IPv4 DHCP helper(s) for an L3 interface.

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

True if successful, False otherwise

pyaoscx.dhcp.get_all_dhcp_relays(**kwargs)

Perform a GET call to get a list (or dictionary) of all entries in DHCP Relays table

Parameters:kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:List/dict of all DHCP helpers in the table
pyaoscx.dhcp.get_dhcp_relay(vrf_name, port_name, **kwargs)

Perform a GET call to get DHCP data for an interface

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

Dictionary containing DHCP Relay data for interface

pyaoscx.evpn module

pyaoscx.evpn.add_evpn_vlan(vlan_id, export_route=['auto'], import_route=['auto'], rd='auto', **kwargs)

Perform POST call to create an EVPN VLAN association Note that this functions has logic that works for both v1 and v10.04

Parameters:
  • vlan_id – Integer representing the VLAN ID
  • export_route – List of route targets to be exported from the VLAN in ASN:nn format, or auto.
  • import_route – List of route targets to be imported from the VLAN in ASN:nn format, or auto.
  • rd – Alphanumeric EVPN RD in ASN:nn format or IP:nn format, or auto.
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.evpn.create_evpn_instance(**kwargs)

Perform POST calls to create an EVPN instance

Parameters:kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:True if successful, False otherwise
pyaoscx.evpn.delete_evpn_instance(**kwargs)

Perform DELETE calls to remove an EVPN instance

Parameters:kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:True if successful, False otherwise
pyaoscx.evpn.get_evpn_info(**kwargs)

Perform a GET call to receive the EVPN information on the system

Parameters:kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:Information
pyaoscx.evpn.get_evpn_vlan_list(**kwargs)

Perform a GET call to receive a list of VLANs associated with the EVPN instance

Parameters:kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:List of EVPN VLANs

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

pyaoscx.lag module

pyaoscx.lag.create_l2_lag_interface(name, phys_ports, lacp_mode='passive', mc_lag=False, fallback_enabled=False, vlan_ids_list=[], desc=None, admin_state='up', **kwargs)

Perform a POST call to create a Port table entry for L2 LAG interface.

Parameters:
  • name – Alphanumeric name of LAG Port
  • phys_ports – List of physical ports to aggregate (e.g. [“1/1/1”, “1/1/2”, “1/1/3”])
  • lacp_mode – Should be either “passive” or “active.” Defaults to “passive” if not specified.
  • mc_lag – Boolean to determine if the LAG is multi-chassis. Defaults to False if not specified.
  • fallback_enabled – Boolean to determine if the LAG uses LACP fallback. Defaults to False if not specified.
  • vlan_ids_list – Optional list of integer VLAN IDs to add as trunk VLANS. Defaults to empty list if not specified.
  • desc – Optional description for the interface. Defaults to nothing if not specified.
  • 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.lag.create_l3_lag_interface(name, phys_ports, ipv4, lacp_mode='passive', mc_lag=False, fallback_enabled=False, desc=None, admin_state='up', vrf='default', **kwargs)

Perform a POST call to create a Port table entry for L3 LAG interface.

Parameters:
  • name – Alphanumeric Port name
  • phys_ports – List of physical ports to aggregate (e.g. [“1/1/1”, “1/1/2”, “1/1/3”])
  • ipv4 – IPv4 address to assign to the interface. Defaults to nothing if not specified.
  • lacp_mode – Should be either “passive” or “active.” Defaults to “passive” if not specified.
  • mc_lag – Boolean to determine if the LAG is multi-chassis. Defaults to False if not specified.
  • fallback_enabled – Boolean to determine if the LAG uses LACP fallback. Defaults to False if not specified.
  • desc – Optional description for the interface. Defaults to nothing if not specified.
  • 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.lag.delete_lag_interface(name, phys_ports, **kwargs)

Perform a DELETE call to delete a LAG interface. For v1, also remove the LAG ID from the port’s Interface, and create the associated Port table entry.

Parameters:
  • name – Alphanumeric name of LAG interface
  • phys_ports – List of physical ports to aggregate (e.g. [“1/1/1”, “1/1/2”, “1/1/3”])
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.lldp module

pyaoscx.lldp.get_all_lldp_neighbors(**kwargs)

Perform a GET call to get a list of all entries in the lldp_neighbors table. This is currently only supported in v1, so even a v10.04 or later AOS-CX device will use the v1 REST call.

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

Perform a GET call to retrieve lldp_neighbor MAC and port data for an Interface. This will return a list if using v1, or a dictionary if using v10.04 or later.

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:

List/dictionary containing lldp_neighbor MAC and port data

pyaoscx.lldp.get_lldp_neighbor_info(int_name, depth=0, selector=None, **kwargs)

Perform a GET call to retrieve LLDP neighbor info for an Interface

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 LLDP neighbor info

pyaoscx.loop_protect module

pyaoscx.loop_protect.clear_port_loop_protect(port_name, **kwargs)

Perform GET and PUT calls to clear a Port’s Loop-protect settings

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

True if successful, False otherwise

pyaoscx.loop_protect.update_port_loop_protect(interface_name, action=None, vlan_list=[], **kwargs)

Perform GET and PUT calls to apply Loop-protect options on an interface.

Parameters:
  • interface_name – Alphanumeric String that is the name of the interface that will apply loop-protect options
  • action – Alphanumeric String that will specify the actions for the Loop-protect interface. The options are “do-not-disable”, “tx-disable”, “tx-rx-disable”, or None.
  • vlan_list – List of VLANs that will be configured for Loop-protect on the interface
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.mac module

pyaoscx.mac.get_all_mac_addresses_on_system(**kwargs)

Perform a GET call to get a list of all of the MAC address URIs for all VLANs on the system :param kwargs:

keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:List of all MAC address URIs on the system
pyaoscx.mac.get_all_mac_addrs(vlan_id, **kwargs)

Perform a GET call to get MAC address(es) for VLAN

Parameters:
  • vlan_id – Numeric ID of VLAN
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

List of MAC address URIs

pyaoscx.mac.get_mac_info(vlan_id, mac_type, mac_addr, **kwargs)

Perform a GET call to get MAC info

Parameters:
  • vlan_id – Numeric ID of VLAN
  • mac_type – The source of the MAC address. Must be “dynamic,” “VSX,” “static,” “VRRP,” “port-access-security,” “evpn,” or “hsc”
  • mac_addr – MAC address
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

Dictionary containing MAC data

pyaoscx.ospf module

pyaoscx.ospf.create_ospf_area(vrf, ospf_id, area_id, area_type='default', **kwargs)

Perform a POST call to create an OSPF Area for the specified OSPF ID

Parameters:
  • vrf – Alphanumeric name of the VRF the OSPF ID belongs to
  • ospf_id – OSPF process ID between numbers 1-63
  • area_id – Unique identifier as a string in the form of x.x.x.x
  • area_type – Alphanumeric defining how the external routing and summary LSAs for this area will be handled. Options are “default”,”nssa”,”nssa_no_summary”,”stub”,”stub_no_summary”
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.ospf.create_ospf_id(vrf, ospf_id, redistribute=['connected', 'static'], **kwargs)

Perform a POST call to create an OSPF ID

Parameters:
  • vrf – Alphanumeric name of the VRF the OSPF ID belongs to
  • ospf_id – OSPF process ID between numbers 1-63
  • redistribute – List of types of redistribution methods for the OSPF Process, with the options being “bgp”, “connected”, and “static”
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.ospf.create_ospf_interface(vrf, ospf_id, area_id, interface_name, **kwargs)

Perform POST calls to attach an interface to an OSPF area.

Parameters:
  • vrf – Alphanumeric name of the VRF the OSPF ID belongs to
  • ospf_id – OSPF process ID between numbers 1-63
  • area_id – Unique identifier as a string in the form of x.x.x.x
  • interface_name – Alphanumeric name of the interface that will be attached to the OSPF area
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.ospf.create_ospfv3_area(vrf, ospf_id, area_id, area_type='default', **kwargs)

Perform a POST call to create an OSPFv3 Area for the specified OSPF ID

Parameters:
  • vrf – Alphanumeric name of the VRF the OSPFv3 ID belongs to
  • ospf_id – OSPFv3 process ID between numbers 1-63
  • area_id – Unique identifier as a string in the form of x.x.x.x
  • area_type – Alphanumeric defining how the external routing and summary LSAs for this area will be handled. Options are “default”,”nssa”,”nssa_no_summary”,”stub”,”stub_no_summary”
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.ospf.create_ospfv3_id(vrf, ospf_id, **kwargs)

Perform a POST call to create an OSPFv3 ID

Parameters:
  • vrf – Alphanumeric name of the VRF the OSPFv3 ID belongs to
  • ospf_id – OSPF process ID between numbers 1-63
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.ospf.create_ospfv3_interface(vrf, ospf_id, area_id, interface_name, **kwargs)

Perform POST calls to attach an interface to an OSPFv3 area.

Parameters:
  • vrf – Alphanumeric name of the VRF the OSPFv3 ID belongs to
  • ospf_id – OSPFv3 process ID between numbers 1-63
  • area_id – Unique identifier as a string in the form of x.x.x.x
  • interface_name – Alphanumeric name of the interface that will be attached to the OSPFv3 area
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.ospf.delete_ospf_area(vrf, ospf_id, area_id, **kwargs)

Perform a DETELE call to remove an OSPF Area for the specified OSPF ID

Parameters:
  • vrf – Alphanumeric name of the VRF the OSPF ID belongs to
  • ospf_id – OSPF process ID between numbers 1-63
  • area_id – Unique identifier as a string in the form of x.x.x.x
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.ospf.delete_ospf_id(vrf, ospf_id, **kwargs)

Perform a DELETE call to delete an OSPF Router ID

Parameters:
  • vrf – Alphanumeric name of the VRF the OSPF ID belongs to
  • ospf_id – OSPF process ID between numbers 1-63
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.ospf.delete_ospfv3_area(vrf, ospf_id, area_id, **kwargs)

Perform a DELETE call to remove an OSPFv3 Area for the specified OSPFv3 ID

Parameters:
  • vrf – Alphanumeric name of the VRF the OSPFv3 ID belongs to
  • ospf_id – OSPFv3 process ID between numbers 1-63
  • area_id – Unique identifier as a string in the form of x.x.x.x
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.ospf.delete_ospfv3_id(vrf, ospf_id, **kwargs)

Perform a DELETE call to delete an OSPFv3 Router ID

Parameters:
  • vrf – Alphanumeric name of the VRF the OSPFv3 ID belongs to
  • ospf_id – OSPFv3 process ID between numbers 1-63
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.ospf.get_ospf_routers(vrf, **kwargs)

Perform a GET call to get a list of all OSPF Router IDs

Parameters:
  • vrf – Alphanumeric name of the VRF that we are retrieving all Router IDs from
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

List of all OSPF Router IDs in the table

pyaoscx.ospf.get_ospfv3_routers(vrf, **kwargs)

Perform a GET call to get a list of all OSPFv3 Router IDs

Parameters:
  • vrf – Alphanumeric name of the VRF that we are retrieving all Router IDs from
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

List of all OSPFv3 Router IDs in the table

pyaoscx.ospf.update_ospf_interface_authentication(vrf, ospf_id, interface_name, auth_type, digest_key, auth_pass, **kwargs)

Perform PUT calls to update an Interface with OSPF to have authentication

Parameters:
  • vrf – Alphanumeric name of the VRF the OSPF ID belongs to
  • ospf_id – OSPF process ID between numbers 1-63
  • interface_name – Alphanumeric name of the interface that will be attached to the OSPF area
  • auth_type – Alphanumeric type of authentication, chosen between ‘md5’, ‘null’, and ‘text’
  • digest_key – Integer between 1-255 that functions as the digest key for the authentication method
  • auth_pass – Alphanumeric text for the authentication password. Note that this will be translated to a base64 String in the configuration and json.
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.ospf.update_ospf_interface_type(vrf, ospf_id, interface_name, interface_type='pointtopoint', **kwargs)

Perform PUT calls to update the type of OSPFv2 Interface given, as well as enable routing on the interface

Parameters:
  • vrf – Alphanumeric name of the VRF the OSPF ID belongs to
  • ospf_id – OSPF process ID between numbers 1-63
  • interface_name – Alphanumeric name of the interface that will be attached to the OSPF area
  • interface_type – Alphanumeric type of OSPF interface. The options are ‘broadcast’, ‘loopback’, ‘nbma’, ‘none’, ‘pointomultipoint’, ‘pointopoint’, and ‘virtuallink’
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.ospf.update_ospfv3_interface_authentication(vrf, ospf_id, interface_name, auth_type, digest_key, auth_pass, **kwargs)

Perform PUT calls to update an Interface with OSPFv3 to have authentication

Parameters:
  • vrf – Alphanumeric name of the VRF the OSPFv3 ID belongs to
  • ospf_id – OSPFv3 process ID between numbers 1-63
  • interface_name – Alphanumeric name of the interface that will be attached to the OSPFv3 area
  • auth_type – Alphanumeric type of authentication, chosen between ‘md5’, ‘null’, and ‘text’
  • digest_key – Integer between 1-255 that functions as the digest key for the authentication method
  • auth_pass – Alphanumeric text for the authentication password. Note that this will be translated to a base64 String in the configuration and json.
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

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

pyaoscx.qos module

pyaoscx.qos.apply_profile_interface(port_name, schedule_profile_name, **kwargs)

Perform GET and PUT calls to apply QoS schedule profile on an interface. If there is a globally applied schedule profile, this function will override the specified interface with the specified schedule profile.

Parameters:
  • port_name – Alphanumeric name of the Port on which the schedule profile is to be applied
  • schedule_profile_name – Alphanumeric name of the schedule profile
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.qos.apply_profiles_globally(queue_profile_name, schedule_profile_name, **kwargs)

Perform GET and PUT calls to apply a QoS queue profile and schedule profile on all interfaces.

Parameters:
  • queue_profile_name – Alphanumeric name of the queue profile
  • schedule_profile_name – Alphanumeric name of the schedule profile
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.qos.clear_port_policy(port_name, **kwargs)

Perform GET and PUT calls to clear a Port’s policy

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

True if successful, False otherwise

pyaoscx.qos.clear_port_rate_limits(port_name, **kwargs)

Perform GET and PUT calls to clear a Port’s rate limits

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

True if successful, False otherwise

pyaoscx.qos.clear_trust_globally(**kwargs)

Perform GET and PUT calls to remove global setting of QoS trust mode on all interfaces.

Parameters:kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:True if successful, False otherwise
pyaoscx.qos.clear_trust_interface(port_name, **kwargs)

Perform GET and PUT calls to clear QoS trust mode on an interface.

Parameters:
  • port_name – Alphanumeric name of the Port on which the trust mode is to be set
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.qos.create_policy(policy_name, **kwargs)

Perform a POST call to create a classifier policy

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

True if successful, False otherwise

pyaoscx.qos.create_policy_entry(policy_name, class_name, class_type, sequence_num, **kwargs)

Perform a POST call to create a policy entry

Parameters:
  • policy_name – Alphanumeric name of the policy
  • class_name – Alphanumeric name of the traffic class
  • class_type – Class type should be one of “ipv4,” “ipv6,” or “mac”
  • sequence_num – Integer ID for the entry
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.qos.create_policy_entry_action(policy_name, sequence_num, dscp=None, pcp=None, **kwargs)

Perform a POST call to create a policy entry action

Parameters:
  • policy_name – Alphanumeric name of the policy
  • sequence_num – Integer ID for the entry
  • dscp – Optional integer DSCP value to set matched packets to
  • pcp – Optional integer PCP value to set matched packets to
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.qos.create_queue_profile(profile_name, **kwargs)

Perform a POST call to create a QoS queue profile with no entries

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

True if successful, False otherwise

pyaoscx.qos.create_queue_profile_entry(profile_name, queue_num, local_priorities, desc=None, **kwargs)

Perform a POST call to create a QoS queue profile entry

Parameters:
  • profile_name – Alphanumeric name of the queue profile
  • queue_num – Integer number of the entry
  • local_priorities – List of integers, each item being a local priority
  • desc – Optional description for the entry
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.qos.create_schedule_profile(profile_name, **kwargs)

Perform a POST call to create a QoS schedule profile with no entries

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

True if successful, False otherwise

pyaoscx.qos.create_schedule_profile_entry(profile_name, queue_num, algorithm='strict', bandwidth=None, burst_size=None, weight=None, **kwargs)

Perform a POST call to create a QoS schedule profile entry

Parameters:
  • profile_name – Alphanumeric name of the schedule profile
  • queue_num – Integer number of queue
  • algorithm – Algorithm type should be “strict,” “dwrr,” or “wfq.” Defaults to “strict” if not specified.
  • bandwidth – Optional bandwidth limit (in kilobits/s) to apply to egress queue traffic
  • burst_size – Optional burst size (in kilobytes) allowed per bandwidth-limited queue
  • weight – Optional weight value for the queue. The maximum weight is hardware-dependent.
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.qos.create_traffic_class(class_name, class_type, **kwargs)

Perform a POST call to create a traffic class

Parameters:
  • class_name – Alphanumeric name of the traffic class
  • class_type – Class type should be one of “ipv4,” “ipv6,” or “mac”
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.qos.create_traffic_class_entry(class_name, class_type, action, sequence_num, ip_protocol=None, src_ip=None, dest_ip=None, **kwargs)

Perform a POST call to create a traffic class entry

Parameters:
  • class_name – Alphanumeric name of the traffic class
  • class_type – Class type should be one of “ipv4,” “ipv6,” or “mac”
  • action – Action should be either “match” or “ignore”
  • sequence_num – Integer ID for the entry.
  • ip_protocol – Optional integer IP protocol number. Defaults to None if not specified. Excluding this parameter will make the entry associate to all IP protocols.
  • src_ip – Optional source IP address. Defaults to None if not specified.
  • dest_ip – Optional destination IP address. Defaults to None 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.qos.delete_policy(policy_name, **kwargs)

Perform a DELETE call to delete a classifier policy

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

True if successful, False otherwise

pyaoscx.qos.delete_policy_entry(policy_name, sequence_num, **kwargs)

Perform a DELETE call to delete a policy entry

Parameters:
  • policy_name – Alphanumeric name of the policy
  • sequence_num – Integer ID for the entry
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.qos.delete_policy_entry_action(policy_name, sequence_num, **kwargs)

Perform a PUT call to set no action on a policy entry

Parameters:
  • policy_name – Alphanumeric name of the policy
  • sequence_num – Integer ID for the entry
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.qos.delete_queue_profile(profile_name, **kwargs)

Perform a DELETE call to delete a QoS queue profile

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

True if successful, False otherwise

pyaoscx.qos.delete_queue_profile_entry(profile_name, queue_num, **kwargs)

Perform a DELETE call to delete a QoS queue profile entry

Parameters:
  • profile_name – Alphanumeric name of the queue profile
  • queue_num – Integer number of the entry
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.qos.delete_schedule_profile(profile_name, **kwargs)

Perform a DELETE call to delete a QoS schedule profile

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

True if successful, False otherwise

pyaoscx.qos.delete_schedule_profile_entry(profile_name, queue_num, **kwargs)

Perform a DELETE call to delete a QoS schedule profile entry

Parameters:
  • profile_name – Alphanumeric name of the schedule profile
  • queue_num – Integer number of the entry
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.qos.delete_traffic_class(class_name, class_type, **kwargs)

Perform a DELETE call to delete a traffic class

Parameters:
  • class_name – Alphanumeric name of the traffic class
  • class_type – Class type should be one of “ipv4,” “ipv6,” or “mac”
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.qos.delete_traffic_class_entry(class_name, class_type, sequence_num, **kwargs)

Perform a DELETE call to delete a traffic class entry

Parameters:
  • class_name – Alphanumeric name of the traffic class
  • class_type – Class type should be one of “ipv4,” “ipv6,” or “mac”=
  • sequence_num – Integer ID for the entry.
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.qos.get_all_classes(**kwargs)

Perform a GET call to get a list of all traffic classes

Parameters:kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:List of all traffic classes in the table
pyaoscx.qos.get_all_policies(**kwargs)

Perform a GET call to get a list of all classifier policies

Parameters:kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:List of all classifier policies in the table
pyaoscx.qos.get_all_policy_entries(policy_name, **kwargs)

Perform a GET call to get a list of all policy entries

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

List of all policy entries in the table

pyaoscx.qos.get_all_queue_profile_entries(profile_name, **kwargs)

Perform a GET call to get all entries of a QoS queue profile

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

Dictionary containing queue profile entry URIs

pyaoscx.qos.get_all_queue_profiles(**kwargs)

Perform a GET call to get a list of all QoS queue profiles

Parameters:kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:List of all QoS queue profiles in the table
pyaoscx.qos.get_all_schedule_profile_entries(profile_name, **kwargs)

Perform a GET call to get all entries of a QoS schedule profile

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

Dictionary containing schedule profile entry URIs

pyaoscx.qos.get_all_schedule_profiles(**kwargs)

Perform a GET call to get a list of all QoS schedule profiles

Parameters:kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:List of all QoS schedule profiles in the table
pyaoscx.qos.get_all_traffic_class_entries(class_name, class_type, **kwargs)

Perform a GET call to get a list of all traffic class entries

Parameters:
  • class_name – Alphanumeric name of traffic class
  • class_type – Class type should be one of “ipv4,” “ipv6,” or “mac”
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

List of all traffic class entries in the table

pyaoscx.qos.get_policy(policy_name, **kwargs)

Perform a GET call to get details of a particular policy

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

Dictionary containing data about a particular policy

pyaoscx.qos.get_policy_entry_action(policy_name, sequence_num, **kwargs)

Perform a GET call to get the action set on a particular policy entry

Parameters:
  • policy_name – Alphanumeric name of policy
  • sequence_num – Integer ID for the entry.
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

Dictionary containing data about the action of a particular policy entry

pyaoscx.qos.get_traffic_class(class_name, class_type, **kwargs)

Perform a GET call to get details of a particular traffic class

Parameters:
  • class_name – Alphanumeric name of the traffic class
  • class_type – Class type should be one of “ipv4,” “ipv6,” or “mac”
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

Dictionary containing data about a particular traffic class

pyaoscx.qos.remap_dscp_entry(code_point, color=None, desc=None, local_priority=None, **kwargs)

Perform PUT call to modify the DSCP code point entry.

Parameters:
  • code_point – Integer identifying the DSCP map code point entry.
  • color – Optional color used for packet-drop decisions. Should be one of “red,” “yellow,” or “green.” If not specified, defaults to the factory default color for the given code point.
  • desc – Optional description for the DSCP code point entry. If not specified, defaults to the factory default description for the given code point.
  • local_priority – Optional local priority to associate to incoming packets. If not specified, defaults to the factory default local priority for the given code point.
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.qos.reset_dscp_entry(code_point, **kwargs)

Perform a PUT call to reset the DSCP code point entry to its default setting.

Parameters:
  • code_point – Integer identifying the DSCP map code point entry.
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.qos.set_trust_globally(trust_mode, **kwargs)

Perform GET and PUT calls to set QoS trust mode on all interfaces.

Parameters:
  • trust_mode – Trust mode should be one of “none,” “cos,” or “dscp.”
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.qos.set_trust_interface(port_name, trust_mode, **kwargs)

Perform GET and PUT calls to set QoS trust mode on an interface. If there is a globally applied trust mode, this function will override the specified interface with the specified trust mode.

Parameters:
  • port_name – Alphanumeric name of the Port on which the trust mode is to be set
  • trust_mode – Trust mode should be one of “none,” “cos,” or “dscp.”
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.qos.unapply_profiles_globally(**kwargs)

Perform GET and PUT calls to remove global application of QoS queue profile and schedule profile on all interfaces.

Parameters:kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:True if successful, False otherwise
pyaoscx.qos.update_policy(policy_name, **kwargs)

Perform a PUT call to version-up a policy

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

True if successful, False otherwise

pyaoscx.qos.update_port_policy(port_name, policy_name, **kwargs)

Perform GET and PUT calls to update a Port’s policy

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

True if successful, False otherwise

pyaoscx.qos.update_port_rate_limits(port_name, broadcast_limit=None, broadcast_units=None, multicast_limit=None, multicast_units=None, unknown_unicast_limit=None, unknown_unicast_units=None, **kwargs)

Perform GET and PUT calls to update a Port’s rate limits

Parameters:
  • port_name – Alphanumeric name of the Port
  • broadcast_limit – Rate limit for broadcast ingress traffic
  • broadcast_units – Units for broadcast rate limit; should be either “kbps” (kilobits/second) or “pps” (packets/second)
  • multicast_limit – Rate limit in pps for multicast ingress traffic
  • multicast_units – Units for multicast rate limit; should be either “kbps” (kilobits/second) or “pps” (packets/second)
  • unknown_unicast_limit – Rate limit in pps for unknown_unicast ingress traffic
  • unknown_unicast_units – Units for unknown unicast rate limit; should be either “kbps” (kilobits/second) or “pps” (packets/second)
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.qos.update_traffic_class(class_name, class_type, **kwargs)

Perform a PUT call to version-up a traffic class. This is required whenever entries of a traffic class are changed in any way.

Parameters:
  • class_name – Alphanumeric name of the traffic class
  • class_type – Class type should be one of “ipv4,” “ipv6,” or “mac”
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.session module

pyaoscx.session.login(base_url, username=None, password=None)

Perform a POST call to login and gain access to other API calls. If either username or password is not specified, user will be prompted to enter the missing credential(s).

Parameters:
  • base_url – URL in main() function
  • username – username
  • password – password
Returns:

requests.session object with loaded cookie jar

pyaoscx.session.logout(**kwargs)

Perform a POST call to logout and end session.

Parameters:kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:True if successful, False otherwise

pyaoscx.system module

pyaoscx.system.get_chassis_info(params={}, **kwargs)

Perform a GET call to get the chassis information, such as product info, reboot statistics, selftest info, and more.

Parameters:
  • params – Dictionary of optional parameters for the GET request
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

Dictionary containing chassis information

pyaoscx.system.get_product_info(params={}, **kwargs)

Perform a GET call to get the product information, such as MAC, Part Number, Model, and Serial

Parameters:
  • params – Dictionary of optional parameters for the GET request
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

Dictionary containing product information

pyaoscx.system.get_system_info(params={}, **kwargs)

Perform a GET call to get system information

Parameters:
  • params – Dictionary of optional parameters for the GET request
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

Dictionary containing system information

pyaoscx.vlan module

pyaoscx.vlan.attach_vlan_acl(vlan_id, list_name, list_type, **kwargs)

Perform GET and PUT calls to attach an ACL to a VLAN

Parameters:
  • vlan_id – Numeric ID of VLAN
  • list_name – Alphanumeric name of the ACL
  • list_type – Type should be one of “ipv4,” “ipv6,” or “mac”
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.vlan.create_vlan(vlan_id, vlan_name, vlan_desc=None, vlan_type='static', admin_conf_state='up', **kwargs)

Perform a POST call to create a new VLAN.

Parameters:
  • vlan_id – Numeric ID of VLAN
  • vlan_name – Alphanumeric name of VLAN
  • vlan_desc – Optional description to add to VLAN
  • vlan_type – VLAN type. Defaults to “static” if not specified
  • admin_conf_state – Optional administratively-configured state of VLAN. Only configurable for static VLANs. Defaults to “up” for static VLANs.
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.vlan.create_vlan_and_svi(vlan_id, vlan_name, vlan_port_name, vlan_int_name, vlan_desc=None, ipv4=None, vrf_name='default', vlan_port_desc=None, **kwargs)

Perform POST and PUT calls to create a new VLAN and SVI.

Parameters:
  • vlan_id – Numeric ID of VLAN
  • vlan_name – Alphanumeric name of VLAN
  • vlan_port_name – Alphanumeric Port name
  • vlan_int_name – Alphanumeric name for the VLAN interface
  • vlan_desc – Optional description to add to 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.
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.vlan.delete_vlan(vlan_id, **kwargs)

Perform a DELETE call to delete VLAN.

Parameters:
  • vlan_id – Numeric ID of VLAN
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.vlan.delete_vlan_and_svi(vlan_id, vlan_port_name, **kwargs)

Perform PUT and DELETE calls to delete SVI and VLAN.

Parameters:
  • vlan_id – Numeric ID of VLAN
  • vlan_port_name – Name of SVI’s entry in Port table
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.vlan.detach_vlan_acl(vlan_id, list_type, **kwargs)

Perform GET and PUT calls to detach ACL from a VLAN

Parameters:
  • vlan_id – Numeric ID of VLAN
  • list_type – Type should be one of “ipv4,” “ipv6,” or “mac”
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.vlan.get_all_vlans(**kwargs)

Perform a GET call to get a list (or dictionary) of all entries in VLANs table

Parameters:kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:List/dict of all VLANs in the table
pyaoscx.vlan.get_vlan(vlan_id, depth=0, selector='configuration', **kwargs)

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

Parameters:
  • 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.
  • vlan_id – Numeric ID of VLAN
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

Dictionary containing port data

pyaoscx.vlan.modify_vlan(vlan_id, vlan_name=None, vlan_desc=None, admin_conf_state=None, **kwargs)

Perform GET and PUT calls to modify an existing VLAN.

Parameters:
  • vlan_id – Numeric ID of VLAN
  • vlan_name – Optional Alphanumeric name of VLAN. Won’t be modified if not specified.
  • vlan_desc – Optional description to add to VLAN. Won’t be modified if not specified.
  • admin_conf_state – Optional administratively-configured state of VLAN. Won’t be modified if not specified. Only configurable for static VLANs.
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.vlan.port_add_vlan_trunks(l2_port_name, vlan_trunk_ids=[], **kwargs)

Perform GET and PUT/POST calls to add specified VLANs to a trunk port. By default, this will also set the port to have ‘no routing’ and if there is not a native VLAN, will set the native VLAN to VLAN 1.

Parameters:
  • l2_port_name – L2 interface’s Port table entry name
  • vlan_trunk_ids – List of VLANs to specify as allowed on the trunk port. If empty, the interface will allow all VLANs on the trunk.
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.vlan.port_delete_vlan_port(l2_port_name, vlan_id, **kwargs)

Perform GET and PUT calls to remove a VLAN from a trunk port

Parameters:
  • l2_port_name – L2 interface’s Port table entry name
  • vlan_id – Numeric ID of VLAN to remove from trunk port
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.vlan.port_set_native_vlan(l2_port_name, vlan_id, tagged=True, **kwargs)

Perform GET and PUT/POST calls to set a VLAN to be the native VLAN on the trunk. Also gives the option to set the VLAN as tagged.

Parameters:
  • l2_port_name – L2 interface’s Port table entry name
  • vlan_id – Numeric ID of VLAN to add to trunk port
  • tagged – Boolean to determine if the native VLAN will be set as the tagged VLAN. If False, the VLAN will be set as the native untagged VLAN
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.vlan.port_set_untagged_vlan(l2_port_name, vlan_id, **kwargs)

Perform GET and PUT/POST calls to set a VLAN on an access port

Parameters:
  • l2_port_name – L2 interface’s Port table entry name
  • vlan_id – Numeric ID of VLAN to set on access port
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.vlan.port_set_vlan_mode(l2_port_name, vlan_mode, **kwargs)

Perform GET and PUT calls to set an L2 interface’s VLAN mode (native-tagged, native-untagged, or access)

Parameters:
  • l2_port_name – L2 interface’s Port table entry name
  • vlan_mode – A string, either ‘native-tagged’, ‘native-untagged’, or ‘access’, specifying the desired VLAN mode
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.vlan.vlan_get_all_mac_info(vlan_id, **kwargs)

Perform GET calls to get info for all MAC address(es) of VLAN

Parameters:
  • vlan_id – Numeric ID of VLAN
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

List of dictionaries containing MAC info

pyaoscx.vrf module

pyaoscx.vrf.add_vrf(vrf_name, route_distinguisher=None, vrf_type='user', **kwargs)

Perform a POST call to create a new VRF, and add a route distinguisher if desired.

Parameters:
  • vrf_name – Alphanumeric name of VRF
  • route_distinguisher – Optional route distinguisher to add. Defaults to nothing if not specified.
  • vrf_type – Optional VRF type. Defaults to “user” 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.vrf.add_vrf_address_family(vrf_name, family_type='ipv4_unicast', export_target=[], import_targets=[], **kwargs)

Perform a POST call to create a new VRF, and add a route distinguisher if desired. Note that this functions has logic that works for both v1 and v10.04

Parameters:
  • vrf_name – Alphanumeric name of VRF
  • family_type – Alphanumeric type of the Address Family. The options are ‘ipv4_unicast’ and ‘ipv6_unicast’. The default value is set to ‘ipv4_unicast’.
  • export_target – Optional list of export route targets.
  • import_targets – Optional list of import route targets
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.vrf.add_vrf_v1(vrf_name, route_distinguisher=None, vrf_type='user', **kwargs)

Perform a POST call to create a new VRF, and add a route distinguisher if desired.

Parameters:
  • vrf_name – name of VRF
  • route_distinguisher – Optional route distinguisher to add. Defaults to nothing if not specified.
  • vrf_type – Optional VRF type. Defaults to “user” 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.vrf.delete_vrf(vrf_name, **kwargs)

Perform a DELETE call to delete a VRF. Note that this functions has logic that works for both v1 and v10.04

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

True if successful, False otherwise

pyaoscx.vrf.delete_vrf_address_family(vrf_name, family_type='ipv4_unicast', **kwargs)

Perform a DELETE call to remove a VRF address family. Note that this functions has logic that works for both v1 and v10.04

Parameters:
  • vrf_name – Alphanumeric name of VRF
  • family_type – Alphanumeric type of the Address Family. The options are ‘ipv4_unicast’ and ‘ipv6_unicast’. The default value is set to ‘ipv4_unicast’.
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.vrf.get_all_vrfs(**kwargs)

Perform a GET call to get a list (or dictionary) of all entries in VRF table

Parameters:kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:List/dict of all VRFs in the table
pyaoscx.vrf.get_vrf(vrf_name, depth=0, selector=None, **kwargs)

Perform a GET call to get data for a VRF table entry

Parameters:
  • vrf_name – Alphanumeric name of the VRF
  • 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’, ‘statistics’ or ‘writable’.
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

Dictionary containing the VRF data

pyaoscx.vsx module

pyaoscx.vsx.create_vsx(role, isl_port, keepalive_peer, keepalive_src, keepalive_vrf, vsx_mac, **kwargs)

Perform a POST call to create VSX commands.

Parameters:
  • role – Alphanumeric role that the system will be in the VSX pair. The options are “primary” or “secondary”
  • isl_port – Alphanumeric name of the interface that will function as the inter-switch link
  • keepalive_peer – Alphanumeric IP address of the VSX Peer that will be reached as the keepalive connection.
  • keepalive_src – Alphanumeric IP address on the switch that will function as the keepalive connection source.
  • keepalive_vrf – Alphanumeric name of the VRF that the keepalive connection will reside on.
  • vsx_mac – Alphanumeric MAC address that will function as the VSX System MAC.
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.vsx.delete_vsx(**kwargs)

Perform a DELETE call to get get the current VSX information on a system.

Parameters:kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:True if successful, False otherwise
pyaoscx.vsx.delete_vsx_interface_vlan(vlan_id, **kwargs)

Perform PUT calls on a VLAN interface to remove VSX IPv4 settings.

Parameters:
  • vlan_id – Numeric ID of VLAN to that will be configured
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.vsx.get_vsx(depth=0, selector=None, **kwargs)

Perform a GET call to get get the current VSX information on a system.

Parameters:
  • 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:

JSON of VSX information

pyaoscx.vsx.update_vsx_interface_vlan(vlan_id, active_forwarding, vsx_sync, act_gw_mac, act_gw_ip, **kwargs)

Perform PUT calls on a VLAN interface to configure VSX IPv4 settings.

Parameters:
  • vlan_id – Numeric ID of VLAN to that will be configured
  • active_forwarding – True or False Boolean to set VSX active forwarding
  • vsx_sync – Set of alphanumeric values to enable VSX configuration synchronization. The options are any combination of ‘active-gateways’, ‘irdp’, and ‘policies’. VSX Sync is mainly used in the Primary.
  • act_gw_mac – Alphanumeric value of the Virtual MAC address for the interface active gateway
  • act_gw_ip – Alphanumeric value of the Virtual IP address for the interface active gateway
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.vxlan module

pyaoscx.vxlan.add_vni_mapping(vni, vxlan, vlan, **kwargs)

Perform POST call to create a Virtual Network ID and Map it to VLANs for a supplied VXLAN.

Parameters:
  • vni – Integer representing the Virtual Network ID
  • vxlan – Alphanumeric of the VXLAN that the VNI will be associated with
  • vlan – VLAN that the VNI will be mapped to
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.vxlan.create_vxlan_interface(port_name, source_ipv4=None, port_desc=None, dest_udp_port=4789, **kwargs)

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

Parameters:
  • port_name – Alphanumeric Interface name
  • source_ipv4 – Source IPv4 address to assign to the VXLAN interface. Defaults to nothing if not specified.
  • port_desc – Optional description for the interface. Defaults to nothing if not specified.
  • dest_udp_port – Optional Destination UDP Port that the VXLAN will use. Default is set to 4789
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.vxlan.delete_vni_mapping(vni, **kwargs)

Perform DELETE call to remove a Virtual Network ID for a VXLAN.

Parameters:
  • vni – Integer representing the Virtual Network ID
  • kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:

True if successful, False otherwise

pyaoscx.vxlan.get_vni_list(**kwargs)

Perform a GET call to receive a list of Virtual Network IDs on the system.

Parameters:kwargs – keyword s: requests.session object with loaded cookie jar keyword url: URL in main() function
Returns:List of Virtual Network IDs

Module contents