Introduction to SDN OpenDayLight

Hi @ammar.eng100

There’s not really a quick answer to this but to get an idea what NETCONF and RESTCONF are about, let me show you an example. This is done on an CSR1000V router running IOS XE.

## RESTCONF

Here’s an example of NETCONF on a Cisco IOS router. It’s an alternative to the CLI where you can use XML to retrieve information or to configure the device. It uses RPC for transport and can be used through SSH:

R1(config)#netconf ssh

Let’s log in:

$ ssh admin@192.168.1.1 -s netconf

The router will respond with a hello like this:

<?xml version="1.0" encoding="UTF-8"?>
<hello
	xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
	<capabilities>
		<capability>urn:ietf:params:netconf:base:1.0</capability>
		<capability>urn:ietf:params:netconf:capability:writeable-running:1.0</capability>
		<capability>urn:ietf:params:netconf:capability:startup:1.0</capability>
		<capability>urn:ietf:params:netconf:capability:url:1.0</capability>
		<capability>urn:cisco:params:netconf:capability:pi-data-model:1.0</capability>
		<capability>urn:cisco:params:netconf:capability:notification:1.0</capability>
	</capabilities>
	<session-id>2035438880</session-id></hello>]]>]]>

We need to send a hello to the router:

<?xml version="1.0" encoding="UTF-8"?>
<hello xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
    <capabilities>
        <capability>urn:ietf:params:netconf:base:1.0</capability>
    </capabilities>
</hello>]]>]]>

Now we can send commands, for example, request the configuration of an interface:

<?xml version="1.0"?>
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"xmlns:cpi="http://www.cisco.com/cpi_10/schema"
message-id="101">
   <get-config>
        <source>
             <running/>
         </source>
          <filter>
              <config-format-text-cmd>
               <text-filter-spec>
        interface GigabitEthernet2
                 </text-filter-spec>
              </config-format-text-cmd>
          </filter>
      </get-config>

This is what the router will send:

<?xml version="1.0" encoding="UTF-8"?><rpc-reply message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><data><cli-c</cmd>data><cmd>!
</cmd>nterface GigabitEthernet2
</cmd>ip address dhcp
</cmd>negotiation auto
</cmd></cli-config-data></data></rpc-reply>]]>]]>

We get the configuration of the GigabitEthernet2 interface in XML format. The advantage of these XML outputs is that they can easily be parsed by scripts, making it easier to automate things.

## RESTCONF

A bit similar as NETCONF but it uses an API through HTTP:

R1(config)#restconf
R1(config)#virtual-service csr_mgmt
R1(config-virt-serv)#ip shared host-interface GigabitEthernet 2
R1(config-virt-serv)#activate

Now we do an HTTP REQUEST for this URL:

http://192.168.1.1/restconf/api/config/native/interface/GigabitEthernet/2/ip/address

And we receive an XML object in return:

<address
	xmlns="http://cisco.com/ns/yang/ned/ios"
	xmlns:y="http://tail-f.com/ns/rest"
	xmlns:ios="http://cisco.com/ns/yang/ned/ios">
	<dhcp/>
</address>

Above you can see that the IP address was assigned by DHCP.

Since IOS XE supports NETCONF / RESTCONF, you could use it with a controller that configures these devices. I believe ODL does have support for IOS XE. In my SDN example, the control plane is only in the controller…not in the devices anymore.

Hope this helps!