本文整理汇总了Python中mininet.moduledeps.pathCheck函数的典型用法代码示例。如果您正苦于以下问题:Python pathCheck函数的具体用法?Python pathCheck怎么用?Python pathCheck使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pathCheck函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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)
开发者ID:wysamuel,项目名称:behavioral-model,代码行数:33,代码来源:p4_mininet.py
示例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)' )
开发者ID:David-B55,项目名称:libfluid,代码行数:7,代码来源:node.py
示例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
开发者ID:sjas,项目名称:mininet,代码行数:7,代码来源:node.py
示例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, "&")
开发者ID:stonary,项目名称:nat,代码行数:8,代码来源:lab5.py
示例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' )
开发者ID:sandeephebbani,项目名称:mininet,代码行数:8,代码来源:node.py
示例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, '&' )
开发者ID:petergrabowski,项目名称:networks,代码行数:8,代码来源:lab3.py
示例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)
开发者ID:BenjaminUJun,项目名称:ryuo,代码行数:9,代码来源:node.py
示例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' )
开发者ID:Guzeping,项目名称:Mininet,代码行数:9,代码来源:nodelib.py
示例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))
开发者ID:meiyangbigswitch,项目名称:mininet,代码行数:9,代码来源:node.py
示例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
开发者ID:sjas,项目名称:mininet,代码行数:9,代码来源:node.py
示例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")
开发者ID:basus,项目名称:mininet,代码行数:9,代码来源:nodelib.py
示例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
开发者ID:RimHaw,项目名称:mn-ccnx,代码行数:9,代码来源:node.py
示例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
开发者ID:OpenFlow-Clemson,项目名称:EAGERProject,代码行数:10,代码来源:floodlight.py
示例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
开发者ID:josecastillolema,项目名称:smart-OF-controller,代码行数:10,代码来源:qosflownet.py
示例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
开发者ID:RimHaw,项目名称:mn-ccnx,代码行数:10,代码来源:node.py
示例16: setup
def setup( cls ):
"Make sure IVS is installed"
pathCheck( 'ivs-ctl', 'ivs',
moduleName="Indigo Virtual Switch (projectfloodlight.org)" )
out, err, exitcode = errRun( 'ivs-ctl show' )
if exitcode:
error( out + err +
'ivs-ctl exited with code %d\n' % exitcode +
'*** The openvswitch kernel module might '
'not be loaded. Try modprobe openvswitch.\n' )
exit( 1 )
开发者ID:Phi-Ho,项目名称:mininet,代码行数:11,代码来源:node.py
示例17: __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( 'ofdatapath', 'ofprotocol',
moduleName='the OpenFlow reference user switch' +
'(openflow.org)' )
if self.listenPort:
self.opts += ' --listen=ptcp:%i ' % self.listenPort
self.dpopts = dpopts
开发者ID:Phi-Ho,项目名称:mininet,代码行数:11,代码来源:node.py
示例18: setup
def setup():
"Ensure any dependencies are loaded; if not, try to load them."
moduleName='Open vSwitch (openvswitch.org)'
pathCheck( 'ovs-vsctl', 'ovsdb-server', 'ovs-vswitchd', moduleName=moduleName )
moduleDeps( subtract=OF_KMOD, add=OVS_KMOD, moduleName=moduleName )
if not checkRunning('ovsdb-server', 'ovs-vswitchd'):
ovsdb_server_cmd = ['ovsdb-server',
'--remote=punix:/tmp/mn-openvswitch-db.sock',
'--remote=db:Open_vSwitch,manager_options']
# We need to specify the DB path for OVS before 1.2.0
ovs_ver = quietRun('ovsdb-server -V').split('\n')[0]
# Note the space in front of the version strings.
# TODO: Maybe we should extract the version instead of
# substr matching
if ' 1.1.' in ovs_ver or ' 1.0.' in ovs_ver:
ovsdb_server_cmd.insert(1, '/usr/local/etc/openvswitch/conf.db')
# Every OVS command *except* ovsdb-server has a default path
# to the database socket hardcoded. Problem is: if we need
# to run ovsdb-server ourselves we cannot figure out what
# this path is. Grr.
ovsdb_instance = Popen(ovsdb_server_cmd,
stderr = STDOUT, stdout = open('/tmp/mn-ovsdb-server.log', "w") )
sleep(0.1)
if ovsdb_instance.poll() is not None:
error("ovsdb-server was not running and we could not start it - exiting\n")
sys.exit(1)
vswitchd_instance = Popen(['ovs-vswitchd', 'unix:/tmp/mn-openvswitch-db.sock'],
stderr = STDOUT, stdout = open('/tmp/mn-vswitchd.log', "w") )
if vswitchd_instance.poll() is not None:
error("ovs-vswitchd was not running and we could not start it - exiting\n")
sys.exit(1)
sleep(0.1)
OVSKernelSwitchNew.vsctl_cmd = 'ovs-vsctl -t 2 --db=unix:/tmp/mn-openvswitch-db.sock '
else:
OVSKernelSwitchNew.vsctl_cmd = 'ovs-vsctl -t 2 '
# Remove old mininet datapaths to make sure they don't interfere
brlist = quietRun ( OVSKernelSwitchNew.vsctl_cmd + ' list-br' )
for line in brlist.split("\n"):
line = line.rstrip()
if re.match('^mn-dp[0-9]+$', line):
quietRun ( OVSKernelSwitchNew.vsctl_cmd + ' del-br ' + line )
开发者ID:sandeephebbani,项目名称:mininet,代码行数:45,代码来源:node.py
示例19: setup
def setup( cls ):
"Make sure Open vSwitch is installed and working"
pathCheck( 'ovs-vsctl',
moduleName='Open vSwitch (openvswitch.org)')
# This should no longer be needed, and it breaks
# with OVS 1.7 which has renamed the kernel module:
# moduleDeps( subtract=OF_KMOD, add=OVS_KMOD )
out, err, exitcode = errRun( 'ovs-vsctl -t 1 show' )
if exitcode:
error( out + err +
'ovs-vsctl exited with code %d\n' % exitcode +
'*** Error connecting to ovs-db with ovs-vsctl\n'
'Make sure that Open vSwitch is installed, '
'that ovsdb-server is running, and that\n'
'"ovs-vsctl show" works correctly.\n'
'You may wish to try '
'"service openvswitch-switch start".\n' )
exit( 1 )
开发者ID:RimHaw,项目名称:mn-ccnx,代码行数:18,代码来源:node.py
示例20: _build_cmd_args
def _build_cmd_args( self ):
"Build command-line argument of POX."
self.run_file = ""
self.ctrl_args = ""
self.cmd_args = ""
self.cmd_log = ""
self.cmd_tail = ""
self.run_file = self.poxCoreDir + "/pox.py"
pathCheck( self.run_file )
if self.use_remote_controller:
self.ctrl_args = "--no-openflow"
elif self.controller_type:
self.ctrl_args = self.controller_type + " openflow.of_01"
self.ctrl_args += " --address=" + str(self.controller_ip)
self.ctrl_args += " --port=" + str(self.controller_port)
self.cmd_args = "datapaths.pcap_switch"
self.cmd_args += " --address=" + str(self.controller_ip)
self.cmd_args += " --port=" + str(self.controller_port)
self.cmd_args += " --max_retry_delay=" + str(self.max_retry_delay)
self.cmd_args += " --dpid=" + str(self.dpid)
self.cmd_args += " --ports=" + ",".join(self.intf_ports)
self.cmd_args += " --extra=" + ",".join(self.extra)
self.cmd_log = "/tmp/" + self.name + ".log"
self.cmd( 'echo "" > %s' % self.cmd_log ) # Clear previous
self.cmd_tail = "1>> " + self.cmd_log + " 2>> " + self.cmd_log + " &"
if self.print_personal_debug: print "WARN: self.listenPort is UNUSED"
self.command = self.run_file
self.command += " " + self.ctrl_args
self.command += " " + self.cmd_args
self.command += " " + self.cmd_tail
if self.print_personal_debug: print "EVAL: " + self.command
开发者ID:eternia478,项目名称:mininetcetera_public,代码行数:36,代码来源:mininet_node_patch.py
注:本文中的mininet.moduledeps.pathCheck函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论