本文整理汇总了Python中mininet.moduledeps.pathCheck函数的典型用法代码示例。如果您正苦于以下问题:Python pathCheck函数的具体用法?Python pathCheck怎么用?Python pathCheck使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pathCheck函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, name, sw_path = None, json_path = None,
thrift_port = None,
pcap_dump = False,
log_console = False,
verbose = False,
device_id = None,
enable_debugger = False,
**kwargs):
Switch.__init__(self, name, **kwargs)
assert(sw_path)
assert(json_path)
# make sure that the provided sw_path is valid
pathCheck(sw_path)
# make sure that the provided JSON file exists
if not os.path.isfile(json_path):
error("Invalid JSON file.\n")
exit(1)
self.sw_path = sw_path
self.json_path = json_path
self.verbose = verbose
logfile = "/tmp/p4s.{}.log".format(self.name)
self.output = open(logfile, 'w')
self.thrift_port = thrift_port
self.pcap_dump = pcap_dump
self.enable_debugger = enable_debugger
self.log_console = log_console
if device_id is not None:
self.device_id = device_id
P4Switch.device_id = max(P4Switch.device_id, device_id)
else:
self.device_id = P4Switch.device_id
P4Switch.device_id += 1
self.nanomsg = "ipc:///tmp/bm-{}-log.ipc".format(self.device_id)
示例2: __init__
def __init__( self, name, dpopts='--no-slicing', **kwargs ):
"""Init.
name: name for the switch
dpopts: additional arguments to ofdatapath (--no-slicing)"""
Switch.__init__( self, name, **kwargs )
pathCheck('switch', moduleName='the Fluid library example switch' +
'(CPqD)' )
示例3: __init__
def __init__(self, name, **kwargs):
"""Init.
name: name for the switch"""
Switch.__init__(self, name, **kwargs)
pathCheck("ofdatapath", "ofprotocol", moduleName="the OpenFlow reference user switch" + "(openflow.org)")
if self.listenPort:
self.opts += " --listen=ptcp:%i " % self.listenPort
示例4: start
def start(self):
"""Start <controller> <args> on controller.
Log to /tmp/cN.log"""
pathCheck(self.command)
cout = "/tmp/" + self.name + ".log"
if self.cdir is not None:
self.cmd("cd " + self.cdir)
self.cmd(self.command, self.cargs % self.port, ">&", cout, "&")
示例5: __init__
def __init__( self, name, **kwargs ):
"""Init.
name: name for the switch"""
Switch.__init__( self, name, **kwargs )
pathCheck( 'ofdatapath', 'ofprotocol',
moduleName='the OpenFlow reference user switch (openflow.org)' )
self.cmd( 'kill %ofdatapath' )
self.cmd( 'kill %ofprotocol' )
示例6: start
def start( self ):
"""Start <controller> <args> on controller.
Log to /tmp/cN.log"""
pathCheck( self.command )
cout = '/tmp/' + self.name + '.log'
if self.cdir is not None:
self.cmd( 'cd ' + self.cdir )
self.cmd( self.command, self.cargs % self.port, '>&', cout, '&' )
示例7: start
def start(self):
pathCheck(self.command)
cout = '/tmp/' + self.name + '.log'
command = self.command + ' ' + (self.cargs % self.port)
print command
self.fout = open(cout, 'w')
self.controller_popen = self.popen(command.split(' '),
stdout=self.fout,
stderr=self.fout)
示例8: setup
def setup( cls ):
"Check dependencies and warn about firewalling"
pathCheck( 'brctl', moduleName='bridge-utils' )
# Disable Linux bridge firewalling so that traffic can flow!
for table in 'arp', 'ip', 'ip6':
cmd = 'sysctl net.bridge.bridge-nf-call-%stables' % table
out = quietRun( cmd ).strip()
if out.endswith( '1' ):
warn( 'Warning: Linux bridge may not work with', out, '\n' )
示例9: setup
def setup():
pathCheck('brctl')
brlist = quietRun('brctl show')
for line in brlist.split("\n"):
line = line.rstrip()
m = re.match('^lxbr-(\w+)', line)
if (m):
print "Cleaning old bridge lxbr-%s" % m.group(1)
self.cmd ('brctl', 'delbr', 'lxbr-%s' % m.group(1))
示例10: start
def start(self):
"""Start <controller> <args> on controller.
Log to /tmp/cN.log"""
pathCheck(self.command)
cout = "/tmp/" + self.name + ".log"
if self.cdir is not None:
self.cmd("cd " + self.cdir)
self.cmd(self.command + " " + self.cargs % self.port + " 1>" + cout + " 2>" + cout + "&")
self.execed = False
示例11: setup
def setup(cls):
"Check dependencies and warn about firewalling"
pathCheck("brctl", moduleName="bridge-utils")
# Disable Linux bridge firewalling so that traffic can flow!
for table in "arp", "ip", "ip6":
cmd = "sysctl net.bridge.bridge-nf-call-%stables" % table
out = quietRun(cmd).strip()
if out.endswith("1"):
warn("Warning: Linux bridge may not work with", out, "\n")
示例12: __init__
def __init__( self, name, **kwargs ):
"""Init.
name: name for the switch"""
Switch.__init__( self, name, **kwargs )
pathCheck( 'ofdatapath', 'ofprotocol',
moduleName='the OpenFlow reference user switch' +
'(openflow.org)' )
if self.listenPort:
self.opts += ' --listen=ptcp:%i ' % self.listenPort
示例13: start
def start(self):
"""Start <controller> <args> on controller.
Log to /tmp/cN.log"""
log.info('Starting controller...\n')
pathCheck(self.command)
cout = '/tmp/' + self.name + '.log'
chdir(self.fl_root_dir)
self.cmd(self.command + ' ' + self.cargs +
' 1>' + cout + ' 2>' + cout + '&')
self.execed = False
示例14: __init__
def __init__( self, name, bw=100000000, **kwargs ): #100mbps
"""Init.
name: name for the switch
bw: interface maximum bandwidth"""
Switch.__init__( self, name, **kwargs )
self.bandwidth = bw
pathCheck( 'ofdatapath', 'ofprotocol', moduleName='QoSFlow 0.1 datapath')
if self.listenPort: # dpctl
self.opts += ' --listen=ptcp:%i ' % self.listenPort
示例15: start
def start( self ):
"""Start <controller> <args> on controller.
Log to /tmp/cN.log"""
pathCheck( self.command )
cout = '/tmp/' + self.name + '.log'
if self.cdir is not None:
self.cmd( 'cd ' + self.cdir )
self.cmd( self.command + ' ' + self.cargs % self.port +
' 1>' + cout + ' 2>' + cout + '&' )
self.execed = False