本文整理汇总了Python中mininet.node.OVSSwitch.batchShutdown方法的典型用法代码示例。如果您正苦于以下问题:Python OVSSwitch.batchShutdown方法的具体用法?Python OVSSwitch.batchShutdown怎么用?Python OVSSwitch.batchShutdown使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mininet.node.OVSSwitch
的用法示例。
在下文中一共展示了OVSSwitch.batchShutdown方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: batchShutdown
# 需要导入模块: from mininet.node import OVSSwitch [as 别名]
# 或者: from mininet.node.OVSSwitch import batchShutdown [as 别名]
def batchShutdown( cls, switches, **_kwargs ):
"Stop switches in per-server batches"
key = attrgetter( 'server' )
for server, switchGroup in groupby( sorted( switches, key=key ), key ):
info( '(%s)' % server )
group = tuple( switchGroup )
switch = group[ 0 ]
OVSSwitch.batchShutdown( group, run=switch.rcmd )
return switches
示例2: batchShutdown
# 需要导入模块: from mininet.node import OVSSwitch [as 别名]
# 或者: from mininet.node.OVSSwitch import batchShutdown [as 别名]
def batchShutdown( cls, switches ):
result = []
for ovsdb, switchGroup in groupby( switches, attrgetter( 'ovsdb') ):
switchGroup = list( switchGroup )
info( '(%s)' % ovsdb )
for switch in switches:
if switch.pid == ovsdb.pid:
switch.pid = None
switch.shell = None
result += OVSSwitch.batchShutdown( switchGroup, run=ovsdb.cmd )
for switch in switchGroup:
switch.ovsdbFree()
return result