本文整理汇总了Python中mininet.link.Link.intfName方法的典型用法代码示例。如果您正苦于以下问题:Python Link.intfName方法的具体用法?Python Link.intfName怎么用?Python Link.intfName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mininet.link.Link
的用法示例。
在下文中一共展示了Link.intfName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _auto_config_intf
# 需要导入模块: from mininet.link import Link [as 别名]
# 或者: from mininet.link.Link import intfName [as 别名]
def _auto_config_intf(self, node_name, intf_name, **param):
node = self.nodemap[node_name]
if 'port' not in param:
param['port'] = node.newPort()
if intf_name == 'auto':
intf_name = Link.intfName(node, param['port'])
if intf_name in node.nameToIntf:
error("Node %s already has interface %s." % (node, name))
return False
net = self.mn
if 'ip' not in param:
ip = net.nextIP
net.nextIP += 1
sufix = ipAdd(ip, ipBaseNum=net.ipBaseNum, prefixLen=net.prefixLen)
prefix = '/%s' % net.prefixLen
param['ip'] = sufix + prefix
if 'mac' not in param:
param['mac'] = macColonHex(ip)
elif 'mac' not in param:
ip, prefix = netParse(param['ip'])
param['mac'] = macColonHex(ip)
if 'cores' not in param and net.autoPinCpus:
param['cores'] = self.nextCore
net.nextCore = (net.nextCore + 1) % net.numCores
return True
示例2: add
# 需要导入模块: from mininet.link import Link [as 别名]
# 或者: from mininet.link.Link import intfName [as 别名]
def add( self, node, port=None, intfName=None ):
if hasattr( node, 'nsNode' ) and node.nsNode is not None:
pass
else:
node.nsNode = ns.network.Node()
allNodes.append( node )
device = ns.network.SimpleNetDevice()
device.SetChannel(self.channel)
device.SetAddress (ns.network.Mac48Address.Allocate ())
node.nsNode.AddDevice(device)
if port is None:
port = node.newPort()
if intfName is None:
intfName = Link.intfName( node, port ) # classmethod
tb = TBIntf( intfName, node, port, node.nsNode, device )
return tb