02-09-2023 04:11 PM
I have noticed an inconsistency between the IP addresses of devices in my inventory file and the IP addresses used by Cisco DNA Center to monitor these devices. This is causing communication issues as DNA Center is unable to reach the devices due to incorrect IP addresses. I am seeking a way to update the IP addresses in DNA Center to match those in my master inventory file, which has the correct IP addresses and device names. However, I have not found an API endpoint that allows me to do this in the DNA Center API documentation. The "Sync Devices" section appears to only allow for changing the IP addresses on the actual devices, but not in DNA Center. Can anyone help me identify the appropriate API endpoint or provide any alternative solutions to achieve what I want to do?
BTW i am using ansible
02-15-2023 06:20 AM - edited 02-15-2023 06:21 AM
Hi, i want to do something similar. I want to change/update netconf port of a device.
iam using dnacentersdk
from dnacentersdk import api
def UpdateDeviceParameters(DevId):
dev = dnac.devices.sync_devices(
ipAddress=["10.26.68.253"],
netconfPort='830',
type="NETWORK_DEVICE")
print (dev)
pass
I get a response back
{'response': {'taskId': '84f1ba0f-86b0-485c-9793-0183d6deb70d', 'url': '/api/v1/task/84f1ba0f-86b0-485c-9793-0183d6deb70d'}, 'version': '1.0'}
But the device is not updating the port to 830. I have tired to add device ID in to the call as shown below. That did not help either.
Can someone help plz
def UpdateDeviceParameters(DevId):
dev = dnac.devices.sync_devices(
ipAddress=["10.26.68.253"],
id=DevId,
netconfPort='830',
type="NETWORK_DEVICE")
print (dev)
pass
03-06-2023 06:51 AM
Found the solution.
You need to have all these in the json body
def ChangeNetconf(DeviceIP,newIP):
resp = dnac.devices.sync_devices(
type="NETWORK_DEVICE",
computeDevice=False,
snmpVersion="v3",
snmpMode="AUTHPRIV",
snmpAuthProtocol="SHA",
snmpAuthPassphrase="xxx",
snmpPrivProtocol="AES128",
snmpPrivPassphrase="xxx",
snmpUserName="snmpv",
snmpROCommunity="NO!$DATA!$",
snmpRWCommunity="NO!$DATA!$",
snmpRetry=-1,
snmpTimeout= -1,
cliTransport="NO!$DATA!$",
userName="NO!$DATA!$",
password="NO!$DATA!$",
enablePassword="NO!$DATA!$",
netconfPort="830",
ipAddress=[DeviceIP],
updateMgmtIPaddressList=[{"existMgmtIpAddress":DeviceIP,"newMgmtIpAddress":newIP}]
)
###########
These are required to make any changes to netconf or management ip
cliTransport (string, required)
enablePassword (string, required)
ipAddress (array<string>, required)
password (string, required)
snmpAuthPassphrase (string, required)
snmpAuthProtocol (string, required)
snmpMode (string, required)
snmpPrivPassphrase (string, required)
snmpPrivProtocol (string, required)
snmpROCommunity (string, required)
snmpRWCommunity (string, required)
snmpRetry (integer, required)
snmpTimeout (integer, required)
snmpUserName (string, required)
username (string, required)
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide