def setUp(self): self.config = config.Config(tools_common.DefaultTestConfiguration) # start server first self._serverDaemon = overlord.LWM2MServerDaemon( self.config.serverIpcPort, self.config.serverAddress, self.config.serverCoapPort, self.config.serverLogFile) self.addCleanup(self._serverDaemon.terminate) self._serverDaemon.spawn() self._clientDaemons = [] for i in range(self.NUM_CLIENTS): print "Creating client %i" % (i, ) clientEndpointName = self.config.clientEndpointName + str(i) clientIPCPort = self.config.clientIpcPort + i clientCoapPort = self.config.clientCoapPort + i client = overlord.LWM2MClientDaemon( clientIPCPort, clientCoapPort, self.config.clientLogFile, clientEndpointName, self.config.bootstrapConfigFile) self.addCleanup(client.terminate) self._clientDaemons.append(client) client.spawn() # wait for client to register with server common.waitForClient(clientEndpointName, self.config.serverIpcPort)
def setUp(self): if g_ConfigurationClass: print("Using configuration override: " + str(g_ConfigurationClass)) self.config = config.Config(g_ConfigurationClass) # use override else: print("Using default configuration") self.config = config.Config() # use default # start server first print "Starting server daemon" if self.config.spawnServerDaemon: self._serverDaemon = overlord.LWM2MServerDaemon(self.config.serverIpcPort, self.config.serverAddress, self.config.serverCoapPort, self.config.serverLogFile) self.addCleanup(self._serverDaemon.terminate) self._serverDaemon.spawn() print "Starting client daemon" if self.config.spawnClientDaemon: self._clientDaemon = overlord.LWM2MClientDaemon(self.config.clientIpcPort, self.config.clientCoapPort, self.config.clientLogFile, self.config.clientEndpointName, self.config.bootstrapConfigFile) self.addCleanup(self._clientDaemon.terminate) self._clientDaemon.spawn() # wait for client to register with server waitForClient(self.config.clientEndpointName, self.config.serverIpcPort)