acitoolkit module¶
Main ACI Toolkit module This is the main module that comprises the ACI Toolkit.
- 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
- attach(item)¶
Attach the object to the other object.
Parameters: item – Object to be attached.
- 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')¶
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')¶
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_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)¶
Gets all instances of this class from the APIC and gets all of the children as well.
Parameters: - full_data –
- working_data –
- parent –
- 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
- 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 the tags assigned to this object.
Returns: List of tag strings
- 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)¶
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_tag(tag)¶
Checks whether this object has a particular tag assigned.
Parameters: tag – string containing the tag Returns: True or False. True indicates the object has this tag assigned.
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.
- populate_children(deep=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
Parameters: 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.
Parameters: tag – string containing the tag to assign to this object
- classmethod subscribe(session)¶
Subscribe to events from the APIC that pertain to instances of this class.
Parameters: session – the instance of Session used for APIC communication
- 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
- 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
- attach(item)¶
Attach the object to the other object.
Parameters: item – Object to be attached.
- 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)¶
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.
- get_all_attached(attached_class, status='attached')¶
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')¶
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_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)¶
Gets all instances of this class from the APIC and gets all of the children as well.
Parameters: - full_data –
- working_data –
- parent –
- 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
- 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 the tags assigned to this object.
Returns: List of tag strings
- 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)¶
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_tag(tag)¶
Checks whether this object has a particular tag assigned.
Parameters: tag – string containing the tag Returns: True or False. True indicates the object has this tag assigned.
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.
- populate_children(deep=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
Parameters: 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.
Parameters: tag – string containing the tag to assign to this object
- classmethod subscribe(session)¶
Subscribe to events from the APIC that pertain to instances of this class.
Parameters: session – the instance of Session used for APIC communication
- 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
- 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
- attach(item)¶
Attach the object to the other object.
Parameters: item – Object to be attached.
- 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)¶
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.
- get_all_attached(attached_class, status='attached')¶
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')¶
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_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)¶
Gets all instances of this class from the APIC and gets all of the children as well.
Parameters: - full_data –
- working_data –
- parent –
- 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
- 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 the tags assigned to this object.
Returns: List of tag strings
- 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)¶
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_tag(tag)¶
Checks whether this object has a particular tag assigned.
Parameters: tag – string containing the tag Returns: True or False. True indicates the object has this tag assigned.
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.
- populate_children(deep=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
Parameters: 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.
Parameters: tag – string containing the tag to assign to this object
- set_scope(scope)¶
Set the scope of this contract. Valid values are ‘context’, ‘global’, ‘tenant’, and ‘application-profile’
- classmethod subscribe(session)¶
Subscribe to events from the APIC that pertain to instances of this class.
Parameters: session – the instance of Session used for APIC communication
- 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
- class acitoolkit.acitoolkit.BaseInterface(name, parent=None)¶
Bases: acitoolkit.acibaseobject.BaseACIObject
Abstract class used to provide base functionality to other Interface classes.
Constructor initializes the basic object and should be called by the init routines of inheriting subclasses.
Parameters: - name – String containing the name of the object instance
- parent – Parent object within the acitoolkit object model.
- 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
- attach(item)¶
Attach the object to the other object.
Parameters: item – Object to be attached.
- 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)¶
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.
- get_all_attached(attached_class, status='attached')¶
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')¶
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_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)¶
Gets all instances of this class from the APIC and gets all of the children as well.
Parameters: - full_data –
- working_data –
- parent –
- 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
- 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_port_channel_selector_json(port_name)¶
- get_port_selector_json()¶
Get the tags assigned to this object.
Returns: List of tag strings
- 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)¶
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_tag(tag)¶
Checks whether this object has a particular tag assigned.
Parameters: tag – string containing the tag Returns: True or False. True indicates the object has this tag assigned.
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.
- populate_children(deep=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
Parameters: 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.
Parameters: tag – string containing the tag to assign to this object
- classmethod subscribe(session)¶
Subscribe to events from the APIC that pertain to instances of this class.
Parameters: session – the instance of Session used for APIC communication
- 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
- 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.
:param 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.
- setDescription(description)¶
- Sets the description of the MonitorStats.
Parameters: description – String to use as the description
- setName(name)¶
- Sets the name of the MonitorStats.
Parameters: name – String to use as the name
- 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_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
- attach(item)¶
Attach the object to the other object.
Parameters: item – Object to be attached.
- 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')¶
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')¶
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_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)¶
Gets all instances of this class from the APIC and gets all of the children as well.
Parameters: - full_data –
- working_data –
- parent –
- 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
- 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_parent()¶
Returns: Parent of this object.
- get_subnets()¶
Get all of the subnets on this BD.
Returns: List of Subnet instances assigned to this BridgeDomain.
Get the tags assigned to this object.
Returns: List of tag strings
- 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)¶
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_subnet(subnet)¶
Check if the BD has this particular 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 Returns: True or False. True indicates the object has this tag assigned.
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.
- populate_children(deep=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
Parameters: 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.
Parameters: tag – string containing the tag to assign to this object
- classmethod subscribe(session)¶
Subscribe to events from the APIC that pertain to instances of this class.
Parameters: session – the instance of Session used for APIC communication
- 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
- 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.
:param 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’.
- setDescription(description)¶
- Sets the description of the MonitorStats.
Parameters: description – String to use as the description
- setName(name)¶
- Sets the name of the MonitorStats.
Parameters: name – String to use as the name
- 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’].
- 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
- attach(item)¶
Attach the object to the other object.
Parameters: item – Object to be attached.
- consume(contract)¶
Make this EPG consume a Contract
Parameters: contract – Contract class instance to be consumed by this EPG. Returns: True
- 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_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_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, tenant)¶
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')¶
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')¶
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()¶
Get all of the Contracts consumed by this EPG
Returns: List of Contract objects that are consumed by the EPG.
- get_all_provided()¶
Get all of the Contracts provided by this EPG
Returns: List of Contract objects that are provided by the EPG.
- 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)¶
Gets all instances of this class from the APIC and gets all of the children as well.
Parameters: - full_data –
- working_data –
- parent –
- 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
- 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 the tags assigned to this object.
Returns: List of tag strings
- 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)¶
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_tag(tag)¶
Checks whether this object has a particular tag assigned.
Parameters: tag – string containing the tag Returns: True or False. True indicates the object has this tag assigned.
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.
- populate_children(deep=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
Parameters: deep – True or False. Default is False.
- 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.
Parameters: tag – string containing the tag to assign to this object
- classmethod subscribe(session)¶
Subscribe to events from the APIC that pertain to instances of this class.
Parameters: session – the instance of Session used for APIC communication
- 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
- 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
- attach(item)¶
Attach the object to the other object.
Parameters: item – Object to be attached.
- 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 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')¶
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')¶
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_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)¶
Gets all instances of this class from the APIC and gets all of the children as well.
Parameters: - full_data –
- working_data –
- parent –
- 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
- 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 the tags assigned to this object.
Returns: List of tag strings
- 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)¶
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_tag(tag)¶
Checks whether this object has a particular tag assigned.
Parameters: tag – string containing the tag Returns: True or False. True indicates the object has this tag assigned.
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.
- populate_children(deep=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
Parameters: 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.
Parameters: tag – string containing the tag to assign to this object
- 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.
- classmethod subscribe(session)¶
Subscribe to events from the APIC that pertain to instances of this class.
Parameters: session – the instance of Session used for APIC communication
- 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
- 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
- attach(item)¶
Attach the object to the other object.
Parameters: item – Object to be attached.
- 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.
- get_all_attached(attached_class, status='attached')¶
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')¶
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_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)¶
- 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
- 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 the tags assigned to this object.
Returns: List of tag strings
- 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)¶
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_tag(tag)¶
Checks whether this object has a particular tag assigned.
Parameters: tag – string containing the tag Returns: True or False. True indicates the object has this tag assigned.
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.
- populate_children(deep=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
Parameters: 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.
Parameters: tag – string containing the tag to assign to this object
- set_scope(scope)¶
Set the scope of this contract. Valid values are ‘context’, ‘global’, ‘tenant’, and ‘application-profile’
- classmethod subscribe(session)¶
Subscribe to events from the APIC that pertain to instances of this class.
Parameters: session – the instance of Session used for APIC communication
- 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
- 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_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
- attach(item)¶
Attach the object to the other object.
Parameters: item – Object to be attached.
- consume(contract)¶
Make this EPG consume a Contract
Parameters: contract – Contract class instance to be consumed by this EPG. Returns: True
- 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_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_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, tenant)¶
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')¶
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')¶
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()¶
Get all of the Contracts consumed by this EPG
Returns: List of Contract objects that are consumed by the EPG.
- get_all_provided()¶
Get all of the Contracts provided by this EPG
Returns: List of Contract objects that are provided by the EPG.
- get_bd()¶
Return the assigned BridgeDomain. There should only be one item in the returned list.
Returns: List of BridgeDomain objects
- 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)¶
Gets all instances of this class from the APIC and gets all of the children as well.
Parameters: - full_data –
- working_data –
- parent –
- 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
- 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 the tags assigned to this object.
Returns: List of tag strings
- 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)¶
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_tag(tag)¶
Checks whether this object has a particular tag assigned.
Parameters: tag – string containing the tag Returns: True or False. True indicates the object has this tag assigned.
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.
- populate_children(deep=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
Parameters: deep – True or False. Default is False.
- 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.
Parameters: tag – string containing the tag to assign to this object
- classmethod subscribe(session)¶
Subscribe to events from the APIC that pertain to instances of this class.
Parameters: session – the instance of Session used for APIC communication
- 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
- class acitoolkit.acitoolkit.Endpoint(name, parent)¶
Bases: acitoolkit.acibaseobject.BaseACIObject
- 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
- attach(item)¶
Attach the object to the other object.
Parameters: item – Object to be attached.
- 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
- get_all_attached(attached_class, status='attached')¶
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')¶
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_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)¶
Gets all instances of this class from the APIC and gets all of the children as well.
Parameters: - full_data –
- working_data –
- parent –
- classmethod get_event(session)¶
- 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_parent()¶
Returns: Parent of this object.
Get the tags assigned to this object.
Returns: List of tag strings
- 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)¶
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_tag(tag)¶
Checks whether this object has a particular tag assigned.
Parameters: tag – string containing the tag Returns: True or False. True indicates the object has this tag assigned.
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.
- populate_children(deep=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
Parameters: 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.
Parameters: tag – string containing the tag to assign to this object
- classmethod subscribe(session)¶
Subscribe to events from the APIC that pertain to instances of this class.
Parameters: session – the instance of Session used for APIC communication
- 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
- class acitoolkit.acitoolkit.FilterEntry(name, parent, applyToFrag='0', arpOpc='0', dFromPort='0', dToPort='0', etherT='0', prot='0', sFromPort='0', sToPort='0', tcpRules='0')¶
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.
- 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
- attach(item)¶
Attach the object to the other object.
Parameters: item – Object to be attached.
- classmethod create_from_apic_json(data, parent)¶
- 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=None, tenant=None)¶
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')¶
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')¶
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_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)¶
Gets all instances of this class from the APIC and gets all of the children as well.
Parameters: - full_data –
- working_data –
- parent –
- 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
- 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 the tags assigned to this object.
Returns: List of tag strings
- 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)¶
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_tag(tag)¶
Checks whether this object has a particular tag assigned.
Parameters: tag – string containing the tag Returns: True or False. True indicates the object has this tag assigned.
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.
- populate_children(deep=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
Parameters: 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.
Parameters: tag – string containing the tag to assign to this object
- classmethod subscribe(session)¶
Subscribe to events from the APIC that pertain to instances of this class.
Parameters: session – the instance of Session used for APIC communication
- 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
- class acitoolkit.acitoolkit.Interface(interface_type, pod, node, module, port, parent=None, session=None, attributes={})¶
Bases: acitoolkit.acitoolkit.BaseInterface
This class defines a physical interface.
- 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
- attach(item)¶
Attach the object to the other object.
Parameters: item – Object to be attached.
- 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.
- disable_cdp()¶
Disables CDP on this interface.
- disable_lldp()¶
Disables LLDP on this interface.
- enable_cdp()¶
Enables CDP on this interface.
- enable_lldp()¶
Enables LLDP on this interface.
- 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, pod_parent=None, node=None, module=None, port=None)¶
Gets all of the physical interfaces from the APIC if no parent is specified. If a parent of type Linecard is specified, then only those interfaces on that linecard are returned and they are also added as children to that linecard.
If the pod, node, module and port are specified, then only that specific interface is read.
Parameters: - session – the instance of Session used for APIC communication
- pod_parent – Linecard instance to limit interfaces or pod number (optional)
- node – Node id string. This specifies the switch to read. (optional)
- module – Module id string. This specifies the module or slot of the port. (optional)
- port – Port number. This is the port to read. (optional)
Returns: list of Interface instances
- get_all_attached(attached_class, status='attached')¶
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')¶
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_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)¶
Gets all instances of this class from the APIC and gets all of the children as well.
Parameters: - full_data –
- working_data –
- parent –
- 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
- 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 for an interface. Returns a tuple since the json is required to be sent in 2 posts.
- get_parent()¶
Returns: Parent of this object.
- get_port_channel_selector_json(port_name)¶
- get_port_selector_json()¶
- get_serial()¶
Get the tags assigned to this object.
Returns: List of tag strings
- get_type()¶
- get_url()¶
- 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)¶
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_tag(tag)¶
Checks whether this object has a particular tag assigned.
Parameters: tag – string containing the tag Returns: True or False. True indicates the object has this tag assigned.
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_cdp_disabled()¶
Returns whether this interface has CDP configured as disabled.
Returns: True or False
- is_cdp_enabled()¶
Returns whether this interface has CDP configured as enabled.
Returns: True or False
- 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
- is_lldp_disabled()¶
Returns whether this interface has LLDP configured as disabled.
Returns: True or False
- is_lldp_enabled()¶
Returns whether this interface has LLDP configured as enabled.
Returns: True or False
- mark_as_deleted()¶
Mark the object as deleted. This will cause the JSON status to be set to deleted.
- classmethod parse_dn(dn)¶
Parses the pod, node, module, port from a distinguished name of the interface.
Parameters: dn – String containing the interface distinguished name Returns: interface_type, pod, node, module, port
- static parse_name(name)¶
Parses a name that is of the form: <type> <pod>/<mod>/<port>
- populate_children(deep=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
Parameters: 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.
Parameters: tag – string containing the tag to assign to this object
- classmethod subscribe(session)¶
Subscribe to events from the APIC that pertain to instances of this class.
Parameters: session – the instance of Session used for APIC communication
- 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
- class acitoolkit.acitoolkit.InterfaceStats(parent, interfaceDn)¶
This class defines interface statistics. It will provide methods to retrieve the stats. The stats are returned as a dictionary with the following structure:
stats= {<counterFamily>:{<granularity>:{<period>:{<counter>:value}}}}
stats are gathered and summed up in time intervals or granularities. For each granularity there are a set of time periods identified by the <period> field. The current stats are stored in period 0. These stats are zeroed at the beginning of the time interval and are updated at a smaller time interval depending on the granularity. Historical statistics have periods that are greater than 0. The number of historical stats to keep is determined by the monitoring policy and may be specifc to a particular counter family.
The counter families are as follows: ‘egrTotal’, ‘egrBytes’,’egrPkts’,’egrDropPkts’, ‘ingrBytes’,’ingrPkts’, ‘ingrTotal’, ‘ingrDropPkts’, ‘ingrUnkBytes’,’ingrUnkPkts’, ‘ingrStorm’.
The granularities are: ‘5min’, ‘15min’, ‘1h’, ‘1d’, ‘1w’, ‘1mo’, ‘1qtr’, and ‘1year’.
For each counter family/granularity/period there are several counter values retained. The best way to see a list of these counters is to print the keys of the dictionary.
- get(session=None)¶
Retrieve the count dictionary. This method will read in all the counters and return them as a dictionary.
Parameters: session – Session to use when accessing the APIC Returns: Dictionary of counters. Format is {<counterFamily>:{<granularity>:{<period>:{<counter>:value}}}}
- retrieve(countFamily, granularity, period, countName)¶
This will return the requested count from stats that were loaded with the previous get(). It will return 0 for counts that don’t exist or None for time stamps that don’t exist.
Note that this method will not access the APIC, it will only work on data that was previously loaded with a get().
Parameters: - countFamily – The counter family string. Examples are ‘egrTotal’, ‘ingrDropPkts, etc.
- granularity – String specifying the counter time granularity. Possible values are: ‘5min’, ‘15min’, ‘1h’, ‘1d’, ‘1w’, ‘1mo’, ‘1qtr’, and ‘1year’
- period – Integer of time period to get the counter from. Period 0 is the current period. Period 1 is the previous time granularity.
- countName – Name of the actual counter. Examples are ‘unicastPer’, ‘unicastRate’, etc. Counter names are unique per counter family.
Returns: integer, float or None. If the counter is not present, it will return 0.
- class acitoolkit.acitoolkit.L2Interface(name, encap_type, encap_id)¶
Bases: acitoolkit.acibaseobject.BaseACIObject
The L2Interface class creates an logical L2 interface that can be attached to a physical interface. This interface defines the L2 encapsulation i.e. VLAN, VXLAN, or NVGRE
Parameters: - name – String containing the L2Interface instance name
- 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).
- 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
- attach(item)¶
Attach the object to the other object.
Parameters: item – Object to be attached.
- 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)¶
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.
- get_all_attached(attached_class, status='attached')¶
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')¶
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_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)¶
Gets all instances of this class from the APIC and gets all of the children as well.
Parameters: - full_data –
- working_data –
- parent –
- get_encap_id()¶
Get the encap_id of the L2 interface. The value is returned as a string and depends on the encap_type (i.e. VLAN VID, VXLAN VNID, or NVGRE VSID)
Returns: String containing encapsulation identifier value.
- get_encap_type()¶
Get the encap_type of the L2 interface. Valid values are ‘vlan’, ‘vxlan’, and ‘nvgre’
Returns: String containing encap_type value.
- 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
- 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 the tags assigned to this object.
Returns: List of tag strings
- 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)¶
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_tag(tag)¶
Checks whether this object has a particular tag assigned.
Parameters: tag – string containing the tag Returns: True or False. True indicates the object has this tag assigned.
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.
- 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.
- populate_children(deep=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
Parameters: 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.
Parameters: tag – string containing the tag to assign to this object
- classmethod subscribe(session)¶
Subscribe to events from the APIC that pertain to instances of this class.
Parameters: session – the instance of Session used for APIC communication
- 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
- class acitoolkit.acitoolkit.L3Interface(name)¶
Bases: acitoolkit.acibaseobject.BaseACIObject
Creates an L3 interface that can be attached to an L2 interface. This interface defines the L3 address i.e. IPv4
Parameters: name – String containing the name of this L3Interface object. - 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)¶
Add context to the EPG
Parameters: context – Instance of Context class to assign to this L3Interface.
- 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
- attach(item)¶
Attach the object to the other object.
Parameters: item – Object to be attached.
- 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)¶
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.
- get_addr()¶
Get the L3 address assigned to this interface. The address is set via the L3Interface.set_addr() method
Returns: String containing the L3 address in dotted decimal notation.
- get_all_attached(attached_class, status='attached')¶
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')¶
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_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()¶
Return the assigned context
Returns: Instance of Context class that this L3Interface is assigned. If no Context is assigned, None is returned.
- classmethod get_deep(full_data, working_data, parent=None)¶
Gets all instances of this class from the APIC and gets all of the children as well.
Parameters: - full_data –
- working_data –
- parent –
- 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
- 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 L3Interface
Returns: json dictionary of L3Interface
- get_l3if_type()¶
Get the l3if_type of this L3 interface.
Returns: L3 interface type. Valid values are ‘sub-interface’, ‘l3-port’, and ‘ext-svi’
- get_mtu()¶
Get the MTU of this interface
Returns: MTU of the interface
- get_parent()¶
Returns: Parent of this object.
Get the tags assigned to this object.
Returns: List of tag strings
- 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 assigned
Returns: True or False. True if a Context has been assigned to this L3Interface.
- 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)¶
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_tag(tag)¶
Checks whether this object has a particular tag assigned.
Parameters: tag – string containing the tag Returns: True or False. True indicates the object has this tag assigned.
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.
- is_interface()¶
Check if this is an interface object.
Returns: True
- mark_as_deleted()¶
Mark the object as deleted. This will cause the JSON status to be set to deleted.
- populate_children(deep=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
Parameters: 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 context from the EPG
- remove_tag(tag)¶
Remove a particular tag from being assigned to this object.
Parameters: tag – string containing the tag to assign to this object
- set_addr(addr)¶
Set the L3 address assigned to this interface
Parameters: addr – String containing the L3 address in dotted decimal notation.
- set_l3if_type(l3if_type)¶
Set the l3if_type of this L3 interface.
Parameters: l3if_type – L3 interface type. Valid values are ‘sub-interface’, ‘l3-port’, and ‘ext-svi’
- set_mtu(mtu)¶
Set the L3 MTU of this interface
Parameters: mtu – String containing MTU
- classmethod subscribe(session)¶
Subscribe to events from the APIC that pertain to instances of this class.
Parameters: session – the instance of Session used for APIC communication
- 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
- class acitoolkit.acitoolkit.MonitorPolicy(policyType, name)¶
Bases: acitoolkit.acitoolkit.BaseMonitorClass
This class is the top-most container for a monitoring policy that controlls how statistics are gathered. It has immediate children, CollectionPolicy objects, that control the default behavior for any network element that uses this monitoring policy. It may optionally have MonitorTarget objects as children that are used to override the default behavior for a particular target class such as Interfaces. There can be further granularity of control through children of the MonitorTarget sub-objects.
Children of the MonitorPolicy will be CollectionPolicy objects that define the collection policy plus optional MonitorTarget objects that allow finer grained control over specific target APIC objects such as ‘l1PhysIf’ (layer 1 physical interface).
The CollectionPolicy children are contained in a dictionary called “collection_policy” that is indexed by the granulariy of the CollectionPolicy, e.g. ‘5min’, ‘15min’, etc.
The MonitorTarget children are contained in a dictionary called “monitor_target” that is indexed by the name of the target object, e.g. ‘l1PhysIf’.
To make a policy take effect for a particular port, for example, you must attach that monitoring policy to the port.
Note that the name of the MonitorPolicy is used to construct the dn of the object in the APIC. As a result, the name cannot be changed. If you read a policy from the APIC, change the name, and write it back, it will create a new policy with the new name and leave the old, original policy, in place with its original name.
A description may be optionally added to the policy.
The MonitorPolicy is initialized with simply a policy type and a name. There are two policy types: ‘fabric’ and ‘access’. The ‘fabric’ monitoring policies can be applied to certain MonitorTarget types and ‘access’ monitoring policies can be applied to other MonitorTarget types. Initially however, both policies can have l1PhysIf as targets.
A name must be specified because it is used to build the distinguising name (dn) along with the policyType in the APIC. The dn for “fabric” policies will be /uni/fabric/monfabric-[name] and for “access” policies it will be /uni/infra/moninfra-[name] in the APIC.
Parameters: - policyType – String specifying whether this is a fabric or access policy
- name – String specifying a name for the policy.
- add_collection_policy(coll_obj)¶
Add a collection policy.
:param 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
- flat(target='l1PhysIf')¶
This method will return a data structure that is a flattened version of the monitor policy. The flattened version is one that walks through the heirarchy of the policy and determines the administrative state and retention policy for each granularity of each statistics family. This is done for the target specified, i.e. ‘l1PhysIf’
For example, if ‘foo’ is a MonitorPolicy object, then flatPol = foo.flat(‘l1PhysIf’) will return a dictionary that looks like the following:
adminState = flatPol[‘counter_family’][‘granularity’].adminState retention = flatPol[‘counter_family’][‘granularity’].retention
The dictionary will have all of the counter families for all of the granularities and the value returned is the administrative state nad retention value that is the final result of resolving the policy heirarchy.
Parameters: target – APIC target object. This will default to ‘l1PhysIf’ Returns: Dictionary of statistic administrative state and retentions indexed by counter family and granularity.
- classmethod get(session)¶
- get() will get all of the monitor policies from the APIC and return them as a list. It will get both fabric and access (infra) policies including default policies.
Parameters: session – the instance of Session used for APIC communication Returns: List of MonitorPolicy objects
- 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.
- setDescription(description)¶
- Sets the description of the MonitorStats.
Parameters: description – String to use as the description
- setName(name)¶
- Sets the name of the MonitorStats.
Parameters: name – String to use as the name
- class acitoolkit.acitoolkit.MonitorStats(parent, statsFamily)¶
Bases: acitoolkit.acitoolkit.BaseMonitorClass
This class is a child of a MonitorTarget object. It is used to specify a scope for applying a monitoring policy that is more fine grained than the MonitorTarget. Specifically, the MonitorStats object specifies a statistics family such as “ingress packets” or “egress bytes”.
- The MonitorStats object must always be initialized with a parent object of type MonitorTarget.
It sets the scope of its children collection policies (CollectionPolicy) to a particular statistics family.
The MonitorStats object contains a dictionary of collection policies called collection_policy. This is a dictionary of children CollectionPolicy objects indexed by their granularity, e.g. ‘5min’, ‘15min’, etc.
Parameters: - parent – Parent object that this monitor stats object should be applied to. This must be an object of type MonitorTarget.
- statsFamily – String specifying the statistics family that the children collection policies should be applied to. Possible values are:[‘egrBytes’, ‘egrPkts’, ‘egrTotal’, ‘egrDropPkts’, ‘ingrBytes’, ‘ingrPkts’, ‘ingrTotal’, ‘ingrDropPkts’, ‘ingrUnkBytes’, ‘ingrUnkPkts’, ‘ingrStorm’]
- add_collection_policy(coll_obj)¶
Add a collection policy.
:param 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.
- setDescription(description)¶
- Sets the description of the MonitorStats.
Parameters: description – String to use as the description
- setName(name)¶
- Sets the name of the MonitorStats.
Parameters: name – String to use as the name
- statsDictionary = {'eqptIngrDropPkts': 'ingrDropPkts', 'eqptIngrBytes': 'ingrBytes', 'eqptEgrPkts': 'egrPkts', 'eqptEgrDropPkts': 'egrDropPkts', 'eqptIngrPkts': 'ingrPkts', 'eqptIngrUnkBytes': 'ingrUnkBytes', 'eqptEgrBytes': 'egrBytes', 'eqptIngrStorm': 'ingrStorm', 'eqptEgrTotal': 'egrTotal', 'eqptIngrUnkPkts': 'ingrUnkPkts', 'eqptIngrTotal': 'ingrTotal'}¶
- statsFamilyEnum = ['egrBytes', 'egrPkts', 'egrTotal', 'egrDropPkts', 'ingrBytes', 'ingrPkts', 'ingrTotal', 'ingrDropPkts', 'ingrUnkBytes', 'ingrUnkPkts', 'ingrStorm']¶
- class acitoolkit.acitoolkit.MonitorTarget(parent, target)¶
Bases: acitoolkit.acitoolkit.BaseMonitorClass
This class is a child of a MonitorPolicy object. It is used to specify a scope for appling a monitoring policy. An example scope would be the Interface class, meaning that the monitoring policies specified here will apply to all Interface clas objects (l1PhysIf in the APIC) that use the parent MonitoringPolicy as their monitoring policy.
Children of the MonitorTarget will be CollectionPolicy objects that define the collection policy for the specified target plus optional MonitorStats objects that allow finer grained control over specific families of statistics such as ingress packets, ingrPkts.
The CollectionPolicy children are contained in a dictionary called “collection_policy” that is indexed by the granulariy of the CollectionPolicy, e.g. ‘5min’, ‘15min’, etc.
The MonitorStats children are contained in a dictionary called “monitor_stats” that is indexed by the name of the statistics family, e.g. ‘ingrBytes’, ‘ingrPkts’, etc.
- The MonitorTarget object is initialized with a parent of type MonitorPoliy, and a target string.
- Initially, this toolkit only support a target of type ‘l1PhysIf’. The ‘l1PhyIf’ target is a layer 1 physical interface or “port”. The MonitorTarget will narrow the scope of the policy specified by the children of the MonitorTarget to be only the target class.
Parameters: - parent – Parent object that his monitor target is a child of. It must be of type MonitorPolicy
- target – String specifying the target class for the Monitor policy.
- add_collection_policy(coll_obj)¶
Add a collection policy.
:param 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.
- setDescription(description)¶
- Sets the description of the MonitorStats.
Parameters: description – String to use as the description
- setName(name)¶
- Sets the name of the MonitorStats.
Parameters: name – String to use as the name
- class acitoolkit.acitoolkit.NetworkPool(name, encap_type, start_id, end_id, mode)¶
Bases: acitoolkit.acibaseobject.BaseACIObject
This class defines a pool of network ids
- 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
- attach(item)¶
Attach the object to the other object.
Parameters: item – Object to be attached.
- 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)¶
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.
- get_all_attached(attached_class, status='attached')¶
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')¶
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_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)¶
Gets all instances of this class from the APIC and gets all of the children as well.
Parameters: - full_data –
- working_data –
- parent –
- 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
- 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_parent()¶
Returns: Parent of this object.
Get the tags assigned to this object.
Returns: List of tag strings
- 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)¶
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_tag(tag)¶
Checks whether this object has a particular tag assigned.
Parameters: tag – string containing the tag Returns: True or False. True indicates the object has this tag assigned.
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.
- populate_children(deep=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
Parameters: 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.
Parameters: tag – string containing the tag to assign to this object
- classmethod subscribe(session)¶
Subscribe to events from the APIC that pertain to instances of this class.
Parameters: session – the instance of Session used for APIC communication
- 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
- class acitoolkit.acitoolkit.OSPFInterface(name, router=None, area_id=None)¶
Bases: acitoolkit.acibaseobject.BaseACIObject
Creates an OSPF router interface that can be attached to a L3 interface. This interface defines the OSPF area, authentication, etc.
Parameters: - name – String containing the name of this OSPFInterface object.
- area_id – String containing the OSPF area id of this interface. Default is None.
- 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
- attach(item)¶
Attach the object to the other object.
Parameters: item – Object to be attached.
- 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)¶
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.
- get_all_attached(attached_class, status='attached')¶
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')¶
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_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)¶
Gets all instances of this class from the APIC and gets all of the children as well.
Parameters: - full_data –
- working_data –
- parent –
- 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
- 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 OSPFInterface :returns: json dictionary of OSPFInterface
- get_parent()¶
Returns: Parent of this object.
Get the tags assigned to this object.
Returns: List of tag strings
- 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)¶
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_tag(tag)¶
Checks whether this object has a particular tag assigned.
Parameters: tag – string containing the tag Returns: True or False. True indicates the object has this tag assigned.
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.
- is_interface()¶
Returns whether this instance is considered an interface. :returns: True
- static is_ospf()¶
Returns: True if this interface is an OSPF interface. In the case of OSPFInterface instances, this is always True.
- mark_as_deleted()¶
Mark the object as deleted. This will cause the JSON status to be set to deleted.
- populate_children(deep=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
Parameters: 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.
Parameters: tag – string containing the tag to assign to this object
- classmethod subscribe(session)¶
Subscribe to events from the APIC that pertain to instances of this class.
Parameters: session – the instance of Session used for APIC communication
- 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
- class acitoolkit.acitoolkit.OSPFInterfacePolicy(name, parent=None)¶
Bases: acitoolkit.acibaseobject.BaseACIObject
Represents the interface settings of an OSPF interface
param name: String containing the name of this OSPF interface policy param parent: Instance of the Tenant class representing the tenant owning this OSPF interface policy
- 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
- attach(item)¶
Attach the object to the other object.
Parameters: item – Object to be attached.
- 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)¶
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.
- get_all_attached(attached_class, status='attached')¶
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')¶
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_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)¶
Gets all instances of this class from the APIC and gets all of the children as well.
Parameters: - full_data –
- working_data –
- parent –
- 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
- 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 OSPFRouter
Returns: json dictionary of OSPFIRouter
- get_nw_type()¶
Get the nw-type of this interface ospf policy :returns: string of the network type for this policy
- get_parent()¶
Returns: Parent of this object.
Get the tags assigned to this object.
Returns: List of tag strings
- 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)¶
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_tag(tag)¶
Checks whether this object has a particular tag assigned.
Parameters: tag – string containing the tag Returns: True or False. True indicates the object has this tag assigned.
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.
- populate_children(deep=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
Parameters: 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.
Parameters: tag – string containing the tag to assign to this object
- set_nw_type(network_type)¶
sets the L3 nw_type with some validation
Parameters: network_type – string of bcast or p2p
- classmethod subscribe(session)¶
Subscribe to events from the APIC that pertain to instances of this class.
Parameters: session – the instance of Session used for APIC communication
- 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
- class acitoolkit.acitoolkit.OSPFRouter(name)¶
Bases: acitoolkit.acibaseobject.BaseACIObject
Represents the global settings of the OSPF Router
Parameters: name – String containing the name of this OSPFRouter object. - 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
- attach(item)¶
Attach the object to the other object.
Parameters: item – Object to be attached.
- 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)¶
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.
- get_all_attached(attached_class, status='attached')¶
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')¶
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_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)¶
Gets all instances of this class from the APIC and gets all of the children as well.
Parameters: - full_data –
- working_data –
- parent –
- 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
- 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 OSPFRouter
Returns: json dictionary of OSPFIRouter
- get_node_id()¶
:returns string containing the Node ID
- get_parent()¶
Returns: Parent of this object.
- get_router_id()¶
:returns string containing the Router ID
Get the tags assigned to this object.
Returns: List of tag strings
- 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)¶
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_tag(tag)¶
Checks whether this object has a particular tag assigned.
Parameters: tag – string containing the tag Returns: True or False. True indicates the object has this tag assigned.
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.
- populate_children(deep=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
Parameters: 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.
Parameters: tag – string containing the tag to assign to this object
- set_node_id(node)¶
Sets the router id of the object :param node: String containing the node id
- set_router_id(rid)¶
Sets the router id of the object :param rid: String containing the router id
- classmethod subscribe(session)¶
Subscribe to events from the APIC that pertain to instances of this class.
Parameters: session – the instance of Session used for APIC communication
- 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
- class acitoolkit.acitoolkit.OutsideEPG(epg_name, parent=None)¶
Bases: acitoolkit.acitoolkit.CommonEPG
Represents the EPG for external connectivity
Parameters: - epg_name – String containing the name of this OutsideEPG
- parent – Instance of the Tenant class representing the tenant owning this OutsideEPG.
- 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)¶
Add context to the EPG
Parameters: context – Instance of Context class to assign to this L3Interface.
- 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
- attach(item)¶
Attach the object to the other object.
Parameters: item – Object to be attached.
- consume(contract)¶
Make this EPG consume a Contract
Parameters: contract – Contract class instance to be consumed by this EPG. Returns: True
- 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_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_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, tenant)¶
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')¶
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')¶
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()¶
Get all of the Contracts consumed by this EPG
Returns: List of Contract objects that are consumed by the EPG.
- get_all_provided()¶
Get all of the Contracts provided by this EPG
Returns: List of Contract objects that are provided by the EPG.
- 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)¶
Gets all instances of this class from the APIC and gets all of the children as well.
Parameters: - full_data –
- working_data –
- parent –
- 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
- 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 OutsideEPG
Returns: json dictionary of OutsideEPG
- get_parent()¶
Returns: Parent of this object.
Get the tags assigned to this object.
Returns: List of tag strings
- 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 assigned
Returns: True or False. True if a Context has been assigned to this L3Interface.
- 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)¶
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_tag(tag)¶
Checks whether this object has a particular tag assigned.
Parameters: tag – string containing the tag Returns: True or False. True indicates the object has this tag assigned.
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.
- populate_children(deep=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
Parameters: deep – True or False. Default is False.
- 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.
Parameters: tag – string containing the tag to assign to this object
- classmethod subscribe(session)¶
Subscribe to events from the APIC that pertain to instances of this class.
Parameters: session – the instance of Session used for APIC communication
- 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
- class acitoolkit.acitoolkit.PortChannel(name)¶
Bases: acitoolkit.acitoolkit.BaseInterface
This class defines a port channel interface.
- 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
- attach(interface)¶
Attach an interface to this PortChannel
- detach(interface)¶
Detach an interface from this PortChannel
- 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 port channel interfaces from the APIC
- get_all_attached(attached_class, status='attached')¶
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')¶
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_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)¶
Gets all instances of this class from the APIC and gets all of the children as well.
Parameters: - full_data –
- working_data –
- parent –
- 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
- 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 PortChannel
Returns: json dictionary of the PortChannel
- get_parent()¶
Returns: Parent of this object.
- get_port_channel_selector_json(port_name)¶
- get_port_selector_json()¶
Get the tags assigned to this object.
Returns: List of tag strings
- static get_url(fmt='json')¶
Get the URLs used to push the configuration to the APIC if no format parameter is specified, the format will be ‘json’ otherwise it will return ‘/api/mo/uni.’ with the format string appended. :param fmt: optional format string, default is ‘json’ :returns: URL string
- 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)¶
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_tag(tag)¶
Checks whether this object has a particular tag assigned.
Parameters: tag – string containing the tag Returns: True or False. True indicates the object has this tag assigned.
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.
- is_interface()¶
Returns True since a PortChannel is an interface
- is_vpc()¶
Returns True if the PortChannel is a VPC
- mark_as_deleted()¶
Mark the object as deleted. This will cause the JSON status to be set to deleted.
- populate_children(deep=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
Parameters: 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.
Parameters: tag – string containing the tag to assign to this object
- classmethod subscribe(session)¶
Subscribe to events from the APIC that pertain to instances of this class.
Parameters: session – the instance of Session used for APIC communication
- 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
- class acitoolkit.acitoolkit.Search¶
Bases: acitoolkit.acibaseobject.BaseACIObject
This is an empty class used to create a search object for use with the “find” method.
Attaching attributes to this class and then invoking find will return all objects with matching attributes in the object hierarchy at and below where the find is invoked.
- 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
- attach(item)¶
Attach the object to the other object.
Parameters: item – Object to be attached.
- 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)¶
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.
- get_all_attached(attached_class, status='attached')¶
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')¶
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_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)¶
Gets all instances of this class from the APIC and gets all of the children as well.
Parameters: - full_data –
- working_data –
- parent –
- 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
- 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 the tags assigned to this object.
Returns: List of tag strings
- 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)¶
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_tag(tag)¶
Checks whether this object has a particular tag assigned.
Parameters: tag – string containing the tag Returns: True or False. True indicates the object has this tag assigned.
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.
- populate_children(deep=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
Parameters: 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.
Parameters: tag – string containing the tag to assign to this object
- classmethod subscribe(session)¶
Subscribe to events from the APIC that pertain to instances of this class.
Parameters: session – the instance of Session used for APIC communication
- 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
- class acitoolkit.acitoolkit.Subnet(subnet_name, parent=None)¶
Bases: acitoolkit.acibaseobject.BaseACIObject
Subnet : roughly equivalent to fvSubnet
Parameters: - subnet_name – String containing the name of this Subnet instance.
- parent – An instance of BridgeDomain class representing the BridgeDomain which contains this Subnet.
- 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
- attach(item)¶
Attach the object to the other object.
Parameters: item – Object to be attached.
- 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, bridgedomain, tenant)¶
Gets all of the Subnets from the APIC for a particular tenant and bridgedomain.
Parameters: - session – the instance of Session used for APIC communication
- bridgedomain – the instance of BridgeDomain used to limit the Subnet instances retreived from the APIC
- tenant – the instance of Tenant used to limit the Subnet instances retreived from the APIC
Returns: List of Subnet objects
- 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')¶
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')¶
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_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)¶
Gets all instances of this class from the APIC and gets all of the children as well.
Parameters: - full_data –
- working_data –
- parent –
- 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
- 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 subnet
Returns: json dictionary of subnet
- get_parent()¶
Returns: Parent of this object.
Get the tags assigned to this object.
Returns: List of tag strings
- 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)¶
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_tag(tag)¶
Checks whether this object has a particular tag assigned.
Parameters: tag – string containing the tag Returns: True or False. True indicates the object has this tag assigned.
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.
- populate_children(deep=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
Parameters: 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.
Parameters: tag – string containing the tag to assign to this object
- set_addr(addr)¶
Set the subnet address
Parameters: addr – The subnet address as a string in the form of <ipaddr>/<mask>
- classmethod subscribe(session)¶
Subscribe to events from the APIC that pertain to instances of this class.
Parameters: session – the instance of Session used for APIC communication
- 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
- class acitoolkit.acitoolkit.Taboo(contract_name, parent=None)¶
Bases: acitoolkit.acitoolkit.BaseContract
Taboo : Class for 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
- attach(item)¶
Attach the object to the other object.
Parameters: item – Object to be attached.
- 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)¶
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.
- get_all_attached(attached_class, status='attached')¶
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')¶
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_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)¶
Gets all instances of this class from the APIC and gets all of the children as well.
Parameters: - full_data –
- working_data –
- parent –
- 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
- 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 the tags assigned to this object.
Returns: List of tag strings
- 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)¶
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_tag(tag)¶
Checks whether this object has a particular tag assigned.
Parameters: tag – string containing the tag Returns: True or False. True indicates the object has this tag assigned.
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.
- populate_children(deep=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
Parameters: 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.
Parameters: tag – string containing the tag to assign to this object
- set_scope(scope)¶
Set the scope of this contract. Valid values are ‘context’, ‘global’, ‘tenant’, and ‘application-profile’
- classmethod subscribe(session)¶
Subscribe to events from the APIC that pertain to instances of this class.
Parameters: session – the instance of Session used for APIC communication
- 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
- class acitoolkit.acitoolkit.Tenant(name, parent=None)¶
Bases: acitoolkit.acibaseobject.BaseACIObject
The Tenant class is used to represent the tenants within the acitoolkit object model. In the APIC model, this class is roughly equivalent to the fvTenant class.
Constructor initializes the basic object and should be called by the init routines of inheriting subclasses.
Parameters: - name – String containing the name of the object instance
- parent – Parent object within the acitoolkit object model.
- 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
- attach(item)¶
Attach the object to the other object.
Parameters: item – Object to be attached.
- 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.
- classmethod exists(session, tenant)¶
Check if a tenant exists on the APIC.
Parameters: - session – the instance of Session used for APIC communication
- tenant – the instance of Tenant to check if exists on the APIC
Returns: True or False
- 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 tenants from the APIC.
Parameters: session – the instance of Session used for APIC communication Returns: a list of Tenant objects
- get_all_attached(attached_class, status='attached')¶
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')¶
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_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(session, names=[])¶
- 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
- 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 the tags assigned to this object.
Returns: List of tag strings
- static get_url(fmt='json')¶
Get the URL used to push the configuration to the APIC if no format parameter is specified, the format will be ‘json’ otherwise it will return ‘/api/mo/uni.’ with the format string appended.
Parameters: fmt – optional format string, default is ‘json’ Returns: URL string
- 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)¶
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_tag(tag)¶
Checks whether this object has a particular tag assigned.
Parameters: tag – string containing the tag Returns: True or False. True indicates the object has this tag assigned.
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.
- populate_children(deep=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
Parameters: deep – True or False. Default is False.
- push_to_apic(session)¶
Push the appropriate configuration to the APIC for this Tenant. All of the subobject configuration will also be pushed.
Parameters: session – the instance of Session used for APIC communication Returns: Requests Response code
- 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.
Parameters: tag – string containing the tag to assign to this object
- classmethod subscribe(session)¶
Subscribe to events from the APIC that pertain to instances of this class.
Parameters: session – the instance of Session used for APIC communication
- 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
- class acitoolkit.acitoolkit.VMM(name, ipaddr, credentials, vswitch_info, network_pool)¶
Bases: acitoolkit.acibaseobject.BaseACIObject
This class defines an instance of connectivity to a Virtual Machine Manager (such as VMware vCenter)
- 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
- attach(item)¶
Attach the object to the other object.
Parameters: item – Object to be attached.
- 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)¶
- get_all_attached(attached_class, status='attached')¶
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')¶
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_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)¶
Gets all instances of this class from the APIC and gets all of the children as well.
Parameters: - full_data –
- working_data –
- parent –
- 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
- 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_parent()¶
Returns: Parent of this object.
Get the tags assigned to this object.
Returns: List of tag strings
- 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)¶
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_tag(tag)¶
Checks whether this object has a particular tag assigned.
Parameters: tag – string containing the tag Returns: True or False. True indicates the object has this tag assigned.
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.
- populate_children(deep=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
Parameters: 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.
Parameters: tag – string containing the tag to assign to this object
- classmethod subscribe(session)¶
Subscribe to events from the APIC that pertain to instances of this class.
Parameters: session – the instance of Session used for APIC communication
- 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
- class acitoolkit.acitoolkit.VMMCredentials(name, uid, pwd)¶
Bases: acitoolkit.acibaseobject.BaseACIObject
This class defines the credentials used to login to a Virtual Machine Manager
- 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
- attach(item)¶
Attach the object to the other object.
Parameters: item – Object to be attached.
- 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)¶
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.
- get_all_attached(attached_class, status='attached')¶
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')¶
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_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)¶
Gets all instances of this class from the APIC and gets all of the children as well.
Parameters: - full_data –
- working_data –
- parent –
- 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
- 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_parent()¶
Returns: Parent of this object.
Get the tags assigned to this object.
Returns: List of tag strings
- 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)¶
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_tag(tag)¶
Checks whether this object has a particular tag assigned.
Parameters: tag – string containing the tag Returns: True or False. True indicates the object has this tag assigned.
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.
- populate_children(deep=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
Parameters: 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.
Parameters: tag – string containing the tag to assign to this object
- classmethod subscribe(session)¶
Subscribe to events from the APIC that pertain to instances of this class.
Parameters: session – the instance of Session used for APIC communication
- 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
- class acitoolkit.acitoolkit.VMMvSwitchInfo(vendor, container_name, vswitch_name)¶
Bases: object
This class contains the information necessary for creating the vSwitch on the Virtual Machine Manager