pyaoscx.ospf_interface module

class pyaoscx.ospf_interface.OspfInterface(session, interface_name, parent_ospf_area, **kwargs)

Bases: pyaoscx.pyaoscx_module.PyaoscxModule

Provide configuration management for OSPF Interface on AOS-CX devices.

apply()
Main method used to either create or update an existing OSPF Interface.
Checks whether the OSPF Interface exists in the switch. Calls self.update() if OSPF Interface being updated. Calls self.create() if a new OSPF Interface is being created.
Returns:Boolean, True if object was created or modified.
collection_uri = 'system/vrfs/{name}/ospf{version}_routers/{instance_tag}/areas/{area_id}/ospf_interfaces'
create()
Perform a POST call to create a new OSPF Interface table entry. Only
returns if an exception is not raised.
Returns:True if OSPF Interface table entry was added.
delete()

Perform DELETE call to delete OSPF Interface.

classmethod from_response(session, parent_ospf_area, response_data)
Create a OspfInterface object given a response_data related to the OSPF
Area ID object.
Parameters:
  • cls – Object’s class.
  • session – pyaoscx.Session object used to represent a logical connection to the device.
  • parent_ospf_area – parent OspfArea object where OspfInterface object is stored.
  • response_data – The response must be a dictionary of the form {id: URL}, with the URL being of the form: “ospf_routers/<id>/areas/<id>/ospf_interfaces/<interface_name>” under the path: “/rest/v10.04/system/vrfs/<vrf_name>/”
Returns:

OspfInterface object.

classmethod from_uri(session, parent_ospf_area, uri)

Create a OspfInterface object given a URI.

Parameters:
  • cls – Object’s class.
  • session – pyaoscx.Session object used to represent a logical connection to the device.
Returns:

tuple containing both the OspfInterface name, and an OspfInterface object.

get(depth=None, selector=None)
Perform a GET call to retrieve data for a OSPF Interfaces 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_ospf_area)
Perform a GET call to retrieve all system OSPF Interfaces inside a OSPF
Area, and create a dictionary containing them as OspfInterface objects.
Parameters:
  • cls – Object’s class.
  • session – pyaoscx.Session object used to represent a logical connection to the device.
  • parent_ospf_area – parent OspfArea object where OspfInterface object is stored.
Returns:

Dictionary containing OSPF Interface IDs as keys and a OspfInterface 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 OSPF Interface uri.

Returns:Object’s URI.
indices = ['interface_name']
interface_name
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/{interface_name}'
port
resource_uri_name = 'ospf_interfaces'
update()

Perform a PUT call to apply changes to an existing OSPF Interface.

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.