Skip to main content

Simple REST-client for Cisco Catalyst Center

Project description

simple_catalyst_center is a simplified REST Client for the Cisco Catalyst Center (formerly known as DNA Center).

Features

simple_catalyst_center has following features:
  • manage login

  • download files

  • wait for task results

  • CRUD interface for all possible API URLs

Installation

Install simple_catalyst_center by running:

pip3 install simple_catalyst_center

Examples

get backup zip file for all devices

from simple_catalyst_center import CiscoCatalystCenterClient
import logging
from getpass import getpass
import secrets
import string

logger = logging.getLogger()
logging.basicConfig(encoding="utf-8", level=logging.INFO)


IP=input("Please Enter Catalyst Center IP: ") or "100.75.2.2"
username=input("Please Enter Catalyst username: ") or "admin"
password=getpass("Please Enter Catalyst password: ") or "not set"
zip_password=input("Please Enter ZIP password: ")
if not zip_password:
    zip_password=''.join((secrets.choice(string.ascii_letters + string.digits + string.punctuation) for i in range(12)))
    print(f"generated zip password is: {zip_password}")


cc = CiscoCatalystCenterClient(f"https://{IP}/", ssl_verify=False)
cc.login(username, password)
api=cc.api
ids=[]

# collect all device ids
for result in api.dna.intent.api.v1("network-device").get(params={"managementIpAddress": ["100.75.1.11"]}):
    ids.append(result["id"])


res=api.dna.intent.api.v1("network-device-archive").cleartext.post(body={
    "deviceId": ids,
    "password": zip_password
})

# download task result, needs task URL and target filename

cc.download(res.get("url"), res.get("taskId") + ".zip")

Contribute

Roadmap

Selected Roadmap items:
  • add more documentation

  • add some more examples

For documentation please refer to https://simple_catalyst_center.readthedocs.io/en/latest/

License

This project is licensed under the Apache License Version 2.0

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

simple_catalyst_center-0.2.4-py3-none-any.whl (15.1 kB view details)

Uploaded Python 3

File details

Details for the file simple_catalyst_center-0.2.4-py3-none-any.whl.

File metadata

File hashes

Hashes for simple_catalyst_center-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 f02cdcb15b0fa1ad56e7dbd846740668841141ae2731fc5dbdc82dbeeafbdc02
MD5 abf158c84a7c18215a04c030ccf7de8e
BLAKE2b-256 18255939f63c1b38bed46bdeed4d179503073281b1c670a864350516b94782ad

See more details on using hashes here.

Supported by

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