cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1284
Views
5
Helpful
2
Replies

Reading proplist values in a MAAPI script

tcragg1
Cisco Employee
Cisco Employee

Is it possible to read the proplist values for a service inside a MAAPI script? If so, does anyone have a code sample they could share?

2 Replies 2

u.avsec
Spotlight
Spotlight

You mean reading with a script after provisioning?

If you dump the service instance with ncs_load with flags like '-M -U -o' you will see that there is no convenient 'proplist' node.
If I remember proplist does persist so my guess would be that NSO stores proplist in the private/diff-set gibberish under the instance or somewhere else entirely. First is not useful at all, second would be cool to know if true.

markozagozen
Frequent Visitor
Frequent Visitor

Yes, there is a private/property-list/property list in each service instance:

In [2]: with ncs.maapi.single_read_trans('admin', 'python') as t:
   ...:     s = ncs.maagic.get_node(t, '/foo-service{bar}')
   ...:     for p in s.private.property_list.property:
   ...:         print(p.name, p.value)
   ...:
k1 v1
k2 v2
You can also access it in the CLI if you unhide fastmap-private.