<?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: removing configuration with ncclient in Controllers</title>
    <link>https://community.cisco.com/t5/controllers/removing-configuration-with-ncclient/m-p/4528719#M2384</link>
    <description>&lt;P&gt;&lt;STRONG&gt;Hi Ugur,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Basically all you need is to add the XML namespace to the config tag and a delete operation on the 'vrf-prefix' element in addition to leafs identifying the particular route object to be deleted:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;sr_config = '''&amp;lt;config &lt;EM&gt;&lt;STRONG&gt;xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"&lt;/STRONG&gt;&lt;/EM&gt;&amp;gt;&lt;BR /&gt;                 &amp;lt;router-static xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-ip-static-cfg"&amp;gt;&lt;BR /&gt;                   &amp;lt;default-vrf&amp;gt;&lt;BR /&gt;                     &amp;lt;address-family&amp;gt;&lt;BR /&gt;                       &amp;lt;vrfipv4&amp;gt;&lt;BR /&gt;                         &amp;lt;vrf-unicast&amp;gt;&lt;BR /&gt;                           &amp;lt;vrf-prefixes&amp;gt;&lt;BR /&gt;                             &amp;lt;vrf-prefix &lt;EM&gt;&lt;STRONG&gt;nc:operation="delete"&lt;/STRONG&gt;&lt;/EM&gt;&amp;gt;&lt;BR /&gt;                               &amp;lt;prefix&amp;gt;13.13.13.13&amp;lt;/prefix&amp;gt;&lt;BR /&gt;                               &amp;lt;prefix-length&amp;gt;32&amp;lt;/prefix-length&amp;gt;&lt;BR /&gt;                             &amp;lt;/vrf-prefix&amp;gt;&lt;BR /&gt;                           &amp;lt;/vrf-prefixes&amp;gt;&lt;BR /&gt;                         &amp;lt;/vrf-unicast&amp;gt;&lt;BR /&gt;                       &amp;lt;/vrfipv4&amp;gt;&lt;BR /&gt;                     &amp;lt;/address-family&amp;gt;&lt;BR /&gt;                   &amp;lt;/default-vrf&amp;gt;&lt;BR /&gt;                 &amp;lt;/router-static&amp;gt;&lt;BR /&gt;              &amp;lt;/config&amp;gt;'''&lt;BR /&gt;resp = device_h.edit_config(target="candidate", config=sr_config)&lt;BR /&gt;print(resp)&lt;BR /&gt;device_h.commit()&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- Johnny&lt;/P&gt;</description>
    <pubDate>Mon, 10 Jan 2022 10:31:39 GMT</pubDate>
    <dc:creator>Johnny Karms Pedersen</dc:creator>
    <dc:date>2022-01-10T10:31:39Z</dc:date>
    <item>
      <title>removing configuration with ncclient</title>
      <link>https://community.cisco.com/t5/controllers/removing-configuration-with-ncclient/m-p/4113934#M2383</link>
      <description>&lt;P&gt;hello guys,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;somehow I couldn't figure out the way to remove existing configuration with netconf. I created xml template based on yang file static for xr 6.5.3 as follows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;sr_config  = '''
&amp;lt;config&amp;gt;
  &amp;lt;router-static xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-ip-static-cfg"&amp;gt;
    &amp;lt;default-vrf&amp;gt;
      &amp;lt;address-family&amp;gt;
        &amp;lt;vrfipv4&amp;gt;
          &amp;lt;vrf-unicast&amp;gt;
            &amp;lt;vrf-prefixes&amp;gt;
              &amp;lt;vrf-prefix&amp;gt;
                &amp;lt;prefix&amp;gt;13.13.13.13&amp;lt;/prefix&amp;gt;
                &amp;lt;prefix-length&amp;gt;32&amp;lt;/prefix-length&amp;gt;
                &amp;lt;vrf-route&amp;gt;
                  &amp;lt;vrf-next-hop-table&amp;gt;
                    &amp;lt;vrf-next-hop-interface-name&amp;gt;
                      &amp;lt;interface-name&amp;gt;Null0&amp;lt;/interface-name&amp;gt;
                      &amp;lt;tag&amp;gt;710&amp;lt;/tag&amp;gt;
                      &amp;lt;description&amp;gt;test_netconf&amp;lt;/description&amp;gt;
                    &amp;lt;/vrf-next-hop-interface-name&amp;gt;
                  &amp;lt;/vrf-next-hop-table&amp;gt;
                &amp;lt;/vrf-route&amp;gt;
	      &amp;lt;/vrf-prefix&amp;gt;
	     &amp;lt;/vrf-prefixes&amp;gt;
          &amp;lt;/vrf-unicast&amp;gt;
        &amp;lt;/vrfipv4&amp;gt;
      &amp;lt;/address-family&amp;gt;
    &amp;lt;/default-vrf&amp;gt;
  &amp;lt;/router-static&amp;gt;
 &amp;lt;/config&amp;gt;
 '''&lt;BR /&gt;&lt;BR /&gt;device_h.edit_config(target="candidate", config=sr_config)&lt;/PRE&gt;&lt;P&gt;I can filter it out too, but how I am supposed to delete this config?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jul 2020 12:58:02 GMT</pubDate>
      <guid>https://community.cisco.com/t5/controllers/removing-configuration-with-ncclient/m-p/4113934#M2383</guid>
      <dc:creator>Ugur Ersoy</dc:creator>
      <dc:date>2020-07-06T12:58:02Z</dc:date>
    </item>
    <item>
      <title>Re: removing configuration with ncclient</title>
      <link>https://community.cisco.com/t5/controllers/removing-configuration-with-ncclient/m-p/4528719#M2384</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Hi Ugur,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Basically all you need is to add the XML namespace to the config tag and a delete operation on the 'vrf-prefix' element in addition to leafs identifying the particular route object to be deleted:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;sr_config = '''&amp;lt;config &lt;EM&gt;&lt;STRONG&gt;xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"&lt;/STRONG&gt;&lt;/EM&gt;&amp;gt;&lt;BR /&gt;                 &amp;lt;router-static xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-ip-static-cfg"&amp;gt;&lt;BR /&gt;                   &amp;lt;default-vrf&amp;gt;&lt;BR /&gt;                     &amp;lt;address-family&amp;gt;&lt;BR /&gt;                       &amp;lt;vrfipv4&amp;gt;&lt;BR /&gt;                         &amp;lt;vrf-unicast&amp;gt;&lt;BR /&gt;                           &amp;lt;vrf-prefixes&amp;gt;&lt;BR /&gt;                             &amp;lt;vrf-prefix &lt;EM&gt;&lt;STRONG&gt;nc:operation="delete"&lt;/STRONG&gt;&lt;/EM&gt;&amp;gt;&lt;BR /&gt;                               &amp;lt;prefix&amp;gt;13.13.13.13&amp;lt;/prefix&amp;gt;&lt;BR /&gt;                               &amp;lt;prefix-length&amp;gt;32&amp;lt;/prefix-length&amp;gt;&lt;BR /&gt;                             &amp;lt;/vrf-prefix&amp;gt;&lt;BR /&gt;                           &amp;lt;/vrf-prefixes&amp;gt;&lt;BR /&gt;                         &amp;lt;/vrf-unicast&amp;gt;&lt;BR /&gt;                       &amp;lt;/vrfipv4&amp;gt;&lt;BR /&gt;                     &amp;lt;/address-family&amp;gt;&lt;BR /&gt;                   &amp;lt;/default-vrf&amp;gt;&lt;BR /&gt;                 &amp;lt;/router-static&amp;gt;&lt;BR /&gt;              &amp;lt;/config&amp;gt;'''&lt;BR /&gt;resp = device_h.edit_config(target="candidate", config=sr_config)&lt;BR /&gt;print(resp)&lt;BR /&gt;device_h.commit()&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- Johnny&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jan 2022 10:31:39 GMT</pubDate>
      <guid>https://community.cisco.com/t5/controllers/removing-configuration-with-ncclient/m-p/4528719#M2384</guid>
      <dc:creator>Johnny Karms Pedersen</dc:creator>
      <dc:date>2022-01-10T10:31:39Z</dc:date>
    </item>
  </channel>
</rss>

