Loading simu/data/ue_information_list.csv +1 −1 Original line number Diff line number Diff line appInst,ueTag,address,state appInst01,UeTagA,acr:192.0.0.1,UNREGISTERED appInst01,UeTagC,acr:192.0.0.3,UNREGISTERED appInst01,UeTagC,acr:192.0.0.3,INVALID_STATE appInst02,UeTagB,acr:192.0.0.2,UNREGISTERED appInst03,UeTagD,acr:192.0.0.4,UNREGISTERED appInst03,UeTagE,acr:192.0.0.5,UNREGISTERED simu/mec_database.py +4 −2 Original line number Diff line number Diff line Loading @@ -212,12 +212,14 @@ class mec_database: def registerUEidentity(self, p_app_inst, p_json_msg): print(">>> registerUEidentity", p_json_msg) if p_json_msg["state"] != "REGISTERED" and p_json_msg["state"] != "UNREGISTERED": return None return '400 Bad Request' resp = None try: # Check the record exists r = tuple(self.__ue_information_list__.loc[p_app_inst, p_json_msg["ueIdentityTag"]]) print("registerUEidentity: Find zoneId for appInst: ", p_app_inst, ", r= ", r) if self.__ue_information_list__.loc[p_app_inst, p_json_msg["ueIdentityTag"]]['state'] == 'INVALID_STATE': return '412 Precondition Failed' self.__ue_information_list__.loc[p_app_inst, p_json_msg["ueIdentityTag"]]['state'] = p_json_msg["state"] l = (p_json_msg["ueIdentityTag"], p_json_msg["state"]) resp = self.__to_ueIdentityTagInfo__(p_json_msg["ueIdentityTag"], l) Loading simu/mec_http_server.py +8 −0 Original line number Diff line number Diff line Loading @@ -96,12 +96,20 @@ class myHandler(http.server.BaseHTTPRequestHandler): else: if resp.find('Not Found') != -1: self.send_response(404, 'Not Found') resp = "" elif resp.find('Forbidden') != -1: self.send_response(403, 'Forbidden') resp = "" elif resp.find('Bad Request') != -1: self.send_response(400, 'Bad Request') resp = "" elif resp.find('Precondition Failed') != -1: self.send_response(412, 'Precondition Failed') resp = "{\"problemDetails\": {\t\"type\": \"Precondition Failed\",\t\"title\": \"N/A\",\t\"status\": 412,\t\"detail\": \"Wrong preconditions\",\t\"instance\": \"N/A\"}}" content_type = 'application/problem+json' elif resp.find('userTrackingSubscription') != -1: self.send_response(201, 'Created') resp = "" else: self.send_response(200, 'OK') self.send_header('Host', self.headers.get('Host')) # send_header() shall be after send_response() Loading simu/mec_simulator.py +2 −2 Original line number Diff line number Diff line Loading @@ -8,9 +8,9 @@ import sys, os, time import msvcrt # MEC simulator IPv4 address #ADDRESS_BINDING = '172.28.4.87' ADDRESS_BINDING = '172.28.4.87' #ADDRESS_BINDING = '192.168.1.21' ADDRESS_BINDING = '192.168.0.17' #ADDRESS_BINDING = '192.168.0.17' #ADDRESS_BINDING = '127.0.0.1' # MEC simulator IPv4 listening port PORT_NUMBER = 8081 Loading Loading
simu/data/ue_information_list.csv +1 −1 Original line number Diff line number Diff line appInst,ueTag,address,state appInst01,UeTagA,acr:192.0.0.1,UNREGISTERED appInst01,UeTagC,acr:192.0.0.3,UNREGISTERED appInst01,UeTagC,acr:192.0.0.3,INVALID_STATE appInst02,UeTagB,acr:192.0.0.2,UNREGISTERED appInst03,UeTagD,acr:192.0.0.4,UNREGISTERED appInst03,UeTagE,acr:192.0.0.5,UNREGISTERED
simu/mec_database.py +4 −2 Original line number Diff line number Diff line Loading @@ -212,12 +212,14 @@ class mec_database: def registerUEidentity(self, p_app_inst, p_json_msg): print(">>> registerUEidentity", p_json_msg) if p_json_msg["state"] != "REGISTERED" and p_json_msg["state"] != "UNREGISTERED": return None return '400 Bad Request' resp = None try: # Check the record exists r = tuple(self.__ue_information_list__.loc[p_app_inst, p_json_msg["ueIdentityTag"]]) print("registerUEidentity: Find zoneId for appInst: ", p_app_inst, ", r= ", r) if self.__ue_information_list__.loc[p_app_inst, p_json_msg["ueIdentityTag"]]['state'] == 'INVALID_STATE': return '412 Precondition Failed' self.__ue_information_list__.loc[p_app_inst, p_json_msg["ueIdentityTag"]]['state'] = p_json_msg["state"] l = (p_json_msg["ueIdentityTag"], p_json_msg["state"]) resp = self.__to_ueIdentityTagInfo__(p_json_msg["ueIdentityTag"], l) Loading
simu/mec_http_server.py +8 −0 Original line number Diff line number Diff line Loading @@ -96,12 +96,20 @@ class myHandler(http.server.BaseHTTPRequestHandler): else: if resp.find('Not Found') != -1: self.send_response(404, 'Not Found') resp = "" elif resp.find('Forbidden') != -1: self.send_response(403, 'Forbidden') resp = "" elif resp.find('Bad Request') != -1: self.send_response(400, 'Bad Request') resp = "" elif resp.find('Precondition Failed') != -1: self.send_response(412, 'Precondition Failed') resp = "{\"problemDetails\": {\t\"type\": \"Precondition Failed\",\t\"title\": \"N/A\",\t\"status\": 412,\t\"detail\": \"Wrong preconditions\",\t\"instance\": \"N/A\"}}" content_type = 'application/problem+json' elif resp.find('userTrackingSubscription') != -1: self.send_response(201, 'Created') resp = "" else: self.send_response(200, 'OK') self.send_header('Host', self.headers.get('Host')) # send_header() shall be after send_response() Loading
simu/mec_simulator.py +2 −2 Original line number Diff line number Diff line Loading @@ -8,9 +8,9 @@ import sys, os, time import msvcrt # MEC simulator IPv4 address #ADDRESS_BINDING = '172.28.4.87' ADDRESS_BINDING = '172.28.4.87' #ADDRESS_BINDING = '192.168.1.21' ADDRESS_BINDING = '192.168.0.17' #ADDRESS_BINDING = '192.168.0.17' #ADDRESS_BINDING = '127.0.0.1' # MEC simulator IPv4 listening port PORT_NUMBER = 8081 Loading