Skip to main content

aci communication helper class

Project description

aciClient

A python wrapper to the Cisco ACI REST-API.

Python Version

We support Python 3.6 and up. Python 2 is not supported and there is no plan to add support for it.

Installation

pip install aciclient

Installation for Developing

git clone https://github.com/netcloud/aciclient.git
pip install -r requirements.txt
python setup.py develop

Usage

Initialisation

Username/password

import aciClient
import logging

logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)

aciclient = aciClient.ACI(apic_hostname, apic_username, apic_password)
try:
    aciclient.login()
    
    aciclient.getJson(uri)
    aciclient.postJson(config)
    aciclient.deleteMo(dn)
    
    aciclient.logout()
except Exception as e:
    logger.exception("Stack Trace")
    

Certificate/signature

import aciClient
import logging

logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)

aciclient = aciClient.ACICert(apic_hostname, path_to_privatekey_file, certificate_dn)

try:
    aciclient.getJson(uri)
    aciclient.postJson(config)
    aciclient.deleteMo(dn)
except Exception as e:
    logger.exception("Stack Trace")

Examples

get config

tenants = aciclient.getJson('class/fvTenant.json?order-by=fvTenant.dn|asc')

for mo in tenants:
    print(f'tenant DN: {mo["fvTenant"]["attributes"]["dn"]}')

post config

config = {
 "fvTenant": {
  "attributes": {
   "dn": "uni/tn-XYZ"
  }
 }
}

aciclient.postJson(config)

delete MOs

aciclient.deleteMo('uni/tn-XYZ')

Testing

pip install -r requirements.txt
python -m pytest

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to this project.

Authors

  • Marcel Zehnder - Initial work
  • Andreas Graber - Migration to open source
  • Richard Strnad - Paginagtion for large requests, various small stuff

License

This project is licensed under MIT - see the LICENSE.md file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aciClient-1.2.tar.gz (5.8 kB view details)

Uploaded Source

File details

Details for the file aciClient-1.2.tar.gz.

File metadata

  • Download URL: aciClient-1.2.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1

File hashes

Hashes for aciClient-1.2.tar.gz
Algorithm Hash digest
SHA256 25504430afc955291e0587ff6381590efd27ff8d3bfebf8824af98630de679a5
MD5 95eeea7885b67b0bf80343248593d27a
BLAKE2b-256 d306f6b280d14630525e65b0094284e87010a342f9e4053f33fef7f348186211

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page