Question

Updating MGMT IP via API

  • 17 January 2022
  • 4 replies
  • 53 views

I am trying to see if there is a why to update/change the management IP of devices via API calls. I’ve looked over the documentation online and can’t find it or it doesn’t exist. Thanks

NetBrain-REST-API-R10


4 replies

Userlevel 3
Badge

Hi @BrettM 

maybe you are looking for this: https://github.com/NetBrainAPI/NetBrain-REST-API-R10/blob/master/REST%20APIs%20Documentation/Shared%20Device%20Setting%20Management/Update%20device%20basic%20settings%20API.md
“This API is used to update device basic settings in current domain. The response of this API will return a list in JSON format.”

Unfortunately, this one does not come with example code. @Gerry.zhang Maybe you can have a look at this? Thanks.

Thanks Carsten, That is what I ended up using. However I get the message that MGMT IP is not editable.

 

---

Set device attribute failed! - {"statusCode":792000,"statusDescription":"The attribute 'mgmtIP' cannot be edited."}

Userlevel 2
Badge

@BrettM  Sorry for the delay. I am checking the API status with Automation team.  There is an alternative way to do it via Plugin. This plugin is used to identify the management interface of each device and update the corresponding interface property. You can edit the Benchmark Task and add the prefered LAN segment as the Management IP, see below.

 

 

Hope it helps.

Userlevel 2
Badge

@BrettM  @Carsten.Schmidt   Please see the sample code below:

 

import requests

import json

 

url = "http://10.10.14.189/ServicesAPI/API/V1/CMDB/SharedDeviceSettings/BasicSetting"

 

payload = json.dumps({

  "HostName": "BJ_L2_Core_6",

  "ManageIp": "172.24.255.62"

})

headers = {

  'Content-Type': 'application/json',

  'Accept': 'application/json',

  'token': '8d1a5a4f-ba97-4f4a-9bd0-b06697b1a230'

}

 

response = requests.request("PUT", url, headers=headers, data=payload)

 

print(response.text)

 

Thanks,

Gerry

Reply


Community |  Ideas

Facebook |  Instagram |  Youtube |  Twitter |  LinkedIn
Privacy & Security Statement  |  Terms & Conditions |  Impressum  |  UK Modern Slavery Statement