| 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(['cvp1'],'username', 'password') |
| 14 |
|
| 15 |
|
| 16 |
data = {"data":[{"info":"Device IP Address Changed", |
| 17 |
"infoPreview":"<b> Device IP Address Changed to 10.83.13.214</b>", |
| 18 |
"action":"associate", |
| 19 |
"nodeType":"ipaddress", |
| 20 |
"nodeId":"", |
| 21 |
"toId":"50:08:00:a7:ca:c3", # MAC of the device |
| 22 |
"fromId":"", |
| 23 |
"nodeName":"", |
| 24 |
"fromName":"", |
| 25 |
"toName":"tp-avd-leaf1", # hostname |
| 26 |
"toIdType":"netelement", |
| 27 |
"nodeIpAddress":"10.83.13.219", # the temporary management IP Address |
| 28 |
"nodeTargetIpAddress":"10.83.13.214" # the final management IP address |
| 29 |
} |
| 30 |
] |
| 31 |
} |
| 32 |
clnt.api._add_temp_action(data) |
| 33 |
|
| 34 |
clnt.api._save_topology_v2([]) |