本文整理汇总了Python中mininet.util.quietRun函数的典型用法代码示例。如果您正苦于以下问题:Python quietRun函数的具体用法?Python quietRun怎么用?Python quietRun使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了quietRun函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: start
def start( self, controllers ):
"Start up kernel datapath."
self.startIntfs()
# Delete local datapath if it exists;
# then create a new one monitoring the given interfaces
quietRun( self.vsctl_cmd + ' -- --if-exists del-br ' + self.dp )
self.cmd( self.vsctl_cmd + ' add-br ' + self.dp )
self.cmd( self.vsctl_cmd + ' set-fail-mode ' + self.dp + ' secure')
mac_str = ''
if self.defaultMAC:
# ovs-openflowd expects a string of exactly 16 hex digits with no
# colons.
dpid_str = '0000' + \
''.join( self.defaultMAC.split( ':' ) ) + ' '
self.cmd(self.vsctl_cmd + ' --no-wait set bridge %s other-config:datapath_type=system other-config:datapath-id=%s' % (self.dp, dpid_str))
ports = sorted( self.ports.values() )
if len( ports ) != ports[ -1 ] + 1 - self.portBase:
raise Exception( 'only contiguous, one-indexed port ranges '
'supported: %s' % self.intfs )
intfs = [ self.intfs[ port ] for port in ports ]
for i in intfs:
self.cmd( self.vsctl_cmd, 'add-port', self.dp, i )
self.cmd( self.vsctl_cmd + ' set-controller ' + self.dp +
' '.join( [ ' tcp:%s:%d' % ( c.IP(), c.port ) \
for c in controllers ] ))
self.execed = False
开发者ID:sandeephebbani,项目名称:mininet,代码行数:26,代码来源:node.py
示例2: waitForNode
def waitForNode( self, node ):
"Wait for a node to finish, and print its output."
# Pollers
nodePoller = poll()
nodePoller.register( node.stdout )
bothPoller = poll()
bothPoller.register( self.stdin, POLLIN )
bothPoller.register( node.stdout, POLLIN )
if self.isatty():
# Buffer by character, so that interactive
# commands sort of work
quietRun( 'stty -icanon min 1' )
while True:
try:
bothPoller.poll()
# XXX BL: this doesn't quite do what we want.
if False and self.inputFile:
key = self.inputFile.read( 1 )
if key is not '':
node.write(key)
else:
self.inputFile = None
if isReadable( self.inPoller ):
key = self.stdin.read( 1 )
node.write( key )
if isReadable( nodePoller ):
data = node.monitor()
output( data )
if not node.waiting:
break
except KeyboardInterrupt:
node.sendInt()
开发者ID:ActiveCK,项目名称:mininet,代码行数:32,代码来源:cli.py
示例3: start
def start( self, controllers ):
"Start up kernel datapath."
ofplog = '/tmp/' + self.name + '-ofp.log'
quietRun( 'ifconfig lo up' )
# Delete local datapath if it exists;
# then create a new one monitoring the given interfaces
quietRun( 'ovs-dpctl del-dp ' + self.dp )
self.cmd( 'ovs-dpctl add-dp ' + self.dp )
mac_str = ''
if self.defaultMAC:
# ovs-openflowd expects a string of exactly 16 hex digits with no
# colons.
mac_str = ' --datapath-id=0000' + \
''.join( self.defaultMAC.split( ':' ) ) + ' '
ports = sorted( self.ports.values() )
if len( ports ) != ports[ -1 ] + 1 - self.portBase:
raise Exception( 'only contiguous, one-indexed port ranges '
'supported: %s' % self.intfs )
intfs = [ self.intfs[ port ] for port in ports ]
self.cmd( 'ovs-dpctl', 'add-if', self.dp, ' '.join( intfs ) )
# Run protocol daemon
controller = controllers[ 0 ]
self.cmd( 'ovs-openflowd ' + self.dp +
' tcp:%s:%d' % ( controller.IP(), controller.port ) +
' --fail=secure ' + self.opts + mac_str +
' 1>' + ofplog + ' 2>' + ofplog + '&' )
self.execed = False
开发者ID:ssujoysaha,项目名称:myfiles,代码行数:27,代码来源:node.py
示例4: start
def start( self, controllers ):
"Start up kernel datapath."
ofplog = '/tmp/' + self.name + '-ofp.log'
self.startIntfs()
# Delete local datapath if it exists;
# then create a new one monitoring the given interfaces
quietRun( 'ovs-dpctl del-dp ' + self.dp )
self.cmd( 'ovs-dpctl add-dp ' + self.dp )
mac_str = ''
if self.defaultMAC:
# ovs-openflowd expects a string of exactly 16 hex digits with no
# colons.
mac_str = ' --datapath-id=0000' + \
''.join( self.defaultMAC.split( ':' ) ) + ' '
ports = sorted( self.ports.values() )
if len( ports ) != ports[ -1 ] + 1 - self.portBase:
raise Exception( 'only contiguous, one-indexed port ranges '
'supported: %s' % self.intfs )
intfs = [ self.intfs[ port ] for port in ports ]
self.cmd( 'ovs-dpctl', 'add-if', self.dp, ' '.join( intfs ) )
# Run protocol daemon
if not self.defVendor:
# Mark the switch so controller will send LLDP/BDDP on all ports
self.opts += ' --mfr-desc="big switch networks" --dp-desc="bigtest datapath" '
self.cmd( 'ovs-openflowd ' + self.dp +
' '.join( [ ' tcp:%s:%d' % ( c.IP(), c.port ) \
for c in controllers ] ) +
' --fail=secure ' + self.opts + mac_str +
' 1>' + ofplog + ' 2>' + ofplog + '&' )
self.execed = False
开发者ID:bigswitch,项目名称:mininet,代码行数:30,代码来源:node.py
示例5: stopUDPClient
def stopUDPClient():
'''stop a UDP client
'''
info('** Stop UDP client!!')
#host.cmd('cd ./%s/; nohup python2.7 ./')
quietRun("pkill -9 -f client")
quietRun("pkill -9 -f client.py")
开发者ID:scbzyhx,项目名称:sdn_final,代码行数:7,代码来源:topo.py
示例6: cleanup
def cleanup( self ):
"Help python collect its garbage."
if not self.inNamespace:
for intfName in self.intfNames():
if self.name in intfName:
quietRun( 'ip link del ' + intfName )
self.shell = None
开发者ID:RimHaw,项目名称:mn-ccnx,代码行数:7,代码来源:node.py
示例7: tunnelX11
def tunnelX11( node, display=None):
"""Create an X11 tunnel from node:6000 to the root host
display: display on root host (optional)
returns: node $DISPLAY, Popen object for tunnel"""
if display is None and 'DISPLAY' in environ:
display = environ[ 'DISPLAY' ]
if display is None:
error( "Error: Cannot connect to display\n" )
return None, None
host, screen = display.split( ':' )
# Unix sockets should work
if not host or host == 'unix':
# GDM3 doesn't put credentials in .Xauthority,
# so allow root to just connect
quietRun( 'xhost +si:localuser:root' )
return display, None
else:
# Add credentials with new hostname
creds = subprocess.check_output( 'xauth list $DISPLAY', shell=True ).split('/', 1)
if len( creds ) == 2:
newCred = node.name + '/' + creds[ 1 ]
node.cmd( 'xauth add ' + newCred )
# Create a tunnel for the TCP connection
port = 6000 + int( float( screen ) )
connection = r'TCP\:%s\:%s' % ( host, port )
cmd = [ "socat", "TCP-LISTEN:%d,fork,reuseaddr" % port,
"EXEC:'mnexec -a 1 socat STDIO %s'" % connection ]
return 'localhost:' + screen, node.popen( cmd )
开发者ID:nhurman,项目名称:mininet,代码行数:29,代码来源:term.py
示例8: cleanup
def cleanup( self ):
"Help python collect its garbage."
# Intfs may end up in root NS
for intfName in self.intfNames():
if self.name in intfName:
quietRun( 'ip link del ' + intfName )
self.shell = None
开发者ID:Phi-Ho,项目名称:mininet,代码行数:7,代码来源:node.py
示例9: start
def start(self, controllers):
"Start up kernel datapath."
ofplog = "/tmp/" + self.name + "-ofp.log"
quietRun("ifconfig lo up")
# Delete local datapath if it exists;
# then create a new one monitoring the given interfaces
self.cmd("ovs-dpctl del-dp " + self.dp)
self.cmd("ovs-dpctl add-dp " + self.dp)
intfs = [str(i) for i in self.intfList() if not i.IP()]
self.cmd("ovs-dpctl", "add-if", self.dp, " ".join(intfs))
# Run protocol daemon
clist = ",".join(["tcp:%s:%d" % (c.IP(), c.port) for c in controllers])
self.cmd(
"ovs-openflowd "
+ self.dp
+ " "
+ clist
+ " --fail=secure "
+ self.opts
+ " --datapath-id="
+ self.dpid
+ " 1>"
+ ofplog
+ " 2>"
+ ofplog
+ "&"
)
self.execed = False
开发者ID:sjas,项目名称:mininet,代码行数:28,代码来源:node.py
示例10: __init__
def __init__( self, mininet, stdin=sys.stdin, script=None ):
self.mn = mininet
# Local variable bindings for py command
self.locals = { 'net': mininet }
# Attempt to handle input
self.stdin = stdin
self.inPoller = poll()
self.inPoller.register( stdin )
self.inputFile = script
Cmd.__init__( self )
info( '*** Starting CLI:\n' )
if self.inputFile:
self.do_source( self.inputFile )
return
while True:
try:
# Make sure no nodes are still waiting
for node in self.mn.values():
while node.waiting:
node.sendInt()
node.monitor()
if self.isatty():
quietRun( 'stty sane' )
self.cmdloop()
break
except KeyboardInterrupt:
output( '\nInterrupt\n' )
开发者ID:FlowForwarding,项目名称:mininet,代码行数:27,代码来源:cli.py
示例11: do_noecho
def do_noecho( self, line ):
"Run an interactive command with echoing turned off."
if self.isatty():
quietRun( 'stty -echo' )
self.default( line )
if self.isatty():
quietRun( 'stty echo' )
开发者ID:ActiveCK,项目名称:mininet,代码行数:7,代码来源:cli.py
示例12: __init__
def __init__( self, mininet, stdin=sys.stdin, script=None ):
self.mn = mininet
self.nodelist = self.mn.controllers + self.mn.switches + self.mn.hosts
self.nodemap = {} # map names to Node objects
for node in self.nodelist:
self.nodemap[ node.name ] = node
# Attempt to handle input
self.stdin = stdin
self.inPoller = poll()
self.inPoller.register( stdin )
self.inputFile = script
Cmd.__init__( self )
info( '*** Starting CLI:\n' )
if self.inputFile:
self.do_source( self.inputFile )
return
while True:
try:
# Make sure no nodes are still waiting
for node in self.nodelist:
while node.waiting:
node.sendInt()
node.monitor()
if self.isatty():
quietRun( 'stty sane' )
self.cmdloop()
break
except KeyboardInterrupt:
output( '\nInterrupt\n' )
开发者ID:sandeephebbani,项目名称:mininet,代码行数:29,代码来源:cli.py
示例13: setupInts
def setupInts(intfs):
'''
add taps and bring them up.
'''
for i in intfs:
quietRun('ip tuntap add dev %s mode tap' % i)
quietRun('ip link set dev %s up' % i)
info('*** Intf %s set\n' % i)
开发者ID:java66liu,项目名称:onos,代码行数:8,代码来源:opticalUtils.py
示例14: cleanUpScreens
def cleanUpScreens():
"Remove moldy old screen sessions."
r = r'(\d+\.mininet\.[hsc]\d+)'
output = quietRun( 'screen -ls' ).split( '\n' )
for line in output:
m = re.search( r, line )
if m:
quietRun( 'screen -S ' + m.group( 1 ) + ' -X quit' )
开发者ID:09zwcbupt,项目名称:mininet,代码行数:8,代码来源:term.py
示例15: configSFlow
def configSFlow(spine, leaf, collector, ifname):
sflow = 'ovs-vsctl -- [email protected] create sflow agent=%s target=%s sampling=10 polling=20 --' % (ifname, collector)
for s in range(1,spine+1):
sflow += ' -- set bridge s%s [email protected]' % s
for ls in range(1,leaf+1):
sflow += ' -- set bridge s%s [email protected]' % (spine+ls)
info('*** Configuring sFlow collector=%s \n' % collector)
quietRun(sflow)
开发者ID:iluxa,项目名称:sflow-rt,代码行数:8,代码来源:leafandspine.py
示例16: cgroupSet
def cgroupSet(self, param, value, resource="cpu"):
"Set a cgroup parameter and return its value"
cmd = "cgset -r %s.%s=%s /%s" % (resource, param, value, self.name)
quietRun(cmd)
nvalue = int(self.cgroupGet(param, resource))
if nvalue != value:
error("*** error: cgroupSet: %s set to %s instead of %s\n" % (param, nvalue, value))
return nvalue
开发者ID:sjas,项目名称:mininet,代码行数:8,代码来源:node.py
示例17: __init__
def __init__( self, net, *args, **kwargs ):
self.iperfs = {}
self.bw = '12k'
self.mn = net
self.lastbw = {} # last bandwidth reports
self.start()
quietRun( 'rm /tmp/*.iperf /tmp/*.client' )
CLI.__init__( self, net, *args, **kwargs )
开发者ID:CrazyCooper,项目名称:onos,代码行数:8,代码来源:attcli.py
示例18: setupInts
def setupInts(intfs):
"""
add taps and bring them up.
"""
for i in intfs:
quietRun("ip tuntap add dev %s mode tap" % i)
quietRun("ip link set dev %s up" % i)
info("*** Intf %s set\n" % i)
开发者ID:suhasmane02,项目名称:onos,代码行数:8,代码来源:opticalUtils.py
示例19: delete
def delete( self ):
"Delete interface"
self.cmd( 'ip link del ' + self.name )
self.cmd( 'ovs-vsctl del-port ' + self.name.split('-')[0] + ' ' + self.name) ###
if self.node.inNamespace:
# Link may have been dumped into root NS
quietRun( 'ip link del ' + self.name )
quietRun( 'ovs-vsctl del-port ' + self.name.split('-')[0] + ' ' + self.name) ###
开发者ID:EliseuTorres,项目名称:mininet-1,代码行数:8,代码来源:link.py
示例20: deleteIntf
def deleteIntf(self, intf):
del self.connection[intf]
port = self.intfToPort(intf)
if port is not None:
del self.intfs[port]
del self.ports[intf]
quietRun( 'ip link del ' + intf )
sleep( 0.001 )
开发者ID:sandeephebbani,项目名称:mininet,代码行数:9,代码来源:node.py
注:本文中的mininet.util.quietRun函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论