def startSimulation(self): if cherrypy.session.get(SESSION_AUTH_KEY, None) is "true" and has_privileges(): simulationID = UserDataInterface().getSimulationid( cherrypy.request.login) #pass in this format logging.info('Starting simulation for user: '******' with Simulation id: ' + str(simulationID)) cloudInterface = CloudInterface() logging.info('Fetching assigned VM for simulation id: ' + str(simulationID)) vm = cloudInterface.assignVM(simulationID) if vm is None: logging.warning('VM could not assigned for user: '******' with Simulation id: ' + str(simulationID)) return {'response': 'notavailable'} private_ip = vm['private_IP'] key_name = vm['key_name'] logging.info('Starting simulation for id: ' + str(simulationID) + ' on VM:' + private_ip) trafficsim(private_ip, key_name, simulationID, cherrypy.request.login).start() #t_sim.start() logging.info('Simulation start command sent..') return {'response': str(simulationID)} else: logging.warning('Unable to authenticate..') return {'response': "failure"}
def restoreSimulationRate(self): if cherrypy.session.get(SESSION_AUTH_KEY, None) is "true" and has_privileges(): interface = UserDataInterface() simulationID = interface.getSimulationid(cherrypy.request.login) #pass in this format logging.info('Restoring simulation rate for user: '******' with Simulation id: ' + str(simulationID)) interface.restoreSimulationStepRate(simulationID); return {'response' : "success"} else: return {'response' : "failure"}
def restoreSimulationRate(self): if cherrypy.session.get(SESSION_AUTH_KEY, None) is "true" and has_privileges(): interface = UserDataInterface() simulationID = interface.getSimulationid( cherrypy.request.login) #pass in this format logging.info('Restoring simulation rate for user: '******' with Simulation id: ' + str(simulationID)) interface.restoreSimulationStepRate(simulationID) return {'response': "success"} else: return {'response': "failure"}
def startSimulation(self): if cherrypy.session.get(SESSION_AUTH_KEY, None) is "true" and has_privileges(): simulationID = UserDataInterface().getSimulationid(cherrypy.request.login) #pass in this format logging.info('Starting simulation for user: '******' with Simulation id: ' + str(simulationID)) cloudInterface = CloudInterface(); logging.info('Fetching assigned VM for simulation id: ' + str(simulationID)) vm = cloudInterface.assignVM(simulationID); if vm is None: logging.warning('VM could not assigned for user: '******' with Simulation id: ' + str(simulationID)) return {'response' : 'notavailable'} private_ip = vm['private_IP']; key_name = vm['key_name']; logging.info('Starting simulation for id: ' + str(simulationID) + ' on VM:' + private_ip) trafficsim(private_ip, key_name, simulationID, cherrypy.request.login).start() #t_sim.start() logging.info('Simulation start command sent..'); return {'response' : str(simulationID)} else: logging.warning('Unable to authenticate..') return {'response' : "failure"}