pyaoscx.mac module

class pyaoscx.mac.Mac(session, from_id, mac_addr, parent_vlan, uri=None)

Bases: pyaoscx.pyaoscx_module.PyaoscxModule

Provide configuration management for vlans/<id>/macs on AOS-CX devices.

apply()

Not applicable for MAC. As HTTP Request method is not implemented inside REST API.

create()

Not applicable for MAC. As HTTP Request method is not implemented inside REST API.

delete()

Not applicable for MAC. As HTTP Request method is not implemented inside REST API.

classmethod from_response(session, parent_vlan, response_data)

Create a Mac object given a response_data related to the MAC ID object.

Parameters:
  • cls – Object’s class.
  • session – pyaoscx.Session object used to represent a logical connection to the device.
  • parent_vlan – parent VLAN class where MAC is stored.
  • response_data – The response must be a dictionary of the form: { “<id1>,<id2>”: “/rest/v10.04/system/vlans/id/macs/id1,id2” }
Returns:

Mac object.

classmethod from_uri(session, parent_vlan, uri)

Create a Mac object.

Parameters:
  • session – pyaoscx.Session object used to represent a logical connection to the device.
  • parent_vlan – parent VLAN class where MAC is stored.
  • uri – a String with a URI.
Return indices, mac:
 

tuple containing both the Mac object and the MAC’ ID.

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

classmethod get_all(session, parent_vlan=None)
Perform a GET call to retrieve all system MACs inside a BGP 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_vlan – parent bgp_router object where MAC is stored.
Returns:

Dictionary containing MACs IDs as keys and a Mac objects as values.

get_info()
Perform a GET call to retrieve data for a MAC table entry and return
info as a dictionary. Do not apply the configuration.
Return info_dict:
 Returns a dictionary containing the current MAC Address information.
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 MAC URI

return: Object’s URI.

indices = ['from', 'mac_addr']
info_format
Method used to obtain correct object format for referencing inside
other objects.

return: Object format depending on the API Version

modified

Return boolean with whether this object has been modified.

resource_uri_name = 'macs'
update()

Not applicable for MAC. As HTTP Request method is not implemented inside REST API.

uri_path

Method used to obtain the specific MAC URI.

return: Object’s URI.

was_modified()

Getter method for the __modified attribute

Returns:Boolean. True if the object was recently modified.