Loading go-apps/meep-auth-svc/go.mod +0 −2 Original line number Diff line number Diff line Loading @@ -3,14 +3,12 @@ module github.com/InterDigitalInc/AdvantEDGE/go-apps/meep-auth-svc go 1.12 require ( github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-data-key-mgr v0.0.0 // indirect github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-data-model v0.0.0 github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-logger v0.0.0 github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-metric-store v0.0.0 github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-model v0.0.0 // indirect github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-mq v0.0.0 github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-platform-ctrl-client v0.0.0 github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-redis v0.0.0 // indirect github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-sandbox-store v0.0.0 // indirect github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-sessions v0.0.0 github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-users v0.0.0 Loading go-apps/meep-loc-serv/server/loc-serv.go +63 −0 Original line number Diff line number Diff line Loading @@ -582,6 +582,25 @@ func usersGet(w http.ResponseWriter, r *http.Request) { userData.queryApId = q["accessPointId"] userData.queryAddress = q["address"] validQueryParams := []string{"zoneId", "accessPointId", "address"} //look for all query parameters to reject if any invalid ones found := false for queryParam := range q { found = false for _, validQueryParam := range validQueryParams { if queryParam == validQueryParam { found = true break } } if !found { log.Error("Query param not valid: ", queryParam) w.WriteHeader(http.StatusBadRequest) return } } // Get user list from DB var response InlineUserList var userList UserList Loading Loading @@ -683,6 +702,25 @@ func apGet(w http.ResponseWriter, r *http.Request) { q := u.Query() userData.queryInterestRealm = q.Get("interestRealm") validQueryParams := []string{"interestRealm"} //look for all query parameters to reject if any invalid ones found := false for queryParam := range q { found = false for _, validQueryParam := range validQueryParams { if queryParam == validQueryParam { found = true break } } if !found { log.Error("Query param not valid: ", queryParam) w.WriteHeader(http.StatusBadRequest) return } } // Get user list from DB var response InlineAccessPointList var apList AccessPointList Loading @@ -691,6 +729,13 @@ func apGet(w http.ResponseWriter, r *http.Request) { response.AccessPointList = &apList userData.apList = &apList //make sure the zone exists first jsonZoneInfo, _ := rc.JSONGetEntry(baseKey+typeZone+":"+vars["zoneId"], ".") if jsonZoneInfo == "" { w.WriteHeader(http.StatusNotFound) return } keyName := baseKey + typeZone + ":" + vars["zoneId"] + ":*" err := rc.ForEachJSONEntry(keyName, populateApList, &userData) if err != nil { Loading Loading @@ -847,6 +892,12 @@ func userTrackingSubDelete(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json; charset=UTF-8") vars := mux.Vars(r) present, _ := rc.JSONGetEntry(baseKey+typeUserSubscription+":"+vars["subscriptionId"], ".") if present == "" { w.WriteHeader(http.StatusNotFound) return } err := rc.JSONDelEntry(baseKey+typeUserSubscription+":"+vars["subscriptionId"], ".") if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) Loading Loading @@ -1068,6 +1119,12 @@ func zonalTrafficSubDelete(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json; charset=UTF-8") vars := mux.Vars(r) present, _ := rc.JSONGetEntry(baseKey+typeZonalSubscription+":"+vars["subscriptionId"], ".") if present == "" { w.WriteHeader(http.StatusNotFound) return } err := rc.JSONDelEntry(baseKey+typeZonalSubscription+":"+vars["subscriptionId"], ".") if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) Loading Loading @@ -1300,6 +1357,12 @@ func zoneStatusSubDelete(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json; charset=UTF-8") vars := mux.Vars(r) present, _ := rc.JSONGetEntry(baseKey+typeZoneStatusSubscription+":"+vars["subscriptionId"], ".") if present == "" { w.WriteHeader(http.StatusNotFound) return } err := rc.JSONDelEntry(baseKey+typeZoneStatusSubscription+":"+vars["subscriptionId"], ".") if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) Loading go-apps/meep-loc-serv/server/loc-serv_test.go +30 −17 Original line number Diff line number Diff line Loading @@ -483,7 +483,7 @@ func TestZonalSuccessSubscription(t *testing.T) { testZonalSubscriptionGet(t, strconv.Itoa(nextZonalSubscriptionIdAvailable-1), expectedGetResp) //delete testZonalSubscriptionDelete(t, strconv.Itoa(nextZonalSubscriptionIdAvailable-1)) testZonalSubscriptionDelete(t, strconv.Itoa(nextZonalSubscriptionIdAvailable-1), true) terminateScenario() } Loading Loading @@ -513,7 +513,7 @@ func TestFailZonalSubscription(t *testing.T) { _ = testZonalSubscriptionPut(t, strconv.Itoa(nextZonalSubscriptionIdAvailable), false) //delete testZonalSubscriptionDelete(t, strconv.Itoa(nextZonalSubscriptionIdAvailable)) testZonalSubscriptionDelete(t, strconv.Itoa(nextZonalSubscriptionIdAvailable), false) terminateScenario() } Loading Loading @@ -543,7 +543,7 @@ func TestZonalSubscriptionsListGet(t *testing.T) { testZonalSubscriptionList(t) //delete testZonalSubscriptionDelete(t, strconv.Itoa(nextZonalSubscriptionIdAvailable-1)) testZonalSubscriptionDelete(t, strconv.Itoa(nextZonalSubscriptionIdAvailable-1), true) terminateScenario() } Loading Loading @@ -759,7 +759,7 @@ func testZonalSubscriptionGet(t *testing.T, subscriptionId string, expectedRespo } } func testZonalSubscriptionDelete(t *testing.T, subscriptionId string) { func testZonalSubscriptionDelete(t *testing.T, subscriptionId string, expectSuccess bool) { /****************************** * expected response section Loading @@ -782,8 +782,12 @@ func testZonalSubscriptionDelete(t *testing.T, subscriptionId string) { /****************************** * request execution section ******************************/ returnCode := http.StatusNoContent if !expectSuccess { returnCode = http.StatusNotFound } _, err := sendRequest(http.MethodDelete, "/subscriptions/zonalTraffic", nil, vars, nil, http.StatusNoContent, ZonalTrafficSubDELETE) _, err := sendRequest(http.MethodDelete, "/subscriptions/zonalTraffic", nil, vars, nil, returnCode, ZonalTrafficSubDELETE) if err != nil { t.Fatalf("Failed to get expected response") } Loading Loading @@ -820,7 +824,7 @@ func TestUserSuccessSubscription(t *testing.T) { testUserSubscriptionGet(t, strconv.Itoa(nextUserSubscriptionIdAvailable-1), expectedGetResp) //delete testUserSubscriptionDelete(t, strconv.Itoa(nextUserSubscriptionIdAvailable-1)) testUserSubscriptionDelete(t, strconv.Itoa(nextUserSubscriptionIdAvailable-1), true) terminateScenario() } Loading Loading @@ -850,7 +854,7 @@ func TestFailUserSubscription(t *testing.T) { _ = testUserSubscriptionPut(t, strconv.Itoa(nextUserSubscriptionIdAvailable), false) //delete testUserSubscriptionDelete(t, strconv.Itoa(nextUserSubscriptionIdAvailable)) testUserSubscriptionDelete(t, strconv.Itoa(nextUserSubscriptionIdAvailable), false) terminateScenario() } Loading Loading @@ -880,7 +884,7 @@ func TestUserSubscriptionsListGet(t *testing.T) { testUserSubscriptionList(t) //delete testUserSubscriptionDelete(t, strconv.Itoa(nextUserSubscriptionIdAvailable-1)) testUserSubscriptionDelete(t, strconv.Itoa(nextUserSubscriptionIdAvailable-1), true) terminateScenario() } Loading Loading @@ -1094,7 +1098,7 @@ func testUserSubscriptionGet(t *testing.T, subscriptionId string, expectedRespon } } func testUserSubscriptionDelete(t *testing.T, subscriptionId string) { func testUserSubscriptionDelete(t *testing.T, subscriptionId string, expectSuccess bool) { /****************************** * expected response section Loading @@ -1117,8 +1121,12 @@ func testUserSubscriptionDelete(t *testing.T, subscriptionId string) { /****************************** * request execution section ******************************/ returnCode := http.StatusNoContent if !expectSuccess { returnCode = http.StatusNotFound } _, err := sendRequest(http.MethodDelete, "/subscriptions/userTracking", nil, vars, nil, http.StatusNoContent, UserTrackingSubDELETE) _, err := sendRequest(http.MethodDelete, "/subscriptions/userTracking", nil, vars, nil, returnCode, UserTrackingSubDELETE) if err != nil { t.Fatalf("Failed to get expected response") } Loading Loading @@ -1155,7 +1163,7 @@ func TestZoneStatusSuccessSubscription(t *testing.T) { testZoneStatusSubscriptionGet(t, strconv.Itoa(nextZoneStatusSubscriptionIdAvailable-1), expectedGetResp) //delete testZoneStatusSubscriptionDelete(t, strconv.Itoa(nextZoneStatusSubscriptionIdAvailable-1)) testZoneStatusSubscriptionDelete(t, strconv.Itoa(nextZoneStatusSubscriptionIdAvailable-1), true) terminateScenario() } Loading Loading @@ -1185,7 +1193,7 @@ func TestFailZoneStatusSubscription(t *testing.T) { _ = testZoneStatusSubscriptionPut(t, strconv.Itoa(nextZoneStatusSubscriptionIdAvailable), false) //delete testZoneStatusSubscriptionDelete(t, strconv.Itoa(nextZoneStatusSubscriptionIdAvailable)) testZoneStatusSubscriptionDelete(t, strconv.Itoa(nextZoneStatusSubscriptionIdAvailable), false) terminateScenario() } Loading Loading @@ -1215,7 +1223,7 @@ func TestZoneStatusSubscriptionsListGet(t *testing.T) { testZoneStatusSubscriptionList(t) //delete testZoneStatusSubscriptionDelete(t, strconv.Itoa(nextZoneStatusSubscriptionIdAvailable-1)) testZoneStatusSubscriptionDelete(t, strconv.Itoa(nextZoneStatusSubscriptionIdAvailable-1), true) terminateScenario() } Loading Loading @@ -1432,7 +1440,7 @@ func testZoneStatusSubscriptionGet(t *testing.T, subscriptionId string, expected } } func testZoneStatusSubscriptionDelete(t *testing.T, subscriptionId string) { func testZoneStatusSubscriptionDelete(t *testing.T, subscriptionId string, expectSuccess bool) { /****************************** * expected response section Loading @@ -1455,8 +1463,12 @@ func testZoneStatusSubscriptionDelete(t *testing.T, subscriptionId string) { /****************************** * request execution section ******************************/ returnCode := http.StatusNoContent if !expectSuccess { returnCode = http.StatusNotFound } _, err := sendRequest(http.MethodDelete, "/subscriptions/zoneStatus", nil, vars, nil, http.StatusNoContent, ZoneStatusSubDELETE) _, err := sendRequest(http.MethodDelete, "/subscriptions/zoneStatus", nil, vars, nil, returnCode, ZoneStatusSubDELETE) if err != nil { t.Fatalf("Failed to get expected response") } Loading Loading @@ -1839,7 +1851,7 @@ func TestUserSubscriptionNotification(t *testing.T) { } //cleanup allocated subscription testUserSubscriptionDelete(t, strconv.Itoa(nextUserSubscriptionIdAvailable-1)) testUserSubscriptionDelete(t, strconv.Itoa(nextUserSubscriptionIdAvailable-1), true) /****************************** * back to initial state section Loading Loading @@ -1994,7 +2006,8 @@ func TestZoneSubscriptionNotification(t *testing.T) { } //cleanup allocated subscription testUserSubscriptionDelete(t, strconv.Itoa(nextUserSubscriptionIdAvailable-1)) testZonalSubscriptionDelete(t, strconv.Itoa(nextZonalSubscriptionIdAvailable-2), true) testZonalSubscriptionDelete(t, strconv.Itoa(nextZonalSubscriptionIdAvailable-1), true) /****************************** * back to initial state section Loading go-apps/meep-rnis/server/rnis.go +103 −0 Original line number Diff line number Diff line Loading @@ -144,6 +144,7 @@ type DomainData struct { } type PlmnInfoResp struct { AppInsId string PlmnInfoList []PlmnInfo } Loading Loading @@ -2397,7 +2398,32 @@ func plmnInfoGet(w http.ResponseWriter, r *http.Request) { //appInsId := q.Get("app_ins_id") //appInsIdArray := strings.Split(appInsId, ",") u, _ := url.Parse(r.URL.String()) q := u.Query() appInsId := q.Get("app_ins_id") validQueryParams := []string{"app_ins_id"} //look for all query parameters to reject if any invalid ones found := false for queryParam := range q { found = false for _, validQueryParam := range validQueryParams { if queryParam == validQueryParam { found = true break } } if !found { log.Error("Query param not valid: ", queryParam) w.WriteHeader(http.StatusBadRequest) return } } var response PlmnInfoResp response.AppInsId = appInsId atLeastOne := false //same for all plmnInfo Loading Loading @@ -2474,6 +2500,7 @@ func populatePlmnInfo(key string, jsonInfo string, response interface{}) error { return err } var plmnInfo PlmnInfo plmnInfo.AppInstanceId = resp.AppInsId var plmn Plmn plmn.Mnc = domainData.Mnc plmn.Mcc = domainData.Mcc Loading @@ -2496,6 +2523,25 @@ func layer2MeasInfoGet(w http.ResponseWriter, r *http.Request) { l2MeasData.queryCellIds = q["cell_id"] l2MeasData.queryIpv4Addresses = q["ue_ipv4_address"] validQueryParams := []string{"app_ins_id", "cell_id", "ue_ipv4_address", "ue_ipv6_address", "nated_ip_address", "gtp_teid", "dl_gbr_prb_usage_cell", "ul_gbr_prb_usage_cell", "dl_nongbr_prb_usage_cell", "ul_nongbr_prb_usage_cell", "dl_total_prb_usage_cell", "ul_total_prb_usage_cell", "received_dedicated_preambles_cell", "received_randomly_selected_preambles_low_range_cell", "received_randomly_selected_preambles_high_range_cell", "number_of_active_ue_dl_gbr_cell", "number_of_active_ue_ul_gbr_cell", "number_of_active_ue_dl_nongbr_cell", "number_of_active_ue_ul_nongbr_cell", "dl_gbr_pdr_cell", "ul_gbr_pdr_cell", "dl_nongbr_pdr_cell", "ul_nongbr_pdr_cell", "dl_gbr_delay_ue", "ul_gbr_delay_ue", "dl_nongbr_delay_ue", "ul_nongbr_delay_ue", "dl_gbr_pdr_ue", "ul_gbr_pdr_ue", "dl_nongbr_pdr_ue", "ul_nongbr_pdr_ue", "dl_gbr_throughput_ue", "ul_gbr_throughput_ue", "dl_nongbr_throughput_ue", "ul_nongbr_throughput_ue", "dl_gbr_data_volume_ue", "ul_gbr_data_volume_ue", "dl_nongbr_data_volume_ue", "ul_nongbr_data_volume_ue"} //look for all query parameters to reject if any invalid ones found := false for queryParam := range q { found = false for _, validQueryParam := range validQueryParams { if queryParam == validQueryParam { found = true break } } if !found { log.Error("Query param not valid: ", queryParam) w.WriteHeader(http.StatusBadRequest) return } } seconds := time.Now().Unix() var timeStamp TimeStamp timeStamp.Seconds = int32(seconds) Loading Loading @@ -2745,6 +2791,25 @@ func rabInfoGet(w http.ResponseWriter, r *http.Request) { rabInfoData.queryCellIds = q["cell_id"] rabInfoData.queryIpv4Addresses = q["ue_ipv4_address"] validQueryParams := []string{"app_ins_id", "cell_id", "ue_ipv4_address", "ue_ipv6_address", "nated_ip_address", "gtp_teid", "erab_id", "qci", "erab_mbr_dl", "erab_mbr_ul", "erab_gbr_dl", "erab_gbr_ul"} //look for all query parameters to reject if any invalid ones found := false for queryParam := range q { found = false for _, validQueryParam := range validQueryParams { if queryParam == validQueryParam { found = true break } } if !found { log.Error("Query param not valid: ", queryParam) w.WriteHeader(http.StatusBadRequest) return } } //same for all plmnInfo seconds := time.Now().Unix() var timeStamp TimeStamp Loading Loading @@ -2978,6 +3043,44 @@ func subscriptionLinkListSubscriptionsGet(w http.ResponseWriter, r *http.Request q := u.Query() subType := q.Get("subscription_type") validQueryParams := []string{"subscription_type"} validQueryParamValues := []string{"cell_change", "rab_est", "rab_mod", "rab_rel", "meas_rep_ue", "nr_meas_rep_ue", "timing_advance_ue", "ca_reconf", "s1_bearer"} //look for all query parameters to reject if any invalid ones found := false for queryParam, values := range q { found = false for _, validQueryParam := range validQueryParams { if queryParam == validQueryParam { found = true break } } if !found { log.Error("Query param not valid: ", queryParam) w.WriteHeader(http.StatusBadRequest) return } for _, validQueryParamValue := range validQueryParamValues { found = false for _, value := range values { if value == validQueryParamValue { found = true break } } if !found { break } } if !found { log.Error("Query param not valid: ", queryParam) w.WriteHeader(http.StatusBadRequest) return } } response := createSubscriptionLinkList(subType) jsonResponse, err := json.Marshal(response) Loading go-apps/meep-rnis/server/rnis_test.go +23 −45 Original line number Diff line number Diff line Loading @@ -2173,24 +2173,22 @@ func TestSbi(t *testing.T) { ueName := "ue1" appName := "zone1-edge1-iperf" poaName := "zone1-poa-cell1" poaNameAfter := "zone2-poa1" /****************************** * expected values section ******************************/ var expectedUeDataStr [2]string var expectedUeData [2]UeData expectedUeData[INITIAL] = UeData{ueName, 1, &Ecgi{"2345678", &Plmn{"123", "456"}}, &NRcgi{"", &Plmn{"123", "456"}}, 80, "", nil, nil} expectedUeData[UPDATED] = UeData{ueName, -1, &Ecgi{"", &Plmn{"123", "456"}}, &NRcgi{"", &Plmn{"123", "456"}}, 80, "", nil, nil} expectedAppNames := []string{"ue1-iperf"} expectedUeData[INITIAL] = UeData{ueName, 1, &Ecgi{"2345678", &Plmn{"123", "456"}}, &NRcgi{"", &Plmn{"123", "456"}}, 80, poaName, nil, expectedAppNames} expectedUeData[UPDATED] = UeData{ueName, -1, &Ecgi{"", &Plmn{"123", "456"}}, &NRcgi{"", &Plmn{"123", "456"}}, 80, poaNameAfter, nil, expectedAppNames} var expectedAppEcgiStr [2]string var expectedAppEcgi [2]Ecgi expectedAppEcgi[INITIAL] = Ecgi{"", &Plmn{"123", "456"}} expectedAppEcgi[UPDATED] = Ecgi{"", &Plmn{"123", "456"}} var expectedAppInfoStr string expectedAppInfo := AppInfo{"EDGE", "zone1-edge1"} var expectedPoaInfoStr [2]string var expectedPoaInfo [2]PoaInfo expectedPoaInfo[INITIAL] = PoaInfo{"POA-4G", Ecgi{"2345678", &Plmn{"123", "456"}}, NRcgi{"", nil}} expectedPoaInfo[UPDATED] = PoaInfo{"POA-4G", Ecgi{"2345678", &Plmn{"123", "456"}}, NRcgi{"", nil}} var expectedPoaInfoStr string expectedPoaInfo := PoaInfo{"POA-4G", Ecgi{"2345678", &Plmn{"123", "456"}}, NRcgi{"", nil}} j, err := json.Marshal(expectedUeData[INITIAL]) if err != nil { Loading @@ -2204,29 +2202,17 @@ func TestSbi(t *testing.T) { } expectedUeDataStr[UPDATED] = string(j) j, err = json.Marshal(expectedAppEcgi[INITIAL]) j, err = json.Marshal(expectedAppInfo) if err != nil { t.Fatalf(err.Error()) } expectedAppEcgiStr[INITIAL] = string(j) expectedAppInfoStr = string(j) j, err = json.Marshal(expectedAppEcgi[UPDATED]) j, err = json.Marshal(expectedPoaInfo) if err != nil { t.Fatalf(err.Error()) } expectedAppEcgiStr[UPDATED] = string(j) j, err = json.Marshal(expectedPoaInfo[INITIAL]) if err != nil { t.Fatalf(err.Error()) } expectedPoaInfoStr[INITIAL] = string(j) j, err = json.Marshal(expectedPoaInfo[UPDATED]) if err != nil { t.Fatalf(err.Error()) } expectedPoaInfoStr[UPDATED] = string(j) expectedPoaInfoStr = string(j) /****************************** * execution section Loading @@ -2235,36 +2221,28 @@ func TestSbi(t *testing.T) { fmt.Println("Set a scenario") initialiseScenario(testScenario) jsonEcgiInfo, _ := rc.JSONGetEntry(baseKey+"UE:"+ueName, ".") if string(jsonEcgiInfo) != expectedUeDataStr[INITIAL] { time.Sleep(1000 * time.Millisecond) jsonInfo, _ := rc.JSONGetEntry(baseKey+"UE:"+ueName, ".") if string(jsonInfo) != expectedUeDataStr[INITIAL] { t.Fatalf("Failed to get expected response") } jsonEcgiInfo, _ = rc.JSONGetEntry(baseKey+"APP:"+appName, ".") if string(jsonEcgiInfo) != expectedAppEcgiStr[INITIAL] { jsonInfo, _ = rc.JSONGetEntry(baseKey+"APP:"+appName, ".") if string(jsonInfo) != expectedAppInfoStr { t.Fatalf("Failed to get expected response") } jsonPoaInfo, _ := rc.JSONGetEntry(baseKey+"POA:"+poaName, ".") if string(jsonPoaInfo) != expectedPoaInfoStr[INITIAL] { jsonInfo, _ = rc.JSONGetEntry(baseKey+"POA:"+poaName, ".") if string(jsonInfo) != expectedPoaInfoStr { t.Fatalf("Failed to get expected response") } updateScenario("mobility1") time.Sleep(1000 * time.Millisecond) jsonEcgiInfo, _ = rc.JSONGetEntry(baseKey+"UE:"+ueName, ".") if string(jsonEcgiInfo) != expectedUeDataStr[UPDATED] { fmt.Println("TEST FAILED but commented out, TODO") //t.Fatalf("Failed to get expected response") } jsonEcgiInfo, _ = rc.JSONGetEntry(baseKey+"APP:"+appName, ".") if string(jsonEcgiInfo) != expectedAppEcgiStr[UPDATED] { t.Fatalf("Failed to get expected response") } jsonPoaInfo, _ = rc.JSONGetEntry(baseKey+"POA:"+poaName, ".") if string(jsonPoaInfo) != expectedPoaInfoStr[UPDATED] { jsonInfo, _ = rc.JSONGetEntry(baseKey+"UE:"+ueName, ".") if string(jsonInfo) != expectedUeDataStr[UPDATED] { t.Fatalf("Failed to get expected response") } Loading Loading
go-apps/meep-auth-svc/go.mod +0 −2 Original line number Diff line number Diff line Loading @@ -3,14 +3,12 @@ module github.com/InterDigitalInc/AdvantEDGE/go-apps/meep-auth-svc go 1.12 require ( github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-data-key-mgr v0.0.0 // indirect github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-data-model v0.0.0 github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-logger v0.0.0 github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-metric-store v0.0.0 github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-model v0.0.0 // indirect github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-mq v0.0.0 github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-platform-ctrl-client v0.0.0 github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-redis v0.0.0 // indirect github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-sandbox-store v0.0.0 // indirect github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-sessions v0.0.0 github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-users v0.0.0 Loading
go-apps/meep-loc-serv/server/loc-serv.go +63 −0 Original line number Diff line number Diff line Loading @@ -582,6 +582,25 @@ func usersGet(w http.ResponseWriter, r *http.Request) { userData.queryApId = q["accessPointId"] userData.queryAddress = q["address"] validQueryParams := []string{"zoneId", "accessPointId", "address"} //look for all query parameters to reject if any invalid ones found := false for queryParam := range q { found = false for _, validQueryParam := range validQueryParams { if queryParam == validQueryParam { found = true break } } if !found { log.Error("Query param not valid: ", queryParam) w.WriteHeader(http.StatusBadRequest) return } } // Get user list from DB var response InlineUserList var userList UserList Loading Loading @@ -683,6 +702,25 @@ func apGet(w http.ResponseWriter, r *http.Request) { q := u.Query() userData.queryInterestRealm = q.Get("interestRealm") validQueryParams := []string{"interestRealm"} //look for all query parameters to reject if any invalid ones found := false for queryParam := range q { found = false for _, validQueryParam := range validQueryParams { if queryParam == validQueryParam { found = true break } } if !found { log.Error("Query param not valid: ", queryParam) w.WriteHeader(http.StatusBadRequest) return } } // Get user list from DB var response InlineAccessPointList var apList AccessPointList Loading @@ -691,6 +729,13 @@ func apGet(w http.ResponseWriter, r *http.Request) { response.AccessPointList = &apList userData.apList = &apList //make sure the zone exists first jsonZoneInfo, _ := rc.JSONGetEntry(baseKey+typeZone+":"+vars["zoneId"], ".") if jsonZoneInfo == "" { w.WriteHeader(http.StatusNotFound) return } keyName := baseKey + typeZone + ":" + vars["zoneId"] + ":*" err := rc.ForEachJSONEntry(keyName, populateApList, &userData) if err != nil { Loading Loading @@ -847,6 +892,12 @@ func userTrackingSubDelete(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json; charset=UTF-8") vars := mux.Vars(r) present, _ := rc.JSONGetEntry(baseKey+typeUserSubscription+":"+vars["subscriptionId"], ".") if present == "" { w.WriteHeader(http.StatusNotFound) return } err := rc.JSONDelEntry(baseKey+typeUserSubscription+":"+vars["subscriptionId"], ".") if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) Loading Loading @@ -1068,6 +1119,12 @@ func zonalTrafficSubDelete(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json; charset=UTF-8") vars := mux.Vars(r) present, _ := rc.JSONGetEntry(baseKey+typeZonalSubscription+":"+vars["subscriptionId"], ".") if present == "" { w.WriteHeader(http.StatusNotFound) return } err := rc.JSONDelEntry(baseKey+typeZonalSubscription+":"+vars["subscriptionId"], ".") if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) Loading Loading @@ -1300,6 +1357,12 @@ func zoneStatusSubDelete(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json; charset=UTF-8") vars := mux.Vars(r) present, _ := rc.JSONGetEntry(baseKey+typeZoneStatusSubscription+":"+vars["subscriptionId"], ".") if present == "" { w.WriteHeader(http.StatusNotFound) return } err := rc.JSONDelEntry(baseKey+typeZoneStatusSubscription+":"+vars["subscriptionId"], ".") if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) Loading
go-apps/meep-loc-serv/server/loc-serv_test.go +30 −17 Original line number Diff line number Diff line Loading @@ -483,7 +483,7 @@ func TestZonalSuccessSubscription(t *testing.T) { testZonalSubscriptionGet(t, strconv.Itoa(nextZonalSubscriptionIdAvailable-1), expectedGetResp) //delete testZonalSubscriptionDelete(t, strconv.Itoa(nextZonalSubscriptionIdAvailable-1)) testZonalSubscriptionDelete(t, strconv.Itoa(nextZonalSubscriptionIdAvailable-1), true) terminateScenario() } Loading Loading @@ -513,7 +513,7 @@ func TestFailZonalSubscription(t *testing.T) { _ = testZonalSubscriptionPut(t, strconv.Itoa(nextZonalSubscriptionIdAvailable), false) //delete testZonalSubscriptionDelete(t, strconv.Itoa(nextZonalSubscriptionIdAvailable)) testZonalSubscriptionDelete(t, strconv.Itoa(nextZonalSubscriptionIdAvailable), false) terminateScenario() } Loading Loading @@ -543,7 +543,7 @@ func TestZonalSubscriptionsListGet(t *testing.T) { testZonalSubscriptionList(t) //delete testZonalSubscriptionDelete(t, strconv.Itoa(nextZonalSubscriptionIdAvailable-1)) testZonalSubscriptionDelete(t, strconv.Itoa(nextZonalSubscriptionIdAvailable-1), true) terminateScenario() } Loading Loading @@ -759,7 +759,7 @@ func testZonalSubscriptionGet(t *testing.T, subscriptionId string, expectedRespo } } func testZonalSubscriptionDelete(t *testing.T, subscriptionId string) { func testZonalSubscriptionDelete(t *testing.T, subscriptionId string, expectSuccess bool) { /****************************** * expected response section Loading @@ -782,8 +782,12 @@ func testZonalSubscriptionDelete(t *testing.T, subscriptionId string) { /****************************** * request execution section ******************************/ returnCode := http.StatusNoContent if !expectSuccess { returnCode = http.StatusNotFound } _, err := sendRequest(http.MethodDelete, "/subscriptions/zonalTraffic", nil, vars, nil, http.StatusNoContent, ZonalTrafficSubDELETE) _, err := sendRequest(http.MethodDelete, "/subscriptions/zonalTraffic", nil, vars, nil, returnCode, ZonalTrafficSubDELETE) if err != nil { t.Fatalf("Failed to get expected response") } Loading Loading @@ -820,7 +824,7 @@ func TestUserSuccessSubscription(t *testing.T) { testUserSubscriptionGet(t, strconv.Itoa(nextUserSubscriptionIdAvailable-1), expectedGetResp) //delete testUserSubscriptionDelete(t, strconv.Itoa(nextUserSubscriptionIdAvailable-1)) testUserSubscriptionDelete(t, strconv.Itoa(nextUserSubscriptionIdAvailable-1), true) terminateScenario() } Loading Loading @@ -850,7 +854,7 @@ func TestFailUserSubscription(t *testing.T) { _ = testUserSubscriptionPut(t, strconv.Itoa(nextUserSubscriptionIdAvailable), false) //delete testUserSubscriptionDelete(t, strconv.Itoa(nextUserSubscriptionIdAvailable)) testUserSubscriptionDelete(t, strconv.Itoa(nextUserSubscriptionIdAvailable), false) terminateScenario() } Loading Loading @@ -880,7 +884,7 @@ func TestUserSubscriptionsListGet(t *testing.T) { testUserSubscriptionList(t) //delete testUserSubscriptionDelete(t, strconv.Itoa(nextUserSubscriptionIdAvailable-1)) testUserSubscriptionDelete(t, strconv.Itoa(nextUserSubscriptionIdAvailable-1), true) terminateScenario() } Loading Loading @@ -1094,7 +1098,7 @@ func testUserSubscriptionGet(t *testing.T, subscriptionId string, expectedRespon } } func testUserSubscriptionDelete(t *testing.T, subscriptionId string) { func testUserSubscriptionDelete(t *testing.T, subscriptionId string, expectSuccess bool) { /****************************** * expected response section Loading @@ -1117,8 +1121,12 @@ func testUserSubscriptionDelete(t *testing.T, subscriptionId string) { /****************************** * request execution section ******************************/ returnCode := http.StatusNoContent if !expectSuccess { returnCode = http.StatusNotFound } _, err := sendRequest(http.MethodDelete, "/subscriptions/userTracking", nil, vars, nil, http.StatusNoContent, UserTrackingSubDELETE) _, err := sendRequest(http.MethodDelete, "/subscriptions/userTracking", nil, vars, nil, returnCode, UserTrackingSubDELETE) if err != nil { t.Fatalf("Failed to get expected response") } Loading Loading @@ -1155,7 +1163,7 @@ func TestZoneStatusSuccessSubscription(t *testing.T) { testZoneStatusSubscriptionGet(t, strconv.Itoa(nextZoneStatusSubscriptionIdAvailable-1), expectedGetResp) //delete testZoneStatusSubscriptionDelete(t, strconv.Itoa(nextZoneStatusSubscriptionIdAvailable-1)) testZoneStatusSubscriptionDelete(t, strconv.Itoa(nextZoneStatusSubscriptionIdAvailable-1), true) terminateScenario() } Loading Loading @@ -1185,7 +1193,7 @@ func TestFailZoneStatusSubscription(t *testing.T) { _ = testZoneStatusSubscriptionPut(t, strconv.Itoa(nextZoneStatusSubscriptionIdAvailable), false) //delete testZoneStatusSubscriptionDelete(t, strconv.Itoa(nextZoneStatusSubscriptionIdAvailable)) testZoneStatusSubscriptionDelete(t, strconv.Itoa(nextZoneStatusSubscriptionIdAvailable), false) terminateScenario() } Loading Loading @@ -1215,7 +1223,7 @@ func TestZoneStatusSubscriptionsListGet(t *testing.T) { testZoneStatusSubscriptionList(t) //delete testZoneStatusSubscriptionDelete(t, strconv.Itoa(nextZoneStatusSubscriptionIdAvailable-1)) testZoneStatusSubscriptionDelete(t, strconv.Itoa(nextZoneStatusSubscriptionIdAvailable-1), true) terminateScenario() } Loading Loading @@ -1432,7 +1440,7 @@ func testZoneStatusSubscriptionGet(t *testing.T, subscriptionId string, expected } } func testZoneStatusSubscriptionDelete(t *testing.T, subscriptionId string) { func testZoneStatusSubscriptionDelete(t *testing.T, subscriptionId string, expectSuccess bool) { /****************************** * expected response section Loading @@ -1455,8 +1463,12 @@ func testZoneStatusSubscriptionDelete(t *testing.T, subscriptionId string) { /****************************** * request execution section ******************************/ returnCode := http.StatusNoContent if !expectSuccess { returnCode = http.StatusNotFound } _, err := sendRequest(http.MethodDelete, "/subscriptions/zoneStatus", nil, vars, nil, http.StatusNoContent, ZoneStatusSubDELETE) _, err := sendRequest(http.MethodDelete, "/subscriptions/zoneStatus", nil, vars, nil, returnCode, ZoneStatusSubDELETE) if err != nil { t.Fatalf("Failed to get expected response") } Loading Loading @@ -1839,7 +1851,7 @@ func TestUserSubscriptionNotification(t *testing.T) { } //cleanup allocated subscription testUserSubscriptionDelete(t, strconv.Itoa(nextUserSubscriptionIdAvailable-1)) testUserSubscriptionDelete(t, strconv.Itoa(nextUserSubscriptionIdAvailable-1), true) /****************************** * back to initial state section Loading Loading @@ -1994,7 +2006,8 @@ func TestZoneSubscriptionNotification(t *testing.T) { } //cleanup allocated subscription testUserSubscriptionDelete(t, strconv.Itoa(nextUserSubscriptionIdAvailable-1)) testZonalSubscriptionDelete(t, strconv.Itoa(nextZonalSubscriptionIdAvailable-2), true) testZonalSubscriptionDelete(t, strconv.Itoa(nextZonalSubscriptionIdAvailable-1), true) /****************************** * back to initial state section Loading
go-apps/meep-rnis/server/rnis.go +103 −0 Original line number Diff line number Diff line Loading @@ -144,6 +144,7 @@ type DomainData struct { } type PlmnInfoResp struct { AppInsId string PlmnInfoList []PlmnInfo } Loading Loading @@ -2397,7 +2398,32 @@ func plmnInfoGet(w http.ResponseWriter, r *http.Request) { //appInsId := q.Get("app_ins_id") //appInsIdArray := strings.Split(appInsId, ",") u, _ := url.Parse(r.URL.String()) q := u.Query() appInsId := q.Get("app_ins_id") validQueryParams := []string{"app_ins_id"} //look for all query parameters to reject if any invalid ones found := false for queryParam := range q { found = false for _, validQueryParam := range validQueryParams { if queryParam == validQueryParam { found = true break } } if !found { log.Error("Query param not valid: ", queryParam) w.WriteHeader(http.StatusBadRequest) return } } var response PlmnInfoResp response.AppInsId = appInsId atLeastOne := false //same for all plmnInfo Loading Loading @@ -2474,6 +2500,7 @@ func populatePlmnInfo(key string, jsonInfo string, response interface{}) error { return err } var plmnInfo PlmnInfo plmnInfo.AppInstanceId = resp.AppInsId var plmn Plmn plmn.Mnc = domainData.Mnc plmn.Mcc = domainData.Mcc Loading @@ -2496,6 +2523,25 @@ func layer2MeasInfoGet(w http.ResponseWriter, r *http.Request) { l2MeasData.queryCellIds = q["cell_id"] l2MeasData.queryIpv4Addresses = q["ue_ipv4_address"] validQueryParams := []string{"app_ins_id", "cell_id", "ue_ipv4_address", "ue_ipv6_address", "nated_ip_address", "gtp_teid", "dl_gbr_prb_usage_cell", "ul_gbr_prb_usage_cell", "dl_nongbr_prb_usage_cell", "ul_nongbr_prb_usage_cell", "dl_total_prb_usage_cell", "ul_total_prb_usage_cell", "received_dedicated_preambles_cell", "received_randomly_selected_preambles_low_range_cell", "received_randomly_selected_preambles_high_range_cell", "number_of_active_ue_dl_gbr_cell", "number_of_active_ue_ul_gbr_cell", "number_of_active_ue_dl_nongbr_cell", "number_of_active_ue_ul_nongbr_cell", "dl_gbr_pdr_cell", "ul_gbr_pdr_cell", "dl_nongbr_pdr_cell", "ul_nongbr_pdr_cell", "dl_gbr_delay_ue", "ul_gbr_delay_ue", "dl_nongbr_delay_ue", "ul_nongbr_delay_ue", "dl_gbr_pdr_ue", "ul_gbr_pdr_ue", "dl_nongbr_pdr_ue", "ul_nongbr_pdr_ue", "dl_gbr_throughput_ue", "ul_gbr_throughput_ue", "dl_nongbr_throughput_ue", "ul_nongbr_throughput_ue", "dl_gbr_data_volume_ue", "ul_gbr_data_volume_ue", "dl_nongbr_data_volume_ue", "ul_nongbr_data_volume_ue"} //look for all query parameters to reject if any invalid ones found := false for queryParam := range q { found = false for _, validQueryParam := range validQueryParams { if queryParam == validQueryParam { found = true break } } if !found { log.Error("Query param not valid: ", queryParam) w.WriteHeader(http.StatusBadRequest) return } } seconds := time.Now().Unix() var timeStamp TimeStamp timeStamp.Seconds = int32(seconds) Loading Loading @@ -2745,6 +2791,25 @@ func rabInfoGet(w http.ResponseWriter, r *http.Request) { rabInfoData.queryCellIds = q["cell_id"] rabInfoData.queryIpv4Addresses = q["ue_ipv4_address"] validQueryParams := []string{"app_ins_id", "cell_id", "ue_ipv4_address", "ue_ipv6_address", "nated_ip_address", "gtp_teid", "erab_id", "qci", "erab_mbr_dl", "erab_mbr_ul", "erab_gbr_dl", "erab_gbr_ul"} //look for all query parameters to reject if any invalid ones found := false for queryParam := range q { found = false for _, validQueryParam := range validQueryParams { if queryParam == validQueryParam { found = true break } } if !found { log.Error("Query param not valid: ", queryParam) w.WriteHeader(http.StatusBadRequest) return } } //same for all plmnInfo seconds := time.Now().Unix() var timeStamp TimeStamp Loading Loading @@ -2978,6 +3043,44 @@ func subscriptionLinkListSubscriptionsGet(w http.ResponseWriter, r *http.Request q := u.Query() subType := q.Get("subscription_type") validQueryParams := []string{"subscription_type"} validQueryParamValues := []string{"cell_change", "rab_est", "rab_mod", "rab_rel", "meas_rep_ue", "nr_meas_rep_ue", "timing_advance_ue", "ca_reconf", "s1_bearer"} //look for all query parameters to reject if any invalid ones found := false for queryParam, values := range q { found = false for _, validQueryParam := range validQueryParams { if queryParam == validQueryParam { found = true break } } if !found { log.Error("Query param not valid: ", queryParam) w.WriteHeader(http.StatusBadRequest) return } for _, validQueryParamValue := range validQueryParamValues { found = false for _, value := range values { if value == validQueryParamValue { found = true break } } if !found { break } } if !found { log.Error("Query param not valid: ", queryParam) w.WriteHeader(http.StatusBadRequest) return } } response := createSubscriptionLinkList(subType) jsonResponse, err := json.Marshal(response) Loading
go-apps/meep-rnis/server/rnis_test.go +23 −45 Original line number Diff line number Diff line Loading @@ -2173,24 +2173,22 @@ func TestSbi(t *testing.T) { ueName := "ue1" appName := "zone1-edge1-iperf" poaName := "zone1-poa-cell1" poaNameAfter := "zone2-poa1" /****************************** * expected values section ******************************/ var expectedUeDataStr [2]string var expectedUeData [2]UeData expectedUeData[INITIAL] = UeData{ueName, 1, &Ecgi{"2345678", &Plmn{"123", "456"}}, &NRcgi{"", &Plmn{"123", "456"}}, 80, "", nil, nil} expectedUeData[UPDATED] = UeData{ueName, -1, &Ecgi{"", &Plmn{"123", "456"}}, &NRcgi{"", &Plmn{"123", "456"}}, 80, "", nil, nil} expectedAppNames := []string{"ue1-iperf"} expectedUeData[INITIAL] = UeData{ueName, 1, &Ecgi{"2345678", &Plmn{"123", "456"}}, &NRcgi{"", &Plmn{"123", "456"}}, 80, poaName, nil, expectedAppNames} expectedUeData[UPDATED] = UeData{ueName, -1, &Ecgi{"", &Plmn{"123", "456"}}, &NRcgi{"", &Plmn{"123", "456"}}, 80, poaNameAfter, nil, expectedAppNames} var expectedAppEcgiStr [2]string var expectedAppEcgi [2]Ecgi expectedAppEcgi[INITIAL] = Ecgi{"", &Plmn{"123", "456"}} expectedAppEcgi[UPDATED] = Ecgi{"", &Plmn{"123", "456"}} var expectedAppInfoStr string expectedAppInfo := AppInfo{"EDGE", "zone1-edge1"} var expectedPoaInfoStr [2]string var expectedPoaInfo [2]PoaInfo expectedPoaInfo[INITIAL] = PoaInfo{"POA-4G", Ecgi{"2345678", &Plmn{"123", "456"}}, NRcgi{"", nil}} expectedPoaInfo[UPDATED] = PoaInfo{"POA-4G", Ecgi{"2345678", &Plmn{"123", "456"}}, NRcgi{"", nil}} var expectedPoaInfoStr string expectedPoaInfo := PoaInfo{"POA-4G", Ecgi{"2345678", &Plmn{"123", "456"}}, NRcgi{"", nil}} j, err := json.Marshal(expectedUeData[INITIAL]) if err != nil { Loading @@ -2204,29 +2202,17 @@ func TestSbi(t *testing.T) { } expectedUeDataStr[UPDATED] = string(j) j, err = json.Marshal(expectedAppEcgi[INITIAL]) j, err = json.Marshal(expectedAppInfo) if err != nil { t.Fatalf(err.Error()) } expectedAppEcgiStr[INITIAL] = string(j) expectedAppInfoStr = string(j) j, err = json.Marshal(expectedAppEcgi[UPDATED]) j, err = json.Marshal(expectedPoaInfo) if err != nil { t.Fatalf(err.Error()) } expectedAppEcgiStr[UPDATED] = string(j) j, err = json.Marshal(expectedPoaInfo[INITIAL]) if err != nil { t.Fatalf(err.Error()) } expectedPoaInfoStr[INITIAL] = string(j) j, err = json.Marshal(expectedPoaInfo[UPDATED]) if err != nil { t.Fatalf(err.Error()) } expectedPoaInfoStr[UPDATED] = string(j) expectedPoaInfoStr = string(j) /****************************** * execution section Loading @@ -2235,36 +2221,28 @@ func TestSbi(t *testing.T) { fmt.Println("Set a scenario") initialiseScenario(testScenario) jsonEcgiInfo, _ := rc.JSONGetEntry(baseKey+"UE:"+ueName, ".") if string(jsonEcgiInfo) != expectedUeDataStr[INITIAL] { time.Sleep(1000 * time.Millisecond) jsonInfo, _ := rc.JSONGetEntry(baseKey+"UE:"+ueName, ".") if string(jsonInfo) != expectedUeDataStr[INITIAL] { t.Fatalf("Failed to get expected response") } jsonEcgiInfo, _ = rc.JSONGetEntry(baseKey+"APP:"+appName, ".") if string(jsonEcgiInfo) != expectedAppEcgiStr[INITIAL] { jsonInfo, _ = rc.JSONGetEntry(baseKey+"APP:"+appName, ".") if string(jsonInfo) != expectedAppInfoStr { t.Fatalf("Failed to get expected response") } jsonPoaInfo, _ := rc.JSONGetEntry(baseKey+"POA:"+poaName, ".") if string(jsonPoaInfo) != expectedPoaInfoStr[INITIAL] { jsonInfo, _ = rc.JSONGetEntry(baseKey+"POA:"+poaName, ".") if string(jsonInfo) != expectedPoaInfoStr { t.Fatalf("Failed to get expected response") } updateScenario("mobility1") time.Sleep(1000 * time.Millisecond) jsonEcgiInfo, _ = rc.JSONGetEntry(baseKey+"UE:"+ueName, ".") if string(jsonEcgiInfo) != expectedUeDataStr[UPDATED] { fmt.Println("TEST FAILED but commented out, TODO") //t.Fatalf("Failed to get expected response") } jsonEcgiInfo, _ = rc.JSONGetEntry(baseKey+"APP:"+appName, ".") if string(jsonEcgiInfo) != expectedAppEcgiStr[UPDATED] { t.Fatalf("Failed to get expected response") } jsonPoaInfo, _ = rc.JSONGetEntry(baseKey+"POA:"+poaName, ".") if string(jsonPoaInfo) != expectedPoaInfoStr[UPDATED] { jsonInfo, _ = rc.JSONGetEntry(baseKey+"UE:"+ueName, ".") if string(jsonInfo) != expectedUeDataStr[UPDATED] { t.Fatalf("Failed to get expected response") } Loading