本文整理汇总了Python中mininet.link.Link.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Link.__init__方法的具体用法?Python Link.__init__怎么用?Python Link.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mininet.link.Link
的用法示例。
在下文中一共展示了Link.__init__方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from mininet.link import Link [as 别名]
# 或者: from mininet.link.Link import __init__ [as 别名]
def __init__(
self,
node1,
node2,
port1=None,
port2=None,
intfName1=None,
intfName2=None,
addr1=None,
addr2=None,
ip1=None,
ip2=None,
**params
):
Link.__init__(
self,
node1,
node2,
port1=port1,
port2=port2,
intfName1=intfName1,
intfName2=intfName2,
cls1=TCIntf,
cls2=TCIntf,
addr1=addr1,
addr2=addr2,
params1=params,
params2=params,
)
if ip1 is not None:
self.intf1.setIP(ip1)
if ip2 is not None:
self.intf2.setIP(ip2)
示例2: __init__
# 需要导入模块: from mininet.link import Link [as 别名]
# 或者: from mininet.link.Link import __init__ [as 别名]
def __init__(self, node1, node2, port1=None, port2=None, allowed=True,
intfName1=None, intfName2=None, linkType='OPTICAL',
annotations={}, speed1=0, speed2=0, **params):
"Creates a dummy link without a virtual ethernet pair."
self.allowed = allowed
self.annotations = annotations
self.linkType = linkType
self.port1 = port1
self.port2 = port2
params1 = { 'speed': speed1 }
params2 = { 'speed': speed2 }
# self.isCrossConnect = True if self.annotations.get('optical.type') == 'cross-connect' else False
if isinstance(node1, LINCSwitch) and isinstance(node2, LINCSwitch):
self.isCrossConnect = False
else:
self.isCrossConnect = True
if isinstance(node1, LINCSwitch):
cls1 = LINCIntf
if self.isCrossConnect:
node1.crossConnects.append(self)
else:
cls1 = Intf
# bad hack to stop error message from appearing when we try to set up intf in a packet switch,
# and there is no interface there( because we do not run makeIntfPair ). This way, we just set lo up
intfName1 = 'lo'
if isinstance(node2, LINCSwitch):
cls2 = LINCIntf
if self.isCrossConnect:
node2.crossConnects.append(self)
else:
cls2 = Intf
intfName2 = 'lo'
Link.__init__(self, node1, node2, port1=port1, port2=port2,
intfName1=intfName1, intfName2=intfName2, cls1=cls1,
cls2=cls2, params1=params1, params2=params2)
示例3: __init__
# 需要导入模块: from mininet.link import Link [as 别名]
# 或者: from mininet.link.Link import __init__ [as 别名]
def __init__( self, node1, node2, port1=None, port2=None, allowed=True,
intfName1=None, intfName2=None, linkType='OPTICAL',
annotations={}, speed1=0, speed2=0, **params ):
"Creates a dummy link without a virtual ethernet pair."
self.allowed = allowed
self.annotations = annotations
self.linkType = linkType
params1 = { 'speed': speed1 }
params2 = { 'speed': speed2 }
if isinstance( node1, OpticalSwitch ):
cls1 = OpticalIntf
else:
cls1 = Intf
# bad hack to stop error message from appearing when we try to set up intf in a packet switch,
# and there is no interface there( because we do not run makeIntfPair ). This way, we just set lo up
intfName1 = 'lo'
if isinstance( node2, OpticalSwitch ):
cls2 = OpticalIntf
else:
cls2 = Intf
intfName2 = 'lo'
Link.__init__( self, node1, node2, port1=port1, port2=port2,
intfName1=intfName1, intfName2=intfName2, cls1=cls1,
cls2=cls2, params1=params1, params2=params2 )
示例4: __init__
# 需要导入模块: from mininet.link import Link [as 别名]
# 或者: from mininet.link.Link import __init__ [as 别名]
def __init__(self, node1, node2, port1=None, port2=None,
intfName1=None, intfName2=None, **params):
Link.__init__(self, node1, node2, port1=port1, port2=port2,
intfName1=intfName1, intfName2=intfName2,
cls1=SdnIntf,
cls2=SdnIntf,
params1=params,
params2=params)
self._connected = True
示例5: __init__
# 需要导入模块: from mininet.link import Link [as 别名]
# 或者: from mininet.link.Link import __init__ [as 别名]
def __init__( self, node1, node2, **kwargs ):
"""Initialize a RemoteLink
see Link() for parameters"""
# Create links on remote node
self.node1 = node1
self.node2 = node2
self.tunnel = None
kwargs.setdefault( 'params1', {} )
kwargs.setdefault( 'params2', {} )
Link.__init__( self, node1, node2, **kwargs )
示例6: __init__
# 需要导入模块: from mininet.link import Link [as 别名]
# 或者: from mininet.link.Link import __init__ [as 别名]
def __init__( self, node1, node2, **kwargs ):
"See Link.__init__() for options"
self.isPatchLink = False
if ( isinstance( node1, OVSSwitch ) and
isinstance( node2, OVSSwitch ) and
getattr( node1, 'ovsdb', None ) ==
getattr( node2, 'ovsdb', None ) ):
self.isPatchLink = True
kwargs.update( cls1=OVSIntf, cls2=OVSIntf )
Link.__init__( self, node1, node2, **kwargs )
示例7: __init__
# 需要导入模块: from mininet.link import Link [as 别名]
# 或者: from mininet.link.Link import __init__ [as 别名]
def __init__(self, node1, node2, port1=None, port2=None,
intf_name1=None, intf_name2=None,
addr1=None, addr2=None, **params):
Link.__init__(self, node1, node2, port1=port1, port2=port2,
intfName1=intf_name1, intfName2=intf_name2,
cls1=ECNIntf,
cls2=ECNIntf,
addr1=addr1, addr2=addr2,
params1=params,
params2=params)