05-09-2017 05:08 AM - edited 03-01-2019 03:47 AM
Hello Team,
I have a question about service template in NSO, demo code(python) is as bellow,
@service.create
def cb_create(self, tctx, root, service, proplist):
try:
vars_prefix = ncs.template.Variables()
template = ncs.template.Template(service)
vars_prefix.add("DEVICE",service.device)
vars_prefix.add("PREFIX_NAME",service.prefix_name)
for value in service.prefix_values:
vars_prefix.add("PREFIX_VALUE",value.prefix_value)
template.apply('uptest-prefix', vars_prefix)
service_args = ComposeArgs()
peering_generic_info , peering_unique_attr, peering_links_attr,msg_expection = service_args.validate_args(service)
if msg_expection != ‘’:
raise Exception (“something is wrong”)
except Exception as e:
self.ilogger.rerror(str(e),2)
My question is when I raise Exception, how do I drop applying template ?
Solved! Go to Solution.
05-09-2017 05:09 AM
Hi!
re-throw the exception, then the transaction is aborted and the error message is presented to the user.
05-09-2017 05:09 AM
Hi!
re-throw the exception, then the transaction is aborted and the error message is presented to the user.
05-09-2017 05:09 AM
Thanks , works now.
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