def batchStartup(cls, switches, **_kwargs): key = attrgetter('server') for server, switchGroup in groupby(sorted(switches, key=key), key): info('(%s)' % server) group = tuple(switchGroup) switch = group[0] OVSSwitch.batchStartup(group, run=switch.cmd) return switches
def batchStartup( cls, switches, **_kwargs ): "Start up 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.batchStartup( group, run=switch.cmd ) return switches
def batchStartup(cls, switches, **_kwargs): """ :return: started up switches """ key = attrgetter('serverIp') for server, switchBatch in groupby(sorted(switches, key=key), key): info('(%s)' % server) batch = tuple(switchBatch) OVSSwitch.batchStartup(batch, run=batch[0].cmd) return switches
def batchStartup( cls, switches ): result = [] for ovsdb, switchGroup in groupby( switches, attrgetter( 'ovsdb') ): switchGroup = list( switchGroup ) info( '(%s)' % ovsdb ) result += OVSSwitch.batchStartup( switchGroup, run=ovsdb.cmd ) return result
def start_seed_topo(net): for cont in net.topo.controllers: cont.checkListening() info('*** Starting %s switches\n' % len(net.switches)) for idx, sw in enumerate(net.switches): type = net.topo.switches_idx[sw.name][1].get("type") if type == "ofSwitch": clist = [ net.topo.controllers_idx[net.topo.node_idx[c]] for c in net.topo.switches_idx[sw.name][1].get("controller").split(" ") ] debug("Starting OFSwitch " + sw.name + " with controller list " + str(clist)) sw.start(clist) elif type == "genericSwitch": debug("Starting genericSwitch " + sw.name) sw.start([]) else: AssertionError( "A switch was not started due to an unsupported type") started = {} success = OVSSwitch.batchStartup(net.switches) started.update({s: s for s in success}) if net.waitConn: net.waitConnected()
def batchStartup(cls, switches, *_parm, **_parms): rv = OVSSwitch.batchStartup(switches, *_parm, **_parms) for s in switches: s.poststart() return rv