acitoolkit module

// ACI Toolkit Class Hierarchy
digraph "ACI Toolkit Class Hierarchy" {
    node [color=lightblue2 style=filled]
    edge [arrowhead=none]
    ContractSubject [label=ContractSubject]
    OutputTerminal [label=OutputTerminal]
    EPG [label=EPG]
    IPEndpoint [label=IPEndpoint]
    Filter [label=Filter]
    AppProfile [label=AppProfile]
    OutsideL3 [label=OutsideL3]
    Tag [label=Tag]
    AttributeCriterion [label=AttributeCriterion]
    Taboo [label=Taboo]
    Endpoint [label=Endpoint]
    Tenant [label=Tenant]
    Context [label=Context]
    OutsideEPG [label=OutsideEPG]
    Fabric [label=Fabric]
    LogicalModel [label=LogicalModel]
    Contract [label=Contract]
    FilterEntry [label=FilterEntry]
    BridgeDomain [label=BridgeDomain]
    Subnet [label=Subnet]
    OutsideL2 [label=OutsideL2]
    OutsideL2EPG [label=OutsideL2EPG]
    ContractInterface [label=ContractInterface]
    OutsideNetwork [label=OutsideNetwork]
    InputTerminal [label=InputTerminal]
    AnyEPG [label=AnyEPG]
    PhysicalModel [label=PhysicalModel]
    Pod [label=Pod]
    ExternalSwitch [label=ExternalSwitch]
    Link [label=Link]
    "Node " [label="Node "]
    Powersupply [label=Powersupply]
    Linecard [label=Linecard]
    Interface [label=Interface]
    Supervisorcard [label=Supervisorcard]
    Fantray [label=Fantray]
    Fan [label=Fan]
    Systemcontroller [label=Systemcontroller]
    ContractSubject -> OutputTerminal
    EPG -> IPEndpoint
    ContractSubject -> Filter
    AppProfile -> EPG
    OutsideL3 -> Tag
    EPG -> AttributeCriterion
    Taboo -> ContractSubject
    EPG -> Endpoint
    Tenant -> Context
    OutsideEPG -> Tag
    Fabric -> LogicalModel
    Contract -> FilterEntry
    BridgeDomain -> Subnet
    OutsideL2 -> OutsideL2EPG
    Tenant -> ContractInterface
    Contract -> ContractSubject
    Context -> Tag
    OutsideEPG -> OutsideNetwork
    BridgeDomain -> Tag
    Tenant -> Filter
    Tenant -> Tag
    Filter -> Tag
    LogicalModel -> Tenant
    Tenant -> Taboo
    ContractSubject -> InputTerminal
    OutsideL3 -> OutsideEPG
    EPG -> Tag
    Taboo -> FilterEntry
    Context -> AnyEPG
    OutsideL2 -> Tag
    Tenant -> AppProfile
    Tenant -> OutsideL3
    Filter -> FilterEntry
    Tenant -> Contract
    Tenant -> OutsideL2
    Fabric -> PhysicalModel
    Contract -> Tag
    Tenant -> BridgeDomain
    PhysicalModel -> Pod
    Pod -> ExternalSwitch
    Pod -> Link
    Pod -> "Node "
    "Node " -> Powersupply
    Linecard -> Interface
    "Node " -> Linecard
    "Node " -> Supervisorcard
    "Node " -> Fantray
    Fantray -> Fan
    "Node " -> Systemcontroller
}

Main ACI Toolkit module This is the main module that comprises the ACI Toolkit.

class acitoolkit.acitoolkit.AnyEPG(epg_name, parent=None)

Bases: acitoolkit.acitoolkit.CommonEPG

AnyEPG class, roughly equivalent to vz:Any

Parameters:
  • epg_name – String containing the name of this EPG
  • parent – Instance of the AppProfile class representing the Application Profile where this EPG is contained.
add_child(obj)

Add a child to the children list.

Parameters:obj – Child object to add to the children list of the called object.
add_tag(tag)

Assign this object a particular tag. Tags are strings that can be used to classify objects. More than 1 tag can be assigned to an object.

Parameters:tag – string containing the tag to assign to this object or an instance of _Tag
attach(item)

Attach the object to the other object.

Parameters:item – Object to be attached.
static check_session(session)

This will check that the session is of type Session and raise exception if it not

Parameters:session – the session to check
Returns:
consume(contract)

Make this EPG consume a Contract

Parameters:contract – Contract class instance to be consumed by this EPG.
Returns:True
consume_cif(contract_interface)

Make this EPG consume a ContractInterface

Parameters:contract_interface – ContractInterface class instance to be consumed by this EPG.
Returns:True
delete_tag(tag)

Mark a particular tag as being deleted from this object.

Parameters:tag – string containing the tag to delete from this object or an instance of _Tag
detach(item)

Detach the object from the other object. A relationship is either ‘attached’, ‘detached’, or does not exist. A detached relationship will cause the relationship to be deleted when pushed to the APIC.

Parameters:item – Object to be detached.
does_consume(contract)

Check if this EPG consumes a specific Contract

Parameters:contract – Instance of Contract class to check if it is consumed by this EPG.
Returns:True or False. True if the EPG does consume the Contract.
does_consume_cif(contract_interface)

Check if this EPG consumes a specific Contract

Parameters:contract_interface
Returns:True or False. True if the EPG does consume the ContractInterface.
does_protect(taboo)

Check if this EPG is protected by a specific Taboo.

Parameters:taboo – Instance of Taboo class to check if it protects this EPG.
Returns:True or False. True if the EPG is protected by the Taboo.
does_provide(contract)

Check if this EPG provides a specific Contract.

Parameters:contract – Instance of Contract class to check if it is provided by this EPG.
Returns:True or False. True if the EPG does provide the Contract.
dont_consume(contract)

Make this EPG not consume a Contract. It does not check to see if the Contract was already consumed

Parameters:contract – Instance of Contract class to be no longer consumed by this EPG.
Returns:True
dont_consume_cif(contract_interface)

Make this EPG not consume a ContractInterface. It does not check to see if the ContractInterface was already consumed

Parameters:contract_interface
Returns:True
dont_protect(taboo)

Make this EPG not protected by a Taboo

Parameters:taboo – Instance of Taboo class to no longer protect this EPG.
Returns:True
dont_provide(contract)

Make this EPG not provide a Contract

Parameters:contract – Instance of Contract class to be no longer provided by this EPG.
Returns:True
find(search_object)

This will check to see if self is a match with search_object and then call find on all of the children of search. If there is a match, a list containing self and any matches found by the children will be returned as a list.

The criteria for a match is that all attributes of self are compared to all attributes of search_object. If search_object.<attr> exists and is the same as self.<attr> or search_object.<attr> is ‘None’, then that attribute matches. If all such attributes match, then there is a match and self will be returned in the result.

If there is an attribute of search_object that does not exist in self, it will be considered a mismatch. If there is an attribute of self that does not exist in search_object, it will be ignored.

Parameters:search_object – ACI object to search
Returns:List of objects
classmethod get(session, parent=None, tenant=None)

Gets all of the EPGs from the APIC.

Parameters:
  • session – the instance of Session used for APIC communication
  • parent – Instance of the AppProfile class used to limit the EPGs retreived from the APIC.
  • tenant – Instance of Tenant class used to limit the EPGs retreived from the APIC.
Returns:

List of CommonEPG instances (or EPG instances if called from EPG class)

get_all_attached(attached_class, status='attached', relation_type=None)

Get all of the relations of objects belonging to the specified class with the specified status.

Parameters:
  • attached_class – The class that is the subject of the search.
  • status – Valid values are ‘attached’ and ‘detached’. Default is ‘attached’.
get_all_attachments(attached_class, status='attached', relation_type=None)

Get all of the attachments to an object belonging to the specified class with the specified status.

Parameters:
  • attached_class – The class that is the subject of the search.
  • status – Valid values are ‘attached’ and ‘detached’. Default is ‘attached’.
get_all_consumed(deleted=False)

Get all of the Contracts consumed by this EPG

Parameters:deleted – Boolean indicating whether to get Contracts that are consumed or that the consumed was marked as deleted
Returns:List of Contract objects that are consumed by the EPG.
get_all_consumed_cif(deleted=False)

Get all of the ContractInterfaces consumed by this EPG

Parameters:deleted – Boolean indicating whether to get ContractInterfaces that are consumed or that the consumed was marked as deleted
Returns:List of ContractInterface objects that are consumed by the EPG.
get_all_protected(deleted=False)

Get all of the Taboos protecting this EPG

Parameters:deleted – Boolean indicating whether to get Taboos that are protected or that the protected was marked as deleted
Returns:List of Taboo objects that are protecting the EPG.
get_all_provided(deleted=False)

Get all of the Contracts provided by this EPG

Parameters:deleted – Boolean indicating whether to get Contracts that are provided or that the provided was marked as deleted
Returns:List of Contract objects that are provided by the EPG.
get_attributes(name=None)

Will return the value of the named attribute in a dictionary format. If no name is given, then it will return all attributes.

Note that attributes that start with _ (underbar) will NOT be included unless explicitly named

This method should be over-written as appropriate by inheriting objects to handle how their local attributes are implemented.

This is intended to normalize how all attributes on all objects can be accessed since the implementations were not consistent.

Parameters:name – optional name of attribute to return
Returns:dictionary of attributes and their values
get_child(child_type, child_name)

Gets a specific immediate child of this object

Parameters:
  • child_type – Class of the child to return
  • child_name – Name of the child to return
Returns:

The specific instance of child_type or None if not found

get_children(only_class=None)

Get a list of the immediate child objects of this object.

Parameters:only_class – Optional parameter that will be used to limit the objects returned to only those belonging to the class passed in this parameter.
Returns:List of children objects.
classmethod get_deep(full_data, working_data, parent=None, limit_to=(), subtree='full', config_only=False)

Gets all instances of this class from the APIC and gets all of the children as well.

Parameters:
  • full_data
  • working_data
  • parent
  • limit_to
  • subtree
  • config_only
classmethod get_deep_apic_classes(include_concrete=False)

Get all the apic classes needed for this acitoolkit class and all of its children. :return: list of all apic classes

get_dn_from_attributes(attributes)

Will get the dn from the attributes or construct it using the dn of the parent plus the rn. Failing those, it will return None

Parameters:attributes
Returns:String containing dn or None
classmethod get_event(session)

Gets the event that is pending for this class. Events are returned in the form of objects. Objects that have been deleted are marked as such.

Parameters:session – the instance of Session used for APIC communication
classmethod get_fault(session, extension='')

Gets the fault that is pending for this class. Faults are returned in the form of objects. Objects that have been deleted are marked as such.

Parameters:session – the instance of Session used for APIC communication
get_from_json(data, parent=None)

returns a Tenant object from a json

get_interfaces(status='attached')

Get all of the interfaces that this EPG is attached. The default is to get list of ‘attached’ interfaces. If ‘status’ is set to ‘detached’ it will return the list of detached Interface objects (Those EPGs which are no longer attached to an Interface, but the configuration is not yet pushed to the APIC.)

Parameters:status – ‘attached’ or ‘detached’. Defaults to ‘attached’.
Returns:List of Interface objects
get_json()

Returns json representation of the EPG

Returns:json dictionary of the EPG
get_parent()
Returns:Parent of this object.
get_searchable()

Method to recursively retrieve all of the searchable items from all the children objects, add the current object to them as additional context, append the local searchable terms, and return the result.

static get_table(aci_object, title='')

Abstract method that should be replaced by a version that is specific to the object

Parameters:
  • aci_object
  • title – String containing the table title
Returns:

list of Table objects

get_tags()

Get the tags assigned to this object.

Returns:List of tag instances
has_attachment(item)

Indicates whether this object is attached to the item/ :returns: True or False, True indicates the object is attached.

has_child(obj)

Check for existence of a child in the children list

Parameters:obj – Child object that is the subject of the check.
Returns:True or False, True indicates that it does indeed have the obj object as a child.
has_detachment(item)

Indicates whether the object is detached from this item. :returns: True or False, True indicates the object is detached.

classmethod has_events(session, extension='')

Check for pending events from the APIC that pertain to instances of this class.

Parameters:session – the instance of Session used for APIC communication
Returns:True or False. True if there are events pending.
has_parent()

returns True if this object has a parent

Returns:bool
has_tag(tag)

Checks whether this object has a particular tag assigned.

Parameters:tag – string containing the tag name or an instance of _Tag
Returns:True or False. True indicates the object has this tag assigned.
has_tags()

Checks whether this object has any tags assigned at all.

Returns:True or False. True indicates the object has at least one tag assigned.
info()

Node information summary.

Returns:Formatted string that has a summary of all of the info gathered about the node.
infoList()

Node information. Returns a list of (attr, value) tuples.

Returns:list of [(attr, value),]
is_attached(item)

Indicates whether the item is attached to this object/ :returns: True or False, True indicates the item is attached.

is_deleted()

Check if the object has been deleted.

Returns:True or False, True indicates the object has been deleted.
is_detached(item)

Indicates whether the item is detached from this object.

Returns:True or False, True indicates the item is detached.
static is_interface()

Indicates whether this object is considered an Interface. The default is False.

Returns:False
mark_as_deleted()

Mark the object as deleted. This will cause the JSON status to be set to deleted.

classmethod mask_class_from_graphs()

Mask (hide) this class from graph creation

Returns:False indicating that this class should not be masked.
populate_children(deep=False, include_concrete=False)

Populates all of the children and then calls populate_children of those children if deep is True. This method should be overridden by any object that does have children.

If include_concrete is True, then if the object has concrete objects below it, i.e. is a switch, then also populate those conrete object.

Parameters:
  • include_concrete – True or False. Default is False
  • deep – True or False. Default is False.
protect(taboo)

Make this EPG protected by a Taboo

Parameters:taboo – Instance of Taboo class to protect this EPG.
Returns:True
provide(contract)

Make this EPG provide a Contract

Parameters:contract – Instance of Contract class to be provided by this EPG.
Returns:True
remove_child(obj)

Remove a child from the children list

Parameters:obj – Child object that is to be removed.
remove_tag(tag)

Remove a particular tag from being assigned to this object. Note that this does not delete the tag from the APIC.

Parameters:tag – string containing the tag to remove from this object or an instance of _Tag
set_parent(parent_obj)

Set the parent object

Parameters:parent_obj – Instance of the parent object
Returns:None
classmethod subscribe(session, extension='', only_new=False)

Subscribe to events from the APIC that pertain to instances of this class.

Parameters:
  • session – the instance of Session used for APIC communication
  • only_new – Boolean indicating whether to get all events or only the new events. All events (indicated by setting only_new to False) will queue a create event for all of the currently existing objects. Setting only_new to True will only queue events that occur after the initial subscribe. The default has only_new set to False.
subscribe_to_fault_instances_subtree(session, extension='', deep=False)

Subscribe to faults instances for the whole subtree.

Parameters:
  • session – the instance of Session used for APIC communication
  • extension – Optional string that can be used to extend the URL
  • only_new – Boolean indicating whether to get all events or only the new events. All events (indicated by setting only_new to False) will queue a create event for all of the currently existing objects. Setting only_new to True will only queue events that occur after the initial subscribe. The default has only_new set to False.
classmethod unsubscribe(session)

Unsubscribe for events from the APIC that pertain to instances of this class.

Parameters:session – the instance of Session used for APIC communication
update_db(session, subscribed_classes, deep=False)
Parameters:
  • session – Session class instance representing the connection to the APIC
  • subscribed_classes – List of subscribed classes
  • deep – Boolean indicating whether to go deep or not. Default is False
Returns:

List of subscribed classes

class acitoolkit.acitoolkit.AppProfile(name, parent)

Bases: acitoolkit.acibaseobject.BaseACIObject

The AppProfile class is used to represent the Application Profiles within the acitoolkit object model. In the APIC model, this class is roughly equivalent to the fvAp class.

Parameters:
  • name – String containing the Application Profile name
  • parent – An instance of Tenant class representing the Tenant which contains this Application Profile.
add_child(obj)

Add a child to the children list.

Parameters:obj – Child object to add to the children list of the called object.
add_tag(tag)

Assign this object a particular tag. Tags are strings that can be used to classify objects. More than 1 tag can be assigned to an object.

Parameters:tag – string containing the tag to assign to this object or an instance of _Tag
attach(item)

Attach the object to the other object.

Parameters:item – Object to be attached.
static check_session(session)

This will check that the session is of type Session and raise exception if it not

Parameters:session – the session to check
Returns:
delete_tag(tag)

Mark a particular tag as being deleted from this object.

Parameters:tag – string containing the tag to delete from this object or an instance of _Tag
detach(item)

Detach the object from the other object. A relationship is either ‘attached’, ‘detached’, or does not exist. A detached relationship will cause the relationship to be deleted when pushed to the APIC.

Parameters:item – Object to be detached.
find(search_object)

This will check to see if self is a match with search_object and then call find on all of the children of search. If there is a match, a list containing self and any matches found by the children will be returned as a list.

The criteria for a match is that all attributes of self are compared to all attributes of search_object. If search_object.<attr> exists and is the same as self.<attr> or search_object.<attr> is ‘None’, then that attribute matches. If all such attributes match, then there is a match and self will be returned in the result.

If there is an attribute of search_object that does not exist in self, it will be considered a mismatch. If there is an attribute of self that does not exist in search_object, it will be ignored.

Parameters:search_object – ACI object to search
Returns:List of objects
classmethod get(session, tenant)

Gets all of the Application Profiles from the APIC.

Parameters:
  • session – the instance of Session used for APIC communication
  • tenant – the instance of Tenant used to limit the Application Profiles retreived from the APIC
Returns:

List of AppProfile objects

get_all_attached(attached_class, status='attached', relation_type=None)

Get all of the relations of objects belonging to the specified class with the specified status.

Parameters:
  • attached_class – The class that is the subject of the search.
  • status – Valid values are ‘attached’ and ‘detached’. Default is ‘attached’.
get_all_attachments(attached_class, status='attached', relation_type=None)

Get all of the attachments to an object belonging to the specified class with the specified status.

Parameters:
  • attached_class – The class that is the subject of the search.
  • status – Valid values are ‘attached’ and ‘detached’. Default is ‘attached’.
get_attributes(name=None)

Will return the value of the named attribute in a dictionary format. If no name is given, then it will return all attributes.

Note that attributes that start with _ (underbar) will NOT be included unless explicitly named

This method should be over-written as appropriate by inheriting objects to handle how their local attributes are implemented.

This is intended to normalize how all attributes on all objects can be accessed since the implementations were not consistent.

Parameters:name – optional name of attribute to return
Returns:dictionary of attributes and their values
get_child(child_type, child_name)

Gets a specific immediate child of this object

Parameters:
  • child_type – Class of the child to return
  • child_name – Name of the child to return
Returns:

The specific instance of child_type or None if not found

get_children(only_class=None)

Get a list of the immediate child objects of this object.

Parameters:only_class – Optional parameter that will be used to limit the objects returned to only those belonging to the class passed in this parameter.
Returns:List of children objects.
classmethod get_deep(full_data, working_data, parent=None, limit_to=(), subtree='full', config_only=False)

Gets all instances of this class from the APIC and gets all of the children as well.

Parameters:
  • full_data
  • working_data
  • parent
  • limit_to
  • subtree
  • config_only
classmethod get_deep_apic_classes(include_concrete=False)

Get all the apic classes needed for this acitoolkit class and all of its children. :return: list of all apic classes

get_dn_from_attributes(attributes)

Will get the dn from the attributes or construct it using the dn of the parent plus the rn. Failing those, it will return None

Parameters:attributes
Returns:String containing dn or None
classmethod get_event(session)

Gets the event that is pending for this class. Events are returned in the form of objects. Objects that have been deleted are marked as such.

Parameters:session – the instance of Session used for APIC communication
classmethod get_fault(session, extension='')

Gets the fault that is pending for this class. Faults are returned in the form of objects. Objects that have been deleted are marked as such.

Parameters:session – the instance of Session used for APIC communication
get_from_json(data, parent=None)

returns a Tenant object from a json

get_interfaces(status='attached')

Get all of the interface relations. Note that multiple classes are considered “interfaces” such as Interface, L2Interface, L3Interface, etc.

Parameters:status – Valid values are ‘attached’ and ‘detached’. Default is ‘attached’.
Returns:List of interfaces that this object has relations and the status matches.
get_json()

Returns json representation of the AppProfile object.

Returns:json dictionary of fvAp
get_parent()
Returns:Parent of this object.
get_searchable()

Method to recursively retrieve all of the searchable items from all the children objects, add the current object to them as additional context, append the local searchable terms, and return the result.

static get_table(app_profiles, title='')

Will create table of app_profile information for a given tenant

Parameters:
  • title
  • app_profiles
get_tags()

Get the tags assigned to this object.

Returns:List of tag instances
has_attachment(item)

Indicates whether this object is attached to the item/ :returns: True or False, True indicates the object is attached.

has_child(obj)

Check for existence of a child in the children list

Parameters:obj – Child object that is the subject of the check.
Returns:True or False, True indicates that it does indeed have the obj object as a child.
has_detachment(item)

Indicates whether the object is detached from this item. :returns: True or False, True indicates the object is detached.

classmethod has_events(session, extension='')

Check for pending events from the APIC that pertain to instances of this class.

Parameters:session – the instance of Session used for APIC communication
Returns:True or False. True if there are events pending.
has_parent()

returns True if this object has a parent

Returns:bool
has_tag(tag)

Checks whether this object has a particular tag assigned.

Parameters:tag – string containing the tag name or an instance of _Tag
Returns:True or False. True indicates the object has this tag assigned.
has_tags()

Checks whether this object has any tags assigned at all.

Returns:True or False. True indicates the object has at least one tag assigned.
info()

Node information summary.

Returns:Formatted string that has a summary of all of the info gathered about the node.
infoList()

Node information. Returns a list of (attr, value) tuples.

Returns:list of [(attr, value),]
is_attached(item)

Indicates whether the item is attached to this object/ :returns: True or False, True indicates the item is attached.

is_deleted()

Check if the object has been deleted.

Returns:True or False, True indicates the object has been deleted.
is_detached(item)

Indicates whether the item is detached from this object.

Returns:True or False, True indicates the item is detached.
static is_interface()

Indicates whether this object is considered an Interface. The default is False.

Returns:False
mark_as_deleted()

Mark the object as deleted. This will cause the JSON status to be set to deleted.

classmethod mask_class_from_graphs()

Mask (hide) this class from graph creation

Returns:False indicating that this class should not be masked.
populate_children(deep=False, include_concrete=False)

Populates all of the children and then calls populate_children of those children if deep is True. This method should be overridden by any object that does have children.

If include_concrete is True, then if the object has concrete objects below it, i.e. is a switch, then also populate those conrete object.

Parameters:
  • include_concrete – True or False. Default is False
  • deep – True or False. Default is False.
remove_child(obj)

Remove a child from the children list

Parameters:obj – Child object that is to be removed.
remove_tag(tag)

Remove a particular tag from being assigned to this object. Note that this does not delete the tag from the APIC.

Parameters:tag – string containing the tag to remove from this object or an instance of _Tag
set_parent(parent_obj)

Set the parent object

Parameters:parent_obj – Instance of the parent object
Returns:None
classmethod subscribe(session, extension='', only_new=False)

Subscribe to events from the APIC that pertain to instances of this class.

Parameters:
  • session – the instance of Session used for APIC communication
  • only_new – Boolean indicating whether to get all events or only the new events. All events (indicated by setting only_new to False) will queue a create event for all of the currently existing objects. Setting only_new to True will only queue events that occur after the initial subscribe. The default has only_new set to False.
subscribe_to_fault_instances_subtree(session, extension='', deep=False)

Subscribe to faults instances for the whole subtree.

Parameters:
  • session – the instance of Session used for APIC communication
  • extension – Optional string that can be used to extend the URL
  • only_new – Boolean indicating whether to get all events or only the new events. All events (indicated by setting only_new to False) will queue a create event for all of the currently existing objects. Setting only_new to True will only queue events that occur after the initial subscribe. The default has only_new set to False.
classmethod unsubscribe(session)

Unsubscribe for events from the APIC that pertain to instances of this class.

Parameters:session – the instance of Session used for APIC communication
update_db(session, subscribed_classes, deep=False)
Parameters:
  • session – Session class instance representing the connection to the APIC
  • subscribed_classes – List of subscribed classes
  • deep – Boolean indicating whether to go deep or not. Default is False
Returns:

List of subscribed classes

class acitoolkit.acitoolkit.AttributeCriterion(name, parent=None)

Bases: acitoolkit.acibaseobject.BaseACIObject

AttributeCriterion : roughly equivalent to fvCrtrn

Initializes the AttributeCriterion with a name and optionally an EPG parent

Parameters:
  • name – String containing the AttributeCriterion name
  • parent – Instance of the EPG class representing where this AttributeCriterion is defined
Returns:

Instance of AttributeCriterion class

add_child(obj)

Add a child to the children list.

Parameters:obj – Child object to add to the children list of the called object.
add_ip_address(ip_addr)

Add an IP address as an attribute

Parameters:ip_addr – String containing the IP address
Returns:None
add_tag(tag)

Assign this object a particular tag. Tags are strings that can be used to classify objects. More than 1 tag can be assigned to an object.

Parameters:tag – string containing the tag to assign to this object or an instance of _Tag
attach(item)

Attach the object to the other object.

Parameters:item – Object to be attached.
static check_session(session)

This will check that the session is of type Session and raise exception if it not

Parameters:session – the session to check
Returns:
delete_tag(tag)

Mark a particular tag as being deleted from this object.

Parameters:tag – string containing the tag to delete from this object or an instance of _Tag
detach(item)

Detach the object from the other object. A relationship is either ‘attached’, ‘detached’, or does not exist. A detached relationship will cause the relationship to be deleted when pushed to the APIC.

Parameters:item – Object to be detached.
find(search_object)

This will check to see if self is a match with search_object and then call find on all of the children of search. If there is a match, a list containing self and any matches found by the children will be returned as a list.

The criteria for a match is that all attributes of self are compared to all attributes of search_object. If search_object.<attr> exists and is the same as self.<attr> or search_object.<attr> is ‘None’, then that attribute matches. If all such attributes match, then there is a match and self will be returned in the result.

If there is an attribute of search_object that does not exist in self, it will be considered a mismatch. If there is an attribute of self that does not exist in search_object, it will be ignored.

Parameters:search_object – ACI object to search
Returns:List of objects
classmethod get(session, toolkit_class, apic_class, parent=None, tenant=None, query_target_type='subtree')

Generic classmethod to get all of a particular APIC class.

Parameters:
  • session – the instance of Session used for APIC communication
  • toolkit_class – acitoolkit class to return
  • apic_class – String containing class name from the APIC object model.
  • parent – Object to assign as the parent to the created objects.
  • tenant – Tenant object to assign the created objects.
  • query_target_type – type of the query either self,children,subtree
get_all_attached(attached_class, status='attached', relation_type=None)

Get all of the relations of objects belonging to the specified class with the specified status.

Parameters:
  • attached_class – The class that is the subject of the search.
  • status – Valid values are ‘attached’ and ‘detached’. Default is ‘attached’.
get_all_attachments(attached_class, status='attached', relation_type=None)

Get all of the attachments to an object belonging to the specified class with the specified status.

Parameters:
  • attached_class – The class that is the subject of the search.
  • status – Valid values are ‘attached’ and ‘detached’. Default is ‘attached’.
get_attributes(name=None)

Will return the value of the named attribute in a dictionary format. If no name is given, then it will return all attributes.

Note that attributes that start with _ (underbar) will NOT be included unless explicitly named

This method should be over-written as appropriate by inheriting objects to handle how their local attributes are implemented.

This is intended to normalize how all attributes on all objects can be accessed since the implementations were not consistent.

Parameters:name – optional name of attribute to return
Returns:dictionary of attributes and their values
get_child(child_type, child_name)

Gets a specific immediate child of this object

Parameters:
  • child_type – Class of the child to return
  • child_name – Name of the child to return
Returns:

The specific instance of child_type or None if not found

get_children(only_class=None)

Get a list of the immediate child objects of this object.

Parameters:only_class – Optional parameter that will be used to limit the objects returned to only those belonging to the class passed in this parameter.
Returns:List of children objects.
classmethod get_deep(full_data, working_data, parent=None, limit_to=(), subtree='full', config_only=False)

Gets all instances of this class from the APIC and gets all of the children as well.

Parameters:
  • full_data
  • working_data
  • parent
  • limit_to
  • subtree
  • config_only
classmethod get_deep_apic_classes(include_concrete=False)

Get all the apic classes needed for this acitoolkit class and all of its children. :return: list of all apic classes

get_dn_from_attributes(attributes)

Will get the dn from the attributes or construct it using the dn of the parent plus the rn. Failing those, it will return None

Parameters:attributes
Returns:String containing dn or None
classmethod get_event(session)

Gets the event that is pending for this class. Events are returned in the form of objects. Objects that have been deleted are marked as such.

Parameters:session – the instance of Session used for APIC communication
classmethod get_fault(session, extension='')

Gets the fault that is pending for this class. Faults are returned in the form of objects. Objects that have been deleted are marked as such.

Parameters:session – the instance of Session used for APIC communication
get_from_json(data, parent=None)

returns a Tenant object from a json

get_interfaces(status='attached')

Get all of the interface relations. Note that multiple classes are considered “interfaces” such as Interface, L2Interface, L3Interface, etc.

Parameters:status – Valid values are ‘attached’ and ‘detached’. Default is ‘attached’.
Returns:List of interfaces that this object has relations and the status matches.
get_ip_addresses()

return the list of IP addresses

get_json()

Returns JSON representation of the AttributeCriterion :return:

get_parent()
Returns:Parent of this object.
get_searchable()

Method to recursively retrieve all of the searchable items from all the children objects, add the current object to them as additional context, append the local searchable terms, and return the result.

static get_table(aci_object, title='')

Abstract method that should be replaced by a version that is specific to the object

Parameters:
  • aci_object
  • title – String containing the table title
Returns:

list of Table objects

get_tags()

Get the tags assigned to this object.

Returns:List of tag instances
has_attachment(item)

Indicates whether this object is attached to the item/ :returns: True or False, True indicates the object is attached.

has_child(obj)

Check for existence of a child in the children list

Parameters:obj – Child object that is the subject of the check.
Returns:True or False, True indicates that it does indeed have the obj object as a child.
has_detachment(item)

Indicates whether the object is detached from this item. :returns: True or False, True indicates the object is detached.

classmethod has_events(session, extension='')

Check for pending events from the APIC that pertain to instances of this class.

Parameters:session – the instance of Session used for APIC communication
Returns:True or False. True if there are events pending.
has_parent()

returns True if this object has a parent

Returns:bool
has_tag(tag)

Checks whether this object has a particular tag assigned.

Parameters:tag – string containing the tag name or an instance of _Tag
Returns:True or False. True indicates the object has this tag assigned.
has_tags()

Checks whether this object has any tags assigned at all.

Returns:True or False. True indicates the object has at least one tag assigned.
info()

Node information summary.

Returns:Formatted string that has a summary of all of the info gathered about the node.
infoList()

Node information. Returns a list of (attr, value) tuples.

Returns:list of [(attr, value),]
is_attached(item)

Indicates whether the item is attached to this object/ :returns: True or False, True indicates the item is attached.

is_deleted()

Check if the object has been deleted.

Returns:True or False, True indicates the object has been deleted.
is_detached(item)

Indicates whether the item is detached from this object.

Returns:True or False, True indicates the item is detached.
static is_interface()

Indicates whether this object is considered an Interface. The default is False.

Returns:False
mark_as_deleted()

Mark the object as deleted. This will cause the JSON status to be set to deleted.

classmethod mask_class_from_graphs()

Mask (hide) this class from graph creation

Returns:False indicating that this class should not be masked.
match

Return the match property :return: String containing the match property. Possible values are ‘any’ or ‘all’

populate_children(deep=False, include_concrete=False)

Populates all of the children and then calls populate_children of those children if deep is True. This method should be overridden by any object that does have children.

If include_concrete is True, then if the object has concrete objects below it, i.e. is a switch, then also populate those conrete object.

Parameters:
  • include_concrete – True or False. Default is False
  • deep – True or False. Default is False.
remove_child(obj)

Remove a child from the children list

Parameters:obj – Child object that is to be removed.
remove_tag(tag)

Remove a particular tag from being assigned to this object. Note that this does not delete the tag from the APIC.

Parameters:tag – string containing the tag to remove from this object or an instance of _Tag
set_parent(parent_obj)

Set the parent object

Parameters:parent_obj – Instance of the parent object
Returns:None
classmethod subscribe(session, extension='', only_new=False)

Subscribe to events from the APIC that pertain to instances of this class.

Parameters:
  • session – the instance of Session used for APIC communication
  • only_new – Boolean indicating whether to get all events or only the new events. All events (indicated by setting only_new to False) will queue a create event for all of the currently existing objects. Setting only_new to True will only queue events that occur after the initial subscribe. The default has only_new set to False.
subscribe_to_fault_instances_subtree(session, extension='', deep=False)

Subscribe to faults instances for the whole subtree.

Parameters:
  • session – the instance of Session used for APIC communication
  • extension – Optional string that can be used to extend the URL
  • only_new – Boolean indicating whether to get all events or only the new events. All events (indicated by setting only_new to False) will queue a create event for all of the currently existing objects. Setting only_new to True will only queue events that occur after the initial subscribe. The default has only_new set to False.
classmethod unsubscribe(session)

Unsubscribe for events from the APIC that pertain to instances of this class.

Parameters:session – the instance of Session used for APIC communication
update_db(session, subscribed_classes, deep=False)
Parameters:
  • session – Session class instance representing the connection to the APIC
  • subscribed_classes – List of subscribed classes
  • deep – Boolean indicating whether to go deep or not. Default is False
Returns:

List of subscribed classes

class acitoolkit.acitoolkit.BGPSession(name, router_id=None, peer_ip=None, node_id=None)

Bases: acitoolkit.acibaseobject.BaseACIObject

Creates an BGP router interface that can be attached to a L3 interface. This interface defines the BGP AS, authentication, etc.

Parameters:
  • name – String containing the name of this BGPSession object.
  • router_id – String containing the IPv4 router-id
  • peer_ip – String containing the IP address of the BGP peer Default is None.
  • node_id – String Containing the node-id (e.g. ‘101’)
add_child(obj)

Add a child to the children list.

Parameters:obj – Child object to add to the children list of the called object.
add_tag(tag)

Assign this object a particular tag. Tags are strings that can be used to classify objects. More than 1 tag can be assigned to an object.

Parameters:tag – string containing the tag to assign to this object or an instance of _Tag
attach(item)

Attach the object to the other object.

Parameters:item – Object to be attached.
static check_session(session)

This will check that the session is of type Session and raise exception if it not

Parameters:session – the session to check
Returns:
delete_tag(tag)

Mark a particular tag as being deleted from this object.

Parameters:tag – string containing the tag to delete from this object or an instance of _Tag
detach(item)

Detach the object from the other object. A relationship is either ‘attached’, ‘detached’, or does not exist. A detached relationship will cause the relationship to be deleted when pushed to the APIC.

Parameters:item – Object to be detached.
find(search_object)

This will check to see if self is a match with search_object and then call find on all of the children of search. If there is a match, a list containing self and any matches found by the children will be returned as a list.

The criteria for a match is that all attributes of self are compared to all attributes of search_object. If search_object.<attr> exists and is the same as self.<attr> or search_object.<attr> is ‘None’, then that attribute matches. If all such attributes match, then there is a match and self will be returned in the result.

If there is an attribute of search_object that does not exist in self, it will be considered a mismatch. If there is an attribute of self that does not exist in search_object, it will be ignored.

Parameters:search_object – ACI object to search
Returns:List of objects
classmethod get(session, toolkit_class, apic_class, parent=None, tenant=None, query_target_type='subtree')

Generic classmethod to get all of a particular APIC class.

Parameters:
  • session – the instance of Session used for APIC communication
  • toolkit_class – acitoolkit class to return
  • apic_class – String containing class name from the APIC object model.
  • parent – Object to assign as the parent to the created objects.
  • tenant – Tenant object to assign the created objects.
  • query_target_type – type of the query either self,children,subtree
get_all_attached(attached_class, status='attached', relation_type=None)

Get all of the relations of objects belonging to the specified class with the specified status.

Parameters:
  • attached_class – The class that is the subject of the search.
  • status – Valid values are ‘attached’ and ‘detached’. Default is ‘attached’.
get_all_attachments(attached_class, status='attached', relation_type=None)

Get all of the attachments to an object belonging to the specified class with the specified status.

Parameters:
  • attached_class – The class that is the subject of the search.
  • status – Valid values are ‘attached’ and ‘detached’. Default is ‘attached’.
get_attributes(name=None)

Will return the value of the named attribute in a dictionary format. If no name is given, then it will return all attributes.

Note that attributes that start with _ (underbar) will NOT be included unless explicitly named

This method should be over-written as appropriate by inheriting objects to handle how their local attributes are implemented.

This is intended to normalize how all attributes on all objects can be accessed since the implementations were not consistent.

Parameters:name – optional name of attribute to return
Returns:dictionary of attributes and their values
get_child(child_type, child_name)

Gets a specific immediate child of this object

Parameters:
  • child_type – Class of the child to return
  • child_name – Name of the child to return
Returns:

The specific instance of child_type or None if not found

get_children(only_class=None)

Get a list of the immediate child objects of this object.

Parameters:only_class – Optional parameter that will be used to limit the objects returned to only those belonging to the class passed in this parameter.
Returns:List of children objects.
classmethod get_deep(full_data, working_data, parent=None, limit_to=(), subtree='full', config_only=False)

Gets all instances of this class from the APIC and gets all of the children as well.

Parameters:
  • full_data
  • working_data
  • parent
  • limit_to
  • subtree
  • config_only
classmethod get_deep_apic_classes(include_concrete=False)

Get all the apic classes needed for this acitoolkit class and all of its children. :return: list of all apic classes

get_dn_from_attributes(attributes)

Will get the dn from the attributes or construct it using the dn of the parent plus the rn. Failing those, it will return None

Parameters:attributes
Returns:String containing dn or None
classmethod get_event(session)

Gets the event that is pending for this class. Events are returned in the form of objects. Objects that have been deleted are marked as such.

Parameters:session – the instance of Session used for APIC communication
classmethod get_fault(session, extension='')

Gets the fault that is pending for this class. Faults are returned in the form of objects. Objects that have been deleted are marked as such.

Parameters:session – the instance of Session used for APIC communication
get_from_json(data, parent=None)

returns a Tenant object from a json

get_interfaces(status='attached')

Get all of the interface relations. Note that multiple classes are considered “interfaces” such as Interface, L2Interface, L3Interface, etc.

Parameters:status – Valid values are ‘attached’ and ‘detached’. Default is ‘attached’.
Returns:List of interfaces that this object has relations and the status matches.
get_json()

Returns json representation of BGPSession

Returns:json dictionary of BGP Session
get_parent()
Returns:Parent of this object.
get_searchable()

Method to recursively retrieve all of the searchable items from all the children objects, add the current object to them as additional context, append the local searchable terms, and return the result.

static get_table(aci_object, title='')

Abstract method that should be replaced by a version that is specific to the object

Parameters:
  • aci_object
  • title – String containing the table title
Returns:

list of Table objects

get_tags()

Get the tags assigned to this object.

Returns:List of tag instances
has_attachment(item)

Indicates whether this object is attached to the item/ :returns: True or False, True indicates the object is attached.

has_child(obj)

Check for existence of a child in the children list

Parameters:obj – Child object that is the subject of the check.
Returns:True or False, True indicates that it does indeed have the obj object as a child.
has_detachment(item)

Indicates whether the object is detached from this item. :returns: True or False, True indicates the object is detached.

classmethod has_events(session, extension='')

Check for pending events from the APIC that pertain to instances of this class.

Parameters:session – the instance of Session used for APIC communication
Returns:True or False. True if there are events pending.
has_parent()

returns True if this object has a parent

Returns:bool
has_tag(tag)

Checks whether this object has a particular tag assigned.

Parameters:tag – string containing the tag name or an instance of _Tag
Returns:True or False. True indicates the object has this tag assigned.
has_tags()

Checks whether this object has any tags assigned at all.

Returns:True or False. True indicates the object has at least one tag assigned.
info()

Node information summary.

Returns:Formatted string that has a summary of all of the info gathered about the node.
infoList()

Node information. Returns a list of (attr, value) tuples.

Returns:list of [(attr, value),]
is_attached(item)

Indicates whether the item is attached to this object/ :returns: True or False, True indicates the item is attached.

static is_bgp()
Returns:True if this interface is an BGP interface. In the case of BGPSession instances, this is always True.
is_deleted()

Check if the object has been deleted.

Returns:True or False, True indicates the object has been deleted.
is_detached(item)

Indicates whether the item is detached from this object.

Returns:True or False, True indicates the item is detached.
is_interface()

Returns whether this instance is considered an interface.

Returns:True
mark_as_deleted()

Mark the object as deleted. This will cause the JSON status to be set to deleted.

classmethod mask_class_from_graphs()

Mask (hide) this class from graph creation

Returns:False indicating that this class should not be masked.
populate_children(deep=False, include_concrete=False)

Populates all of the children and then calls populate_children of those children if deep is True. This method should be overridden by any object that does have children.

If include_concrete is True, then if the object has concrete objects below it, i.e. is a switch, then also populate those conrete object.

Parameters:
  • include_concrete – True or False. Default is False
  • deep – True or False. Default is False.
remove_child(obj)

Remove a child from the children list

Parameters:obj – Child object that is to be removed.
remove_tag(tag)

Remove a particular tag from being assigned to this object. Note that this does not delete the tag from the APIC.

Parameters:tag – string containing the tag to remove from this object or an instance of _Tag
set_parent(parent_obj)

Set the parent object

Parameters:parent_obj – Instance of the parent object
Returns:None
classmethod subscribe(session, extension='', only_new=False)

Subscribe to events from the APIC that pertain to instances of this class.

Parameters:
  • session – the instance of Session used for APIC communication
  • only_new – Boolean indicating whether to get all events or only the new events. All events (indicated by setting only_new to False) will queue a create event for all of the currently existing objects. Setting only_new to True will only queue events that occur after the initial subscribe. The default has only_new set to False.
subscribe_to_fault_instances_subtree(session, extension='', deep=False)

Subscribe to faults instances for the whole subtree.

Parameters:
  • session – the instance of Session used for APIC communication
  • extension – Optional string that can be used to extend the URL
  • only_new – Boolean indicating whether to get all events or only the new events. All events (indicated by setting only_new to False) will queue a create event for all of the currently existing objects. Setting only_new to True will only queue events that occur after the initial subscribe. The default has only_new set to False.
classmethod unsubscribe(session)

Unsubscribe for events from the APIC that pertain to instances of this class.

Parameters:session – the instance of Session used for APIC communication
update_db(session, subscribed_classes, deep=False)
Parameters:
  • session – Session class instance representing the connection to the APIC
  • subscribed_classes – List of subscribed classes
  • deep – Boolean indicating whether to go deep or not. Default is False
Returns:

List of subscribed classes

class acitoolkit.acitoolkit.BaseContract(contract_name, parent=None)

Bases: acitoolkit.acibaseobject.BaseACIObject

BaseContract : Base class for Contracts and Taboos

add_child(obj)

Add a child to the children list.

Parameters:obj – Child object to add to the children list of the called object.
add_tag(tag)

Assign this object a particular tag. Tags are strings that can be used to classify objects. More than 1 tag can be assigned to an object.

Parameters:tag – string containing the tag to assign to this object or an instance of _Tag
attach(item)

Attach the object to the other object.

Parameters:item – Object to be attached.
static check_session(session)

This will check that the session is of type Session and raise exception if it not

Parameters:session – the session to check
Returns:
delete_tag(tag)

Mark a particular tag as being deleted from this object.

Parameters:tag – string containing the tag to delete from this object or an instance of _Tag
detach(item)

Detach the object from the other object. A relationship is either ‘attached’, ‘detached’, or does not exist. A detached relationship will cause the relationship to be deleted when pushed to the APIC.

Parameters:item – Object to be detached.
find(search_object)

This will check to see if self is a match with search_object and then call find on all of the children of search. If there is a match, a list containing self and any matches found by the children will be returned as a list.

The criteria for a match is that all attributes of self are compared to all attributes of search_object. If search_object.<attr> exists and is the same as self.<attr> or search_object.<attr> is ‘None’, then that attribute matches. If all such attributes match, then there is a match and self will be returned in the result.

If there is an attribute of search_object that does not exist in self, it will be considered a mismatch. If there is an attribute of self that does not exist in search_object, it will be ignored.

Parameters:search_object – ACI object to search
Returns:List of objects
classmethod get(session, toolkit_class, apic_class, parent=None, tenant=None, query_target_type='subtree')

Generic classmethod to get all of a particular APIC class.

Parameters:
  • session – the instance of Session used for APIC communication
  • toolkit_class – acitoolkit class to return
  • apic_class – String containing class name from the APIC object model.
  • parent – Object to assign as the parent to the created objects.
  • tenant – Tenant object to assign the created objects.
  • query_target_type – type of the query either self,children,subtree
get_all_attached(attached_class, status='attached', relation_type=None)

Get all of the relations of objects belonging to the specified class with the specified status.

Parameters:
  • attached_class – The class that is the subject of the search.
  • status – Valid values are ‘attached’ and ‘detached’. Default is ‘attached’.
get_all_attachments(attached_class, status='attached', relation_type=None)

Get all of the attachments to an object belonging to the specified class with the specified status.

Parameters:
  • attached_class – The class that is the subject of the search.
  • status – Valid values are ‘attached’ and ‘detached’. Default is ‘attached’.
get_all_filter_entries(direction='bidirectional-only')

Get all of the filter entries contained within this Contract/Taboo

Parameters:direction – String containing the type of filter entries to gather Valid values are ‘bidirectional-only’, ‘input-only’, ‘output-only’, ‘all’ Default is ‘bidirectional-only’
Returns:List of FilterEntry instances
get_attributes(name=None)

Will return the value of the named attribute in a dictionary format. If no name is given, then it will return all attributes.

Note that attributes that start with _ (underbar) will NOT be included unless explicitly named

This method should be over-written as appropriate by inheriting objects to handle how their local attributes are implemented.

This is intended to normalize how all attributes on all objects can be accessed since the implementations were not consistent.

Parameters:name – optional name of attribute to return
Returns:dictionary of attributes and their values
get_child(child_type, child_name)

Gets a specific immediate child of this object

Parameters:
  • child_type – Class of the child to return
  • child_name – Name of the child to return
Returns:

The specific instance of child_type or None if not found

get_children(only_class=None)

Get a list of the immediate child objects of this object.

Parameters:only_class – Optional parameter that will be used to limit the objects returned to only those belonging to the class passed in this parameter.
Returns:List of children objects.
classmethod get_deep(full_data, working_data, parent=None, limit_to=(), subtree='full', config_only=False)

Gets all instances of this class from the APIC and gets all of the children as well.

Parameters:
  • full_data
  • working_data
  • parent
  • limit_to
  • subtree
  • config_only
classmethod get_deep_apic_classes(include_concrete=False)

Get all the apic classes needed for this acitoolkit class and all of its children. :return: list of all apic classes

get_dn_from_attributes(attributes)

Will get the dn from the attributes or construct it using the dn of the parent plus the rn. Failing those, it will return None

Parameters:attributes
Returns:String containing dn or None
classmethod get_event(session)

Gets the event that is pending for this class. Events are returned in the form of objects. Objects that have been deleted are marked as such.

Parameters:session – the instance of Session used for APIC communication
classmethod get_fault(session, extension='')

Gets the fault that is pending for this class. Faults are returned in the form of objects. Objects that have been deleted are marked as such.

Parameters:session – the instance of Session used for APIC communication
get_from_json(data, parent=None)

returns a Tenant object from a json

get_interfaces(status='attached')

Get all of the interface relations. Note that multiple classes are considered “interfaces” such as Interface, L2Interface, L3Interface, etc.

Parameters:status – Valid values are ‘attached’ and ‘detached’. Default is ‘attached’.
Returns:List of interfaces that this object has relations and the status matches.
get_json()

Returns json representation of the contract

Returns:json dictionary of the contract
get_parent()
Returns:Parent of this object.
get_scope()

Get the scope of this contract. Valid values are ‘context’, ‘global’, ‘tenant’, and ‘application-profile’

get_searchable()

Method to recursively retrieve all of the searchable items from all the children objects, add the current object to them as additional context, append the local searchable terms, and return the result.

static get_table(aci_object, title='')

Abstract method that should be replaced by a version that is specific to the object

Parameters:
  • aci_object
  • title – String containing the table title
Returns:

list of Table objects

get_tags()

Get the tags assigned to this object.

Returns:List of tag instances
has_attachment(item)

Indicates whether this object is attached to the item/ :returns: True or False, True indicates the object is attached.

has_child(obj)

Check for existence of a child in the children list

Parameters:obj – Child object that is the subject of the check.
Returns:True or False, True indicates that it does indeed have the obj object as a child.
has_detachment(item)

Indicates whether the object is detached from this item. :returns: True or False, True indicates the object is detached.

classmethod has_events(session, extension='')

Check for pending events from the APIC that pertain to instances of this class.

Parameters:session – the instance of Session used for APIC communication
Returns:True or False. True if there are events pending.
has_parent()

returns True if this object has a parent

Returns:bool
has_tag(tag)

Checks whether this object has a particular tag assigned.

Parameters:tag – string containing the tag name or an instance of _Tag
Returns:True or False. True indicates the object has this tag assigned.
has_tags()

Checks whether this object has any tags assigned at all.

Returns:True or False. True indicates the object has at least one tag assigned.
info()

Node information summary.

Returns:Formatted string that has a summary of all of the info gathered about the node.
infoList()

Node information. Returns a list of (attr, value) tuples.

Returns:list of [(attr, value),]
is_attached(item)

Indicates whether the item is attached to this object/ :returns: True or False, True indicates the item is attached.

is_deleted()

Check if the object has been deleted.

Returns:True or False, True indicates the object has been deleted.
is_detached(item)

Indicates whether the item is detached from this object.

Returns:True or False, True indicates the item is detached.
static is_interface()

Indicates whether this object is considered an Interface. The default is False.

Returns:False
mark_as_deleted()

Mark the object as deleted. This will cause the JSON status to be set to deleted.

classmethod mask_class_from_graphs()

Mask (hide) this class from graph creation

Returns:False indicating that this class should not be masked.
populate_children(deep=False, include_concrete=False)

Populates all of the children and then calls populate_children of those children if deep is True. This method should be overridden by any object that does have children.

If include_concrete is True, then if the object has concrete objects below it, i.e. is a switch, then also populate those conrete object.

Parameters:
  • include_concrete – True or False. Default is False
  • deep – True or False. Default is False.
remove_child(obj)

Remove a child from the children list

Parameters:obj – Child object that is to be removed.
remove_tag(tag)

Remove a particular tag from being assigned to this object. Note that this does not delete the tag from the APIC.

Parameters:tag – string containing the tag to remove from this object or an instance of _Tag
set_parent(parent_obj)

Set the parent object

Parameters:parent_obj – Instance of the parent object
Returns:None
set_scope(scope)

Set the scope of this contract. Valid values are ‘context’, ‘global’, ‘tenant’, and ‘application-profile’

Parameters:scope – String containing one of the following ‘context’, ‘global’, ‘tenant’, or ‘application-profile’
classmethod subscribe(session, extension='', only_new=False)

Subscribe to events from the APIC that pertain to instances of this class.

Parameters:
  • session – the instance of Session used for APIC communication
  • only_new – Boolean indicating whether to get all events or only the new events. All events (indicated by setting only_new to False) will queue a create event for all of the currently existing objects. Setting only_new to True will only queue events that occur after the initial subscribe. The default has only_new set to False.
subscribe_to_fault_instances_subtree(session, extension='', deep=False)

Subscribe to faults instances for the whole subtree.

Parameters:
  • session – the instance of Session used for APIC communication
  • extension – Optional string that can be used to extend the URL
  • only_new – Boolean indicating whether to get all events or only the new events. All events (indicated by setting only_new to False) will queue a create event for all of the currently existing objects. Setting only_new to True will only queue events that occur after the initial subscribe. The default has only_new set to False.
classmethod unsubscribe(session)

Unsubscribe for events from the APIC that pertain to instances of this class.

Parameters:session – the instance of Session used for APIC communication
update_db(session, subscribed_classes, deep=False)
Parameters:
  • session – Session class instance representing the connection to the APIC
  • subscribed_classes – List of subscribed classes
  • deep – Boolean indicating whether to go deep or not. Default is False
Returns:

List of subscribed classes

class acitoolkit.acitoolkit.BaseMonitorClass

Bases: object

Base class for monitoring policies. These are methods that can be used on all monitoring objects.

add_collection_policy(coll_obj)

Add a collection policy.

Parameters:coll_obj – A collection policy object of type CollectionPolicy
add_stats(stat_obj)

Adds a stats family object.

Parameters:stat_obj – Statistics family object of type MonitorStats.
add_target(target_obj)

Add a target object.

Parameters:target_obj – target object of type MonitorTarget
get_parent()
Returns:parent object
isModified()

Returns True if this policy and any children have been modified or created and not been written to the APIC

remove_collection_policy(collection)

Remove a collection_policy object. The object to remove is identified by its granularity, e.g. ‘5min’, ‘15min’, etc. This string can be found in the ‘CollectionPolicy.granularity’ attribute of the object.

Parameters:collection – CollectionPolicy to remove.
remove_stats(stats_family)

Remove a stats family object. The object to remove is identified by a string, e.g. ‘ingrPkts’, or ‘egrTotal’. This string can be found in the ‘MonitorStats.scope’ attribute of the object.

Parameters:stats_family – Statistics family string.
remove_target(target)

Remove a target object. The object to remove is identified by a string, e.g ‘l1PhysIf’. This string can be found in the ‘MonitorTarget.scope’ attribute of the object.

Parameters:target – target to remove.
set_description(description)
Sets the description of the MonitorStats.
Parameters:description – String to use as the description
set_name(name)
Sets the name of the MonitorStats.
Parameters:name – String to use as the name
class acitoolkit.acitoolkit.BaseSubnet(name, parent=None, address=None)

Bases: acitoolkit.acibaseobject.BaseACIObject

Base class for Subnet and OutsideNetwork

Parameters:
  • name – String containing the name of this instance.
  • parent – An instance of the parent class.
  • address – String containing the IP address. Can optionally be set later.
add_child(obj)

Add a child to the children list.

Parameters:obj – Child object to add to the children list of the called object.
add_tag(tag)

Assign this object a particular tag. Tags are strings that can be used to classify objects. More than 1 tag can be assigned to an object.

Parameters:tag – string containing the tag to assign to this object or an instance of _Tag
addr

Subnet address

Returns:String containing the subnet default gateway IP address and mask e.g. “1.2.3.4/24”
attach(item)

Attach the object to the other object.

Parameters:item – Object to be attached.
static check_session(session)

This will check that the session is of type Session and raise exception if it not

Parameters:session – the session to check
Returns:
delete_tag(tag)

Mark a particular tag as being deleted from this object.

Parameters:tag – string containing the tag to delete from this object or an instance of _Tag
detach(item)

Detach the object from the other object. A relationship is either ‘attached’, ‘detached’, or does not exist. A detached relationship will cause the relationship to be deleted when pushed to the APIC.

Parameters:item – Object to be detached.
find(search_object)

This will check to see if self is a match with search_object and then call find on all of the children of search. If there is a match, a list containing self and any matches found by the children will be returned as a list.

The criteria for a match is that all attributes of self are compared to all attributes of search_object. If search_object.<attr> exists and is the same as self.<attr> or search_object.<attr> is ‘None’, then that attribute matches. If all such attributes match, then there is a match and self will be returned in the result.

If there is an attribute of search_object that does not exist in self, it will be considered a mismatch. If there is an attribute of self that does not exist in search_object, it will be ignored.

Parameters:search_object – ACI object to search
Returns:List of objects
classmethod get(session, toolkit_class, apic_class, parent=None, tenant=None, query_target_type='subtree')

Generic classmethod to get all of a particular APIC class.

Parameters:
  • session – the instance of Session used for APIC communication
  • toolkit_class – acitoolkit class to return
  • apic_class – String containing class name from the APIC object model.
  • parent – Object to assign as the parent to the created objects.
  • tenant – Tenant object to assign the created objects.
  • query_target_type – type of the query either self,children,subtree
get_addr()

Get the subnet address

Returns:The subnet address as a string in the form of <ipaddr>/<mask>
get_all_attached(attached_class, status='attached', relation_type=None)

Get all of the relations of objects belonging to the specified class with the specified status.

Parameters:
  • attached_class – The class that is the subject of the search.
  • status – Valid values are ‘attached’ and ‘detached’. Default is ‘attached’.
get_all_attachments(attached_class, status='attached', relation_type=None)

Get all of the attachments to an object belonging to the specified class with the specified status.

Parameters:
  • attached_class – The class that is the subject of the search.
  • status – Valid values are ‘attached’ and ‘detached’. Default is ‘attached’.
get_attributes(name=None)

Will return the value of the named attribute in a dictionary format. If no name is given, then it will return all attributes.

Note that attributes that start with _ (underbar) will NOT be included unless explicitly named

This method should be over-written as appropriate by inheriting objects to handle how their local attributes are implemented.

This is intended to normalize how all attributes on all objects can be accessed since the implementations were not consistent.

Parameters:name – optional name of attribute to return
Returns:dictionary of attributes and their values
get_child(child_type, child_name)

Gets a specific immediate child of this object

Parameters:
  • child_type – Class of the child to return
  • child_name – Name of the child to return
Returns:

The specific instance of child_type or None if not found

get_children(only_class=None)

Get a list of the immediate child objects of this object.

Parameters:only_class – Optional parameter that will be used to limit the objects returned to only those belonging to the class passed in this parameter.
Returns:List of children objects.
classmethod get_deep(full_data, working_data, parent=None, limit_to=(), subtree='full', config_only=False)

Gets all instances of this class from the APIC and gets all of the children as well.

Parameters:
  • full_data
  • working_data
  • parent
  • limit_to
  • subtree
  • config_only
classmethod get_deep_apic_classes(include_concrete=False)

Get all the apic classes needed for this acitoolkit class and all of its children. :return: list of all apic classes

get_dn_from_attributes(attributes)

Will get the dn from the attributes or construct it using the dn of the parent plus the rn. Failing those, it will return None

Parameters:attributes
Returns:String containing dn or None
classmethod get_event(session)

Gets the event that is pending for this class. Events are returned in the form of objects. Objects that have been deleted are marked as such.

Parameters:session – the instance of Session used for APIC communication
classmethod get_fault(session, extension='')

Gets the fault that is pending for this class. Faults are returned in the form of objects. Objects that have been deleted are marked as such.

Parameters:session – the instance of Session used for APIC communication
get_from_json(data, parent=None)

returns a Tenant object from a json

get_interfaces(status='attached')

Get all of the interface relations. Note that multiple classes are considered “interfaces” such as Interface, L2Interface, L3Interface, etc.

Parameters:status – Valid values are ‘attached’ and ‘detached’. Default is ‘attached’.
Returns:List of interfaces that this object has relations and the status matches.
get_json(obj_class, attributes=None, children=None, get_children=True)

Get the JSON representation of this class in the actual APIC Object Model.

Parameters:
  • obj_class – Object Class Name within the APIC model.
  • attributes – Additional attributes that should be set in the JSON.
  • children – Children objects to traverse as well.
  • get_children – Indicates whether the children objects should be included.
Returns:

JSON dictionary to be pushed to the APIC.

get_parent()
Returns:Parent of this object.
get_scope()

Get the subnet scope

Returns:The subnet scope as a string
get_searchable()

Method to recursively retrieve all of the searchable items from all the children objects, add the current object to them as additional context, append the local searchable terms, and return the result.

static get_table(aci_object, title='')

Abstract method that should be replaced by a version that is specific to the object

Parameters:
  • aci_object
  • title – String containing the table title
Returns:

list of Table objects

get_tags()

Get the tags assigned to this object.

Returns:List of tag instances
has_attachment(item)

Indicates whether this object is attached to the item/ :returns: True or False, True indicates the object is attached.

has_child(obj)

Check for existence of a child in the children list

Parameters:obj – Child object that is the subject of the check.
Returns:True or False, True indicates that it does indeed have the obj object as a child.
has_detachment(item)

Indicates whether the object is detached from this item. :returns: True or False, True indicates the object is detached.

classmethod has_events(session, extension='')

Check for pending events from the APIC that pertain to instances of this class.

Parameters:session – the instance of Session used for APIC communication
Returns:True or False. True if there are events pending.
has_parent()

returns True if this object has a parent

Returns:bool
has_tag(tag)

Checks whether this object has a particular tag assigned.

Parameters:tag – string containing the tag name or an instance of _Tag
Returns:True or False. True indicates the object has this tag assigned.
has_tags()

Checks whether this object has any tags assigned at all.

Returns:True or False. True indicates the object has at least one tag assigned.
info()

Node information summary.

Returns:Formatted string that has a summary of all of the info gathered about the node.
infoList()

Node information. Returns a list of (attr, value) tuples.

Returns:list of [(attr, value),]
ip

IP address of the subnet in the form of Address/mask e.g. 10.1.1.1/16

Returns:String containing the IP address
is_attached(item)

Indicates whether the item is attached to this object/ :returns: True or False, True indicates the item is attached.

is_deleted()

Check if the object has been deleted.

Returns:True or False, True indicates the object has been deleted.
is_detached(item)

Indicates whether the item is detached from this object.

Returns:True or False, True indicates the item is detached.
static is_interface()

Indicates whether this object is considered an Interface. The default is False.

Returns:False
mark_as_deleted()

Mark the object as deleted. This will cause the JSON status to be set to deleted.

classmethod mask_class_from_graphs()

Mask (hide) this class from graph creation

Returns:False indicating that this class should not be masked.
populate_children(deep=False, include_concrete=False)

Populates all of the children and then calls populate_children of those children if deep is True. This method should be overridden by any object that does have children.

If include_concrete is True, then if the object has concrete objects below it, i.e. is a switch, then also populate those conrete object.

Parameters:
  • include_concrete – True or False. Default is False
  • deep – True or False. Default is False.
remove_child(obj)

Remove a child from the children list

Parameters:obj – Child object that is to be removed.
remove_tag(tag)

Remove a particular tag from being assigned to this object. Note that this does not delete the tag from the APIC.

Parameters:tag – string containing the tag to remove from this object or an instance of _Tag
set_addr(addr)

Set the subnet address

Parameters:addr – The subnet default gateway address as a string in the form of <ipaddr>/<mask>
set_parent(parent_obj)

Set the parent object

Parameters:parent_obj – Instance of the parent object
Returns:None
set_scope(scope)

Set the subnet scope

Parameters:scope – String containing the subnet scope
Returns:None
classmethod subscribe(session, extension='', only_new=False)

Subscribe to events from the APIC that pertain to instances of this class.

Parameters:
  • session – the instance of Session used for APIC communication
  • only_new – Boolean indicating whether to get all events or only the new events. All events (indicated by setting only_new to False) will queue a create event for all of the currently existing objects. Setting only_new to True will only queue events that occur after the initial subscribe. The default has only_new set to False.
subscribe_to_fault_instances_subtree(session, extension='', deep=False)

Subscribe to faults instances for the whole subtree.

Parameters:
  • session – the instance of Session used for APIC communication
  • extension – Optional string that can be used to extend the URL
  • only_new – Boolean indicating whether to get all events or only the new events. All events (indicated by setting only_new to False) will queue a create event for all of the currently existing objects. Setting only_new to True will only queue events that occur after the initial subscribe. The default has only_new set to False.
classmethod unsubscribe(session)

Unsubscribe for events from the APIC that pertain to instances of this class.

Parameters:session – the instance of Session used for APIC communication
update_db(session, subscribed_classes, deep=False)
Parameters:
  • session – Session class instance representing the connection to the APIC
  • subscribed_classes – List of subscribed classes
  • deep – Boolean indicating whether to go deep or not. Default is False
Returns:

List of subscribed classes

class acitoolkit.acitoolkit.BaseTerminal(terminal_name, parent=None)

Bases: acitoolkit.acibaseobject.BaseACIObject

Base class for Input terminal and output terminal

add_child(obj)

Add a child to the children list.

Parameters:obj – Child object to add to the children list of the called object.
add_filter(filter_obj)

Add Filter to the Terminal, roughly equivalent to vzRsFiltAtt

Parameters:filter_obj – Instance of Filter class. Represents a Filter that is added to the Terminal. Multiple Filters can be assigned to a single Terminal.
add_tag(tag)

Assign this object a particular tag. Tags are strings that can be used to classify objects. More than 1 tag can be assigned to an object.

Parameters:tag – string containing the tag to assign to this object or an instance of _Tag
attach(item)

Attach the object to the other object.

Parameters:item – Object to be attached.
static check_session(session)

This will check that the session is of type Session and raise exception if it not

Parameters:session – the session to check
Returns:
delete_tag(tag)

Mark a particular tag as being deleted from this object.

Parameters:tag – string containing the tag to delete from this object or an instance of _Tag
detach(item)

Detach the object from the other object. A relationship is either ‘attached’, ‘detached’, or does not exist. A detached relationship will cause the relationship to be deleted when pushed to the APIC.

Parameters:item – Object to be detached.
find(search_object)

This will check to see if self is a match with search_object and then call find on all of the children of search. If there is a match, a list containing self and any matches found by the children will be returned as a list.

The criteria for a match is that all attributes of self are compared to all attributes of search_object. If search_object.<attr> exists and is the same as self.<attr> or search_object.<attr> is ‘None’, then that attribute matches. If all such attributes match, then there is a match and self will be returned in the result.

If there is an attribute of search_object that does not exist in self, it will be considered a mismatch. If there is an attribute of self that does not exist in search_object, it will be ignored.

Parameters:search_object – ACI object to search
Returns:List of objects
classmethod get(session, toolkit_class, apic_class, parent=None, tenant=None, query_target_type='subtree')

Generic classmethod to get all of a particular APIC class.

Parameters:
  • session – the instance of Session used for APIC communication
  • toolkit_class – acitoolkit class to return
  • apic_class – String containing class name from the APIC object model.
  • parent – Object to assign as the parent to the created objects.
  • tenant – Tenant object to assign the created objects.
  • query_target_type – type of the query either self,children,subtree
get_all_attached(attached_class, status='attached', relation_type=None)

Get all of the relations of objects belonging to the specified class with the specified status.

Parameters:
  • attached_class – The class that is the subject of the search.
  • status – Valid values are ‘attached’ and ‘detached’. Default is ‘attached’.
get_all_attachments(attached_class, status='attached', relation_type=None)

Get all of the attachments to an object belonging to the specified class with the specified status.

Parameters:
  • attached_class – The class that is the subject of the search.
  • status – Valid values are ‘attached’ and ‘detached’. Default is ‘attached’.
get_attributes(name=None)

Will return the value of the named attribute in a dictionary format. If no name is given, then it will return all attributes.

Note that attributes that start with _ (underbar) will NOT be included unless explicitly named

This method should be over-written as appropriate by inheriting objects to handle how their local attributes are implemented.

This is intended to normalize how all attributes on all objects can be accessed since the implementations were not consistent.

Parameters:name – optional name of attribute to return
Returns:dictionary of attributes and their values
get_child(child_type, child_name)

Gets a specific immediate child of this object

Parameters:
  • child_type – Class of the child to return
  • child_name – Name of the child to return
Returns:

The specific instance of child_type or None if not found

get_children(only_class=None)

Get a list of the immediate child objects of this object.

Parameters:only_class – Optional parameter that will be used to limit the objects returned to only those belonging to the class passed in this parameter.
Returns:List of children objects.
classmethod get_deep(full_data, working_data, parent=None, limit_to=(), subtree='full', config_only=False)

Gets all instances of this class from the APIC and gets all of the children as well.

Parameters:
  • full_data
  • working_data
  • parent
  • limit_to
  • subtree
  • config_only
classmethod get_deep_apic_classes(include_concrete=False)

Get all the apic classes needed for this acitoolkit class and all of its children. :return: list of all apic classes

get_dn_from_attributes(attributes)

Will get the dn from the attributes or construct it using the dn of the parent plus the rn. Failing those, it will return None

Parameters:attributes
Returns:String containing dn or None
classmethod get_event(session)

Gets the event that is pending for this class. Events are returned in the form of objects. Objects that have been deleted are marked as such.

Parameters:session – the instance of Session used for APIC communication
classmethod get_fault(session, extension='')

Gets the fault that is pending for this class. Faults are returned in the form of objects. Objects that have been deleted are marked as such.

Parameters:session – the instance of Session used for APIC communication
get_filters()

Get all of the filters that are attached to this Terminal.

Returns:List of Filter objects
get_from_json(data, parent=None)

returns a Tenant object from a json

get_interfaces(status='attached')

Get all of the interface relations. Note that multiple classes are considered “interfaces” such as Interface, L2Interface, L3Interface, etc.

Parameters:status – Valid values are ‘attached’ and ‘detached’. Default is ‘attached’.
Returns:List of interfaces that this object has relations and the status matches.
get_json()

Returns json representation of the Terminal Object

Returns:json dictionary of the ContractSubject
get_parent()
Returns:Parent of this object.
get_searchable()

Method to recursively retrieve all of the searchable items from all the children objects, add the current object to them as additional context, append the local searchable terms, and return the result.

static get_table(aci_object, title='')

Abstract method that should be replaced by a version that is specific to the object

Parameters:
  • aci_object
  • title – String containing the table title
Returns:

list of Table objects

get_tags()

Get the tags assigned to this object.

Returns:List of tag instances
has_attachment(item)

Indicates whether this object is attached to the item/ :returns: True or False, True indicates the object is attached.

has_child(obj)

Check for existence of a child in the children list

Parameters:obj – Child object that is the subject of the check.
Returns:True or False, True indicates that it does indeed have the obj object as a child.
has_detachment(item)

Indicates whether the object is detached from this item. :returns: True or False, True indicates the object is detached.

classmethod has_events(session, extension='')

Check for pending events from the APIC that pertain to instances of this class.

Parameters:session – the instance of Session used for APIC communication
Returns:True or False. True if there are events pending.
has_parent()

returns True if this object has a parent

Returns:bool
has_tag(tag)

Checks whether this object has a particular tag assigned.

Parameters:tag – string containing the tag name or an instance of _Tag
Returns:True or False. True indicates the object has this tag assigned.
has_tags()

Checks whether this object has any tags assigned at all.

Returns:True or False. True indicates the object has at least one tag assigned.
info()

Node information summary.

Returns:Formatted string that has a summary of all of the info gathered about the node.
infoList()

Node information. Returns a list of (attr, value) tuples.

Returns:list of [(attr, value),]
is_attached(item)

Indicates whether the item is attached to this object/ :returns: True or False, True indicates the item is attached.

is_deleted()

Check if the object has been deleted.

Returns:True or False, True indicates the object has been deleted.
is_detached(item)

Indicates whether the item is detached from this object.

Returns:True or False, True indicates the item is detached.
static is_interface()

Indicates whether this object is considered an Interface. The default is False.

Returns:False
mark_as_deleted()

Mark the object as deleted. This will cause the JSON status to be set to deleted.

classmethod mask_class_from_graphs()

Mask (hide) this class from graph creation

Returns:False indicating that this class should not be masked.
populate_children(deep=False, include_concrete=False)

Populates all of the children and then calls populate_children of those children if deep is True. This method should be overridden by any object that does have children.

If include_concrete is True, then if the object has concrete objects below it, i.e. is a switch, then also populate those conrete object.

Parameters:
  • include_concrete – True or False. Default is False
  • deep – True or False. Default is False.
remove_child(obj)

Remove a child from the children list

Parameters:obj – Child object that is to be removed.
remove_tag(tag)

Remove a particular tag from being assigned to this object. Note that this does not delete the tag from the APIC.

Parameters:tag – string containing the tag to remove from this object or an instance of _Tag
set_parent(parent_obj)

Set the parent object

Parameters:parent_obj – Instance of the parent object
Returns:None
classmethod subscribe(session, extension='', only_new=False)

Subscribe to events from the APIC that pertain to instances of this class.

Parameters:
  • session – the instance of Session used for APIC communication
  • only_new – Boolean indicating whether to get all events or only the new events. All events (indicated by setting only_new to False) will queue a create event for all of the currently existing objects. Setting only_new to True will only queue events that occur after the initial subscribe. The default has only_new set to False.
subscribe_to_fault_instances_subtree(session, extension='', deep=False)

Subscribe to faults instances for the whole subtree.

Parameters:
  • session – the instance of Session used for APIC communication
  • extension – Optional string that can be used to extend the URL
  • only_new – Boolean indicating whether to get all events or only the new events. All events (indicated by setting only_new to False) will queue a create event for all of the currently existing objects. Setting only_new to True will only queue events that occur after the initial subscribe. The default has only_new set to False.
classmethod unsubscribe(session)

Unsubscribe for events from the APIC that pertain to instances of this class.

Parameters:session – the instance of Session used for APIC communication
update_db(session, subscribed_classes, deep=False)
Parameters:
  • session – Session class instance representing the connection to the APIC
  • subscribed_classes – List of subscribed classes
  • deep – Boolean indicating whether to go deep or not. Default is False
Returns:

List of subscribed classes

class acitoolkit.acitoolkit.BridgeDomain(bd_name, parent=None)

Bases: acitoolkit.acibaseobject.BaseACIObject

BridgeDomain : roughly equivalent to fvBD

Parameters:
  • bd_name – String containing the name of this BridgeDomain object.
  • parent – An instance of Tenant class representing the Tenant which contains this BridgeDomain.
add_child(obj)

Add a child to the children list.

Parameters:obj – Child object to add to the children list of the called object.
add_context(context)

Set the Context for this BD

Parameters:context – Context to assign this BridgeDomain
add_l3out(l3out)

Set the L3Out for this BD

Parameters:l3out – OutsideL3 to assign this BridgeDomain
add_subnet(subnet)

Add a subnet to this BD.

Parameters:subnet – Instance of Subnet class to add to this BridgeDomain.
add_tag(tag)

Assign this object a particular tag. Tags are strings that can be used to classify objects. More than 1 tag can be assigned to an object.

Parameters:tag – string containing the tag to assign to this object or an instance of _Tag
attach(item)

Attach the object to the other object.

Parameters:item – Object to be attached.
static check_session(session)

This will check that the session is of type Session and raise exception if it not

Parameters:session – the session to check
Returns:
delete_tag(tag)

Mark a particular tag as being deleted from this object.

Parameters:tag – string containing the tag to delete from this object or an instance of _Tag
detach(item)

Detach the object from the other object. A relationship is either ‘attached’, ‘detached’, or does not exist. A detached relationship will cause the relationship to be deleted when pushed to the APIC.

Parameters:item – Object to be detached.
find(search_object)

This will check to see if self is a match with search_object and then call find on all of the children of search. If there is a match, a list containing self and any matches found by the children will be returned as a list.

The criteria for a match is that all attributes of self are compared to all attributes of search_object. If search_object.<attr> exists and is the same as self.<attr> or search_object.<attr> is ‘None’, then that attribute matches. If all such attributes match, then there is a match and self will be returned in the result.

If there is an attribute of search_object that does not exist in self, it will be considered a mismatch. If there is an attribute of self that does not exist in search_object, it will be ignored.

Parameters:search_object – ACI object to search
Returns:List of objects
classmethod get(session, tenant)

Gets all of the Bridge Domains from the APIC.

Parameters:
  • session – the instance of Session used for APIC communication
  • tenant – the instance of Tenant used to limit the BridgeDomain instances retreived from the APIC
Returns:

List of BridgeDomain objects

get_all_attached(attached_class, status='attached', relation_type=None)

Get all of the relations of objects belonging to the specified class with the specified status.

Parameters:
  • attached_class – The class that is the subject of the search.
  • status – Valid values are ‘attached’ and ‘detached’. Default is ‘attached’.
get_all_attachments(attached_class, status='attached', relation_type=None)

Get all of the attachments to an object belonging to the specified class with the specified status.

Parameters:
  • attached_class – The class that is the subject of the search.
  • status – Valid values are ‘attached’ and ‘detached’. Default is ‘attached’.
get_arp_flood()

Get the ARP flooding policy for this BD

Returns:a string containing the ARP flooding policy of the BridgeDomain
get_attributes(name=None)

Will return the value of the named attribute in a dictionary format. If no name is given, then it will return all attributes.

Note that attributes that start with _ (underbar) will NOT be included unless explicitly named

This method should be over-written as appropriate by inheriting objects to handle how their local attributes are implemented.

This is intended to normalize how all attributes on all objects can be accessed since the implementations were not consistent.

Parameters:name – optional name of attribute to return
Returns:dictionary of attributes and their values
get_child(child_type, child_name)

Gets a specific immediate child of this object

Parameters:
  • child_type – Class of the child to return
  • child_name – Name of the child to return
Returns:

The specific instance of child_type or None if not found

get_children(only_class=None)

Get a list of the immediate child objects of this object.

Parameters:only_class – Optional parameter that will be used to limit the objects returned to only those belonging to the class passed in this parameter.
Returns:List of children objects.
get_context()

Get the Context for this BD

Returns:Instance of Context class that this BridgeDomain is assigned.
classmethod get_deep(full_data, working_data, parent=None, limit_to=(), subtree='full', config_only=False)

Gets all instances of this class from the APIC and gets all of the children as well.

Parameters:
  • full_data
  • working_data
  • parent
  • limit_to
  • subtree
  • config_only
classmethod get_deep_apic_classes(include_concrete=False)

Get all the apic classes needed for this acitoolkit class and all of its children. :return: list of all apic classes

get_dn_from_attributes(attributes)

Will get the dn from the attributes or construct it using the dn of the parent plus the rn. Failing those, it will return None

Parameters:attributes
Returns:String containing dn or None
classmethod get_event(session)

Gets the event that is pending for this class. Events are returned in the form of objects. Objects that have been deleted are marked as such.

Parameters:session – the instance of Session used for APIC communication
classmethod get_fault(session, extension='')

Gets the fault that is pending for this class. Faults are returned in the form of objects. Objects that have been deleted are marked as such.

Parameters:session – the instance of Session used for APIC communication
static get_from_json(self, data, parent=None)

returns a Tenant object from a json

get_interfaces(status='attached')

Get all of the interface relations. Note that multiple classes are considered “interfaces” such as Interface, L2Interface, L3Interface, etc.

Parameters:status – Valid values are ‘attached’ and ‘detached’. Default is ‘attached’.
Returns:List of interfaces that this object has relations and the status matches.
get_json()

Returns json representation of the bridge domain

Returns:json dictionary of bridge domain
get_l3out()
Returns:List of OutsideL3 objects
get_mac()

Get the mac address for the BD

Returns:string containing the mac address of the BD (e.g. 00:22:BD:F8:19:FF)
get_parent()
Returns:Parent of this object.
get_searchable()

Method to recursively retrieve all of the searchable items from all the children objects, add the current object to them as additional context, append the local searchable terms, and return the result.

get_subnets()

Get all of the subnets on this BD.

Returns:List of Subnet instances assigned to this BridgeDomain.
static get_table(bridge_domains, title='')

Will create table of context information

Parameters:
  • title
  • bridge_domains
get_tags()

Get the tags assigned to this object.

Returns:List of tag instances
get_unicast_route()

Get the Unicast Routing policy for this BD

Returns:a string containing the unicast routing policy of the BridgeDomain
get_unknown_mac_unicast()

Gets the unknown mac unicast for this BD

Returns:unknown mac unicast of the BridgeDomain
get_unknown_multicast()

Gets the unknown multicast for this BD

Returns:unknown multicast of the BridgeDomain
has_attachment(item)

Indicates whether this object is attached to the item/ :returns: True or False, True indicates the object is attached.

has_child(obj)

Check for existence of a child in the children list

Parameters:obj – Child object that is the subject of the check.
Returns:True or False, True indicates that it does indeed have the obj object as a child.
has_context()

Check if the Context has been set for this BD

Returns:True or False. True if this BridgeDomain is assigned to a Context.
has_detachment(item)

Indicates whether the object is detached from this item. :returns: True or False, True indicates the object is detached.

classmethod has_events(session, extension='')

Check for pending events from the APIC that pertain to instances of this class.

Parameters:session – the instance of Session used for APIC communication
Returns:True or False. True if there are events pending.
has_l3out()

Check if this BD has an OutsideL3 :return: True if the BD has an OutsideL3 configured. False, otherwise.

has_parent()

returns True if this object has a parent

Returns:bool
has_subnet(subnet)

Check if the BD has this particular subnet.

Parameters:subnet
Returns:True or False. True if this BridgeDomain has this particular Subnet.
has_tag(tag)

Checks whether this object has a particular tag assigned.

Parameters:tag – string containing the tag name or an instance of _Tag
Returns:True or False. True indicates the object has this tag assigned.
has_tags()

Checks whether this object has any tags assigned at all.

Returns:True or False. True indicates the object has at least one tag assigned.
info()

Node information summary.

Returns:Formatted string that has a summary of all of the info gathered about the node.
infoList()

Node information. Returns a list of (attr, value) tuples.

Returns:list of [(attr, value),]
is_arp_flood()

Check if ARP flooding is enabled

is_attached(item)

Indicates whether the item is attached to this object/ :returns: True or False, True indicates the item is attached.

is_deleted()

Check if the object has been deleted.

Returns:True or False, True indicates the object has been deleted.
is_detached(item)

Indicates whether the item is detached from this object.

Returns:True or False, True indicates the item is detached.
static is_interface()

Indicates whether this object is considered an Interface. The default is False.

Returns:False
is_unicast_route()

Check if unicast routing is enabled

mark_as_deleted()

Mark the object as deleted. This will cause the JSON status to be set to deleted.

classmethod mask_class_from_graphs()

Mask (hide) this class from graph creation

Returns:False indicating that this class should not be masked.
populate_children(deep=False, include_concrete=False)

Populates all of the children and then calls populate_children of those children if deep is True. This method should be overridden by any object that does have children.

If include_concrete is True, then if the object has concrete objects below it, i.e. is a switch, then also populate those conrete object.

Parameters:
  • include_concrete – True or False. Default is False
  • deep – True or False. Default is False.
remove_child(obj)

Remove a child from the children list

Parameters:obj – Child object that is to be removed.
remove_context()

Remove the assigned Context from this BD

remove_subnet(subnet)

Remove a subnet from this BD

Parameters:subnet – Instance of Subnet class to remove from this BridgeDomain.
remove_tag(tag)

Remove a particular tag from being assigned to this object. Note that this does not delete the tag from the APIC.

Parameters:tag – string containing the tag to remove from this object or an instance of _Tag
set_arp_flood(arp_value)

Set the ARP flood for this BD

Parameters:arp_value – arp to assign this BridgeDomain
set_mac(mac)

Set the mac address for the BD

Parameters:mac – string mac address (XX:XX:XX:XX:XX:XX)
set_multidestination(multidestination)

Set the multidestination flood policy for this BD

Parameters:multidestination – policy to assign this BridgeDomain
set_parent(parent_obj)

Set the parent object

Parameters:parent_obj – Instance of the parent object
Returns:None
set_unicast_route(route)

Set the unicast route for this BD

Parameters:route – route to assign this BridgeDomain
set_unknown_mac_unicast(unicast)

Set the unknown mac unicast for this BD

Parameters:unicast – Unicast to assign this BridgeDomain
set_unknown_multicast(multicast)

Set the unknown multicast for this BD

Parameters:multicast – Multicast to assign this BridgeDomain
classmethod subscribe(session, extension='', only_new=False)

Subscribe to events from the APIC that pertain to instances of this class.

Parameters:
  • session – the instance of Session used for APIC communication
  • only_new – Boolean indicating whether to get all events or only the new events. All events (indicated by setting only_new to False) will queue a create event for all of the currently existing objects. Setting only_new to True will only queue events that occur after the initial subscribe. The default has only_new set to False.
subscribe_to_fault_instances_subtree(session, extension='', deep=False)

Subscribe to faults instances for the whole subtree.

Parameters:
  • session – the instance of Session used for APIC communication
  • extension – Optional string that can be used to extend the URL
  • only_new – Boolean indicating whether to get all events or only the new events. All events (indicated by setting only_new to False) will queue a create event for all of the currently existing objects. Setting only_new to True will only queue events that occur after the initial subscribe. The default has only_new set to False.
classmethod unsubscribe(session)

Unsubscribe for events from the APIC that pertain to instances of this class.

Parameters:session – the instance of Session used for APIC communication
update_db(session, subscribed_classes, deep=False)
Parameters:
  • session – Session class instance representing the connection to the APIC
  • subscribed_classes – List of subscribed classes
  • deep – Boolean indicating whether to go deep or not. Default is False
Returns:

List of subscribed classes

class acitoolkit.acitoolkit.CollectionPolicy(parent, granularity, retention, adminState='enabled')

Bases: acitoolkit.acitoolkit.BaseMonitorClass

This class is a child of a MonitorPolicy object, MonitorTarget object or a MonitorStats object. It is where the statistics collection policy is actually specified. It applies to all of the statistics that are at the scope level of the parent object, i.e. all, specific to a target, or specific to a statistics family. What is specified in the CollectionPolicy is the time granularity of the collection and how much history to retain. For example, the granularity might be 5 minutes (5min) or 1 hour (1h). How much history to retain is similarly specified. For example you might specify that it be kept for 10 days (10d) or 2 years (2year).

If the CollectionPolicy is a child of a MonitorStats object, it can optionally have children that specify the policy for raising threshold alarms on the fields in the stats family specified in the MonitorStats object. This has yet to be implemented.

This object is roughly the same as the statsColl and statsHierColl objects in the APIC.

The CollectionPolicy must always be initialized with a parent object of type MonitorPolicy, MonitorTarget or MonitorStats. The granularity must also be specifically specified. The retention period can be specified, set to “none”, or set to “inherited”. Note that the “none” value is a string, not the Python None. When the retention period is set to “none” there will be no historical stats kept. However, assuming collection is enabled, stats will be kept for the current time period.

If the retention period is set to “inherited”, the value will be inherited from the less specific policy directly above this one. The same applies to the adminState value. It can be ‘disabled’, ‘enabled’, or ‘inherited’. If ‘disabled’, the current scope of counters are not gathered. If enabled, they are gathered. If ‘inherited’, it will be according to the next higher scope.

Having the ‘inherited’ option on the retention and administrative status allows these items independently controlled at the current stats granularity. For example, you can specify that ingress unknown packets are gathered every 15 minutes by setting adding a collection policy that specifies a 15 minutes granularity and an adminState of ‘enabled’ under a MonitorStats object that sets the scope to be ingress unknown packets. This might override a higher level policy that disabled collection at a 15 minute interval. However, you can set the retention in that same object to be “inherited” so that this specific policy does not change the retention behavior from that of the higher, less specific, policy.

When the CollectionPolicy is a child at the top level, i.e. of the MonitorPolicy, the ‘inherited’ option is not allowed because there is no higher level policy to inherit from. If this were to happen, ‘inherited’ will be treated as ‘enabled’.

Parameters:
  • parent – Parent object that this collection policy should be applied to. This must be an object of type MonitorStats, MonitorTarget, or MonitorPolicy.
  • granularity – String specifying the time collection interval or granularity of this policy. Possible values are: [‘5min’, ‘15min’, ‘1h’, ‘1d’, ‘1w’, ‘1mo’, ‘1qtr’, ‘1year’].
  • retention – String specifying how much history to retain the collected statistics for. The retention will be for time units of the granularity specified. Possible values are [‘none’, ‘inherited’, ‘5min’, ‘15min’, ‘1h’, ‘1d’, ‘1w’, ‘10d’, ‘1mo’, ‘1qtr’, ‘1year’, ‘2year’, ‘3year’].
  • adminState – Administrative status. String to specify whether stats should be collected at the specified granularity. Possible values are [‘enabled’, ‘disabled’, ‘inherited’]. The default if not specified is ‘enabled’.
add_collection_policy(coll_obj)

Add a collection policy.

Parameters:coll_obj – A collection policy object of type CollectionPolicy
add_stats(stat_obj)

Adds a stats family object.

Parameters:stat_obj – Statistics family object of type MonitorStats.
add_target(target_obj)

Add a target object.

Parameters:target_obj – target object of type MonitorTarget
get_parent()
Returns:parent object
granularityEnum = ['5min', '15min', '1h', '1d', '1w', '1mo', '1qtr', '1year']
isModified()

Returns True if this policy and any children have been modified or created and not been written to the APIC

remove_collection_policy(collection)

Remove a collection_policy object. The object to remove is identified by its granularity, e.g. ‘5min’, ‘15min’, etc. This string can be found in the ‘CollectionPolicy.granularity’ attribute of the object.

Parameters:collection – CollectionPolicy to remove.
remove_stats(stats_family)

Remove a stats family object. The object to remove is identified by a string, e.g. ‘ingrPkts’, or ‘egrTotal’. This string can be found in the ‘MonitorStats.scope’ attribute of the object.

Parameters:stats_family – Statistics family string.
remove_target(target)

Remove a target object. The object to remove is identified by a string, e.g ‘l1PhysIf’. This string can be found in the ‘MonitorTarget.scope’ attribute of the object.

Parameters:target – target to remove.
retentionEnum = ['none', 'inherited', '5min', '15min', '1h', '1d', '1w', '10d', '1mo', '1qtr', '1year', '2year', '3year']
setAdminState(adminState)

Sets the administrative status.

Parameters:adminState – Administrative status. String to specify whether stats should be collected at the specified granularity. Possible values are [‘enabled’, ‘disabled’, ‘inherited’]. The default if not specified is ‘enabled’.
setRetention(retention)
Sets the retention period.
Parameters:retention – String specifying how much history to retain the collected statistics for. The retention will be for time units of the granularity specified. Possible values are [‘none’, ‘inherited’, ‘5min’, ‘15min’, ‘1h’, ‘1d’, ‘1w’, ‘10d’, ‘1mo’, ‘1qtr’, ‘1year’, ‘2year’, ‘3year’].
set_description(description)
Sets the description of the MonitorStats.
Parameters:description – String to use as the description
set_name(name)
Sets the name of the MonitorStats.
Parameters:name – String to use as the name
class acitoolkit.acitoolkit.CommonEPG(epg_name, parent=None)

Bases: acitoolkit.acibaseobject.BaseACIObject

Base class for EPG and OutsideEPG. Not meant to be instantiated directly

Parameters:
  • epg_name – String containing the name of this EPG
  • parent – Instance of the AppProfile class representing the Application Profile where this EPG is contained.
add_child(obj)

Add a child to the children list.

Parameters:obj – Child object to add to the children list of the called object.
add_tag(tag)

Assign this object a particular tag. Tags are strings that can be used to classify objects. More than 1 tag can be assigned to an object.

Parameters:tag – string containing the tag to assign to this object or an instance of _Tag
attach(item)

Attach the object to the other object.

Parameters:item – Object to be attached.
static check_session(session)

This will check that the session is of type Session and raise exception if it not

Parameters:session – the session to check
Returns:
consume(contract)

Make this EPG consume a Contract

Parameters:contract – Contract class instance to be consumed by this EPG.
Returns:True
consume_cif(contract_interface)

Make this EPG consume a ContractInterface

Parameters:contract_interface – ContractInterface class instance to be consumed by this EPG.
Returns:True
delete_tag(tag)

Mark a particular tag as being deleted from this object.

Parameters:tag – string containing the tag to delete from this object or an instance of _Tag
detach(item)

Detach the object from the other object. A relationship is either ‘attached’, ‘detached’, or does not exist. A detached relationship will cause the relationship to be deleted when pushed to the APIC.

Parameters:item – Object to be detached.
does_consume(contract)

Check if this EPG consumes a specific Contract

Parameters:contract – Instance of Contract class to check if it is consumed by this EPG.
Returns:True or False. True if the EPG does consume the Contract.
does_consume_cif(contract_interface)

Check if this EPG consumes a specific Contract

Parameters:contract_interface
Returns:True or False. True if the EPG does consume the ContractInterface.
does_protect(taboo)

Check if this EPG is protected by a specific Taboo.

Parameters:taboo – Instance of Taboo class to check if it protects this EPG.
Returns:True or False. True if the EPG is protected by the Taboo.
does_provide(contract)

Check if this EPG provides a specific Contract.

Parameters:contract – Instance of Contract class to check if it is provided by this EPG.
Returns:True or False. True if the EPG does provide the Contract.
dont_consume(contract)

Make this EPG not consume a Contract. It does not check to see if the Contract was already consumed

Parameters:contract – Instance of Contract class to be no longer consumed by this EPG.
Returns:True
dont_consume_cif(contract_interface)

Make this EPG not consume a ContractInterface. It does not check to see if the ContractInterface was already consumed

Parameters:contract_interface
Returns:True
dont_protect(taboo)

Make this EPG not protected by a Taboo

Parameters:taboo – Instance of Taboo class to no longer protect this EPG.
Returns:True
dont_provide(contract)

Make this EPG not provide a Contract

Parameters:contract – Instance of Contract class to be no longer provided by this EPG.
Returns:True
find(search_object)

This will check to see if self is a match with search_object and then call find on all of the children of search. If there is a match, a list containing self and any matches found by the children will be returned as a list.

The criteria for a match is that all attributes of self are compared to all attributes of search_object. If search_object.<attr> exists and is the same as self.<attr> or search_object.<attr> is ‘None’, then that attribute matches. If all such attributes match, then there is a match and self will be returned in the result.

If there is an attribute of search_object that does not exist in self, it will be considered a mismatch. If there is an attribute of self that does not exist in search_object, it will be ignored.

Parameters:search_object – ACI object to search
Returns:List of objects
classmethod get(session, parent=None, tenant=None)

Gets all of the EPGs from the APIC.

Parameters:
  • session – the instance of Session used for APIC communication
  • parent – Instance of the AppProfile class used to limit the EPGs retreived from the APIC.
  • tenant – Instance of Tenant class used to limit the EPGs retreived from the APIC.
Returns:

List of CommonEPG instances (or EPG instances if called from EPG class)

get_all_attached(attached_class, status='attached', relation_type=None)

Get all of the relations of objects belonging to the specified class with the specified status.

Parameters:
  • attached_class – The class that is the subject of the search.
  • status – Valid values are ‘attached’ and ‘detached’. Default is ‘attached’.
get_all_attachments(attached_class, status='attached', relation_type=None)

Get all of the attachments to an object belonging to the specified class with the specified status.

Parameters:
  • attached_class – The class that is the subject of the search.
  • status – Valid values are ‘attached’ and ‘detached’. Default is ‘attached’.
get_all_consumed(deleted=False)

Get all of the Contracts consumed by this EPG

Parameters:deleted – Boolean indicating whether to get Contracts that are consumed or that the consumed was marked as deleted
Returns:List of Contract objects that are consumed by the EPG.
get_all_consumed_cif(deleted=False)

Get all of the ContractInterfaces consumed by this EPG

Parameters:deleted – Boolean indicating whether to get ContractInterfaces that are consumed or that the consumed was marked as deleted
Returns:List of ContractInterface objects that are consumed by the EPG.
get_all_protected(deleted=False)

Get all of the Taboos protecting this EPG

Parameters:deleted – Boolean indicating whether to get Taboos that are protected or that the protected was marked as deleted
Returns:List of Taboo objects that are protecting the EPG.
get_all_provided(deleted=False)

Get all of the Contracts provided by this EPG

Parameters:deleted – Boolean indicating whether to get Contracts that are provided or that the provided was marked as deleted
Returns:List of Contract objects that are provided by the EPG.
get_attributes(name=None)

Will return the value of the named attribute in a dictionary format. If no name is given, then it will return all attributes.

Note that attributes that start with _ (underbar) will NOT be included unless explicitly named

This method should be over-written as appropriate by inheriting objects to handle how their local attributes are implemented.

This is intended to normalize how all attributes on all objects can be accessed since the implementations were not consistent.

Parameters:name – optional name of attribute to return
Returns:dictionary of attributes and their values
get_child(child_type, child_name)

Gets a specific immediate child of this object

Parameters:
  • child_type – Class of the child to return
  • child_name – Name of the child to return
Returns:

The specific instance of child_type or None if not found

get_children(only_class=None)

Get a list of the immediate child objects of this object.

Parameters:only_class – Optional parameter that will be used to limit the objects returned to only those belonging to the class passed in this parameter.
Returns:List of children objects.
classmethod get_deep(full_data, working_data, parent=None, limit_to=(), subtree='full', config_only=False)

Gets all instances of this class from the APIC and gets all of the children as well.

Parameters:
  • full_data
  • working_data
  • parent
  • limit_to
  • subtree
  • config_only
classmethod get_deep_apic_classes(include_concrete=False)

Get all the apic classes needed for this acitoolkit class and all of its children. :return: list of all apic classes

get_dn_from_attributes(attributes)

Will get the dn from the attributes or construct it using the dn of the parent plus the rn. Failing those, it will return None

Parameters:attributes
Returns:String containing dn or None
classmethod get_event(session)

Gets the event that is pending for this class. Events are returned in the form of objects. Objects that have been deleted are marked as such.

Parameters:session – the instance of Session used for APIC communication
classmethod get_fault(session, extension='')

Gets the fault that is pending for this class. Faults are returned in the form of objects. Objects that have been deleted are marked as such.

Parameters:session – the instance of Session used for APIC communication
get_from_json(data, parent=None)

returns a Tenant object from a json

get_interfaces(status='attached')

Get all of the interfaces that this EPG is attached. The default is to get list of ‘attached’ interfaces. If ‘status’ is set to ‘detached’ it will return the list of detached Interface objects (Those EPGs which are no longer attached to an Interface, but the configuration is not yet pushed to the APIC.)

Parameters:status – ‘attached’ or ‘detached’. Defaults to ‘attached’.
Returns:List of Interface objects
get_json(obj_class, attributes=None, children=None, get_children=True)

Get the JSON representation of this class in the actual APIC Object Model.

Parameters:
  • obj_class – Object Class Name within the APIC model.
  • attributes – Additional attributes that should be set in the JSON.
  • children – Children objects to traverse as well.
  • get_children – Indicates whether the children objects should be included.
Returns:

JSON dictionary to be pushed to the APIC.

get_parent()
Returns:Parent of this object.
get_searchable()

Method to recursively retrieve all of the searchable items from all the children objects, add the current object to them as additional context, append the local searchable terms, and return the result.

static get_table(aci_object, title='')

Abstract method that should be replaced by a version that is specific to the object

Parameters:
  • aci_object
  • title – String containing the table title
Returns:

list of Table objects

get_tags()

Get the tags assigned to this object.

Returns:List of tag instances
has_attachment(item)

Indicates whether this object is attached to the item/ :returns: True or False, True indicates the object is attached.

has_child(obj)

Check for existence of a child in the children list

Parameters:obj – Child object that is the subject of the check.
Returns:True or False, True indicates that it does indeed have the obj object as a child.
has_detachment(item)

Indicates whether the object is detached from this item. :returns: True or False, True indicates the object is detached.

classmethod has_events(session, extension='')

Check for pending events from the APIC that pertain to instances of this class.

Parameters:session – the instance of Session used for APIC communication
Returns:True or False. True if there are events pending.
has_parent()

returns True if this object has a parent

Returns:bool
has_tag(tag)

Checks whether this object has a particular tag assigned.

Parameters:tag – string containing the tag name or an instance of _Tag
Returns:True or False. True indicates the object has this tag assigned.
has_tags()

Checks whether this object has any tags assigned at all.

Returns:True or False. True indicates the object has at least one tag assigned.
info()

Node information summary.

Returns:Formatted string that has a summary of all of the info gathered about the node.
infoList()

Node information. Returns a list of (attr, value) tuples.

Returns:list of [(attr, value),]
is_attached(item)

Indicates whether the item is attached to this object/ :returns: True or False, True indicates the item is attached.

is_deleted()

Check if the object has been deleted.

Returns:True or False, True indicates the object has been deleted.
is_detached(item)

Indicates whether the item is detached from this object.

Returns:True or False, True indicates the item is detached.
static is_interface()

Indicates whether this object is considered an Interface. The default is False.

Returns:False
mark_as_deleted()

Mark the object as deleted. This will cause the JSON status to be set to deleted.

classmethod mask_class_from_graphs()

Mask (hide) this class from graph creation

Returns:False indicating that this class should not be masked.
populate_children(deep=False, include_concrete=False)

Populates all of the children and then calls populate_children of those children if deep is True. This method should be overridden by any object that does have children.

If include_concrete is True, then if the object has concrete objects below it, i.e. is a switch, then also populate those conrete object.

Parameters:
  • include_concrete – True or False. Default is False
  • deep – True or False. Default is False.
protect(taboo)

Make this EPG protected by a Taboo

Parameters:taboo – Instance of Taboo class to protect this EPG.
Returns:True
provide(contract)

Make this EPG provide a Contract

Parameters:contract – Instance of Contract class to be provided by this EPG.
Returns:True
remove_child(obj)

Remove a child from the children list

Parameters:obj – Child object that is to be removed.
remove_tag(tag)

Remove a particular tag from being assigned to this object. Note that this does not delete the tag from the APIC.

Parameters:tag – string containing the tag to remove from this object or an instance of _Tag
set_parent(parent_obj)

Set the parent object

Parameters:parent_obj – Instance of the parent object
Returns:None
classmethod subscribe(session, extension='', only_new=False)

Subscribe to events from the APIC that pertain to instances of this class.

Parameters:
  • session – the instance of Session used for APIC communication
  • only_new – Boolean indicating whether to get all events or only the new events. All events (indicated by setting only_new to False) will queue a create event for all of the currently existing objects. Setting only_new to True will only queue events that occur after the initial subscribe. The default has only_new set to False.
subscribe_to_fault_instances_subtree(session, extension='', deep=False)

Subscribe to faults instances for the whole subtree.

Parameters:
  • session – the instance of Session used for APIC communication
  • extension – Optional string that can be used to extend the URL
  • only_new – Boolean indicating whether to get all events or only the new events. All events (indicated by setting only_new to False) will queue a create event for all of the currently existing objects. Setting only_new to True will only queue events that occur after the initial subscribe. The default has only_new set to False.
classmethod unsubscribe(session)

Unsubscribe for events from the APIC that pertain to instances of this class.

Parameters:session – the instance of Session used for APIC communication
update_db(session, subscribed_classes, deep=False)
Parameters:
  • session – Session class instance representing the connection to the APIC
  • subscribed_classes – List of subscribed classes
  • deep – Boolean indicating whether to go deep or not. Default is False
Returns:

List of subscribed classes

class acitoolkit.acitoolkit.Context(context_name, parent=None)

Bases: acitoolkit.acibaseobject.BaseACIObject

Context : roughly equivalent to fvCtx

Parameters:
  • context_name – String containing the Context name
  • parent – An instance of Tenant class representing the Tenant which contains this Context.
add_child(obj)

Add a child to the children list.

Parameters:obj – Child object to add to the children list of the called object.
add_tag(tag)

Assign this object a particular tag. Tags are strings that can be used to classify objects. More than 1 tag can be assigned to an object.

Parameters:tag – string containing the tag to assign to this object or an instance of _Tag
attach(item)

Attach the object to the other object.

Parameters:item – Object to be attached.
static check_session(session)

This will check that the session is of type Session and raise exception if it not

Parameters:session – the session to check
Returns:
delete_tag(tag)

Mark a particular tag as being deleted from this object.

Parameters:tag – string containing the tag to delete from this object or an instance of _Tag
detach(item)

Detach the object from the other object. A relationship is either ‘attached’, ‘detached’, or does not exist. A detached relationship will cause the relationship to be deleted when pushed to the APIC.

Parameters:item – Object to be detached.
find(search_object)

This will check to see if self is a match with search_object and then call find on all of the children of search. If there is a match, a list containing self and any matches found by the children will be returned as a list.

The criteria for a match is that all attributes of self are compared to all attributes of search_object. If search_object.<attr> exists and is the same as self.<attr> or search_object.<attr> is ‘None’, then that attribute matches. If all such attributes match, then there is a match and self will be returned in the result.

If there is an attribute of search_object that does not exist in self, it will be considered a mismatch. If there is an attribute of self that does not exist in search_object, it will be ignored.

Parameters:search_object – ACI object to search
Returns:List of objects
classmethod get(session, tenant=None)

Gets all of the Contexts from the APIC.

Parameters:
  • session – the instance of Session used for APIC communication
  • tenant – the instance of Tenant used to limit the Contexts retreived from the APIC
Returns:

List of Context objects

get_all_attached(attached_class, status='attached', relation_type=None)

Get all of the relations of objects belonging to the specified class with the specified status.

Parameters:
  • attached_class – The class that is the subject of the search.
  • status – Valid values are ‘attached’ and ‘detached’. Default is ‘attached’.
get_all_attachments(attached_class, status='attached', relation_type=None)

Get all of the attachments to an object belonging to the specified class with the specified status.

Parameters:
  • attached_class – The class that is the subject of the search.
  • status – Valid values are ‘attached’ and ‘detached’. Default is ‘attached’.
get_allow_all()

Returns the allow_all value from this Context. When set, contracts will not be enforced in this context.

Returns:True or False.
get_attributes(name=None)

Will return the value of the named attribute in a dictionary format. If no name is given, then it will return all attributes.

Note that attributes that start with _ (underbar) will NOT be included unless explicitly named

This method should be over-written as appropriate by inheriting objects to handle how their local attributes are implemented.

This is intended to normalize how all attributes on all objects can be accessed since the implementations were not consistent.

Parameters:name – optional name of attribute to return
Returns:dictionary of attributes and their values
get_child(child_type, child_name)

Gets a specific immediate child of this object

Parameters:
  • child_type – Class of the child to return
  • child_name – Name of the child to return
Returns:

The specific instance of child_type or None if not found

get_children(only_class=None)

Get a list of the immediate child objects of this object.

Parameters:only_class – Optional parameter that will be used to limit the objects returned to only those belonging to the class passed in this parameter.
Returns:List of children objects.
classmethod get_deep(full_data, working_data, parent=None, limit_to=(), subtree='full', config_only=False)

Gets all instances of this class from the APIC and gets all of the children as well.

Parameters:
  • full_data
  • working_data
  • parent
  • limit_to
  • subtree
  • config_only
classmethod get_deep_apic_classes(include_concrete=False)

Get all the apic classes needed for this acitoolkit class and all of its children. :return: list of all apic classes

get_dn_from_attributes(attributes)

Will get the dn from the attributes or construct it using the dn of the parent plus the rn. Failing those, it will return None

Parameters:attributes
Returns:String containing dn or None
classmethod get_event(session)

Gets the event that is pending for this class. Events are returned in the form of objects. Objects that have been deleted are marked as such.

Parameters:session – the instance of Session used for APIC communication
classmethod get_fault(session, extension='')

Gets the fault that is pending for this class. Faults are returned in the form of objects. Objects that have been deleted are marked as such.

Parameters:session – the instance of Session used for APIC communication
get_from_json(data, parent=None)

returns a Tenant object from a json

get_interfaces(status='attached')

Get all of the interface relations. Note that multiple classes are considered “interfaces” such as Interface, L2Interface, L3Interface, etc.

Parameters:status – Valid values are ‘attached’ and ‘detached’. Default is ‘attached’.
Returns:List of interfaces that this object has relations and the status matches.
get_json()

Returns json representation of fvCtx object

Returns:json dictionary of fvCtx object
get_parent()
Returns:Parent of this object.
get_searchable()

Method to recursively retrieve all of the searchable items from all the children objects, add the current object to them as additional context, append the local searchable terms, and return the result.

static get_table(contexts, title='')

Will create table of context information

Parameters:
  • title
  • contexts
get_tags()

Get the tags assigned to this object.

Returns:List of tag instances
has_attachment(item)

Indicates whether this object is attached to the item/ :returns: True or False, True indicates the object is attached.

has_child(obj)

Check for existence of a child in the children list

Parameters:obj – Child object that is the subject of the check.
Returns:True or False, True indicates that it does indeed have the obj object as a child.
has_detachment(item)

Indicates whether the object is detached from this item. :returns: True or False, True indicates the object is detached.

classmethod has_events(session, extension='')

Check for pending events from the APIC that pertain to instances of this class.

Parameters:session – the instance of Session used for APIC communication
Returns:True or False. True if there are events pending.
has_parent()

returns True if this object has a parent

Returns:bool
has_tag(tag)

Checks whether this object has a particular tag assigned.

Parameters:tag – string containing the tag name or an instance of _Tag
Returns:True or False. True indicates the object has this tag assigned.
has_tags()

Checks whether this object has any tags assigned at all.

Returns:True or False. True indicates the object has at least one tag assigned.
info()

Node information summary.

Returns:Formatted string that has a summary of all of the info gathered about the node.
infoList()

Node information. Returns a list of (attr, value) tuples.

Returns:list of [(attr, value),]
is_attached(item)

Indicates whether the item is attached to this object/ :returns: True or False, True indicates the item is attached.

is_deleted()

Check if the object has been deleted.

Returns:True or False, True indicates the object has been deleted.
is_detached(item)

Indicates whether the item is detached from this object.

Returns:True or False, True indicates the item is detached.
static is_interface()

Indicates whether this object is considered an Interface. The default is False.

Returns:False
mark_as_deleted()

Mark the object as deleted. This will cause the JSON status to be set to deleted.

classmethod mask_class_from_graphs()

Mask (hide) this class from graph creation

Returns:False indicating that this class should not be masked.
populate_children(deep=False, include_concrete=False)

Populates all of the children and then calls populate_children of those children if deep is True. This method should be overridden by any object that does have children.

If include_concrete is True, then if the object has concrete objects below it, i.e. is a switch, then also populate those conrete object.

Parameters:
  • include_concrete – True or False. Default is False
  • deep – True or False. Default is False.
remove_child(obj)

Remove a child from the children list

Parameters:obj – Child object that is to be removed.
remove_tag(tag)

Remove a particular tag from being assigned to this object. Note that this does not delete the tag from the APIC.

Parameters:tag – string containing the tag to remove from this object or an instance of _Tag
set_allow_all(value=True)

Set the allow_all value. When set, contracts will not be enforced in this context.

Parameters:value – True or False. Default is True.
set_parent(parent_obj)

Set the parent object

Parameters:parent_obj – Instance of the parent object
Returns:None
classmethod subscribe(session, extension='', only_new=False)

Subscribe to events from the APIC that pertain to instances of this class.

Parameters:
  • session – the instance of Session used for APIC communication
  • only_new – Boolean indicating whether to get all events or only the new events. All events (indicated by setting only_new to False) will queue a create event for all of the currently existing objects. Setting only_new to True will only queue events that occur after the initial subscribe. The default has only_new set to False.
subscribe_to_fault_instances_subtree(session, extension='', deep=False)

Subscribe to faults instances for the whole subtree.

Parameters:
  • session – the instance of Session used for APIC communication
  • extension – Optional string that can be used to extend the URL
  • only_new – Boolean indicating whether to get all events or only the new events. All events (indicated by setting only_new to False) will queue a create event for all of the currently existing objects. Setting only_new to True will only queue events that occur after the initial subscribe. The default has only_new set to False.
classmethod unsubscribe(session)

Unsubscribe for events from the APIC that pertain to instances of this class.

Parameters:session – the instance of Session used for APIC communication
update_db(session, subscribed_classes, deep=False)
Parameters:
  • session – Session class instance representing the connection to the APIC
  • subscribed_classes – List of subscribed classes
  • deep – Boolean indicating whether to go deep or not. Default is False
Returns:

List of subscribed classes

class acitoolkit.acitoolkit.Contract(contract_name, parent=None)

Bases: acitoolkit.acitoolkit.BaseContract

Contract : Class for Contracts

add_child(obj)

Add a child to the children list.

Parameters:obj – Child object to add to the children list of the called object.
add_tag(tag)

Assign this object a particular tag. Tags are strings that can be used to classify objects. More than 1 tag can be assigned to an object.

Parameters:tag – string containing the tag to assign to this object or an instance of _Tag
attach(item)

Attach the object to the other object.

Parameters:item – Object to be attached.
static check_session(session)

This will check that the session is of type Session and raise exception if it not

Parameters:session – the session to check
Returns:
delete_tag(tag)

Mark a particular tag as being deleted from this object.

Parameters:tag – string containing the tag to delete from this object or an instance of _Tag
detach(item)

Detach the object from the other object. A relationship is either ‘attached’, ‘detached’, or does not exist. A detached relationship will cause the relationship to be deleted when pushed to the APIC.

Parameters:item – Object to be detached.
find(search_object)

This will check to see if self is a match with search_object and then call find on all of the children of search. If there is a match, a list containing self and any matches found by the children will be returned as a list.

The criteria for a match is that all attributes of self are compared to all attributes of search_object. If search_object.<attr> exists and is the same as self.<attr> or search_object.<attr> is ‘None’, then that attribute matches. If all such attributes match, then there is a match and self will be returned in the result.

If there is an attribute of search_object that does not exist in self, it will be considered a mismatch. If there is an attribute of self that does not exist in search_object, it will be ignored.

Parameters:search_object – ACI object to search
Returns:List of objects
classmethod get(session, tenant)

Gets all of the Contracts from the APIC for a particular tenant.

Parameters:
  • tenant
  • session
get_all_attached(attached_class, status='attached', relation_type=None)

Get all of the relations of objects belonging to the specified class with the specified status.

Parameters:
  • attached_class – The class that is the subject of the search.
  • status – Valid values are ‘attached’ and ‘detached’. Default is ‘attached’.
get_all_attachments(attached_class, status='attached', relation_type=None)

Get all of the attachments to an object belonging to the specified class with the specified status.

Parameters:
  • attached_class – The class that is the subject of the search.
  • status – Valid values are ‘attached’ and ‘detached’. Default is ‘attached’.
get_all_consuming_epgs(deleted=False)

Get all of the EPGs consuming this contract

Parameters:deleted – Boolean indicating whether to get EPGs that are consuming or that the consuming relationship was marked as deleted
Returns:List of EPG instances
get_all_filter_entries(direction='bidirectional-only')

Get all of the filter entries contained within this Contract/Taboo

Parameters:direction – String containing the type of filter entries to gather Valid values are ‘bidirectional-only’, ‘input-only’, ‘output-only’, ‘all’ Default is ‘bidirectional-only’
Returns:List of FilterEntry instances
get_all_providing_epgs(deleted=False)

Get all of the EPGs providing this contract

Parameters:deleted – Boolean indicating whether to get EPGs that are providing or that the providing relationship was marked as deleted
Returns:List of EPG instances
get_attributes(name=None)

Will return the value of the named attribute in a dictionary format. If no name is given, then it will return all attributes.

Note that attributes that start with _ (underbar) will NOT be included unless explicitly named

This method should be over-written as appropriate by inheriting objects to handle how their local attributes are implemented.

This is intended to normalize how all attributes on all objects can be accessed since the implementations were not consistent.

Parameters:name – optional name of attribute to return
Returns:dictionary of attributes and their values
get_child(child_type, child_name)

Gets a specific immediate child of this object

Parameters:
  • child_type – Class of the child to return
  • child_name – Name of the child to return
Returns:

The specific instance of child_type or None if not found

get_children(only_class=None)

Get a list of the immediate child objects of this object.

Parameters:only_class – Optional parameter that will be used to limit the objects returned to only those belonging to the class passed in this parameter.
Returns:List of children objects.
classmethod get_deep(full_data, working_data, parent=None, limit_to=(), subtree='full', config_only=False)

Gets all instances of this class from the APIC and gets all of the children as well.

Parameters:
  • full_data
  • working_data
  • parent
  • limit_to
  • subtree
  • config_only
classmethod get_deep_apic_classes(include_concrete=False)

Get all the apic classes needed for this acitoolkit class and all of its children. :return: list of all apic classes

get_dn_from_attributes(attributes)

Will get the dn from the attributes or construct it using the dn of the parent plus the rn. Failing those, it will return None

Parameters:attributes
Returns:String containing dn or None
classmethod get_event(session)

Gets the event that is pending for this class. Events are returned in the form of objects. Objects that have been deleted are marked as such.

Parameters:session – the instance of Session used for APIC communication
classmethod get_fault(session, extension='')

Gets the fault that is pending for this class. Faults are returned in the form of objects. Objects that have been deleted are marked as such.

Parameters:session – the instance of Session used for APIC communication
get_from_json(data, parent=None)

returns a Tenant object from a json

get_interfaces(status='attached')

Get all of the interface relations. Note that multiple classes are considered “interfaces” such as Interface, L2Interface, L3Interface, etc.

Parameters:status – Valid values are ‘attached’ and ‘detached’. Default is ‘attached’.
Returns:List of interfaces that this object has relations and the status matches.
get_json()

Returns json representation of the contract

Returns:json dictionary of the contract
get_parent()
Returns:Parent of this object.
get_scope()

Get the scope of this contract. Valid values are ‘context’, ‘global’, ‘tenant’, and ‘application-profile’

get_searchable()

Method to recursively retrieve all of the searchable items from all the children objects, add the current object to them as additional context, append the local searchable terms, and return the result.

static get_table(contracts, title='')

Will create of each contract

Parameters:
  • title
  • contracts
get_tags()

Get the tags assigned to this object.

Returns:List of tag instances
has_attachment(item)

Indicates whether this object is attached to the item/ :returns: True or False, True indicates the object is attached.

has_child(obj)

Check for existence of a child in the children list

Parameters:obj – Child object that is the subject of the check.
Returns:True or False, True indicates that it does indeed have the obj object as a child.
has_detachment(item)

Indicates whether the object is detached from this item. :returns: True or False, True indicates the object is detached.

classmethod has_events(session, extension='')

Check for pending events from the APIC that pertain to instances of this class.

Parameters:session – the instance of Session used for APIC communication
Returns:True or False. True if there are events pending.
has_parent()

returns True if this object has a parent

Returns:bool
has_tag(tag)

Checks whether this object has a particular tag assigned.

Parameters:tag – string containing the tag name or an instance of _Tag
Returns:True or False. True indicates the object has this tag assigned.
has_tags()

Checks whether this object has any tags assigned at all.

Returns:True or False. True indicates the object has at least one tag assigned.
info()

Node information summary.

Returns:Formatted string that has a summary of all of the info gathered about the node.
infoList()

Node information. Returns a list of (attr, value) tuples.

Returns:list of [(attr, value),]
is_attached(item)

Indicates whether the item is attached to this object/ :returns: True or False, True indicates the item is attached.

is_deleted()

Check if the object has been deleted.

Returns:True or False, True indicates the object has been deleted.
is_detached(item)

Indicates whether the item is detached from this object.

Returns:True or False, True indicates the item is detached.
static is_interface()

Indicates whether this object is considered an Interface. The default is False.

Returns:False
mark_as_deleted()

Mark the object as deleted. This will cause the JSON status to be set to deleted.

classmethod mask_class_from_graphs()

Mask (hide) this class from graph creation

Returns:False indicating that this class should not be masked.
populate_children(deep=False, include_concrete=False)

Populates all of the children and then calls populate_children of those children if deep is True. This method should be overridden by any object that does have children.

If include_concrete is True, then if the object has concrete objects below it, i.e. is a switch, then also populate those conrete object.

Parameters:
  • include_concrete – True or False. Default is False
  • deep – True or False. Default is False.
remove_child(obj)

Remove a child from the children list

Parameters:obj – Child object that is to be removed.
remove_tag(tag)

Remove a particular tag from being assigned to this object. Note that this does not delete the tag from the APIC.

Parameters:tag – string containing the tag to remove from this object or an instance of _Tag
set_parent(parent_obj)

Set the parent object

Parameters:parent_obj – Instance of the parent object
Returns:None
set_scope(scope)

Set the scope of this contract. Valid values are ‘context’, ‘global’, ‘tenant’, and ‘application-profile’

Parameters:scope – String containing one of the following ‘context’, ‘global’, ‘tenant’, or ‘application-profile’
classmethod subscribe(session, extension='', only_new=False)

Subscribe to events from the APIC that pertain to instances of this class.

Parameters:
  • session – the instance of Session used for APIC communication
  • only_new – Boolean indicating whether to get all events or only the new events. All events (indicated by setting only_new to False) will queue a create event for all of the currently existing objects. Setting only_new to True will only queue events that occur after the initial subscribe. The default has only_new set to False.
subscribe_to_fault_instances_subtree(session, extension='', deep=False)

Subscribe to faults instances for the whole subtree.

Parameters:
  • session – the instance of Session used for APIC communication
  • extension – Optional string that can be used to extend the URL
  • only_new – Boolean indicating whether to get all events or only the new events. All events (indicated by setting only_new to False) will queue a create event for all of the currently existing objects. Setting only_new to True will only queue events that occur after the initial subscribe. The default has only_new set to False.
classmethod unsubscribe(session)

Unsubscribe for events from the APIC that pertain to instances of this class.

Parameters:session – the instance of Session used for APIC communication
update_db(session, subscribed_classes, deep=False)
Parameters:
  • session – Session class instance representing the connection to the APIC
  • subscribed_classes – List of subscribed classes
  • deep – Boolean indicating whether to go deep or not. Default is False
Returns:

List of subscribed classes

class acitoolkit.acitoolkit.ContractInterface(contractif_name, parent=None)

Bases: acitoolkit.acibaseobject.BaseACIObject

ContractInterface : roughly equivalent to vzCPIf

Parameters:
  • contractif_name – String containing the ContractInterface name
  • parent – An instance of Tenant class representing the Tenant which contains this ContractInterface.
add_child(obj)

Add a child to the children list.

Parameters:obj – Child object to add to the children list of the called object.
add_tag(tag)

Assign this object a particular tag. Tags are strings that can be used to classify objects. More than 1 tag can be assigned to an object.

Parameters:tag – string containing the tag to assign to this object or an instance of _Tag
attach(item)

Attach the object to the other object.

Parameters:item – Object to be attached.
static check_session(session)

This will check that the session is of type Session and raise exception if it not

Parameters:session – the session to check
Returns:
delete_tag(tag)

Mark a particular tag as being deleted from this object.

Parameters:tag – string containing the tag to delete from this object or an instance of _Tag
detach(item)

Detach the object from the other object. A relationship is either ‘attached’, ‘detached’, or does not exist. A detached relationship will cause the relationship to be deleted when pushed to the APIC.

Parameters:item – Object to be detached.
does_import_contract(contract)

Check if this ContractInterface imports a specific Contract.

Parameters:contract – Instance of Contract class to check if it is imported by this ContractInterface.
Returns:True or False. True if the ContractInterface does import the Contract.
find(search_object)

This will check to see if self is a match with search_object and then call find on all of the children of search. If there is a match, a list containing self and any matches found by the children will be returned as a list.

The criteria for a match is that all attributes of self are compared to all attributes of search_object. If search_object.<attr> exists and is the same as self.<attr> or search_object.<attr> is ‘None’, then that attribute matches. If all such attributes match, then there is a match and self will be returned in the result.

If there is an attribute of search_object that does not exist in self, it will be considered a mismatch. If there is an attribute of self that does not exist in search_object, it will be ignored.

Parameters:search_object – ACI object to search
Returns:List of objects
classmethod get(session, tenant=None)

Gets all of the ContractInterfaces from the APIC.

Parameters:
  • session – the instance of Session used for APIC communication
  • tenant – the instance of Tenant used to limit the ContractInterfaces retrieved from the APIC
Returns:

List of ContractInterface objects

get_all_attached(attached_class, status='attached', relation_type=None)

Get all of the relations of objects belonging to the specified class with the specified status.

Parameters:
  • attached_class – The class that is the subject of the search.
  • status – Valid values are ‘attached’ and ‘detached’. Default is ‘attached’.
get_all_attachments(attached_class, status='attached', relation_type=None)

Get all of the attachments to an object belonging to the specified class with the specified status.

Parameters:
  • attached_class – The class that is the subject of the search.
  • status – Valid values are ‘attached’ and ‘detached’. Default is ‘attached’.
get_attributes(name=None)

Will return the value of the named attribute in a dictionary format. If no name is given, then it will return all attributes.

Note that attributes that start with _ (underbar) will NOT be included unless explicitly named

This method should be over-written as appropriate by inheriting objects to handle how their local attributes are implemented.

This is intended to normalize how all attributes on all objects can be accessed since the implementations were not consistent.

Parameters:name – optional name of attribute to return
Returns:dictionary of attributes and their values
get_child(child_type, child_name)

Gets a specific immediate child of this object

Parameters:
  • child_type – Class of the child to return
  • child_name – Name of the child to return
Returns:

The specific instance of child_type or None if not found

get_children(only_class=None)

Get a list of the immediate child objects of this object.

Parameters:only_class – Optional parameter that will be used to limit the objects returned to only those belonging to the class passed in this parameter.
Returns:List of children objects.
classmethod get_deep(full_data, working_data, parent=None, limit_to=(), subtree='full', config_only=False)

Gets all instances of this class from the APIC and gets all of the children as well.

Parameters:
  • full_data
  • working_data
  • parent
  • limit_to
  • subtree
  • config_only
classmethod get_deep_apic_classes(include_concrete=False)

Get all the apic classes needed for this acitoolkit class and all of its children. :return: list of all apic classes

get_dn_from_attributes(attributes)

Will get the dn from the attributes or construct it using the dn of the parent plus the rn. Failing those, it will return None

Parameters:attributes
Returns:String containing dn or None
classmethod get_event(session)

Gets the event that is pending for this class. Events are returned in the form of objects. Objects that have been deleted are marked as such.

Parameters:session – the instance of Session used for APIC communication
classmethod get_fault(session, extension='')

Gets the fault that is pending for this class. Faults are returned in the form of objects. Objects that have been deleted are marked as such.

Parameters:session – the instance of Session used for APIC communication
get_from_json(data, parent=None)

returns a Tenant object from a json

get_import_contract(deleted=False)

Get the specific Contract that this ContractInterface is importing.

Parameters:contract – Instance of Contract class that is imported by this ContractInterface.
Returns:Contract class instance or None if not importing a contract
get_interfaces(status='attached')

Get all of the interface relations. Note that multiple classes are considered “interfaces” such as Interface, L2Interface, L3Interface, etc.

Parameters:status – Valid values are ‘attached’ and ‘detached’. Default is ‘attached’.
Returns:List of interfaces that this object has relations and the status matches.
get_json()

Returns json representation of vzCPIf object

Returns:json dictionary of vzCPIf object
get_parent()
Returns:Parent of this object.
get_searchable()

Method to recursively retrieve all of the searchable items from all the children objects, add the current object to them as additional context, append the local searchable terms, and return the result.

static get_table(aci_object, title='')

Abstract method that should be replaced by a version that is specific to the object

Parameters:
  • aci_object
  • title – String containing the table title
Returns:

list of Table objects

get_tags()

Get the tags assigned to this object.

Returns:List of tag instances
has_attachment(item)

Indicates whether this object is attached to the item/ :returns: True or False, True indicates the object is attached.

has_child(obj)

Check for existence of a child in the children list

Parameters:obj – Child object that is the subject of the check.
Returns:True or False, True indicates that it does indeed have the obj object as a child.
has_detachment(item)

Indicates whether the object is detached from this item. :returns: True or False, True indicates the object is detached.

classmethod has_events(session, extension='')

Check for pending events from the APIC that pertain to instances of this class.

Parameters:session – the instance of Session used for APIC communication
Returns:True or False. True if there are events pending.
has_import_contract()

Check if the ContractInterface has any imported Contract :return: True or False. True if the ContractInterface does import a Contract.

has_parent()

returns True if this object has a parent

Returns:bool
has_tag(tag)

Checks whether this object has a particular tag assigned.

Parameters:tag – string containing the tag name or an instance of _Tag
Returns:True or False. True indicates the object has this tag assigned.
has_tags()

Checks whether this object has any tags assigned at all.

Returns:True or False. True indicates the object has at least one tag assigned.
import_contract(contract)

Set the Contract that is imported by this ContractInterface

Parameters:contract – Instance of Contract
Returns:None
info()

Node information summary.

Returns:Formatted string that has a summary of all of the info gathered about the node.
infoList()

Node information. Returns a list of (attr, value) tuples.

Returns:list of [(attr, value),]
is_attached(item)

Indicates whether the item is attached to this object/ :returns: True or False, True indicates the item is attached.

is_deleted()

Check if the object has been deleted.

Returns:True or False, True indicates the object has been deleted.
is_detached(item)

Indicates whether the item is detached from this object.

Returns:True or False, True indicates the item is detached.
static is_interface()

Indicates whether this object is considered an Interface. The default is False.

Returns:False
mark_as_deleted()

Mark the object as deleted. This will cause the JSON status to be set to deleted.

classmethod mask_class_from_graphs()

Mask (hide) this class from graph creation

Returns:False indicating that this class should not be masked.
populate_children(deep=False, include_concrete=False)

Populates all of the children and then calls populate_children of those children if deep is True. This method should be overridden by any object that does have children.

If include_concrete is True, then if the object has concrete objects below it, i.e. is a switch, then also populate those conrete object.

Parameters:
  • include_concrete – True or False. Default is False
  • deep – True or False. Default is False.
remove_child(obj)

Remove a child from the children list

Parameters:obj – Child object that is to be removed.
remove_tag(tag)

Remove a particular tag from being assigned to this object. Note that this does not delete the tag from the APIC.

Parameters:tag – string containing the tag to remove from this object or an instance of _Tag
set_parent(parent_obj)

Set the parent object

Parameters:parent_obj – Instance of the parent object
Returns:None
classmethod subscribe(session, extension='', only_new=False)

Subscribe to events from the APIC that pertain to instances of this class.

Parameters:
  • session – the instance of Session used for APIC communication
  • only_new – Boolean indicating whether to get all events or only the new events. All events (indicated by setting only_new to False) will queue a create event for all of the currently existing objects. Setting only_new to True will only queue events that occur after the initial subscribe. The default has only_new set to False.
subscribe_to_fault_instances_subtree(session, extension='', deep=False)

Subscribe to faults instances for the whole subtree.

Parameters:
  • session – the instance of Session used for APIC communication
  • extension – Optional string that can be used to extend the URL
  • only_new – Boolean indicating whether to get all events or only the new events. All events (indicated by setting only_new to False) will queue a create event for all of the currently existing objects. Setting only_new to True will only queue events that occur after the initial subscribe. The default has only_new set to False.
classmethod unsubscribe(session)

Unsubscribe for events from the APIC that pertain to instances of this class.

Parameters:session – the instance of Session used for APIC communication
update_db(session, subscribed_classes, deep=False)
Parameters:
  • session – Session class instance representing the connection to the APIC
  • subscribed_classes – List of subscribed classes
  • deep – Boolean indicating whether to go deep or not. Default is False
Returns:

List of subscribed classes

class acitoolkit.acitoolkit.ContractSubject(subject_name, parent=None)

Bases: acitoolkit.acibaseobject.BaseACIObject

ContractSubject : roughly equivalent to vzSubj

add_child(obj)

Add a child to the children list.

Parameters:obj – Child object to add to the children list of the called object.
add_filter(filter_obj)

Add Filter to the ContractSubject, roughly equivalent to vzRsSubjFiltAtt

Parameters:filter_obj – Instance of Filter class. Represents a Filter that is added to the ContractSubject. Multiple Filter can be assigned to a single ContractSubject.
add_tag(tag)

Assign this object a particular tag. Tags are strings that can be used to classify objects. More than 1 tag can be assigned to an object.

Parameters:tag – string containing the tag to assign to this object or an instance of _Tag
attach(item)

Attach the object to the other object.

Parameters:item – Object to be attached.
static check_session(session)

This will check that the session is of type Session and raise exception if it not

Parameters:session – the session to check
Returns:
delete_tag(tag)

Mark a particular tag as being deleted from this object.

Parameters:tag – string containing the tag to delete from this object or an instance of _Tag
detach(item)

Detach the object from the other object. A relationship is either ‘attached’, ‘detached’, or does not exist. A detached relationship will cause the relationship to be deleted when pushed to the APIC.

Parameters:item – Object to be detached.
find(search_object)

This will check to see if self is a match with search_object and then call find on all of the children of search. If there is a match, a list containing self and any matches found by the children will be returned as a list.

The criteria for a match is that all attributes of self are compared to all attributes of search_object. If search_object.<attr> exists and is the same as self.<attr> or search_object.<attr> is ‘None’, then that attribute matches. If all such attributes match, then there is a match and self will be returned in the result.

If there is an attribute of search_object that does not exist in self, it will be considered a mismatch. If there is an attribute of self that does not exist in search_object, it will be ignored.

Parameters:search_object – ACI object to search
Returns:List of objects
classmethod get(session, toolkit_class, apic_class, parent=None, tenant=None, query_target_type='subtree')

Generic classmethod to get all of a particular APIC class.

Parameters:
  • session – the instance of Session used for APIC communication
  • toolkit_class – acitoolkit class to return
  • apic_class – String containing class name from the APIC object model.
  • parent – Object to assign as the parent to the created objects.
  • tenant – Tenant object to assign the created objects.
  • query_target_type – type of the query either self,children,subtree
get_all_attached(attached_class, status='attached', relation_type=None)

Get all of the relations of objects belonging to the specified class with the specified status.

Parameters:
  • attached_class – The class that is the subject of the search.
  • status – Valid values are ‘attached’ and ‘detached’. Default is ‘attached’.
get_all_attachments(attached_class, status='attached', relation_type=None)

Get all of the attachments to an object belonging to the specified class with the specified status.

Parameters:
  • attached_class – The class that is the subject of the search.
  • status – Valid values are ‘attached’ and ‘detached’. Default is ‘attached’.
get_attributes(name=None)

Will return the value of the named attribute in a dictionary format. If no name is given, then it will return all attributes.

Note that attributes that start with _ (underbar) will NOT be included unless explicitly named

This method should be over-written as appropriate by inheriting objects to handle how their local attributes are implemented.

This is intended to normalize how all attributes on all objects can be accessed since the implementations were not consistent.

Parameters:name – optional name of attribute to return
Returns:dictionary of attributes and their values
get_child(child_type, child_name)

Gets a specific immediate child of this object

Parameters:
  • child_type – Class of the child to return
  • child_name – Name of the child to return
Returns:

The specific instance of child_type or None if not found

get_children(only_class=None)

Get a list of the immediate child objects of this object.

Parameters:only_class – Optional parameter that will be used to limit the objects returned to only those belonging to the class passed in this parameter.
Returns:List of children objects.
classmethod get_deep(full_data, working_data, parent=None, limit_to=(), subtree='full', config_only=False)

Gets all instances of this class from the APIC and gets all of the children as well.

Parameters:
  • full_data
  • working_data
  • parent
  • limit_to
  • subtree
  • config_only
classmethod get_deep_apic_classes(include_concrete=False)

Get all the apic classes needed for this acitoolkit class and all of its children. :return: list of all apic classes

get_dn_from_attributes(attributes)

Will get the dn from the attributes or construct it using the dn of the parent plus the rn. Failing those, it will return None

Parameters:attributes
Returns:String containing dn or None
classmethod get_event(session)

Gets the event that is pending for this class. Events are returned in the form of objects. Objects that have been deleted are marked as such.

Parameters:session – the instance of Session used for APIC communication
classmethod get_fault(session, extension='')

Gets the fault that is pending for this class. Faults are returned in the form of objects. Objects that have been deleted are marked as such.

Parameters:session – the instance of Session used for APIC communication
get_filters(deleted=False)

Get all of the filters that are attached to this ContractSubject.

Returns:List of Filter objects
static get_from_json(self, data, parent=None)

returns a Tenant object from a json

get_interfaces(status='attached')

Get all of the interface relations. Note that multiple classes are considered “interfaces” such as Interface, L2Interface, L3Interface, etc.

Parameters:status – Valid values are ‘attached’ and ‘detached’. Default is ‘attached’.
Returns:List of interfaces that this object has relations and the status matches.
get_json()

Returns json representation of the ContractSubject or TabooContractSubject

Returns:json dictionary of the ContractSubject or TabooContractSubject
get_parent()
Returns:Parent of this object.
get_searchable()

Method to recursively retrieve all of the searchable items from all the children objects, add the current object to them as additional context, append the local searchable terms, and return the result.

static get_table(aci_object, title='')

Abstract method that should be replaced by a version that is specific to the object

Parameters:
  • aci_object
  • title – String containing the table title
Returns:

list of Table objects

get_tags()

Get the tags assigned to this object.

Returns:List of tag instances
has_attachment(item)

Indicates whether this object is attached to the item/ :returns: True or False, True indicates the object is attached.

has_child(obj)

Check for existence of a child in the children list

Parameters:obj – Child object that is the subject of the check.
Returns:True or False, True indicates that it does indeed have the obj object as a child.
has_detachment(item)

Indicates whether the object is detached from this item. :returns: True or False, True indicates the object is detached.

classmethod has_events(session, extension='')

Check for pending events from the APIC that pertain to instances of this class.

Parameters:session – the instance of Session used for APIC communication
Returns:True or False. True if there are events pending.
has_parent()

returns True if this object has a parent

Returns:bool
has_tag(tag)

Checks whether this object has a particular tag assigned.

Parameters:tag – string containing the tag name or an instance of _Tag
Returns:True or False. True indicates the object has this tag assigned.
has_tags()

Checks whether this object has any tags assigned at all.

Returns:True or False. True indicates the object has at least one tag assigned.
info()

Node information summary.

Returns:Formatted string that has a summary of all of the info gathered about the node.
infoList()

Node information. Returns a list of (attr, value) tuples.

Returns:list of [(attr, value),]
is_attached(item)

Indicates whether the item is attached to this object/ :returns: True or False, True indicates the item is attached.

is_deleted()

Check if the object has been deleted.

Returns:True or False, True indicates the object has been deleted.
is_detached(item)

Indicates whether the item is detached from this object.

Returns:True or False, True indicates the item is detached.
static is_interface()

Indicates whether this object is considered an Interface. The default is False.

Returns:False
mark_as_deleted()

Mark the object as deleted. This will cause the JSON status to be set to deleted.

classmethod mask_class_from_graphs()

Mask (hide) this class from graph creation

Returns:False indicating that this class should not be masked.
populate_children(deep=False, include_concrete=False)

Populates all of the children and then calls populate_children of those children if deep is True. This method should be overridden by any object that does have children.

If include_concrete is True, then if the object has concrete objects below it, i.e. is a switch, then also populate those conrete object.

Parameters:
  • include_concrete – True or False. Default is False
  • deep – True or False. Default is False.
remove_child(obj)

Remove a child from the children list

Parameters:obj – Child object that is to be removed.
remove_tag(tag)

Remove a particular tag from being assigned to this object. Note that this does not delete the tag from the APIC.

Parameters:tag – string containing the tag to remove from this object or an instance of _Tag
set_parent(parent_obj)

Set the parent object

Parameters:parent_obj – Instance of the parent object
Returns:None
classmethod subscribe(session, extension='', only_new=False)

Subscribe to events from the APIC that pertain to instances of this class.

Parameters:
  • session – the instance of Session used for APIC communication
  • only_new – Boolean indicating whether to get all events or only the new events. All events (indicated by setting only_new to False) will queue a create event for all of the currently existing objects. Setting only_new to True will only queue events that occur after the initial subscribe. The default has only_new set to False.
subscribe_to_fault_instances_subtree(session, extension='', deep=False)

Subscribe to faults instances for the whole subtree.

Parameters:
  • session – the instance of Session used for APIC communication
  • extension – Optional string that can be used to extend the URL
  • only_new – Boolean indicating whether to get all events or only the new events. All events (indicated by setting only_new to False) will queue a create event for all of the currently existing objects. Setting only_new to True will only queue events that occur after the initial subscribe. The default has only_new set to False.
classmethod unsubscribe(session)

Unsubscribe for events from the APIC that pertain to instances of this class.

Parameters:session – the instance of Session used for APIC communication
update_db(session, subscribed_classes, deep=False)
Parameters:
  • session – Session class instance representing the connection to the APIC
  • subscribed_classes – List of subscribed classes
  • deep – Boolean indicating whether to go deep or not. Default is False
Returns:

List of subscribed classes

class acitoolkit.acitoolkit.EPG(epg_name, parent=None)

Bases: acitoolkit.acitoolkit.CommonEPG

EPG : roughly equivalent to fvAEPg

Initializes the EPG with a name and, optionally, an AppProfile parent. If the parent is specified and is not an AppProfile, an error will occur.

Parameters:
  • epg_name – String containing the name of the EPG.
  • parent – Instance of the AppProfile class representing the Application Profile where this EPG is contained.
add_bd(bridgedomain)

Add BridgeDomain to the EPG, roughly equivalent to fvRsBd

Parameters:bridgedomain – Instance of BridgeDomain class. Represents the BridgeDomain that this EPG will be assigned. An EPG can only be assigned to a single BridgeDomain.
add_child(obj)

Add a child to the children list.

Parameters:obj – Child object to add to the children list of the called object.
add_infradomain(infradomain)

Add Infrastructure Domain to the EPG

Parameters:infradomain – Instance of InfraDomain class.
add_static_leaf_binding(leaf_id, encap_type, encap_id, encap_mode='regular', immediacy='lazy', pod=1)

Adds a static leaf binding to this EPG.

Parameters:
  • leaf_id – Integer containing the node ID (e.g. 101)
  • encap_type – String containing the encapsulation type. Valid values are ‘vlan’, ‘vxlan’, or ‘nvgre’.
  • encap_id – String containing the encapsulation specific identifier representing the virtual L2 network (i.e. for VXLAN, this is the numeric value of the VNID).
  • encap_mode – String containing the encapsulation mode. Use

“regular” for normal dot1q tagged traffic, “untagged” for traffic reaching the leaf without any dot1q tags, and “native” for traffic tagged with a 802.1P tag.

Parameters:
  • immediacy – String containing either “immediate” or “lazy”
  • pod – Integer containing the ACI Pod where the supplied leaf is located.
add_tag(tag)

Assign this object a particular tag. Tags are strings that can be used to classify objects. More than 1 tag can be assigned to an object.

Parameters:tag – string containing the tag to assign to this object or an instance of _Tag
attach(item)

Attach the object to the other object.

Parameters:item – Object to be attached.
static check_session(session)

This will check that the session is of type Session and raise exception if it not

Parameters:session – the session to check
Returns:
consume(contract)

Make this EPG consume a Contract

Parameters:contract – Contract class instance to be consumed by this EPG.
Returns:True
consume_cif(contract_interface)

Make this EPG consume a ContractInterface

Parameters:contract_interface – ContractInterface class instance to be consumed by this EPG.
Returns:True
delete_tag(tag)

Mark a particular tag as being deleted from this object.

Parameters:tag – string containing the tag to delete from this object or an instance of _Tag
detach(item)

Detach the object from the other object. A relationship is either ‘attached’, ‘detached’, or does not exist. A detached relationship will cause the relationship to be deleted when pushed to the APIC.

Parameters:item – Object to be detached.
does_consume(contract)

Check if this EPG consumes a specific Contract

Parameters:contract – Instance of Contract class to check if it is consumed by this EPG.
Returns:True or False. True if the EPG does consume the Contract.
does_consume_cif(contract_interface)

Check if this EPG consumes a specific Contract

Parameters:contract_interface
Returns:True or False. True if the EPG does consume the ContractInterface.
does_protect(taboo)

Check if this EPG is protected by a specific Taboo.

Parameters:taboo – Instance of Taboo class to check if it protects this EPG.
Returns:True or False. True if the EPG is protected by the Taboo.
does_provide(contract)

Check if this EPG provides a specific Contract.

Parameters:contract – Instance of Contract class to check if it is provided by this EPG.
Returns:True or False. True if the EPG does provide the Contract.
dont_consume(contract)

Make this EPG not consume a Contract. It does not check to see if the Contract was already consumed

Parameters:contract – Instance of Contract class to be no longer consumed by this EPG.
Returns:True
dont_consume_cif(contract_interface)

Make this EPG not consume a ContractInterface. It does not check to see if the ContractInterface was already consumed

Parameters:contract_interface
Returns:True
dont_protect(taboo)

Make this EPG not protected by a Taboo

Parameters:taboo – Instance of Taboo class to no longer protect this EPG.
Returns:True
dont_provide(contract)

Make this EPG not provide a Contract

Parameters:contract – Instance of Contract class to be no longer provided by this EPG.
Returns:True
find(search_object)

This will check to see if self is a match with search_object and then call find on all of the children of search. If there is a match, a list containing self and any matches found by the children will be returned as a list.

The criteria for a match is that all attributes of self are compared to all attributes of search_object. If search_object.<attr> exists and is the same as self.<attr> or search_object.<attr> is ‘None’, then that attribute matches. If all such attributes match, then there is a match and self will be returned in the result.

If there is an attribute of search_object that does not exist in self, it will be considered a mismatch. If there is an attribute of self that does not exist in search_object, it will be ignored.

Parameters:search_object – ACI object to search
Returns:List of objects
classmethod get(session, parent=None, tenant=None)

Gets all of the EPGs from the APIC.

Parameters:
  • session – the instance of Session used for APIC communication
  • parent – Instance of the AppProfile class used to limit the EPGs retreived from the APIC.
  • tenant – Instance of Tenant class used to limit the EPGs retreived from the APIC.
Returns:

List of CommonEPG instances (or EPG instances if called from EPG class)

get_all_attached(attached_class, status='attached', relation_type=None)

Get all of the relations of objects belonging to the specified class with the specified status.

Parameters:
  • attached_class – The class that is the subject of the search.
  • status – Valid values are ‘attached’ and ‘detached’. Default is ‘attached’.
get_all_attachments(attached_class, status='attached', relation_type=None)

Get all of the attachments to an object belonging to the specified class with the specified status.

Parameters:
  • attached_class – The class that is the subject of the search.
  • status – Valid values are ‘attached’ and ‘detached’. Default is ‘attached’.
get_all_consumed(deleted=False, include_any_epg=False)

Get all of the Contracts consumed by this EPG

Parameters:
  • deleted – Boolean indicating whether to get Contracts that are consumed or that the consumed was marked as deleted
  • include_any_epg – Boolean indicating whether to include Contracts that are consumed due to inheritance from an AnyEPG within the same Context that this EPG is in.
Returns:

List of Contract objects that are consumed by the EPG.

get_all_consumed_cif(deleted=False)

Get all of the ContractInterfaces consumed by this EPG

Parameters:deleted – Boolean indicating whether to get ContractInterfaces that are consumed or that the consumed was marked as deleted
Returns:List of ContractInterface objects that are consumed by the EPG.
get_all_protected(deleted=False)

Get all of the Taboos protecting this EPG

Parameters:deleted – Boolean indicating whether to get Taboos that are protected or that the protected was marked as deleted
Returns:List of Taboo objects that are protecting the EPG.
get_all_provided(deleted=False, include_any_epg=False)

Get all of the Contracts provided by this EPG

Parameters:
  • deleted – Boolean indicating whether to get Contracts that are provided or that the provided was marked as deleted
  • include_any_epg – Boolean indicating whether to include Contracts that are provided due to inheritance from an AnyEPG within the same Context that this EPG is in.
Returns:

List of Contract objects that are provided by the EPG.

get_attributes(name=None)

Will return the value of the named attribute in a dictionary format. If no name is given, then it will return all attributes.

Note that attributes that start with _ (underbar) will NOT be included unless explicitly named

This method should be over-written as appropriate by inheriting objects to handle how their local attributes are implemented.

This is intended to normalize how all attributes on all objects can be accessed since the implementations were not consistent.

Parameters:name – optional name of attribute to return
Returns:dictionary of attributes and their values
get_bd()

Return the assigned BridgeDomain. There should only be one item in the returned list.

Returns:List of BridgeDomain objects
get_child(child_type, child_name)

Gets a specific immediate child of this object

Parameters:
  • child_type – Class of the child to return
  • child_name – Name of the child to return
Returns:

The specific instance of child_type or None if not found

get_children(only_class=None)

Get a list of the immediate child objects of this object.

Parameters:only_class – Optional parameter that will be used to limit the objects returned to only those belonging to the class passed in this parameter.
Returns:List of children objects.
classmethod get_deep(full_data, working_data, parent=None, limit_to=(), subtree='full', config_only=False)

Gets all instances of this class from the APIC and gets all of the children as well.

Parameters:
  • full_data
  • working_data
  • parent
  • limit_to
  • subtree
  • config_only
classmethod get_deep_apic_classes(include_concrete=False)

Get all the apic classes needed for this acitoolkit class and all of its children. :return: list of all apic classes

get_dn_from_attributes(attributes)

Will get the dn from the attributes or construct it using the dn of the parent plus the rn. Failing those, it will return None

Parameters:attributes
Returns:String containing dn or None
classmethod get_event(session)

Gets the event that is pending for this class. Events are returned in the form of objects. Objects that have been deleted are marked as such.

Parameters:session – the instance of Session used for APIC communication
classmethod get_fault(session, extension='')

Gets the fault that is pending for this class. Faults are returned in the form of objects. Objects that have been deleted are marked as such.

Parameters:session – the instance of Session used for APIC communication
static get_from_json(self, data, parent=None)

returns a Tenant object from a json

get_interfaces(status='attached')

Get all of the interfaces that this EPG is attached. The default is to get list of ‘attached’ interfaces. If ‘status’ is set to ‘detached’ it will return the list of detached Interface objects (Those EPGs which are no longer attached to an Interface, but the configuration is not yet pushed to the APIC.)

Parameters:status – ‘attached’ or ‘detached’. Defaults to ‘attached’.
Returns:List of Interface objects
get_json()

Returns json representation of the EPG

Returns:json dictionary of the EPG
get_parent()
Returns:Parent of this object.
get_searchable()

Method to recursively retrieve all of the searchable items from all the children objects, add the current object to them as additional context, append the local searchable terms, and return the result.

static get_table(epgs, title='')

Will create table of EPG information for a given tenant

Parameters:
  • epgs
  • title
get_tags()

Get the tags assigned to this object.

Returns:List of tag instances
has_attachment(item)

Indicates whether this object is attached to the item/ :returns: True or False, True indicates the object is attached.

has_bd()

Check if a BridgeDomain has been assigned to the EPG

Returns:True or False. True if the EPG has been assigned a BridgeDomain.
has_child(obj)

Check for existence of a child in the children list

Parameters:obj – Child object that is the subject of the check.
Returns:True or False, True indicates that it does indeed have the obj object as a child.
has_detachment(item)

Indicates whether the object is detached from this item. :returns: True or False, True indicates the object is detached.

classmethod has_events(session, extension='')

Check for pending events from the APIC that pertain to instances of this class.

Parameters:session – the instance of Session used for APIC communication
Returns:True or False. True if there are events pending.
has_parent()

returns True if this object has a parent

Returns:bool
has_tag(tag)

Checks whether this object has a particular tag assigned.

Parameters:tag – string containing the tag name or an instance of _Tag
Returns:True or False. True indicates the object has this tag assigned.
has_tags()

Checks whether this object has any tags assigned at all.

Returns:True or False. True indicates the object has at least one tag assigned.
info()

Node information summary.

Returns:Formatted string that has a summary of all of the info gathered about the node.
infoList()

Node information. Returns a list of (attr, value) tuples.

Returns:list of [(attr, value),]
is_attached(item)

Indicates whether the item is attached to this object/ :returns: True or False, True indicates the item is attached.

is_attributed_based

Get whether the EPG is attribute based :return: True if attribute based. False otherwise.

is_deleted()

Check if the object has been deleted.

Returns:True or False, True indicates the object has been deleted.
is_detached(item)

Indicates whether the item is detached from this object.

Returns:True or False, True indicates the item is detached.
static is_interface()

Indicates whether this object is considered an Interface. The default is False.

Returns:False
mark_as_deleted()

Mark the object as deleted. This will cause the JSON status to be set to deleted.

classmethod mask_class_from_graphs()

Mask (hide) this class from graph creation

Returns:False indicating that this class should not be masked.
populate_children(deep=False, include_concrete=False)

Populates all of the children and then calls populate_children of those children if deep is True. This method should be overridden by any object that does have children.

If include_concrete is True, then if the object has concrete objects below it, i.e. is a switch, then also populate those conrete object.

Parameters:
  • include_concrete – True or False. Default is False
  • deep – True or False. Default is False.
protect(taboo)

Make this EPG protected by a Taboo

Parameters:taboo – Instance of Taboo class to protect this EPG.
Returns:True
provide(contract)

Make this EPG provide a Contract

Parameters:contract – Instance of Contract class to be provided by this EPG.
Returns:True
remove_bd()

Remove BridgeDomain from the EPG. Note that there should only be one BridgeDomain attached to the EPG.

remove_child(obj)

Remove a child from the children list

Parameters:obj – Child object that is to be removed.
remove_tag(tag)

Remove a particular tag from being assigned to this object. Note that this does not delete the tag from the APIC.

Parameters:tag – string containing the tag to remove from this object or an instance of _Tag
set_base_epg(epg)

Sets the Base EPG. Used by Attribute-based EPGs to indicate that the BridgeDomain, NodeAttach, and PathAttach relations should be copied from the base EPG when generating JSON.

Parameters:epg – EPG class instance of the Base EPG
Returns:None
set_deployment_immediacy(immediacy)

Set the deployment immediacy of the EPG

Parameters:immediacy – String containing either “immediate” or “lazy”
set_dom_deployment_immediacy(immediacy)

Set the deployment immediacy for PhysDomain of the EPG

Parameters:immediacy – String containing either “immediate” or “lazy”
set_dom_resolution_immediacy(immediacy)

Set the resolution immediacy for PhysDomain of the EPG

Parameters:immediacy – String containing either “immediate” or “lazy”
set_intra_epg_isolation(isolation)

Set the intra-EPG isolation of the EPG

Parameters:isolation – String containing either “unenforced” or “enforced”
set_parent(parent_obj)

Set the parent object

Parameters:parent_obj – Instance of the parent object
Returns:None
classmethod subscribe(session, extension='', only_new=False)

Subscribe to events from the APIC that pertain to instances of this class.

Parameters:
  • session – the instance of Session used for APIC communication
  • only_new – Boolean indicating whether to get all events or only the new events. All events (indicated by setting only_new to False) will queue a create event for all of the currently existing objects. Setting only_new to True will only queue events that occur after the initial subscribe. The default has only_new set to False.
subscribe_to_fault_instances_subtree(session, extension='', deep=False)

Subscribe to faults instances for the whole subtree.

Parameters:
  • session – the instance of Session used for APIC communication
  • extension – Optional string that can be used to extend the URL
  • only_new – Boolean indicating whether to get all events or only the new events. All events (indicated by setting only_new to False) will queue a create event for all of the currently existing objects. Setting only_new to True will only queue events that occur after the initial subscribe. The default has only_new set to False.
classmethod unsubscribe(session)

Unsubscribe for events from the APIC that pertain to instances of this class.

Parameters:session – the instance of Session used for APIC communication
update_db(session, subscribed_classes, deep=False)
Parameters:
  • session – Session class instance representing the connection to the APIC
  • subscribed_classes – List of subscribed classes
  • deep – Boolean indicating whether to go deep or not. Default is False
Returns:

List of subscribed classes

class acitoolkit.acitoolkit.EPGDomain(name, parent)

Bases: acitoolkit.acibaseobject.BaseACIObject

EPGDomain class

Parameters:
  • name – String containing the name of a source relation to an infrastructure domain profile associated with application endpoint groups. The domain profile can be either a VMM domain profile or a physical domain profile.
  • parent – An instance of EPG class representing the EPG which contains this Domain Profile.
add_child(obj)

Add a child to the children list.

Parameters:obj – Child object to add to the children list of the called object.
add_tag(tag)

Assign this object a particular tag. Tags are strings that can be used to classify objects. More than 1 tag can be assigned to an object.

Parameters:tag – string containing the tag to assign to this object or an instance of _Tag
attach(item)

Attach the object to the other object.

Parameters:item – Object to be attached.
static check_session(session)

This will check that the session is of type Session and raise exception if it not

Parameters:session – the session to check
Returns:
delete_tag(tag)

Mark a particular tag as being deleted from this object.

Parameters:tag – string containing the tag to delete from this object or an instance of _Tag
detach(item)

Detach the object from the other object. A relationship is either ‘attached’, ‘detached’, or does not exist. A detached relationship will cause the relationship to be deleted when pushed to the APIC.

Parameters:item – Object to be detached.
find(search_object)

This will check to see if self is a match with search_object and then call find on all of the children of search. If there is a match, a list containing self and any matches found by the children will be returned as a list.

The criteria for a match is that all attributes of self are compared to all attributes of search_object. If search_object.<attr> exists and is the same as self.<attr> or search_object.<attr> is ‘None’, then that attribute matches. If all such attributes match, then there is a match and self will be returned in the result.

If there is an attribute of search_object that does not exist in self, it will be considered a mismatch. If there is an attribute of self that does not exist in search_object, it will be ignored.

Parameters:search_object – ACI object to search
Returns:List of objects
classmethod get(session)

Gets all of the Physical Domains from the APIC

Parameters:session – the instance of Session used for APIC communication
Returns:List of Switch Profile objects
get_all_attached(attached_class, status='attached', relation_type=None)

Get all of the relations of objects belonging to the specified class with the specified status.

Parameters:
  • attached_class – The class that is the subject of the search.
  • status – Valid values are ‘attached’ and ‘detached’. Default is ‘attached’.
get_all_attachments(attached_class, status='attached', relation_type=None)

Get all of the attachments to an object belonging to the specified class with the specified status.

Parameters:
  • attached_class – The class that is the subject of the search.
  • status – Valid values are ‘attached’ and ‘detached’. Default is ‘attached’.
get_attributes(name=None)

Will return the value of the named attribute in a dictionary format. If no name is given, then it will return all attributes.

Note that attributes that start with _ (underbar) will NOT be included unless explicitly named

This method should be over-written as appropriate by inheriting objects to handle how their local attributes are implemented.

This is intended to normalize how all attributes on all objects can be accessed since the implementations were not consistent.

Parameters:name – optional name of attribute to return
Returns:dictionary of attributes and their values
classmethod get_by_name(session, infra_name)

Gets all of the Physical Domains from the APIC

Parameters:
  • infra_name
  • session – the instance of Session used for APIC communication
Returns:

List of Switch Profile objects

get_child(child_type, child_name)

Gets a specific immediate child of this object

Parameters:
  • child_type – Class of the child to return
  • child_name – Name of the child to return
Returns:

The specific instance of child_type or None if not found

get_children(only_class=None)

Get a list of the immediate child objects of this object.

Parameters:only_class – Optional parameter that will be used to limit the objects returned to only those belonging to the class passed in this parameter.
Returns:List of children objects.
classmethod get_deep(full_data, working_data, parent=None, limit_to=(), subtree='full', config_only=False)

Gets all instances of this class from the APIC and gets all of the children as well.

Parameters:
  • full_data
  • working_data
  • parent
  • limit_to
  • subtree
  • config_only
classmethod get_deep_apic_classes(include_concrete=False)

Get all the apic classes needed for this acitoolkit class and all of its children. :return: list of all apic classes

get_dn_from_attributes(attributes)

Will get the dn from the attributes or construct it using the dn of the parent plus the rn. Failing those, it will return None

Parameters:attributes
Returns:String containing dn or None
classmethod get_event(session)

Gets the event that is pending for this class. Events are returned in the form of objects. Objects that have been deleted are marked as such.

Parameters:session – the instance of Session used for APIC communication
classmethod get_fault(session, extension='')

Gets the fault that is pending for this class. Faults are returned in the form of objects. Objects that have been deleted are marked as such.

Parameters:session – the instance of Session used for APIC communication
get_from_json(data, parent=None)

returns a Tenant object from a json

get_interfaces(status='attached')

Get all of the interface relations. Note that multiple classes are considered “interfaces” such as Interface, L2Interface, L3Interface, etc.

Parameters:status – Valid values are ‘attached’ and ‘detached’. Default is ‘attached’.
Returns:List of interfaces that this object has relations and the status matches.
get_json()

Returns json representation of the fvTenant object

Returns:A json dictionary of fvTenant
get_parent()
Returns:Parent of this object.
get_searchable()

Method to recursively retrieve all of the searchable items from all the children objects, add the current object to them as additional context, append the local searchable terms, and return the result.

static get_table(aci_object, title='')

Abstract method that should be replaced by a version that is specific to the object

Parameters:
  • aci_object
  • title – String containing the table title
Returns:

list of Table objects

get_tags()

Get the tags assigned to this object.

Returns:List of tag instances
has_attachment(item)

Indicates whether this object is attached to the item/ :returns: True or False, True indicates the object is attached.

has_child(obj)

Check for existence of a child in the children list

Parameters:obj – Child object that is the subject of the check.
Returns:True or False, True indicates that it does indeed have the obj object as a child.
has_detachment(item)

Indicates whether the object is detached from this item. :returns: True or False, True indicates the object is detached.

classmethod has_events(session, extension='')

Check for pending events from the APIC that pertain to instances of this class.

Parameters:session – the instance of Session used for APIC communication
Returns:True or False. True if there are events pending.
has_parent()

returns True if this object has a parent

Returns:bool
has_tag(tag)

Checks whether this object has a particular tag assigned.

Parameters:tag – string containing the tag name or an instance of _Tag
Returns:True or False. True indicates the object has this tag assigned.
has_tags()

Checks whether this object has any tags assigned at all.

Returns:True or False. True indicates the object has at least one tag assigned.
info()

Node information summary.

Returns:Formatted string that has a summary of all of the info gathered about the node.
infoList()

Node information. Returns a list of (attr, value) tuples.

Returns:list of [(attr, value),]
is_attached(item)

Indicates whether the item is attached to this object/ :returns: True or False, True indicates the item is attached.

is_deleted()

Check if the object has been deleted.

Returns:True or False, True indicates the object has been deleted.
is_detached(item)

Indicates whether the item is detached from this object.

Returns:True or False, True indicates the item is detached.
static is_interface()

Indicates whether this object is considered an Interface. The default is False.

Returns:False
mark_as_deleted()

Mark the object as deleted. This will cause the JSON status to be set to deleted.

classmethod mask_class_from_graphs()

Mask (hide) this class from graph creation

Returns:False indicating that this class should not be masked.
populate_children(deep=False, include_concrete=False)

Populates all of the children and then calls populate_children of those children if deep is True. This method should be overridden by any object that does have children.

If include_concrete is True, then if the object has concrete objects below it, i.e. is a switch, then also populate those conrete object.

Parameters:
  • include_concrete – True or False. Default is False
  • deep – True or False. Default is False.
remove_child(obj)

Remove a child from the children list

Parameters:obj – Child object that is to be removed.
remove_tag(tag)

Remove a particular tag from being assigned to this object. Note that this does not delete the tag from the APIC.

Parameters:tag – string containing the tag to remove from this object or an instance of _Tag
set_parent(parent_obj)

Set the parent object

Parameters:parent_obj – Instance of the parent object
Returns:None
classmethod subscribe(session, extension='', only_new=False)

Subscribe to events from the APIC that pertain to instances of this class.

Parameters:
  • session – the instance of Session used for APIC communication
  • only_new – Boolean indicating whether to get all events or only the new events. All events (indicated by setting only_new to False) will queue a create event for all of the currently existing objects. Setting only_new to True will only queue events that occur after the initial subscribe. The default has only_new set to False.
subscribe_to_fault_instances_subtree(session, extension='', deep=False)

Subscribe to faults instances for the whole subtree.

Parameters:
  • session – the instance of Session used for APIC communication
  • extension – Optional string that can be used to extend the URL
  • only_new – Boolean indicating whether to get all events or only the new events. All events (indicated by setting only_new to False) will queue a create event for all of the currently existing objects. Setting only_new to True will only queue events that occur after the initial subscribe. The default has only_new set to False.
classmethod unsubscribe(session)

Unsubscribe for events from the APIC that pertain to instances of this class.

Parameters:session – the instance of Session used for APIC communication
update_db(session, subscribed_classes, deep=False)
Parameters:
  • session – Session class instance representing the connection to the APIC
  • subscribed_classes – List of subscribed classes
  • deep – Boolean indicating whether to go deep or not. Default is False
Returns:

List of subscribed classes

class acitoolkit.acitoolkit.Endpoint(name, parent)

Bases: acitoolkit.acibaseobject.BaseACIObject

Endpoint class

add_child(obj)

Add a child to the children list.

Parameters:obj – Child object to add to the children list of the called object.
add_tag(tag)

Assign this object a particular tag. Tags are strings that can be used to classify objects. More than 1 tag can be assigned to an object.

Parameters:tag – string containing the tag to assign to this object or an instance of _Tag
attach(item)

Attach the object to the other object.

Parameters:item – Object to be attached.
static check_session(session)

This will check that the session is of type Session and raise exception if it not

Parameters:session – the session to check
Returns:
delete_tag(tag)

Mark a particular tag as being deleted from this object.

Parameters:tag – string containing the tag to delete from this object or an instance of _Tag
detach(item)

Detach the object from the other object. A relationship is either ‘attached’, ‘detached’, or does not exist. A detached relationship will cause the relationship to be deleted when pushed to the APIC.

Parameters:item – Object to be detached.
find(search_object)

This will check to see if self is a match with search_object and then call find on all of the children of search. If there is a match, a list containing self and any matches found by the children will be returned as a list.

The criteria for a match is that all attributes of self are compared to all attributes of search_object. If search_object.<attr> exists and is the same as self.<attr> or search_object.<attr> is ‘None’, then that attribute matches. If all such attributes match, then there is a match and self will be returned in the result.

If there is an attribute of search_object that does not exist in self, it will be considered a mismatch. If there is an attribute of self that does not exist in search_object, it will be ignored.

Parameters:search_object – ACI object to search
Returns:List of objects
static get(session, endpoint_name=None)

Gets all of the endpoints connected to the fabric from the APIC

Parameters:
  • endpoint_name
  • session – Session instance used to communicate with the APIC. Assumed to be logged in
get_all_attached(attached_class, status='attached', relation_type=None)

Get all of the relations of objects belonging to the specified class with the specified status.

Parameters:
  • attached_class – The class that is the subject of the search.
  • status – Valid values are ‘attached’ and ‘detached’. Default is ‘attached’.
get_all_attachments(attached_class, status='attached', relation_type=None)

Get all of the attachments to an object belonging to the specified class with the specified status.

Parameters:
  • attached_class – The class that is the subject of the search.
  • status – Valid values are ‘attached’ and ‘detached’. Default is ‘attached’.
classmethod get_all_by_epg(session, tenant_name, app_name, epg_name, with_interface_attachments=True)

Get all of the Endpoints for a specified EPG

Parameters:
  • session – Session instance used to communicate with the APIC. Assumed to be logged in
  • tenant_name – String containing the tenant name
  • app_name – String containing the app name
  • epg_name – String containing the epg name
  • with_interface_attachments – Boolean indicating whether interfaces should be attached or not. True is default.
Returns:

List of Endpoint instances

get_attributes(name=None)

Will return the value of the named attribute in a dictionary format. If no name is given, then it will return all attributes.

Note that attributes that start with _ (underbar) will NOT be included unless explicitly named

This method should be over-written as appropriate by inheriting objects to handle how their local attributes are implemented.

This is intended to normalize how all attributes on all objects can be accessed since the implementations were not consistent.

Parameters:name – optional name of attribute to return
Returns:dictionary of attributes and their values
get_child(child_type, child_name)

Gets a specific immediate child of this object

Parameters:
  • child_type – Class of the child to return
  • child_name – Name of the child to return
Returns:

The specific instance of child_type or None if not found

get_children(only_class=None)

Get a list of the immediate child objects of this object.

Parameters:only_class – Optional parameter that will be used to limit the objects returned to only those belonging to the class passed in this parameter.
Returns:List of children objects.
classmethod get_deep(full_data, working_data, parent=None, limit_to=(), subtree='full', config_only=False)

Gets all instances of this class from the APIC and gets all of the children as well.

Parameters:
  • full_data
  • working_data
  • parent
  • limit_to
  • subtree
  • config_only
classmethod get_deep_apic_classes(include_concrete=False)

Get all the apic classes needed for this acitoolkit class and all of its children. :return: list of all apic classes

get_dn_from_attributes(attributes)

Will get the dn from the attributes or construct it using the dn of the parent plus the rn. Failing those, it will return None

Parameters:attributes
Returns:String containing dn or None
classmethod get_event(session, with_relations=True)

Gets the event that is pending for this class. Events are returned in the form of objects. Objects that have been deleted are marked as such.

Parameters:session – the instance of Session used for APIC communication
classmethod get_fault(session, extension='')

Gets the fault that is pending for this class. Faults are returned in the form of objects. Objects that have been deleted are marked as such.

Parameters:session – the instance of Session used for APIC communication
get_from_json(data, parent=None)

returns a Tenant object from a json

get_interfaces(status='attached')

Get all of the interface relations. Note that multiple classes are considered “interfaces” such as Interface, L2Interface, L3Interface, etc.

Parameters:status – Valid values are ‘attached’ and ‘detached’. Default is ‘attached’.
Returns:List of interfaces that this object has relations and the status matches.
get_json()

Get the JSON representation of this class in the actual APIC Object Model.

Parameters:
  • obj_class – Object Class Name within the APIC model.
  • attributes – Additional attributes that should be set in the JSON.
  • children – Children objects to traverse as well.
  • get_children – Indicates whether the children objects should be included.
Returns:

JSON dictionary to be pushed to the APIC.

get_parent()
Returns:Parent of this object.
get_searchable()

Method to recursively retrieve all of the searchable items from all the children objects, add the current object to them as additional context, append the local searchable terms, and return the result.

static get_table(endpoints, title='')

Will create table of taboo information for a given tenant

Parameters:
  • title
  • endpoints
get_tags()

Get the tags assigned to this object.

Returns:List of tag instances
has_attachment(item)

Indicates whether this object is attached to the item/ :returns: True or False, True indicates the object is attached.

has_child(obj)

Check for existence of a child in the children list

Parameters:obj – Child object that is the subject of the check.
Returns:True or False, True indicates that it does indeed have the obj object as a child.
has_detachment(item)

Indicates whether the object is detached from this item. :returns: True or False, True indicates the object is detached.

classmethod has_events(session, extension='')

Check for pending events from the APIC that pertain to instances of this class.

Parameters:session – the instance of Session used for APIC communication
Returns:True or False. True if there are events pending.
has_parent()

returns True if this object has a parent

Returns:bool
has_tag(tag)

Checks whether this object has a particular tag assigned.

Parameters:tag – string containing the tag name or an instance of _Tag
Returns:True or False. True indicates the object has this tag assigned.
has_tags()

Checks whether this object has any tags assigned at all.

Returns:True or False. True indicates the object has at least one tag assigned.
info()

Node information summary.

Returns:Formatted string that has a summary of all of the info gathered about the node.
infoList()

Node information. Returns a list of (attr, value) tuples.

Returns:list of [(attr, value),]
is_attached(item)

Indicates whether the item is attached to this object/ :returns: True or False, True indicates the item is attached.

is_deleted()

Check if the object has been deleted.

Returns:True or False, True indicates the object has been deleted.
is_detached(item)

Indicates whether the item is detached from this object.

Returns:True or False, True indicates the item is detached.
static is_interface()

Indicates whether this object is considered an Interface. The default is False.

Returns:False
mark_as_deleted()

Mark the object as deleted. This will cause the JSON status to be set to deleted.

classmethod mask_class_from_graphs()

Mask (hide) this class from graph creation

Returns:False indicating that this class should not be masked.
populate_children(deep=False, include_concrete=False)

Populates all of the children and then calls populate_children of those children if deep is True. This method should be overridden by any object that does have children.

If include_concrete is True, then if the object has concrete objects below it, i.e. is a switch, then also populate those conrete object.

Parameters:
  • include_concrete – True or False. Default is False
  • deep – True or False. Default is False.
remove_child(obj)

Remove a child from the children list

Parameters:obj – Child object that is to be removed.
remove_tag(tag)

Remove a particular tag from being assigned to this object. Note that this does not delete the tag from the APIC.

Parameters:tag – string containing the tag to remove from this object or an instance of _Tag
set_parent(parent_obj)

Set the parent object

Parameters:parent_obj – Instance of the parent object
Returns:None
classmethod subscribe(session, extension='', only_new=False)

Subscribe to events from the APIC that pertain to instances of this class.

Parameters:
  • session – the instance of Session used for APIC communication
  • only_new – Boolean indicating whether to get all events or only the new events. All events (indicated by setting only_new to False) will queue a create event for all of the currently existing objects. Setting only_new to True will only queue events that occur after the initial subscribe. The default has only_new set to False.
subscribe_to_fault_instances_subtree(session, extension='', deep=False)

Subscribe to faults instances for the whole subtree.

Parameters:
  • session – the instance of Session used for APIC communication
  • extension – Optional string that can be used to extend the URL
  • only_new – Boolean indicating whether to get all events or only the new events. All events (indicated by setting only_new to False) will queue a create event for all of the currently existing objects. Setting only_new to True will only queue events that occur after the initial subscribe. The default has only_new set to False.
classmethod unsubscribe(session)

Unsubscribe for events from the APIC that pertain to instances of this class.

Parameters:session – the instance of Session used for APIC communication
update_db(session, subscribed_classes, deep=False)
Parameters:
  • session – Session class instance representing the connection to the APIC
  • subscribed_classes – List of subscribed classes
  • deep – Boolean indicating whether to go deep or not. Default is False
Returns:

List of subscribed classes

class acitoolkit.acitoolkit.FexInterface(if_type, pod, node, fex, module, port)

Bases: acitoolkit.acibaseobject.BaseACIObject

This class describes a physical interface on a FEX device

add_child(obj)

Add a child to the children list.

Parameters:obj – Child object to add to the children list of the called object.
add_tag(tag)

Assign this object a particular tag. Tags are strings that can be used to classify objects. More than 1 tag can be assigned to an object.

Parameters:tag – string containing the tag to assign to this object or an instance of _Tag
attach(item)

Attach the object to the other object.

Parameters:item – Object to be attached.
static check_session(session)

This will check that the session is of type Session and raise exception if it not

Parameters:session – the session to check
Returns:
delete_tag(tag)

Mark a particular tag as being deleted from this object.

Parameters:tag – string containing the tag to delete from this object or an instance of _Tag
detach(item)

Detach the object from the other object. A relationship is either ‘attached’, ‘detached’, or does not exist. A detached relationship will cause the relationship to be deleted when pushed to the APIC.

Parameters:item – Object to be detached.
find(search_object)

This will check to see if self is a match with search_object and then call find on all of the children of search. If there is a match, a list containing self and any matches found by the children will be returned as a list.

The criteria for a match is that all attributes of self are compared to all attributes of search_object. If search_object.<attr> exists and is the same as self.<attr> or search_object.<attr> is ‘None’, then that attribute matches. If all such attributes match, then there is a match and self will be returned in the result.

If there is an attribute of search_object that does not exist in self, it will be considered a mismatch. If there is an attribute of self that does not exist in search_object, it will be ignored.

Parameters:search_object – ACI object to search
Returns:List of objects
classmethod get(session, toolkit_class, apic_class, parent=None, tenant=None, query_target_type='subtree')

Generic classmethod to get all of a particular APIC class.

Parameters:
  • session – the instance of Session used for APIC communication
  • toolkit_class – acitoolkit class to return
  • apic_class – String containing class name from the APIC object model.
  • parent – Object to assign as the parent to the created objects.
  • tenant – Tenant object to assign the created objects.
  • query_target_type – type of the query either self,children,subtree
get_all_attached(attached_class, status='attached', relation_type=None)

Get all of the relations of objects belonging to the specified class with the specified status.

Parameters:
  • attached_class – The class that is the subject of the search.
  • status – Valid values are ‘attached’ and ‘detached’. Default is ‘attached’.
get_all_attachments(attached_class, status='attached', relation_type=None)

Get all of the attachments to an object belonging to the specified class with the specified status.

Parameters:
  • attached_class – The class that is the subject of the search.
  • status – Valid values are ‘attached’ and ‘detached’. Default is ‘attached’.
get_attributes(name=None)

Will return the value of the named attribute in a dictionary format. If no name is given, then it will return all attributes.

Note that attributes that start with _ (underbar) will NOT be included unless explicitly named

This method should be over-written as appropriate by inheriting objects to handle how their local attributes are implemented.

This is intended to normalize how all attributes on all objects can be accessed since the implementations were not consistent.

Parameters:name – optional name of attribute to return
Returns:dictionary of attributes and their values
get_child(child_type, child_name)

Gets a specific immediate child of this object

Parameters:
  • child_type – Class of the child to return
  • child_name – Name of the child to return
Returns:

The specific instance of child_type or None if not found

get_children(only_class=None)

Get a list of the immediate child objects of this object.

Parameters:only_class – Optional parameter that will be used to limit the objects returned to only those belonging to the class passed in this parameter.
Returns:List of children objects.
classmethod get_deep(full_data, working_data, parent=None, limit_to=(), subtree='full', config_only=False)

Gets all instances of this class from the APIC and gets all of the children as well.

Parameters:
  • full_data
  • working_data
  • parent
  • limit_to
  • subtree
  • config_only
classmethod get_deep_apic_classes(include_concrete=False)

Get all the apic classes needed for this acitoolkit class and all of its children. :return: list of all apic classes

get_dn_from_attributes(attributes)

Will get the dn from the attributes or construct it using the dn of the parent plus the rn. Failing those, it will return None

Parameters:attributes
Returns:String containing dn or None
classmethod get_event(session)

Gets the event that is pending for this class. Events are returned in the form of objects. Objects that have been deleted are marked as such.

Parameters:session – the instance of Session used for APIC communication
classmethod get_fault(session, extension='')

Gets the fault that is pending for this class. Faults are returned in the form of objects. Objects that have been deleted are marked as such.

Parameters:session – the instance of Session used for APIC communication
get_from_json(data, parent=None)

returns a Tenant object from a json

get_interfaces(status='attached')

Get all of the interface relations. Note that multiple classes are considered “interfaces” such as Interface, L2Interface, L3Interface, etc.

Parameters:status – Valid values are ‘attached’ and ‘detached’. Default is ‘attached’.
Returns:List of interfaces that this object has relations and the status matches.
get_json(obj_class, attributes=None, children=None, get_children=True)

Get the JSON representation of this class in the actual APIC Object Model.

Parameters:
  • obj_class – Object Class Name within the APIC model.
  • attributes – Additional attributes that should be set in the JSON.
  • children – Children objects to traverse as well.
  • get_children – Indicates whether the children objects should be included.
Returns:

JSON dictionary to be pushed to the APIC.

get_parent()
Returns:Parent of this object.
get_searchable()

Method to recursively retrieve all of the searchable items from all the children objects, add the current object to them as additional context, append the local searchable terms, and return the result.

static get_table(aci_object, title='')

Abstract method that should be replaced by a version that is specific to the object

Parameters:
  • aci_object
  • title – String containing the table title
Returns:

list of Table objects

get_tags()

Get the tags assigned to this object.

Returns:List of tag instances
has_attachment(item)

Indicates whether this object is attached to the item/ :returns: True or False, True indicates the object is attached.

has_child(obj)

Check for existence of a child in the children list

Parameters:obj – Child object that is the subject of the check.
Returns:True or False, True indicates that it does indeed have the obj object as a child.
has_detachment(item)

Indicates whether the object is detached from this item. :returns: True or False, True indicates the object is detached.

classmethod has_events(session, extension='')

Check for pending events from the APIC that pertain to instances of this class.

Parameters:session – the instance of Session used for APIC communication
Returns:True or False. True if there are events pending.
has_parent()

returns True if this object has a parent

Returns:bool
has_tag(tag)

Checks whether this object has a particular tag assigned.

Parameters:tag – string containing the tag name or an instance of _Tag
Returns:True or False. True indicates the object has this tag assigned.
has_tags()

Checks whether this object has any tags assigned at all.

Returns:True or False. True indicates the object has at least one tag assigned.
info()

Node information summary.

Returns:Formatted string that has a summary of all of the info gathered about the node.
infoList()

Node information. Returns a list of (attr, value) tuples.

Returns:list of [(attr, value),]
is_attached(item)

Indicates whether the item is attached to this object/ :returns: True or False, True indicates the item is attached.

is_deleted()

Check if the object has been deleted.

Returns:True or False, True indicates the object has been deleted.
is_detached(item)

Indicates whether the item is detached from this object.

Returns:True or False, True indicates the item is detached.
classmethod is_dn_a_fex_interface(dn)
static is_interface()

Indicates whether this object is considered an Interface. The default is False.

Returns:False
mark_as_deleted()

Mark the object as deleted. This will cause the JSON status to be set to deleted.

classmethod mask_class_from_graphs()

Mask (hide) this class from graph creation

Returns:False indicating that this class should not be masked.
classmethod parse_dn(dn)

Parse the pod, node, interface name from the dn :param dn: String containing the interface DN :return: Tuple consisting of if_type, pod, node, fex, module, port

populate_children(deep=False, include_concrete=False)

Populates all of the children and then calls populate_children of those children if deep is True. This method should be overridden by any object that does have children.

If include_concrete is True, then if the object has concrete objects below it, i.e. is a switch, then also populate those conrete object.

Parameters:
  • include_concrete – True or False. Default is False
  • deep – True or False. Default is False.
remove_child(obj)

Remove a child from the children list

Parameters:obj – Child object that is to be removed.
remove_tag(tag)

Remove a particular tag from being assigned to this object. Note that this does not delete the tag from the APIC.

Parameters:tag – string containing the tag to remove from this object or an instance of _Tag
set_parent(parent_obj)

Set the parent object

Parameters:parent_obj – Instance of the parent object
Returns:None
classmethod subscribe(session, extension='', only_new=False)

Subscribe to events from the APIC that pertain to instances of this class.

Parameters:
  • session – the instance of Session used for APIC communication
  • only_new – Boolean indicating whether to get all events or only the new events. All events (indicated by setting only_new to False) will queue a create event for all of the currently existing objects. Setting only_new to True will only queue events that occur after the initial subscribe. The default has only_new set to False.
subscribe_to_fault_instances_subtree(session, extension='', deep=False)

Subscribe to faults instances for the whole subtree.

Parameters:
  • session – the instance of Session used for APIC communication
  • extension – Optional string that can be used to extend the URL
  • only_new – Boolean indicating whether to get all events or only the new events. All events (indicated by setting only_new to False) will queue a create event for all of the currently existing objects. Setting only_new to True will only queue events that occur after the initial subscribe. The default has only_new set to False.
classmethod unsubscribe(session)

Unsubscribe for events from the APIC that pertain to instances of this class.

Parameters:session – the instance of Session used for APIC communication
update_db(session, subscribed_classes, deep=False)
Parameters:
  • session – Session class instance representing the connection to the APIC
  • subscribed_classes – List of subscribed classes
  • deep – Boolean indicating whether to go deep or not. Default is False
Returns:

List of subscribed classes

class acitoolkit.acitoolkit.Filter(filter_name, parent=None)

Bases: acitoolkit.acibaseobject.BaseACIObject

Filter : roughly equivalent to vzFilter

add_child(obj)

Add a child to the children list.

Parameters:obj – Child object to add to the children list of the called object.
add_tag(tag)

Assign this object a particular tag. Tags are strings that can be used to classify objects. More than 1 tag can be assigned to an object.

Parameters:tag – string containing the tag to assign to this object or an instance of _Tag
attach(item)

Attach the object to the other object.

Parameters:item – Object to be attached.
static check_session(session)

This will check that the session is of type Session and raise exception if it not

Parameters:session – the session to check
Returns:
delete_tag(tag)

Mark a particular tag as being deleted from this object.

Parameters:tag – string containing the tag to delete from this object or an instance of _Tag
detach(item)

Detach the object from the other object. A relationship is either ‘attached’, ‘detached’, or does not exist. A detached relationship will cause the relationship to be deleted when pushed to the APIC.

Parameters:item – Object to be detached.
find(search_object)

This will check to see if self is a match with search_object and then call find on all of the children of search. If there is a match, a list containing self and any matches found by the children will be returned as a list.

The criteria for a match is that all attributes of self are compared to all attributes of search_object. If search_object.<attr> exists and is the same as self.<attr> or search_object.<attr> is ‘None’, then that attribute matches. If all such attributes match, then there is a match and self will be returned in the result.

If there is an attribute of search_object that does not exist in self, it will be considered a mismatch. If there is an attribute of self that does not exist in search_object, it will be ignored.

Parameters:search_object – ACI object to search
Returns:List of objects
classmethod get(session, tenant)

Gets all of the Filters for the current tenant from the APIC.

Parameters:
  • session – the instance of Session used for APIC communication
  • tenant – the instance of Tenant used to limit the Filters retreived from the APIC
Returns:

List of Filter objects

get_all_attached(attached_class, status='attached', relation_type=None)

Get all of the relations of objects belonging to the specified class with the specified status.

Parameters:
  • attached_class – The class that is the subject of the search.
  • status – Valid values are ‘attached’ and ‘detached’. Default is ‘attached’.
get_all_attachments(attached_class, status='attached', relation_type=None)

Get all of the attachments to an object belonging to the specified class with the specified status.

Parameters:
  • attached_class – The class that is the subject of the search.
  • status – Valid values are ‘attached’ and ‘detached’. Default is ‘attached’.
get_attributes(name=None)

Will return the value of the named attribute in a dictionary format. If no name is given, then it will return all attributes.

Note that attributes that start with _ (underbar) will NOT be included unless explicitly named

This method should be over-written as appropriate by inheriting objects to handle how their local attributes are implemented.

This is intended to normalize how all attributes on all objects can be accessed since the implementations were not consistent.

Parameters:name – optional name of attribute to return
Returns:dictionary of attributes and their values
classmethod get_by_name_and_tenant(session, tenant, filter_name)

Returns the Filter Object with name == filter_name and tenant == tenant

Parameters:
  • session – the instance of Session used for APIC communication
  • tenant – the instance of Tenant used to limit the search scope
  • filter_name – the searched Filter Object
Returns:

a single Filter Object

get_child(child_type, child_name)

Gets a specific immediate child of this object

Parameters:
  • child_type – Class of the child to return
  • child_name – Name of the child to return
Returns:

The specific instance of child_type or None if not found

get_children(only_class=None)

Get a list of the immediate child objects of this object.

Parameters:only_class – Optional parameter that will be used to limit the objects returned to only those belonging to the class passed in this parameter.
Returns:List of children objects.
classmethod get_deep(full_data, working_data, parent=None, limit_to=(), subtree='full', config_only=False)

Gets all instances of this class from the APIC and gets all of the children as well.

Parameters:
  • full_data
  • working_data
  • parent
  • limit_to
  • subtree
  • config_only
classmethod get_deep_apic_classes(include_concrete=False)

Get all the apic classes needed for this acitoolkit class and all of its children. :return: list of all apic classes

get_dn_from_attributes(attributes)

Will get the dn from the attributes or construct it using the dn of the parent plus the rn. Failing those, it will return None

Parameters:attributes
Returns:String containing dn or None
classmethod get_event(session)

Gets the event that is pending for this class. Events are returned in the form of objects. Objects that have been deleted are marked as such.

Parameters:session – the instance of Session used for APIC communication
classmethod get_fault(session, extension='')

Gets the fault that is pending for this class. Faults are returned in the form of objects. Objects that have been deleted are marked as such.

Parameters:session – the instance of Session used for APIC communication
static get_from_json(self, data, parent=None)

returns a Tenant object from a json

get_interfaces(status='attached')

Get all of the interface relations. Note that multiple classes are considered “interfaces” such as Interface, L2Interface, L3Interface, etc.

Parameters:status – Valid values are ‘attached’ and ‘detached’. Default is ‘attached’.
Returns:List of interfaces that this object has relations and the status matches.
get_json()

Returns json representation of the Filter

Returns:json dictionary of the Filter
get_parent()
Returns:Parent of this object.
get_searchable()

Method to recursively retrieve all of the searchable items from all the children objects, add the current object to them as additional context, append the local searchable terms, and return the result.

static get_table(aci_object, title='')

Abstract method that should be replaced by a version that is specific to the object

Parameters:
  • aci_object
  • title – String containing the table title
Returns:

list of Table objects

get_tags()

Get the tags assigned to this object.

Returns:List of tag instances
has_attachment(item)

Indicates whether this object is attached to the item/ :returns: True or False, True indicates the object is attached.

has_child(obj)

Check for existence of a child in the children list

Parameters:obj – Child object that is the subject of the check.
Returns:True or False, True indicates that it does indeed have the obj object as a child.
has_detachment(item)

Indicates whether the object is detached from this item. :returns: True or False, True indicates the object is detached.

has_entry(applyToFrag, arpOpc, dFromPort, dToPort, etherT, prot, sFromPort, sToPort, tcpRules, stateful, icmpv4T='not-given', icmpv6T='not-given')

Returns whether or not the Filter has a FilterEntry. All fields are compared except name.

Returns:True if the Filter has a matching FilterEntry. False otherwise
classmethod has_events(session, extension='')

Check for pending events from the APIC that pertain to instances of this class.

Parameters:session – the instance of Session used for APIC communication
Returns:True or False. True if there are events pending.
has_parent()

returns True if this object has a parent

Returns:bool
has_tag(tag)

Checks whether this object has a particular tag assigned.

Parameters:tag – string containing the tag name or an instance of _Tag
Returns:True or False. True indicates the object has this tag assigned.
has_tags()

Checks whether this object has any tags assigned at all.

Returns:True or False. True indicates the object has at least one tag assigned.
info()

Node information summary.

Returns:Formatted string that has a summary of all of the info gathered about the node.
infoList()

Node information. Returns a list of (attr, value) tuples.

Returns:list of [(attr, value),]
is_attached(item)

Indicates whether the item is attached to this object/ :returns: True or False, True indicates the item is attached.

is_deleted()

Check if the object has been deleted.

Returns:True or False, True indicates the object has been deleted.
is_detached(item)

Indicates whether the item is detached from this object.

Returns:True or False, True indicates the item is detached.
static is_interface()

Indicates whether this object is considered an Interface. The default is False.

Returns:False
mark_as_deleted()

Mark the object as deleted. This will cause the JSON status to be set to deleted.

classmethod mask_class_from_graphs()

Mask (hide) this class from graph creation

Returns:False indicating that this class should not be masked.
populate_children(deep=False, include_concrete=False)

Populates all of the children and then calls populate_children of those children if deep is True. This method should be overridden by any object that does have children.

If include_concrete is True, then if the object has concrete objects below it, i.e. is a switch, then also populate those conrete object.

Parameters:
  • include_concrete – True or False. Default is False
  • deep – True or False. Default is False.
remove_child(obj)

Remove a child from the children list

Parameters:obj – Child object that is to be removed.
remove_tag(tag)

Remove a particular tag from being assigned to this object. Note that this does not delete the tag from the APIC.

Parameters:tag – string containing the tag to remove from this object or an instance of _Tag
set_parent(parent_obj)

Set the parent object

Parameters:parent_obj – Instance of the parent object
Returns:None
classmethod subscribe(session, extension='', only_new=False)

Subscribe to events from the APIC that pertain to instances of this class.

Parameters:
  • session – the instance of Session used for APIC communication
  • only_new – Boolean indicating whether to get all events or only the new events. All events (indicated by setting only_new to False) will queue a create event for all of the currently existing objects. Setting only_new to True will only queue events that occur after the initial subscribe. The default has only_new set to False.
subscribe_to_fault_instances_subtree(session, extension='', deep=False)

Subscribe to faults instances for the whole subtree.

Parameters:
  • session – the instance of Session used for APIC communication
  • extension – Optional string that can be used to extend the URL
  • only_new – Boolean indicating whether to get all events or only the new events. All events (indicated by setting only_new to False) will queue a create event for all of the currently existing objects. Setting only_new to True will only queue events that occur after the initial subscribe. The default has only_new set to False.
classmethod unsubscribe(session)

Unsubscribe for events from the APIC that pertain to instances of this class.

Parameters:session – the instance of Session used for APIC communication
update_db(session, subscribed_classes, deep=False)
Parameters:
  • session – Session class instance representing the connection to the APIC
  • subscribed_classes – List of subscribed classes
  • deep – Boolean indicating whether to go deep or not. Default is False
Returns:

List of subscribed classes

class acitoolkit.acitoolkit.FilterEntry(name, parent, applyToFrag='0', arpOpc='0', dFromPort='0', dToPort='0', etherT='0', prot='0', sFromPort='0', sToPort='0', tcpRules='0', stateful='0', icmpv4T='not-given', icmpv6T='not-given')

Bases: acitoolkit.acibaseobject.BaseACIObject

FilterEntry : roughly equivalent to vzEntry

Parameters:
  • name – String containing the name of this FilterEntry instance.
  • applyToFrag – True or False. True indicates that this FilterEntry should be applied to IP fragments.
  • arpOpc – ‘req’ or ‘reply’. Indicates that this FilterEntry should be applied to ARP Requests or ARP replies.
  • dFromPort – String containing the lower L4 destination port number of the L4 destination port number range.
  • dToPort – String containing the upper L4 destination port number of the L4 destination port number range.
  • etherT – String containing the EtherType of the frame to be matched by this FilterEntry.
  • prot – String containing the L4 protocol number to be matched by this FilterEntry.
  • sFromPort – String containing the lower L4 source port number of the L4 source port number range.
  • sToPort – String containing the upper L4 source port number of the L4 source port number range.
  • tcpRules – Bit mask consisting of the TCP flags to be matched by this FilterEntry.
  • stateful – True or False. True indicates that this FilterEntry should monitor the TCP ACK bit.
  • icmpv4T – String containing the ICMPv4 type.
  • icmpv6T – String containing the ICMPv6 type.
add_child(obj)

Add a child to the children list.

Parameters:obj – Child object to add to the children list of the called object.
add_tag(tag)

Assign this object a particular tag. Tags are strings that can be used to classify objects. More than 1 tag can be assigned to an object.

Parameters:tag – string containing the tag to assign to this object or an instance of _Tag
attach(item)

Attach the object to the other object.

Parameters:item – Object to be attached.
static check_session(session)

This will check that the session is of type Session and raise exception if it not

Parameters:session – the session to check
Returns:
classmethod create_from_apic_json(data, parent)

create from the apic json

Parameters:
  • data – json dictionary
  • parent – parent object
Returns:

object created from json dictionary

delete_tag(tag)

Mark a particular tag as being deleted from this object.

Parameters:tag – string containing the tag to delete from this object or an instance of _Tag
detach(item)

Detach the object from the other object. A relationship is either ‘attached’, ‘detached’, or does not exist. A detached relationship will cause the relationship to be deleted when pushed to the APIC.

Parameters:item – Object to be detached.
find(search_object)

This will check to see if self is a match with search_object and then call find on all of the children of search. If there is a match, a list containing self and any matches found by the children will be returned as a list.

The criteria for a match is that all attributes of self are compared to all attributes of search_object. If search_object.<attr> exists and is the same as self.<attr> or search_object.<attr> is ‘None’, then that attribute matches. If all such attributes match, then there is a match and self will be returned in the result.

If there is an attribute of search_object that does not exist in self, it will be considered a mismatch. If there is an attribute of self that does not exist in search_object, it will be ignored.

Parameters:search_object – ACI object to search
Returns:List of objects
classmethod get(session, parent, tenant)

To get all of acitoolkit style Filter Entries APIC class.

Parameters:
  • session – the instance of Session used for APIC communication
  • parent – Object to assign as the parent to the created objects.
  • tenant – Tenant object to assign the created objects.
get_all_attached(attached_class, status='attached', relation_type=None)

Get all of the relations of objects belonging to the specified class with the specified status.

Parameters:
  • attached_class – The class that is the subject of the search.
  • status – Valid values are ‘attached’ and ‘detached’. Default is ‘attached’.
get_all_attachments(attached_class, status='attached', relation_type=None)

Get all of the attachments to an object belonging to the specified class with the specified status.

Parameters:
  • attached_class – The class that is the subject of the search.
  • status – Valid values are ‘attached’ and ‘detached’. Default is ‘attached’.
get_attributes(name=None)

Will return the value of the named attribute in a dictionary format. If no name is given, then it will return all attributes.

Note that attributes that start with _ (underbar) will NOT be included unless explicitly named

This method should be over-written as appropriate by inheriting objects to handle how their local attributes are implemented.

This is intended to normalize how all attributes on all objects can be accessed since the implementations were not consistent.

Parameters:name – optional name of attribute to return
Returns:dictionary of attributes and their values
get_child(child_type, child_name)

Gets a specific immediate child of this object

Parameters:
  • child_type – Class of the child to return
  • child_name – Name of the child to return
Returns:

The specific instance of child_type or None if not found

get_children(only_class=None)

Get a list of the immediate child objects of this object.

Parameters:only_class – Optional parameter that will be used to limit the objects returned to only those belonging to the class passed in this parameter.
Returns:List of children objects.
classmethod get_deep(full_data, working_data, parent=None, limit_to=(), subtree='full', config_only=False)

Gets all instances of this class from the APIC and gets all of the children as well.

Parameters:
  • full_data
  • working_data
  • parent
  • limit_to
  • subtree
  • config_only
classmethod get_deep_apic_classes(include_concrete=False)

Get all the apic classes needed for this acitoolkit class and all of its children. :return: list of all apic classes

get_dn_from_attributes(attributes)

Will get the dn from the attributes or construct it using the dn of the parent plus the rn. Failing those, it will return None

Parameters:attributes
Returns:String containing dn or None
classmethod get_event(session)

Gets the event that is pending for this class. Events are returned in the form of objects. Objects that have been deleted are marked as such.

Parameters:session – the instance of Session used for APIC communication
classmethod get_fault(session, extension='')

Gets the fault that is pending for this class. Faults are returned in the form of objects. Objects that have been deleted are marked as such.

Parameters:session – the instance of Session used for APIC communication
get_from_json(data, parent=None)

returns a Tenant object from a json

get_interfaces(status='attached')

Get all of the interface relations. Note that multiple classes are considered “interfaces” such as Interface, L2Interface, L3Interface, etc.

Parameters:status – Valid values are ‘attached’ and ‘detached’. Default is ‘attached’.
Returns:List of interfaces that this object has relations and the status matches.
get_json()

Returns json representation of the FilterEntry

Returns:json dictionary of the FilterEntry
get_parent()
Returns:Parent of this object.
get_searchable()

Method to recursively retrieve all of the searchable items from all the children objects, add the current object to them as additional context, append the local searchable terms, and return the result.

static get_table(filters, title='')

Will create table of filter information for a given tenant

Parameters:
  • title
  • filters
get_tags()

Get the tags assigned to this object.

Returns:List of tag instances
has_attachment(item)

Indicates whether this object is attached to the item/ :returns: True or False, True indicates the object is attached.

has_child(obj)

Check for existence of a child in the children list

Parameters:obj – Child object that is the subject of the check.
Returns:True or False, True indicates that it does indeed have the obj object as a child.
has_detachment(item)

Indicates whether the object is detached from this item. :returns: True or False, True indicates the object is detached.

classmethod has_events(session, extension='')

Check for pending events from the APIC that pertain to instances of this class.

Parameters:session – the instance of Session used for APIC communication
Returns:True or False. True if there are events pending.
has_parent()

returns True if this object has a parent

Returns:bool
has_tag(tag)

Checks whether this object has a particular tag assigned.

Parameters:tag – string containing the tag name or an instance of _Tag
Returns:True or False. True indicates the object has this tag assigned.
has_tags()

Checks whether this object has any tags assigned at all.

Returns:True or False. True indicates the object has at least one tag assigned.
info()

Node information summary.

Returns:Formatted string that has a summary of all of the info gathered about the node.
infoList()

Node information. Returns a list of (attr, value) tuples.

Returns:list of [(attr, value),]
is_attached(item)

Indicates whether the item is attached to this object/ :returns: True or False, True indicates the item is attached.

is_deleted()

Check if the object has been deleted.

Returns:True or False, True indicates the object has been deleted.
is_detached(item)

Indicates whether the item is detached from this object.

Returns:True or False, True indicates the item is detached.
static is_interface()

Indicates whether this object is considered an Interface. The default is False.

Returns:False
mark_as_deleted()

Mark the object as deleted. This will cause the JSON status to be set to deleted.

classmethod mask_class_from_graphs()

Mask (hide) this class from graph creation

Returns:False indicating that this class should not be masked.
populate_children(deep=False, include_concrete=False)

Populates all of the children and then calls populate_children of those children if deep is True. This method should be overridden by any object that does have children.

If include_concrete is True, then if the object has concrete objects below it, i.e. is a switch, then also populate those conrete object.

Parameters:
  • include_concrete – True or False. Default is False
  • deep – True or False. Default is False.
remove_child(obj)

Remove a child from the children list

Parameters:obj – Child object that is to be removed.
remove_tag(tag)

Remove a particular tag from being assigned to this object. Note that this does not delete the tag from the APIC.

Parameters:tag – string containing the tag to remove from this object or an instance of _Tag
set_parent(parent_obj)

Set the parent object

Parameters:parent_obj – Instance of the parent object
Returns:None
classmethod subscribe(session, extension='', only_new=False)

Subscribe to events from the APIC that pertain to instances of this class.

Parameters:
  • session – the instance of Session used for APIC communication
  • only_new – Boolean indicating whether to get all events or only the new events. All events (indicated by setting only_new to False) will queue a create event for all of the currently existing objects. Setting only_new to True will only queue events that occur after the initial subscribe. The default has only_new set to False.
subscribe_to_fault_instances_subtree(session, extension='', deep=False)

Subscribe to faults instances for the whole subtree.

Parameters:
  • session – the instance of Session used for APIC communication
  • extension – Optional string that can be used to extend the URL
  • only_new – Boolean indicating whether to get all events or only the new events. All events (indicated by setting only_new to False) will queue a create event for all of the currently existing objects. Setting only_new to True will only queue events that occur after the initial subscribe. The default has only_new set to False.
classmethod unsubscribe(session)

Unsubscribe for events from the APIC that pertain to instances of this class.

Parameters:session – the instance of Session used for APIC communication
update_db(session, subscribed_classes, deep=False)
Parameters:
  • session – Session class instance representing the connection to the APIC
  • subscribed_classes – List of subscribed classes
  • deep – Boolean indicating whether to go deep or not. Default is False
Returns:

List of subscribed classes

class acitoolkit.acitoolkit.IPEndpoint(name, parent)

Bases: acitoolkit.acibaseobject.BaseACIObject

Endpoint class

add_child(obj)

Add a child to the children list.

Parameters:obj – Child object to add to the children list of the called object.
add_tag(tag)

Assign this object a particular tag. Tags are strings that can be used to classify objects. More than 1 tag can be assigned to an object.

Parameters:tag – string containing the tag to assign to this object or an instance of _Tag
attach(item)

Attach the object to the other object.

Parameters:item – Object to be attached.
static check_session(session)

This will check that the session is of type Session and raise exception if it not

Parameters:session – the session to check
Returns:
delete_tag(tag)

Mark a particular tag as being deleted from this object.

Parameters:tag – string containing the tag to delete from this object or an instance of _Tag
detach(item)

Detach the object from the other object. A relationship is either ‘attached’, ‘detached’, or does not exist. A detached relationship will cause the relationship to be deleted when pushed to the APIC.

Parameters:item – Object to be detached.
find(search_object)

This will check to see if self is a match with search_object and then call find on all of the children of search. If there is a match, a list containing self and any matches found by the children will be returned as a list.

The criteria for a match is that all attributes of self are compared to all attributes of search_object. If search_object.<attr> exists and is the same as self.<attr> or search_object.<attr> is ‘None’, then that attribute matches. If all such attributes match, then there is a match and self will be returned in the result.

If there is an attribute of search_object that does not exist in self, it will be considered a mismatch. If there is an attribute of self that does not exist in search_object, it will be ignored.

Parameters:search_object – ACI object to search
Returns:List of objects
static get(session)

Gets all of the IP endpoints connected to the fabric from the APIC

Parameters:session – Session instance assumed to be logged into the APIC
Returns:List of IPEndpoint instances
get_all_attached(attached_class, status='attached', relation_type=None)

Get all of the relations of objects belonging to the specified class with the specified status.

Parameters:
  • attached_class – The class that is the subject of the search.
  • status – Valid values are ‘attached’ and ‘detached’. Default is ‘attached’.
get_all_attachments(attached_class, status='attached', relation_type=None)

Get all of the attachments to an object belonging to the specified class with the specified status.

Parameters:
  • attached_class – The class that is the subject of the search.
  • status – Valid values are ‘attached’ and ‘detached’. Default is ‘attached’.
classmethod get_all_by_epg(session, tenant_name, app_name, epg_name)

Get all of the IP Endpoints for the specified EPG

Parameters:
  • session – Session instance assumed to be logged into the APIC
  • tenant_name – String containing the Tenant name that holds the EPG
  • app_name – String containing the AppProfile name that holds the EPG
  • epg_name – String containing the EPG name
Returns:

List of IPEndpoint instances

get_attributes(name=None)

Will return the value of the named attribute in a dictionary format. If no name is given, then it will return all attributes.

Note that attributes that start with _ (underbar) will NOT be included unless explicitly named

This method should be over-written as appropriate by inheriting objects to handle how their local attributes are implemented.

This is intended to normalize how all attributes on all objects can be accessed since the implementations were not consistent.

Parameters:name – optional name of attribute to return
Returns:dictionary of attributes and their values
get_child(child_type, child_name)

Gets a specific immediate child of this object

Parameters:
  • child_type – Class of the child to return
  • child_name – Name of the child to return
Returns:

The specific instance of child_type or None if not found

get_children(only_class=None)

Get a list of the immediate child objects of this object.

Parameters:only_class – Optional parameter that will be used to limit the objects returned to only those belonging to the class passed in this parameter.
Returns:List of children objects.
classmethod get_deep(full_data, working_data, parent=None, limit_to=(), subtree='full', config_only=False)

Gets all instances of this class from the APIC and gets all of the children as well.

Parameters:
  • full_data
  • working_data
  • parent
  • limit_to
  • subtree
  • config_only
classmethod get_deep_apic_classes(include_concrete=False)

Get all the apic classes needed for this acitoolkit class and all of its children. :return: list of all apic classes

get_dn_from_attributes(attributes)

Will get the dn from the attributes or construct it using the dn of the parent plus the rn. Failing those, it will return None

Parameters:attributes
Returns:String containing dn or None
classmethod get_event(session)

Gets the event that is pending for this class. Events are returned in the form of objects. Objects that have been deleted are marked as such.

Parameters:session – the instance of Session used for APIC communication
classmethod get_fault(session, extension='')

Gets the fault that is pending for this class. Faults are returned in the form of objects. Objects that have been deleted are marked as such.

Parameters:session – the instance of Session used for APIC communication
get_from_json(data, parent=None)

returns a Tenant object from a json

get_interfaces(status='attached')

Get all of the interface relations. Note that multiple classes are considered “interfaces” such as Interface, L2Interface, L3Interface, etc.

Parameters:status – Valid values are ‘attached’ and ‘detached’. Default is ‘attached’.
Returns:List of interfaces that this object has relations and the status matches.
get_json()

Get the JSON representation of this class in the actual APIC Object Model.

Parameters:
  • obj_class – Object Class Name within the APIC model.
  • attributes – Additional attributes that should be set in the JSON.
  • children – Children objects to traverse as well.
  • get_children – Indicates whether the children objects should be included.
Returns:

JSON dictionary to be pushed to the APIC.

get_parent()
Returns:Parent of this object.
get_searchable()

Method to recursively retrieve all of the searchable items from all the children objects, add the current object to them as additional context, append the local searchable terms, and return the result.

static get_table(aci_object, title='')

Abstract method that should be replaced by a version that is specific to the object

Parameters:
  • aci_object
  • title – String containing the table title
Returns:

list of Table objects

get_tags()

Get the tags assigned to this object.

Returns:List of tag instances
has_attachment(item)

Indicates whether this object is attached to the item/ :returns: True or False, True indicates the object is attached.

has_child(obj)

Check for existence of a child in the children list

Parameters:obj – Child object that is the subject of the check.
Returns:True or False, True indicates that it does indeed have the obj object as a child.
has_detachment(item)

Indicates whether the object is detached from this item. :returns: True or False, True indicates the object is detached.

classmethod has_events(session, extension='')

Check for pending events from the APIC that pertain to instances of this class.

Parameters:session – the instance of Session used for APIC communication
Returns:True or False. True if there are events pending.
has_parent()

returns True if this object has a parent

Returns:bool
has_tag(tag)

Checks whether this object has a particular tag assigned.

Parameters:tag – string containing the tag name or an instance of _Tag
Returns:True or False. True indicates the object has this tag assigned.
has_tags()

Checks whether this object has any tags assigned at all.

Returns:True or False. True indicates the object has at least one tag assigned.
info()

Node information summary.

Returns:Formatted string that has a summary of all of the info gathered about the node.
infoList()

Node information. Returns a list of (attr, value) tuples.

Returns:list of [(attr, value),]
is_attached(item)

Indicates whether the item is attached to this object/ :returns: True or False, True indicates the item is attached.

is_deleted()

Check if the object has been deleted.

Returns:True or False, True indicates the object has been deleted.
is_detached(item)

Indicates whether the item is detached from this object.

Returns:True or False, True indicates the item is detached.
static is_interface()

Indicates whether this object is considered an Interface. The default is False.

Returns:False
mark_as_deleted()

Mark the object as deleted. This will cause the JSON status to be set to deleted.

classmethod mask_class_from_graphs()

Mask (hide) this class from graph creation

Returns:False indicating that this class should not be masked.
populate_children(deep=False, include_concrete=False)

Populates all of the children and then calls populate_children of those children if deep is True. This method should be overridden by any object that does have children.

If include_concrete is True, then if the object has concrete objects below it, i.e. is a switch, then also populate those conrete object.

Parameters:
  • include_concrete – True or False. Default is False
  • deep – True or False. Default is False.
remove_child(obj)

Remove a child from the children list

Parameters:obj – Child object that is to be removed.
remove_tag(tag)

Remove a particular tag from being assigned to this object. Note that this does not delete the tag from the APIC.

Parameters:tag – string containing the tag to remove from this object or an instance of _Tag
set_parent(parent_obj)

Set the parent object

Parameters:parent_obj – Instance of the parent object
Returns:None
classmethod subscribe(session, extension='', only_new=False)

Subscribe to events from the APIC that pertain to instances of this class.

Parameters:
  • session – the instance of Session used for APIC communication
  • only_new – Boolean indicating whether to get all events or only the new events. All events (indicated by setting only_new to False) will queue a create event for all of the currently existing objects. Setting only_new to True will only queue events that occur after the initial subscribe. The default has only_new set to False.
subscribe_to_fault_instances_subtree(session, extension='', deep=False)

Subscribe to faults instances for the whole subtree.

Parameters:
  • session – the instance of Session used for APIC communication
  • extension – Optional string that can be used to extend the URL
  • only_new – Boolean indicating whether to get all events or only the new events. All events (indicated by setting only_new to False) will queue a create event for all of the currently existing objects. Setting only_new to True will only queue events that occur after the initial subscribe. The default has only_new set to False.
classmethod unsubscribe(session)

Unsubscribe for events from the APIC that pertain to instances of this class.

Parameters:session – the instance of Session used for APIC communication
update_db(session, subscribed_classes, deep=False)
Parameters:
  • session – Session class instance representing the connection to the APIC
  • subscribed_classes – List of subscribed classes
  • deep – Boolean indicating whether to go deep or not. Default is False
Returns:

List of subscribed classes

class acitoolkit.acitoolkit.InputTerminal(terminal_name, parent=None)

Bases: acitoolkit.acitoolkit.BaseTerminal

Input terminal for a graph. It is input with respect to the provider

add_child(obj)

Add a child to the children list.

Parameters:obj – Child object to add to the children list of the called object.
add_filter(filter_obj)

Add Filter to the Terminal, roughly equivalent to vzRsFiltAtt

Parameters:filter_obj – Instance of Filter class. Represents a Filter that is added to the Terminal. Multiple Filters can be assigned to a single Terminal.
add_tag(tag)

Assign this object a particular tag. Tags are strings that can be used to classify objects. More than 1 tag can be assigned to an object.

Parameters:tag – string containing the tag to assign to this object or an instance of _Tag
attach(item)

Attach the object to the other object.

Parameters:item – Object to be attached.
static check_session(session)

This will check that the session is of type Session and raise exception if it not

Parameters:session – the session to check
Returns:
delete_tag(tag)

Mark a particular tag as being deleted from this object.

Parameters:tag – string containing the tag to delete from this object or an instance of _Tag
detach(item)

Detach the object from the other object. A relationship is either ‘attached’, ‘detached’, or does not exist. A detached relationship will cause the relationship to be deleted when pushed to the APIC.

Parameters:item – Object to be detached.
find(search_object)

This will check to see if self is a match with search_object and then call find on all of the children of search. If there is a match, a list containing self and any matches found by the children will be returned as a list.

The criteria for a match is that all attributes of self are compared to all attributes of search_object. If search_object.<attr> exists and is the same as self.<attr> or search_object.<attr> is ‘None’, then that attribute matches. If all such attributes match, then there is a match and self will be returned in the result.

If there is an attribute of search_object that does not exist in self, it will be considered a mismatch. If there is an attribute of self that does not exist in search_object, it will be ignored.

Parameters:search_object – ACI object to search
Returns:List of objects
classmethod get(session, toolkit_class, apic_class, parent=None, tenant=None, query_target_type='subtree')

Generic classmethod to get all of a particular APIC class.

Parameters:
  • session – the instance of Session used for APIC communication
  • toolkit_class – acitoolkit class to return
  • apic_class – String containing class name from the APIC object model.
  • parent – Object to assign as the parent to the created objects.
  • tenant – Tenant object to assign the created objects.
  • query_target_type – type of the query either self,children,subtree
get_all_attached(attached_class, status='attached', relation_type=None)

Get all of the relations of objects belonging to the specified class with the specified status.

Parameters:
  • attached_class – The class that is the subject of the search.
  • status – Valid values are ‘attached’ and ‘detached’. Default is ‘attached’.
get_all_attachments(attached_class, status='attached', relation_type=None)

Get all of the attachments to an object belonging to the specified class with the specified status.

Parameters:
  • attached_class – The class that is the subject of the search.
  • status – Valid values are ‘attached’ and ‘detached’. Default is ‘attached’.
get_attributes(name=None)

Will return the value of the named attribute in a dictionary format. If no name is given, then it will return all attributes.

Note that attributes that start with _ (underbar) will NOT be included unless explicitly named

This method should be over-written as appropriate by inheriting objects to handle how their local attributes are implemented.

This is intended to normalize how all attributes on all objects can be accessed since the implementations were not consistent.

Parameters:name – optional name of attribute to return
Returns:dictionary of attributes and their values
get_child(child_type, child_name)

Gets a specific immediate child of this object

Parameters:
  • child_type – Class of the child to return
  • child_name – Name of the child to return
Returns:

The specific instance of child_type or None if not found

get_children(only_class=None)

Get a list of the immediate child objects of this object.

Parameters:only_class – Optional parameter that will be used to limit the objects returned to only those belonging to the class passed in this parameter.
Returns:List of children objects.
classmethod get_deep(full_data, working_data, parent=None, limit_to=(), subtree='full', config_only=False)

Gets all instances of this class from the APIC and gets all of the children as well.

Parameters:
  • full_data
  • working_data
  • parent
  • limit_to
  • subtree
  • config_only
classmethod get_deep_apic_classes(include_concrete=False)

Get all the apic classes needed for this acitoolkit class and all of its children. :return: list of all apic classes

get_dn_from_attributes(attributes)

Will get the dn from the attributes or construct it using the dn of the parent plus the rn. Failing those, it will return None

Parameters:attributes
Returns:String containing dn or None
classmethod get_event(session)

Gets the event that is pending for this class. Events are returned in the form of objects. Objects that have been deleted are marked as such.

Parameters:session – the instance of Session used for APIC communication
classmethod get_fault(session, extension='')

Gets the fault that is pending for this class. Faults are returned in the form of objects. Objects that have been deleted are marked as such.

Parameters:session – the instance of Session used for APIC communication
get_filters()

Get all of the filters that are attached to this Terminal.

Returns:List of Filter objects
get_from_json(data, parent=None)

returns a Tenant object from a json

get_interfaces(status='attached')

Get all of the interface relations. Note that multiple classes are considered “interfaces” such as Interface, L2Interface, L3Interface, etc.

Parameters:status – Valid values are ‘attached’ and ‘detached’. Default is ‘attached’.
Returns:List of interfaces that this object has relations and the status matches.
get_json()

Returns json representation of the Terminal Object

Returns:json dictionary of the ContractSubject
get_parent()
Returns:Parent of this object.
get_searchable()

Method to recursively retrieve all of the searchable items from all the children objects, add the current object to them as additional context, append the local searchable terms, and return the result.

static get_table(aci_object, title='')

Abstract method that should be replaced by a version that is specific to the object

Parameters:
  • aci_object
  • title – String containing the table title
Returns:

list of Table objects

get_tags()

Get the tags assigned to this object.

Returns:List of tag instances
has_attachment(item)

Indicates whether this object is attached to the item/ :returns: True or False, True indicates the object is attached.

has_child(obj)

Check for existence of a child in the children list

Parameters:obj – Child object that is the subject of the check.
Returns:True or False, True indicates that it does indeed have the obj object as a child.
has_detachment(item)

Indicates whether the object is detached from this item. :returns: True or False, True indicates the object is detached.

classmethod has_events(session, extension='')

Check for pending events from the APIC that pertain to instances of this class.

Parameters:session – the instance of Session used for APIC communication
Returns:True or False. True if there are events pending.
has_parent()

returns True if this object has a parent

Returns:bool
has_tag(tag)

Checks whether this object has a particular tag assigned.

Parameters:tag – string containing the tag name or an instance of _Tag
Returns:True or False. True indicates the object has this tag assigned.
has_tags()

Checks whether this object has any tags assigned at all.

Returns:True or False. True indicates the object has at least one tag assigned.
info()

Node information summary.

Returns:Formatted string that has a summary of all of the info gathered about the node.
infoList()

Node information. Returns a list of (attr, value) tuples.

Returns:list of [(attr, value),]
is_attached(item)

Indicates whether the item is attached to this object/ :returns: True or False, True indicates the item is attached.

is_deleted()

Check if the object has been deleted.

Returns:True or False, True indicates the object has been deleted.
is_detached(item)

Indicates whether the item is detached from this object.

Returns:True or False, True indicates the item is detached.
static is_interface()

Indicates whether this object is considered an Interface. The default is False.

Returns:False
mark_as_deleted()

Mark the object as deleted. This will cause the JSON status to be set to deleted.

classmethod mask_class_from_graphs()

Mask (hide) this class from graph creation

Returns:False indicating that this class should not be masked.
populate_children(deep=False, include_concrete=False)

Populates all of the children and then calls populate_children of those children if deep is True. This method should be overridden by any object that does have children.

If include_concrete is True, then if the object has concrete objects below it, i.e. is a switch, then also populate those conrete object.

Parameters:
  • include_concrete – True or False. Default is False
  • deep – True or False. Default is False.
remove_child(obj)

Remove a child from the children list

Parameters:obj – Child object that is to be removed.
remove_tag(tag)

Remove a particular tag from being assigned to this object. Note that this does not delete the tag from the APIC.

Parameters:tag – string containing the tag to remove from this object or an instance of _Tag
set_parent(parent_obj)

Set the parent object

Parameters:parent_obj – Instance of the parent object
Returns:None
classmethod subscribe(session, extension='', only_new=False)

Subscribe to events from the APIC that pertain to instances of this class.

Parameters:
  • session – the instance of Session used for APIC communication
  • only_new – Boolean indicating whether to get all events or only the new events. All events (indicated by setting only_new to False) will queue a create event for all of the currently existing objects. Setting only_new to True will only queue events that occur after the initial subscribe. The default has only_new set to False.
subscribe_to_fault_instances_subtree(session, extension='', deep=False)

Subscribe to faults instances for the whole subtree.

Parameters:
  • session – the instance of Session used for APIC communication
  • extension – Optional string that can be used to extend the URL
  • only_new – Boolean indicating whether to get all events or only the new events. All events (indicated by setting only_new to False) will queue a create event for all of the currently existing objects. Setting only_new to True will only queue events that occur after the initial subscribe. The default has only_new set to False.
classmethod unsubscribe(session)

Unsubscribe for events from the APIC that pertain to instances of this class.

Parameters:session – the instance of Session used for APIC communication
update_db(session, subscribed_classes, deep=False)
Parameters:
  • session – Session class instance representing the connection to the APIC
  • subscribed_classes – List of subscribed classes
  • deep – Boolean indicating whether to go deep or not. Default is False
Returns:

List of subscribed classes

class acitoolkit.acitoolkit.L2ExtDomain(name, parent)

Bases: acitoolkit.acibaseobject.BaseACIObject

L2ExtDomain class

Parameters:
  • name – String containing the L2ExtDomain name
  • parent – An instance of DomP class representing
add_child(obj)

Add a child to the children list.

Parameters:obj – Child object to add to the children list of the called object.
add_tag(tag)

Assign this object a particular tag. Tags are strings that can be used to classify objects. More than 1 tag can be assigned to an object.

Parameters:tag – string containing the tag to assign to this object or an instance of _Tag
attach(item)

Attach the object to the other object.

Parameters:item – Object to be attached.
static check_session(session)

This will check that the session is of type Session and raise exception if it not

Parameters:session – the session to check
Returns:
delete_tag(tag)

Mark a particular tag as being deleted from this object.

Parameters:tag – string containing the tag to delete from this object or an instance of _Tag
detach(item)

Detach the object from the other object. A relationship is either ‘attached’, ‘detached’, or does not exist. A detached relationship will cause the relationship to be deleted when pushed to the APIC.

Parameters:item – Object to be detached.
find(search_object)

This will check to see if self is a match with search_object and then call find on all of the children of search. If there is a match, a list containing self and any matches found by the children will be returned as a list.

The criteria for a match is that all attributes of self are compared to all attributes of search_object. If search_object.<attr> exists and is the same as self.<attr> or search_object.<attr> is ‘None’, then that attribute matches. If all such attributes match, then there is a match and self will be returned in the result.

If there is an attribute of search_object that does not exist in self, it will be considered a mismatch. If there is an attribute of self that does not exist in search_object, it will be ignored.

Parameters:search_object – ACI object to search
Returns:List of objects
classmethod get(session)

Gets all of the L2Ext Domains from the APIC

Parameters:session – the instance of Session used for APIC communication
Returns:List of L2ExtDomain objects
get_all_attached(attached_class, status='attached', relation_type=None)

Get all of the relations of objects belonging to the specified class with the specified status.

Parameters:
  • attached_class – The class that is the subject of the search.
  • status – Valid values are ‘attached’ and ‘detached’. Default is ‘attached’.
get_all_attachments(attached_class, status='attached', relation_type=None)

Get all of the attachments to an object belonging to the specified class with the specified status.

Parameters:
  • attached_class – The class that is the subject of the search.
  • status – Valid values are ‘attached’ and ‘detached’. Default is ‘attached’.
get_attributes(name=None)

Will return the value of the named attribute in a dictionary format. If no name is given, then it will return all attributes.

Note that attributes that start with _ (underbar) will NOT be included unless explicitly named

This method should be over-written as appropriate by inheriting objects to handle how their local attributes are implemented.

This is intended to normalize how all attributes on all objects can be accessed since the implementations were not consistent.

Parameters:name – optional name of attribute to return
Returns:dictionary of attributes and their values
classmethod get_by_name(session, infra_name)

Gets all of the Physical Domainss from the APIC

Parameters:
  • infra_name
  • session – the instance of Session used for APIC communication
Returns:

List of L2ExtDomain objects

get_child(child_type, child_name)

Gets a specific immediate child of this object

Parameters:
  • child_type – Class of the child to return
  • child_name – Name of the child to return
Returns:

The specific instance of child_type or None if not found

get_children(only_class=None)

Get a list of the immediate child objects of this object.

Parameters:only_class – Optional parameter that will be used to limit the objects returned to only those belonging to the class passed in this parameter.
Returns:List of children objects.
classmethod get_deep(full_data, working_data, parent=None, limit_to=(), subtree='full', config_only=False)

Gets all instances of this class from the APIC and gets all of the children as well.

Parameters:
  • full_data
  • working_data
  • parent
  • limit_to
  • subtree
  • config_only
classmethod get_deep_apic_classes(include_concrete=False)

Get all the apic classes needed for this acitoolkit class and all of its children. :return: list of all apic classes

get_dn_from_attributes(attributes)

Will get the dn from the attributes or construct it using the dn of the parent plus the rn. Failing those, it will return None

Parameters:attributes
Returns:String containing dn or None
classmethod get_event(session)

Gets the event that is pending for this class. Events are returned in the form of objects. Objects that have been deleted are marked as such.

Parameters:session – the instance of Session used for APIC communication
classmethod get_fault(session, extension='')

Gets the fault that is pending for this class. Faults are returned in the form of objects. Objects that have been deleted are marked as such.

Parameters:session – the instance of Session used for APIC communication
get_from_json(data, parent=None)

returns a Tenant object from a json

get_interfaces(status='attached')

Get all of the interface relations. Note that multiple classes are considered “interfaces” such as Interface, L2Interface, L3Interface, etc.

Parameters:status – Valid values are ‘attached’ and ‘detached’. Default is ‘attached’.
Returns:List of interfaces that this object has relations and the status matches.
get_json()

Returns json representation of the l2extDomP object

Returns:A json dictionary of fvTenant
get_parent()
Returns:Parent of this object.
get_searchable()

Method to recursively retrieve all of the searchable items from all the children objects, add the current object to them as additional context, append the local searchable terms, and return the result.

static get_table(aci_object, title='')

Abstract method that should be replaced by a version that is specific to the object

Parameters:
  • aci_object
  • title – String containing the table title
Returns:

list of Table objects

get_tags()

Get the tags assigned to this object.

Returns:List of tag instances
has_attachment(item)

Indicates whether this object is attached to the item/ :returns: True or False, True indicates the object is attached.

has_child(obj)

Check for existence of a child in the children list

Parameters:obj – Child object that is the subject of the check.
Returns:True or False, True indicates that it does indeed have the obj object as a child.
has_detachment(item)

Indicates whether the object is detached from this item. :returns: True or False, True indicates the object is detached.

classmethod has_events(session, extension='')

Check for pending events from the APIC that pertain to instances of this class.

Parameters:session – the instance of Session used for APIC communication
Returns:True or False. True if there are events pending.
has_parent()

returns True if this object has a parent

Returns:bool
has_tag(tag)

Checks whether this object has a particular tag assigned.

Parameters:tag – string containing the tag name or an instance of _Tag
Returns:True or False. True indicates the object has this tag assigned.
has_tags(