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 

My gauge.yaml configuration is:

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 doesn't 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:



























If you don't have created previosly a faucet database, you'll 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

Comments

  1. I am trying to run gauge

    I can see switch s1 is added in both faucet and gauge controller, but I am not getting any stats from switch
    my gauge log

    Feb 26 01:57:20 gauge INFO DPID 1 (0x1) up
    Feb 26 01:57:35 gauge INFO port stats request timed out for s1
    Feb 26 01:57:40 gauge INFO port stats request timed out for s1

    My VM IP: 192.168.16.129, 192.168.171.131
    my config files:

    faucet.yaml

    version: 2
    vlans:
    4090:
    name: "trusted network"
    unicast_flood: True
    dps:
    s1:
    dp_id: 1
    description: "Switch"
    interfaces:
    1:
    native_vlan: 4090
    name: "port1.0.1"
    2:
    native_vlan: 4090
    name: "port1.0.2"

    gauge.yaml

    version: 2
    faucet_configs:
    - '/etc/ryu/faucet/faucet.yaml'
    watchers:
    port_status_poller:
    type: 'port_state'
    dps: ['s1']
    db: 'influx'
    interval: 5

    port_stats_poller:
    type: 'port_stats'
    dps: ['s1']
    db: 'influx'
    interval: 5
    dbs:
    influx:
    type: 'influx'
    influx_db: 'faucet'
    influx_host: 'localhost'
    influx_port: 8086
    influx_user: 'faucet'
    influx_pwd: '123'
    influx_timeout: 10

    Steps I followed:

    Start controller
    sudo ryu-manager --ofp-tcp-listen-port=6633 faucet/src/ryu_faucet/org/onfsdn/faucet/faucet.py
    Start mininet and add gauge controller
    sudo mn --mac --controller=remote,ip=192.168.16.129
    sh ovs-vsctl set-controller s1 tcp:192.168.16.129:6633 tcp:192.168.16.129:6663
    Start gauge controller
    sudo ryu-manager --verbose --ofp-tcp-listen-port=6663 faucet/src/ryu_faucet/org/onfsdn/faucet/gauge.py

    Always getting port stats request timed out for s1

    ReplyDelete
    Replies
    1. No. I solved it by replacing local host with 127.0.0.1 in influx_host

      Delete

Post a Comment

Popular posts from this blog

How to fix Android when developer options are not available for this user

Contiki 3.0 on XM1000

How to fix VirtualBox error when you try to import an ova file