cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
784
Views
0
Helpful
2
Replies

Netconf in Python script

sqambera
Beginner
Beginner

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}

1 Accepted Solution

Accepted Solutions

bigevilbeard
Cisco Employee
Cisco Employee

@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:

View solution in original post

2 Replies 2

bigevilbeard
Cisco Employee
Cisco Employee

@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:

Thank you so much for nailing it down. Changing the host made it work. Really appreciate your help.

 

Qamber

Getting Started

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:

Recognize Your Peers