Loading go-apps/meep-app-enablement/server/app-support/app-support.go +2 −2 Original line number Diff line number Diff line Loading @@ -681,7 +681,7 @@ func appRegistrationPOST(w http.ResponseWriter, r *http.Request) { return } if appInfo.IsInsByMec == false && appInfo.Endpoint == nil { if !appInfo.IsInsByMec && appInfo.Endpoint == nil { log.Error("Shall be present when IsInsByMec is FALSE") errHandlerProblemDetails(w, "Endpoint shall be present when IsInsByMec is FALSE.", http.StatusBadRequest) return Loading Loading @@ -827,7 +827,7 @@ func appRegistrationPUT(w http.ResponseWriter, r *http.Request) { return } if appInfoPut.IsInsByMec == false && appInfoPut.Endpoint == nil { if !appInfoPut.IsInsByMec && appInfoPut.Endpoint == nil { log.Error("Shall be present when IsInsByMec is FALSE") errHandlerProblemDetails(w, "Shall be present when IsInsByMec is FALSE.", http.StatusBadRequest) return Loading go-apps/meep-app-enablement/server/mae_test.go +2 −2 Original line number Diff line number Diff line Loading @@ -6444,7 +6444,7 @@ func testSubscriptionPost(t *testing.T, appInstanceId string, requestTestNotific /****************************** * Comparing responses ******************************/ if validateAppTerminationNotificationSubscription(respBody, expected_appTermNotifSub) == false { if !validateAppTerminationNotificationSubscription(respBody, expected_appTermNotifSub) { t.Fatalf("Failed to get expected response") } Loading Loading @@ -7255,7 +7255,7 @@ func validateAppInfo(received as.AppInfo, expected as.AppInfo) bool { fmt.Println("validateAppInfo: AppInfo.IsInsByMec mismatch") return false } if received.IsInsByMec == false && received.Endpoint == nil { if !received.IsInsByMec && received.Endpoint == nil { fmt.Println("validateAppInfo: Endpoint shall be present when IsInsByMec is FALSE") return false } Loading go-apps/meep-app-enablement/server/service-mgmt/convert.go +9 −0 Original line number Diff line number Diff line Loading @@ -78,6 +78,15 @@ func convertProblemDetailsToJson(obj *ProblemDetails) string { return string(jsonInfo) } func convertSubscriptionLinkListToJson(obj *SubscriptionLinkList) string { jsonInfo, err := json.Marshal(*obj) if err != nil { log.Error(err.Error()) return "" } return string(jsonInfo) } func convertMecServiceMgmtApiSubscriptionLinkListToJson(obj *MecServiceMgmtApiSubscriptionLinkList) string { jsonInfo, err := json.Marshal(*obj) if err != nil { Loading go-apps/meep-app-enablement/server/service-mgmt/service-mgmt.go +30 −10 Original line number Diff line number Diff line Loading @@ -27,7 +27,6 @@ import ( "sync" "time" as "github.com/InterDigitalInc/AdvantEDGE/go-apps/meep-app-enablement/server/app-support" dkm "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-data-key-mgr" log "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-logger" mq "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-mq" Loading Loading @@ -731,9 +730,26 @@ func applicationsSubscriptionGET(w http.ResponseWriter, r *http.Request) { return } // Return original marshalled subscription // Create subscription link list subscriptionLinkList := &MecServiceMgmtApiSubscriptionLinkList{ Links: &MecServiceMgmtApiSubscriptionLinkListLinks{ Self: &LinkType{ Href: hostUrl.String() + basePath + "applications/" + appId + "/subscriptions", }, }, } // Create subscription reference & append it to link list subscription := MecServiceMgmtApiSubscriptionLinkListSubscription{ Rel: SER_AVAILABILITY_NOTIF_SUB_TYPE, Href: sub.Cfg.Self, } subscriptionLinkList.Links.Subscriptions = append(subscriptionLinkList.Links.Subscriptions, subscription) // Send response w.WriteHeader(http.StatusOK) fmt.Fprintf(w, sub.JsonSubOrig) fmt.Fprint(w, convertMecServiceMgmtApiSubscriptionLinkListToJson(subscriptionLinkList)) } func applicationsSubscriptionDELETE(w http.ResponseWriter, r *http.Request) { Loading Loading @@ -794,6 +810,8 @@ func applicationsSubscriptionDELETE(w http.ResponseWriter, r *http.Request) { } func applicationsSubscriptionsGET(w http.ResponseWriter, r *http.Request) { log.Info("applicationsSubscriptionsGET") w.Header().Set("Content-Type", "application/json; charset=UTF-8") vars := mux.Vars(r) appId := vars["appInstanceId"] Loading Loading @@ -829,9 +847,9 @@ func applicationsSubscriptionsGET(w http.ResponseWriter, r *http.Request) { } // Create subscription link list subscriptionLinkList := &as.SubscriptionLinkList{ Links: &as.SubscriptionLinkListLinks{ Self: &as.LinkType{ subscriptionLinkList := &SubscriptionLinkList{ Links: &SubscriptionLinkListLinks{ Self: &LinkType{ Href: hostUrl.String() + basePath + "applications/" + appId + "/subscriptions", }, }, Loading @@ -839,22 +857,24 @@ func applicationsSubscriptionsGET(w http.ResponseWriter, r *http.Request) { for _, sub := range subList { // Create subscription reference & append it to link list subscription := as.SubscriptionLinkListSubscription{ subscription := SubscriptionLinkListLinksSubscriptions{ // In v2.1.1 it should be SubscriptionType, but spec is expecting "rel" as per v1.1.1 SubscriptionType: SER_AVAILABILITY_NOTIF_SUB_TYPE, Href: sub.Cfg.Self, SubscriptionType: &sub.Cfg.Type, } subscriptionLinkList.Links.Subscriptions = append(subscriptionLinkList.Links.Subscriptions, subscription) } // Send response w.WriteHeader(http.StatusOK) fmt.Fprint(w, convertMecServiceMgmtApiSubscriptionLinkListToJson(subscriptionLinkList)) fmt.Fprint(w, convertSubscriptionLinkListToJson(subscriptionLinkList)) } func getIndividualMECService(w http.ResponseWriter, r *http.Request) { log.Info("getIndividualMECService") w.Header().Set("Content-Type", "application/json; charset=UTF-8") // FIXME FSCOM TODO // Send response w.WriteHeader(http.StatusOK) } Loading Loading
go-apps/meep-app-enablement/server/app-support/app-support.go +2 −2 Original line number Diff line number Diff line Loading @@ -681,7 +681,7 @@ func appRegistrationPOST(w http.ResponseWriter, r *http.Request) { return } if appInfo.IsInsByMec == false && appInfo.Endpoint == nil { if !appInfo.IsInsByMec && appInfo.Endpoint == nil { log.Error("Shall be present when IsInsByMec is FALSE") errHandlerProblemDetails(w, "Endpoint shall be present when IsInsByMec is FALSE.", http.StatusBadRequest) return Loading Loading @@ -827,7 +827,7 @@ func appRegistrationPUT(w http.ResponseWriter, r *http.Request) { return } if appInfoPut.IsInsByMec == false && appInfoPut.Endpoint == nil { if !appInfoPut.IsInsByMec && appInfoPut.Endpoint == nil { log.Error("Shall be present when IsInsByMec is FALSE") errHandlerProblemDetails(w, "Shall be present when IsInsByMec is FALSE.", http.StatusBadRequest) return Loading
go-apps/meep-app-enablement/server/mae_test.go +2 −2 Original line number Diff line number Diff line Loading @@ -6444,7 +6444,7 @@ func testSubscriptionPost(t *testing.T, appInstanceId string, requestTestNotific /****************************** * Comparing responses ******************************/ if validateAppTerminationNotificationSubscription(respBody, expected_appTermNotifSub) == false { if !validateAppTerminationNotificationSubscription(respBody, expected_appTermNotifSub) { t.Fatalf("Failed to get expected response") } Loading Loading @@ -7255,7 +7255,7 @@ func validateAppInfo(received as.AppInfo, expected as.AppInfo) bool { fmt.Println("validateAppInfo: AppInfo.IsInsByMec mismatch") return false } if received.IsInsByMec == false && received.Endpoint == nil { if !received.IsInsByMec && received.Endpoint == nil { fmt.Println("validateAppInfo: Endpoint shall be present when IsInsByMec is FALSE") return false } Loading
go-apps/meep-app-enablement/server/service-mgmt/convert.go +9 −0 Original line number Diff line number Diff line Loading @@ -78,6 +78,15 @@ func convertProblemDetailsToJson(obj *ProblemDetails) string { return string(jsonInfo) } func convertSubscriptionLinkListToJson(obj *SubscriptionLinkList) string { jsonInfo, err := json.Marshal(*obj) if err != nil { log.Error(err.Error()) return "" } return string(jsonInfo) } func convertMecServiceMgmtApiSubscriptionLinkListToJson(obj *MecServiceMgmtApiSubscriptionLinkList) string { jsonInfo, err := json.Marshal(*obj) if err != nil { Loading
go-apps/meep-app-enablement/server/service-mgmt/service-mgmt.go +30 −10 Original line number Diff line number Diff line Loading @@ -27,7 +27,6 @@ import ( "sync" "time" as "github.com/InterDigitalInc/AdvantEDGE/go-apps/meep-app-enablement/server/app-support" dkm "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-data-key-mgr" log "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-logger" mq "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-mq" Loading Loading @@ -731,9 +730,26 @@ func applicationsSubscriptionGET(w http.ResponseWriter, r *http.Request) { return } // Return original marshalled subscription // Create subscription link list subscriptionLinkList := &MecServiceMgmtApiSubscriptionLinkList{ Links: &MecServiceMgmtApiSubscriptionLinkListLinks{ Self: &LinkType{ Href: hostUrl.String() + basePath + "applications/" + appId + "/subscriptions", }, }, } // Create subscription reference & append it to link list subscription := MecServiceMgmtApiSubscriptionLinkListSubscription{ Rel: SER_AVAILABILITY_NOTIF_SUB_TYPE, Href: sub.Cfg.Self, } subscriptionLinkList.Links.Subscriptions = append(subscriptionLinkList.Links.Subscriptions, subscription) // Send response w.WriteHeader(http.StatusOK) fmt.Fprintf(w, sub.JsonSubOrig) fmt.Fprint(w, convertMecServiceMgmtApiSubscriptionLinkListToJson(subscriptionLinkList)) } func applicationsSubscriptionDELETE(w http.ResponseWriter, r *http.Request) { Loading Loading @@ -794,6 +810,8 @@ func applicationsSubscriptionDELETE(w http.ResponseWriter, r *http.Request) { } func applicationsSubscriptionsGET(w http.ResponseWriter, r *http.Request) { log.Info("applicationsSubscriptionsGET") w.Header().Set("Content-Type", "application/json; charset=UTF-8") vars := mux.Vars(r) appId := vars["appInstanceId"] Loading Loading @@ -829,9 +847,9 @@ func applicationsSubscriptionsGET(w http.ResponseWriter, r *http.Request) { } // Create subscription link list subscriptionLinkList := &as.SubscriptionLinkList{ Links: &as.SubscriptionLinkListLinks{ Self: &as.LinkType{ subscriptionLinkList := &SubscriptionLinkList{ Links: &SubscriptionLinkListLinks{ Self: &LinkType{ Href: hostUrl.String() + basePath + "applications/" + appId + "/subscriptions", }, }, Loading @@ -839,22 +857,24 @@ func applicationsSubscriptionsGET(w http.ResponseWriter, r *http.Request) { for _, sub := range subList { // Create subscription reference & append it to link list subscription := as.SubscriptionLinkListSubscription{ subscription := SubscriptionLinkListLinksSubscriptions{ // In v2.1.1 it should be SubscriptionType, but spec is expecting "rel" as per v1.1.1 SubscriptionType: SER_AVAILABILITY_NOTIF_SUB_TYPE, Href: sub.Cfg.Self, SubscriptionType: &sub.Cfg.Type, } subscriptionLinkList.Links.Subscriptions = append(subscriptionLinkList.Links.Subscriptions, subscription) } // Send response w.WriteHeader(http.StatusOK) fmt.Fprint(w, convertMecServiceMgmtApiSubscriptionLinkListToJson(subscriptionLinkList)) fmt.Fprint(w, convertSubscriptionLinkListToJson(subscriptionLinkList)) } func getIndividualMECService(w http.ResponseWriter, r *http.Request) { log.Info("getIndividualMECService") w.Header().Set("Content-Type", "application/json; charset=UTF-8") // FIXME FSCOM TODO // Send response w.WriteHeader(http.StatusOK) } Loading