本文整理汇总了Python中mininet.moduledeps.moduleDeps函数的典型用法代码示例。如果您正苦于以下问题:Python moduleDeps函数的具体用法?Python moduleDeps怎么用?Python moduleDeps使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了moduleDeps函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: build_topo_ee
def build_topo_ee(self, network_topo, name, opts):
"""
Build VNF Container object with given name and "opts" params
network_topo - Topology object need to update
name - Container name
opts - Container instance params
No return
"""
settings = {}
ip = opts.get('ip', None)
if ip: settings['ip'] = ip
defaultRoute = opts.get('defaultRoute', None)
if defaultRoute: settings['defaultRoute'] = 'via ' + defaultRoute
# Create the correct host class
hostCls = EE
params = {'name': name,
'cls': hostCls,
'cpu': opts['res']['cpu'],
'mem': opts['res']['mem'],
'ee_type': opts.get('ee_type', 'static'),
}
for o in ['remote_dpid', 'remote_port', 'remote_conf_ip',
'remote_netconf_port', 'netconf_username',
'netconf_passwd', 'local_intf_name']:
params[o] = opts.get(o)
params.update(settings)
network_topo['ee'][opts['_id']]={'params': params}
if False:
# Set the CPULimitedHost specific options
if 'cores' in opts:
network_topo['ee'][opts['_id']]['cores'] = opts['cores']
if 'cpu' in opts:
network_topo['ee'][opts['_id']]['frac']={'f':opts['res']['cpu'],
'sched':opts['sched']
}
# Attach external interfaces
if 'externalInterfaces' in opts:
network_topo['ee'][opts['_id']]['extintf'] = opts['externalInterfaces']
vlanif = opts.get('vlanInterfaces', None)
if vlanif:
self._debug('Checking that OS is VLAN prepared')
self.pathCheck('vconfig', moduleName='vlan package')
moduleDeps( add='8021q' )
network_topo['ee'][opts['_id']]['vlanif'] = vlanif
self._debug("Add %s EE to mininet topo with parameters %s" % (name, network_topo['ee'][opts['_id']]))
开发者ID:fredericoschardong,项目名称:escape,代码行数:53,代码来源:NetworkManager.py
示例2: 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
示例3: setup
def setup( cls ):
"Ensure any dependencies are loaded; if not, try to load them."
if not os.path.exists( '/dev/net/tun' ):
moduleDeps( add=TUN )
开发者ID:RimHaw,项目名称:mn-ccnx,代码行数:4,代码来源:node.py
示例4: setup
def setup():
"Ensure any dependencies are loaded; if not, try to load them."
pathCheck( 'ofprotocol',
moduleName='the OpenFlow reference kernel switch'
' (openflow.org) (NOTE: not available in OpenFlow 1.0!)' )
moduleDeps( subtract=OVS_KMOD, add=OF_KMOD )
开发者ID:ssujoysaha,项目名称:myfiles,代码行数:6,代码来源:node.py
示例5: 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 )
output = quietRun('ovs-vsctl --version')
if "1.7" in output:
# The kernel module name is changed some time in 2012
# http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;
# a=commitdiff;h=9b80f761bed9a32c1b0eb22ee3361966057ea973
moduleDeps( subtract=OF_KMOD, add="openvswitch", moduleName=moduleName )
else:
moduleDeps( subtract=OF_KMOD, add=OVS_KMOD, moduleName=moduleName )
if not checkRunning('ovsdb-server', 'ovs-vswitchd'):
# db, socket, pid, log file paths
ovsInstanceDir = "/var/run/openvswitch"
quietRun('mkdir -p %s' % ovsInstanceDir)
confDbPath = "%s/conf.db" % ovsInstanceDir
dbSockPath = "%s/db.sock" % ovsInstanceDir
ovsdbServerPidPath = "%s/ovsdb-server.pid" % ovsInstanceDir
ovsdbServerLogPath = "%s/ovsdb-server.log" % ovsInstanceDir
ovsVswitchdPidPath = "%s/ovs-vswitchd.pid" % ovsInstanceDir
ovsVswitchdLogPath = "%s/ovs-vswitchd.log" % ovsInstanceDir
# Create ovs database
quietRun("ovsdb-tool create %s" % confDbPath)
# Start ovsdb-server
ovsdb_instance = Popen(['ovsdb-server',
confDbPath,
'--remote=punix:%s' % dbSockPath,
'--remote=db:Open_vSwitch,manager_options',
'--detach',
'--pidfile=%s' % ovsdbServerPidPath,
'--log-file=%s' % ovsdbServerLogPath],
stderr = sys.stderr,
stdout = sys.stdout)
assert ovsdb_instance.wait() == 0
# Start ovs-vswitchd
vswitchd_instance = Popen(['ovs-vswitchd',
'unix:%s' % dbSockPath,
'--detach',
'--pidfile=%s' % ovsVswitchdPidPath,
'--log-file=%s' % ovsVswitchdLogPath],
stderr = sys.stderr,
stdout = sys.stdout)
assert vswitchd_instance.wait() == 0
# Append ovs-vsctl with database information
OVSKernelSwitchNew.vsctl_cmd = \
'ovs-vsctl -t 2 --db=unix:%s ' % dbSockPath
# Save the pids of ovsdb-server and ovs-vswitchd
OVSKernelSwitchNew.ovsdbServerPid = \
int(file(ovsdbServerPidPath).read().strip())
OVSKernelSwitchNew.ovsVswitchdPid = \
int(file(ovsVswitchdPidPath).read().strip())
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:meiyangbigswitch,项目名称:mininet,代码行数:68,代码来源:node.py
注:本文中的mininet.moduledeps.moduleDeps函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论