ntc-rosetta
ntc-rosetta copied to clipboard
Junos Translate/RPC Exception
After translating a Yang model to native config, and then sending the config to a vQFX via Napalm I get the following,
Traceback (most recent call last):
File "/root/rosetta-demo/venv/lib/python3.6/site-packages/jnpr/junos/utils/config.py", line 456, in try_load
**rpc_xattrs)
File "/root/rosetta-demo/venv/lib/python3.6/site-packages/jnpr/junos/rpcmeta.py", line 277, in load_config
return self._junos.execute(rpc, ignore_warning=ignore_warning)
File "/root/rosetta-demo/venv/lib/python3.6/site-packages/jnpr/junos/decorators.py", line 76, in wrapper
return function(*args, **kwargs)
File "/root/rosetta-demo/venv/lib/python3.6/site-packages/jnpr/junos/decorators.py", line 31, in wrapper
return function(*args, **kwargs)
File "/root/rosetta-demo/venv/lib/python3.6/site-packages/jnpr/junos/device.py", line 797, in execute
errs=ex)
jnpr.junos.exception.RpcError: RpcError(severity: error, bad_element: vlan-id, message: error: syntax error
error: syntax error)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/root/rosetta-demo/venv/lib/python3.6/site-packages/napalm/junos/junos.py", line 236, in _load_candidate
ignore_warning=self.ignore_warning,
File "/root/rosetta-demo/venv/lib/python3.6/site-packages/jnpr/junos/utils/config.py", line 539, in load
ignore_warning=ignore_warning)
File "/root/rosetta-demo/venv/lib/python3.6/site-packages/jnpr/junos/utils/config.py", line 460, in try_load
raise ConfigLoadError(cmd=err.cmd, rsp=err.rsp, errs=err.errs)
jnpr.junos.exception.ConfigLoadError: ConfigLoadError(severity: error, bad_element: vlan-id, message: error: syntax error
error: syntax error)
Note: my scripts/code are located within https://github.com/rickdonato/rosetta-demo/tree/master/scripts
The process I follow is:
• create the running-config yang model. scripts/yang-create.py
• create the candidate config yang model. Via modying a copy of the running-config yang.
• obtain the config via nos_driver.merge
scripts/push-config.py`
• A config example that I send it shown below. However, any native config generated by Rosetta results in the exception above.
<configuration>
<vlans>
<vlan delete="delete">
<vlan-id>1000</vlan-id>
</vlan>
<vlan>
<vlan-id>2000</vlan-id>
<name>prod2</name>
<disable delete="delete"/>
</vlan>
</vlans>
</configuration>
• I send this to the device via Napalm but I get the error above.
Any help on this would be appreciated. Everything works great with IOS.
UPDATE: Confirmed working XML via Napalm push. VLANs are slighty different. But it shows main differences...
config = """
<configuration>
<vlans>
<vlan operation="delete">
<name>vlan1020</name>
</vlan>
<vlan operation="create">
<name>prod2</name>
<vlan-id>2000</vlan-id>
</vlan>
</vlans>
</configuration>
"""