Test 1: mininet-wifi + pyretic


  If you want to run the following example, I suggest that you can use SDN hub VM. And install the mininet-wifi.(See the installation part)




In this topology, ap1 is also an openvswitch that accepts openflow control messages from remote controller. ap1 has two ports: ap1-eth1 is connected to h1 and ap1-wlan0 is for wireless station connections.


[mininet-wifi Scripts: test_infrastructure.py]



from mininet.net import Mininet

from mininet.node import  Controller, RemoteController, OVSKernelSwitch

from mininet.cli import CLI

from mininet.log import setLogLevel

from mininet.link import TCLink


def topology():

    "Create a network."

    net = Mininet( controller=Controller, link=TCLink, switch=OVSKernelSwitch )


    print "*** Creating nodes"

    sta1 = net.addStation( 'sta1', ip="" )

    sta2 = net.addStation( 'sta2', ip="" )

    h1 = net.addHost( 'h1', ip="" )

    ap1 = net.addBaseStation( 'ap1', ssid="ssid_1", mode="g", channel="1" )

    c0 = net.addController('c0', controller=RemoteController, ip='', port=6633 )


    print "*** Adding Link"


    net.addLink(sta1, ap1)

    net.addLink(sta2, ap1)


    print "*** Starting network"



    ap1.start( [c0] )


    print "*** Running CLI"

    CLI( net )

    print "*** Stopping network"



if __name__ == '__main__':

    setLogLevel( 'info' )



[pyretic controller: test1.py. This file is placed under ~/pyretic/pyretic/modules folder.] Note: The following code will allow h1 to ping sta1, but not sta2.

from pyretic.lib.corelib import*

from pyretic.lib.std import *


ip1 = IPAddr('')

ip2 = IPAddr('')

ip3 = IPAddr('')


route1 = match(switch=1) >> fwd(2)


route2 = match(switch=1) >> drop


route3 = match(switch=1) >> fwd(1)


myroute = ((match(dstip=ip1) >> route1) +

           (match(dstip=ip2) >> route2) +

           (match(dstip=ip3) >> route3))


def main():

   return myroute






some basic openvswitch operations.




wireless information for ap1, sta1, and sta2.


Dr. Chih-Heng Ke

Department of Computer Science and Information Engineering, National Quemoy University, Kinmen, Taiwan

Email: smallko@gmail.com