Debian Codegraph @

docs/labs/lab03-configlet-management/assign_configlet_to_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
10 requests.packages.urllib3.disable_warnings()
11
12 # Create connection to CloudVision
13 clnt = CvpClient()
14 clnt.connect(nodes=['cvp1'], username="username",password="password")
15
16 configletName = 'cvprac_example2'
17
18 device_name = "tp-avd-leaf1"
19 device = clnt.api.get_device_by_name(device_name)
20
21 configlet = clnt.api.get_configlet_by_name(configletName)
22
23 clnt.api.apply_configlets_to_device("", device, [configlet])