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 runnetconf
return session.run(rpc, lock)
File "/xxx/yang-explorer/server/explorer/utils/runner.py", line 105, in run
response = self.handle.get(data).xmlAttributeError: '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).xmlexcept:response = str(self.handle.<get,get_config,edit_config,dispatch>(data))
I have been trying to use yang-explorer with Juniper MX series router with Junos version 19.2.
Steps:
Output:
_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 runnetconf 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:
Fix:
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))