Introduction to SDN OpenDayLight

This topic is to discuss the following lesson:

WOW Rene!!!
Nice and clear explanation.
God Bless you!

Hello Rene,
can you please explain to us more about RESTCONF and NETCONF and what is the difference? also can we integrate ODL controller with regular Cisco devices in GNS3 ?


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.


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@ -s netconf

The router will respond with a hello like this:

<?xml version="1.0" encoding="UTF-8"?>

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">

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=""
        interface GigabitEthernet2

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

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.


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

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

Now we do an HTTP REQUEST for this URL:

And we receive an XML object in return:


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!

Forgot to mention, APIC-EM does have support for most Cisco routers/switches.

In the SDN topic you have explained , do we need to run mininet and sdn controller both on single machine as two seperate virtual machines?

Hi @veera.krn

Both options are possible, whatever you prefer. It’s possible to create a single virtual machine that includes mininet and multiple SDN controllers.

Personally, I like to use the VM images that are offered. Mininet also has a pre-installed image:

OpenDayLight has a VM image that includes their SDN controller and mininet:

Using these images usually saves you a lot of time compared to installing everything from source yourself.

Hi Rene,

I have difficulties understanding this step. sorry, not so familiar with Linux commands:

Open the following file in your favorite text editor:

$ vim ~/.bashrc
And add the following line to set the JAVA_HOME variable:

export JAVA_HOME=/usr/lib/jvm/default-java
Save the file and execute the bashrc file:

$ source ~/.bashrc

Hello Hany

vim is a CLI text editor in Linux. You can find out more about vim and getting started with quick commands here.

Secondly, the command $ vim ~/.bashrc means open the “.bashrc” file (yes the full stop “.” is part of the file name) in the vim CLI text editor. The “~/” is just an indication of the user’s home directory. The $ just shows the prompt belongs to a normal user account.

So, the command $ vim ~/.bashrc essentially says a user wants to open the .bashrc file which is in the user’s home directory using the vim CLI text editor.

Now once you have it open, you should see its contents. Go to the end of the file (using the command keys indicated in the link provided above) and add the text “export JAVA_HOME=/usr/lib/jvm/default-java”

Finally, save and close the file (again using the commands from the link). Issue the final command. The source command essentially tells the operating system to run the .bashrc file. It executes the commands implemented in there including the additional export command you added.

I hope this has been helpful!


hello guys,

do you have any idea why get this issue ;

mininet@mininet-vm:~/distribution-karaf-0.6.4-Carbon$ ./bin/karaf
karaf: JAVA_HOME is not valid: /usr/lib/jvm/default-java

Hi Ali,

Looking at these posts:

This error seems to occur when it can’t find Java. Did you install it? Otherwise, it seems you can fix it by setting the environment variable with the correct java folder.

You can try some of the docker containers out there. This saves quite some time. For example:


In case anyone wants to know more about NETCONF, RESTCONF, and gRPC…I just published a lesson that covers these three protocols:

Hi Rene,

I am trying to get OpenDaylight to work but I’m having some difficulty. I have installed your VM but now when i open ./bin/karaf… how do i get to the web GUI of Opendaylight? this is where im stuck.

Hello Edgar

In order to access the web GUI, you will have to input the URL in the web browser of your PC. You don’t access the interface from the actual VM itself. You will have to use the IP address that ens160 has obtained via DHCP to gain network access to the interface.

I hope this has been helpful!


1 Like

Thank you… I think thats where i got confused.

1 Like

Dear Rene,
I was able to follow all the lab except the part where I am supposed to run the script in python. I get the following syntax error:

Can you please tell me the mistake?

–Gaby :slight_smile:

Btw, my python is operational:


Hi Gaby,

Are you using python 3? The syntax for the print command is different for python 2 or 3.

Python 2:

ip_address = ""
mac_address = "FC-77-74-EA-F2-FE"
print "Found host with MAC address %s and IP address %s" % (mac_address, ip_address)
Found host with MAC address FC-77-74-EA-F2-FE and IP address

Python 3:

ip_address = ""
mac_address = "FC-77-74-EA-F2-FE"
print "Found host with MAC address %s and IP address %s" % (mac_address, ip_address)
SyntaxError: invalid syntax

In python 3 you have to use parenthesis for the print command like this:


Or in our example:

print("Found host with MAC address %s and IP address %s" % (mac_address, ip_address))
Found host with MAC address FC-77-74-EA-F2-FE and IP address

Python 2 is still the most popular version but will retire on 1-1-2020. When you use Python, it’s best to use version 3 now. I’ll update my material so it works on Python 3.

Hope this helps!


Hello Rene,
Yes, I am using Python 3. I will use the parenthesis as per your suggetion. I will let you know if it works.

Hello Rene,
Just letting you know that this worked. Thank you!!!