cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1206
Views
0
Helpful
1
Replies

Subscribe to specific path on cdb

sfloresk
Cisco Employee
Cisco Employee

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

 

 

 

 

1 Accepted Solution

Accepted Solutions

sfloresk
Cisco Employee
Cisco Employee

It can be done using yang push - IETF RFC 8641

View solution in original post

1 Reply 1

sfloresk
Cisco Employee
Cisco Employee

It can be done using yang push - IETF RFC 8641

Polls
AI-powered tools for network troubleshooting are likely to be part of everyone’s workflow sooner or later. What is the single biggest challenge or concern you see with adopting these tools in your organization?