01-30-2020 01:09 AM
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
Solved! Go to Solution.
01-30-2020 01:25 AM
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'.
01-30-2020 01:25 AM
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'.
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