NETCONF on-box difference of candidate and running database

About NETCONF on-box difference

The Yang-based NETCONF has no defined way for a NETCONF server to return the difference between configuration databases. It is assumed that the client already has all the building blocks to find the difference. For a NETCONF server to return the difference between configuration databases, a new feature is provided with a Cisco NETCONF option or RPC. This new option instructs the switch to calculate the on-box candidate or running difference.

Note: The calculated difference is for information only. It is not intended for the user to further push it back to the switch to change the configuration.

The following are the advantages for a NETCONF server to calculate and return the on-box difference:

  • For users which do not use controllers, they would need to write ad-hoc tool/script to wrap around the plain NETCONF operation. This could be a burden for a simple use-case to just check the changes in the candidate configuration.
  • On-box difference could be more efficient in case that the diff is relatively small comparing to the whole database. It is not worthwhile to fetch and compare two complete running or candidate snapshots to figure out a few lines of difference.
  • This RPC would calculate and return the difference between the data source in the following order:
    • Fetches the candidate and running configuration information in xml format.
    • Calculates the textual diff between two XML outputs.

The following are the tasks performed by the straight text difference method:

  • Mimics the activities of the user for the day.
  • Fetches the candidate and running configuration information in xml format.
  • Calculates the straight difference between two XML outputs.

The following are the examples for different types of configuration changes:

Example Requests and Responses

Configuration created in candidate

Example Request

Example Request
<rpc message-id=“1"> 
<get_diff xmlns="http://cisco.com/ns/yang/cisco-nx-os-device">
<source>
  <running/>
</source>
<target>
  <candidate/>
</target>
<type>xml-text</type>
<filter>
  <System> 
    <tm-items>
      <dest-items>
      </dest-items>
    </tm-items>
  </System>
</filter>
</get_diff>
</rpc>

Example Response

Example Response
<?xml version="1.0" encoding="UTF-8"?>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1">
  <data><![CDATA[
*** Running-config
--- Candidate-config
***************
*** 3,11 ****
--- 3,14 ----
      <tm-items>
          <dest-items>
              <DestGroup-list>
                  <id>111</id>
              </DestGroup-list>
+             <DestGroup-list>
+                 <id>222</id>
+             </DestGroup-list>
          </dest-items>
      </tm-items>
  </System>
  
]]></data>
</rpc-reply>

Configuration changed in candidate

Example Request

Example Request
<rpc message-id=“1"> 
<get_diff xmlns="http://cisco.com/ns/yang/cisco-nx-os-device">
<source>
  <running/>
</source>
<target>
  <candidate/>
</target>
<type>xml-text</type>
<filter>
  <System> 
    <intf-items>
      <svi-items>
        <If-list>
        </If-list>
      </svi-items>
    </intf-items>
  </System>
</filter>
</get_diff>
</rpc>

Example Response

Example Response
<?xml version="1.0" encoding="UTF-8"?>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1">
  <data><![CDATA[
*** Running-config
--- Candidate-config
***************
*** 23,33 ****
                  <snmpTrap>true</snmpTrap>
                  <vlanId>1</vlanId>
              </If-list>
              <If-list>
                  <id>vlan200</id>
!                 <adminSt>down</adminSt>
                  <autostate>true</autostate>
                  <bw>1000000</bw>
                  <carDel>100</carDel>
                  <ctrlrId/>
                  <delay>1</delay>
--- 23,33 ----
                  <snmpTrap>true</snmpTrap>
                  <vlanId>1</vlanId>
              </If-list>
              <If-list>
                  <id>vlan200</id>
!                 <adminSt>up</adminSt>
                  <autostate>true</autostate>
                  <bw>1000000</bw>
                  <carDel>100</carDel>
                  <ctrlrId/>
                  <delay>1</delay>
]]></data>
</rpc-reply>

Configuration removed in candidate

Example Request

Example Request
<rpc message-id=“1"> 
<get_diff xmlns="http://cisco.com/ns/yang/cisco-nx-os-device">
<source>
  <running/>
</source>
<target>
  <candidate/>
</target>
<type>xml-text</type>
<filter>
  <System> 
    <intf-items>
      <svi-items>
      </svi-items>
    </intf-items>
  </System>
</filter>
</get_diff>
</rpc>

Example Response

Example Response
<?xml version="1.0" encoding="UTF-8"?>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1">
  <data><![CDATA[
*** Running-config
--- Candidate-config
***************
*** 43,72 ****
                      <tDn>/System/inst-items/Inst-list[name='default']</tDn>
                  </rtvrfMbr-items>
                  <snmpTrap>true</snmpTrap>
                  <vlanId>200</vlanId>
              </If-list>
-             <If-list>
-                 <id>vlan100</id>
-                 <adminSt>down</adminSt>
-                 <autostate>true</autostate>
-                 <bw>1000000</bw>
-                 <carDel>100</carDel>
-                 <delay>1</delay>
-                 <inbMgmt>false</inbMgmt>
-                 <loadIntvl1>60</loadIntvl1>
-                 <loadIntvl2>300</loadIntvl2>
-                 <loadIntvl3>60</loadIntvl3>
-                 <mac>80:2D:BF:30:13:97</mac>
-                 <medium>bcast</medium>
-                 <mtu>1500</mtu>
-                 <mtuInherit>true</mtuInherit>
-                 <rtvrfMbr-items>
-                     <tDn>/System/inst-items/Inst-list[name='default']</tDn>
-                 </rtvrfMbr-items>
-                 <snmpTrap>true</snmpTrap>
-                 <vlanId>100</vlanId>
-             </If-list>
          </svi-items>
      </intf-items>
  </System>
  
--- 43,51 ----
]]></data>
</rpc-reply>

Mixes of modifications in candidate via DeviceYang

Example Request

Example Request
<rpc message-id=“1"> 
<get_diff xmlns="http://cisco.com/ns/yang/cisco-nx-os-device">
<source>
  <running/>
</source>
<target>
  <candidate/>
</target>
<type>xml-text</type>
<filter>
  <System> 
    <intf-items>
      <phys-items>
        <PhysIf-list>
        </PhysIf-list>
      </phys-items>
</intf-items>
  </System>
</filter>
</get_diff>
</rpc>

Example Response

Example Response
<?xml version="1.0" encoding="UTF-8"?>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1">
  <data><![CDATA[
*** Running-config
--- Candidate-config
***************
*** 110,120 ****
                  <autoNeg>on</autoNeg>
                  <beacon>off</beacon>
                  <bw>0</bw>
                  <controllerId/>
                  <delay>1</delay>
-                 <descr>test-17-description</descr>
                  <dfeAdaptiveTuning>enable</dfeAdaptiveTuning>
                  <dfeTuningDelay>100</dfeTuningDelay>
                  <dot1qEtherType>33024</dot1qEtherType>
                  <duplex>auto</duplex>
                  <eeep-items>
--- 110,119 ----
***************
*** 2011,2020 ****
--- 2010,2020 ----
                  <autoNeg>on</autoNeg>
                  <beacon>off</beacon>
                  <bw>0</bw>
                  <controllerId/>
                  <delay>1</delay>
+                 <descr>test-15-description</descr>
                  <dfeAdaptiveTuning>enable</dfeAdaptiveTuning>
                  <dfeTuningDelay>100</dfeTuningDelay>
                  <dot1qEtherType>33024</dot1qEtherType>
                  <duplex>auto</duplex>
                  <eeep-items>
***************
*** 5211,5221 ****
                  <autoNeg>on</autoNeg>
                  <beacon>off</beacon>
                  <bw>0</bw>
                  <controllerId/>
                  <delay>1</delay>
!                 <descr>test-16-description</descr>
                  <dfeAdaptiveTuning>enable</dfeAdaptiveTuning>
                  <dfeTuningDelay>100</dfeTuningDelay>
                  <dot1qEtherType>33024</dot1qEtherType>
                  <duplex>auto</duplex>
                  <eeep-items>
--- 5211,5221 ----
                  <autoNeg>on</autoNeg>
                  <beacon>off</beacon>
                  <bw>0</bw>
                  <controllerId/>
                  <delay>1</delay>
!                 <descr>test-16-new-description</descr>
                  <dfeAdaptiveTuning>enable</dfeAdaptiveTuning>
                  <dfeTuningDelay>100</dfeTuningDelay>
                  <dot1qEtherType>33024</dot1qEtherType>
                  <duplex>auto</duplex>
                  <eeep-items>
]]></data>
</rpc-reply>

Mixes of modifications in candidate via OpenConfig

Example Request

Example Request
<rpc message-id=“1"> 
<get_diff xmlns="http://cisco.com/ns/yang/cisco-nx-os-device">
<source>
  <running/>
</source>
<target>
  <candidate/>
</target>
<type>xml-text</type>
<filter>
  <interfaces xmlns="http://openconfig.net/yang/interfaces">
    <interface>
    </interface>
  </interfaces>
</filter>
</get_diff>
</rpc>

Example Response

Example Response
<?xml version="1.0" encoding="UTF-8"?>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1">
  <data><![CDATA[
*** Running-config
--- Candidate-config
***************
*** 450,459 ****
--- 450,460 ----
          </ethernet>
      </interface>
      <interface>
          <name>eth1/15</name>
          <config>
+             <description>test-15-description</description>
              <enabled>false</enabled>
              <mtu>1500</mtu>
              <name>eth1/15</name>
              <type xmlns:ianaift="urn:ietf:params:xml:ns:yang:iana-if-type">ianaift:ethernetCsmacd</type>
              <tpid xmlns="http://openconfig.net/yang/vlan">TPID_0X8100</tpid>
***************
*** 1597,1607 ****
          </ethernet>
      </interface>
      <interface>
          <name>eth1/16</name>
          <config>
!             <description>test-16-description</description>
              <enabled>false</enabled>
              <mtu>1500</mtu>
              <name>eth1/16</name>
              <type xmlns:ianaift="urn:ietf:params:xml:ns:yang:iana-if-type">ianaift:ethernetCsmacd</type>
              <tpid xmlns="http://openconfig.net/yang/vlan">TPID_0X8100</tpid>
--- 1598,1608 ----
          </ethernet>
      </interface>
      <interface>
          <name>eth1/16</name>
          <config>
!             <description>test-16-new-description</description>
              <enabled>false</enabled>
              <mtu>1500</mtu>
              <name>eth1/16</name>
              <type xmlns:ianaift="urn:ietf:params:xml:ns:yang:iana-if-type">ianaift:ethernetCsmacd</type>
              <tpid xmlns="http://openconfig.net/yang/vlan">TPID_0X8100</tpid>
***************
*** 1968,1978 ****
          </ethernet>
      </interface>
      <interface>
          <name>eth1/17</name>
          <config>
-             <description>test-17-description</description>
              <enabled>false</enabled>
              <mtu>1500</mtu>
              <name>eth1/17</name>
              <type xmlns:ianaift="urn:ietf:params:xml:ns:yang:iana-if-type">ianaift:ethernetCsmacd</type>
              <tpid xmlns="http://openconfig.net/yang/vlan">TPID_0X8100</tpid>
--- 1969,1978 ----
]]></data>
</rpc-reply>

Source and Target datastore are identical

Example Request

Example Request
<rpc message-id=“1"> 
<get_diff xmlns="http://cisco.com/ns/yang/cisco-nx-os-device">
<source>
  <running/>
</source>
<target>
  <candidate/>
</target>
<type>xml-text</type>
<filter>
  <System> 
    <tm-items>
    </tm-items>
  </System>
</filter>
</get_diff>
</rpc>

Example Response

Example Response
<?xml version="1.0" encoding="UTF-8"?>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1">
  <data/>
</rpc-reply>