Services Module¶
This module provides an interface to uploading L4-7 device packages to the controller. Refer to the Developing L4-L7 Device Packages document for more information on creating device packages.
Example:
session = cobra.mit.session.LoginSession('https://apic', 'admin',
'password', secure=False)
moDir = cobra.mit.access.MoDirectory(session)
moDir.login()
packageUpload = cobra.services.UploadPackage('asa-device-pkg.zip')
response = moDir.commit(packageUpload)
The following sections describe the classes in the services module.
UploadPackage¶
Class for uploading L4-L7 device packages to APIC
-
class
cobra.services.
UploadPackage
(devicePackagePath, validate=False)[source]¶ Class for uploading L4-L7 device packages to APIC
-
__init__
(devicePackagePath, validate=False)[source]¶ Create an UploadPackage object that can be passed to MoDirectory.commit
Parameters: - devicePackagePath (str) – Path to the device package on the local file system
- validate (bool) – If true, the device package will be validated locally before attempting to upload
-
data
¶ Returns the data this request should post
Returns: string containing contents of device package Return type: str
-
devicePackagePath
¶ Returns the currently configured path to the device package
Returns: Path to the device package on the local file system Return type: str
-
getUrl
(session)[source]¶ Returns the URI this request will access
Parameters: session (cobra.mit.session.AbstractSession) – session object for which the request will be sent
-
requestargs
(session)[source]¶ Returns the POST arguments for this request
Parameters: session (cobra.mit.session.AbstractSession) – session object for which the request will be sent Returns: requests style kwargs that can be passed to request.post() Return type: dict
-