diff --git a/simu/mec_database.py b/simu/mec_database.py index 602c683b7c4cc18bde9f8528cb8ac4cc2b4da4b4..465d3f18ddb3a3595c314111df4044659eab2dd1 100644 --- a/simu/mec_database.py +++ b/simu/mec_database.py @@ -391,8 +391,8 @@ class mec_database: def getRabInfo(self, p_cell_id): print(">>> getRabInfo: ", p_cell_id) resp = None - if p_cell_id == '0xFFFFFFFF': - resp = "{\"problemDetails\": {\t\"type\": \"Bad Request\",\t\"title\": \"RnisAPI\",\t\"status\": 400,\t\"detail\": \"Wrong parameters\",\t\"instance\": \"string\"}}" + if p_cell_id == '0x8000099': + resp = "{\"problemDetails\": {\t\"type\": \"Not Found\",\t\"title\": \"RnisAPI\",\t\"status\": 404,\t\"detail\": \"Not Found\",\t\"instance\": \"string\"}}" else: resp = "{ \"RabInfo\": { \"timeStamp\": { \"seconds\": 1577836800, \"nanoSeconds\": 0 }, \"appInsId\": \"01\", \"requestId\": \"01\", \"cellUserInfo\": [ { \"ecgi\": { \"plmn\": { \"mcc\": \"001\", \"mnc\": \"01\" }, \"cellId\": \"" + p_cell_id + "\" }, \"ueInfo\": [ { \"associateId\": [ { \"type\": \"1\", \"value\": \"192.0.2.0\" } ], \"erabInfo\": [ { \"erabId\": 10 , \"erabQosParameters\": [ { \"qci\": 7, \"qosInformation\": [ { \"erabMbrDl\": 10, \"erabMbrUl\": 10, \"erabGbrDl\": 10, \"erabGbrUl\": 10 } ] } ] } ] } ] } ] } }" return resp @@ -402,7 +402,7 @@ class mec_database: print(">>> getPlmnInfo: ", p_app_inst) resp = None if p_app_inst == '99': - resp = "{\"problemDetails\": {\t\"type\": \"Bad Request\",\t\"title\": \"RnisAPI\",\t\"status\": 400,\t\"detail\": \"Wrong parameters\",\t\"instance\": \"string\"}}" + resp = "{\"problemDetails\": {\t\"type\": \"Not Found\",\t\"title\": \"RnisAPI\",\t\"status\": 404,\t\"detail\": \"Not Found\",\t\"instance\": \"string\"}}" else: resp = "{ \"PlmnInfo\": { \"timeStamp\": { \"seconds\": 1577836800, \"nanoSeconds\": 0 }, \"appInsId\": \"" + p_app_inst + "\", \"plmn\": [ { \"mcc\": \"001\", \"mnc\": \"01\" } ] } }" return resp @@ -411,11 +411,19 @@ class mec_database: def getS1BearerInfo(self, p_cell_id): print(">>> getS1BearerInfo: ", p_cell_id) resp = None - if p_cell_id == '99': - resp = "{\"problemDetails\": {\t\"type\": \"Bad Request\",\t\"title\": \"RnisAPI\",\t\"status\": 400,\t\"detail\": \"Wrong parameters\",\t\"instance\": \"string\"}}" + if p_cell_id == '0x8000099': + resp = "{\"problemDetails\": {\t\"type\": \"Not Found\",\t\"title\": \"RnisAPI\",\t\"status\": 404,\t\"detail\": \"Not Found\",\t\"instance\": \"string\"}}" else: resp = "{ \"S1BearerInfo\": { \"timeStamp\": { \"seconds\": 1577836800, \"nanoSeconds\": 0 }, \"s1UeInfo\": [ { \"tempUeId\": [ { \"mmec\": \"0\", \"mtmsi\": \"1234\" } ], \"associateId\": [ { \"type\": \"1\", \"value\": \"192.0.2.0\" }, { \"type\": \"3\", \"value\": \"198.51.100.0\" } ], \"ecgi\": [ { \"plmn\": { \"mcc\": \"001\", \"mnc\": \"01\" }, \"cellId\": \"0x800000A\" } ], \"s1BearerInfoDetailed\": [ { \"erabId\": 1, \"s1EnbInfo\": { \"ipAddress\": \"192.0.2.0\", \"tunnelId\": \"1111\" }, \"sGwInfo\": { \"ipAddress\": \"192.0.2.1\", \"tunnelId\": \"2222\" } } ] } ] } }" return resp - # End of getPlmnInfo + # End of getS1BearerInfo + + def getL2MeasInfo(self, p_cell_id): + print(">>> getL2MeasInfo: ", p_cell_id) + resp = None + if p_cell_id == '0x8000099': + resp = "{\"problemDetails\": {\t\"type\": \"Not Found\",\t\"title\": \"RnisAPI\",\t\"status\": 404,\t\"detail\": \"Not Found\",\t\"instance\": \"string\"}}" + return resp + # End of getL2MeasInfo # End of class mec_database diff --git a/simu/mec_http_server.py b/simu/mec_http_server.py index 59bf5e2b06ed3151504ec5d397381b174549901e..6c0ac180ad5e4b16dce89548c51ae215ff64fbaa 100644 --- a/simu/mec_http_server.py +++ b/simu/mec_http_server.py @@ -436,12 +436,14 @@ class myHandler(http.server.BaseHTTPRequestHandler): query = s[0] s = s[1].split('=') print('__process__rnis__api__ (queries): ', s) - if query == 'rab_info': + if query == 'rab_info' and s[0] == 'cell_id': resp = self.__db__.getRabInfo(s[1]) - elif query == 'plmn_info': + elif query == 'plmn_info' and s[0] == 'app_ins_id': resp = self.__db__.getPlmnInfo(s[1]) - elif query == 's1_bearer_info': + elif query == 's1_bearer_info' and s[0] == 'cell_id': resp = self.__db__.getS1BearerInfo(s[1]) + elif query == 'layer2_meas' and s[0] == 'cell_id': + resp = self.__db__.getL2MeasInfo(s[1]) else: resp = "{\"problemDetails\": {\t\"type\": \"Bad Request\",\t\"title\": \"RnisAPI\",\t\"status\": 400,\t\"detail\": \"Wrong parameters\",\t\"instance\": \"string\"}}" if (resp == None):