Using the ciscoisesdk python script, trying update a description of the NDG
the api ERS is responding with mandatory fields? See within the errors!
Here is the sample script:
===========================
import json
from ciscoisesdk import api
from ciscoisesdk.exceptions import ApiError
from urllib.parse import quote
host = 'my-ise-pan-01'
ise_user = 'ise_ers_user'
ise_password = 'superPass'
api_ = api.IdentityServicesEngineAPI (
username=ise_user,
password=ise_password,
base_url=f"https://{host}",
verify=False
)
try:
### Get the information about existing NDG
res_by_name = api_.network_device_group.get_network_device_group_by_name(name=ndg_to_update).response
ndg_dict = json.loads(json.dumps(res_by_name)) ### python dict
ndg_id = ndg_dict['NetworkDeviceGroup']['id'] ### get the device id
### now trying to update the NDG description
ndg_description_new = quote("Spicy Chicken Nuggets")
update_ndg = api_.network_device_group.update_network_device_group_by_id(ndg_id,description=ndg_description_new).response
print(json.dump(update_ndg, indent=2))
=== ERROR message start ====
[400] - Validation Error - Mandatory fields missing: [name, ndgtype] <<<<< huh? how do I update the ndgtype ( no field )
{
"ERSResponse" : {
"operation" : "PUT-update-networkdevicegroup",
"messages" : [ {
"title" : "Validation Error - Mandatory fields missing: [name, ndgtype]",
"type" : "ERROR",
"code" : "Application resource validation exception"
} ],
"link" : {
"rel" : "related",
"href" : ... [removed],
"type" : "application/xml"
}
}
}
=== ERROR message end ====
### fine, add the name
ndg_name = quote("Location:All Locations:Some Datacenter:Some Datacenter Room")
### try again
update_ndg = api_.network_device_group.update_network_device_group_by_id(ndg_id,description=ndg_description_new, name=ndg_name).response
print(json.dump(update_ndg, indent=2))
=== ERROR message start ====
[400] - Validation Error - Mandatory fields missing: [ndgtype] <<<<< still the same error
{
"ERSResponse" : {
"operation" : "PUT-update-networkdevicegroup",
"messages" : [ {
"title" : "Validation Error - Mandatory fields missing: [ndgtype]",
"type" : "ERROR",
"code" : "Application resource validation exception"
} ],
"link" : {
"rel" : "related",
"href" : removed
"type" : "application/xml"
}
}
}
=== ERROR message end ====
except ApiError as e:
print(e)
===========================