pyaoscx.bgp_neighbor module¶
-
class
pyaoscx.bgp_neighbor.
BgpNeighbor
(session, ip_or_ifname_or_group_name, parent_bgp_router, uri=None, **kwargs)¶ Bases:
pyaoscx.pyaoscx_module.PyaoscxModule
Provide configuration management for BGP Neighbor on AOS-CX devices.
-
apply
()¶ - Main method used to either create or update an existing BGP Neighbor.
- Checks whether the BGP Neighbor exists in the switch. Calls self.update() if BGP Neighbor is being updated. Calls self.create() if a new BGP Neighbor is being created.
Returns: Boolean, True if object was created or modified.
-
create
()¶ Perform a POST call to create a new BGP Neighbor table entry Only returns if an exception is not raise
Returns: Boolean, True if entry was created
-
delete
()¶ Perform DELETE call to delete BGP Neighbor table entry.
-
classmethod
from_response
(session, parent_bgp_router, response_data)¶ Create a BgpNeighbor object given a response_data related to the BGP Router ID object
Parameters: - cls – Object’s class
- session – pyaoscx.Session object used to represent a logical connection to the device
- parent_bgp_router – parent BgpRouter object where BGP Neighbor is stored
- response_data – The response can be either a dictionary: { id: “/rest/v10.04/system/vrfs/<vrf_name>/bgp_routers/asn /bgp_neighbors/id” } or a string: “/rest/v10.04/system/vrfs/<vrf_name>/bgp_routers/asn/ bgp_neighbors/id”
Returns: BgpNeighbor object
-
classmethod
from_uri
(session, parent_bgp_router, uri)¶ Create a BgpNeighbor object given a URI
Parameters: - cls – Object’s class
- session – pyaoscx.Session object used to represent a logical connection to the device
- parent_bgp_router – parent BgpRouter object where BGP Neighbor is stored
- uri – a String with a URI
Returns: tuple containing both the BGP object and the BGP’s ID
-
get
(depth=None, selector=None)¶ Perform a GET call to retrieve data for a BGP Neighbor 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_bgp_router)¶ Perform a GET call to retrieve all system BGP Neighbors 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_bgp_router – parent BgpRouter object where BGP Neighbor is stored
Returns: Dictionary containing BGP Neighbors IDs as keys and a BGP Neighbors 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 BGP Neighbor URI
return: Object’s URI
-
indices
= ['ip_or_ifname_or_group_name']¶
-
modified
¶ Return boolean with whether this object has been modified
-
resource_uri_name
= 'bgp_neighbors'¶
-
update
()¶ Perform a PUT call to apply changes to an existing BGP Neighbor.
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.
-