11 from mininet.net
import Mininet
12 from mininet.node
import OVSSwitch, Controller, RemoteController
13 from mininet.log
import setLogLevel, info
14 from mininet.cli
import CLI
21 "Add the OpenFlow13 Protocol" 23 params[
'protocols'] =
'OpenFlow13' 24 OVSSwitch.__init__(self, name, **params)
29 netstat = subprocess.check_output([
'netstat',
'-rn']).split(
'\n')
31 if line.startswith(
'0.0.0.0'):
32 gateway = re.split(
'\s+', line)[1]
35 print "gateway=", gateway
38 net = Mininet( controller=RemoteController, switch=KildaSwitch, build=
False )
40 info(
"*** Creating (Remote) controllers\n" )
41 c0 = net.addController(
'c0', ip=gateway, port=6653)
43 info(
"*** Creating switches\n" )
44 s1 = net.addSwitch(
's1' )
45 s2 = net.addSwitch(
's2' )
47 info(
"*** Creating hosts\n" )
48 hosts1 = [ net.addHost(
'h%ds1' % n )
for n
in ( 1, 2 ) ]
49 hosts2 = [ net.addHost(
'h%ds2' % n )
for n
in ( 1, 2 ) ]
51 info(
"*** Creating links\n" )
58 info(
"*** Starting network\n" )
67 info(
"*** Running CLI\n" )
70 info(
"*** Stopping network\n" )
def __init__(self, name, params)