02-27-2024 10:06 AM
Hi everyone,
We need a way to set or modify refcounts on some configurations due to some migrations we are doing.
There is a _ncs.maapi.get_attrs() that gets metadata from a config that works great, we are having trouble making the _ncs.maapi.set_attr() operation:
We are doing the following on ipython to test:
#1 - Get Hkeypath from an existing service.
val = _ncs.maapi.get_attrs(m.msock, t.th, [], '/devices/device{TC2471-LAB-02}/config/cisco-ios-xr:prefix-set{CLIENTES_CORPO_GPON_NSO}')
pypath = kpath[0].as_pyval()
#2 - Create _ncs.Value objects for refcount and backref / type C_OBJECTREF(34), type C_INT32(12)
refcount = _ncs.Value(1 , 12)
backref = _ncs.Value(pypath , 34)
#3 - Set backpointer
_ncs.maapi.set_attr(m.msock, t.th, 2147483651, backref,'/devices/device{TC2471-LAB-02}/config/cisco-ios-xr:prefix-set{CLIENTES_CORPO_TC2471-GP-99}')
#4 -Set refcount
_ncs.maapi.set_attr(m.msock, t.th, 2147483650, refcount,'/devices/device{TC2471-LAB-02}/config/cisco-ios-xr:prefix-set{CLIENTES_CORPO_TC2471-GP-99}')
Both set_attr command fails with:
Error: item has a bad/wrong type (5): Not a valid value
Any ideas what we are doing wrong?
06-07-2024 02:13 PM
I am in the same boat, I did not have any luck with the python/confd_lib path. Here is where I am at,
I haven't fully tested all cases and haven't settled on this solution just yet, but it's the best solution I have thus far...
06-26-2024 01:32 PM
I know you have reasons to do so, but you should NOT modify the refcount/backpointer directly.
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