pyaoscx.static_mac module¶
-
class
pyaoscx.static_mac.
StaticMac
(session, mac_addr, parent_vlan, uri=None, **kwargs)¶ Bases:
pyaoscx.pyaoscx_module.PyaoscxModule
Provide configuration management for Static MAC on AOS-CX devices.
-
apply
()¶ - Main method used to either create or update an existing Static MAC.
- Checks whether the Static MAC exists in the switch. Calls self.update() if Static MAC is being updated. Calls self.create() if a new Static MAC is being created.
Returns: Boolean, True if object was created or modified.
-
collection_uri
= 'system/vlans/{vlan_id}/static_macs'¶
-
create
()¶ - Perform a POST call to create a new Static MAC using the object’s
- attributes as POST body. Only returns if no exception is raised.
Returns: Boolean, True if entry was created
-
delete
()¶ Perform DELETE call to delete Static MAC.
-
classmethod
from_response
(session, parent_vlan, response_data)¶ Create a Static MAC object given a response_data related to it.
Parameters: - cls – Object’s class.
- session – pyaoscx.Session object used to represent a logical connection to the device.
- parent_vlan – parent Vlan object where Static MAC is stored.
- response_data – The response must be a dictionary of the form: { <mac_addr>: ( “/rest/v10.04/system/vlans/<vlan_id>/static_macs/<mac_addr>” ) }
Returns: Static MAC object
-
classmethod
from_uri
(session, parent_vlan, uri)¶ Create a StaticMac object given a URI.
Parameters: - cls – Object’s class.
- session – pyaoscx.Session object used to represent a logical connection to the device.
- parent_vlan – VLAN object where Static MAC is stored.
- uri – a String with a URI.
Return index, static_mac_obj: tuple containing both the StaticMac Object and the static_mac’s mac_address.
-
get
(depth=None, selector=None)¶ - Perform a GET call to retrieve data for a Static 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 there is not an exception raised.
-
classmethod
get_all
(session, parent_vlan)¶ - Perform a GET call to retrieve all system Static MACs inside a VLAN,
- 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 – VLAN object where Static MAC is stored.
Returns: Dictionary containing Static MAC IDs as keys and a Static MAC 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 Statis MAC URI.
Returns: Object’s URI.
-
indices
= ['mac_addr']¶
-
mac_addr
¶
-
modified
¶ Return boolean with whether this object has been modified.
-
object_uri
= 'system/vlans/{vlan_id}/static_macs/{mac_addr}'¶
-
resource_uri_name
= 'static_macs'¶
-
update
()¶ Perform a PUT call to apply changes to an existing Static MAC.
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.
-