Commit 97948a1e authored by YannGarcia's avatar YannGarcia
Browse files
parents 2be74c99 89da1624
Loading
Loading
Loading
Loading
+24 −6
Original line number Diff line number Diff line
@@ -156,7 +156,7 @@ class mec_database:
    def __to_rni_subscriptions__(self, p_subscription, p_subscription_type):
        """ Build a RNI subscription Json message. """
        print(">>> __to_rni_subscriptions__")
        resp = "{\"CellChangeSubscription\": {\"subscriptionType\": \"" + p_subscription_type + "\",\"callbackReference\": \"http://meAppClient.example.com/rni/v2/notifications/cell_change/77777\", \"_links\": {\"self\": \"http://example.com/exampleAPI/rni/v2/subscriptions\"}, \"filterCriteria\": {\"appInsId\": \"01\", \"associateId\": [{\"type\": \"UE_IPV4_ADDRESS\", \"value\": 1}], \"plmn\": {\"mcc\": \"01\", \"mnc\": \"001\"}, \"cellId\": [\"0x800000A\"], \"hoStatus\": \"COMPLETED\"}, \"expiryDeadline\": {\"seconds\": 1577836800, \"nanoSeconds\": 0}}}"
        resp = "{\"CellChangeSubscription\": {\"subscriptionType\": \"" + p_subscription_type + "\",\"callbackReference\": \"http://meAppClient.example.com/rni/v2/notifications/cell_change/77777\", \"_links\": {\"self\": \"http://example.com/exampleAPI/rni/v2/subscriptions\"}, \"filterCriteria\": {\"appInsId\": \"01\", \"associateId\": [{\"type\": \"1\", \"value\": \"192.0.0.2\"}], \"plmn\": {\"mcc\": \"01\", \"mnc\": \"001\"}, \"cellId\": \"0x800000A\", \"hoStatus\": \"COMPLETED\"}, \"expiryDeadline\": {\"seconds\": 1577836800, \"nanoSeconds\": 0}}}"
#        resp = "{\"CellChangeSubscription\": {\"callbackReference\": " + p_subscription['callbackReference'] + ", \"_links\": {\"self\": " + p_subscription['_links'] + "}, \"filterCriteria\": {\"appInsId\": " + p_subscription['filterCriteria']['appInsId'] + ", \"associateId\": [{\"type\": " + p_subscription['filterCriteria']['associateId']['type'] + ", \"value\": " + p_subscription['filterCriteria']['associateId']['value'] + "}], \"plmn\": {\"mcc\": " +  p_subscription['filterCriteria']['plmn']['mcc'] + ", \"mnc\": " + p_subscription['filterCriteria']['plmn']['mnc'] + "}, \"cellId\": [" + p_subscription['filterCriteria']['cellId'] + "], 'hoStatus': " + p_subscription['filterCriteria']['hoStatus'] + "}, \"expiryDeadline\": {\"seconds\": " + p_subscription['expiryDeadline']['seconds'] + ", \"nanoSeconds\": \"" + p_subscription['expiryDeadline']['nanoSeconds'] + "}}"
        print("__to_rni_subscriptions__: ", resp)
        return resp
@@ -391,10 +391,10 @@ 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\": null, \"type\": \"1\", \"value\": \"192.0.2.0\", \"erabInfo\": { \"erabId\": 10 }, \"erabQosParameters\": { \"qci\": 7, \"qosInformation\": { \"erabMbrDl\": 10, \"erabMbrUl\": 10, \"erabGbrDl\": 10, \"erabGbrUl\": 10 } } } } } }"
            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
    # End of getRabInfo

@@ -402,10 +402,28 @@ 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 + "\", \"ecgi\": { \"plmn\": { \"mcc\": \"001\", \"mnc\": \"01\" }, \"cellId\": \"0x800000A\" } } }"
            resp = "{ \"PlmnInfo\": { \"timeStamp\": { \"seconds\": 1577836800, \"nanoSeconds\": 0 }, \"appInsId\": \"" + p_app_inst + "\", \"plmn\": [ { \"mcc\": \"001\", \"mnc\": \"01\" } ] } }"
        return resp
    # End of getPlmnInfo

    def getS1BearerInfo(self, p_cell_id):
        print(">>> getS1BearerInfo: ", 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\"}}"
        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 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
+10 −8
Original line number Diff line number Diff line
@@ -428,20 +428,22 @@ class myHandler(http.server.BaseHTTPRequestHandler):
                    else:
                        resp = self.__db__.getSubscriptionLinkList(self.path)
        elif p_split[4].startswith('queries'):
            if p_split.__len__() == 5:
                s = p_split[4].split('?')
            if p_split.__len__() == 6:
                s = p_split[5].split('?')
                if s.__len__() == 1: # Chek message body
                    pass
                else:
                    if s[0] != 'queries':
                    resp = "{\"problemDetails\": {\t\"type\": \"Bad Request\",\t\"title\": \"RnisAPI\",\t\"status\": 400,\t\"detail\": \"Wrong parameters\",\t\"instance\": \"string\"}}"
                else:
                        query = s[0]
                        s = s[1].split('=')
                        print('__process__rnis__api__ (queries): ', s)
                        if s[0] == 'cell_id':
                        if query == 'rab_info' and s[0] == 'cell_id':
                            resp = self.__db__.getRabInfo(s[1])
                        elif s[0] == 'plmn_info':
                        elif query == 'plmn_info' and s[0] == 'app_ins_id':
                            resp = self.__db__.getPlmnInfo(s[1])
                        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):