11-22-2021 03:25 PM
Hello,
I am getting following error while trying to use the filter for netconf in Python. Please help to make corrections:
m = manager.connect(host="sandbox-iosxe-latest-1.cisco.com", port=830, username="developer", password="C1sco12345", hostkey_verify=False)
m.connected
True
loop777 = m.get_config("running")
filt_lo777 = """
<filter>
<interfaces xmlns="http://openconfig.net/yang/interfaces">
<interface>
<name>Loopback777</name>
</interface>
</interfaces>
</filter>
"""
loopb_777 = m.get_config("running", filt_lo777)
Traceback (most recent call last):
File "<pyshell#131>", line 1, in <module>
loopb_777 = m.get_config("running", filt_lo777)
File "C:\automation\netconf\lib\site-packages\ncclient\manager.py", line 246, in execute
return cls(self._session,
File "C:\automation\netconf\lib\site-packages\ncclient\operations\retrieve.py", line 166, in request
return self._request(node)
ncclient.operations.rpc.RPCError: {'type': 'protocol', 'tag': 'unknown-element', 'app_tag': None, 'severity': 'error', 'info': '<?xml version="1.0" encoding="UTF-8"?><error-info xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"><bad-element>filter</bad-element>\n</error-info>\n', 'path': '\n /rpc/get-config\n ', 'message': None}
Solved! Go to Solution.
11-23-2021 04:25 AM
@sqambera i get this error on the sandbox too, switch your hostname to the other XE always-on sandbox and run this again.
with manager.connect(host = "sandbox-iosxe-recomm-1.cisco.com", port = 830, username = "developer", password = "C1sco12345", hostkey_verify = False) as m:
11-23-2021 04:25 AM
@sqambera i get this error on the sandbox too, switch your hostname to the other XE always-on sandbox and run this again.
with manager.connect(host = "sandbox-iosxe-recomm-1.cisco.com", port = 830, username = "developer", password = "C1sco12345", hostkey_verify = False) as m:
11-23-2021 12:09 PM
Thank you so much for nailing it down. Changing the host made it work. Really appreciate your help.
Qamber
Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: