pyaoscx.ospf_router module¶
-
class
pyaoscx.ospf_router.
OspfRouter
(session, instance_tag, parent_vrf, **kwargs)¶ Bases:
pyaoscx.pyaoscx_module.PyaoscxModule
Provide configuration management for OSPF Routers on AOS-CX devices.
-
apply
()¶ - Main method used to either create update an existing OSPF Router.
- Checks whether the VRF exists in the switch. Calls self.update() if OSPF Router is being updated. Calls self.create() if a new OSPF Router is being created.
Returns: Boolean, True if object was created or modified.
-
areas
¶ - 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.
-
collection_uri
= 'system/vrfs/{name}/ospf{version}_routers'¶
-
create
()¶ - Perform a POST call to create a new OSPF Router. Only returns if an
- exception is not raised.
Returns: True if entry was created.
-
delete
()¶ Perform DELETE call to delete OSPF Router table entry.
-
classmethod
from_response
(session, parent_vrf, response_data)¶ - Create a OspfRouter object given a response_data related to the
- OspfRouter object.
Parameters: - cls – Object’s class.
- session – pyaoscx.Session object used to represent a logical connection to the device.
- parent_vrf – Vrf object where OspfRouter object is stored.
- response_data – The response must be a dictionary of the form: {id: URL}, with the URL being of the form “/rest/v10.04/system/vrfs/<name>/ospf_routers/<id>”
Returns: OspfRouter object.
-
classmethod
from_uri
(session, parent_vrf, uri)¶ Create a OspfRouter object given a URI.
Parameters: - session – pyaoscx.Session object used to represent a logical connection to the device.
- uri – a String with a URI.
Returns: tuple(OSPF Instance Tag, OSPF Router).
-
get
(depth=None, selector=None)¶ - Perform a GET call to retrieve data for a OSPF Router 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 OSPF Router settings for a
- given 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 – Vrf object where OspfRouter object is stored.
Returns: Dictionary containing (OSPF Router ID, OspfRouter object) (key,value) pairs.
-
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 OSPF Router URI.
return: Object’s URI.
-
indices
= ['instance_tag']¶
-
instance_tag
¶ Return this OSPF Router’s instance_tag.
-
modified
¶ Return boolean with whether this object has been modified.
-
object_uri
= 'system/vrfs/{name}/ospf{version}_routers/{instance_tag}'¶
-
remove_ospf_area
(area)¶ - Update references to OSPF Areas. If an Area with the same area_id is
- found, delete the reference to it.
Parameters: new_area – Area to add reference to.
-
resource_uri_name
= 'ospf_routers'¶
-
update
()¶ Perform a PUT call to apply changes to an existing OSPF Router.
Returns: True if Object was modified and a PUT request was made.
-
update_ospf_areas
(new_area)¶ - Update references to OSPF Areas. If an Area with the same area_id is
- found, update the reference to the new area, otherwise, add reference to the new area.
Parameters: new_area – Area to add reference to.
-
version
= ''¶
-
was_modified
()¶ Getter method for the __modified attribute.
Returns: Boolean True if the object was recently modified.
-