pyaoscx.vni module

class pyaoscx.vni.Vni(session, vni_id, interface, vni_type='vxlan_vni', **kwargs)

Bases: pyaoscx.pyaoscx_module.PyaoscxModule

Provide configuration management for Virtual Network IDs on
AOS-CX devices
apply()
Main method used to either create or update a
VNI table entry
Returns:True if the object was modified
collection_uri = 'system/virtual_network_ids'
create()
Perform a POST call to create a new VNI using the object’s
attributes as POST body. Exception is raised if object is unable to be created
Returns:Boolean, True if entry was created
delete()

Perform a DELETE call to erase the VNI table entry.

classmethod from_response(session, parent_intf, response_data)

Create a VNI object given a response_data related to a VNI object

Parameters:
  • cls – Object’s class
  • session – pyaoscx.Session object used to represent a logical connection to the device
  • parent_intf – Interface attached to this tunnel
  • response_data – The response must be a dictionary of the form: {id: URL}
Returns:

VNI object

classmethod from_uri(session, parent_intf, uri)

Create a Vni object given a VNI URI

Parameters:
  • cls – Object’s class
  • session – pyaoscx.Session object used to represent a logical connection to the device
  • parent_intf – Interface attached to this tunnel
  • uri – A String with a URI
Returns:

tuple containing the VNI ids (type, and actual ID) and the VNI object.

get(depth=None, selector=None)
Perform a GET call to retrieve data for VNI 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_intf)
Perform a GET call to retrieve all system VNI and create a dictionary
containing each respective VNI
Parameters:
  • cls – Object’s class
  • session – pyaoscx.Session object used to represent a logical connection to the switch
  • parent_intf – Interface attached to this tunnel
Returns:

Dictionary containing VNI IDs and a VNI object as value

get_info_format()
Method 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 VNI URI

Returns:Object’s URI
indices = ['type', 'id']
interface

Getter method for the interface attribute.

Returns:Interface object for method.
modified

Return boolean with whether this object has been modified.

object_uri = 'system/virtual_network_ids/{type},{id}'
resource_uri_name = 'virtual_network_ids'
update()

Perform a PUT call to apply changes to an existing VNI table entry

Returns:True if object was modified and a PUT request was made. False otherwise
was_modified()

Getter method for the __modified attribute.

Returns:Boolean True if the object was recently modified.