Description
Description of Issue/Question
https://github.com/napalm-automation/napalm/blob/develop/napalm/junos/junos.py#L59
In the JunOSDriver()
Constructor, there is no way to use huge_tree
as an optional arg.
ncclient/ncclient#185 in this issue, whenever an xml node is greater than 10,000,000 bytes, an exception is raised lxml.etree.XMLSyntaxError: xmlSAX2Characters: huge text node
To fix this jnpr.junos.device.Device()
introduced a huge_tree
parameter here. Juniper/py-junos-eznc#975
But napalm doesn't support the huge_tree
parameter yet. Due to this, I am seeing the same exception raised whenever I call get_config()
Note: Please check https://guides.github.com/features/mastering-markdown/
to see how to properly format your request.
Did you follow the steps from https://github.com/napalm-automation/napalm#faq
(Place an x
between the square brackets where applicable)
- Yes
- [] No
Setup
napalm version
(Paste verbatim output from pip freeze | grep napalm
between quotes below)
4.10
Network operating system version
(Paste verbatim output from show version
- or equivalent - between quotes below)
Junos 21.2R3-S5.4
Steps to Reproduce the Issue
device.get_config()
Error Traceback
(Paste the complete traceback of the exception between quotes below)
INFO:ncclient.transport.ssh:[host 127.0.0.1 session-id 91995] Received message from host
/Users/arkhatri/.pyenv/versions/olympus/lib/python3.8/site-packages/jnpr/junos/device.py:857: RuntimeWarning: An unknown exception occurred - please report.
warnings.warn(
Traceback (most recent call last):
File "test_junos.py", line 18, in <module>
current_config = device.get_config()
File "/Users/arkhatri/.pyenv/versions/olympus/lib/python3.8/site-packages/olympus_nqa/Device.py", line 1751, in get_config
return executor(retrieve=retrieve)
File "/Users/arkhatri/.pyenv/versions/olympus/lib/python3.8/site-packages/olympus_nqa/Device.py", line 179, in _run
return getattr(self.device, method)(*args, **kwargs)
File "/Users/arkhatri/.pyenv/versions/olympus/lib/python3.8/site-packages/napalm/junos/junos.py", line 2448, in get_config
config = self.device.rpc.get_config(filter_xml=None, options=options)
File "/Users/arkhatri/.pyenv/versions/olympus/lib/python3.8/site-packages/jnpr/junos/rpcmeta.py", line 151, in get_config
response = self._junos.execute(rpc, **kwargs)
File "/Users/arkhatri/.pyenv/versions/olympus/lib/python3.8/site-packages/jnpr/junos/decorators.py", line 76, in wrapper
return function(*args, **kwargs)
File "/Users/arkhatri/.pyenv/versions/olympus/lib/python3.8/site-packages/jnpr/junos/decorators.py", line 31, in wrapper
return function(*args, **kwargs)
File "/Users/arkhatri/.pyenv/versions/olympus/lib/python3.8/site-packages/jnpr/junos/device.py", line 834, in execute
rpc_rsp_e = self._rpc_reply(
File "/Users/arkhatri/.pyenv/versions/olympus/lib/python3.8/site-packages/jnpr/junos/decorators.py", line 117, in wrapper
rsp = function(self, *args, **kwargs)
File "/Users/arkhatri/.pyenv/versions/olympus/lib/python3.8/site-packages/jnpr/junos/device.py", line 1470, in _rpc_reply
return self._conn.rpc(rpc_cmd_e, filter_xml)._NCElement__doc
File "/Users/arkhatri/.pyenv/versions/olympus/lib/python3.8/site-packages/ncclient/manager.py", line 246, in execute
return cls(self._session,
File "/Users/arkhatri/.pyenv/versions/olympus/lib/python3.8/site-packages/ncclient/operations/third_party/juniper/rpc.py", line 52, in request
return self._request(rpc)
File "/Users/arkhatri/.pyenv/versions/olympus/lib/python3.8/site-packages/ncclient/operations/rpc.py", line 365, in _request
self._reply.parse()
File "/Users/arkhatri/.pyenv/versions/olympus/lib/python3.8/site-packages/ncclient/operations/rpc.py", line 161, in parse
root = self._root = to_ele(self._raw, huge_tree=self._huge_tree) # The <rpc-reply> element
File "/Users/arkhatri/.pyenv/versions/olympus/lib/python3.8/site-packages/ncclient/xml_.py", line 129, in to_ele
return x if etree.iselement(x) else etree.fromstring(x.encode('UTF-8'), parser=_get_parser(huge_tree))
File "src/lxml/etree.pyx", line 3257, in lxml.etree.fromstring
File "src/lxml/parser.pxi", line 1916, in lxml.etree._parseMemoryDocument
File "src/lxml/parser.pxi", line 1803, in lxml.etree._parseDoc
File "src/lxml/parser.pxi", line 1144, in lxml.etree._BaseParser._parseDoc
File "src/lxml/parser.pxi", line 618, in lxml.etree._ParserContext._handleParseResultDoc
File "src/lxml/parser.pxi", line 728, in lxml.etree._handleParseResult
File "src/lxml/parser.pxi", line 657, in lxml.etree._raiseParseError
File "<string>", line 496650
lxml.etree.XMLSyntaxError: xmlSAX2Characters: huge text node, line 496650, column 41