11-04-2020 01:44 PM
Hello,
Is there a way to subscribe to a specific path in the cdb using netconf? For example, this code works, but returns all changes
import ncclient.manager
m = ncclient.manager.connect_ssh(host="localhost",
port=2022,
username="****",
password="***",
hostkey_verify=False,
timeout=120, look_for_keys=False)
m.create_subscription(stream_name="NETCONF")
print('Listening notifications from NSO (stream ncs-events)')
while True:
# This will block until a notification is received because
# we didn't pass a timeout or block=False
n = m.take_notification()
print(n.notification_xml)
When I try to create the same subscription, but only for devices with xpath filter:
import ncclient.manager
m = ncclient.manager.connect_ssh(host="localhost",
port=2022,
username="****",
password="*****",
hostkey_verify=False,
timeout=120, look_for_keys=False)
m.create_subscription(stream_name="NETCONF", filter=("xpath","/devices/device"))
print('Listening notifications from NSO (stream ncs-events)')
while True:
n = m.take_notification()
print(n.notification_xml)
I get the following error:
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/p0:create-subscription\n ', 'message': None}
Thank you
Solved! Go to Solution.
11-04-2020 02:04 PM
It can be done using yang push - IETF RFC 8641
11-04-2020 02:04 PM
It can be done using yang push - IETF RFC 8641
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide