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

Why doesn't proplist in my service persist?

JennyW
Level 1
Level 1

I'd like to persist some data in proplist in my service, in cb_create() I have proplist.append((service.name, str(index)) where index is allocated in cb_create(). The commit was successful. But when the config was updated again, in cb_pre_modification() the proplist became empty:

def cb_create(self, tctx, root, service, proplist):

    if service.profile.index is None:

service.profile.index = self._allocate_index(root)

proplist.append((service.name, str(service.profile.index))

 

def cb_pre_modification(self, tctx, op, kp, root, proplist):

    if op == _ncs.dp.NCS_SERVICE_UPDATE:

service = ncs.maagic.cd(root, kp)

profiles = dict(proplist)

print(profiles)       <-- empty

Wonder if I did anything wrong with proplist, can't find much information in NSO document on proplist.

1 Accepted Solution

Accepted Solutions

snovello
Cisco Employee
Cisco Employee
Hello,,
You need to return the proplist from the create function call for changes to be persisted.

View solution in original post

2 Replies 2

snovello
Cisco Employee
Cisco Employee
Hello,,
You need to return the proplist from the create function call for changes to be persisted.

Aha, that's it, it works now with "return proplist". Thanks!