11-17-2021 05:29 AM
Hi all,
I wish to the following via the RESTCONF, i can do it via python maapi and the ncs_cli
ncs_cli -
alarms alarm-list alarm ncs package-load-failure /packages/package[name='tailf-hcc'] "" purge
mappi
root.alarms.alarm_list.alarm['ncs', 'al:package-load-failure', "/ncs:packages/ncs:package[ncs:name='tailf-hcc']", ""].purge()
could some one please help translate either of the above in the a RESTCONF request
Thanks
Regards
Yale
11-18-2021 05:54 AM
Hello,
this is how I would address it to figure out the action restconf path "easily" with `| display restconf`. Sadly we cannot used this filter when trying to execute the action.
(I am using 5.6 here):
admin@ncs# show alarms alarm-list alarm ncs package-load-failure /packages/package[name='resource-manager'] "" | display restconf /restconf/data/tailf-ncs-alarms:alarms/alarm-list/alarm=ncs,al%3Apackage-load-failure,%2Fncs%3Apackages%2Fncs%3Apackage%5Bncs%3Aname%3D%27resource-manager%27%5D,""/is-cleared true
[...]
and so the POST RESTCONF call would be:
/restconf/data/tailf-ncs-alarms:alarms/alarm-list/alarm=ncs,al%3Apackage-load-failure,%2Fncs%3Apackages%2Fncs%3Apackage%5Bncs%3Aname%3D%27resource-manager%27%5D,""/purge
Now you have also this very cool package you can install in your development environment that would give you the same answer: https://gitlab.com/nso-developer/rest-api-explorer (make sure to tick the option to display the module names)
11-18-2021 05:57 AM - edited 11-18-2021 05:58 AM
What works now is this:
restconf/operations/tailf-ncs-alarms:alarms/alarm-list/alarm=ncs,package-load-failure,%2Fpackages%2Fpackage%5Bname%3D%27tailf-hcc%27%5D,/purge
This is the url-encoded RESTCONF path to the 'purge' action for that alarm.
Note the last comma - it encodes the last key for the alarm list (ie, the empty string).
Also note that the 'package-load-failure' and the package itself (/packages/package[name='tailf-hcc']) are not namespace qualified. Qualifying them results in an error as of now.
11-18-2021 06:09 AM
Something like the following:
curl -X POST --data '<input></input>' \
"http://localhost:8080/restconf/data/tailf-ncs-alarms:alarms/alarm-list/alarm=ncs,al:package-load-failure,/ncs:packages/ncs:package[ncs:name='tailf-hcc'],/purge"
Note that the following requirements with the alarm keys as in your other
question [0] might apply: urlencode and maybe no prefixes in "managed-object".
[0] https://community.cisco.com/t5/nso-developer-hub-discussions/maapi-to-restconf/m-p/4504186
11-23-2021 04:46 AM
Hallo all,
I have the same issue on nso v5.6
I tried the sollutions you gave to Yale but none of the is working.
Is there anybody that test those solutions and got succesfull response ?
Is there any other solution ?
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