<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: ncclient get_config subtree filter not working in Controllers</title>
    <link>https://community.cisco.com/t5/controllers/ncclient-get-config-subtree-filter-not-working/m-p/4825973#M1004</link>
    <description>&lt;P&gt;Sorry to bring this thread back from the dead but did you ever find an answer to the empty dataset issue?&lt;/P&gt;</description>
    <pubDate>Mon, 01 May 2023 21:09:26 GMT</pubDate>
    <dc:creator>brybyrne</dc:creator>
    <dc:date>2023-05-01T21:09:26Z</dc:date>
    <item>
      <title>ncclient get_config subtree filter not working</title>
      <link>https://community.cisco.com/t5/controllers/ncclient-get-config-subtree-filter-not-working/m-p/4788989#M1002</link>
      <description>&lt;P&gt;Hi everyone&lt;/P&gt;
&lt;P&gt;Does anybody else facing issues when using ncclient's get_config method with a subtree filter? On most XE-boxes I get empty data for my calls:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;&amp;lt;snip&amp;gt;
 with manager.connect(host=device,port=830,username=user,password=password,hostkey_verify=False) as m:
    subtree = """
    &amp;lt;native xmlns="http://cisco.com/ns/yang/Cisco-IOS-XE-native"&amp;gt;
        &amp;lt;interface&amp;gt;
            &amp;lt;Loopback&amp;gt;
                &amp;lt;name&amp;gt;0&amp;lt;/name&amp;gt;
            &amp;lt;/Loopback&amp;gt;
        &amp;lt;/interface&amp;gt;
    &amp;lt;/native&amp;gt;
    """
    reply = m.get_config(filter=("subtree", subtree), source="running")
    return reply.data_xml
&amp;lt;snip&amp;gt;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;is just returning an empty data element:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;
&amp;lt;data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"/&amp;gt;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(yes, the Lo0 is configured on all of the boxes)&lt;/P&gt;
&lt;P&gt;Python 3.9.13&lt;BR /&gt;ncclient==0.6.13&lt;/P&gt;</description>
      <pubDate>Tue, 07 Mar 2023 21:48:30 GMT</pubDate>
      <guid>https://community.cisco.com/t5/controllers/ncclient-get-config-subtree-filter-not-working/m-p/4788989#M1002</guid>
      <dc:creator>Marcel Zehnder</dc:creator>
      <dc:date>2023-03-07T21:48:30Z</dc:date>
    </item>
    <item>
      <title>Re: ncclient get_config subtree filter not working</title>
      <link>https://community.cisco.com/t5/controllers/ncclient-get-config-subtree-filter-not-working/m-p/4789662#M1003</link>
      <description>&lt;P&gt;Be good to see what the box is seeing, pop a eem in and run it&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;event manager applet catchall
event cli pattern ".*" sync no skip no
action 1 syslog msg "$_cli_msg"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Mar 2023 15:10:52 GMT</pubDate>
      <guid>https://community.cisco.com/t5/controllers/ncclient-get-config-subtree-filter-not-working/m-p/4789662#M1003</guid>
      <dc:creator>bigevilbeard</dc:creator>
      <dc:date>2023-03-08T15:10:52Z</dc:date>
    </item>
    <item>
      <title>Re: ncclient get_config subtree filter not working</title>
      <link>https://community.cisco.com/t5/controllers/ncclient-get-config-subtree-filter-not-working/m-p/4825973#M1004</link>
      <description>&lt;P&gt;Sorry to bring this thread back from the dead but did you ever find an answer to the empty dataset issue?&lt;/P&gt;</description>
      <pubDate>Mon, 01 May 2023 21:09:26 GMT</pubDate>
      <guid>https://community.cisco.com/t5/controllers/ncclient-get-config-subtree-filter-not-working/m-p/4825973#M1004</guid>
      <dc:creator>brybyrne</dc:creator>
      <dc:date>2023-05-01T21:09:26Z</dc:date>
    </item>
    <item>
      <title>Re: ncclient get_config subtree filter not working</title>
      <link>https://community.cisco.com/t5/controllers/ncclient-get-config-subtree-filter-not-working/m-p/4826315#M1005</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Not really, well I think it's related to the IOS version - Seems like it's working with the newest versions.&lt;/P&gt;
&lt;P&gt;Marcel&lt;/P&gt;</description>
      <pubDate>Tue, 02 May 2023 07:01:31 GMT</pubDate>
      <guid>https://community.cisco.com/t5/controllers/ncclient-get-config-subtree-filter-not-working/m-p/4826315#M1005</guid>
      <dc:creator>Marcel Zehnder</dc:creator>
      <dc:date>2023-05-02T07:01:31Z</dc:date>
    </item>
    <item>
      <title>Re: ncclient get_config subtree filter not working</title>
      <link>https://community.cisco.com/t5/controllers/ncclient-get-config-subtree-filter-not-working/m-p/4826654#M1006</link>
      <description>&lt;P&gt;Awesome. Thank you!&lt;/P&gt;</description>
      <pubDate>Tue, 02 May 2023 13:11:11 GMT</pubDate>
      <guid>https://community.cisco.com/t5/controllers/ncclient-get-config-subtree-filter-not-working/m-p/4826654#M1006</guid>
      <dc:creator>brybyrne</dc:creator>
      <dc:date>2023-05-02T13:11:11Z</dc:date>
    </item>
    <item>
      <title>Re: ncclient get_config subtree filter not working</title>
      <link>https://community.cisco.com/t5/controllers/ncclient-get-config-subtree-filter-not-working/m-p/4849456#M2574</link>
      <description>&lt;P&gt;I was running into the same issue with my XR. This is my version I am running. Note this deployed on a whitebox, so its cisco ios v-xr&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Tue Jun  6 12:59:42.986 ECT
Cisco IOS XR Software, Version 7.4.16
Copyright (c) 2013-2021 by Cisco Systems, Inc.

Build Information:
 Built By     : ingunawa
 Built On     : Mon Nov 29 03:56:27 PST 2021
 Built Host   : iox-ucs-069
 Workspace    : /auto/srcarchive17/prod/7.4.16/iosxrwbd/ws
 Version      : 7.4.16
 Location     : /opt/cisco/XR/packages/
 Label        : 7.4.16
&lt;/LI-CODE&gt;&lt;P&gt;The problem I was running into was at first I as including `&amp;lt;filter&amp;gt;&amp;lt;/filter&amp;gt;` in my subtree statement, also tried including cisco get-config prefix and suffixes like this (note I was looking for an object group contents)&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;  &amp;lt;get-config&amp;gt;
    &amp;lt;source&amp;gt;
      &amp;lt;running/&amp;gt;
    &amp;lt;/source&amp;gt;
    &amp;lt;filter&amp;gt;
      &amp;lt;object-group xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-um-object-group-cfg"&amp;gt;
        &amp;lt;network&amp;gt;
          &amp;lt;ipv4s&amp;gt;
            &amp;lt;ipv4&amp;gt;
              &amp;lt;ipv4-object-group-name&amp;gt;TEST_BLOCK_LIST&amp;lt;/ipv4-object-group-name&amp;gt;
            &amp;lt;/ipv4&amp;gt;
          &amp;lt;/ipv4s&amp;gt;
        &amp;lt;/network&amp;gt;
      &amp;lt;/object-group&amp;gt;
    &amp;lt;/filter&amp;gt;
  &amp;lt;/get-config&amp;gt;
&amp;lt;/rpc&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;Both returned the same result that OP shows. In the end it was to only to include the parent string name like this&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;      &amp;lt;object-group xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-um-object-group-cfg"&amp;gt;
        &amp;lt;network&amp;gt;
          &amp;lt;ipv4s&amp;gt;
            &amp;lt;ipv4&amp;gt;
              &amp;lt;ipv4-object-group-name&amp;gt;ONG_V4_COMMON_BLOCK&amp;lt;/ipv4-object-group-name&amp;gt;
            &amp;lt;/ipv4&amp;gt;
          &amp;lt;/ipv4s&amp;gt;
        &amp;lt;/network&amp;gt;
      &amp;lt;/object-group&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;If you include anything else the filter wont know where to start and return nothing. However OP seemed to be doing this so not sure why it started working for him.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Jun 2023 18:03:20 GMT</pubDate>
      <guid>https://community.cisco.com/t5/controllers/ncclient-get-config-subtree-filter-not-working/m-p/4849456#M2574</guid>
      <dc:creator>davehouser1</dc:creator>
      <dc:date>2023-06-06T18:03:20Z</dc:date>
    </item>
  </channel>
</rss>

