Posts

Showing posts with the label ryu

How to run ping when STP is ready in a mininet topology

If you have a topology like a mesh or any other with redundant links, you must use Spanning tree protocol (STP) to avoid a while. To run STP, you can use a controller app or setup your virtual switches to be compatible with STP. To run as controller: Run a STP controller app. In my case I use Ryu: ryu-manager --ofp-tcp-listen-port=6633 ryu.app.simple_switch_stp_13 To run as virtual switch (OVSSwitch): You can modify your switch from your terminal (outside mininet) as follows: ovs-vsctl set bridge s1 stp-enable=true You can use the same sentence inside a python script like follows: s1 .cmd( 'ovs-vsctl set bridge s1 stp-enable=true' ) Now, to avoid execute ping before STP is ready, you need to see the status port of your switch. You can use the following code to insert in your python script. while (s1.cmdPrint( 'ovs-ofctl show s1 | grep -o FORWARD | head -n1' ) != "FORWARD \r\n " ): time.sleep( 3 ) # Avoid initial too long delay time.slee...

Full faucet.yaml file configuration

version: 2 dps:     test-faucet-1:         dp_id: 0x0000000000000001   # The id of the datapath to be controlled         description: "Initial Test Faucet"    # Purely informational         hardware: "Open_vSwitch"  # used to determine which valve implementation to use         interfaces:             1:                 native_vlan: 100                 name: "port1"   # name for this port, used for logging/monitoring                 acl_in: 1                 description: "Port 1"    # informational             2:                 #native_vlan: 100               ...

Issues to run faucet.py

A typicall issue when you run faucet.py is the following: sudo ryu-manager --ofp-tcp-listen-port=6633 /home/nboettcher/Downloads/faucet/src/ryu_faucet/org/onfsdn/faucet/faucet.py ryu.app.simple_switch_13 ryu.app.ofctl_rest ... in __init__  self.config_file, self.logname) TypeError: 'NoneType' object is not iterable To see the specific conflictive line in your config file (faucet.yaml), you need to check out the faucet log: $ cat /var/log/ryu/faucet/faucet.log faucet.config ERROR    Error in file /etc/ryu/faucet/faucet.yaml (while scanning for the next token found character '\t' that cannot start any token   in "/etc/ryu/faucet/faucet.yaml", line 15, column 1) As you can see, yaml files can't use tabulation to ident the content. Replace tabs by spaces. Don't forget delete empty lines at the end of file. Enjoy it!

Running Faucet and Gauge on localhost

Image
In my post about how to configure  mininet-ryu-faucet-gauge-influxdb  I used faucet in a remote machine (as virtual machine). Now, I going to explain how to install and configure it in localhost. First, download it form github: git clone https://github.com/onfsdn/faucet.git cd faucet sudo python setup.py install Probably, you will see this message: build/temp.linux-x86_64-2.7/check_libyaml.c:2:18: fatal error: yaml.h: No such file or directory To avoid it, you need to install yaml: apt-get install libyaml-dev If you try to install it again you will see this message: ERROR:root:Error parsing Traceback (most recent call last):   File "/usr/local/lib/python2.7/dist-packages/pbr/core.py", line 111, in pbr     attrs = util.cfg_to_args(path, dist.script_args)   File "/usr/local/lib/python2.7/dist-packages/pbr/util.py", line 248, in cfg_to_args     kwargs = setup_cfg_to_setup_kwargs(config, script_args)   File "/usr/local/lib...

Debug SDN Ryu controller with Pycharm

Image
If you want debug your Ryu App, you need execute ryu-manager throught Pycharm. To do it, you need execute the following python script in the same folder where you have the ryu app. I got the script from  https://www.mail-archive.com/ryu-devel%40lists.sourceforge.net/msg08519.html #!/usr/bin/env python # -*- coding: utf-8 -*- import sys from ryu.cmd import manager def main(): sys.argv.append('--ofp-tcp-listen-port') sys.argv.append('6633') sys.argv.append('simple_switch_13') sys.argv.append('--verbose') sys.argv.append('--enable-debugger') manager.main() if __name__ == '__main__': main() Where simple_switch_13 is your ryu.app.name. Run with Shift+F9 in Pycharm. If you choose any line in your Ryu app to debug, the console will show you the data about this variable like the following screenshot:

Mininet + Ryu + Faucet + Gauge + Influxdb

Image
First, to install faucet proceed to download it: pip install https://pypi.python.org/packages/a3/5a/197046b6fbad2f129e108358d7ba9674ebae638a227e6a1680cd77c7bd13/ryu-faucet-1.1.tar.gz or from the github: git clone https://github.com/onfsdn/faucet.git I had a problem to run gauge with this installer (maybe dependencies or something else). When I run gauge I got this error: raise SystemError('__init__ called too many times') SystemError: __init__ called too many times If you have the same issue reported as #19  or you want ot avoid it, they recommend to download the ryu-faucet VM to work on it: https://susestudio.com/a/ENQFFD/ryu-faucet/download/vmx The user is root and password is faucet I prefer work with byobu, to manage a lot tabs. To install on the VM just run: zypper install byobu If you try to run the ./test_config.py including in the faucet folder, you will see the following error: Traceback (most recent call last):   File "./test_config.py...

Interactive RYU controller with Postman

Image
A good way to communicate with your RYU controller is through Postman. You can find a lot of frequently curl requests on OF-DPA Ryu Rest, and you can import them to Postman. You can download them from ofdpa.com  (you need a previous registration) or download from this link Now, import them from Postman And now, enjoy it! You can use this video as tutorial