pyaoscx.vrf module¶
-
class
pyaoscx.vrf.
Vrf
(session, name, uri=None, **kwargs)¶ Bases:
pyaoscx.pyaoscx_module.PyaoscxModule
Provide configuration management for VRF on AOS-CX devices.
-
add_address_family
(family_type='ipv4_unicast', export_target=[], import_targets=[])¶ Add a VRF Address Family to the current Vrf object.
Parameters: - 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
Return address_family: VrfAddressFamily Object
-
address_families
¶ - Attribute descriptor class to keep track of a list that contains
- pyaoscx_module objects simulating a Reference to a resource. If the list changes, then every pyaoscx_module object has to be changed.
-
apply
()¶ - Main method used to either create or update an existing VRF table
- entry. Checks whether the VRF exists in the switch. Calls self.update() if VRF is being updated. Calls self.create() if a new VRF is being created.
Return modified: Boolean, True if object was created or modified.
-
base_uri
= 'system/vrfs'¶
-
bgp_routers
¶ - Attribute descriptor class to keep track of a list that contains
- pyaoscx_module objects simulating a Reference to a resource. If the list changes, then every pyaoscx_module object has to be changed.
-
create
()¶ - Perform a POST call to create a new VRF using the object’s attributes
- as POST body. Only returns if no exception is raised.
Return modified: Boolean, True if entry was created
-
delete
()¶ Perform DELETE call to delete VRF table entry.
-
delete_address_family
(family_type='ipv4_unicast')¶ Given an address family type, delete that address from the current Vrf.
Parameters: family_type – Alphanumeric type of the Address Family. The options are ‘ipv4_unicast’ and ‘ipv6_unicast’. A VrfAddressFamily object is accepted. The default value is set to ‘ipv4_unicast’.
-
delete_dns
(domain_name=None, domain_list=None, domain_servers=None, host_v4_address_mapping=None, host_v6_address_mapping=None)¶ Delete DNS client configuration within a Vrf object.
Parameters: - domain_name – If value is not None, it is deleted
- domain_list – If value is not None, it is deleted
- domain_servers – If value is not None, it is deleted
- host_v4_address_mapping – If value is not None, it is deleted
- host_v6_address_mapping – If value is not None, it is deleted
Return modified: Returns True if modified.
-
classmethod
from_response
(session, response_data)¶ Create a Vrf object given a response_data related to the Vrf object.
Parameters: - cls – Object’s class.
- session – pyaoscx.Session object used to represent a logical connection to the device.
- response_data – The response must be a dictionary of the form: { “test_vrf”: “/rest/v10.04/system/vrfs/test_vrf” }
Returns: Vrf object
-
classmethod
from_uri
(session, uri)¶ Create a Vrf object given a VRF URI.
Parameters: - session – pyaoscx.Session object used to represent a logical connection to the device.
- uri – a String with a URI.
Return name, vrf_obj: tuple containing both the VRF’s name and a Vrf object.
-
get
(depth=None, selector=None)¶ - Perform a GET call to retrieve data for a VRF table entry and fill the
- class with the incoming attributes.
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.
Returns: Returns True if no exception is raised.
-
classmethod
get_all
(session)¶ - Perform a GET call to retrieve all system VRFs and create a dictionary
- containing them.
Parameters: - cls – Object’s class.
- session – pyaoscx.Session object used to represent a logical connection to the device.
Returns: Dictionary containing VRF names as keys and a Vrf objects as values.
-
classmethod
get_facts
(session)¶ - Modify this to Perform a GET call to retrieve all VRFs and their
- respective data.
Parameters: - cls – Class reference.
- session – pyaoscx.Session object used to represent a logical connection to the device.
Return facts: Dictionary containing VRF IDs as keys and VRF objects as values.
-
get_info_format
()¶ - Method used to obtain correct object format for referencing inside
- other objects.
return: Object format depending on the API Version.
-
get_uri
()¶ Method used to obtain the specific VRF URI.
return: Object’s URI.
-
indices
= ['name']¶
-
modified
¶ Return boolean with whether this object has been modified.
-
ospf_routers
¶ - Attribute descriptor class to keep track of a list that contains
- pyaoscx_module objects simulating a Reference to a resource. If the list changes, then every pyaoscx_module object has to be changed.
-
ospfv3_routers
¶ - Attribute descriptor class to keep track of a list that contains
- pyaoscx_module objects simulating a Reference to a resource. If the list changes, then every pyaoscx_module object has to be changed.
-
remove_bgp_router
(router)¶ - Update references to BGP Routers. If a Router with the same instance
- tag is found, delete the reference to it.
-
remove_ospf_router
(router)¶ - Update references to OSPF Routers. If a Router with the same instance
- tag is found, delete the reference to it.
-
resource_uri_name
= 'vrfs'¶
-
setup_dns
(domain_name=None, domain_list=None, domain_servers=None, host_v4_address_mapping=None, host_v6_address_mapping=None)¶ Setup DNS client configuration within a VRF.
Parameters: - domain_name – Domain name used for name resolution by the DNS client, if ‘dns_domain_list’ is not configured.
- domain_list – dict of DNS Domain list names to be used for address resolution, keyed by the resolution priority order. Example: { 0: “hpe.com” 1: “arubanetworks.com” }
- domain_servers – dict of DNS Name servers to be used for address resolution, keyed by the resolution priority order. Example: { 0: “4.4.4.10” 1: “4.4.4.12” }
- host_v4_address_mapping – dict of static host address configurations and the IPv4 address associated with them. Example: { “host1”: “5.5.44.5” “host2”: “2.2.44.2” }
- host_v6_address_mapping – dict of static host address configurations and the IPv6 address associated with them. Example: { “host1”: “2001:0db8:85a3:0000:0000:8a2e:0370:7334” }
Return modified: Returns True if modified.
-
static_routes
¶ - Attribute descriptor class to keep track of a list that contains
- pyaoscx_module objects simulating a Reference to a resource. If the list changes, then every pyaoscx_module object has to be changed.
-
update
()¶ Perform a PUT call to apply changes to an existing VRF table entry.
Return modified: True if Object was modified and a PUT request was made.
-
update_bgp_routers
(router)¶ - Update references to BGP Routers. If a Router with the same instance
- tag is found, update the reference to the new router, otherwise, add reference to the new router.
-
update_ospf_routers
(router)¶ - Update references to OSPF Routers. If a Router with the same instance
- tag is found, update the reference to the new router, otherwise, add reference to the new router.
-
was_modified
()¶ Getter method for the __modified attribute.
Returns: Boolean True if the object was recently modified.
-