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]

The MoDirectory class creates a connection to the APIC and the MIT. MoDirectory requires an existing session and endpoint.

__init__(session)[source]
Parameters:session – Specifies a session
commit(configObject, sync_wait_timeout=None)[source]

Short-form commit operation for a configRequest

exists(dnStrOrDn)[source]

Checks if managed object (MO) with given distinguished name (dn) is present or not

Parameters:dnStrOrDn (str or cobra.mit.naming.Dn) – A distinguished name as a cobra.mit.naming.Dn or string
Returns:True, if MO is present, else False.
Return type:bool
login()[source]

Creates a session to an APIC.

logout()[source]

Ends a session to an APIC.

lookupByClass(classNames, parentDn=None, **queryParams)[source]

A short-form managed object (MO) query by class.

Parameters:
  • classNames – Name of the class to lookup
  • parentDn – dn of the root object were to start search from (optional)
  • queryParams – a dictionary including the properties to the added to the query.
lookupByDn(dnStrOrDn, **queryParams)[source]

A short-form managed object (MO) query using the distinguished name(Dn) of the MO.

Parameters:
  • dnStrOrDn – dn of the object to lookup
  • queryParams – a dictionary including the properties to the added to the query.
query(queryObject)[source]

Queries the MIT for a specified object. The queryObject provides a variety of search options.

reauth()[source]

Re-authenticate this 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.