cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
266
Views
5
Helpful
1
Replies
Highlighted

going template-less

Hi all,

 

currently developing some template-less services and i have encounted this issue, does any one know how to work around this 

escape the 'import' part of the yang model some how ??

 

vrf.rd = mgmt_ip + ':' + vpn_id
vrf.route_target.export.create(asn + ':' + vpn_id)
vrf.route_target.import.create(asn + ':' + vpn_id)

 

<ERROR> 30-Jan-2020::09:07:36.955 svi_fractus MainThread: - Traceback (most recent call last):
File "/opt/ncs/ncs-4.7.2.1/src/ncs/pyapi/ncs_pyvm/startup.py", line 246, in start_components
pname=pname, cname=cname, main_q=self.msg_sink)
File "/opt/ncs/ncs-4.7.2.1/src/ncs/pyapi/ncs_pyvm/ncsthreads.py", line 153, in __init__
mod = __import__(modname)
File "/var/opt/ncs/state/packages-in-use/1/svi_fractus/python/svi_fractus/main.py", line 264
vrf.route_target.import.create(asn + ':' + vpn_id)
^
SyntaxError: invalid syntax

 

Thanks

regards

Yale

 

Everyone's tags (1)
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Cisco Employee

Re: going template-less

If a node name in the YANG model clashes with a python reserved word like import, you should be able to escape it by prepending the namespace name followed by a pair of underscores. So for example if your script is running against devices using the ios-cli NED, you would replace 'import' with 'ios__import'.

View solution in original post

1 REPLY 1
Highlighted
Cisco Employee

Re: going template-less

If a node name in the YANG model clashes with a python reserved word like import, you should be able to escape it by prepending the namespace name followed by a pair of underscores. So for example if your script is running against devices using the ios-cli NED, you would replace 'import' with 'ios__import'.

View solution in original post