예제 #1
0
파일: start.py 프로젝트: arsheth/mininet
def startNetwork():
    "instantiates a topo, then starts the network and prints debug information"

    info('** Creating Quagga network topology\n')
    topo = QuaggaTopo()

    info('** Starting the network\n')
    global net
    net = MiniNExT(topo, controller=OVSController)
    net.start()


   # h1, h2, r1, r2, r3, r4 = net.get('host1', 'host2', 'router1', 'router2', 'router3', 'router4')

    #h1intf = h1.defaultIntf()
    #h1intf.setIP('192.168.1.1/24')
	
    #h2intf = h2.defaultIntf()
    #h2intf.setIP('192.168.2.1/24')

    info('** Dumping host connections\n')
    dumpNodeConnections(net.hosts)

    info('** Testing network connectivity\n')
    net.ping(net.hosts)

    info('** Dumping host processes\n')
    for host in net.hosts:
        host.cmdPrint("ps aux")

    info('** Running CLI\n')
    CLI(net)
예제 #2
0
def bbnet():
    "Create network and run Buffer Bloat experiment"
    print "starting mininet ...."
    # Seconds to run iperf; keep this very high
    seconds = 3600
    start = time()
    # Reset to known state
    topo = StarTopo(n=args.n, bw_host=args.bw_host,
                    delay='%sms' % args.delay,
                    bw_net=args.bw_net, maxq=args.maxq, diff=args.diff)
    net = Mininet(topo=topo, host=CPULimitedHost, link=TCLink,
                  autoPinCpus=True, controller=OVSController)
    net.start()
    dumpNodeConnections(net.hosts)
    net.pingAll()
    print args.diff
    if args.diff:
        print "Differentiate Traffic Between iperf and wget"
        os.system("bash tc_cmd_diff.sh")
    else:
        print "exec tc_cmd.sh"
        os.system("bash tc_cmd.sh %s" % args.maxq)
    sleep(2)
    ping_latency(net)
    print "Initially, the delay between two hosts is around %dms" % (int(args.delay)*2)
    h2 = net.getNodeByName('h2')
    h1 = net.getNodeByName('h1')
    h1.cmd('cd ./http/; nohup python2.7 ./webserver.py &')
    h1.cmd('cd ../')
    h2.cmd('iperf -s -w 16m -p 5001 -i 1 > iperf-recv.txt &')
    CLI( net )
    h1.cmd("sudo pkill -9 -f webserver.py")
    h2.cmd("rm -f index.html*")
    Popen("killall -9 cat", shell=True).wait()
def simpleTest():
    "Create and test a simple network"
    net = Mininet()
    #c0 = net.addController('c0',POXBridge)
    c0 = net.addController('c0',RemoteController)
    s1 = net.addSwitch('s1')
    s2 = net.addSwitch('s2',dpid='0000000000000012')
    s3 = net.addSwitch('s3')
    s4 = net.addSwitch('s4')
    h1 = net.addHost('h1')
    h2 = net.addHost('h2')
    h3 =net.addHost('h3')
    h4 = net.addHost('h4')
    l11= net.addLink(h1,s1)
    l22= net.addLink(h2,s2)
    l33= net.addLink(h3,s3)
    l44= net.addLink(h4,s4)

    l12= net.addLink(s1,s2)
    l23= net.addLink(s2,s3)
    l2f= net.addLink(s2,s4)
    net.start()
    h1.intfList()[0].setIP('10.43.21.1/24')
    h2.intfList()[0].setIP('10.43.21.2/24')
    h3.intfList()[0].setIP('10.43.21.3/24')
    h4.intfList()[0].setIP('10.43.21.4/24')
    print "Dumping host connections"
    dumpNodeConnections(net.hosts)
    print "Testing network connectivity"
    CLI(net)
    net.stop()
예제 #4
0
def setupITG( network ):
    for host in network.hosts:
        host.cmd( '/usr/sbin/sshd -D &')
        host.cmd( 'ITGRecv < /dev/null &' )

    # DEBUGGING INFO
    print
    print "Dumping host connections"
    dumpNodeConnections(network.hosts)
    print
    print "*** Hosts addresses:"
    print
    for host in network.hosts:
        print host.name, host.IP()
    print
    print "*** Type 'exit' or control-D to shut down network"
    print
    print "*** For testing network connectivity among the hosts, wait a bit for the controller to create all the routes, then do 'pingall' on the mininet console."
    print

    CLI( network )
    print "Killing ITGRecv(s)..."
    for host in network.hosts:
        host.cmd('kill %' + '/usr/sbin/sshd')
        host.cmd( 'pkill -15 ITGRecv')
    print "Stopping the network..."
    network.stop()
예제 #5
0
def main():
  start = time()
  try:
    topo = NetworkTopo(switch_bw=args.bw_net, host_bw=args.bw_host, switch_delay='%sms' %(args.delay, ), queue_size=23593)
    net = Mininet(topo=topo, host=CPULimitedHost, link=TCLink)
    net.start()
    dumpNodeConnections(net.hosts)
    net.pingAll()

    if args.http:
      test_http(net)
    else:
      run_tcp_first(net, args.tcp_n)

  except:
    print "-"*80
    print "Caught exception.  Cleaning up..."
    print "-"*80
    import traceback
    traceback.print_exc()
    raise
  finally:
    stop_all_iperf()
    net.stop()
    Popen("killall -9 top bwm-ng tcpdump cat mnexec; mn -c", shell=True, stderr=PIPE)
    Popen("pgrep -f webserver.py | xargs kill -9", shell=True).wait()
    stop_tcpprobe()
    end = time()
    cprint("Experiment took %s seconds\n" % (end - start), "yellow")
예제 #6
0
def perTest():
    "Specify performance parameters for the links"
    # Between core and aggregation switches
    linkopts1 = dict(bw=10, delay='5ms', loss=1, max_queue_size=1000, use_htb=True)
    # Between aggregation and edge switches
    linkopts2 = dict(bw=10, delay='5ms', loss=1, max_queue_size=1000, use_htb=True)
    # Between edge switches and hosts
    linkopts3 = dict(bw=10, delay='5ms', loss=1, max_queue_size=1000, use_htb=True)

    "Create and test a simple network"
    topo = CustomTopo(linkopts1=linkopts1, linkopts2=linkopts2, linkopts3=linkopts3, fanout=2)
    net = Mininet(topo=topo, host=CPULimitedHost, link=TCLink)
    net.start()

    print "Dumping host connections"
    dumpNodeConnections(net.hosts)

    print "Testing network connectivity"
    net.pingAll()

    print "Testing bandwidth between h1 with h2, h3 and h5"
    h1, h2 = net.get('h1', 'h2')
    net.iperf( ( h1, h2 ) )
    h1, h3 = net.get('h1', 'h3')
    net.iperf( ( h1, h3 ) )
    h1, h5 = net.get('h1', 'h5')
    net.iperf( ( h1, h5 ) )
    h1, h7 = net.get('h1', 'h7')
    net.iperf( ( h1, h7 ) )

    net.stop()
예제 #7
0
파일: bft2f.py 프로젝트: akshayka/bft2f
def main():
    parser = ArgumentParser()
    parser.add_argument('--verbose', '-v', action='store_true')
    args = parser.parse_args()

    topo = BftTopo()
    net = Mininet(topo=topo, host=CPULimitedHost, link=TCLink)
    net.start()
    create_etc_hosts(net)
    # This dumps the topology and how nodes are interconnected through
    # links.
    dumpNodeConnections(net.hosts)
    start_app(net)
    start_nodes(net, args.verbose)
    start_client(net)

    #CLI(net)

    sleep(5)
    start_user(net)
    CLI(net)
    endTime = time() + RUN_DURATION

    for p in popens.values():
       os.killpg(p.pid, signal.SIGTERM)
    net.stop()
def sshd( network, cmd='/usr/sbin/sshd', opts='-D' ):
    "Start a network, connect it to root ns, and run sshd on all hosts."
    switch = network.switches[ 0 ]  # switch to use
    ip = '10.123.123.1'  # our IP address on host network
    routes = [ '10.0.0.0/8' ]  # host networks to route to
    connectToRootNS( network, switch, ip, 8, routes )
    for host in network.hosts:
        host.cmd( cmd + ' ' + opts + '&' )
        host.cmd( 'ITGRecv -l /tmp/ITGRecv-Logs/ITGRecv-' + host.IP() + '.log > /dev/null &' )

    # DEBUGGING INFO
    print
    print "Dumping host connections"
    dumpNodeConnections(network.hosts)
    print
    print "*** Hosts are running sshd at the following addresses:"
    print
    for host in network.hosts:
        print host.name, host.IP()
    print
    print "*** Type 'exit' or control-D to shut down network"
    print
    print "*** For testing network connectivity among the hosts, wait a bit for the controller to create all the routes, then do 'pingall' on the mininet console."
    print

    CLI( network )
    for host in network.hosts:
        host.cmd( 'kill %' + cmd )
    network.stop()
예제 #9
0
파일: simple-topo.py 프로젝트: moz/mininet
def testIt():
    topo = SingleSwitch()
    net = Mininet(topo)
    net.start()
    dumpNodeConnections(net.hosts)
    net.pingAll()
    net.stop()
예제 #10
0
def createTopo():
    logging.debug("Create FatTopo")
    global topo
    topo = FatTopo()
    topo.createTopo()
    topo.createLink()

    logging.debug("Start Mininet")
    CONTROLLER_IP = "127.0.0.1"
    CONTROLLER_PORT = 6633
    global net
    net = Mininet(topo=topo, link=TCLink, controller=None)
    net.addController('controller', controller=RemoteController, ip=CONTROLLER_IP, port=CONTROLLER_PORT)
    net.start()

    logger.debug("dumpNode")
    # enableSTP()
    dumpNodeConnections(net.hosts)

    # pingTest(net)
    # iperfTest(net, topo)
    root = net.get(topo.HostList[0])
    makeTerm(root)
    # root.cmd('java -jar ../ncintents-bridge.jar 9000 &')

    run(host='172.20.4.112', port=8090)
    CLI(net)
    net.stop()
def myTopo():
    net = Mininet(switch=OVSKernelSwitch)
    net.addController('controller01',controller=RemoteController,ip=ofc_ip, port=ofc_port)

    spine1 = net.addSwitch(spine1_name, dpid=spine1_dpid)
    leaf1  = net.addSwitch(leaf1_name,  dpid=leaf1_dpid)
    leaf2  = net.addSwitch(leaf2_name,  dpid=leaf2_dpid)

    host1 = net.addHost(host1_name, ip=host1_ip)
    host2 = net.addHost(host2_name, ip=host2_ip)
    host3 = net.addHost(host3_name, ip=host3_ip)
    host4 = net.addHost(host4_name, ip=host4_ip)

    net.addLink(spine1, leaf1)
    net.addLink(spine1, leaf2)

    net.addLink(leaf1, host1)
    net.addLink(leaf1, host2)

    net.addLink(leaf2, host3)
    net.addLink(leaf2, host4)

    net.start()
    print "Dumping node connections"
    dumpNodeConnections(net.switches)
    dumpNodeConnections(net.hosts)

    ofp_version(spine1, ['OpenFlow13'])
    ofp_version(leaf1,  ['OpenFlow13'])
    ofp_version(leaf2,  ['OpenFlow13'])

    CLI(net)
    net.stop()
예제 #12
0
def RunTest():
    """TOPO"""
    topo = FatTreeTopo()
    topo.topoCreate(4,4,2,2,2)

    CONTROLLER_NAME = topo.crtlname
    CONTROLLER_IP = topo.crtlip
    CONTROLLER_PORT = topo.crtlport
    net = Mininet(topo=topo,build= False,link=TCLink, controller=None)
    time.sleep(1)
    net.addController( CONTROLLER_NAME,controller=RemoteController,
                      ip=CONTROLLER_IP,
                      port=CONTROLLER_PORT)

    net.start()
    dumpNodeConnections(net.hosts)
    net.pingAll()
    h1 = net.get('h000')
    h16 = net.get('h311')
    h2 = net.get('h001')
    h1.popen('iperf -s -u -i 1')
    h16.popen('iperf -s -u -i 1')
    h2.cmdPrint('iperf -c '+ h1.IP() + ' -u -t 10 -i 1 -b 100m')
    h2.cmdPrint('iperf -c '+ h16.IP() + ' -u -t 10 -i 1 -b 100m')
    CLI(net)
    net.stop()
예제 #13
0
 def do_net( self, _line ):
     "List network connections."
     nl=self.nodelist
     simhost=self.mn.nameToNode['simhost']
     x=nl.index(simhost)
     nl.remove(nl[x])
     dumpNodeConnections( nl )
예제 #14
0
def createTopo():
    logging.debug("LV1 Create HugeTopo")
    topo = HugeTopo()
    topo.createTopo()
    topo.createLink()
    # TODO  add multiple controller here
    logging.debug("LV1 Start Mininet")
    CONTROLLER_IP = "127.0.0.1"
    CONTROLLER_PORT = 6633
    c0 = Controller('c0', port=6633)
    c1 = Controller('c1', port=6634)
    c2 = Controller('c2', port=6635)
    c3 = Controller('c3', port=6636)
    c5 = RemoteController('c2', ip='127.0.0.1')
    net = Mininet(topo=topo, link=TCLink, controller=POX)
    for c in [c0, c1, c2, c3 ]:
        net.addController(c)
    net.start()
    logger.debug("LV1 dumpNode")
    enableSTP()
    dumpNodeConnections(net.hosts)

    #pingTest(net)
    #iperfTest(net, topo)


    CLI(net)
    p = pexpect.spawn( 'controller test' )
    # but first a simple ping test
    p.sendline( 'xterm c0' )
    net.stop()
예제 #15
0
def perfTest():
		"Create network and run simple performance test"
		topo =LinearTopo(k=Y)
		net =Mininet(topo=topo, host=CPULimitedHost, link=TCLink,controller=OVSController)
		count=1
		for i in range(1,X+1,2):
			stri="h"
			stri2="127.0.0."
			stri2=stri2+str(count)
			count=count+1
			stri=stri+str(i)
			hi=net.get(stri)
			hi.setIP(stri2,24)
		count=1
		for i in range(2,X+1,2):
			stri="h"
			stri2="192.168.0."
			stri=stri+str(i)
			stri2=stri2+str(count)
			count=count+1
			hi=net.get(stri)
			hi.setIP(stri2,29)

		net.start()
		print "Dumping host connections"
		dumpNodeConnections(net.hosts)
		print "Testing network connectivity"
		net.pingAll()
		net.stop()
예제 #16
0
    def __init__( self, loss):
        "Create custom topo."

        # Initialize topology
        Topo.__init__( self )
	
	self.loss = loss

        # Add hosts and switches
        leftHost = self.addHost( 'h1' )
        leftHost2 = self.addHost( 'h2' )
        rightHost = self.addHost( 'h3' )
        leftSwitch = self.addSwitch( 's4' )
        leftSwitch2 = self.addSwitch( 's5' )
        middleSwitch = self.addSwitch( 's6' )
        rightSwitch = self.addSwitch( 's7' )
	

        # Add links
        self.addLink( leftHost, leftSwitch , loss=self.loss ) #(h1,s4)
        self.addLink( leftHost2, leftSwitch2 , loss=self.loss ) #(h2,s5)
        self.addLink( leftSwitch, middleSwitch , loss=self.loss ) #(s4,s6)
        self.addLink( leftSwitch2, middleSwitch , loss=self.loss ) #(s5,s6)
        self.addLink( middleSwitch, rightSwitch , loss=self.loss ) #(s6,s7)
        self.addLink( rightSwitch, rightHost , loss=self.loss ) #(s7,h3)

	# preconfigure the ARP table
	arpNodes = [rightHost,rightSwitch]
	net = Mininet(self)
	
	print "\n dumping node connection info"	
	dumpNodeConnections(net.hosts)
	print "\n"
예제 #17
0
def perfTest():
	"Create network and run simple performance test"

	prm = myParam(n=200, data_size=200)
	print prm.n, prm.m, prm.data_size, prm.pipes
	topo = myTopo(prm.n, prm.m)
	net = Mininet(topo=topo, link=TCLink)

	net.start()
	print "Dumping host connections"
	dumpNodeConnections( net.hosts )
	print "Dumping switch connections"
	dumpNodeConnections( net.switches )
	#print "Testing network connectivity"
	#net.pingAll()
	print "Testing bandwidth under s1"
	h1, h2 = net.get('h1', 'h2')
	net.iperf((h1, h2))
	print "Testing bandwidth across tree"
	h1, h2 = net.get('h1', 'h%d'%(prm.n+1))
	net.iperf((h1, h2))

	for p in (1, 2, 5, 10, 20):
		prm.pipes = p
		simTrans(net.hosts, prm)
	#CLI( net )
	net.stop()
예제 #18
0
def startNetwork():
	"instantiates a topo, then starts the network and prints debug information"

	info('** Creating Quagga network topology\n')
	topo = QuaggaTopo()

	info('** Starting the network\n')
	global net
	net = MiniNExT(topo, controller=OVSController)
	net.start()

	info('** Dumping host connections\n')
	dumpNodeConnections(net.hosts)

	

	info('** Dumping host processes\n')
	#    for host in net.hosts:
	#        host.cmdPrint("ps aux")
	#    for host in net.hosts:
	#        host.cmdPrint('ifconfig')

	# Enabling IP forwarding
	net.get("R1").cmd("sysctl -w net.ipv4.ip_forward=1")
	net.get("R2").cmd("sysctl -w net.ipv4.ip_forward=1")
	net.get("R3").cmd("sysctl -w net.ipv4.ip_forward=1")
	net.get("R4").cmd("sysctl -w net.ipv4.ip_forward=1")

	# Setting Interface IPs
	net.get("R1").cmd("ifconfig R1-eth1 172.0.2.1/24")
	net.get("R1").cmd("ifconfig R1-eth2 172.0.6.2/24")
	net.get("R2").cmd("ifconfig R2-eth1 172.0.3.1/24")
	net.get("R4").cmd("ifconfig R4-eth1 172.0.3.2/24")
	net.get("R4").cmd("ifconfig R4-eth2 172.0.5.1/24")
	net.get("R3").cmd("ifconfig R3-eth1 172.0.5.2/24")
	
	# Static Routes from R1 to R2
	net.get("H1").cmd("route add default gw 172.0.1.2")
	net.get("R1").cmd("ip route add 172.0.3.0/24 via 172.0.2.2 dev R1-eth1")
	net.get("R1").cmd("ip route add 172.0.4.0/24 via 172.0.2.2 dev R1-eth1")
	net.get("R2").cmd("ip route add 172.0.4.0/24 via 172.0.3.2 dev R2-eth1")
	
	# Allowing Nating ar each router in the path from H1 to H2	
	net.get("R1").cmd("iptables -t nat -A POSTROUTING -o R1-eth1 -j MASQUERADE")
	net.get("R1").cmd("iptables -A FORWARD -i R1-eth1 -o R1-eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT")
	net.get("R1").cmd("iptables -A FORWARD -i R1-eth0 -o R1-eth1 -j ACCEPT") 
	net.get("R2").cmd("iptables -t nat -A POSTROUTING -o R2-eth1 -j MASQUERADE")
	net.get("R2").cmd("iptables -A FORWARD -i R2-eth1 -o R2-eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT")
	net.get("R2").cmd("iptables -A FORWARD -i R2-eth0 -o R2-eth1 -j ACCEPT") 
	net.get("R4").cmd("iptables -t nat -A POSTROUTING -o R4-eth0 -j MASQUERADE")
	net.get("R4").cmd("iptables -A FORWARD -i R4-eth0 -o R4-eth1 -m state --state RELATED,ESTABLISHED -j ACCEPT")
	net.get("R4").cmd("iptables -A FORWARD -i R4-eth1 -o R4-eth0 -j ACCEPT")


	info('** Testing network connectivity\n')
	net.ping(net.hosts)

	
	info('** Running CLI\n')
	CLI(net)
예제 #19
0
파일: deployment.py 프로젝트: rosmod/rosmod
def rosTest():
    "Create network and run simple performance test"
    topo = SingleSwitchTopo(n=3)
    net = Mininet(topo=topo, 
                  link=TCLink)
    net.start()
    print "Dumping host connections"
    dumpNodeConnections(net.hosts)
    print "Testing network connectivity"
    net.pingAll()
    h1, h2, h3 = net.get('h1', 'h2', 'h3')
    print "Starting roscore"
    output = h3.cmd('source /opt/ros/indigo/setup.bash && '
                    'export ROS_IP='+h3.IP()+
                    ' && export ROS_MASTER_URI=http://'+h3.IP()+
                    ':11311 && roscore &')
    print output
    print "Starting receiver"
    output = h2.cmd('export LD_LIBRARY_PATH=/home/jeb/:$LD_LIBRARY_PATH && export ROS_IP='+h2.IP()+
                    ' && export ROS_MASTER_URI=http://'+h3.IP()+
                    ':11311 && /home/jeb/node_main -config /home/jeb/receiver.xml --tg_time 50 &')
    print output
    print "Starting sender"
    output = h1.cmd('export LD_LIBRARY_PATH=/home/jeb/:$LD_LIBRARY_PATH && export ROS_IP='+h1.IP()+
                    ' && export ROS_MASTER_URI=http://'+h3.IP()+
                    ':11311 && /home/jeb/node_main -config /home/jeb/sender.xml --tg_time 50 --max_data_length_bits 6000 &')
    print output
    sleep(70)
    net.stop()
예제 #20
0
def multiSwitchTest():
    topo = MultiSwitchTopo(depth=2, fanout=4)
    #net = Mininet(topo, controller=OVSController)
    net = Mininet(topo, controller=lambda name: RemoteController(name, ip='192.168.56.1'))
    net.start()
    print "Dumping host connections"
    dumpNodeConnections(net.hosts)
    print "Testing network connectivity"
    net.pingAll()
    receivers = ["00:11:22:33:44:00",
                 "00:11:22:33:44:04",
                 "00:11:22:33:44:08",
                 "00:11:22:33:44:0c"]
    for host in net.hosts:
        if host.defaultIntf().MAC() in receivers:
            startLogReceiver(host)
        else:
            startLogSender(host)

    for host in net.hosts:
        if not (host.defaultIntf().MAC() in receivers):
            runGenerator(host)

    for host in net.hosts:
        if host.defaultIntf().MAC() in receivers:
            stopLogReceiver(host)
        else:
            stopLogSender(host)
    net.stop()
def  required(x,y):
    topo = MyTopo(x, y)
    net = Mininet(topo,host=CPULimitedHost, link=TCLink)
    net.start()

    for i in xrange(y):
        for j in xrange(y):
            if (i+1)%2==0 and (j+1)%2==1:
                net.nameToNode["h"+str(i+1)].cmd("iptables -A OUTPUT -o h"+str(i+1)+"-eth0 -d 10.0.0."+ str(j+1)+" -j DROP")
                net.nameToNode["h"+str(j+1)].cmd("iptables -A OUTPUT -o h"+str(j+1)+"-eth0 -d 10.0.0."+ str(i+1)+" -j DROP")
            elif (i+1)%2==1 and (j+1)%2==0:
                net.nameToNode["h"+str(i+1)].cmd("iptables -A OUTPUT -o h"+str(i+1)+"-eth0 -d 10.0.0."+ str(j+1)+" -j DROP")
                net.nameToNode["h"+str(j+1)].cmd("iptables -A OUTPUT -o h"+str(j+1)+"-eth0 -d 10.0.0."+ str(i+1)+" -j DROP")
    
    net.pingAll()
    try:
        
        print "Testing bandwidth between h1 and h3"
        h1, h3 = net.get('h1', 'h3')
        net.iperf((h1, h3))
    except:
        c=1
    try:
        
        print "Testing bandwidth between h1 and h3"
        h4, h2 = net.get('h2', 'h4')
        net.iperf((h2, h4))
    except:
        c=1

    
    dumpNodeConnections(net.switches)
    CLI(net)
    net.stop()
예제 #22
0
def main(argv):
    global _remControl
    global _controllers
    remote_ip = '127.0.0.1'
    lan = 2
    
    try:
        opts, args = getopt(argv[1:], 'r:l:', ['remote-ip=','lan='])
    except GetoptError as err:
        print err.msg, err.opt
        exit(1);
    print opts
    print args

    for opt, arg in opts:
        if opt in ('-r', '--remote-ip'):
            remote_ip = arg
        if opt in ('-l', '--lan'):
            lan = int(arg)

    _remControl = RemoteController('Remote Controller', ip=remote_ip)
    _controllers['remote'] = _remControl
    topo = HomeTopo(ethHosts=lan)
    net = Mininet(topo=topo, switch=MultiController, host=CPULimitedHost, 
                  link=TCLink, autoPinCpus=True, build=False)
    net.addController(_controller)
    net.build()
    topo.routerSetup(net)
    net.start()
    dumpNodeConnections(net.hosts)
    CLI( net )
    net.stop()
예제 #23
0
def run_quic_topology():

    # remove old files
    os.system( "rm /tmp/client-*")
    os.system( "rm /tmp/server-*")

    # kill old processes
    os.system( "killall -q controller" )
    os.system( "killall -q quic_client" )
    os.system( "killall -q quic_server" )

    topo = QuicTester()
    net = Mininet(topo=topo, host=Host, link=Link)
    net.start()

    client = net.getNodeByName('client')
    server = net.getNodeByName('server')
    
    set_all_IP(net, client, server)
    
    #Dump connections
    dumpNodeConnections(net.hosts)
    display_routes(net, client, server)

    run_quic(client, server)

    CLI(net)

    net.stop()
def main():
    """@todo: Docstring for main.
    :returns: @todo

    """
    linkopts1 = dict(bw=1000, delay='1ms')
    linkopts2 = dict(bw=100, delay='5ms')
    linkopts3 = dict(bw=10, delay='50ms')
    fanout = 4

    topo = CustomTopo(linkopts1, linkopts2, linkopts3, fanout)
    net = Mininet(topo = topo, link=TCLink)

    net.start()
    print "Dumping host connections"
    dumpNodeConnections(net.hosts)
    print "Testing network connectivity"

    h1 = net.get('h1')
    h27 = net.get('h27')

    print "Starting Test: ping h1 to h27"
    # Start pings
    outputString = h1.cmd('ping', '-c6', h27.IP())
    print outputString
    print

    #  print "Starting Test2: pingAll"
    #  net.pingAll()

    net.stop()
def setup_fattree_topo(kval):
    # setup fat-tree topology
    print("**** Setting up fat-tree topology ****\n")
    topo = fat_tree_topo()
    topo.setup_topo(kval)

    print("**** Setting up all the network links ****\n")
    topo.link_setup(kval)

    # instantiate mininet network
    print("**** Instantiating netwrok ****")
    net = Mininet(topo=topo, link=TCLink, controller=None)
    net.addController('floodlight', controller=RemoteController, ip="127.0.0.1", port=6653)

    print("**** Setting up IP and MAC addresses ****")
    ip_mac_setup(net, kval)

    # start the netwrok
    net.start()
   
    # start sshd on each host
    enable_ssh(net)

    # enable STP
    enable_stp(kval)

    dumpNodeConnections(net.hosts)
    #net.pingAll()

    # grab mininet CLI
    CLI(net)
    disable_ssh(net)
    net.stop()
예제 #26
0
 def setUp(self):
     super(FaucetTaggedTest, self).setUp()
     self.topo = FaucetSwitchTopo(n_tagged=4)
     self.net = Mininet(self.topo, controller=FAUCET)
     self.net.start()
     dumpNodeConnections(self.net.hosts)
     self.net.waitConnected()
예제 #27
0
def perfTest():
	topo = MyTopo()
	net = Mininet(topo=topo)
	dumpNodeConnections(net.hosts)
	h1, h2 = net.getNodeByName('h1', 'h2')	
	
	@route('/cmd/<node>/<cmd>')
	def cmd( node='h1', cmd='hostname' ):
    		out, err, code = net.get( node ).pexec( cmd )
    		return out + err
	
	@route('/stop')
	def stop():
		net.stop()

	@route('/run_http_client')
	def function():	
		result = h2.cmd('curl -o /dev/null -s -S -w data=%{url_effective},%{time_total},%{time_starttransfer},%{size_download},%{speed_download}\\n http://h1/getsize.py?length=6856')
		print result
		return 
	
	@route('/goto_cli')
	def function():
		CLI(net)
		print "stopping"
		net.stop()
		return 0

	net.start()
	run(host='localhost', port=8080 )
예제 #28
0
def bufferbloat(**kwargs):
    # Linux uses CUBIC-TCP by default that doesn't have the usual sawtooth
    # behaviour.  For those who are curious, replace reno with cubic
    # see what happens...
    # sysctl -a | grep cong should list some interesting parameters.
    os.system("sysctl -w net.ipv4.tcp_congestion_control=reno")
    
    # create the topology and network
    topo = BBTopo(int(kwargs['queue_size']), int(kwargs['ping_RTT']))
    net = Mininet(topo=topo, host=CPULimitedHost, link=TCLink, controller= OVSController)
    net.start()

    # This dumps the topology and how nodes are interconnected through
    # links.
    dumpNodeConnections(net.hosts)
    
    # This performs a basic all pairs ping test.
    net.pingAll()
    
    # Start all the monitoring processes
    start_tcpprobe("cwnd.txt")

    # TODO: Start monitoring the queue sizes.  Since the switch I
    # created is "s0", I monitor one of the interfaces.  Which
    # interface?  The interface numbering starts with 1 and increases.
    # Depending on the order you add links to your network, this
    # number may be 1 or 2.  Ensure you use the correct number.
    # qmon = start_qmon(...)    
    qmon = start_qmon(iface='s0-eth2', outfile='%s/q.txt' % ".")

    # TODO: Start iperf, pings, and the webserver.
    # start_iperf(net), ...
    start_iperf(net, kwargs['congestion_window'])
    start_webserver(net)
    start_ping(net)

    # TODO: measure the time it takes to complete webpage transfer
    # from h1 to h2 (say) 4-5 times.  Hint: check what the following
    # command does: curl -o /dev/null -s -w %{time_total} google.com
    # Now use the curl command to fetch webpage from the webserver you
    # spawned on host h1 (not from google!)
    print "starting timing tester"
    timing_results = timing_tester(net)

    # TODO: compute average (and standard deviation) of the fetch
    # times.  You don't need to plot them.  Just print them
    # here and explain your observations in the Questions part
    # in Part 2, where you analyze your measurements.
    print timing_results[0]
    print "Ave fetching time:  %.4f" % numpy.average(numpy.array(timing_results).astype(numpy.float))
    print "std dev. of fetching times: %.4f" % numpy.std(numpy.array(timing_results).astype(numpy.float))

    # Stop probing 
    stop_tcpprobe()
    qmon.terminate()
    net.stop()
    
    # Ensure that all processes you create within Mininet are killed.
    # Sometimes they require manual killing.
    Popen("pgrep -f webserver.py | xargs kill -9", shell=True).wait()
def startup():
   topo=Network1()
   net=Mininet(topo,link=TCLink)
   net.start()
   dumpNodeConnections(net.hosts)
   CLI(net)
   net.stop()
예제 #30
0
파일: services.py 프로젝트: wette/MaxiNet
 def create_mininet(self, topo=None, tunnels=[],  switch=UserSwitch, controller=None):
     "Create a Mininet and test it with pingall"
     self.setLogLevel('debug')
     self.logger.info("Creating mininet instance")
     if not topo:
         topo=SingleSwitchTopo(k=2)
     if controller:
         self.net = Mininet(topo=topo, intf=TCIntf, link=TCLink, switch=switch, controller=controller)
     else:
         self.net = Mininet(topo=topo, intf=TCIntf, link=TCLink, switch=switch)
     self.logger.info("Adding tunnels to mininet instance")
     for tunnel in tunnels:
         port=None
         cls=None
         if "port" in tunnel[2].keys():
             port = tunnel[2]["port"]
             del tunnel[2]["port"]
         if "cls" in tunnel[2].keys():
             cls = tunnel[2]["cls"]
             del tunnel[2]["cls"]
         self.addTunnel(tunnel[0], tunnel[1], port, cls, **tunnel[2])
     self.logger.info("Starting Mininet...")
     self.net.start()
     #print "Dumping host connections"
     dumpNodeConnections(self.net.hosts)
     self.logger.info("Startup complete.")
예제 #31
0
def perfTest():
    "Create network and run simple performance test"
    topo = SingleSwitchTopo(n=4)
    net = Mininet(topo=topo, host=CPULimitedHost, link=TCLink)
    net.start()
    print "Dumping host connections"
    dumpNodeConnections(net.hosts)
    print "Testing network connectivity"
    net.pingAll()
    print "Testing bandwidth between h1 and h4"
    h1, h4 = net.get('h1', 'h4')
    net.iperf((h1, h4), seconds=40)
    net.stop()
예제 #32
0
def start_net(net, ping_all=False, cli=False):
    """
    Starts the network that is passed to it.
    :param net: the network to be started
    :param ping_all: after start pingAll()
    :param cli: Drop the user in to a CLI so user can run commands.
    """
    net.start()
    dumpNodeConnections(net.hosts)
    if ping_all:
        net.pingAll()
    if cli:
        CLI(net)
예제 #33
0
def Test():
    "Create network and run simple performance test"
    topo = SingleSwitchTopo()
    net = Mininet( topo=topo,
                   host=CPULimitedHost, link=TCLink,
                   autoStaticArp=False )
    net.start()
    info( "Dumping host connections\n" )
    dumpNodeConnections(net.hosts)
    tracker,h1,h2,h3,h4,h5,h6 = net.getNodeByName('tracker','h1','h2','h3','h4','h5','h6')
    CLI(net,script = "script")
    CLI(net)
    net.stop()
예제 #34
0
def perfTest():
    "Create network and run simple performance test"
    topo = KalmanSwitchTopo()
    net = Mininet(topo=topo)
    net.start()
    # print "Dumping host connections"
    dumpNodeConnections(net.hosts)
    #print "Testing network connectivity"
    # net.pingAll()
    print "Testing bandwidth between h1 and h2"
    h1, h2 = net.get('h1', 'h2')
    net.iperf((h1, h2), seconds=5)
    net.stop()
예제 #35
0
def perfTest( lossy=True ):
    "Create network and run simple performance test"
    topo = SingleSwitchTopo( n=4, lossy=lossy )
    net = Mininet( topo=topo,
                   host=CPULimitedHost, link=TCLink,
                   autoStaticArp=True )
    net.start()
    print( "Dumping host connections" )
    dumpNodeConnections(net.hosts)
    print( "Testing bandwidth between h1 and h4" )
    h1, h4 = net.getNodeByName('h1', 'h4')
    net.iperf( ( h1, h4 ), l4Type='UDP' )
    net.stop()
예제 #36
0
파일: hw3.py 프로젝트: ltzone/2021Spring
def perfTest():
    "Create and test a simple network"
    topo = MyTopo(switch_num=SWITCH_NUM, host_num=HOST_NUM, conn_map=CONN_MAP)
    net = Mininet(topo)
    net.start()

    print("Dumping host connections")
    dumpNodeConnections(net.hosts)
    dumpNodeConnections(net.switches)
    input("Are you ready To ping? (Press Any Key to Continue)")
    net.pingAll()

    net.stop()
예제 #37
0
def simpleTest():
    "Create and test a simple network"
    # p=int(input())
    topo = SingleSwitchTopo(n=5)
    net = Mininet(topo)
    s23 = net.addSwitch('s23')
    print s23.cmd("echo 'Hello'")
    net.start()
    print "Dumping host connections"
    dumpNodeConnections(net.hosts)
    print "Testing network connectivity"
    net.pingAll()
    net.stop()
예제 #38
0
def perfTest():
    "Create network and run simple performance test"
    topo = ParkingLotTopo(n=3)
    net = Mininet(topo=topo,
                  host=CPULimitedHost,
                  link=TCLink,
                  controller=OVSController)
    net.start()
    print("Dumping host connections")
    dumpNodeConnections(net.hosts)
    print("Testing network connectivity")
    net.pingAll()
    # CLI( net )

    TCP_TYPE_first = 'bbr'  # bbr or cubic
    TCP_TYPE_second = 'bbr'  # bbr or cubic
    run_time_tot = 100  # total iperf3 runtime, in seconds. I recommend more than 300 sec.

    h1, h2, h3, h4, h5, h6, h7, h8 = net.get('h1', 'h2', 'h3', 'h4', 'h5',
                                             'h6', 'h7', 'h8')

    # ### To indirectly measure RTT delay
    # print("--- ping h6 to h2 ---") # to measure the bottleneck level at link S1-S2 and S2-S3
    # h5.cmd('ping 10.0.0.8 -i 1 -c %d > h5_ping_result_%s &' % (run_time_tot, TCP_TYPE_first))
    # print("--- ping h7 to h5 ---") # to measure the bottleneck level at link S2-S3
    # h2.cmd('ping 10.0.0.8 -i 1 -c %d > h2_ping_result_%s &' % (run_time_tot, TCP_TYPE_second))

    # Receiver of flow 1 = h1
    h1.cmd('iperf3 -s -i 1 > h1_server_%s &' % (TCP_TYPE_first))
    # Receiver of flow 2 = h4
    h4.cmd('iperf3 -s -i 1 > h4_server_%s &' % (TCP_TYPE_second))

    # First, start to send the flow 1 : h8 --> h1
    print("--- h8 sends to h1 with 1 TCP (%s) flow during %d sec ---" %
          (TCP_TYPE_first, run_time_tot))
    h8.cmd('iperf3 -c 10.0.0.1 -t %d -C %s > flow1_tcp%s &' %
           (run_time_tot, TCP_TYPE_first, TCP_TYPE_first))

    # wait 10 seconds
    time.sleep(10)

    # Secondly, start to send the flow 2 : h8 --> h4
    print("--- h8 sends to h4 with 1 TCP (%s) flow during %d sec ---" %
          (TCP_TYPE_second, run_time_tot - 10))
    h8.cmd('iperf3 -c 10.0.0.4 -t %d -C %s > flow2_tcp%s &' %
           (run_time_tot - 10, TCP_TYPE_second, TCP_TYPE_second))

    # wait enough until all processes are done.
    time.sleep((run_time_tot - 10) + 3)
    # CLI(net)
    net.stop()  # exit mininet
예제 #39
0
def Test():
    "Create network and run simple performance test"
    topo = SimpleTopo(k=2)
    net = Mininet(topo=topo, host=CPULimitedHost,
                  link=TCLink)  #, controller=RemoteController)
    s1 = net.getNodeByName('s1')
    s2 = net.getNodeByName('s2')
    if args.intf1 is not None:
        addRealIntf(net, args.intf1, s1)
    if args.intf2 is not None:
        addRealIntf(net, args.intf2, s2)


#   net.start()
    opts = '-D -o UseDNS=no -u0'

    #' '.join( sys.argv[ 1: ] ) if len( sys.argv ) > 1 else (
    rootnode = sshd(net, opts=opts)
    #   print "Dumping host connections"
    dumpNodeConnections(net.hosts)

    #   net.pingAll()
    h2 = net.getNodeByName('h2')
    #   dhcp = net.getNodeByName('dhcp')
    #   out = dhcp.cmd('sudo dhcpd')
    #   print "DHCPD = "+ out
    #h1.cmd("bash tc_cmd_diff.sh h1-eth0")
    #h1.cmd("tc -s show dev h1-eth0")
    h2.cmd('iperf -s -p 5001 -i 1 > iperf-recv_TCP.txt &')
    h2.cmd('iperf -s -p 5003 -u -i 1 > iperf-recv_UDP.txt &')
    #h2.cmd('iperf -s -p %s -i 1 > iperf_server_TCP.txt &' % 5001)
    #               (CUSTOM_IPERF_PATH, 5001, args.dir))
    #monitoring the network
    #monitor = Process(target=monitor_qlen,
    #args=("%s"%args.iface,float(args.sampleR),int(args.nQ), "%s_%s"% (args.exp,args.out)))

    for host in net.hosts:
        #host.cmd('tc qdisc del dev %s-eth0 root'%host)
        #host.cmd('tc qdisc add dev %s-eth0 root tbf rate 10Mbit latency 2s burst 15k mtu 1512'%host)
        host.cmd('ethtool -K %s-eth0 gso off tso off ufo off' % host)
    #start mininet CLI
    CLI(net)
    #terminate
    for host in net.hosts:
        host.cmd('kill %' + '/usr/sbin/sshd')
    os.system('killall -9 iperf')
    net.hosts[0].cmd('killall -9 dhcpd')
    stopNAT(rootnode)
    net.stop()

    Popen("killall -9 cat", shell=True).wait()
예제 #40
0
def buildlineTopo():
    '''
    h1---s1---s2---s3---h2
    '''
    pofNet = Mininet(switch=POFSwitch, controller=RemoteController)

    # build switches
    n = 5
    switchList = [
        pofNet.addSwitch('s%d' % i, listenPort=6633 + i)
        for i in range(1, n + 1)
    ]
    pofNet.addController('c0',
                         controller=RemoteController,
                         ip=IPAddr,
                         port=6666)
    host = pofNet.addHost('h1', mac="00:00:00:00:00:01")
    pofNet.addLink(host, switchList[0])

    lastSwitch = None
    for switch in switchList:
        if lastSwitch:
            pofNet.addLink(lastSwitch, switch)
        lastSwitch = switch
    # build hosts


#    hostlist = [pofNet.addHost('h%d'%i, mac="00:00:00:00:00:0%d"%i)for i in range(2,6)]
#   for host in hostlist:
#       pofNet.addLink(host, switchList[4])
    s6 = pofNet.addSwitch('s6', listenPort=6639)
    s7 = pofNet.addSwitch('s7', listenPort=6640)
    pofNet.addLink(switchList[2], s6)
    pofNet.addLink(switchList[3], s7)
    pofNet.addLink(s6, s7)
    #  host = pofNet.addHost('h9', mac="00:00:00:00:00:09")
    #  pofNet.addLink(host, s7)
    host = pofNet.addHost('h2', mac="00:00:00:00:00:02")
    pofNet.addLink(host, switchList[4])
    #  host = pofNet.addHost('h11', mac="00:00:00:00:00:0B")
    #  pofNet.addLink(host,s7)
    #  hostlist = [pofNet.addHost('h%d' % i, mac="00:00:00:00:00:0%d" % i) for i in range(6, 9)]
    # for host in hostlist:
    #     pofNet.addLink(host, switchList[3])
    # pofNet.delLinkBetween(switchList[1],switchList[2])
    # start the network
    pofNet.start()
    dumpNodeConnections(pofNet.switches)
    CLI(pofNet)
    pofNet.stop()
예제 #41
0
def perfTest():
    "Create network and run simple performance test"
    topo = ParkingLotTopo(n=3)
    net = Mininet(topo=topo,
                  host=CPULimitedHost,
                  link=TCLink,
                  controller=OVSController)
    net.start()
    print("Dumping host connections")
    dumpNodeConnections(net.hosts)
    print("Testing network connectivity")
    net.pingAll()
    CLI(net)  # start mininet interface
    net.stop()  # exit mininet
예제 #42
0
def simpleTest():
    "Create and test a simple network"
    topo = SingleSwitchTopo(n=4)
    net = Mininet(topo)
    net.addController('c0',
                      controller=RemoteController,
                      ip='127.0.0.1',
                      port=6633)
    net.start()
    print "Dumping host connections"
    dumpNodeConnections(net.hosts)
    print "Testing network connectivity"
    net.pingAll()
    net.stop()
예제 #43
0
def jellyfish():
    topo = JFTopo(nServers=args.nServers,
                  nSwitches=args.nSwitches,
                  nPorts=args.nPorts)
    net = Mininet(topo=topo, host=CPULimitedHost, link=TCLink)
    net.start()

    dumpNodeConnections(net.hosts)
    net.pingAll()

    net.stop()
    # Ensure that all processes you create within Mininet are killed.
    # Sometimes they require manual killing.
    Popen("pgrep -f webserver.py | xargs kill -9", shell=True).wait()
예제 #44
0
def loopyTest():
    topo = LoopyTopo()
    net = Mininet(topo=topo,
                  host=CPULimitedHost, link=TCLink, controller=RemoteController, autoSetMacs=True)
    net.start()
    print "Dumping host connections"
    dumpNodeConnections(net.hosts)
    # print "Testing network connectivity"
    # net.pingAll()
    # print "Testing bandwidth between h1 and h4"
    # h1, h4 = net.get('h1', 'h4')
    # net.iperf((h1, h4))
    CLI(net)
    net.stop()
예제 #45
0
def IotTest():
    controllerInstance = RemoteController('Iot-Controller',
                                          ip='10.108.100.254',
                                          port=6633)
    #controllerInstance = RemoteController('Iot-Controller',ip='127.0.0.1',port=6633)
    topo = MyTopo()
    net = Mininet(topo, build=False, ipBase='192.168.3.0/24')
    net.addController(controllerInstance)
    net.build()
    net.start()
    CLI(net)
    dumpNodeConnections(net.hosts)
    #net.ping(net.hosts)
    net.stop()
예제 #46
0
def Test():
    "Create network and run simple performance test"
    topo = SingleSwitchTopo()
    net = Mininet( topo=topo,
                   host=CPULimitedHost, link=TCLink,
                   autoStaticArp=False )
    net.start()
    info( "Dumping host connections\n" )
    dumpNodeConnections(net.hosts)
    info( "Testing bandwidth between h1 and h4\n" )
    h1, h2, h3 = net.getNodeByName('h1', 'h2', 'h3')
    #s1, s2 = net.getNodeByName('s1', 's2')
    CLI(net)
    net.stop()
예제 #47
0
def perfTest(banwid=10, tdelay='50ms', tloss=0):
    "Create network and run simple performance test"
    topo = SingleSwitchTopo(n=2, ibw=banwid, idelay=tdelay, iloss=tloss)
    net = Mininet(topo=topo, host=CPULimitedHost, link=TCLink)
    net.start()
    dumpNodeConnections(net.hosts)

    #    print "Pre-Starting test..."
    #    net.pingAll()

    h1, h2 = net.get('h1', 'h2')

    #    net.iperf( (h1, h2) )

    print h1.cmd('sudo mosquitto &')

    print "Starting test..."
    tvalues = []
    for num in range(5):
        start_time = time.clock()

        h2.cmd("""
            mqttc = mqtt.Client()
            mqttc.loop_start()
            print "000"
            mqttc.on_message = on_message
            mqttc.on_connect = on_connect
            mqttc.on_publish = on_publish
            mqttc.on_subscribe = on_subscribe
            print "A"
            mqttc.connect(broker_add, 1883, keepalive=60)
            print "B"
            mqttc.subscribe(sensor_name, 0)
            print "C"
            new_s_value = random.randint(1, 1000)
            print "D"
            new_sensor_t = {'value': str(new_s_value)}
            print "E"
            the_msg_str = json.dumps(new_sensor_t)
            print "F"
            mqttc.publish(sensor_name,the_msg_str)
            print "G"
            """)

        elapsed = time.clock() - start_time
        tvalues.append(elapsed)
        print elapsed * 1000, "msec"

    print "Average elapsed time = ", numpy.mean(tvalues) * 1000, " msec"
    net.stop()
예제 #48
0
def test():
    "Create network and run simple performance test"
    topo = SingleSwitchTopo()
    net = Mininet(topo=topo, host=CPULimitedHost, link=TCLink)
    info('Starting network\n')
    net.start()
    print "Dumping host connections"
    dumpNodeConnections(net.hosts)
    print "Testing network connectivity"
    net.pingAll()
    info('Running CLI\n')
    CLI(net)
    info('Stoping network\n')
    net.stop()
예제 #49
0
def simpleTest():
    "Create and test the  network"
    topo = NewTopo(n=4)
    net = Mininet(topo=topo, link=TCLink, host=CPULimitedHost)
    print "Starting the network"
    net.start()
    print "Dumping host connections"
    dumpNodeConnections(net.hosts)
    print "Testing network connectivity"
    hosts = net.hosts
    h1, h2, h3, h4, h5, h6, h7, h8 = net.get('h1', 'h2', 'h3', 'h4', 'h5',
                                             'h6', 'h7', 'h8')
    ping10(net, (h1, h2, h3, h4, h5, h6, h7, h8))
    net.stop()
예제 #50
0
def simpleTest():
    "Create and test a simple network"
    topo = SingleSwitchTopo(n=5)
    net = Mininet(topo, controller=None)
    " Remote Ryu Controller"
    c = RemoteController('c', '0.0.0.0', 6633)
    net.addController(c)
    net.start()
    print "Dumping host connections"
    dumpNodeConnections(net.hosts)
    CLI(net)
    #print "Testing network connectivity"
    #net.pingAll()
    net.stop()
예제 #51
0
def test_MininetLinearTopo():

    net = Mininet(topo=LinearTopo(n=5), link=TCLink)
    net.start()

    print "Dumpingg host connections"
    dumpNodeConnections(net.hosts)

    print "Testing network connectivity"
    net.pingAll()

    # CLI(net)

    net.stop()
예제 #52
0
def main():
    "Create and run the Wordcount mapreduce program in Mininet topology"

    # parse the command line
    parsed_args = parseCmdLineArgs()

    # instantiate our topology
    print "Instantiate topology"
    topo = MR_Topo(Racks=parsed_args.racks,
                   M=parsed_args.map,
                   R=parsed_args.reduce)

    # create the network
    print "Instantiate network"
    # net = Mininet (topo)
    net = Mininet(topo=topo, controller=OVSController)

    # activate the network
    print "Activate network"
    net.start()

    # debugging purposes
    print "Dumping host connections"
    dumpNodeConnections(net.hosts)

    # debugging purposes
    print "Testing network connectivity"
    net.pingAll()

    # print "Running wordcount apparatus"
    # Unfortunately, I cannot get this to work :-(
    # runMapReduceWordCount (net.hosts, parsed_args)

    print "Generating commands file to be sourced"
    genCommandsFile(net.hosts, parsed_args)

    # run the cli
    CLI(net)

    # @NOTE@
    # You should run the generated commands by going to the
    # Mininet prompt on the CLI and typing:
    #     source commands.txt
    # Then, keep checking if all python jobs (except one) are completed
    # You can look at the *.out files which have all the debugging data
    # If there are errors in running the python code, these will also
    # show up in the *.out files.

    # cleanup
    net.stop()
예제 #53
0
def perfTest():
    "Create network and run simple performance test"
    topo = SingleSwitchTopo(n=4)
    net = Mininet(topo=topo,
                  autoSetMacs=True,
                  host=CPULimitedHost,
                  link=TCLink,
                  autoStaticArp=False,
                  controller=RemoteController)
    print "Dumping host connections"
    net.start()
    dumpNodeConnections(net.hosts)
    CLI(net)
    net.stop()
예제 #54
0
 def create_new_net(self):
     net_config = self.new_net_configuration()
     topo = SingleSwitchTopoWithLinkConfig(4, net_config)
     net = Mininet(topo=topo)
     #,               host=CPULimitedHost, link=TCLink )
     self.net = net
     net.start()
     print("Dumping host connections")
     dumpNodeConnections(net.hosts)
     print("Testing network connectivity")
     net.pingAll()
     print("Testing bandwidth between h1 and h4")
     h1, h4 = net.get('h1', 'h4')
     net.iperf((h1, h4))
예제 #55
0
def main():
    setLogLevel('info')
    tp = MyTopo()
    net = Mininet(tp,
                  controller=RemoteController(ip='127.0.0.1',
                                              name='RyuController'),
                  autoStaticArp=True)
    net.addNAT().configDefault()
    net.start()

    dumpNodeConnections(net.hosts)
    net.staticArp()  # Not needed if autoStaticArp=True
    CLI(net)
    net.stop()
def main():
    topo = CustomTopology()
    net = Mininet(topo=topo,
                  link=TCLink,
                  controller=RemoteController,
                  switch=OVSSwitch,
                  autoSetMacs=True)
    net.start()
    print "Dumping host connections"
    dumpNodeConnections(net.switches)
    dumpNodeConnections(net.hosts)
    net.pingAll()
    CLI(net)
    net.stop()
def perfTest():
    # "Create network and run simple performance test"
    topo = SingleSwitchTopo(n=4)
    net = Mininet(topo=topo, host=CPULimitedHost, link=TCLink)
    net.start()
    print("Dumping host connections")
    dumpNodeConnections(net.hosts)
    print("Testing network connectivity")
    net.pingAll()

    print('*** Running CLI\n')
    CLI(net)
    print('*** Stopping network')
    net.stop()
def start_cli():
    topo = create_topo()
    net = Mininet(topo=topo)
    net.start()
    dumpNodeConnections(net.hosts)
    s1, s2, h1, h2 = net.get('s1', 's2', 'h1', 'h2')
    net.pingAll()
    h1.cmd('ethtool --offload h1-eth0 rx off tx off')
    h2.cmd('ethtool --offload h2-eth0 rx off tx off')
    h2.cmd('python3 modbus_server.py &')
    h1.cmd('tcpdump -i h1-eth0 -w h1_without_snort.pcap &')
    h2.cmd('tcpdump -i h2-eth0 -w h2_without_snort.pcap &')
    CLI(net)
    net.stop()
def perfTest():
    "Create network and run simple perf test"
    topo = DualSwitchTopo()
    net = Mininet(topo=topo, link=TCLink)
    net.start()
    print "Dumping host connections"
    dumpNodeConnections(net.hosts)
    print "Testing network connectivity"
    net.pingAll()
    c0, h1, h2, h3, h4, h5, h6 = net.get('c0', 'h1', 'h2', 'h3', 'h4', 'h5',
                                         'h6')
    print "IP address of h6 is ", h6.IP()
    CLI(net)
    net.stop()
예제 #60
0
def perfTest():
    "Create network and run simple performance test"
    IP = sys.argv[1]
    print "Ip of the controller is: " + IP
    topo = CreateTopo( n=4 )
    net = Mininet( topo=topo, controller=lambda name: RemoteController('c1', ip=IP, port=6633), switch=OVSKernelSwitch)
    # ~ c1 = net.addController('c1', controller=RemoteController, ip=IP, port=6653)
    c1 = net.controllers[0]
    c1.start()
    net.start()
    print "Dumping host connections"
    dumpNodeConnections( net.hosts )
    print "Testing network connectivity"
    net.pingAll()