Skip to content
Snippets Groups Projects
Commit a4c40bda authored by Rowan Powell's avatar Rowan Powell
Browse files

Added simulation of demoserver shutdown

parent 8ea18d6d
No related branches found
No related tags found
No related merge requests found
......@@ -139,10 +139,15 @@ class DemoServer(object):
def configure(self, server_id, server_location):
print("Configuring")
self.configure_VM()
self.configure_VM('starting')
self.configure_VM('running')
time.sleep(1)
self.configure_server(server_id, server_location)
def shutdown(self):
print("Shutting down")
self.configure_VM('stopping')
def generate_clients(self):
self.clients = []
for i in range(self.clientCount):
......@@ -165,13 +170,9 @@ class DemoServer(object):
# lp._generateServerConfig(id, locations[i], 8, '100G', '1T', self._selectDelay(len(ids))))
self._sendInfluxDataBlock(server_conf_block)
def configure_VM(self):
print("Configuring VM nodes")
VM_conf_block = []
self._generateVMS('starting', 1, VM_conf_block)
self._generateVMS('running', 1, VM_conf_block)
self._sendInfluxDataBlock(VM_conf_block)
def configure_VM(self, state):
print("Configuring VM node")
self._sendInfluxData(self._generateVM(state, 1))
def configure_ports(self):
print("Configuring Servers")
......@@ -259,9 +260,8 @@ class DemoServer(object):
return self.simIterations
# 'Private' methods ________________________________________________________
def _generateVMS(self, state, amount, datablock):
for i in range(0, amount):
datablock.append(lp._generateVMConfig(state, 1, '100G', '1T', self._selectDelay(amount)))
def _generateVM(self, state, delay):
return lp._generateVMConfig(state, 1, '100G', '1T', self._selectDelay(delay))
def _cpuUsage(self, clientCount):
cpuUsage = randint(0, 10)
......@@ -382,5 +382,5 @@ while True:
if itCount == 0:
break
demoServer.shutdown_VMs()
demoServer.shutdown()
print("\nFinished")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment