当前位置: 首页>>代码示例>>Python>>正文


Python Mininet.staticArp方法代码示例

本文整理汇总了Python中mininet.net.Mininet.staticArp方法的典型用法代码示例。如果您正苦于以下问题:Python Mininet.staticArp方法的具体用法?Python Mininet.staticArp怎么用?Python Mininet.staticArp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mininet.net.Mininet的用法示例。


在下文中一共展示了Mininet.staticArp方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: emptyNet

# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import staticArp [as 别名]
def emptyNet():
	net = Mininet(controller = RemoteController, switch = OVSKernelSwitch)
	#add Controller
	c1 = net.addController('c1', controller = RemoteController, ip = "127.0.0.1", port = 6633)
	
	#tt
	#add Host
	h1 = net.addHost('h1', ip = '10.0.0.1', mac = '00:00:00:00:00:01')
	h2 = net.addHost('h2', ip = '10.0.0.2', mac = '00:00:00:00:00:02')
	#h3 = net.addHost('h3', ip = '10.0.0.3')

	#add Switch
	s1 = net.addSwitch('s1')
	s2 = net.addSwitch('s2')

	#add Link
	s1.linkTo(h1)
	s2.linkTo(h2)
	s1.linkTo(s2)
	#s1.linkTo(h3)

	net.build()
	c1.start()
	s1.start([c1])
	s2.start([c1])
	net.start()
	net.staticArp()
	print s1.cmd('ovs-vsctl set Bridge s1 protocols=OpenFlow13')
	print s2.cmd('ovs-vsctl set Bridge s2 protocols=OpenFlow13')
	CLI(net)
	net.stop()
开发者ID:ychhsieh,项目名称:research,代码行数:33,代码来源:simple_topo.py

示例2: myNet

# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import staticArp [as 别名]
def myNet():
   MultiSwitch13 = partial( MultiSwitch, protocols='OpenFlow13' )
   #tree_topo = TreeTopo(depth=3,fanout=2)
   tree_topo = SingleSwitchTopo(n=14)

   net = Mininet(controller=RemoteController, topo=tree_topo, switch=MultiSwitch13, build=False, autoSetMacs=True)

   info( '*** Adding controllers\n')
   #c1 = net.addController('c1', controller=RemoteController, ip="127.0.0.1", port=6633)
   c1 = net.addController('c1', controller=RemoteController, ip="192.168.1.1", port=6633)
   c2 = net.addController('c2', controller=RemoteController, ip="192.168.1.2", port=6633)
   c3 = net.addController('c3', controller=RemoteController, ip="192.168.1.3", port=6633)

#   info( '*** Add hosts\n')
#   h1 = net.addHost( 'h1', ip='10.0.0.1' )
#   h2 = net.addHost( 'h2', ip='10.0.0.2' )
#   h3 = net.addHost( 'h3', ip='10.0.0.3' )
#   h4 = net.addHost( 'h4', ip='10.0.0.4' )

#   info( '*** Add switches\n')
#   s1 = net.addSwitch( 's1', cls=OVSKernelSwitch, protocols='OpenFlow13' )
#   s2 = net.addSwitch( 's2', cls=OVSKernelSwitch, protocols='OpenFlow13' )
#   s3 = net.addSwitch( 's3', cls=OVSKernelSwitch, protocols='OpenFlow13' )
#   s4 = net.addSwitch( 's4', cls=OVSKernelSwitch, protocols='OpenFlow13' )

#   info( '*** Add links\n')
#   s1.linkTo( h1 )
#   s1.linkTo( s2 )
#   s2.linkTo( h2 )
#   s2.linkTo( s3 )
#   s3.linkTo( h3 )
#   s3.linkTo( s4 )
#   s4.linkTo( h4 )

   info( '*** Starting network\n')
   net.build()

   info( '*** Starting controllers\n')
   c1.start()
   c2.start()
   c3.start()

#   info( '*** Starting switches\n')
#   s1.start([c1,c2,c3])
#   s2.start([c1,c2,c3])
#   s3.start([c1,c2,c3])
#   s4.start([c1,c2,c3])

   net.start()
   net.staticArp()
#   i = 0;
#   while i < 10:
#     h1, h2  = random.choice(net.hosts), random.choice(net.hosts)
#     print h1.IP(), "-->", h2.IP()
#     sent, received, rttmin, rttavg, rttmax, rttdev = ping(h1, h2)
#     print received,"/",sent
#     i = i + 1
#     sleep(1)
   CLI( net )
   net.stop()
开发者ID:CRAT-EU,项目名称:T-NOVA,代码行数:62,代码来源:setup_mininet_with_cluster_v2.py

示例3: main

# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import staticArp [as 别名]
def main():
    topo = PyRouterTopo(args)
    net = Mininet(topo=topo, link=TCLink, autoSetMacs=True, cleanup=True, listenPort=10001, controller=RemoteController)
    mb = net.get('mb')
    mb.setIP('0.0.0.0') # don't set an IP address on middlebox
    net.staticArp()
    start_webservers(net)
    net.interact()
开发者ID:CarrieBurgess,项目名称:cosc465_project7,代码行数:10,代码来源:start_mininet.py

示例4: runMultiLink

# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import staticArp [as 别名]
def runMultiLink():
    "Create and run multiple link network"
    topo = simpleMultiLinkTopo( n=5 )
    net = Mininet( topo=topo, switch=OVSSwitch, controller=None, autoSetMacs=True, autoStaticArp=True )
    net.addController(RemoteController( 'c0', ip='192.168.12.50' ))
    net.staticArp()
    net.start()
    CLI( net )
    net.stop()
开发者ID:sphaero,项目名称:sdn_poc,代码行数:11,代码来源:spftopo.py

示例5: start

# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import staticArp [as 别名]
def start(controllers=[{'ip':'127.0.0.1', 'port': 6633}]):

    # Set up logging
    lg.setLogLevel('info')
    lg.setLogLevel('output')

    net = Mininet(switch=OVSSwitch, controller=None, autoStaticArp=True, listenPort=6634)

    for indx, ctl in enumerate(controllers):
        print("Adding controller", (1+indx))
        net.addController(('c%d' % indx), controller=RemoteController, ip=ctl['ip'], port=ctl['port'])


    # Add hosts
    h1 = net.addHost('h1')
    h2 = net.addHost('h2')

    #physical_intf = 'eth1'

    #Add switch that accepts only OpenFlow 1.0

    s1 = net.addSwitch('s1', dpid='00:00:00:00:00:00:00:01', protocols='OpenFlow10')

    #Will accept both OpenFlow 1.0 and 1.3
    #s2 = net.addSwitch('s2', dpid='00:00:00:00:00:00:00:02', protocols='OpenFlow10,OpenFlow13')

    #Will accept all protocols support by openvswitch
    #s3 = net.addSwitch('s2', dpid='00:00:00:00:00:00:00:02')

    # Connect physical interface
    #print "Adding physical hosts to mininet network..."
    #_intf1 = Intf( physical_intf, node=s1, port=1 )


    net.addLink(h1, s1)
    net.addLink(h2, s1)


    # Start the network and prime other ARP caches
    net.start()
    net.staticArp()

    # Enter CLI mode
    output("Network ready\n")
    output("Getting results...")
    time.sleep(60)

    process_results()
    #output("Press Ctrl-d or type exit to quit\n")
    net.stop()
开发者ID:vmehmeri,项目名称:sfc-lab,代码行数:52,代码来源:sample_network.py

示例6: emptyNet

# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import staticArp [as 别名]
def emptyNet():

    net = Mininet(controller=RemoteController, switch=OVSKernelSwitch, build=False, listenPort=6633)

    c1 = net.addController('c1', controller=RemoteController, defaultIP="127.0.0.1", port=6633)

    s1 = net.addSwitch( 's1', protocols = 'OpenFlow13' )
    s2 = net.addSwitch( 's2', protocols = 'OpenFlow13' )
    s3 = net.addSwitch( 's3', protocols = 'OpenFlow13' )
    s4 = net.addSwitch( 's4', protocols = 'OpenFlow13' )

    h1 = net.addHost( 'h1', ip='10.0.0.1/24', mac = '00:00:00:00:00:01' )
    h2 = net.addHost( 'h2', ip='30.0.0.42/24', mac = '00:00:00:00:00:42' )

    l1 = net.addHost( 'l1', ip='10.0.0.11/24', mac = '00:00:00:00:00:11' )
    l2 = net.addHost( 'l2', ip='20.0.0.41/24', mac = '00:00:00:00:00:41' )

    n1 = net.addHost( 'n1', ip='20.0.0.21/24', mac = '00:00:00:00:00:21' )
    n2 = net.addHost( 'n2', ip='20.0.0.31/24', mac = '00:00:00:00:00:31' )
 
    s1_h1 = net.addLink(s1,h1)
    s1_l1 = net.addLink(s1,l1)
    s1_l12 = net.addLink(s1,l1)
    s1_s3 = net.addLink(s1,s3)
    s1_s4 = net.addLink(s1,s4)

    s4_n2 = net.addLink(s4,n2)
    s4_n22 = net.addLink(s4,n2)
    s4_s2 = net.addLink(s4,s2)

    s3_n1 = net.addLink(s3,n1)
    s3_n12 = net.addLink(s3,n1)
    s3_s2 = net.addLink(s3,s2)

    s2_l2 = net.addLink(s2,l2)
    s2_l22 = net.addLink(s2,l2)
    s2_h2 = net.addLink(s2,h2)
   
    net.build()
    c1.start()
    s1.start([c1])
    s2.start([c1])
    s3.start([c1])
    s4.start([c1])
    net.start()
    net.staticArp()
    CLI( net )
    net.stop()
开发者ID:windyswsw,项目名称:LoadBalancerOpenFlowV0,代码行数:50,代码来源:Topology.py

示例7: start

# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import staticArp [as 别名]
def start(ip="127.0.0.1",port="6633",app="Netgaze"):
    net = Mininet(switch=ClickKernelSwitch)

    net.addController('c0')
    h1 = net.addHost('h1', ip='144.0.3.0')
    h2 = net.addHost('h2', ip='132.0.2.0')
    sw = net.addSwitch("click")
    sw.linkAs(h1, "h1")
    sw.linkAs(h2, "h2")

    net.start()
    net.staticArp()

    output("Network ready\n")
    time.sleep(3)
    # Enter CLI mode
    output("Press Ctrl-d or type exit to quit\n")

    lg.setLogLevel('info')
    CLI(net)
    lg.setLogLevel('output')
    net.stop()
开发者ID:basus,项目名称:click-mininet,代码行数:24,代码来源:sandbox.py

示例8: test_wget

# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import staticArp [as 别名]
def test_wget(ip="127.0.0.1",port="6633"):
    net = Mininet(switch=ClickKernelSwitch,
                  controller=lambda n: RemoteController(n,
                                                        defaultIP=ip, port=int(port)))

    net.addController('c0')
    h1 = net.addHost('h1', ip='144.0.3.0')
    h2 = net.addHost('h2', ip='132.0.2.0')
    sw = net.addSwitch("click")
    sw.linkAs(h1, "h1")
    sw.linkAs(h2, "h2")

    net.start()
    net.staticArp()

    output("Network ready\n")
    time.sleep(3)

    # Run a simple file transfer test
    output(h1.cmd("./serve.sh"))
    output(h2.cmd("wget 144.0.3.0"))

    time.sleep(1)
    net.stop()
开发者ID:basus,项目名称:click-mininet,代码行数:26,代码来源:test.py

示例9: GenericMiddleBoxTopology

# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import staticArp [as 别名]
class GenericMiddleBoxTopology(object):
    """
    This class creates a basic experminet topology containing
    traffic sources and targets as well as intermediate middlebox
    machines. The number of hosts per type can be defined in the
    constructor.

    Management network: 10.0.0.0/8
    User data network:  20.0.0.0/8

     client1  --         -- mb1 --          -- target1
                |       |    |    |        |
                -- s1 --    s3     -- s2 --
                |       |    |    |        |
     client2  --         -- mb2 --          -- target2

    """

    def __init__(self, source_instances=2, target_instances=1, mbox_instances=2):
        self.source_instances = source_instances
        self.target_instances = target_instances
        self.mbox_instances = mbox_instances

        # bring up Mininet
        self.net = Mininet(
            host=CPULimitedHost, link=TCLink, autoSetMacs=True)

        # topology elements
        self.controllers = []
        self.switches = []
        self.middlebox_hosts = []
        self.source_hosts = []
        self.target_hosts = []
        # single pointers to nw components
        self.control_switch = None
        self.source_switch = None
        self.target_switch = None
        self.default_controller = None
        self.data_controller = None

        # do network setup
        self.setup_controllers()
        self.setup_switches()
        self.setup_hosts()


    def start_network(self):
        # run the network
        self.net.staticArp()
        #self.net.start()
        # build network
        self.net.build()
        # start controllers
        self.data_controller.start()
        self.default_controller.start()
        # start switches and assign controller
        self.control_switch.start([self.default_controller])
        self.source_switch.start([self.data_controller])
        self.target_switch.start([self.data_controller])
        # additional start tasks
        self.config_middlebox_hosts()
        self.run_middlebox_hosts()
        self.run_target_hosts()
        time.sleep(5)  # give servers some time to come up
        self.run_source_hosts()

    def test_network(self):
        # debugging
        print "### Dumping host connections"
        dumpNodeConnections(self.net.hosts)
        if PARAMS.duration < 0:
            # only test if we are in CLI mode (save time)
            print "### Testing middlebox replica connectivity"
            if self.net.ping(hosts=self.middlebox_hosts) < 0.1:
                print "### OK"

    def enter_cli(self):
        # enter user interface
        CLI(self.net)
        self.net.stop()

    def setup_controllers(self):
        # default controller for managemen switch
        c1 = self.net.addController("c1", port=6634)
        self.default_controller = c1
        self.controllers.append(c1)
        # custom controller for user traffic management
        c2 = self.net.addController(
            "c2", controller=RemoteController, ip='127.0.0.1', port=6633)
        self.data_controller = c2
        self.controllers.append(c2)

    def setup_switches(self):
        # management switch
        s = self.net.addSwitch("s1")
        self.switches.append(s)
        self.control_switch = s
        # source switch
        s = self.net.addSwitch("s2")
        self.switches.append(s)
#.........这里部分代码省略.........
开发者ID:mpeuster,项目名称:estate,代码行数:103,代码来源:topology.py

示例10: exampleNet

# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import staticArp [as 别名]
def exampleNet():

	IP_PREFIX='192.168.137.'
	MININET_VM_IP=IP_PREFIX+'110'
	CONTROLLER_IP=IP_PREFIX+'110'
	#MANAGER_IP=IP_PREFIX+'100'
	H1_VM_IP=IP_PREFIX+'10'
	H2_VM_IP=IP_PREFIX+'20'
	H3_VM_IP=IP_PREFIX+'30'
	
	#intfName = 'eth1'
	#_intf = Intf( intfName, node=s1 )

	net = Mininet( topo=None, controller=None, build=False)

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



	# Add hosts and switches
	h1 = net.addHost( 'h1', ip='10.0.0.1', mac='00:00:00:00:00:01')
	h2 = net.addHost( 'h2', ip='10.0.0.2', mac='00:00:00:00:00:02' )
	h3 = net.addHost( 'h3', ip='10.0.0.3', mac='00:00:00:00:00:03' )
	h4 = net.addHost( 'h4', ip='10.0.0.4' )
	h5 = net.addHost( 'h5', ip='10.0.0.5' )
	h6 = net.addHost( 'h6', ip='10.0.0.6' )

	s1 = net.addSwitch( 's1', protocols='OpenFlow10' )
	s2 = net.addSwitch( 's2', protocols='OpenFlow10' )
	s3 = net.addSwitch( 's3', protocols='OpenFlow10' )
	s4 = net.addSwitch( 's4', protocols='OpenFlow10' )
	s5 = net.addSwitch( 's5', protocols='OpenFlow10' )
	s6 = net.addSwitch( 's6', protocols='OpenFlow10' )
	s7 = net.addSwitch( 's7', protocols='OpenFlow10' )

	# Add links
	net.addLink( s1, s5 )
	net.addLink( s1, s2 )
	net.addLink( s2, s4 )
	net.addLink( s2, s3 )
	net.addLink( s2, s7 )
	net.addLink( s3, s4 )
	net.addLink( s3, s6 )
	net.addLink( s4, s5 )
	net.addLink( s4, s7 )
	net.addLink( s6, s7 )
	
	
	net.addLink( h1, s1 )
	net.addLink( h2, s2 )
	net.addLink( h3, s4 )
	net.addLink( h4, s4 )
	net.addLink( h5, s2 )
	net.addLink( h6, s3 )
	
	## Configure GRE tunnel ##

	# Delete old tunnel if still exists
	s1.cmd('ip tun del s1-gre1')
	s2.cmd('ip tun del s2-gre1')
	s4.cmd('ip tun del s4-gre1')

	# Create GRE tunnels
	print "Creating GRE tunnels..."
	
	s1.cmd('ip li ad s1-gre1 type gretap local '+MININET_VM_IP+' remote '+H1_VM_IP+' ttl 64')
	s1.cmd('ip li se dev s1-gre1 up')
	Intf( 's1-gre1', node=s1 )

	s2.cmd('ip li ad s2-gre1 type gretap local '+MININET_VM_IP+' remote '+H2_VM_IP+' ttl 64')
	s2.cmd('ip li se dev s2-gre1 up')
	Intf( 's2-gre1', node=s2 )

	s4.cmd('ip li ad s4-gre1 type gretap local '+MININET_VM_IP+' remote '+H3_VM_IP+' ttl 64')
	s4.cmd('ip li se dev s4-gre1 up')
	Intf( 's4-gre1', node=s4 )
	
	net.start()
	print "Configuring ARP entries..."
	net.staticArp()
	
	s1.cmd('sudo ovs-ofctl add-flow s1 priority=65535,tcp,in_port=3,nw_src=10.0.0.0/8,nw_dst=10.0.0.0/8,tp_dst=80,actions=output:4')
	s4.cmd('sudo ovs-ofctl add-flow s4 priority=65535,tcp,in_port=5,actions=output:3')
	
	CLI( net )
	net.stop()
开发者ID:vmehmeri,项目名称:sfc-lab,代码行数:91,代码来源:tunnel_mininet_vm.py

示例11: start

# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import staticArp [as 别名]
def start(nh=4, ns=1, stype = 'us', ip="127.0.0.1", port="6633", pi=5, 
            fwd='lsw', val=2):
    init()
    passes = val
    # Initialize network
    noxfwd = {'lsw':'pyswitch', 'hub':'pyhub', 'fls':'sample_routing', 'adapt':'adaptive_routing'}
    noxapp = "FreneticApp"
    freneticapp = "benchmarks"
    freneticfun = "pc"
    args = [fwd]

    if GOPTS['remote']:
        net = Mininet( topo=LinearTopo(nh,ns), switch=switchTypes[stype],
                       controller=lambda name: RemoteController(name, defaultIP=ip, port=int(port)),
                       xterms=False, autoSetMacs=True)
    else:
        if GOPTS['nox']:
            noxapp = noxfwd[fwd]
        else:
            setup_env(freneticapp,args,freneticfun,fetch_subdirs(parent))
        
        net = Mininet( topo=LinearTopo(nh,ns), switch=switchTypes[stype],
                       controller=lambda name: NOX(name, noxapp),
                       xterms=False, autoSetMacs=True)

    setNet(net)
    startNet()

    INIT = time.time()

    if not GOPTS['quiet']:
        output("  *** Network Initialized in %s seconds***\n" % str(INIT-GOPTS['start']))

    if not(GOPTS['arp']):
        net.staticArp()
        if not GOPTS['quiet']:
            output("  *** Network Statically ARP'ed in %s seconds***\n" % str(time.time()-INIT))

    netElems = {}
    netElems = buildNetElems(GOPTS['debug'],net)

    if GOPTS['agg']:
        p = {}

        if GOPTS['debug']:
            qopt = ""
        else:
            qopt = "-q "
        pcmd = 'sudo tshark -a duration:%s ' + qopt + '-i %s -z io,stat,0,'

        justhosts = map(lambda h:h.name, net.hosts)
        for s in net.switches:
            for swifname in s.connection.keys():
                (h, hifname) = s.connection[swifname]
                [hostname,ifname] = hifname.split("-")
                if hostname in justhosts:
                    cmd = pcmd % (str(nh*4),swifname)
                    p[swifname] = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
                    if GOPTS['debug']:
                        print "Beginning packet capture on interface %s..." % swifname

    # Change verbosity so that the output of CLI commands will display
    time.sleep(6)

    if GOPTS['debug']:
        output(netElems['s101'].cmd('dpctl show unix:/tmp/s101'))

    r = hostSweep(net, nh, ns, 0,passes)
    #r = net.pingall()

    # Despite the fact that the pings are blocking calls 
    # which wait for a result, it seems that tshark needs
    # additional time to 'catch up'
    time.sleep(int(pi*1.5))

    # Wait for capture processes to finish
    if GOPTS['agg']:
        for proc in p.values():
            proc.wait()

    if not GOPTS['quiet']:
        lg.setLogLevel('output')

    if GOPTS['dump']:
        dumpFlows(stype,net)
    
    ### Stop controller, but wait to kill mininet
    if not GOPTS['remote']:
        netElems['c0'].stop()
    
    if GOPTS['agg']:
        # Grab network capture data
        total = 0
        rexp = re.compile('000.000-[\s]+[\d]+[\s]+[\d]+', re.IGNORECASE)
        for (k,proc) in p.items():
            out = proc.stdout.read()
            err = proc.stderr.read()
            if GOPTS['debug']:
                print k
                print err
#.........这里部分代码省略.........
开发者ID:XianliangJ,项目名称:collections,代码行数:103,代码来源:connectivity_test.py

示例12: main

# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import staticArp [as 别名]
def main():
    topo = PyRouterTopo(args)
    net = Mininet(topo=topo, link=TCLink, cleanup=True, autoSetMacs=True)
    setup_addressing(net)
    net.staticArp()
    net.interact()
开发者ID:asperlea,项目名称:COSC-465,代码行数:8,代码来源:start_mininet.py

示例13: start

# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import staticArp [as 别名]
def start(stype, ip, port, numserv, numclient, dummyIP, numtests, delay):

    app='FreneticApp'

    # Initialize network
    net = Mininet(switch=switchTypes[stype],
                        controller=lambda name: RemoteController(name, defaultIP=ip, port=int(port)),
                        xterms=False )
    print "Creating topology..."
    net = createNetwork(net, numserv, numclient)

    print "Starting network..."
    net.start()

    print "Configuring network..."
    net = configure(net)

    ## Prime all hosts ARP caches
    if STATIC_ARP:
        net.staticArp()

    netElems = {}
    for h in net.hosts:
        netElems[h.name] = h
        if DEBUG:
            print "=== " + h.name + " Connections ==="
            print h.connection
    for s in net.switches:
        netElems[s.name] = s
        if DEBUG:
            print "=== " + s.name + " Connections ==="
            print s.connection
    for c in net.controllers:
        netElems[c.name] = c

    output("  *** Network Initialized in %s seconds***\n\n" % str(time.time()-START_TIME))

    # Wait for switch to register with controller
    time.sleep(3)

    # Run Test Harness
    yes = ['Y', 'y', 'yes', 'Yes', '']
    no = ['N', 'n', 'no', 'No', 'NO']
    print 'Waiting for controller: (Enter to continue) ',
    l = sys.stdin.readline() # Wait for prompt to continue

#    time.sleep(3) # Wait for controller to register
#    print 'Running intra-server pings...'
#    intraServerPing(net)
    print 'Start mongoose servers? [Y (default) / n ] ',
    l = sys.stdin.readline().strip()
    if l in no:
        print 'Not running mongoose servers'
    elif l in yes:
        runServers(net)
    else:
        print 'Unknown answer: ', l
        sys.exit(0)

#    print 'Writing intra-server pings to initialize switch entries'
#    CLIfile = 'LB.cli'
#    intraServerPing(net, CLIfile)

    print 'Automatic clients? [Y (default) / n ] ',
    l = sys.stdin.readline().strip()
    if l in no:
        print 'Not running automatic client wgets'
#        CLI(net, script=CLIfile)
    elif l in yes:
#        CLI(net, script=CLIfile)
        print 'Randomize client IPs? [Y (default) / n ] ',
        l = sys.stdin.readline().strip()
        if l in no:
            runClients(net, dummyIP=dummyIP, numtests=numtests, delay=delay)
        elif l in yes:
            runRandomClients(net, dummyIP=dummyIP, numtests=numtests, delay=delay)
        else:
            print 'Unknown answer: ', l
            sys.exit(0)
    else:
        print 'Unknown answer: ', l
        sys.exit(0)

    # Enter CLI mode for any finishing touches you might want to test
    output("*** Press ctrl-d or type exit to quit ***\n")
    # Change verbosity so that the output of CLI commands will display
    lg.setLogLevel('info')
    CLI(net)
    lg.setLogLevel('output')
    # All done, cleanup
#    netElems['h1'].cmd('sudo killall wbox dhclient')
    net.stop()


    os.system('sudo killall wget')
    os.system('sudo killall python')
    os.system('sudo killall mongoose')
    os.system('sudo killall /home/mininet/noxcore/build/src/.libs/lt-nox_core')
开发者ID:wenley,项目名称:frenetic-load-balancer,代码行数:100,代码来源:LB_sandbox.py


注:本文中的mininet.net.Mininet.staticArp方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。