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

How to use touch() and "commit reconcile" from python

cnicasio
Level 1
Level 1

Hello

We have to do "commit reconcile" on a set of NSO services from python. We are using:

1) We open a write transaction "t"

2) We do touch in one or several service instances:

root.services.xxx.touch()

3) We do commit reconcile:

cp = ncs.maapi.CommitParams()

cp.reconcile_keep_non_service_config()

t.apply_params(True, cp)

 

However, config reference counts do not change.

If we do the same from the CLI, works perfectly:

 

admin@ncs(config)# services xxx touch

admin@ncs(config)# commit reconcile keep-non-service-config

 

Any ideas?

Regards

 

 

 

5 Replies 5

vleijon
Cisco Employee
Cisco Employee
I feel like it should work. Maybe you should use False instead of true? Do you get anything interested in the return value from apply_params?

Thanks for your answer.

Tried with

t.apply_params(False, cp)

a didn't work again....si really weird.

Regards

 

What does the call return? Any errors there? Anything in devel.log or any of the other logs?

no errors apparently. devel.log and python service log show cb_create() runs...so the touch+commit works, but is not doing the reconcile stuff. Will open a TAC case. In case you have any other suggestion, it will be welcome!

 

Hi, I know this topic is very old and you probably found the issue. Anyway, I wanted to add an answer for those who end up in this post.
From the yang file where the "touch" action is defined, description says: Executing the action touch followed by a commit is the same as executing the action 're-deploy shallow'.

So, if your service is a stacked service, you won't see any reconciliation happening between the lowermost service and the device configuration.