pyaoscx.static_nexthop module¶
-
class
pyaoscx.static_nexthop.
StaticNexthop
(session, _id, parent_static_route, uri=None, **kwargs)¶ Bases:
pyaoscx.pyaoscx_module.PyaoscxModule
- Provide configuration management for Static Nexthop settings on AOS-CX
- devices.
-
apply
()¶ - Main method used to either create or update an existing Static Nexthop.
- Checks whether the static_nexthop exists in the switch. Calls self.update() if Static Nexthop being updated. Calls self.create() if a new Static Nexthop is being created.
Returns: Boolean, True if object was created or modified.
-
create
()¶ - Perform a POST call to create a new static_nexthop. Only returns if no
- exception is raised.
Returns: Boolean, True if entry was created
-
delete
()¶ Perform DELETE call to delete StaticNexthop table entry.
-
classmethod
from_response
(session, parent_static_route, response_data)¶ - Create a StaticNexthop object given a response_data related to the
- Static Nexthop ID object.
Parameters: - cls – Object’s class.
- session – pyaoscx.Session object used to represent a logical connection to the device.
- parent_static_route – parent StaticRoute object where Static Nexthop is stored.
- response_data – The response must be a dictionary of the form: { id: “/rest/v10.04/system/static_routes/static_nexthops/id” }
Returns: StaticNexthop object.
-
classmethod
from_uri
(session, parent_static_route, uri)¶ Create a StaticNexthop object given a URI.
Parameters: - cls – Object’s class.
- session – pyaoscx.Session object used to represent a logical connection to the device.
- parent_static_route – parent static_route class where static_nexthop is stored.
- uri – a String with a URI.
Returns: tuple containing both the Static Nexthop object and the Static Nexthop’s ID.
-
get
(depth=None, selector=None)¶ - Perform a GET call to retrieve data for a Static Nexthop 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 no exception is raised.
-
classmethod
get_all
(session, parent_static_route)¶ - Perform a GET call to retrieve all system Static Nexthop objects
- related to a Static Route, and create a dictionary containing StaticNexthop objects.
Parameters: - cls – Object’s class.
- session – pyaoscx.Session object used to represent a logical connection to the device.
- parent_static_route – StaticRoute object, parent for the Static Nexthops.
Returns: Dictionary containing Static Nexthop IDs as keys and a Static NexthopThis 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
-
classmethod
get_next_id
(session, parent_static_route)¶ - Method used to obtain the ID for the next Static Nexthop. Thus perform
- a GET call to retrieve all system Static Nexthop inside a Static Route, and with it determine the next ID.
Parameters: - cls – Object’s class.
- session – pyaoscx.Session object used to represent a logical connection to the device.
- parent_static_route – StaticRoute object, parent for the Static Nexthops.
Returns: Integer with the new Id for the next Static Nexthop.
-
get_uri
()¶ Method used to obtain the specific Static Nexthop URI.
Returns: Object’s URI.
-
indices
= ['id']¶
-
modified
¶ Return boolean with whether this object has been modified.
-
resource_uri_name
= 'static_nexthops'¶
-
update
()¶ Perform a PUT call to apply changes to an existing static_nexthop.
Return modified: 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.