pyaoscx.pyaoscx_module module

class pyaoscx.pyaoscx_module.PyaoscxModule

Bases: abc.ABC

Provide an Interface class for pyaoscx Modules.

apply()
Main method used to either create or update an existing
<pyaoscx_module_type>. Checks whether the <pyaoscx_module_type> exists in the switch. Calls self.update() if object being updated. Calls self.create() if a new <pyaoscx_module_type> is being created.
Returns:Boolean, True if object was created or modified.
base_uri = ''
connected()
Function used as a decorator to ensure the module has a established
connection.
Parameters:fnct – function which behavior is modified.
Returns:Function.
create()
Perform a POST call to create a new <pyaoscx_module_type>. Only returns
if an exception is not raise.
Returns:Boolean, True if entry was created.
delete()

Perform DELETE call to delete <pyaoscx_module_type> table entry.

deprecated()

Function used as a decorator to show deprecation notice of a method.

Parameters:func – function whose behavior is modified/wrapped.
Returns:function whose behavior is modified/wrapped.
from_uri(session, uri)

Create a <pyaoscx_module_type> object given its URI.

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

tuple containing both the <pyaoscx_module_type> object its ID.

get(depth=None, selector=None)
Perform a GET call to retrieve data for a 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.

get_all(session)
Perform a GET call to retrieve all system <pyaoscx_module_type> and
create a dictionary of each object.
Parameters:
  • cls – Object’s class.
  • session – pyaoscx.Session object used to represent a logical connection to the device.
Returns:

Dictionary containing object IDs as keys their respective 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.
indices = []
materialized()

Function used as a decorator to verify if the object is materialized.

Para fnct:function which behavior is modified.
Returns:Function.
update()
Perform a PUT call to apply changes to an existing
<pyaoscx_module_type> table entry.
Returns:True if Object was modified and a PUT request was made.