Monday, July 23, 2018
Mininet Ryu Faucet Gauge Influxdb
Mininet Ryu Faucet Gauge Influxdb
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", line 29, in <module>
from config_parser import dp_parser, watcher_parser
File "/root/faucet/src/ryu_faucet/org/onfsdn/faucet/config_parser.py", line 21, in <module>
from dp import DP
File "/root/faucet/src/ryu_faucet/org/onfsdn/faucet/dp.py", line 20, in <module>
import networkx
ImportError: No module named networkx
To fix it, install networkx
pip install networkx
Now, go to /etc/ryu/faucet folder. Here you must have faucet.yaml and gauge.yaml
My faucet.yaml content is a extract from the shown in sdn-workshop:
dp_id: 0x0000000000000001 # The id of the datapath to be controlled
name: "test-faucet-1" # The name of the datapath for use with logging
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
description: "Port 1" # informational
2:
native_vlan: 100
name: "port2"
description: "Port 2"
vlans:
100:
description: "Test vlan" # informational
name: "test_vlan" # used for logging/monitoring
max_hosts: 3 # Maxium of 3 hosts can go on this VLAN
faucet_configs:
- /etc/ryu/faucet/faucet.yaml
watchers:
port_stats_poller:
type: port_stats
dps: [test-faucet-1]
interval: 10
db: influx
dbs:
influx:
type: influx
influx_db: faucet
influx_host: localhost
influx_port: 8086
influx_user: faucet
influx_pwd:
influx_timeout: 10
First, run ryu-manager with faucet app:
ryu-manager --ofp-tcp-listen-port=6633 faucet/src/ryu_faucet/org/onfsdn/faucet/faucet.py ryu.app.simple_switch_13 ryu.app.ofctl_rest
To run gauge as a second controller, with a different port, you must run the following code:
ryu-manager --verbose --ofp-tcp-listen-port=6663 /root/faucet/src/ryu_faucet/org/onfsdn/faucet/gauge.py
Now, run mininet on other machine (mininet doesnt have an installer for suse) and connect the first switch to both controllers:
sudo mn --mac --controller remote,ip=${FAUCET_IP}
sh ovs-vsctl set-controller s1 tcp:${FAUCET_IP}:6633 tcp:${FAUCET_IP}:6663
If you see /var/log/ryu/faucet/gauge.log content, you can see the following:
Oct 12 18:17:28 gauge.config WARNING Version 1 config is UNSUPPORTED. Please move to version 2
Oct 12 18:17:28 gauge.config INFO test-faucet-1
Oct 12 18:17:31 gauge INFO DPID 1 (0x1) up
To avoid the warning, change faucet.yaml to version 2 format:
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
description: "Port 1" # informational
2:
native_vlan: 100
name: "port2"
description: "Port 2"
vlans:
100:
description: "Test vlan" # informational
name: "test_vlan" # used for logging/monitoring
max_hosts: 3 # Maxium of 3 hosts can go on this VLAN
In your influxdb you can see these information:
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
description: "Port 1" # informational
2:
native_vlan: 100
name: "port2"
description: "Port 2"
vlans:
100:
description: "Test vlan" # informational
name: "test_vlan" # used for logging/monitoring
max_hosts: 3 # Maxium of 3 hosts can go on this VLAN
In your influxdb you can see these information:


If you dont have created previosly a faucet database, youll see this errror in gauge:
Starting new HTTP connection (1): localhost
"POST /write?db=faucet&precision=s HTTP/1.1" 404 53
Killed
You can checkout the same information from dump-flows throught this mininet command:
dpctl dump-flows -O OpenFlow13