<?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 Running show commands through Northbound Netconf API in NSO Developer Hub Discussions</title>
    <link>https://community.cisco.com/t5/nso-developer-hub-discussions/running-show-commands-through-northbound-netconf-api/m-p/3733547#M2811</link>
    <description>&lt;P&gt;I'm converting some Lux tests and instead using Pytest which connects to NSO through Netconf with ncclient. I think it works quite nicely, as it's both easier to write and validate the tests and they also run a lot faster.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am a bit stuck on the reconcile part, in one part I want to convert the show commands which have been used previously. I.e., something like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;show devices device lab-router-1 config ios:interface Loopback 0&lt;/P&gt;
&lt;P&gt;or&lt;/P&gt;
&lt;P&gt;show devices device lab-router-1 config ios:interface Loopback 0 | display set (or xml or whatever)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm not quite sure how to format the XML payload to send something like this to NSO. For the reconcile action I just use `&amp;lt;action xmlns="&lt;A href="http://tail-f.com/ns/netconf/actions/1.0&amp;quot;&amp;gt;&amp;lt;data" target="_blank"&gt;http://tail-f.com/ns/netconf/actions/1.0"&amp;gt;&amp;lt;data&lt;/A&gt;&amp;gt;` and then point to the action I want to use.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How would I execute one of the show commands above or any show command for that matter?&lt;/P&gt;</description>
    <pubDate>Fri, 01 Mar 2019 12:14:08 GMT</pubDate>
    <dc:creator>ogenstad</dc:creator>
    <dc:date>2019-03-01T12:14:08Z</dc:date>
    <item>
      <title>Running show commands through Northbound Netconf API</title>
      <link>https://community.cisco.com/t5/nso-developer-hub-discussions/running-show-commands-through-northbound-netconf-api/m-p/3733547#M2811</link>
      <description>&lt;P&gt;I'm converting some Lux tests and instead using Pytest which connects to NSO through Netconf with ncclient. I think it works quite nicely, as it's both easier to write and validate the tests and they also run a lot faster.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am a bit stuck on the reconcile part, in one part I want to convert the show commands which have been used previously. I.e., something like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;show devices device lab-router-1 config ios:interface Loopback 0&lt;/P&gt;
&lt;P&gt;or&lt;/P&gt;
&lt;P&gt;show devices device lab-router-1 config ios:interface Loopback 0 | display set (or xml or whatever)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm not quite sure how to format the XML payload to send something like this to NSO. For the reconcile action I just use `&amp;lt;action xmlns="&lt;A href="http://tail-f.com/ns/netconf/actions/1.0&amp;quot;&amp;gt;&amp;lt;data" target="_blank"&gt;http://tail-f.com/ns/netconf/actions/1.0"&amp;gt;&amp;lt;data&lt;/A&gt;&amp;gt;` and then point to the action I want to use.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How would I execute one of the show commands above or any show command for that matter?&lt;/P&gt;</description>
      <pubDate>Fri, 01 Mar 2019 12:14:08 GMT</pubDate>
      <guid>https://community.cisco.com/t5/nso-developer-hub-discussions/running-show-commands-through-northbound-netconf-api/m-p/3733547#M2811</guid>
      <dc:creator>ogenstad</dc:creator>
      <dc:date>2019-03-01T12:14:08Z</dc:date>
    </item>
    <item>
      <title>Re: Running show commands through Northbound Netconf API</title>
      <link>https://community.cisco.com/t5/nso-developer-hub-discussions/running-show-commands-through-northbound-netconf-api/m-p/3734666#M2815</link>
      <description>&lt;P&gt;Something like&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;curl -X GET -i -u admin:admin \&lt;BR /&gt;--header "Accept: application/yang-data+json" \&lt;BR /&gt;http://localhost:8080/restconf/data/devices/device=c0/config/\&lt;BR /&gt;tailf-ned-cisco-ios:router/bgp&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;or&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;curl -X GET -i -u admin:admin \&lt;BR /&gt;--header "Accept: application/yang-data+xml" \&lt;BR /&gt;http://localhost:8080/restconf/data/devices/device=c0/config/\&lt;BR /&gt;tailf-ned-cisco-ios:router/bgp&lt;/P&gt;</description>
      <pubDate>Mon, 29 Oct 2018 07:38:32 GMT</pubDate>
      <guid>https://community.cisco.com/t5/nso-developer-hub-discussions/running-show-commands-through-northbound-netconf-api/m-p/3734666#M2815</guid>
      <dc:creator>hniska</dc:creator>
      <dc:date>2018-10-29T07:38:32Z</dc:date>
    </item>
    <item>
      <title>Re: Running show commands through Northbound Netconf API</title>
      <link>https://community.cisco.com/t5/nso-developer-hub-discussions/running-show-commands-through-northbound-netconf-api/m-p/3734669#M2816</link>
      <description>Ah sorry, netconf &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
      <pubDate>Mon, 29 Oct 2018 07:41:18 GMT</pubDate>
      <guid>https://community.cisco.com/t5/nso-developer-hub-discussions/running-show-commands-through-northbound-netconf-api/m-p/3734669#M2816</guid>
      <dc:creator>hniska</dc:creator>
      <dc:date>2018-10-29T07:41:18Z</dc:date>
    </item>
    <item>
      <title>Re: Running show commands through Northbound Netconf API</title>
      <link>https://community.cisco.com/t5/nso-developer-hub-discussions/running-show-commands-through-northbound-netconf-api/m-p/3734670#M2817</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can find some ncclient examples here if you havent already seen them&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://github.com/ncclient/ncclient/blob/master/examples/nc03.py" target="_blank"&gt;https://github.com/ncclient/ncclient/blob/master/examples/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;example three shows you how to fetch config&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://github.com/ncclient/ncclient/blob/master/examples/nc03.py" target="_blank"&gt;https://github.com/ncclient/ncclient/blob/master/examples/nc03.py&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To get config you can just pass in the xpath to the data you want.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Oct 2018 07:47:49 GMT</pubDate>
      <guid>https://community.cisco.com/t5/nso-developer-hub-discussions/running-show-commands-through-northbound-netconf-api/m-p/3734670#M2817</guid>
      <dc:creator>hniska</dc:creator>
      <dc:date>2018-10-29T07:47:49Z</dc:date>
    </item>
    <item>
      <title>Re: Running show commands through Northbound Netconf API</title>
      <link>https://community.cisco.com/t5/nso-developer-hub-discussions/running-show-commands-through-northbound-netconf-api/m-p/3734694#M2818</link>
      <description>&lt;P&gt;Thanks!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's so apparent when you see how you should do it. I was looking around to trigger a show command when I could grab the actual config instead.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm happy now but I have a small follow up. When I get the configuration I see a reference counter and backpointer&amp;nbsp;for the lines that have been configured by a service, but not if I've directly configured the device. Is it possible to&amp;nbsp;remove that part? If not I'll just do it in code. For some kinds of tests it will probably be better to have that than to not have it.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Configured through a service:
netconf-console -u admin -p admin --host 127.0.0.1 --port 2022 --get-config -x "/devices/device[name='ios-pe0']/config/interface/Port-channel[name='10']

&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;
&amp;lt;rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1"&amp;gt;
  &amp;lt;data&amp;gt;
    &amp;lt;devices xmlns="http://tail-f.com/ns/ncs"&amp;gt;
      &amp;lt;device&amp;gt;
        &amp;lt;name&amp;gt;ios-pe0&amp;lt;/name&amp;gt;
        &amp;lt;config&amp;gt;
          &amp;lt;interface xmlns="urn:ios"&amp;gt;
            &amp;lt;Port-channel refcounter="1" backpointer="[ /base:rfs-services/interface-rfs:interface-rfs[interface-rfs:device='ios-pe0'][interface-rfs:interface='LAG'][interface-rfs:id='10'] ]"&amp;gt;
              &amp;lt;name&amp;gt;10&amp;lt;/name&amp;gt;
              &amp;lt;description refcounter="1"&amp;gt;HEJ&amp;lt;/description&amp;gt;
            &amp;lt;/Port-channel&amp;gt;
          &amp;lt;/interface&amp;gt;
        &amp;lt;/config&amp;gt;
      &amp;lt;/device&amp;gt;
    &amp;lt;/devices&amp;gt;
  &amp;lt;/data&amp;gt;
&amp;lt;/rpc-reply&amp;gt;


Configured directly against the device:
netconf-console -u admin -p admin --host 127.0.0.1 --port 2022 --get-config -x "/devices/device[name='ios-pe0']/config/interface/Port-channel[name='11']"

&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;
&amp;lt;rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1"&amp;gt;
  &amp;lt;data&amp;gt;
    &amp;lt;devices xmlns="http://tail-f.com/ns/ncs"&amp;gt;
      &amp;lt;device&amp;gt;
        &amp;lt;name&amp;gt;ios-pe0&amp;lt;/name&amp;gt;
        &amp;lt;config&amp;gt;
          &amp;lt;interface xmlns="urn:ios"&amp;gt;
            &amp;lt;Port-channel&amp;gt;
              &amp;lt;name&amp;gt;11&amp;lt;/name&amp;gt;
              &amp;lt;description&amp;gt;Directly configured&amp;lt;/description&amp;gt;
            &amp;lt;/Port-channel&amp;gt;
          &amp;lt;/interface&amp;gt;
        &amp;lt;/config&amp;gt;
      &amp;lt;/device&amp;gt;
    &amp;lt;/devices&amp;gt;
  &amp;lt;/data&amp;gt;
&amp;lt;/rpc-reply&amp;gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 29 Oct 2018 08:50:45 GMT</pubDate>
      <guid>https://community.cisco.com/t5/nso-developer-hub-discussions/running-show-commands-through-northbound-netconf-api/m-p/3734694#M2818</guid>
      <dc:creator>ogenstad</dc:creator>
      <dc:date>2018-10-29T08:50:45Z</dc:date>
    </item>
  </channel>
</rss>

