def __init__(self, server): Module.__init__(self, server) self.apiroutine = RoutineContainer(self.scheduler) self.apiroutine.main = self._manage_conns self.routines.append(self.apiroutine) self.managed_conns = {} self.endpoint_conns = {} self.table_modules = set() self._acquiring = False self._acquire_updated = False self._lastacquire = None self._synchronized = False self.createAPI(api(self.getconnections, self.apiroutine), api(self.getconnection, self.apiroutine), api(self.waitconnection, self.apiroutine), api(self.getdatapathids, self.apiroutine), api(self.getalldatapathids, self.apiroutine), api(self.getallconnections, self.apiroutine), api(self.getconnectionsbyendpoint, self.apiroutine), api(self.getconnectionsbyendpointname, self.apiroutine), api(self.getendpoints, self.apiroutine), api(self.getallendpoints, self.apiroutine), api(self.acquiretable, self.apiroutine), api(self.unacquiretable, self.apiroutine), api(self.lastacquiredtables) )
def __init__(self, server): Module.__init__(self, server) self.apiroutine = RoutineContainer(self.scheduler) self.client = ZooKeeperClient(self.apiroutine, self.serverlist) self.connections.append(self.client) self.apiroutine.main = self.main self.routines.append(self.apiroutine)
def __init__(self, server): Module.__init__(self, server) self._managed_objs = {} self._watches = {} self._watchedkeys = set() self._requests = [] self._transactno = 0 self._stale = False self._updatekeys = set() self._update_version = {} self.apiroutine = RoutineContainer(self.scheduler) self.apiroutine.main = self._update self.routines.append(self.apiroutine) self.createAPI(api(self.mget, self.apiroutine), api(self.get, self.apiroutine), api(self.mgetonce, self.apiroutine), api(self.getonce, self.apiroutine), api(self.mwatch, self.apiroutine), api(self.watch, self.apiroutine), api(self.munwatch, self.apiroutine), api(self.unwatch, self.apiroutine), api(self.unwatchall, self.apiroutine), api(self.transact, self.apiroutine), api(self.watchlist), api(self.walk, self.apiroutine) )
def __init__(self, server): Module.__init__(self, server) self.apiroutine = RoutineContainer(self.scheduler) self.apiroutine.main = self._manage_conns self.routines.append(self.apiroutine) self.managed_conns = {} self.managed_systemids = {} self.managed_bridges = {} self.managed_routines = [] self.endpoint_conns = {} self.createAPI(api(self.getconnection, self.apiroutine), api(self.waitconnection, self.apiroutine), api(self.getdatapathids, self.apiroutine), api(self.getalldatapathids, self.apiroutine), api(self.getallconnections, self.apiroutine), api(self.getbridges, self.apiroutine), api(self.getbridge, self.apiroutine), api(self.getbridgebyuuid, self.apiroutine), api(self.waitbridge, self.apiroutine), api(self.waitbridgebyuuid, self.apiroutine), api(self.getsystemids, self.apiroutine), api(self.getallsystemids, self.apiroutine), api(self.getconnectionbysystemid, self.apiroutine), api(self.waitconnectionbysystemid, self.apiroutine), api(self.getconnectionsbyendpoint, self.apiroutine), api(self.getconnectionsbyendpointname, self.apiroutine), api(self.getendpoints, self.apiroutine), api(self.getallendpoints, self.apiroutine), api(self.getallbridges, self.apiroutine), api(self.getbridgeinfo, self.apiroutine), api(self.waitbridgeinfo, self.apiroutine) ) self._synchronized = False
def __init__(self, server): Module.__init__(self, server) self.protocol = ZooKeeper() self.client = Client(self.url, self.protocol, self.scheduler) self.connections.append(self.client) self.apiroutine = RoutineContainer(self.scheduler) self.apiroutine.main = self.main self.routines.append(self.apiroutine)
def __init__(self, server, protocolclass): Module.__init__(self, server) self._protocolclass = protocolclass self.apiroutine = RoutineContainer(self.scheduler) self.managed_connections = set() self._createServers(self, '') self.createAPI(api(self.getservers), api(self.stoplisten, self.apiroutine), api(self.startlisten, self.apiroutine), api(self.updateconfig, self.apiroutine), api(self.getconnections))
def __init__(self, server): Module.__init__(self, server) self.apiroutine = RoutineContainer(self.scheduler) def _main(): try: for m in self.run(*self.args, **self.kwargs): yield m finally: self.scheduler.quit() self.apiroutine.main = _main self.routines.append(self.apiroutine)
def __init__(self, server): """ Constructor """ Module.__init__(self, server) self.apiroutine = RoutineContainer(self.scheduler) self.createAPI( api(self.start, self.apiroutine), api(self.create, self.apiroutine), api(self.get, self.apiroutine), api(self.destroy, self.apiroutine), )
def __init__(self, server): Module.__init__(self, server) self.dispatcher = Dispatcher(self.scheduler) self.mimetypedatabase = mimetypes.MimeTypes(self.mimetypes) self._cache = {} self.apiroutine = RoutineContainer(self.scheduler) self.lastcleartime = 0 def start(asyncStart = False): self._createHandlers(self) def close(): self.dispatcher.close() self.apiroutine.start = start self.apiroutine.close = close self.routines.append(self.apiroutine) self.createAPI(api(self.updateconfig))
def __init__(self, server): Module.__init__(self, server) self.apiroutine = RoutineContainer(self.scheduler) self.apiroutine.main = self._manage_ports self.routines.append(self.apiroutine) self.managed_ports = {} self.createAPI(api(self.getports, self.apiroutine), api(self.getallports, self.apiroutine), api(self.getportbyno, self.apiroutine), api(self.waitportbyno, self.apiroutine), api(self.getportbyname, self.apiroutine), api(self.waitportbyname, self.apiroutine), api(self.resync, self.apiroutine) ) self._synchronized = False
def load(self, container): for m in Module.load(self, container): yield m loadmodules = [] for p in self.autoloadpackages: try: def onerror(name): self._logger.warning("Autoload package %r on package %r failed", name, p) pkg = __import__(p, fromlist = ('dummy',)) for _, name, ispkg in pkgutil.walk_packages(pkg.__path__, p + '.', onerror): if not ispkg: try: pymod = __import__(name, fromlist = ('dummy',)) for m in vars(pymod).values(): if isinstance(m, type) and issubclass(m, Module) and getattr(m, '__module__', '') == name: loadmodules.append(m) except Exception: self._logger.warning('Autoload module %r failed', name, exc_info = True) except Exception: self._logger.warning('Autoload package %r failed', p, exc_info = True) if loadmodules: for m in container.executeAll([self.server.moduleloader.loadmodule(m) for m in loadmodules], self.server.moduleloader, ()): yield m for m in self.changestate(ModuleLoadStateChanged.LOADED, container): yield m
def __init__(self, server): Module.__init__(self, server) self.apiroutine = RoutineContainer(self.scheduler) self.apiroutine.main = self._main self.routines.append(self.apiroutine) self._reqid = 0 self._ownerid = uuid1().hex self.createAPI(api(self.createlogicalnetwork, self.apiroutine), api(self.createlogicalnetworks, self.apiroutine), api(self.createphysicalnetwork, self.apiroutine), api(self.createphysicalnetworks, self.apiroutine), api(self.createphysicalport, self.apiroutine), api(self.createphysicalports, self.apiroutine), api(self.createlogicalport, self.apiroutine), api(self.createlogicalports, self.apiroutine), api(self.getlogicalnetworks, self.apiroutine)) self._logger.setLevel(logging.DEBUG)
def __init__(self, server): """ Constructor """ Module.__init__(self, server) self.apiroutine = RoutineContainer(self.scheduler) self.apiroutine.main = self._autoreload self._lastcheck = time() if self.autoreload: self.routines.append(self.apiroutine) self.createAPI( api(self.enableAutoReload), api(self.activeModules), api(self.reloadmodules, self.apiroutine), api(self.loadmodule, self.apiroutine), api(self.unloadmodule, self.apiroutine), )
def load(self, container): self.scheduler.queue.addSubQueue(\ self.objectupdatepriority, dataobj.DataObjectUpdateEvent.createMatcher(), 'dataobjectupdate') for m in callAPI(container, 'updatenotifier', 'createnotifier'): yield m self._notifier = container.retvalue for m in Module.load(self, container): yield m self.routines.append(self._notifier)
def __init__(self, server): Module.__init__(self, server) self.apiroutine = RoutineContainer(self.scheduler) self.apiroutine.main = self._manage_ports self.routines.append(self.apiroutine) self.managed_ports = {} self.managed_ids = {} self.monitor_routines = set() self.ports_uuids = {} self.wait_portnos = {} self.wait_names = {} self.wait_ids = {} self.bridge_datapathid = {} self.createAPI(api(self.getports, self.apiroutine), api(self.getallports, self.apiroutine), api(self.getportbyid, self.apiroutine), api(self.waitportbyid, self.apiroutine), api(self.getportbyname, self.apiroutine), api(self.waitportbyname, self.apiroutine), api(self.getportbyno, self.apiroutine), api(self.waitportbyno, self.apiroutine), api(self.resync, self.apiroutine) ) self._synchronized = False
def __init__(self, server): ''' Constructor ''' Module.__init__(self, server) self._ce_matcher = ConsoleEvent.createMatcher() self.apiroutine = RoutineContainer(self.scheduler) self.apiroutine.main = self._service_routine self._restore_console_event = threading.Event() @generator_to_async(True, False) def proxy(event, matcher): while True: events = self.sendEventQueue.get() if events is None: break yield events @async_to_async(True, False) @async_processor def processor(event, matcher, queueout): if event.type == 'initproxy': proxy(event, matcher, queueout) self.connector = Connector(processor, (self._ce_matcher,), self.scheduler, False) self.routines.append(self.apiroutine) self.routines.append(self.connector)
def load(self, container): for m in Module.load(self, container): yield m loadmodules = [] for p in self.autoloadpackages: try: def onerror(name): self._logger.warning( "Autoload package %r on package %r failed", name, p) pkg = __import__(p, fromlist=('dummy', )) for _, name, ispkg in pkgutil.walk_packages( pkg.__path__, p + '.', onerror): if not ispkg: try: pymod = __import__(name, fromlist=('dummy', )) for m in vars(pymod).values(): if isinstance(m, type) and issubclass( m, Module) and getattr( m, '__module__', '') == name: loadmodules.append(m) except Exception: self._logger.warning('Autoload module %r failed', name, exc_info=True) except Exception: self._logger.warning('Autoload package %r failed', p, exc_info=True) if loadmodules: for m in container.executeAll( [self.server.moduleloader.loadmodule(m) for m in loadmodules], self.server.moduleloader, ()): yield m for m in self.changestate(ModuleLoadStateChanged.LOADED, container): yield m
def load(self, container): @updater def initialize(phynetset, lognetset, logportset, phyportset): if phynetset is None: phynetset = PhysicalNetworkSet() phynetset.set = DataObjectSet() if lognetset is None: lognetset = LogicalNetworkSet() lognetset.set = DataObjectSet() if logportset is None: logportset = LogicalPortSet() logportset.set = DataObjectSet() if phyportset is None: phyportset = PhysicalPortSet() phyportset.set = DataObjectSet() return [phynetset, lognetset, logportset, phyportset] for m in callAPI(container, 'objectdb', 'transact', {'keys':[PhysicalNetworkSet.default_key(), LogicalNetworkSet.default_key(), LogicalPortSet.default_key(), PhysicalPortSet.default_key()], 'updater': initialize}): yield m for m in Module.load(self, container): yield m
def unload(self, container, force=False): for m in Module.unload(self, container, force=force): yield m
def unload(self, container, force=False): if self.connmanage: self.connections.extend(self.managed_connections) self.managed_connections.clear() for m in Module.unload(self, container, force=force): yield m
def unload(self, container, force=False): for m in Module.unload(self, container, force=force): yield m for m in container.syscall_noreturn(syscall_removequeue(self.scheduler.queue, "redisnotifier_modifylisten")): yield m
def __init__(self, server): Module.__init__(self, server) self.createAPI(api(self.createnotifier))
def unload(self, container, force=False): for m in container.syscall( syscall_removequeue(self.scheduler.queue, 'dataobjectupdate')): yield m for m in Module.unload(self, container, force=force): yield m
def __init__(self, server): Module.__init__(self, server) self.apiroutine = RoutineContainer(self.scheduler) self.apiroutine.main = self.main self.routines.append(self.apiroutine)
def __init__(self, server): Module.__init__(self, server) # Should consider to use a subclass of vlcp.service.connection.tcpserver.TcpServerBase self.connections.append(TcpServer(self.url, MyProtocol(), self.scheduler)) self.routines.append(MyServer(self.scheduler))
def unload(self, container, force=False): for m in Module.unload(self, container, force=force): yield m for m in container.syscall(syscall_removequeue(self.scheduler.queue, 'ofpmanager_tableacquiredelay')): yield m
def __init__(self, server): Module.__init__(self, server) self._tableacquire_routine = RoutineContainer(self.scheduler) self._tableacquire_routine.main = self._acquiretable self.routines.append(self._tableacquire_routine) self.createAPI(api(self.gettablerequest))
def __init__(self, server): Module.__init__(self, server)
def __init__(self, server): Module.__init__(self, server) # Should consider to use a subclass of vlcp.service.connection.tcpserver.TcpServerBase self.connections.append( TcpServer(self.url, MyProtocol(), self.scheduler)) self.routines.append(MyServer(self.scheduler))
def __init__(self, server): Module.__init__(self, server) self.client = RedisClient() self.routines.append(MainRoutine(self.client, self.scheduler))
def __init__(self, server): ''' Constructor ''' Module.__init__(self, server) self.routines.append(WebAPIHandler(self))
def load(self, container): self.scheduler.queue.addSubQueue(999, ModifyListen.createMatcher(), "redisnotifier_modifylisten") for m in Module.load(self, container): yield m
def __init__(self, server): Module.__init__(self, server) self.routines.append(MainHandler(self.scheduler))
def __init__(self, server): Module.__init__(self, server) self.routines.append(MainRoutine(self.scheduler))
def load(self, container): self.scheduler.queue.addSubQueue(1, TableAcquireDelayEvent.createMatcher(), 'ofpmanager_tableacquiredelay') for m in container.waitForSend(TableAcquireUpdate(result = None)): yield m for m in Module.load(self, container): yield m
def unload(self, container, force=False): for m in container.syscall(syscall_removequeue(self.scheduler.queue, 'dataobjectupdate')): yield m for m in Module.unload(self, container, force=force): yield m