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


Python log.setLogLevel函数代码示例

本文整理汇总了Python中mininet.log.setLogLevel函数的典型用法代码示例。如果您正苦于以下问题:Python setLogLevel函数的具体用法?Python setLogLevel怎么用?Python setLogLevel使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: main

def main():
    # Defines the log level
    setLogLevel('info')

    # parses command line arguments
    parser = OptionParser()
    parser.add_option('-H', dest='hosts', default=5,
                      help='Number of hosts per switch')
    parser.add_option('-S', dest='switches', default=2,
                      help='Number of switches')
    (options, args) = parser.parse_args()

    # Build network topology (see mininet/topo.py)
    #topo = LinearTopo(int(options.switches), int(options.hosts))
    topo = LinearTopo()

    # Creates the Network using a remote controller
    #net = Mininet(topo)
    net = Mininet(topo,
                  controller=lambda a: RemoteController(a, ip='127.0.0.1'))

    # Starts the network
    net.start()
    # Run the mininet client
    while True:
        try:
            DynCLI(net)
            break
        except Exception as e:
            error('Fail: %s\n Args: %s \n %s \n' % (type(e), e.args, e))
            traceback.print_exc()
            continue
        
    # Stop the network
    net.stop()
开发者ID:pantuza,项目名称:mininet,代码行数:35,代码来源:dynamicnet.py

示例2: main

def main():
    import argparse
    import threading
    from threading import Thread

    parser = argparse.ArgumentParser(description="less script")
    parser.add_argument("-u", "--urls", dest="urls", default="10.128.10.1", type=str, help="a string to show urls to post intents to separated by space, ex. '10.128.10.1:6633 10.128.10.2:6633' ")
    parser.add_argument("-s", "--switches", dest="numsw", default=100, type=int, help="number of switches use in the load generator; together with the ports per switch config, each switch generates (numport + 2) events")
    parser.add_argument("-p", "--ports", dest="numport", default=1, type=int, help="number of ports per switches")
    parser.add_argument("-a", "--addrate", dest="addrate", default=10, type=float, help="rate to add intents groups, groups per second")
    parser.add_argument("-d", "--delrate", dest="delrate", default=100, type=float, help= "rate to delete intents, intents/second")
    parser.add_argument("-l", "--testlength", dest="duration", default=0, type=int, help= "pausing time between add and delete of intents")
    args = parser.parse_args()

    urllist = args.urls.split()
    numsw = args.numsw
    numport = args.numport
    addrate = args.addrate
    delrate = args.delrate
    duration = args.duration
    setLogLevel( 'info' )
    swlist = createSwPorts(numsw,numport)
    telapse,count = loadsw(urllist, swlist, addrate, delrate, duration)
    print ("Total number of switches connected/disconnected: " + str(count) + "; Total events generated: " + str(count * (2 + numport)) + "; Elalpse time: " + str('%.1f' %telapse))
    print ("Effective aggregated loading is: " + str('%.1f' %((( count * (2+ numport))) / telapse ) ) + "Events/s.")
    cleanMN()
开发者ID:Santhosh2488,项目名称:ONLabTest,代码行数:26,代码来源:loadgen_SB.py

示例3: UC2_IITS_Network

def UC2_IITS_Network():

	logger.info('=================== Mininet Topology SetUp ===================')

	# Create UC Topology instance
	IITSTopo = IITSTopology()

	# Start mininet and load the topology
	net = Mininet( topo=IITSTopo, controller=RemoteController, autoSetMacs = True )
	net.start()
	setLogLevel( 'info' ) #setLogLevel( 'info' | 'debug' | 'output' )

	# Get the devices
	Devices = dict()
	Devices = net.get('h1', 'h2', 'h3', 'h4', 'h5', 's1', 's2', 's3', 's4', 's5', 's6', 's7', 's8')
	IITSTopo.SetDevices(Devices)
	logger.info('==============================================================\n')

	# Enforce IP configuration
	logger.info('====================== IP Configuration ======================')
	IITSTopo.SetIPConfiguration(Devices, net)
	logger.info('==============================================================\n')

	# Start mininet CLI
	CLI( net )

	# Destroy network after exiting the CLI
	net.stop()
开发者ID:fp7-netide,项目名称:Usecases,代码行数:28,代码来源:UC2_IITSystem.py

示例4: run

def run():
    "Test a multiple ONOS cluster network"
    setLogLevel( 'info' )
    # East and west control network topologies (using RenamedTopo)
    # We specify switch and host prefixes to avoid name collisions
    # East control switch prefix: 'east_cs', ONOS node prefix: 'east_onos'
    # Each network is a renamed SingleSwitchTopo of size clusterSize
    # It's also possible to specify your own control network topology
    clusterSize = 1
    etopo = RenamedTopo( SingleSwitchTopo, clusterSize,
                         snew='east_cs', hnew='east_onos' )
    wtopo = RenamedTopo( SingleSwitchTopo, clusterSize,
                         snew='west_cs', hnew='west_onos' )
    # east and west ONOS clusters
    # Note that we specify the NAT node names to avoid name collisions
    east = ONOSCluster( 'east', topo=etopo, ipBase='192.168.123.0/24',
                        nat='enat0' )
    west = ONOSCluster( 'west', topo=wtopo, ipBase='192.168.124.0/24',
                        nat='wnat0' )
    # Data network topology
    topo = LinearTopo( 10 )
    # Create network
    net = Mininet( topo=topo, switch=MultiSwitch, controller=[ east, west ] )
    # Assign switches to controllers
    count = len( net.switches )
    for i, switch in enumerate( net.switches ):
        switch.controller = east if i < count/2 else west
    # Start up network
    net.start()
    ONOSCLI( net )  # run our special unified Mininet/ONOS CLI
    net.stop()
开发者ID:YuanyouZhang,项目名称:onos,代码行数:31,代码来源:multicluster.py

示例5: start_networking

    def start_networking(self):
        setLogLevel("info")
        net = Mininet(topo=self, \
                      controller=lambda name: RemoteController(name))
        net.start()

        # setup each switch
        for sw in net.switches:
            # set ofp version
            self.set_ofp_version(sw, ['OpenFlow10', 'OpenFlow13'])
            # if sw is bridge, set it up for normal SW
            swEntry = self.switchList[sw.name][1]
            isBridge = swEntry["bridge"]
            if isBridge:
                self.set_normalsw(sw)
            self.switchList[sw.name].append(sw)

        # setup each host
        for host in net.hosts:
            self.add_ipv6address(host)
            self.hostList[host.name].append(host)

        # execute pre_command
        if "pre_cmd_file" in self.jsonData:
            cmd_file = self.jsonData["pre_cmd_file"]
            self.exec_usercmd(cmd_file)

        CLI(net)

        # execute post_command
        if "post_cmd_file" in self.jsonData:
            cmd_file = self.jsonData["post_cmd_file"]
            self.exec_usercmd(cmd_file)

        net.stop()
开发者ID:saitoh-ats,项目名称:Sandbox,代码行数:35,代码来源:custom-topo.py

示例6: run

  def run (self):
    setLogLevel("info")
    OVSKernelSwitch.setup()#"Make sure Open vSwitch is installed and working"

    info("****creating network****\n")
    self.net = Mininet(listenPort = 6666)

    controller = RemoteController("mirrorController",   ip = "127.0.0.1")
    self.net.addController(controller)
    while core.running:
      try:
        time.sleep(3)
        if not core.running: break
        '''
        self.net.pingAll()
        if len(self.addswitches)!=0:
          for i in self.addswitches:
            print self.addswitches[i].dpctl('show')
        '''
        if self.rectopolyreply==1:
          mutex.acquire()
          self.createtoptly()
          self.rectopolyreply=0
          mutex.release()
      except exceptions.KeyboardInterrupt:
        break
      except:
        log.exception("Exception SendMes running ")
        break
    self.net.stop()
开发者ID:iiisthu,项目名称:MMD-pro,代码行数:30,代码来源:SendMessage.py

示例7: main

def main():
    # Defines the log level
    setLogLevel('info')

    # parses command line arguments
    parser = OptionParser()
    parser.add_option('-H', dest='hosts', default=5,
                      help='Number of hosts per switch')
    parser.add_option('-S', dest='switches', default=2,
                      help='Number of switches')
    (options, args) = parser.parse_args()

    # Build network topology (see mininet/topo.py)
    topo = LinearTopo(int(options.switches), int(options.hosts))

    # Creates the Network using a remote controller
    net = Mininet(topo,
                  controller=lambda a: RemoteController(a, ip='127.0.0.1'))

    # Starts the network
    net.start()
    # Run the mininet client
    CLI(net)
    # Stop the network
    net.stop()
开发者ID:dshulyak,项目名称:mininet,代码行数:25,代码来源:dynamicnet.py

示例8: standalone

def standalone():
	if "info" in argv:
		setLogLevel( 'info' )
	scls=None
	if "of" in argv:
		scls = StaticSwitch 
	elif "lr" in argv:
		scls = DRtr
	else:
		print("Supply either of (for OpenFlow) or lr (for a Linux Router)")
		exit(-1)
	topo = DTopo(scls=scls)
	net = Mininet(topo=topo,autoSetMacs=True)
	net.start()
	sw, h1, h2 = net.get('s1', 'h1', 'n1')
	if "noarp" not in argv:
		makearpentries(sw, [h1, h2])
	#print(sw.cmd("netstat -tulpen"))
	if "dump" in argv:
		if "lr" in argv:
			dump('iptables-save', sw.cmd('iptables-save'))
			dump('ip-route', sw.cmd('ip route'))
			dump('collectedmacs', sw.cmd('collectmacs.sh'))
		elif "of" in argv:
			print("of/dump TODO")
	if "test" in argv:
		sese = [h1,h2]
		net.ping(sese)
		tcpreachtests(net,sese,ports=[80,22])
	if "cli" in argv:
		CLI(net)
	net.stop()
开发者ID:ammbauer,项目名称:Iptables_Semantics,代码行数:32,代码来源:3chn.py

示例9: pingloop

def pingloop( net ):
    setLogLevel( 'error' )
    try:
        while True:
            net.ping()
    finally:
        setLogLevel( 'info' )
开发者ID:CrazyCooper,项目名称:onos,代码行数:7,代码来源:rftest.py

示例10: main

def main():
    _LOGGER.info("Executing the integration topology with pid {0!s} and parent pid {1!s}".format(os.getpid(), os.getppid()))
    setLogLevel('debug')  # set Mininet loglevel
    # create_and_start_topology(DCNetwork(controller=RemoteController,
    #                                     monitor=True,
    #                                     enable_learning=True))
    sc = SigTermCatcher()
    (server_thread, server) = spawn_socket_thread(sc)
    server_thread.start()

    while True:
        if sc.is_alive():
            forked_process = spawn_process(sc)
            sc.ignore_signal()
            forked_process.start()
            sc.setup_signal()
            forked_process.join()
        else:
            break
        time.sleep(1)

    _LOGGER.info("Stopping the server")
    server.shutdown(socket.SHUT_RDWR)
    server_thread.join()
    exit(2)
开发者ID:cgeoffroy,项目名称:son-analyze,代码行数:25,代码来源:topology_integration.py

示例11: run

  def run(self):
    print self.receivelinkevent
    
    setLogLevel("info")
    OVSKernelSwitch.setup()#"Make sure Open vSwitch is installed and working"

    info("****creating network****\n")
    self.net = Mininet(listenPort = self.listenPort)

    controller = RemoteController("mirrorController",   ip = "127.0.0.1")
    self.net.addController(controller)
    #self.gettoptly()
    timesnum=0;
    while core.running:
      try:
        while True:
          rlist, wlist, elist = yield Select([self.receivelinkevent], [], [], 5)
          if len(rlist) == 0 and len(wlist) == 0 and len(elist) == 0:
            #self.gettoptly()
            if not core.running: break
          #if len(rlist)!=0:
            #print self.receivelinkevent
          if self.receivelinkevent==1:
            self.gettoptly()
            timesnum+=1
            if timesnum==5:
              self.net.pingAll()    
      except exceptions.KeyboardInterrupt:
        break
    self.net.stop()
开发者ID:iiisthu,项目名称:MMD-pro,代码行数:30,代码来源:mininettask.py

示例12: run

 def run(self):
     setLogLevel('info')
     myNetworkStop()
     myNetwork()
     while True:
         print('Still running...')
         time.sleep(10)
     myNetworkStop()
开发者ID:zoltan-nz,项目名称:NWEN402-lab,代码行数:8,代码来源:example_one.py

示例13: pingloop

 def pingloop( self ):
     "Loop forever pinging the full mesh of hosts"
     setLogLevel( 'error' )
     try:
         while True:
             self.ping()
     finally:
         setLogLevel( 'info' )
开发者ID:K-OpenNet,项目名称:ONOS-ApSM,代码行数:8,代码来源:onosnet.py

示例14: main

def main():
    setLogLevel("info")  # set Mininet loglevel
    # add the SIGTERM handler (eg. received when son-emu docker container stops)
    signal.signal(signal.SIGTERM, exit_gracefully)
    # also handle Ctrl-C
    signal.signal(signal.SIGINT, exit_gracefully)
    # start the topology
    create_topology1()
开发者ID:CN-UPB,项目名称:son-emu,代码行数:8,代码来源:son-monitor_test_topo.py

示例15: main

def main():
  desc = ( 'Generate Mininet Testbed' )
  usage = ( '%prog [options]\n'
            '(type %prog -h for details)' )
  op = OptionParser( description=desc, usage=usage )

  ### Options
  op.add_option( '--rate', '-r', action="store", \
                 dest="rate", help = "Set rate. <n>S for (n/second), <n>M for (n/minute). Don't include the brackets when specifying n" )

  op.add_option( '--switchNum', '-s', action="store", \
                 dest="switchnum", help = "Specify the number of switches for this linear topology." )

  op.add_option( '--time', '-t', action="store", \
                 dest="timeout", help = "Specify the timeout in seconds." )
 
  op.add_option( '--type', '-y', action="store", \
                 dest="topo_type", help = "Specify type of the topology (linear, fattree)" )


  wait_time = 0.0
  options, args = op.parse_args()

  if options.rate is not None:
    if options.rate.endswith('S'):
      num_str = options.rate.rstrip('S')
      wait_time = 1.0/float(num_str)
    elif options.rate.endswith('M'):
      num_str = options.rate.rstrip('M')
      wait_time = 60.0/float(num_str)
    else:
      print 'Wrong rate format. Abort.'
      return
  else:
    print '\nNo rate given. Abort.\n'
    return

  # Set parameters      
  timeout_int = math.ceil(float(options.timeout))
  
  top = 1
  middle = 2
  bottom = int(options.switchnum)
  host_fanout = 5

  # Start
  if options.switchnum is not None and options.timeout is not None and options.rate is not None:
    setLogLevel('info')
    MakeTestBed_and_Test(options.topo_type,
                         top,
                         middle,
                         bottom, 
                         host_fanout,
                         timeout_int, wait_time)
  else:
    print '\nNo switch number given. Abort.\n'
开发者ID:ecnoel,项目名称:mininet_examples,代码行数:56,代码来源:topo.py


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