Loading go-apps/meep-app-enablement/server/capif-mgmt/service-mgmt.go +38 −20 Original line number Diff line number Diff line Loading @@ -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) Loading Loading @@ -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, } Loading @@ -383,7 +380,6 @@ 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, } Loading Loading @@ -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() Loading Loading @@ -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 Loading Loading @@ -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) Loading go-apps/meep-app-enablement/server/routers.go +7 −0 Original line number Diff line number Diff line Loading @@ -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", Loading Loading
go-apps/meep-app-enablement/server/capif-mgmt/service-mgmt.go +38 −20 Original line number Diff line number Diff line Loading @@ -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) Loading Loading @@ -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, } Loading @@ -383,7 +380,6 @@ 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, } Loading Loading @@ -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() Loading Loading @@ -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 Loading Loading @@ -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) Loading
go-apps/meep-app-enablement/server/routers.go +7 −0 Original line number Diff line number Diff line Loading @@ -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", Loading