pyaoscx.dhcp_relay module¶
-
class
pyaoscx.dhcp_relay.
DhcpRelay
(session, vrf, port, uri=None, **kwargs)¶ Bases:
pyaoscx.pyaoscx_module.PyaoscxModule
Provide configuration management for DHCP Relay on AOS-CX devices.
-
add_ipv4_addresses
(ipv4_list)¶ - Perform a PUT calls to modify an existing DhcpRelay. Adding a list of
- IPv4 addresses into IPv4_ucast_server
Parameters: ipv4_list – List of IPv4 addresses. Example: [‘1.1.1.1’, ‘2.2.2.2’] Returns: True if object was changed.
-
add_ipv6_addresses
(ipv6_list)¶ - Perform a PUT calls to modify an existing DhcpRelay. Adding a list of
- IPv6 addresses into IPv6_ucast_server.
Parameters: ipv6_list – List of IPv6 addresses. Example: [‘2001:db8::11/ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff’] Returns: True if object was changed.
-
apply
()¶ - Main method used to either create or update an existing DHCP Relay.
- Checks whether the DHCP Relay exists in the switch. Calls self.update() if DHCP Relay is being updated. Calls self.create() if a new DHCP Relay is being created.
Returns: Boolean, True if object was created or modified.
-
base_uri
= 'system/dhcp_relays'¶
-
create
()¶ - Perform a POST call to create a new DHCP Relay. Only returns if no
- exception is raised.
Returns: Boolean, True if entry was created.
-
delete
()¶ Perform DELETE call to delete DhcpRelay table entry.
-
classmethod
from_response
(session, response_data)¶ Create a DhcpRelay object given a response_data.
Parameters: - cls – Class calling the method.
- session – pyaoscx.Session object used to represent a logical connection to the device.
- response_data – The response must be a dictionary of the form: { {vrf},{port}: “/rest/v10.04/system/dhcp_relays/{vrf},{port}” }
Returns: DhcpRelay object.
-
classmethod
from_uri
(session, uri)¶ Create a DHCP Relay object given a URI.
Parameters: - cls – Class calling the method.
- session – pyaoscx.Session object used to represent a logical connection to the device.
- uri – a String with a URI.
Returns: tuple containing both the indices and DhcpRelay object.
-
get
(depth=None, selector=None)¶ - Perform a GET call to retrieve data for a DHCP Relay 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)¶ - Perform a GET call to retrieve all system DHCP Relays, and create a
- dictionary containing them.
Parameters: - cls – Object’s class.
- session – pyaoscx.Session object used to represent a logical connection to the device.
Returns: Dictionary containing DHCP Relays IDs as keys and a DHCP Relay 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 DhcpRelay URI.
Returns: Object’s URI.
-
indices
= ['vrf', 'port']¶
-
modified
¶ Return boolean with whether this object has been modified
-
resource_uri_name
= 'dhcp_relays'¶
-
update
()¶ Perform a PUT call to apply changes to an existing DHCP Relay.
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.
-