05-28-2020 10:51 AM
I'm sorry if this has been answered somewhere. I've tried looking through the forums first and at the YDK documentation. I'm new to YANG/NETCONF, and I'm not sure if what I want to do is invalid, or if it's just the approach that I'm taking is wrong.
I'd like to get a list of all the Xconnects in the device (cisco_ios_xr::Cisco_IOS_XR_l2vpn_cfg::L2vpn::Database::XconnectGroups).
I have the following snippet of code:
NetconfServiceProvider provider{ip_address, "username", "password", 830}; try { auto filter = make_shared<L2vpn::Database::XconnectGroups>(); CrudService crud_service{}; auto db_read = crud_service.read( provider, *filter ); } ...
With that, I see the following request go out to the device:
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><get xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"> <filter><l2vpn xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-l2vpn-cfg"> <database> <xconnect-groups/> </database> </l2vpn> </filter> </get> </rpc>
This is what I see coming back from the device:
<?xml version="1.0"?> <rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1"> <data> <l2vpn xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-l2vpn-cfg"> <database> <xconnect-groups> <xconnect-group> <name>xcon0</name> <p2p-xconnects> <p2p-xconnect> <name>xc0</name> <attachment-circuits> <attachment-circuit> <name>GigabitEthernet0/0/0/22.1</name> <enable/> </attachment-circuit> </attachment-circuits> <pseudowires> <pseudowire> <pseudowire-id>10</pseudowire-id> <neighbor> <neighbor>10.40.10.10</neighbor> <class>path0</class> </neighbor> </pseudowire> </pseudowires> </p2p-xconnect> </p2p-xconnects> </xconnect-group> </xconnect-groups> </database> </l2vpn> </data> </rpc-reply>
So it appears that the device accepted the request and responded. However, I get the following error message out of the ydk-cpp libraries:
[ydk] [error] get_top_entity_from_filter: Could not traverse from filter 'xconnect-groups' up to top-entity
From playing around with my query, it appears that the following request doesn't create an error (getting everything under L2vpn):
NetconfServiceProvider provider{ip_address, "username", "password", 830}; try { auto filter = make_shared<L2vpn>(); CrudService crud_service{}; auto db_read = crud_service.read( provider, *filter ); } ...
However, I'm curious how to get just the values under XConnectGroups
I'm sure I'm just not forming the right query. Any help would greatly be appreciated.
Thanks,
Eric
05-28-2020 01:57 PM
I finally figured it out. Sorry to keep spamming this forum.
NetconfServiceProvider provider{ip_address, "username", "password", 830}; try { auto filter = make_shared<L2vpn>(); CrudService crud_service{}; auto read_value = crud_service.read( provider, *filter->database->xconnect_groups ); } ...
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