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

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

 

1 Accepted Solution

Accepted Solutions

tcragg1
Cisco Employee
Cisco Employee

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

tcragg1
Cisco Employee
Cisco Employee

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'.