Access Module¶
The access module enables you to maintain network endpoints and manage APIC connections.
The following sections describe the classes in the access module.
MoDirectory¶
Class that creates a connection to the APIC and manage the MIT configuration. MoDirectory enables you to create queries based on the object class, distinguished name, or other properties, and to commit a new configuration. MoDirectory requires an existing session and endpoint.
-
class
cobra.mit.access.
MoDirectory
(session)[source]¶ Creates a connection to the APIC and the MIT.
MoDirectory requires an existing session.
-
__init__
(session)[source]¶ Initialize a MoDirectory instance.
Parameters: session (cobra.mit.session.AbstractSession) – The session
-
commit
(configObject)[source]¶ Commit operation for a request object.
Commit a change on the APIC or fabric node.
Parameters: configObject (cobra.mit.request.AbstractRequest) – The configuration request to commit Returns: The response as a string Return type: str Raises: CommitError
– If no MOs have been added to the config request
-
lookupByClass
(classNames, parentDn=None, **kwargs)[source]¶ Lookup MO’s by class.
A short-form managed object (MO) query by class.
Parameters: - classNames (str or list) – The class name list of class names. If parentDn is set, the classNames are used as a filter in a subtree query for the parentDn
- parentDn (cobra.mit.naming.Dn or str, optional) – The distinguished
name of the parent object as a
cobra.mit.naming.Dn
or string. - **kwargs – Arbitrary parameters to be passed to the query generated internally, to further filter the result
Returns: A list of the managed objects found in the query.
Return type: list
-
lookupByDn
(dnStrOrDn, **kwargs)[source]¶ Query the APIC or fabric node by distinguished name (Dn).
A short-form managed object (MO) query using the Dn of the MO of the MO.
Parameters: - dnStrOrDn (str or cobra.mit.naming.Dn) – A distinguished name as a
cobra.mit.naming.Dn
or string - **kwargs – Arbitrary parameters to be passed to the query generated internally, to further filter the result
Returns: - None if no MO was returned otherwise
Return type: None or cobra.mit.mo.Mo
- dnStrOrDn (str or cobra.mit.naming.Dn) – A distinguished name as a
-
query
(queryObject)[source]¶ Query the Model Information Tree.
The various types of potential queryObjects provide a variety of search options
Parameters: queryObject (cobra.mit.request.AbstractRequest) – A query object Returns: A list of Managed Objects (MOs) returned from the query Return type: list
-
reauth
()[source]¶ Re-authenticate the session with the current authentication cookie.
This method can be used to extend the validity of a successful login credentials. This method may fail if the current session expired on the server side. If this method fails, the user must login again to authenticate and effectively create a new session.
-