diff --git a/simu/mec_database.py b/simu/mec_database.py index 7e26c8053490a98f606732ccab6c0ca7a6c3e44b..7a6cf232e2e97ed6c01d714f706bb8191e9314b3 100644 --- a/simu/mec_database.py +++ b/simu/mec_database.py @@ -209,7 +209,8 @@ class mec_database: # End of method getAccessPointList def getSubscriptionLinkList(self, p_uri): - return "{\"SubscriptionLinkList\": {\"_links\": {\"self\": \"http://example.com" + p_uri + "\"},\"subscription\": [{\"href\": \"http://meAppClient.example.com/rni/v1/notifications/cell_change/77777\",\"subscriptionType\": \"CELL_CHANGE\"},{\"href\": \"http://meAppClient.example.com/rni/v1/notifications/MeasTa/77777\",\"subscriptionType\": \"MEAS_TIMING_ADVANCE\"}]}}" + s = p_uri.split('?') + return "{\"SubscriptionLinkList\": {\"_links\": {\"self\": \"http://example.com" + s[0] + "\"},\"subscription\": [{\"href\": \"http://meAppClient.example.com/rni/v1/notifications/cell_change/77777\",\"subscriptionType\": \"CELL_CHANGE\"},{\"href\": \"http://meAppClient.example.com/rni/v1/notifications/MeasTa/77777\",\"subscriptionType\": \"MEAS_TIMING_ADVANCE\"}]}}" # End of method getSubscriptionLinkList def getMp1TransportInfoList(self): diff --git a/simu/mec_http_server.py b/simu/mec_http_server.py index 8f644742b4637a10ceb57549c712ace614831f00..6cc35ef0b148b29421760c810b9bb39f0787f950 100644 --- a/simu/mec_http_server.py +++ b/simu/mec_http_server.py @@ -391,7 +391,22 @@ class myHandler(http.server.BaseHTTPRequestHandler): resp = None content_type = 'application/json' if p_split[4].startswith('subscriptions'): - if p_split.__len__() == 6: + if p_split.__len__() == 5: + s = p_split[4].split('?') + if s.__len__() == 1: + resp = self.__db__.getSubscriptionLinkList(self.path) + elif s[0] != 'subscriptions': + resp = "{\"problemDetails\": {\t\"type\": \"Bad Request\",\t\"title\": \"RnisAPI\",\t\"status\": 400,\t\"detail\": \"Wrong parameters\",\t\"instance\": \"string\"}}" + content_type = 'application/problem+json' + else: + s = s[1].split('=') + print('__process__rnis__api__: ', s) + if s[0] != 'subscription_type': + resp = "{\"problemDetails\": {\t\"type\": \"Bad Request\",\t\"title\": \"RnisAPI\",\t\"status\": 400,\t\"detail\": \"Wrong parameters\",\t\"instance\": \"string\"}}" + content_type = 'application/problem+json' + else: + resp = self.__db__.getSubscriptionLinkList(self.path) + elif p_split.__len__() == 6: if p_split[5] == '': resp = self.__db__.getSubscriptionLinkList(self.path) if (resp == None):