本文整理汇总了Python中mininet.node.Host.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Host.__init__方法的具体用法?Python Host.__init__怎么用?Python Host.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mininet.node.Host
的用法示例。
在下文中一共展示了Host.__init__方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from mininet.node import Host [as 别名]
# 或者: from mininet.node.Host import __init__ [as 别名]
def __init__(self, name, loopback, CR, cluster_id, *args, **kwargs ):
dirs = ['/var/log/', '/var/log/quagga', '/var/run', '/var/run/quagga', '/var/run/openvswitch', '/var/run/sshd']
Host.__init__(self, name, privateDirs=dirs, *args, **kwargs )
self.loopback = loopback
if cluster_id == "default":
cluster_id = "0"
cluster_id = int(cluster_id)
if CR:
cluster_id = cluster_id + 128
extrainfo = '%02x000000' % cluster_id
self.dpid = self.loopbackDpid(self.loopback, extrainfo)
self.mac = self.loopbackMac(self.loopback,"0200")
self.path_ovs = "%s/%s/ovs" %(self.baseDIR, self.name)
self.path_quagga = "%s/%s/quagga" %(self.baseDIR, self.name)
self.path_fpm = "%s/%s/fpm-of" %(self.baseDIR, self.name)
if OSHI.checked == False:
self.checkQuagga()
if self.OF_V == "OpenFlow13":
self.checkOVS()
if OSHI.SR == True:
self.checkSR()
OSHI.checked = True
示例2: __init__
# 需要导入模块: from mininet.node import Host [as 别名]
# 或者: from mininet.node.Host import __init__ [as 别名]
def __init__(self, name, ips, ce_mac_address=None, gw=None, *args, **kwargs ):
dirs = ['/var/log/', '/var/log/quagga', '/var/run', '/var/run/quagga']
Host.__init__(self, name, privateDirs=dirs, *args, **kwargs )
self.ips = ips
self.ce_mac_address = ce_mac_address
self.gw = gw
self.path_quagga = "%s/%s/quagga" %(self.baseDIR, self.name)
示例3: __init__
# 需要导入模块: from mininet.node import Host [as 别名]
# 或者: from mininet.node.Host import __init__ [as 别名]
def __init__(self, name, *args, **kwargs ):
"""privateDirs: list of private directories
remounts: dirs to remount
unmount: unmount dirs in cleanup? (True)
Note: if unmount is False, you must call unmountAll()
manually."""
self.privateDirs = kwargs.pop( 'privateDirs', [] )
self.remounts = kwargs.pop( 'remounts', [] )
self.unmount = kwargs.pop( 'unmount', True )
Host.__init__( self, name, *args, **kwargs )
self.rundir = '%s/%s' % ( self.mnRunDir, name )
self.root, self.private = None, None # set in createBindMounts
if self.privateDirs:
self.privateDirs = [ realpath( d ) for d in self.privateDirs ]
self.createBindMounts()
# These should run in the namespace before we chroot,
# in order to put the right entries in /etc/mtab
# Eventually this will allow a local pid space
# Now we chroot and cd to wherever we were before.
pwd = self.cmd( 'pwd' ).strip()
self.sendCmd( 'exec chroot', self.root, 'bash -ms mininet:'
+ self.name )
self.waiting = False
self.cmd( 'cd', pwd )
# In order for many utilities to work,
# we need to remount /proc and /sys
self.cmd( 'mount /proc' )
self.cmd( 'mount /sys' )
示例4: __init__
# 需要导入模块: from mininet.node import Host [as 别名]
# 或者: from mininet.node.Host import __init__ [as 别名]
def __init__(self, name, quaggaConfFile, zebraConfFile, intfDict, ARPDict, *args, **kwargs):
Host.__init__(self, name, *args, **kwargs)
self.quaggaConfFile = quaggaConfFile
self.zebraConfFile = zebraConfFile
self.intfDict = intfDict
# TODO should be optional?
self.ARPDict = ARPDict
示例5: __init__
# 需要导入模块: from mininet.node import Host [as 别名]
# 或者: from mininet.node.Host import __init__ [as 别名]
def __init__( self, name, image='myace:v1', dargs=None, startString=None, **kwargs ):
self.image = image
self.dargs = dargs
if startString is None:
self.startString = "/bin/bash"
self.dargs = "-ti"
else:
self.startString = startString
Host.__init__( self, name, **kwargs )
示例6: __init__
# 需要导入模块: from mininet.node import Host [as 别名]
# 或者: from mininet.node.Host import __init__ [as 别名]
def __init__(self, name, **kwargs):
Host.__init__(self, name, **kwargs)
if not NdnHost.inited:
NdnHostCommon.init()
self.nfd = Nfd(self)
self.nfd.start()
self.peerList = {}
示例7: __init__
# 需要导入模块: from mininet.node import Host [as 别名]
# 或者: from mininet.node.Host import __init__ [as 别名]
def __init__(self, name, **kwargs):
privateDirs = [('/usr/local/etc/ndn', '/tmp/%(name)s/usr/local/etc/ndn'), ]
kwargs['privateDirs'] = privateDirs
Host.__init__(self, name, **kwargs)
if not NdnHost.inited:
NdnHostCommon.init()
self.nfd = Nfd(self)
self.nfd.start()
self.peerList = {}
示例8: __init__
# 需要导入模块: from mininet.node import Host [as 别名]
# 或者: from mininet.node.Host import __init__ [as 别名]
def __init__(self, name, ip=None, inNamespace=True,
root_dir=None, ssh_template=None,
auth_keys=None, **kwargs):
self.name = name
self.ssh_template = ssh_template
self.auth_keys = auth_keys
self.root_dir = root_dir
self.ssh_pid_file = None
self.mounted_dirs = []
Host.__init__(self, name, inNamespace, **kwargs)
示例9: __init__
# 需要导入模块: from mininet.node import Host [as 别名]
# 或者: from mininet.node.Host import __init__ [as 别名]
def __init__(self, name, **kwargs):
Host.__init__(self, name, **kwargs)
if not NdnHost.inited:
NdnHostCommon.init()
# Create home directory for a node
self.homeFolder = "%s/%s" % (self.params['workdir'], self.name)
self.cmd("mkdir -p %s" % self.homeFolder)
self.cmd("cd %s" % self.homeFolder)
self.nfd = Nfd(self)
self.nfd.start()
self.peerList = {}
示例10: __init__
# 需要导入模块: from mininet.node import Host [as 别名]
# 或者: from mininet.node.Host import __init__ [as 别名]
def __init__(self, *opts, **params):
"""Construct NDN host.
fw: forwarder constructor
rout: routing constructor
env: base environ for popen"""
OVERRIDE_DIRS = ['/etc/ndn', '/var/log/ndn', '/var/run', '/root']
privateDirs = params.get('privateDirs', [])
privateDirs = [ pd for pd in privateDirs if pd[0] not in OVERRIDE_DIRS ]
for d in OVERRIDE_DIRS:
privateDirs.append((d, '/tmp/mnndn/%(name)s' + d))
params['privateDirs'] = privateDirs
Host.__init__(self, *opts, **params)
self.cmd('export HOME=/root')
from NfdForwarder import NfdForwarder
from NlsrRouting import NlsrRouting
self.fwCtor = params.pop('fw', NfdForwarder)
self.routCtor = params.pop('rout', NlsrRouting)
self.env = params.pop('env', {})
self.fw = None
self.rout = None
示例11: __init__
# 需要导入模块: from mininet.node import Host [as 别名]
# 或者: from mininet.node.Host import __init__ [as 别名]
def __init__(self, name, intfDict, *args, **kwargs):
Host.__init__(self, name, *args, **kwargs)
self.intfDict = intfDict
示例12: __init__
# 需要导入模块: from mininet.node import Host [as 别名]
# 或者: from mininet.node.Host import __init__ [as 别名]
def __init__(self, name, quaggaConfFile, zebraConfFile, intfDict, *args, **kwargs):
Host.__init__(self, name, *args, **kwargs)
self.quaggaConfFile = quaggaConfFile
self.zebraConfFile = zebraConfFile
self.intfDict = intfDict
示例13: __init__
# 需要导入模块: from mininet.node import Host [as 别名]
# 或者: from mininet.node.Host import __init__ [as 别名]
def __init__(self, name, ip, gw, *args, **kwargs):
Host.__init__(self, name, ip=ip, *args, **kwargs)
self.gw = gw
示例14: __init__
# 需要导入模块: from mininet.node import Host [as 别名]
# 或者: from mininet.node.Host import __init__ [as 别名]
def __init__(self, name, inNamespace=True, **params):
Host.__init__(self, name, inNamespace=inNamespace, **params)
self.exectoken = "/tmp/mn-exec-token-host-%s" % name
self.cmd("touch %s" % self.exectoken)