pyaoscx.ospf_area module¶
-
class
pyaoscx.ospf_area.
OspfArea
(session, area_id, parent_ospf_router, **kwargs)¶ Bases:
pyaoscx.pyaoscx_module.PyaoscxModule
Provide configuration management for OSPF Area instance on AOS-CX devices.
-
apply
()¶ - Main method used to either create or update an existing Ospf Area.
- Checks whether the OSPF Area exists in the switch. Calls self.update() if OSPF Area is being updated. Calls self.create() if a new OSPF Area is being created.
Returns: Boolean, True if object was created or modified.
-
area_id
¶
-
collection_uri
= 'system/vrfs/{name}/ospf{version}_routers/{instance_tag}/areas'¶
-
create
()¶ - Perform a POST call to create a new OSPF Area. Only returns if an
- exception is not raised.
Returns: Boolean, True if entry was created.
-
delete
()¶ Perform DELETE call to delete OSPF Area table entry.
-
classmethod
from_response
(session, parent_ospf_router, response_data)¶ - Create an OspfArea object given a response_data related to the ospf
- router ID object
Parameters: - cls – Object’s class.
- session – pyaoscx.Session object used to represent a logical connection to the device.
- parent_ospf_router – parent OspfRouter object where OspfArea 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>/areas/<id>”
Returns: OspfArea object.
-
classmethod
from_uri
(session, parent_ospf_router, uri)¶ Create an OspfArea 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 containing both the OspfArea object and the OSPF Area’s ID.
-
get
(depth=None, selector=None)¶ - Perform a GET call to retrieve data for a OSPF Area 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 no exception raised.
-
classmethod
get_all
(session, parent_ospf_router)¶ - Perform a GET call to retrieve all system OSPF Area inside a OPSF
- Router, 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_ospf_router – parent OPSF Router object where OPSF Area is stored.
Returns: Dictionary containing OSPF Area IDs as keys and a OSPF Area 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 OSPF Area URI.
return: Object’s URI.
-
indices
= ['area_id']¶
-
modified
¶ Return boolean with whether this object has been modified.
-
object_uri
= 'system/vrfs/{name}/ospf{version}_routers/{instance_tag}/areas/{area_id}'¶
-
ospf_interfaces
¶ - 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_ospf_interface
(interface)¶ - Update references to OSPF Interfaces. If an Interface with the same
- interface_name is found, delete the reference to it.
Parameters: interface – Interface to add reference to.
-
resource_uri_name
= 'areas'¶
-
update
()¶ Perform a PUT call to apply changes to an existing OSPF Area.
Returns: True if Object was modified and a PUT request was made.
-
update_ospf_interfaces
(new_interface)¶ - Update references to OSPF Interfaces. If an Interface with the same
- interface_name is found, update the reference to the new interface, otherwise, add reference to the new interface.
Parameters: new_interface – Interface to add reference to.
-
was_modified
()¶ Getter method for the __modified attribute
Returns: Boolean True if the object was recently modified.
-