aciphysobject module¶
API Reference¶
ACI Toolkit module for physical objects
- class acitoolkit.aciphysobject.BaseACIPhysModule(pod, node, slot, parent=None)¶
Bases: acitoolkit.aciphysobject.BaseACIPhysObject
BaseACIPhysModule: base class for modules
Initialize the basic object. This should be called by the init routines of inheriting subclasses.
Parameters: - pod – pod id of module
- node – node id of module
- slot – slot id of module
- parent – optional parent object
- add_child(child_obj)¶
Add a child to the children list. All children must be unique so it will first delete the child if it already exists.
Parameters: child_obj – a child object to be added as a child to this object. This will be put into the _children list. Returns: None
- add_tag(tag)¶
Assign this object a particular tag. Tags are strings that can be used to classify objects. More than 1 tag can be assigned to an object.
Parameters: tag – string containing the tag to assign to this object
- 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, phys_obj)¶
Check if an apic phys_obj exists on the APIC. Returns True if the phys_obj does exist.
Parameters: - session – APIC session to use when accessing the APIC controller.
- phys_obj – The object that you are checking for.
Returns: True if the phys_obj exists, False if it does not.
- 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(childType=None)¶
Returns the list of children. If childType is provided, then it will return all of the children of the matching type.
Parameters: childType – This optional parameter will cause this method to return only those children that match the type of childType. If this parameter is ommitted, then all of the children will be returned. Returns: list of children
- 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 object
Returns: JSON of contained Interfaces
- get_name()¶
Gets name.
Returns: Name string
- get_node()¶
Gets node id
Returns: id of node
- classmethod get_obj(session, apic_class, parent)¶
Gets all of the Nodes from the APIC. This is called by the module specific get() methods. The parameters passed include the APIC object class, apic_class, so that this will work for different kinds of modules.
Parameters: - session – APIC session to use when retrieving the nodes
- apic_class – The object class in APIC to retrieve
- parent – The parent object of this object
Returns: list of module objects derived from the specified apic_class
- get_parent()¶
Returns: Parent of this object.
- get_pod()¶
Gets pod_id :returns: id of pod
- get_serial()¶
Returns the serial number. :returns: serial number string
- get_slot()¶
Gets slot id
Returns: slot id
Get the tags assigned to this object.
Returns: List of tag strings
- get_type()¶
Gets physical object type
Returns: type string of the object.
- get_url(fmt='json')¶
Get the URL used to push the configuration to the APIC if no fmt parameter is specified, the format will be ‘json’ otherwise it will return ‘/api/mo/uni.’ with the fmt string appended.
Parameters: fmt – optional fmt string Returns: Nothing - physical objects are not modifiable
- 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.aciphysobject.BaseACIPhysObject(name, parent=None)¶
Bases: acitoolkit.acibaseobject.BaseACIObject
Base class for physical objects
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(child_obj)¶
Add a child to the children list. All children must be unique so it will first delete the child if it already exists.
Parameters: child_obj – a child object to be added as a child to this object. This will be put into the _children list. Returns: None
- add_tag(tag)¶
Assign this object a particular tag. Tags are strings that can be used to classify objects. More than 1 tag can be assigned to an object.
Parameters: tag – string containing the tag to assign to this object
- 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, phys_obj)¶
Check if an apic phys_obj exists on the APIC. Returns True if the phys_obj does exist.
Parameters: - session – APIC session to use when accessing the APIC controller.
- phys_obj – The object that you are checking for.
Returns: True if the phys_obj exists, False if it does not.
- 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(childType=None)¶
Returns the list of children. If childType is provided, then it will return all of the children of the matching type.
Parameters: childType – This optional parameter will cause this method to return only those children that match the type of childType. If this parameter is ommitted, then all of the children will be returned. Returns: list of children
- 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 object
Returns: JSON of contained Interfaces
- get_name()¶
Gets name.
Returns: Name string
- get_node()¶
Gets node id
Returns: id of node
- get_parent()¶
Returns: Parent of this object.
- get_pod()¶
Gets pod_id :returns: id of pod
- get_serial()¶
Gets serial number.
Returns: serial number string
Get the tags assigned to this object.
Returns: List of tag strings
- get_type()¶
Gets physical object type
Returns: type string of the object.
- get_url(fmt='json')¶
Get the URL used to push the configuration to the APIC if no fmt parameter is specified, the format will be ‘json’ otherwise it will return ‘/api/mo/uni.’ with the fmt string appended.
Parameters: fmt – optional fmt string Returns: Nothing - physical objects are not modifiable
- 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.aciphysobject.ENode(attributes, session=None, parent=None)¶
Bases: acitoolkit.aciphysobject.Node
External Node. This class is for switch nodes that are connected to the pod, but are not ACI nodes, i.e. are not under control of the APIC. Examples would be external layer 2 switches, external routers, or hypervisor based switches.
This class will look as much as possible like the Node class recognizing that not as much information is available to the APIC about them as is available about ACI nodes. Nearly all of the information used to create this class comes from LLDP.
- add_child(child_obj)¶
Add a child to the children list. All children must be unique so it will first delete the child if it already exists.
Parameters: child_obj – a child object to be added as a child to this object. This will be put into the _children list. Returns: None
- add_tag(tag)¶
Assign this object a particular tag. Tags are strings that can be used to classify objects. More than 1 tag can be assigned to an object.
Parameters: tag – string containing the tag to assign to this object
- 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, phys_obj)¶
Check if an apic phys_obj exists on the APIC. Returns True if the phys_obj does exist.
Parameters: - session – APIC session to use when accessing the APIC controller.
- phys_obj – The object that you are checking for.
Returns: True if the phys_obj exists, False if it does not.
- 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, parent=None)¶
Gets all of the loose nodes from the APIC.
Parameters: - session – APIC session
- parent – optional parent object of type Topology
Returns: list of ENodes
- getFabricSt()¶
retrieves the fabric state.
Returns: fabric state
- getName()¶
Gets name.
Returns: Name string
- getRole()¶
retrieves the node role :returns: role
- 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_chassisType()¶
Returns the chassis type of this node. The chassis type is derived from the model number. This is a chassis type that is compatible with Cisco’s Cable Plan XML.
Returns: chassis type of node of type str
- get_children(childType=None)¶
Returns the list of children. If childType is provided, then it will return all of the children of the matching type.
Parameters: childType – This optional parameter will cause this method to return only those children that match the type of childType. If this parameter is ommitted, then all of the children will be returned. Returns: list of children
- 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 object
Returns: JSON of contained Interfaces
- get_model()¶
Returns the model string of the node’
Returns: model of node of type str
- get_name()¶
Gets name.
Returns: Name string
- get_node()¶
Gets node id
Returns: id of node
- get_parent()¶
Returns: Parent of this object.
- get_pod()¶
Gets pod_id :returns: id of pod
- get_role()¶
retrieves the node role :returns: role
- get_serial()¶
Gets serial number.
Returns: serial number string
Get the tags assigned to this object.
Returns: List of tag strings
- get_type()¶
Gets physical object type
Returns: type string of the object.
- get_url(fmt='json')¶
Get the URL used to push the configuration to the APIC if no fmt parameter is specified, the format will be ‘json’ otherwise it will return ‘/api/mo/uni.’ with the fmt string appended.
Parameters: fmt – optional fmt string Returns: Nothing - physical objects are not modifiable
- 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)¶
Will populate all of the children modules such as linecards, fantrays and powersupplies, of the node.
Parameters: deep – boolean that when true will cause the entire sub-tree to be populated when false, only the immediate children are populated Returns: None
- 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.aciphysobject.Fantray(pod, node, slot, parent=None)¶
Bases: acitoolkit.aciphysobject.BaseACIPhysModule
Class for the fan tray of a node
Initialize the basic object. It will create the name of the fan tray and set the type before calling the base class __init__ method :param pod: pod id :param node: node id :param slot: slot id :param parent: optional parent object
- add_child(child_obj)¶
Add a child to the children list. All children must be unique so it will first delete the child if it already exists.
Parameters: child_obj – a child object to be added as a child to this object. This will be put into the _children list. Returns: None
- add_tag(tag)¶
Assign this object a particular tag. Tags are strings that can be used to classify objects. More than 1 tag can be assigned to an object.
Parameters: tag – string containing the tag to assign to this object
- 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, phys_obj)¶
Check if an apic phys_obj exists on the APIC. Returns True if the phys_obj does exist.
Parameters: - session – APIC session to use when accessing the APIC controller.
- phys_obj – The object that you are checking for.
Returns: True if the phys_obj exists, False if it does not.
- 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)¶
Gets all of the fantrays from the APIC. If parent is specified, it will only get fantrays that are children of the the parent. The fantrays will also be added as children to the parent Node.
The fantray object is derived mostly from the APIC ‘eqptFt’ class.
Parameters: - session – APIC session
- parent – optional parent switch of class Node
Returns: list of fantrays
- 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(childType=None)¶
Returns the list of children. If childType is provided, then it will return all of the children of the matching type.
Parameters: childType – This optional parameter will cause this method to return only those children that match the type of childType. If this parameter is ommitted, then all of the children will be returned. Returns: list of children
- 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 object
Returns: JSON of contained Interfaces
- get_name()¶
Gets name.
Returns: Name string
- get_node()¶
Gets node id
Returns: id of node
- classmethod get_obj(session, apic_class, parent)¶
Gets all of the Nodes from the APIC. This is called by the module specific get() methods. The parameters passed include the APIC object class, apic_class, so that this will work for different kinds of modules.
Parameters: - session – APIC session to use when retrieving the nodes
- apic_class – The object class in APIC to retrieve
- parent – The parent object of this object
Returns: list of module objects derived from the specified apic_class
- get_parent()¶
Returns: Parent of this object.
- get_pod()¶
Gets pod_id :returns: id of pod
- get_serial()¶
Returns the serial number. :returns: serial number string
- get_slot()¶
Gets slot id
Returns: slot id
Get the tags assigned to this object.
Returns: List of tag strings
- get_type()¶
Gets physical object type
Returns: type string of the object.
- get_url(fmt='json')¶
Get the URL used to push the configuration to the APIC if no fmt parameter is specified, the format will be ‘json’ otherwise it will return ‘/api/mo/uni.’ with the fmt string appended.
Parameters: fmt – optional fmt string Returns: Nothing - physical objects are not modifiable
- 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 of the fantray. Since the fantray has no children, this will return none.
Parameters: deep – boolean that when true will cause the entire sub-tree to be populated when false, only the immediate children are populated Returns: None
- 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.aciphysobject.Linecard(arg0=None, arg1=None, slot=None, parent=None)¶
Bases: acitoolkit.aciphysobject.BaseACIPhysModule
class for a linecard of a switch
Initialize the basic object. It will create the name of the linecard and set the type before calling the base class __init__ method. If arg1 is an instance of a Node, then pod, and node are derived from the Node and the slot_id is from arg0. If arg1 is not a Node, then arg0 is the pod, arg1 is the node id, and slot is the slot_id
In other words, this Linecard object can either be initialized by
>>> lc = Linecard(slot_id, parent_switch)
or
>>> lc = Linecard(pod_id, node_id, slot_id)
or
>>> lc = Linecard(pod_id, node_id, slot_id, parent_switch)
Parameters: - arg0 – pod_id if arg1 is a node_id, slot_id if arg1 is of type Node
- arg1 – node_id string or parent Node of type Node
- slot – slot_id if arg1 is node_id Not required if arg1 is a Node
- parent – parent switch of type Node. Not required if arg1 is used instead.
Returns: None
- add_child(child_obj)¶
Add a child to the children list. All children must be unique so it will first delete the child if it already exists.
Parameters: child_obj – a child object to be added as a child to this object. This will be put into the _children list. Returns: None
- add_tag(tag)¶
Assign this object a particular tag. Tags are strings that can be used to classify objects. More than 1 tag can be assigned to an object.
Parameters: tag – string containing the tag to assign to this object
- 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, phys_obj)¶
Check if an apic phys_obj exists on the APIC. Returns True if the phys_obj does exist.
Parameters: - session – APIC session to use when accessing the APIC controller.
- phys_obj – The object that you are checking for.
Returns: True if the phys_obj exists, False if it does not.
- 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)¶
Gets all of the linecards from the APIC. If parent is specified, it will only get linecards that are children of the the parent. The linecards will also be added as children to the parent Node.
The lincard object is derived mostly from the APIC ‘eqptLC’ class.
Parameters: - session – APIC session
- parent – optional parent of class Node
Returns: list of linecards
- 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(childType=None)¶
Returns the list of children. If childType is provided, then it will return all of the children of the matching type.
Parameters: childType – This optional parameter will cause this method to return only those children that match the type of childType. If this parameter is ommitted, then all of the children will be returned. Returns: list of children
- 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 object
Returns: JSON of contained Interfaces
- get_name()¶
Gets name.
Returns: Name string
- get_node()¶
Gets node id
Returns: id of node
- classmethod get_obj(session, apic_class, parent)¶
Gets all of the Nodes from the APIC. This is called by the module specific get() methods. The parameters passed include the APIC object class, apic_class, so that this will work for different kinds of modules.
Parameters: - session – APIC session to use when retrieving the nodes
- apic_class – The object class in APIC to retrieve
- parent – The parent object of this object
Returns: list of module objects derived from the specified apic_class
- get_parent()¶
Returns: Parent of this object.
- get_pod()¶
Gets pod_id :returns: id of pod
- get_serial()¶
Returns the serial number. :returns: serial number string
- get_slot()¶
Gets slot id
Returns: slot id
Get the tags assigned to this object.
Returns: List of tag strings
- get_type()¶
Gets physical object type
Returns: type string of the object.
- get_url(fmt='json')¶
Get the URL used to push the configuration to the APIC if no fmt parameter is specified, the format will be ‘json’ otherwise it will return ‘/api/mo/uni.’ with the fmt string appended.
Parameters: fmt – optional fmt string Returns: Nothing - physical objects are not modifiable
- 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 of the linecard. Children are the interfaces. If deep is set to true, it will also try to populate the children of the children.
Parameters: deep – boolean that when true will cause the entire sub-tree to be populated when false, only the immediate children are populated Returns: None
- 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.aciphysobject.Link(pod, link, node1, slot1, port1, node2, slot2, port2, parent=None)¶
Bases: acitoolkit.aciphysobject.BaseACIPhysObject
Link class, equivalent to the fabricLink object in APIC
Parameters: - pod – pod id
- link – link id
- node1 – id of node of port at first end of link
- slot1 – id of slot (linecard) of port at first end of link
- port1 – id of port at first end of link
- node2 – id of node of port at second end of link
- slot2 – id of slot (linecard) of port at second end of link
- port2 – id of port at second end of link
- parent – optional parent object
- add_child(child_obj)¶
Add a child to the children list. All children must be unique so it will first delete the child if it already exists.
Parameters: child_obj – a child object to be added as a child to this object. This will be put into the _children list. Returns: None
- add_tag(tag)¶
Assign this object a particular tag. Tags are strings that can be used to classify objects. More than 1 tag can be assigned to an object.
Parameters: tag – string containing the tag to assign to this object
- 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, phys_obj)¶
Check if an apic phys_obj exists on the APIC. Returns True if the phys_obj does exist.
Parameters: - session – APIC session to use when accessing the APIC controller.
- phys_obj – The object that you are checking for.
Returns: True if the phys_obj exists, False if it does not.
- 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, parent=None)¶
Gets all of the Links from the APIC. If the parent pod is specified, only links of that pod will be retrieved.
Parameters: - session – APIC session
- parent – Optional parent Pod object
Returns: list of links
- 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(childType=None)¶
Returns the list of children. If childType is provided, then it will return all of the children of the matching type.
Parameters: childType – This optional parameter will cause this method to return only those children that match the type of childType. If this parameter is ommitted, then all of the children will be returned. Returns: list of children
- 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 object
Returns: JSON of contained Interfaces
- get_linkstatus()¶
Gets the link status
Returns: link status string
- get_name()¶
Gets name.
Returns: Name string
- get_node()¶
Gets node id
Returns: id of node
- get_node1()¶
Returns the Node object that corresponds to the first node of the link. The Node must be a child of the Pod that this link is a member of, i.e. it must already have been read from the APIC. This can most easily be done by populating the entire physical heirarchy from the Pod down.
Returns: Node object at first end of link
- get_node2()¶
Returns the Node object that corresponds to the second node of the link. The Node must be a child of the Pod that this link is a member of, i.e. it must already have been read from the APIC. This can most easily be done by populating the entire physical heirarchy from the Pod down.
Returns: Node object at second end of link
- get_parent()¶
Returns: Parent of this object.
- get_pod()¶
Gets pod_id :returns: id of pod
- get_port1()¶
Returns the Linecard object that corresponds to the first port of the link. The port must be a child of the Linecard in the Node in the Pod that this link is a member of, i.e. it must already have been read from the APIC. This can most easily be done by populating the entire physical heirarchy from the Pod down.
Returns: Interface object at first end of link
- get_port2()¶
Returns the Linecard object that corresponds to the second port of the link. The port must be a child of the Linecard in the Node in the Pod that this link is a member of, i.e. it must already have been read from the APIC. This can most easily be done by populating the entire physical heirarchy from the Pod down.
Returns: Interface object at second end of link
- get_serial()¶
Gets serial number.
Returns: serial number string
- get_slot1()¶
Returns the Linecard object that corresponds to the first slot of the link. The Linecard must be a child of the Node in the Pod that this link is a member of, i.e. it must already have been read from the APIC. This can most easily be done by populating the entire physical heirarchy from the Pod down.
Returns: Linecard object at first end of link
- get_slot2()¶
Returns the Linecard object that corresponds to the second slot of the link. The Linecard must be a child of the Node in the Pod that this link is a member of, i.e. it must already have been read from the APIC. This can most easily be done by populating the entire physical heirarchy from the Pod down.
Returns: Linecard object at second end of link
Get the tags assigned to this object.
Returns: List of tag strings
- get_type()¶
Gets physical object type
Returns: type string of the object.
- get_url(fmt='json')¶
Get the URL used to push the configuration to the APIC if no fmt parameter is specified, the format will be ‘json’ otherwise it will return ‘/api/mo/uni.’ with the fmt string appended.
Parameters: fmt – optional fmt string Returns: Nothing - physical objects are not modifiable
- 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.aciphysobject.Node(pod=None, node=None, name=None, role=None, parent=None)¶
Bases: acitoolkit.aciphysobject.BaseACIPhysObject
Node : roughly equivalent to eqptNode
Parameters: - pod – String representation of the pod number
- node – String representation of the node number
- name – Name of the node
- role – Role of the node. Valid roles are None, ‘spine’, ‘leaf’, ‘controller’, ‘loosenode’
- parent – Parent pod object of the node.
- add_child(child_obj)¶
Add a child to the children list. All children must be unique so it will first delete the child if it already exists.
Parameters: child_obj – a child object to be added as a child to this object. This will be put into the _children list. Returns: None
- add_tag(tag)¶
Assign this object a particular tag. Tags are strings that can be used to classify objects. More than 1 tag can be assigned to an object.
Parameters: tag – string containing the tag to assign to this object
- 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, phys_obj)¶
Check if an apic phys_obj exists on the APIC. Returns True if the phys_obj does exist.
Parameters: - session – APIC session to use when accessing the APIC controller.
- phys_obj – The object that you are checking for.
Returns: True if the phys_obj exists, False if it does not.
- 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, parent=None)¶
Gets all of the Nodes from the APIC. If the parent pod is specified, only nodes of that pod will be retrieved.
Parameters: - session – APIC session
- parent – optional parent object
Returns: list of Nodes
- getFabricSt()¶
retrieves the fabric state.
Returns: fabric state
- 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_chassisType()¶
Returns the chassis type of this node. The chassis type is derived from the model number. This is a chassis type that is compatible with Cisco’s Cable Plan XML.
Returns: chassis type of node of type str
- get_children(childType=None)¶
Returns the list of children. If childType is provided, then it will return all of the children of the matching type.
Parameters: childType – This optional parameter will cause this method to return only those children that match the type of childType. If this parameter is ommitted, then all of the children will be returned. Returns: list of children
- 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 object
Returns: JSON of contained Interfaces
- get_model()¶
Returns the model string of the node’
Returns: model of node of type str
- get_name()¶
Gets name.
Returns: Name string
- get_node()¶
Gets node id
Returns: id of node
- get_parent()¶
Returns: Parent of this object.
- get_pod()¶
Gets pod_id :returns: id of pod
- get_role()¶
retrieves the node role :returns: role
- get_serial()¶
Gets serial number.
Returns: serial number string
Get the tags assigned to this object.
Returns: List of tag strings
- get_type()¶
Gets physical object type
Returns: type string of the object.
- get_url(fmt='json')¶
Get the URL used to push the configuration to the APIC if no fmt parameter is specified, the format will be ‘json’ otherwise it will return ‘/api/mo/uni.’ with the fmt string appended.
Parameters: fmt – optional fmt string Returns: Nothing - physical objects are not modifiable
- 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)¶
Will populate all of the children modules such as linecards, fantrays and powersupplies, of the node.
Parameters: deep – boolean that when true will cause the entire sub-tree to be populated when false, only the immediate children are populated Returns: None
- 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.aciphysobject.Pod(pod_id, attributes={}, parent=None)¶
Bases: acitoolkit.aciphysobject.BaseACIPhysObject
Pod : roughly equivalent to fabricPod
Initialize the basic object. It will create the name of the pod and set the type before calling the base class __init__ method. Typically the pod_id will be 1.
Parameters: - pod_id – pod id string
- attributes –
- parent – optional parent object
- add_child(child_obj)¶
Add a child to the children list. All children must be unique so it will first delete the child if it already exists.
Parameters: child_obj – a child object to be added as a child to this object. This will be put into the _children list. Returns: None
- add_tag(tag)¶
Assign this object a particular tag. Tags are strings that can be used to classify objects. More than 1 tag can be assigned to an object.
Parameters: tag – string containing the tag to assign to this object
- 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, phys_obj)¶
Check if an apic phys_obj exists on the APIC. Returns True if the phys_obj does exist.
Parameters: - session – APIC session to use when accessing the APIC controller.
- phys_obj – The object that you are checking for.
Returns: True if the phys_obj exists, False if it does not.
- 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 Pods from the APIC. Generally there will be only one.
Parameters: session – APIC session Returns: list of Pods. Note that this will be a list even though there typically will only be one item in the list.
- 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(childType=None)¶
Returns the list of children. If childType is provided, then it will return all of the children of the matching type.
Parameters: childType – This optional parameter will cause this method to return only those children that match the type of childType. If this parameter is ommitted, then all of the children will be returned. Returns: list of children
- 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 object
Returns: JSON of contained Interfaces
- get_name()¶
Gets name.
Returns: Name string
- get_node()¶
Gets node id
Returns: id of node
- get_parent()¶
Returns: Parent of this object.
- get_pod()¶
Gets pod_id :returns: id of pod
- get_serial()¶
Gets serial number.
Returns: serial number string
Get the tags assigned to this object.
Returns: List of tag strings
- get_type()¶
Gets physical object type
Returns: type string of the object.
- get_url(fmt='json')¶
Get the URL used to push the configuration to the APIC if no fmt parameter is specified, the format will be ‘json’ otherwise it will return ‘/api/mo/uni.’ with the fmt string appended.
Parameters: fmt – optional fmt string Returns: Nothing - physical objects are not modifiable
- 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)¶
This will cause all of children of the pod to be gotten from the APIC and populated as children of the pod.
If deep is set to True, it will populate the entire tree.
This method returns nothing.
Parameters: deep – boolean that when true will cause the entire sub-tree to be populated when false, only the immediate children are populated Returns: None
- 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.aciphysobject.Powersupply(pod, node, slot, parent=None)¶
Bases: acitoolkit.aciphysobject.BaseACIPhysModule
class for a power supply in a node
Initialize the basic object. It will create the name of the powersupply and set the type before calling the base class __init__ method :param pod: pod id :param node: node id :param slot: slot id :param parent: optional parent object
- add_child(child_obj)¶
Add a child to the children list. All children must be unique so it will first delete the child if it already exists.
Parameters: child_obj – a child object to be added as a child to this object. This will be put into the _children list. Returns: None
- add_tag(tag)¶
Assign this object a particular tag. Tags are strings that can be used to classify objects. More than 1 tag can be assigned to an object.
Parameters: tag – string containing the tag to assign to this object
- 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, phys_obj)¶
Check if an apic phys_obj exists on the APIC. Returns True if the phys_obj does exist.
Parameters: - session – APIC session to use when accessing the APIC controller.
- phys_obj – The object that you are checking for.
Returns: True if the phys_obj exists, False if it does not.
- 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)¶
Gets all of the power supplies from the APIC. If parent is specified, it will only get power supplies that are children of the the parent. The power supplies will also be added as children to the parent Node.
The Powersupply object is derived mostly from the APIC ‘eqptPsu’ class.
Parameters: - session – APIC session
- parent – optional parent switch of class Node
Returns: list of powersupplies
- 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(childType=None)¶
Returns the list of children. If childType is provided, then it will return all of the children of the matching type.
Parameters: childType – This optional parameter will cause this method to return only those children that match the type of childType. If this parameter is ommitted, then all of the children will be returned. Returns: list of children
- 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 object
Returns: JSON of contained Interfaces
- get_name()¶
Gets name.
Returns: Name string
- get_node()¶
Gets node id
Returns: id of node
- classmethod get_obj(session, apic_class, parent)¶
Gets all of the Nodes from the APIC. This is called by the module specific get() methods. The parameters passed include the APIC object class, apic_class, so that this will work for different kinds of modules.
Parameters: - session – APIC session to use when retrieving the nodes
- apic_class – The object class in APIC to retrieve
- parent – The parent object of this object
Returns: list of module objects derived from the specified apic_class
- get_parent()¶
Returns: Parent of this object.
- get_pod()¶
Gets pod_id :returns: id of pod
- get_serial()¶
Returns the serial number. :returns: serial number string
- get_slot()¶
Gets slot id
Returns: slot id
Get the tags assigned to this object.
Returns: List of tag strings
- get_type()¶
Gets physical object type
Returns: type string of the object.
- get_url(fmt='json')¶
Get the URL used to push the configuration to the APIC if no fmt parameter is specified, the format will be ‘json’ otherwise it will return ‘/api/mo/uni.’ with the fmt string appended.
Parameters: fmt – optional fmt string Returns: Nothing - physical objects are not modifiable
- 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 of the power supply. Since the power supply has no children, this will return none.
Parameters: deep – boolean that when true will cause the entire sub-tree to be populated when false, only the immediate children are populated Returns: None
- 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.aciphysobject.Supervisorcard(pod, node, slot, parent=None)¶
Bases: acitoolkit.aciphysobject.BaseACIPhysModule
Class representing the supervisor card of a switch
Initialize the basic object. This should be called by the init routines of inheriting subclasses.
Parameters: - pod – pod id
- node – node id
- slot – slot id
- parent – optional parent object
- add_child(child_obj)¶
Add a child to the children list. All children must be unique so it will first delete the child if it already exists.
Parameters: child_obj – a child object to be added as a child to this object. This will be put into the _children list. Returns: None
- add_tag(tag)¶
Assign this object a particular tag. Tags are strings that can be used to classify objects. More than 1 tag can be assigned to an object.
Parameters: tag – string containing the tag to assign to this object
- 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, phys_obj)¶
Check if an apic phys_obj exists on the APIC. Returns True if the phys_obj does exist.
Parameters: - session – APIC session to use when accessing the APIC controller.
- phys_obj – The object that you are checking for.
Returns: True if the phys_obj exists, False if it does not.
- 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)¶
Gets all of the supervisor cards from the APIC. If parent is specified, it will only get the supervisor card that is a child of the the parent Node. The supervisor will also be added as a child to the parent Node.
The Supervisorcard object is derived mostly from the APIC ‘eqptSupC’ class.
Parameters: - session – APIC session
- parent – optional parent switch of class Node
Returns: list of linecards
- 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(childType=None)¶
Returns the list of children. If childType is provided, then it will return all of the children of the matching type.
Parameters: childType – This optional parameter will cause this method to return only those children that match the type of childType. If this parameter is ommitted, then all of the children will be returned. Returns: list of children
- 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 object
Returns: JSON of contained Interfaces
- get_name()¶
Gets name.
Returns: Name string
- get_node()¶
Gets node id
Returns: id of node
- classmethod get_obj(session, apic_class, parent)¶
Gets all of the Nodes from the APIC. This is called by the module specific get() methods. The parameters passed include the APIC object class, apic_class, so that this will work for different kinds of modules.
Parameters: - session – APIC session to use when retrieving the nodes
- apic_class – The object class in APIC to retrieve
- parent – The parent object of this object
Returns: list of module objects derived from the specified apic_class
- get_parent()¶
Returns: Parent of this object.
- get_pod()¶
Gets pod_id :returns: id of pod
- get_serial()¶
Returns the serial number. :returns: serial number string
- get_slot()¶
Gets slot id
Returns: slot id
Get the tags assigned to this object.
Returns: List of tag strings
- get_type()¶
Gets physical object type
Returns: type string of the object.
- get_url(fmt='json')¶
Get the URL used to push the configuration to the APIC if no fmt parameter is specified, the format will be ‘json’ otherwise it will return ‘/api/mo/uni.’ with the fmt string appended.
Parameters: fmt – optional fmt string Returns: Nothing - physical objects are not modifiable
- 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.aciphysobject.Systemcontroller(pod, node, slot, parent=None)¶
Bases: acitoolkit.aciphysobject.BaseACIPhysModule
class of the motherboard of the APIC controller node
Initialize the basic object. It will create the name of the Systemcontroller and set the type before calling the base class __init__ method.
Parameters: - pod – pod id
- node – node id
- slot – slot id
- parent – optional parent object
- add_child(child_obj)¶
Add a child to the children list. All children must be unique so it will first delete the child if it already exists.
Parameters: child_obj – a child object to be added as a child to this object. This will be put into the _children list. Returns: None
- add_tag(tag)¶
Assign this object a particular tag. Tags are strings that can be used to classify objects. More than 1 tag can be assigned to an object.
Parameters: tag – string containing the tag to assign to this object
- 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, phys_obj)¶
Check if an apic phys_obj exists on the APIC. Returns True if the phys_obj does exist.
Parameters: - session – APIC session to use when accessing the APIC controller.
- phys_obj – The object that you are checking for.
Returns: True if the phys_obj exists, False if it does not.
- 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)¶
Gets all of the System controllers from the APIC. This information comes from the APIC ‘eqptBoard’ class.
If parent is specified, it will only get system controllers that are children of the the parent. The system controlles will also be added as children to the parent Node.
Parameters: - session – APIC session
- parent – parent Node
Returns: list of Systemcontrollers
- 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(childType=None)¶
Returns the list of children. If childType is provided, then it will return all of the children of the matching type.
Parameters: childType – This optional parameter will cause this method to return only those children that match the type of childType. If this parameter is ommitted, then all of the children will be returned. Returns: list of children
- 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 object
Returns: JSON of contained Interfaces
- get_name()¶
Gets name.
Returns: Name string
- get_node()¶
Gets node id
Returns: id of node
- classmethod get_obj(session, apic_class, parent)¶
Gets all of the Nodes from the APIC. This is called by the module specific get() methods. The parameters passed include the APIC object class, apic_class, so that this will work for different kinds of modules.
Parameters: - session – APIC session to use when retrieving the nodes
- apic_class – The object class in APIC to retrieve
- parent – The parent object of this object
Returns: list of module objects derived from the specified apic_class
- get_parent()¶
Returns: Parent of this object.
- get_pod()¶
Gets pod_id :returns: id of pod
- get_serial()¶
Returns the serial number. :returns: serial number string
- get_slot()¶
Gets slot id
Returns: slot id
Get the tags assigned to this object.
Returns: List of tag strings
- get_type()¶
Gets physical object type
Returns: type string of the object.
- get_url(fmt='json')¶
Get the URL used to push the configuration to the APIC if no fmt parameter is specified, the format will be ‘json’ otherwise it will return ‘/api/mo/uni.’ with the fmt string appended.
Parameters: fmt – optional fmt string Returns: Nothing - physical objects are not modifiable
- 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
Future Work¶
Future work items to be added to aciphysobject include:
- Add an events sub-object. This would work similarly to the stats object.
- Add a top level object called Topology that would have Pod as its child. This object would also contain devices attached to the fabric, so called loose nodes, external links, and discovered end-points.