cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
987
Views
10
Helpful
3
Replies

NSO service template - pre and post check

I want to do pre and postcheck before and after the service creation.

Service creation done using service template YANG, Python and XML.

Is there any option to perform pre and postcheck? 

3 Replies 3

erdemk
Level 1
Level 1

There are more experienced people here, my 2 cents is as follows ..

One way for handling pre-check and post-check for services is by utilizing pre_modification and post_modification decorators.

When you create a service with ncs-make-package utility, you can see them in python code. 

regards..

 

hniska
Cisco Employee
Cisco Employee

Ive got a small example on how to add post checks to your services https://github.com/NSO-developer/selftest

aelganzo
Cisco Employee
Cisco Employee

In nso development doc

there is steps & sample for action handler where you could create action package where you could use it in

$ ncs-make-package --service-skeleton python pyaction --component-class action.Action --action-example

where you could use the below function for post and pre_modification check

 

@service.pre_modification
def cb_pre_modification(self, tctx, op, kp, root, proplist):
     self.log.info('Service premod(service=', kp, ')')

@service.post_modification
def cb_post_modification(self, tctx, op, kp, root, proplist):
     self.log.info('Service premod(service=', kp, ')')