def load_request_info(self, req: Request) -> None: sql = """SELECT * FROM Requests WHERE id = {}"""\ .format(req.id) r: tuple = self.exec_sql(sql) if not r: return req.src = r[1] req.dst = r[2] req.sfc = r[3].split(' ') req.bandwidth = r[4] req.maxDelay = r[5] req.duration = r[6] req.bid = r[7]
def input_request(self) -> Request: req = Request() req.id = len(self.requests) + 1 print("Please input your flow's source") req.src = input() print("Please input your flow's destination") req.dst = input() print("Please input your sfc, format is vnf1 vnf2 ...") sfc_vnf_name = input().split(" ") # print("Please input your bandwidth, the unit is M") # req.bid = int(input()) # print("Please input your bid, the unit is doller") # req.bid = float(input()) # print("Please input your maxDelay, the unit is ms") # req.maxDelay = int(input()) print("Please input enter duration, the unit is seconds") req.duration = int(input()) for i in range(len(sfc_vnf_name)): vnf = VNF(req.id, 0, i + 1, 0, 0, 0) req.sfc.append(vnf) return req