Debian Codegraph @

docs/labs/lab06-provisioning/move_device.py

raw
1 # Copyright (c) 2021 Arista Networks, Inc.
2 # Use of this source code is governed by the Apache License 2.0
3 # that can be found in the COPYING file.
4
5 from cvprac.cvp_client import CvpClient
6 import ssl
7 ssl._create_default_https_context = ssl._create_unverified_context
8 import requests.packages.urllib3
9 requests.packages.urllib3.disable_warnings()
10
11 # Create connection to CloudVision
12 with open("token.tok") as f:
13 token = f.read().strip('\n')
14
15 clnt = CvpClient()
16 clnt.connect(nodes=['cvp1'], username='',password='',api_token=token)
17
18 container = clnt.api.get_container_by_name('TP_LEAFS') # container object
19
20 app_name = "my app" # can be any string
21
22 device = {"key":"00:1c:73:c5:4c:87", "fqdn":"co633.ire.aristanetworks.com"}
23
24 move_device_to_container(app_name, device, container)