Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue in runner.py [ lines 104-120 ] - Unable to Parse RPC replies from Junos19.2 #121

Open
SauravMar opened this issue Jun 11, 2020 · 0 comments

Comments

@SauravMar
Copy link

I have been trying to use yang-explorer with Juniper MX series router with Junos version 19.2.

Steps:

  • Manage Models -> Select Device Profile

Output:

  • UI shows a dialog box displaying "Something went wrong, returned errored response !!"
  • In the server logs, I am getting:

ERROR:django.request:Internal Server Error: /explorer/schema
Traceback (most recent call last):
File "/xxx/yang-explorer/v/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 132, in get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/xxx/yang-explorer/server/explorer/views.py", line 297, in schema_handler
return get_schema(request, req)
File "/xxx/yang-explorer/server/explorer/utils/schema.py", line 70, in get_schema
xml = Adapter.run_netconf(request.user.username, device, rpc_xml)
File "/xxx/yang-explorer/server/explorer/utils/adapter.py", line 113, in run_netconf
return session.run(rpc, lock)
File "/xxx/yang-explorer/server/explorer/utils/runner.py", line 105, in run
response = self.handle.get(data).xml

AttributeError: 'NCElement' object has no attribute 'xml'

Root Cause:

  • RPC replies from Junos does not contain XML attribute.

Fix:

  • Instead of response = self.handle.<get,get_config,edit_config,dispatch>(data).xml, we can put a try-except block:
    try:
    response = self.handle.<get,get_config,edit_config,dispatch>(data).xml
    except:
    response = str(self.handle.<get,get_config,edit_config,dispatch>(data))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant