Monday, March 24, 2014

SDN Opendaylight Controller: Add/Remove Flow Entries using REST


Start Controller
$ ./run.sh

Start Open vSwitches using Mininet
$ sudo mn --topo single,2 --controller remote,ip=192.168.56.101 --switch ovsk,protocols=OpenFlow13


192.168.56.101     Virtual Machine (VM) where Opendaylight(ODL) Controller is running
192.168.56.102     VM where Mininet is running

We will be using f206.xml for our testing.

Before using REST request Click on Basic Auth tab and configure username/password as admin/admin which are default credentials for accessing Controller GUI, click Refresh Headers. And configure Content-Type and Accept as shown below

To add a Flow Entry on to OpenvSwitch need to use PUT request method.

table_id, id tags of the XML will be part of REST request URL

http://192.168.56.101:8080/restconf/config/opendaylight-inventory:nodes/node/openflow:1/table/2/flow/133

Select raw-> XML as data format and copy f206.xml to the text body and click on Send tab. It should return us "200 OK" status code which indicates Flow is successfully sent to Controller without any issues, and the information will be saved in Controllers cache(Configuration Data Store).



Flow being successfully sent to Switch or not can be verified using ovs-ofctl command.

To remove a flow from Switch using REST request use DELETE request instead of PUT.

Following articles might be of interested
SDN Opendaylight Controller: Add/Remove Flow Entries using OSGI CLI
http://blog.disects.com/2014/03/sdn-opendaylight-controller-addremove_24.html

ovs-ofctl OVS action commands for OpenFlow 1.3
http://blog.disects.com/2014/01/ovs-ofctl-ovs-action-commands-for.html

ovs-ofctl commands on OpenFlow 1.3 Mininet Open vSwitch (OVSK)
http://blog.disects.com/2014/01/ovs-ofctl-commands-on-openflow-13.html 

Interested in Ethical Hacking!
http://blog.disects.com/2012/05/cain-and-abel-password-cracking.html

SDN Opendaylight Controller: Add/Remove Flow Entries using OSGI CLI


Start Controller
$ ./run.sh

Start Switches using mininet
$ sudo mn --topo single,2 --controller remote,ip=192.168.56.101 --switch ovsk,protocols=OpenFlow13

osgi> addMDFlow openflow:1 f40
osgi> removeMDFlow openflow:1 f40

f40 is and XML file, f40.xml located at openlowplugin/test-scripts/xmls which is part of your openflowplugin git clone.

You can also execute addMDFlow command as shown below
osgi> addMDFlow openflow:1 f40 8
where 8 represents new Table ID.

To make sure flows are pushed onto OpenvSwitch(OVS) execute below command
$ sudo ovs-ofctl -O OpenFlow dump-flows s1


Adding a Flow Entry to Switch using OSGI CLI.


Verifying Flow Entry exists on Switch by executing ovs-ofctl command on machine where Mininet is running.


Removing a Flow Entry on Switch using OSGI CLI


Verifying Flow Entry exists on Switch by executing ovs-ofctl command on machine where Mininet is running.


Below articles might be of interest
ovs-ofctl OVS action commands for OpenFlow 1.3
http://blog.disects.com/2014/01/ovs-ofctl-ovs-action-commands-for.html

 ovs-ofctl commands on OpenFlow 1.3 Mininet Open vSwitch (OVSK)
http://blog.disects.com/2014/01/ovs-ofctl-commands-on-openflow-13.html

Friday, January 31, 2014

Installing CPqD switch, invoke using Mininet and OpenFlow 1.3 for Communication

Installing CPqD switch on Mininet instead of OVSK.

If OVSK is already installed remove it using below commands


sudo kill `cd /usr/local/var/run/openvswitch && cat ovsdb-server.pid ovs-vswitchd.pid`
sudo /etc/init.d/openvswitch-switch stop
sudo apt-get remove openvswitch-common openvswitch-datapath-dkms openvswitch-controller openvswitch-pki openvswitch-switch


Git clone mininet
Below git command will check out the latest Mininet
git clone git://github.com/mininet/mininet.git

If you want to run the last tagged/released version of Mininet, use
git clone git://github.com/mininet/mininet
git checkout -b 2.1.0 2.1.0

Install CPqD
cd mininet/util
sudo ./install.sh -n3fx

Start CPqD Switch
sudo mn --topo single,2 --controller remote,ip=192.168.1.8 --switch user,protocols=OpenFlow13

CPqD works in User space and OVS works in kernel space.

To get the dpid of CPqD switch
sudo dpctl tcp:127.0.0.1:6634 features

To get the stats and flow rule for CPqD switch:
dpctl tcp:127.0.0.1:6634 stats-flow

dpctl doc
https://github.com/CPqD/ofsoftswitch13/wiki/Dpctl-Documentation