本文整理汇总了Python中mininet.log.lg.setLogLevel函数的典型用法代码示例。如果您正苦于以下问题:Python setLogLevel函数的具体用法?Python setLogLevel怎么用?Python setLogLevel使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setLogLevel函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self):
self.options = None
self.args = None
self.parseArgs()
lg.setLogLevel('info')
self.runDemo()
开发者ID:brownsys,项目名称:pane-demo-vm,代码行数:7,代码来源:PaneDemo.py
示例2: start
def start(ip="127.0.0.1",port=6633):
#def start(ip="127.0.0.1",port=6653):
ctrlr = lambda n: RemoteController(n, ip=ip, port=port, inNamespace=False)
net = Mininet(switch=OVSSwitch, controller=ctrlr, autoStaticArp=False)
c1 = net.addController('c1')
gates_agraph = pgv.AGraph("simplified_gates_topology.dot")
for sw in gates_agraph.nodes():
net.addSwitch(sw, dpid = hex( int(sw.attr['dpid']) )[2:])
for link in gates_agraph.edges():
(src_switch, dst_switch) = link
net.addLink(src_switch, dst_switch, int(link.attr['src_port']), int(link.attr['dport']) )
# Only one host and an Internet Router disguised as a host for now (because it's not part of the OF network)
h0 = net.addHost('h0', cls=VLANHost, mac='d4:c9:ef:b2:1b:80', ip='128.253.154.1', vlan=1356)
net.addLink("s_bdf", h0, 1, 0)
# To test DHCP functionality, ucnomment this line and comment out the fixed IP line. Then when mininet
# starts you issue:
# mininet> h1 dhclient -v -d -1 h1-eth0.1356
# and make sure it gets its IP by going through all protocol steps.
#h1 = net.addHost('h1', cls=VLANHost, mac='00:00:01:00:00:11', ip='0.0.0.0', vlan=1356)
h1 = net.addHost('h1', cls=VLANHost, mac='00:00:01:00:00:11', ip='128.253.154.100', vlan=1356)
net.addLink("s_f3a", h1, 32, 0)
# h4{a,b,c} are wireless nodes supposedly hooked up to a dumb AP. You can't just hook them up
# to the same mininet port. Y
h4a = net.addHost('h4a', cls=VLANHost, mac='00:00:01:00:00:14', ip='128.253.154.104', vlan=1356)
net.addLink("s_f3a", h4a, 33, 0)
#net.addHost('h4b', cls=VLANHost, mac='00:00:01:00:00:14', ip='128.253.154.104', vlan=1356)
#net.addHost('h4c', cls=VLANHost, mac='00:00:01:00:00:14', ip='128.253.154.104', vlan=1356)
# h2 is a syslab PC
h2 = net.addHost('h2', cls=VLANHost, mac='00:00:01:00:00:13', ip='128.253.154.102', vlan=1356)
net.addLink("s_lab_r6", h2, 1, 0)
# MAC spoofing attempt of h2
h3 = net.addHost('h3', cls=VLANHost, mac='00:00:01:00:00:13', ip='128.253.154.102', vlan=1356)
net.addLink("s_lab_r6", h3, 2, 0)
###### Start of static Mininet epilogue ######
# Set up logging etc.
lg.setLogLevel('info')
lg.setLogLevel('output')
# Start the network
net.start()
# Start the DHCP server on Internet Router. This will actually be a DHCP proxy in the real setup.
#startDHCPserver( h0, gw='128.253.154.1', dns='8.8.8.8')
# Enter CLI mode
output("Network ready\n")
output("Press Ctrl-d or type exit to quit\n")
CLI(net)
开发者ID:coscin,项目名称:gates,代码行数:57,代码来源:gates_mininet.py
示例3: setup
def setup( self ):
"Setup and validate environment."
# set logging verbosity
if LEVELS[self.options.verbosity] > LEVELS['output']:
print ( '*** WARNING: selected verbosity level (%s) will hide CLI '
'output!\n'
'Please restart Mininet with -v [debug, info, output].'
% self.options.verbosity )
lg.setLogLevel( self.options.verbosity )
开发者ID:ARCCN,项目名称:nps,代码行数:10,代码来源:turn_on_script_for_10.211.55.13.py
示例4: __init__
def __init__(self, tableIP, verbose=False):
Mininet.__init__(self, build=False)
self.tableIP = tableIP
self.vsfs = []
self.rootnodes = []
self.verbose = verbose
lg.setLogLevel('info')
self.name_to_root_nodes = {}
self.node_to_pw_data = defaultdict(list)
开发者ID:netgroup,项目名称:Dreamer-Management-Scripts,代码行数:10,代码来源:net.py
示例5: pingall_test
def pingall_test(folder, exe, topo=SingleSwitchTopo(4), custom_topo=None, custom_test=None, expect_pct=0):
ip="127.0.0.1"
port=6633
if not VERBOSE:
lg.setLogLevel('critical')
ctrlr = lambda n: RemoteController(n, ip=ip, port=port, inNamespace=False)
net = Mininet(switch=OVSSwitch, controller=ctrlr, autoStaticArp=False,cleanup=True)
c1 = net.addController('c1')
if custom_topo:
custom_topo.build(net)
else:
net.buildFromTopo(topo)
# Start the network
net.start()
# Fork off Frenetic process
devnull = None if VERBOSE else open(os.devnull, 'w')
frenetic_proc = Popen(
['/home/vagrant/src/frenetic/frenetic.native', 'http-controller','--verbosity','debug'],
stdout=devnull, stderr=devnull
)
# Wait a few seconds for frenetic to initialize, otherwise
time.sleep(5)
# And fork off application
app_proc = Popen(
['/usr/bin/python2.7',exe],
stdout=devnull, stderr=devnull, cwd=CODE_ROOT+folder
)
if custom_test:
got_pct = int(custom_test(net))
else:
got_pct = int(net.pingAll())
expected_msg = " expected "+str(expect_pct)+"% dropped got "+str(got_pct)+"% dropped"
print exe + ("...ok" if expect_pct==got_pct else expected_msg)
frenetic_proc.kill()
app_proc.kill()
# Ocassionally shutting down the network throws an error, which is superfluous because
# the net is already shut down. So ignore.
try:
net.stop()
except OSError:
pass
开发者ID:frenetic-lang,项目名称:manual,代码行数:53,代码来源:test_suite.py
示例6: main
def main():
args = parse_args()
#setup args from parser
setup(args)
exp = importlib.import_module("."+args.open,package="experiment")
lg.setLogLevel('info')
topo = khalili2hosts()
run_MPTCP(args,topo,exp,end) #launch Test
开发者ID:Rakku,项目名称:PRES_FatTree,代码行数:12,代码来源:pyMPTCP.py
示例7: main
def main(argv):
args = parse_args()
lg.setLogLevel('info')
"Create and run experiment"
topo = MyTopo()
net = Mininet(topo=topo, link=TCLink, controller = OVSController)
net.start()
Config(net,args)
#dumpNodeConnections(net.hosts)
net.stop()
开发者ID:antons1,项目名称:MIP-daemon,代码行数:13,代码来源:testtopology.py
示例8: httpTest
def httpTest( N=2 ):
"Run pings and monitor multiple hosts using pmonitor"
## SET LOGGING AND CLEANUP PREVIOUS MININET STATE, IF ANY
lg.setLogLevel('info')
cleanup()
## INSTEAD OF RUNNING PYRETIC HUB, UNCOMMENT LINE
## TO SEE THAT THIS WORKS FINE WHEN RUNNING REFERENCE CONTROLLER
# call('controller ptcp: &', shell=True)
## SET UP TOPOLOGY
topo = LinearTopo( N ) ## (tcp parse) warning TCP data offset too long or too short
# topo = SingleSwitchTopo( N ) ## SILENT STALL
## SET UP MININET INSTANCE AND START
net = Mininet( topo, switch=OVSKernelSwitch, host=Host, controller=RemoteController )
net.start()
print "Starting test..."
## GET THE HOST AND SERVER NAMES
hosts = net.hosts
client = hosts[ 0 ]
server = hosts[ 1 ]
## DICTS FOR USE W/ PMONITOR
spopens = {}
cpopens = {}
## WARMUP SERVER
spopens[server] = server.popen('python', '-m', 'SimpleHTTPServer', '80')
sleep(1)
## CLIENT REQUEST
cpopens[client] = client.popen('wget', '-O', '-', server.IP(), stdout=PIPE, stderr=STDOUT)
## MONITOR OUTPUT
for h, line in pmonitor( cpopens, timeoutms=5000 ):
if h and line:
print '%s: %s' % ( h.name, line ),
## TO USE THE COMMAND LINE INTERFACE, BEFORE FINISHING, UNCOMMENT
# CLI( net )
## SHUTDOWN SERVER
spopens[server].send_signal( SIGINT )
## SHUTDOWN MININET
net.stop()
开发者ID:cryptobanana,项目名称:pyretic,代码行数:51,代码来源:http_test.py
示例9: start
def start(ip="127.0.0.1",port=6633):
ctrlr = lambda n: RemoteController(n,
defaultIP=ip,
port=port,
inNamespace=False)
net = Mininet(switch=UserSwitch, controller=ctrlr, intf=VLANIntf, autoStaticArp=True)
c1 = net.addController('c1')
####### End of static Mininet prologue ######
eth1 = '00:00:00:00:00:01'
eth2 = '00:00:00:00:00:02'
ip1 = '10.0.0.1'
ip2 = '10.0.0.2'
# -- s2 --
# / \
# h1 - s1 s3 - h2
# \ /
# -- s4 --
# Ports to host are numbered 1, then clockwise
h1 = net.addHost('h1', mac=eth1, ip=ip1)
h2 = net.addHost('h2', mac=eth2, ip=ip2)
s1 = net.addSwitch('s1')
s2 = net.addSwitch('s2')
s3 = net.addSwitch('s3')
s4 = net.addSwitch('s4')
net.addLink(h1, s1, 0, 1)
net.addLink(h2, s3, 0, 1)
net.addLink(s1, s2, 2, 1)
net.addLink(s2, s3, 2, 3)
net.addLink(s3, s4, 2, 2)
net.addLink(s4, s1, 1, 3)
###### Start of static Mininet epilogue ######
# Set up logging etc.
lg.setLogLevel('info')
lg.setLogLevel('output')
# Start the network and prime other ARP caches
net.start()
h1.setDefaultRoute('h1-eth0')
h2.setDefaultRoute('h2-eth0')
# Enter CLI mode
output("Network ready\n")
output("Press Ctrl-d or type exit to quit\n")
CLI(net)
net.stop()
开发者ID:ClassWYZ,项目名称:Frenetic,代码行数:51,代码来源:diamond.py
示例10: __init__
def __init__(self, verbose=False):
self.checkPATHs()
Mininet.__init__(self, build=False)
self.cr_oshis = []
self.pe_oshis = []
self.ce_routers = []
self.ctrls = []
self.nodes_in_rn = []
self.node_to_data = defaultdict(list)
self.node_to_node = {}
self.node_to_default_via = {}
self.coex = {}
self.verbose = verbose
lg.setLogLevel('info')
self.vlls = []
self.node_to_pw_data = defaultdict(list)
self.pws = []
self.cer_to_customer = {}
self.customer_to_vtepallocator = {}
self.vsfs = []
self.pe_cer_to_vsf = {}
self.is_vs = False
self.vss = []
self.vss_data = []
self.id_peo_to_vs = {}
self.last_ipnet = IPv4Network(u'0.0.0.0/24')
self.id_to_node = {}
self.ip_to_mac = {}
self.overall_info = {}
self.mgmt = None
root = Node( 'root', inNamespace=False )
root.cmd('/etc/init.d/network-manager stop')
mylog("*** Stop Network Manager\n")
self.cluster_to_ctrl = defaultdict(list)
self.cluster_to_nodes = defaultdict(list)
self.nodes_to_cluster = {}
开发者ID:netgroup,项目名称:Dreamer-Mininet-Extensions,代码行数:51,代码来源:mininet_extensions.py
示例11: start
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,代码行数:50,代码来源:sample_network.py
示例12: main
def main():
lg.setLogLevel( 'info')
c = lambda name: RemoteController(name, defaultIP='132.239.17.35')
if 'fattree' in sys.argv:
net = FatTreeNet(switch=OVSKernelSwitch, controller=c)
elif 'linear' in sys.argv:
net = LinearNet(switch=OVSKernelSwitch, controller=c)
else:
print >> sys.stderr, 'Specify either "fattree" or "linear" as the sole argument.'
return
net.start()
CLI(net)
net.stop()
开发者ID:crazyideas21,项目名称:swclone,代码行数:16,代码来源:pod.py
示例13: go
def go(cargs=None):
global GOPTS
lg.setLogLevel('output')
parser = CommonParser('connectivity_test.py')
parser.add_option('-p', '--num-passes', action="store",dest='passes', type='int', default=2,
help="Number of passes through the network.")
(options, args) = parser.parse_args(cargs)
if options.remote_nox and options.nox_test:
parser.error("Run reference NOX test without the -r option.")
if (options.numhosts < 2 or options.numhosts > MAXHOSTS):
parser.error("Need at least 2 hosts. Maximum of %s" % str(MAXHOSTS))
if not(options.remote_nox) and options.controller != '127.0.0.1:6633':
parser.error("Specified a remote controller address, but -r remote NOX mode not specified.")
if not(options.forwarding.lower() in validforwarding):
parser.error("Please specify a valid forwarding policy for the experiment. hub | lsw | flw.")
(ip,port) = check_controller(options.controller)
if (ip,port) == (None,None):
parser.error("Bad IP:Port specified for controller.")
GOPTS = setFlags(dump_flows=options.dump_flows,nox_test=options.nox_test,
remote_nox=options.remote_nox,flow_size=options.flow_size,
debugp=options.debug,interrupt=options.interrupt,quiet=options.quiet,
agg=options.agg,full_arp=options.arp,verify=options.verify)
GOPTS['interrupt'] = options.interrupt
interval = options.interval
# QUIET mode trumps many options
if GOPTS['quiet']:
GOPTS['debug'] = False
GOPTS['dump'] = False
GOPTS['interrupt'] = False
numpasses = 2
GOPTS['flowsize'] = 56
interval = 1
GOPTS['start'] = time.time()
# Initialize and run
init()
retcode = start(options.numhosts, options.numswitches, options.st,
ip, port, interval, options.forwarding.lower(), options.passes)
return retcode
开发者ID:XianliangJ,项目名称:collections,代码行数:46,代码来源:connectivity_test.py
示例14: launch
def launch(topo = None, routing = None, mode = None):
"""
Args in format toponame,arg1,arg2,...
"""
print("mininet_stuffs")
if not mode:
mode = DEF_MODE
# Instantiate a topo object from the passed-in file.
if not topo:
raise Exception("please specify topo and args on cmd line")
else:
t = buildTopo(topo, topos)
r = getRouting(routing, t)
core.registerNew(RipLController, t, r, mode)
lg.setLogLevel('info')
log.info("RipL-POX running with topo=%s." % topo)
开发者ID:CodingCat,项目名称:mininet_stuffs,代码行数:19,代码来源:riplpox.py
示例15: cleanup
def cleanup():
"""Cleanup all possible junk that we may have started."""
log.setLogLevel('info')
# Standard mininet cleanup
mnclean.cleanup()
# Cleanup any leftover daemon
patterns = []
for d in daemons.__all__:
obj = getattr(daemons, d)
killp = getattr(obj, 'KILL_PATTERNS', None)
if not killp:
continue
if not is_container(killp):
killp = [killp]
patterns.extend(killp)
log.info('*** Cleaning up daemons:\n')
for pattern in patterns:
mnclean.killprocs('"%s"' % pattern)
log.info('\n')
开发者ID:oliviertilmans,项目名称:ipmininet,代码行数:19,代码来源:clean.py
示例16: __init__
def __init__(self):
# 15 Mbps bandwidth and 2 ms delay on each link
#self.linkopts = dict(bw=15, delay='2ms', loss=0, use_htb=True) # disabled for testing
self.linkopts = dict()
self.numHostsPerSubnet = 2
self.options = None
self.args = None
self.subnetRootSwitch = None
self.subnetRootSwitchBaseDpid = None
self.subnetHostLastIP = {}
self.globalHostCount = 0
self.globalPeerCount = 0
self.globalEdgeSwCount = 0
self.networksToLaunch = {}
self.parseArgs()
lg.setLogLevel('info')
self.runDemo()
开发者ID:CharlesYeh,项目名称:FlowLog,代码行数:20,代码来源:FlowlogMN.py
示例17: start
def start(ip="127.0.0.1",port=6633):
ctrlr = lambda n: RemoteController(n, ip=ip, port=port, inNamespace=False)
net = Mininet(switch=OVSSwitch, controller=ctrlr, autoStaticArp=False)
c1 = net.addController('c1')
vmb = VlanMininetBuilder()
vmb.build(net)
# Set up logging etc.
lg.setLogLevel('info')
lg.setLogLevel('output')
# Start the network
net.start()
# Enter CLI mode
output("Network ready\n")
output("Press Ctrl-d or type exit to quit\n")
CLI(net)
net.stop()
开发者ID:frenetic-lang,项目名称:manual,代码行数:20,代码来源:mn_custom_topo.py
示例18: main
def main():
lg.setLogLevel('info')
context = Context()
if not get_cmd_line_args(context):
return
print 'Starting with [%s] switches' % context.switch_number
# Create the topology with the context args taken from the cmd-line
myTopo = create_topology(context)
# The network
myNet = Mininet(myTopo)
# The SDN-remote_controller connection
mySDNController = myNet.addController(
context.remote_controller_name,
customConstructor({'remote': RemoteController},
context.remote_controller_args))
myLocalController = myNet.addController('c1', controller=OVSController)
myLocalController.start()
dump_hosts(myNet)
# This will output the nodes port connections to MININET_NET_FILE
dumpNodeConnections(myNet.values())
# This will output the nodes port connections to MININET_DUMP_FILE
dumpNodes(myNet.values())
# start_gateways(myNet)
start_switches(context, myNet, mySDNController, myLocalController)
# Insert ovs-ofctl rules
print 'Inserting flows into the switches...'
init_flows(context)
# Start the command line
CLI(myNet)
cleanup()
开发者ID:CiscoDevNet,项目名称:iOAM,代码行数:41,代码来源:sfc-openflow-renderer_mininet.py
示例19: start
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,代码行数:22,代码来源:sandbox.py
示例20: start
def start(ip="127.0.0.1", port=6633):
ctrlr = lambda n: RemoteController(n, defaultIP=ip, port=port, inNamespace=False)
net = Mininet(switch=OVSSwitch, controller=ctrlr, host=VLANHost, autoStaticArp=True)
c1 = net.addController("c1")
####### End of static Mininet prologue ######
h1 = net.addHost("h1", mac="00:00:00:00:00:01", ip="10.0.0.1")
h2 = net.addHost("h2", mac="00:00:00:00:00:02", ip="10.0.0.2")
h3 = net.addHost("h3", mac="00:00:00:00:00:03", ip="10.0.0.3")
h4 = net.addHost("h4", mac="00:00:00:00:00:04", ip="10.0.0.4")
s1 = net.addSwitch("s1")
s10 = net.addSwitch("s10")
s2 = net.addSwitch("s2")
s9 = net.addSwitch("s9")
net.addLink(h1, s1, 1, 1)
net.addLink(h2, s1, 1, 2)
net.addLink(h3, s2, 1, 1)
net.addLink(h4, s2, 1, 2)
net.addLink(s1, s9, 3, 1)
net.addLink(s1, s10, 4, 1)
net.addLink(s2, s9, 3, 2)
net.addLink(s2, s10, 4, 2)
###### Start of static Mininet epilogue ######
# Set up logging etc.
lg.setLogLevel("info")
lg.setLogLevel("output")
# Start the network and prime other ARP caches
net.start()
# Enter CLI mode
output("Network ready\n")
output("Press Ctrl-d or type exit to quit\n")
CLI(net)
net.stop()
开发者ID:frenetic-lang,项目名称:frenetic,代码行数:38,代码来源:abfattree-testpaths2.mn.py
注:本文中的mininet.log.lg.setLogLevel函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论