cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
185
Views
0
Helpful
0
Replies

How to set metadata on a device config (refcount and backpointer)

Nicolas3
Level 1
Level 1

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:

Captura.PNG

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?

0 Replies 0