| 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 |
clnt = CvpClient() |
| 13 |
clnt.connect(nodes=['cvp1'], username="username",password="password") |
| 14 |
|
| 15 |
configletNames = ['tp-avd_tp-avd-leaf1','vlan144','api_models'] |
| 16 |
|
| 17 |
device_name = "tp-avd-leaf1" |
| 18 |
device = clnt.api.get_device_by_name(device_name) |
| 19 |
|
| 20 |
configlets = [] |
| 21 |
|
| 22 |
for name in configletNames: |
| 23 |
configlets.append(clnt.api.get_configlet_by_name(name)) |
| 24 |
|
| 25 |
# Apply configlets in the order specified in the list |
| 26 |
clnt.api.apply_configlets_to_device("", device, configlets, reorder_configlets=True) |