Showing posts with label mininet. Show all posts
Showing posts with label mininet. Show all posts

Monday, August 4, 2014

[RYU] Try the RYU Web GUI with Mininet

This post is about the displaying of RYU Web GUI. We can see what the GUI looks like. My environment is with 2 virtual machines running on Virtula-Box. I skep the installation guide with RYU and GUI because there is already some documents to tell how to do so. If interested, please check there:
http://blog.linton.tw/posts/2014/02/15/note-install-ryu-36-sdn-framework
http://blog.linton.tw/posts/2014/02/11/note-how-to-set-up-ryu-controller-with-gui-component

P.S: Maybe need to do this:
pip install --upgrade pip or pip install -U pip

First, I started with my RYU server and executed the command:

  • > ryu-manager --verbose --observe-links ryu.topology.switches ryu.app.rest_topology ryu.app.ofctl_rest ryu.app.simple_switch

P.S: Currently the GUI doesn't support OF1.3.

Second, open another console to execute this command under your ryu directory. It is a middle-ware between Web and Controller.

  • > ./ryu/gui/controller.py


For Mininet, I just downloaded the Mininet Virtual Machine and directed to use it. The following command can generate the 3 tiers network topology quickly.

>  sudo mn --controller=remote,ip=10.3.207.81 --topo tree,3


Back to the RYU server, open the browser with the URL: http://127.0.0.1:8000/   








Friday, March 22, 2013

[mininet] A simple example to build your own topology in mininet

Well, first of all I want to thank my colleague to giving me an example to build myself topology. It is very simple. Everyone can modify it and do your own topology with OpenFlow Controller.
Second, due to introducing switch cluster concept in Floodlight Controller, I will provide a simple example to give switch clusters in topology.

my_topology.py


from mininet.topo import Topo class MyTopo( Topo ): "Simple topology example." def __init__( self ): "Create custom topo." # Initialize topology Topo.__init__( self ) h1 = self.addHost( 'h1' ) h2 = self.addHost( 'h2' ) h3 = self.addHost( 'h3' ) h4 = self.addHost( 'h4' ) h5 = self.addHost( 'h5' ) h6 = self.addHost( 'h6' ) s1 = self.addSwitch( 's1' ) s2 = self.addSwitch( 's2' ) s3 = self.addSwitch( 's3' ) s4 = self.addSwitch( 's4' ) s5 = self.addSwitch( 's5' ) s6 = self.addSwitch( 's6' ) s7 = self.addSwitch( 's7' ) self.addLink( s1, s2 ) self.addLink( s1, s3 ) self.addLink( s2, s3 ) self.addLink( s2, s4 ) self.addLink( s2, s5 ) self.addLink( s3, s4 ) self.addLink( s3, s5 ) self.addLink( s4, h1 ) self.addLink( s4, h2 ) self.addLink( s5, s3 ) self.addLink( s5, s4 ) self.addLink( s6, h5 ) self.addLink( s7, h6 ) topos = { 'mytopo': ( lambda: MyTopo() ) }

Testing
Use the REST API in Floodlight Controller to query the related information as follows:

> curl -s http://localhost:8080/wm/topology/switchclusters/json
{
    "00:00:00:00:00:00:00:06": [
        "00:00:00:00:00:00:00:06",
        "00:00:00:00:00:00:00:07"
    ],
    "00:00:00:00:00:00:00:01": [
        "00:00:00:00:00:00:00:05",
        "00:00:00:00:00:00:00:02",
        "00:00:00:00:00:00:00:01",
        "00:00:00:00:00:00:00:03",
        "00:00:00:00:00:00:00:04"
    ]
}

> curl -s http://localhost:8080/wm/topology/links/json
[
    {
        "src-switch": "00:00:00:00:00:00:00:05",
        "src-port": 1,
        "src-port-state": 0,
        "dst-switch": "00:00:00:00:00:00:00:02",
        "dst-port": 4,
        "dst-port-state": 0,
        "type": "internal"
    },
    {
        "src-switch": "00:00:00:00:00:00:00:02",
        "src-port": 1,
        "src-port-state": 0,
        "dst-switch": "00:00:00:00:00:00:00:01",
        "dst-port": 1,
        "dst-port-state": 0,
        "type": "internal"
    },
    {
        "src-switch": "00:00:00:00:00:00:00:04",
        "src-port": 1,
        "src-port-state": 0,
        "dst-switch": "00:00:00:00:00:00:00:02",
        "dst-port": 3,
        "dst-port-state": 0,
        "type": "internal"
    },
    {
        "src-switch": "00:00:00:00:00:00:00:05",
        "src-port": 2,
        "src-port-state": 0,
        "dst-switch": "00:00:00:00:00:00:00:03",
        "dst-port": 4,
        "dst-port-state": 0,
        "type": "internal"
    },
    {
        "src-switch": "00:00:00:00:00:00:00:02",
        "src-port": 3,
        "src-port-state": 0,
        "dst-switch": "00:00:00:00:00:00:00:04",
        "dst-port": 1,
        "dst-port-state": 0,
        "type": "internal"
    },
    {
        "src-switch": "00:00:00:00:00:00:00:06",
        "src-port": 1,
        "src-port-state": 0,
        "dst-switch": "00:00:00:00:00:00:00:07",
        "dst-port": 1,
        "dst-port-state": 0,
        "type": "internal"
    },
    {
        "src-switch": "00:00:00:00:00:00:00:07",
        "src-port": 1,
        "src-port-state": 0,
        "dst-switch": "00:00:00:00:00:00:00:06",
        "dst-port": 1,
        "dst-port-state": 0,
        "type": "internal"
    },
    {
        "src-switch": "00:00:00:00:00:00:00:03",
        "src-port": 3,
        "src-port-state": 0,
        "dst-switch": "00:00:00:00:00:00:00:04",
        "dst-port": 2,
        "dst-port-state": 0,
        "type": "internal"
    },
    {
        "src-switch": "00:00:00:00:00:00:00:03",
        "src-port": 4,
        "src-port-state": 0,
        "dst-switch": "00:00:00:00:00:00:00:05",
        "dst-port": 2,
        "dst-port-state": 0,
        "type": "internal"
    },
    {
        "src-switch": "00:00:00:00:00:00:00:03",
        "src-port": 1,
        "src-port-state": 0,
        "dst-switch": "00:00:00:00:00:00:00:01",
        "dst-port": 2,
        "dst-port-state": 0,
        "type": "internal"
    },
    {
        "src-switch": "00:00:00:00:00:00:00:03",
        "src-port": 2,
        "src-port-state": 0,
        "dst-switch": "00:00:00:00:00:00:00:02",
        "dst-port": 2,
        "dst-port-state": 0,
        "type": "internal"
    },
    {
        "src-switch": "00:00:00:00:00:00:00:02",
        "src-port": 4,
        "src-port-state": 0,
        "dst-switch": "00:00:00:00:00:00:00:05",
        "dst-port": 1,
        "dst-port-state": 0,
        "type": "internal"
    },
    {
        "src-switch": "00:00:00:00:00:00:00:04",
        "src-port": 2,
        "src-port-state": 0,
        "dst-switch": "00:00:00:00:00:00:00:03",
        "dst-port": 3,
        "dst-port-state": 0,
        "type": "internal"
    },
    {
        "src-switch": "00:00:00:00:00:00:00:02",
        "src-port": 2,
        "src-port-state": 0,
        "dst-switch": "00:00:00:00:00:00:00:03",
        "dst-port": 2,
        "dst-port-state": 0,
        "type": "internal"
    },
    {
        "src-switch": "00:00:00:00:00:00:00:01",
        "src-port": 2,
        "src-port-state": 0,
        "dst-switch": "00:00:00:00:00:00:00:03",
        "dst-port": 1,
        "dst-port-state": 0,
        "type": "internal"
    },
    {
        "src-switch": "00:00:00:00:00:00:00:01",
        "src-port": 1,
        "src-port-state": 0,
        "dst-switch": "00:00:00:00:00:00:00:02",
        "dst-port": 1,
        "dst-port-state": 0,
        "type": "internal"
    }
]

> curl -s http://localhost:8080/wm/device/
[
    {
        "entityClass": "DefaultEntityClass",
        "mac": [
            "82:da:cd:82:03:13"
        ],
        "ipv4": [
            "10.0.0.6"
        ],
        "vlan": [],
        "attachmentPoint": [
            {
                "port": 2,
                "switchDPID": "00:00:00:00:00:00:00:07",
                "errorStatus": null
            }
        ],
        "lastSeen": 1363763792481
    },
    {
        "entityClass": "DefaultEntityClass",
        "mac": [
            "62:76:b0:43:51:c7"
        ],
        "ipv4": [
            "10.0.0.1"
        ],
        "vlan": [],
        "attachmentPoint": [
            {
                "port": 3,
                "switchDPID": "00:00:00:00:00:00:00:04",
                "errorStatus": null
            }
        ],
        "lastSeen": 1363763762405
    },
    {
        "entityClass": "DefaultEntityClass",
        "mac": [
            "4a:77:dc:12:86:50"
        ],
        "ipv4": [
            "10.0.0.3"
        ],
        "vlan": [],
        "attachmentPoint": [
            {
                "port": 3,
                "switchDPID": "00:00:00:00:00:00:00:05",
                "errorStatus": null
            }
        ],
        "lastSeen": 1363763762427
    },
    {
        "entityClass": "DefaultEntityClass",
        "mac": [
            "de:42:94:b1:24:a7"
        ],
        "ipv4": [
            "10.0.0.2"
        ],
        "vlan": [],
        "attachmentPoint": [
            {
                "port": 4,
                "switchDPID": "00:00:00:00:00:00:00:04",
                "errorStatus": null
            }
        ],
        "lastSeen": 1363763762417
    },
    {
        "entityClass": "DefaultEntityClass",
        "mac": [
            "02:ee:63:f6:65:ea"
        ],
        "ipv4": [
            "10.0.0.4"
        ],
        "vlan": [],
        "attachmentPoint": [
            {
                "port": 4,
                "switchDPID": "00:00:00:00:00:00:00:05",
                "errorStatus": null
            }
        ],
        "lastSeen": 1363763767429
    },
    {
        "entityClass": "DefaultEntityClass",
        "mac": [
            "42:a4:fd:b6:62:b9"
        ],
        "ipv4": [
            "10.0.0.5"
        ],
        "vlan": [],
        "attachmentPoint": [
            {
                "port": 2,
                "switchDPID": "00:00:00:00:00:00:00:06",
                "errorStatus": null
            }
        ],
        "lastSeen": 1363763792493
    }
]


P.S: Here is a more complete example of mininet for you to refer to: http://blog.sflow.com/2013/06/flow-collisions.html
It also contains the setting of sFlow. Awesome!