Adding upstream version 1.3.1+dfsg.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
455a3d9fdb
commit
d2e39936a0
95 changed files with 10747 additions and 0 deletions
|
@ -0,0 +1,34 @@
|
|||
from cvprac.cvp_client import CvpClient
|
||||
import ssl
|
||||
ssl._create_default_https_context = ssl._create_unverified_context
|
||||
import requests.packages.urllib3
|
||||
requests.packages.urllib3.disable_warnings()
|
||||
|
||||
clnt = CvpClient()
|
||||
clnt.connect(nodes=['cvp1'], username="username",password="password")
|
||||
|
||||
ts = "2021-11-19T15:04:05.0Z" # rfc3339 time
|
||||
uri = "/api/v3/services/compliancecheck.Compliance/GetConfig"
|
||||
|
||||
# Fetch the inventory
|
||||
inventory = clnt.api.get_inventory()
|
||||
|
||||
# Iterate through all devices and get the running-config at the specified time for each device
|
||||
for device in inventory:
|
||||
sn = device['serialNumber']
|
||||
data = {"request":{
|
||||
"device_id": sn,
|
||||
"timestamp": ts,
|
||||
"type":"RUNNING_CONFIG"
|
||||
}
|
||||
}
|
||||
try:
|
||||
resultRunningConfig = clnt.post(uri, data=data)
|
||||
for idx in resultRunningConfig:
|
||||
if 'config' in idx:
|
||||
result = idx['config']
|
||||
break
|
||||
with open(device['hostname']+'.cfg','w') as f:
|
||||
f.write(result)
|
||||
except Exception as e:
|
||||
print("Not able to get configuration for device {} - exception {}".format(device['fqdn'], e))
|
Loading…
Add table
Add a link
Reference in a new issue