"from ncclient import manager
host = 'sandbox-iosxr-1.cisco.com'
port = 830 # Default NETCONF port
username = 'admin'
password = 'C1sco12345'
# Define the filter for the NETCONF request using IETF interfaces model
netconf_filter = """
<filter>
<interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces">
<interface>
<ipv4 xmlns="urn:ietf:params:xml:ns:yang:ietf-ip"/>
<ipv6 xmlns="urn:ietf:params:xml:ns:yang:ietf-ip"/>
</interface>
</interfaces>
</filter>
"""
# Connect to the device using ncclient
with manager.connect(
host=host,
port=port,
username=username,
password=password,
hostkey_verify=False,
device_params={'name': 'iosxr'}, # Specify device type as 'iosxr'
look_for_keys=False,
allow_agent=False,
timeout=10) as m:
# Send the NETCONF <get> request with the specified filter
response = m.get(filter=('subtree', netconf_filter)).xml
# Print the XML response
print(response)"
I get the following output:
"/usr/bin/python3 "/Users/amac/Documents/VSCode/Netw
ork Managment/gRPC test/netconf2.py"
<?xml version="1.0"?>
<rpc-reply message-id="urn:uuid:10bf5ab2-64d8-42b2-af2b-4a6358237888" xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<data/>
</rpc-reply>"
cannot retrieve any "data",
Any help is appreciated