diff --git a/go-apps/meep-app-enablement/server/capif-mgmt/service-mgmt.go b/go-apps/meep-app-enablement/server/capif-mgmt/service-mgmt.go index 3c5d652c0976f0c3ef3c784ab295776a24f93336..963261462717eac1aa8342046a814304289ab45d 100644 --- a/go-apps/meep-app-enablement/server/capif-mgmt/service-mgmt.go +++ b/go-apps/meep-app-enablement/server/capif-mgmt/service-mgmt.go @@ -253,9 +253,6 @@ func appServicesPOST(w http.ResponseWriter, r *http.Request) { IsLocal: true, ConsumedLocalOnly: true, }, - // ScopeOfLocality: &locality, - // IsLocal: true, - // ConsumedLocalOnly: true, } decoder := json.NewDecoder(r.Body) err = decoder.Decode(&sInfoPost) @@ -363,12 +360,12 @@ func appServicesPOST(w http.ResponseWriter, r *http.Request) { } transportInfo_ := TransportInfo{ - Id: sInfoPost.AefProfiles[0].AefId, // Set this appropriately or generate it + Id: sInfoPost.AefProfiles[0].AefId, Name: sInfoPost.AefProfiles[0].VendorSpecificUrnetsimeccapifexttransportInfo.Name, Type_: sInfoPost.AefProfiles[0].VendorSpecificUrnetsimeccapifexttransportInfo.Type_, Protocol: sInfoPost.AefProfiles[0].VendorSpecificUrnetsimeccapifexttransportInfo.Protocol, Version: sInfoPost.AefProfiles[0].VendorSpecificUrnetsimeccapifexttransportInfo.Version, - Endpoint: sInfoPost.AefProfiles[0].InterfaceDescriptions, // Set the endpoint as required + Endpoint: sInfoPost.AefProfiles[0].InterfaceDescriptions, Security: sInfoPost.AefProfiles[0].VendorSpecificUrnetsimeccapifexttransportInfo.Security, } @@ -383,9 +380,8 @@ func appServicesPOST(w http.ResponseWriter, r *http.Request) { Serializer: dsInfo.VendorSpecificUrnetsimeccapifextserviceInfo.Serializer, ScopeOfLocality: dsInfo.VendorSpecificUrnetsimeccapifextserviceInfo.ScopeOfLocality, ConsumedLocalOnly: dsInfo.VendorSpecificUrnetsimeccapifextserviceInfo.ConsumedLocalOnly, - // although IsLocal is reevaluated when a query is replied to, value stored in sInfo as is for now - IsLocal: dsInfo.VendorSpecificUrnetsimeccapifextserviceInfo.IsLocal, - LivenessInterval: 0, + IsLocal: dsInfo.VendorSpecificUrnetsimeccapifextserviceInfo.IsLocal, + LivenessInterval: 0, } sInfo.Links = &ServiceInfoLinks{ Self: &LinkType{ @@ -615,8 +611,8 @@ func appServicesByIdGET(w http.ResponseWriter, r *http.Request) { log.Info("appServicesByIdGET") w.Header().Set("Content-Type", "application/json; charset=UTF-8") vars := mux.Vars(r) - svcId := vars["serviceId"] - appId := vars["appInstanceId"] + svcId := vars["serviceApiId"] + appId := vars["apfId"] mutex.Lock() defer mutex.Unlock() @@ -1273,15 +1269,6 @@ func getServices(w http.ResponseWriter, r *http.Request, appId string) { } serName := q["api-name"] - // var serName []string - // if serNameParam != "" { - // parsedParam, err := parseJSONQueryParam(serNameParam) - // if err != nil { - // errHandlerProblemDetails(w, "Invalid JSON in ser_name", http.StatusBadRequest) - // return - // } - // serName = append(serName, parsedParam.Value) - // } serCategoryIdParam := q.Get("vend-spec-etsi-mec-sercategory-id") var serCategoryId string @@ -1450,8 +1437,39 @@ func getService(w http.ResponseWriter, r *http.Request, appId string, serviceId return } + // Map ServiceInfoList to ServiceApiDescription list + serviceApiDescriptions := make([]ServiceApiDescription, 0) + for _, service := range sInfoList.Services { + aefProfile := AefProfile{ + AefId: service.TransportInfo.Id, + Versions: []string{service.Version}, + InterfaceDescriptions: service.TransportInfo.Endpoint, + VendorSpecificUrnetsimeccapifexttransportInfo: &MecTransportInfoCapifExt{ + Name: service.TransportInfo.Name, + Type_: service.TransportInfo.Type_, + Protocol: service.TransportInfo.Protocol, + Version: service.TransportInfo.Version, + Security: service.TransportInfo.Security, + }, + } + apiDesc := ServiceApiDescription{ + ApiName: service.SerName, + ApiId: service.SerInstanceId, + AefProfiles: []AefProfile{aefProfile}, + VendorSpecificUrnetsimeccapifextserviceInfo: &MecServiceInfoCapifExt{ + Serializer: service.Serializer, + State: service.State, + ScopeOfLocality: service.ScopeOfLocality, + ConsumedLocalOnly: service.ConsumedLocalOnly, + IsLocal: service.IsLocal, + Category: service.SerCategory, + }, + } + serviceApiDescriptions = append(serviceApiDescriptions, apiDesc) + } + // Prepare & send response - jsonResponse, err := json.Marshal(sInfoList.Services[0]) + jsonResponse, err := json.Marshal(serviceApiDescriptions) if err != nil { log.Error(err.Error()) errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) diff --git a/go-apps/meep-app-enablement/server/routers.go b/go-apps/meep-app-enablement/server/routers.go index bfc34c6ac39091fdf16517ecdf37af26350d74c6..2e382b74b624131217c0e59a17b3b3971cde2ac8 100644 --- a/go-apps/meep-app-enablement/server/routers.go +++ b/go-apps/meep-app-enablement/server/routers.go @@ -357,6 +357,13 @@ var routes = Routes{ capifMgmt.AppServicesPOST, }, + Route{ + "AppServicesServiceIdGET", + strings.ToUpper("Get"), + "/published-apis/v1/{apfId}/service-apis/{serviceId}", + capifMgmt.AppServicesServiceIdGET, + }, + Route{ "Index", "GET",