From 9708268f53b3e88def00c5309ad5d6287017f18c Mon Sep 17 00:00:00 2001 From: garciay Date: Tue, 6 Aug 2019 15:48:05 +0200 Subject: [PATCH] Add TC_MEC_SRV_RNIS_011_OK --- simu/mec_database.py | 3 ++- simu/mec_http_server.py | 17 ++++++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/simu/mec_database.py b/simu/mec_database.py index 7e26c80..7a6cf23 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 8f64474..6cc35ef 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): -- GitLab