pyaoscx.static_route module¶
-
class
pyaoscx.static_route.
StaticRoute
(session, prefix, parent_vrf, uri=None, **kwargs)¶ Bases:
pyaoscx.pyaoscx_module.PyaoscxModule
Provide configuration management for Static Route on AOS-CX devices.
-
add_static_nexthop
(next_hop_ip_address=None, next_hop_interface=None, distance=None, nexthop_type=None, bfd_enable=None)¶ - Create a Static Nexthop, with a VRF and a Destination Address related
- to a Static Route.
Parameters: - next_hop_ip_address – The IPv4 address or the IPv6 address of next hop. Example: ‘1.1.1.1’ or ‘2001:db8::11/ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff’
- next_hop_interface – The interface through which the next hop can be reached.
- distance – Administrative distance to be used for the next hop in the static route instead of default value.
- nexthop_type – Specifies whether the static route is a forward, blackhole or reject route.
- bfd_enable – Boolean to enable BFD.
Returns: StaticNexthop object.
-
apply
()¶ - Main method used to either create a new or update an existing Static
- Route table entry. Checks whether the Static Route exists in the switch. Calls self.update() if object being updated. Calls self.create() if a new Static Route is being created.
Returns: Boolean, True if object was created or modified.
-
create
()¶ - Perform a POST call to create a new Static Route table entry. Only
- returns if no exception is raised.
Returns: Boolean, True if entry was created
-
delete
()¶ Perform DELETE call to delete specified Static Route table entry.
-
classmethod
from_response
(session, parent_vrf, response_data)¶ - Create a StaticRoute object given a response_data related to the Static
- Route prefix object.
Parameters: - cls – Object’s class.
- session – pyaoscx.Session object used to represent a logical connection to the device.
- parent_vrf – parent Vrf object where Static Route is stored.
- response_data – The response must be a dictionary of the form: { prefix: “/rest/v10.04/system/vrfs/static_routes/prefix” }
Returns: Static Route Object.
-
classmethod
from_uri
(session, parent_vrf, uri)¶ Create a StaticRoute object given a URI.
Parameters: - cls – Object’s class.
- session – pyaoscx.Session object used to represent a logical connection to the device.
- parent_vrf – parent Vrf object where Static Route is stored.
- uri – a String with a URI.
Returns: tuple containing both the static_route object and the static_route’s prefix.
-
get
(depth=None, selector=None)¶ - Perform a GET call to retrieve data for a Static Route table entry and
- fill the object 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 there is not an exception raised.
-
classmethod
get_all
(session, parent_vrf)¶ - Perform a GET call to retrieve all system Static Routes inside a VRF,
- and create a dictionary containing them.
Parameters: - cls – Object’s class.
- session – pyaoscx.Session object used to represent a logical connection to the device.
- parent_vrf – parent Vrf object where vrf is stored.
Returns: Dictionary containing Static Route IDs as keys and a Static Route objects as values.
-
get_info_format
()¶ - Method used to obtain correct object format for referencing inside
- other objects.
Returns: Object format depending on the API Version.
-
get_uri
()¶ Method used to obtain the specific static route URI.
Returns: Object’s URI.
-
indices
= ['prefix']¶
-
modified
¶ Return boolean with whether this object has been modified.
-
resource_uri_name
= 'static_routes'¶
-
static_nexthops
¶ - 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 Static Route table
- entry.
Returns: True if Object was modified and a PUT request was made.
-
was_modified
()¶ Getter method for the __modified attribute.
Returns: Boolean True if the object was recently modified.
-