CiscoDevNet / yang-explorer

An open-source Yang Browser and RPC Builder Application
Apache License 2.0
438 stars 177 forks source link

XMLSyntaxError when using bbf yang models #53

Closed lvdh1 closed 7 years ago

lvdh1 commented 7 years ago

When trying to generate a RPC to retrieve net-date rate from the bbf-fast-channel-performance-body.yang file I get a "HTTP request error"

I use the yang files available in : https://github.com/YangModels/yang/tree/master/standard/bbf

bb_fast_line

Looking at the logs it seems that there is an issue with the namespace : XMLSyntaxError: Namespace prefix bbf-fast on line is not defined, line 7, column 15

E&mode=rpc HTTP/1.1" 200 364 INFO:explorer.views:request_handler: Received Request: (rpc) [28/Jan/2017 13:55:17] ERROR [django.request] Internal Server Error: /explorer/netconf Traceback (most recent call last): File "/opt/yang-explorer/v/lib/python2.7/site-packages/django/core/handlers/base.py", line 132, in get_response response = wrapped_callback(request, *callback_args, *callback_kwargs) File "/opt/org_yang-explorer/server/explorer/views.py", line 230, in request_handler reply_xml = Adapter.gen_rpc(request.user.username, req) File "/opt/org_yang-explorer/server/explorer/utils/adapter.py", line 160, in gen_rpc return ET.fromstring(rpc, parser=ET.XMLParser(remove_blank_text=True)) File "lxml.etree.pyx", line 3103, in lxml.etree.fromstring (src/lxml/lxml.etree.c:70569) File "parser.pxi", line 1828, in lxml.etree._parseMemoryDocument (src/lxml/lxml.etree.c:106403) File "parser.pxi", line 1716, in lxml.etree._parseDoc (src/lxml/lxml.etree.c:105194) File "parser.pxi", line 1086, in lxml.etree._BaseParser._parseDoc (src/lxml/lxml.etree.c:99876) File "parser.pxi", line 580, in lxml.etree._ParserContext._handleParseResultDoc (src/lxml/lxml.etree.c:94350) File "parser.pxi", line 690, in lxml.etree._handleParseResult (src/lxml/lxml.etree.c:95786) File "parser.pxi", line 620, in lxml.etree._raiseParseError (src/lxml/lxml.etree.c:94853) XMLSyntaxError: Namespace prefix bbf-fast on line is not defined, line 7, column 15 ERROR:django.request:Internal Server Error: /explorer/netconf Traceback (most recent call last): File "/opt/yang-explorer/v/lib/python2.7/site-packages/django/core/handlers/base.py", line 132, in get_response response = wrapped_callback(request, callback_args, **callback_kwargs) File "/opt/org_yang-explorer/server/explorer/views.py", line 230, in request_handler reply_xml = Adapter.gen_rpc(request.user.username, req) File "/opt/org_yang-explorer/server/explorer/utils/adapter.py", line 160, in gen_rpc return ET.fromstring(rpc, parser=ET.XMLParser(remove_blank_text=True)) File "lxml.etree.pyx", line 3103, in lxml.etree.fromstring (src/lxml/lxml.etree.c:70569) File "parser.pxi", line 1828, in lxml.etree._parseMemoryDocument (src/lxml/lxml.etree.c:106403) File "parser.pxi", line 1716, in lxml.etree._parseDoc (src/lxml/lxml.etree.c:105194) File "parser.pxi", line 1086, in lxml.etree._BaseParser._parseDoc (src/lxml/lxml.etree.c:99876) File "parser.pxi", line 580, in lxml.etree._ParserContext._handleParseResultDoc (src/lxml/lxml.etree.c:94350) File "parser.pxi", line 690, in lxml.etree._handleParseResult (src/lxml/lxml.etree.c:95786) File "parser.pxi", line 620, in lxml.etree._raiseParseError (src/lxml/lxml.etree.c:94853) XMLSyntaxError: Namespace prefix bbf-fast on line is not defined, line 7, column 15

Restconf is able to generate the correct url, specifying all the namespaces , following namespace bbf-fast:line/bbf-fast:channel are in the path restconf

The RPC that should be build is :

rpc_that_should_be_build

I can generate RPC up to the level of urn:bbf:yang:bbf-fastdsl, but 1 layer/container deeper I always get the namespace issues.

Any suggestion on where the root cause could be found ? Or what I can do to get more info for this issue.

Thanks

lvdh1 commented 7 years ago

The issue was caused due to problems with utf-8 conversion when extracting the yang files from the BBF repo