Loading examples/demo4-ue/src/demo-server/backend/README.md +3 −35 Original line number Diff line number Diff line # Go API Server for openapi Demo 4 is an edge application that can be used with AdvantEDGE or ETSI MEC Sandbox to demonstrate MEC011 and MEC021 usage ## Overview This server was generated by the [openapi-generator] (https://openapi-generator.tech) project. By using the [OpenAPI-Spec](https://github.com/OAI/OpenAPI-Specification) from a remote server, you can easily generate a server stub. - To see how to make this your own, look here: [README](https://openapi-generator.tech) - API version: 0.0.1 - Build date: 2022-08-03T12:17:06.810209074+02:00[Europe/Paris] ### Running the server To run the server, follow these simple steps: ``` go run main.go ``` To run the server in a docker container ``` docker build --network=host -t openapi . ``` Once image is built use ``` docker run --rm -it openapi ``` # Demo4 Demo 4 is an edge application that can be used with AdvantEDGE or ETSI MEC Sandbox to demonstrate MEC016 usage For more details, check out the [Demo4 Documentation](https://interdigitalinc.github.io/AdvantEDGE/docs/usage/usage-demo4/) examples/demo4-ue/src/demo-server/backend/api/swagger.yaml +28 −0 Original line number Diff line number Diff line Loading @@ -147,6 +147,34 @@ paths: summary: Returns onboarded-demo4 User Application activity tags: - DAI /dai/availability: post: description: Used to obtain the locations available for instantiation of a specific user application in the MEC system. operationId: daiAppLocationAvailabilityPOST responses: "200": content: application/json: schema: $ref: '#/components/schemas/AppLocationAvailability' description: Uppon success, a response body containing pong will be returned "400": content: application/problem+json: schema: $ref: '#/components/schemas/ProblemDetails' description: Bad request. It is used to indicate that incorrect parameters were passed to the request. "404": content: application/problem+json: schema: $ref: '#/components/schemas/ProblemDetails' description: Not found summary: Obtain the location constraints for a new application context. tags: - DAI /services/callback/service-availability: post: tags: Loading examples/demo4-ue/src/demo-server/backend/server/api_dai.go +5 −0 Original line number Diff line number Diff line Loading @@ -28,3 +28,8 @@ func DaiDoPingPOST(w http.ResponseWriter, r *http.Request) { func DaiDoPingDELETE(w http.ResponseWriter, r *http.Request) { demo4DaiDoPingDELETE(w, r) } func DaiAppLocationAvailabilityPOST(w http.ResponseWriter, r *http.Request) { demo4DaiAppLocationAvailabilityPOST(w, r) } examples/demo4-ue/src/demo-server/backend/server/demo4_service.go +55 −2 Original line number Diff line number Diff line Loading @@ -817,6 +817,7 @@ const ( simu_appPackageSource = "appPackageSource1" ) // REST API retrieves the list of the onboarded MEC application func demo4DaiDoPingGET(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json; charset=UTF-8") Loading Loading @@ -856,7 +857,7 @@ func demo4DaiDoPingGET(w http.ResponseWriter, r *http.Request) { fmt.Fprintf(w, string(jsonResponse))*/ } // REST API retrieve activity logs // REST API creates a new instance of an onboarded MEC application func demo4DaiDoPingPOST(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json; charset=UTF-8") Loading Loading @@ -911,7 +912,7 @@ func demo4DaiDoPingPOST(w http.ResponseWriter, r *http.Request) { fmt.Fprintf(w, string(jsonResponse)) } // REST API retrieve activity logs // REST API creates an existing instance of an onboarded MEC application func demo4DaiDoPingDELETE(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json; charset=UTF-8") Loading Loading @@ -947,6 +948,58 @@ func demo4DaiDoPingDELETE(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusNoContent) } // REST API retrieve location constraints of an existing instance of an onboarded MEC application func demo4DaiAppLocationAvailabilityPOST(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json; charset=UTF-8") log.Debug("demo4DaiAppLocationAvailabilityPOST: appContexts= ", appContexts) if len(appContexts) == 0 { err := errors.New("No context created, please use POST /dai/instantiate") appActivityLogs = append(appActivityLogs, "demo4DaiDoPingDELETE: "+err.Error()) log.Error(err.Error()) http.Error(w, err.Error(), http.StatusInternalServerError) return } // Retrieve the appContextId var appContextId string for k := range appContexts { log.Debug("demo4DaiAppLocationAvailabilityPOST: Set appContextId to ", k) appContextId = k } // End of 'for' statement log.Debug("demo4DaiAppLocationAvailabilityPOST: appContextId: ", appContextId) // Create a ApplicationLocationAvailability var appInfo dai.ApplicationLocationAvailabilityAppInfo appInfo.AppDVersion = appContexts[appContextId].app.AppInfo.AppDVersion appInfo.AppDescription = appContexts[appContextId].app.AppInfo.AppDescription appInfo.AppName = appContexts[appContextId].app.AppInfo.AppName appInfo.AppPackageSource = appContexts[appContextId].app.AppInfo.AppPackageSource appInfo.AppProvider = appContexts[appContextId].app.AppInfo.AppProvider appInfo.AppSoftVersion = appContexts[appContextId].app.AppInfo.AppSoftVersion var applicationLocationAvailability dai.ApplicationLocationAvailability applicationLocationAvailability.AppInfo = &appInfo applicationLocationAvailability.AssociateDevAppId = appContexts[appContextId].app.AssociateDevAppId appLocAv, response, err := daiClient.DevAppApi.AppLocationAvailabilityPOST(context.TODO(), applicationLocationAvailability) if err != nil { log.Error(err.Error()) http.Error(w, err.Error(), http.StatusInternalServerError) return } log.Debug("demo4DaiAppLocationAvailabilityPOST: Status: ", response.Status) // Send resp jsonResponse, err := json.Marshal(appLocAv) if err != nil { log.Error(err.Error()) http.Error(w, err.Error(), http.StatusInternalServerError) return } w.WriteHeader(http.StatusOK) fmt.Fprintf(w, string(jsonResponse)) } // Rest API handle user-app termination call-back notification func appTerminationNotificationCallback(w http.ResponseWriter, r *http.Request) { var notification asc.AppTerminationNotification Loading examples/demo4-ue/src/demo-server/backend/server/routers.go +7 −0 Original line number Diff line number Diff line Loading @@ -119,6 +119,13 @@ var routes = Routes{ DaiDoPingPOST, }, Route{ "DaiAppLocationAvailabilityPOST", strings.ToUpper("Post"), "/dai/availability", DaiAppLocationAvailabilityPOST, }, Route{ "ServiceAvailNotificationCallback", strings.ToUpper("Post"), Loading Loading
examples/demo4-ue/src/demo-server/backend/README.md +3 −35 Original line number Diff line number Diff line # Go API Server for openapi Demo 4 is an edge application that can be used with AdvantEDGE or ETSI MEC Sandbox to demonstrate MEC011 and MEC021 usage ## Overview This server was generated by the [openapi-generator] (https://openapi-generator.tech) project. By using the [OpenAPI-Spec](https://github.com/OAI/OpenAPI-Specification) from a remote server, you can easily generate a server stub. - To see how to make this your own, look here: [README](https://openapi-generator.tech) - API version: 0.0.1 - Build date: 2022-08-03T12:17:06.810209074+02:00[Europe/Paris] ### Running the server To run the server, follow these simple steps: ``` go run main.go ``` To run the server in a docker container ``` docker build --network=host -t openapi . ``` Once image is built use ``` docker run --rm -it openapi ``` # Demo4 Demo 4 is an edge application that can be used with AdvantEDGE or ETSI MEC Sandbox to demonstrate MEC016 usage For more details, check out the [Demo4 Documentation](https://interdigitalinc.github.io/AdvantEDGE/docs/usage/usage-demo4/)
examples/demo4-ue/src/demo-server/backend/api/swagger.yaml +28 −0 Original line number Diff line number Diff line Loading @@ -147,6 +147,34 @@ paths: summary: Returns onboarded-demo4 User Application activity tags: - DAI /dai/availability: post: description: Used to obtain the locations available for instantiation of a specific user application in the MEC system. operationId: daiAppLocationAvailabilityPOST responses: "200": content: application/json: schema: $ref: '#/components/schemas/AppLocationAvailability' description: Uppon success, a response body containing pong will be returned "400": content: application/problem+json: schema: $ref: '#/components/schemas/ProblemDetails' description: Bad request. It is used to indicate that incorrect parameters were passed to the request. "404": content: application/problem+json: schema: $ref: '#/components/schemas/ProblemDetails' description: Not found summary: Obtain the location constraints for a new application context. tags: - DAI /services/callback/service-availability: post: tags: Loading
examples/demo4-ue/src/demo-server/backend/server/api_dai.go +5 −0 Original line number Diff line number Diff line Loading @@ -28,3 +28,8 @@ func DaiDoPingPOST(w http.ResponseWriter, r *http.Request) { func DaiDoPingDELETE(w http.ResponseWriter, r *http.Request) { demo4DaiDoPingDELETE(w, r) } func DaiAppLocationAvailabilityPOST(w http.ResponseWriter, r *http.Request) { demo4DaiAppLocationAvailabilityPOST(w, r) }
examples/demo4-ue/src/demo-server/backend/server/demo4_service.go +55 −2 Original line number Diff line number Diff line Loading @@ -817,6 +817,7 @@ const ( simu_appPackageSource = "appPackageSource1" ) // REST API retrieves the list of the onboarded MEC application func demo4DaiDoPingGET(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json; charset=UTF-8") Loading Loading @@ -856,7 +857,7 @@ func demo4DaiDoPingGET(w http.ResponseWriter, r *http.Request) { fmt.Fprintf(w, string(jsonResponse))*/ } // REST API retrieve activity logs // REST API creates a new instance of an onboarded MEC application func demo4DaiDoPingPOST(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json; charset=UTF-8") Loading Loading @@ -911,7 +912,7 @@ func demo4DaiDoPingPOST(w http.ResponseWriter, r *http.Request) { fmt.Fprintf(w, string(jsonResponse)) } // REST API retrieve activity logs // REST API creates an existing instance of an onboarded MEC application func demo4DaiDoPingDELETE(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json; charset=UTF-8") Loading Loading @@ -947,6 +948,58 @@ func demo4DaiDoPingDELETE(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusNoContent) } // REST API retrieve location constraints of an existing instance of an onboarded MEC application func demo4DaiAppLocationAvailabilityPOST(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json; charset=UTF-8") log.Debug("demo4DaiAppLocationAvailabilityPOST: appContexts= ", appContexts) if len(appContexts) == 0 { err := errors.New("No context created, please use POST /dai/instantiate") appActivityLogs = append(appActivityLogs, "demo4DaiDoPingDELETE: "+err.Error()) log.Error(err.Error()) http.Error(w, err.Error(), http.StatusInternalServerError) return } // Retrieve the appContextId var appContextId string for k := range appContexts { log.Debug("demo4DaiAppLocationAvailabilityPOST: Set appContextId to ", k) appContextId = k } // End of 'for' statement log.Debug("demo4DaiAppLocationAvailabilityPOST: appContextId: ", appContextId) // Create a ApplicationLocationAvailability var appInfo dai.ApplicationLocationAvailabilityAppInfo appInfo.AppDVersion = appContexts[appContextId].app.AppInfo.AppDVersion appInfo.AppDescription = appContexts[appContextId].app.AppInfo.AppDescription appInfo.AppName = appContexts[appContextId].app.AppInfo.AppName appInfo.AppPackageSource = appContexts[appContextId].app.AppInfo.AppPackageSource appInfo.AppProvider = appContexts[appContextId].app.AppInfo.AppProvider appInfo.AppSoftVersion = appContexts[appContextId].app.AppInfo.AppSoftVersion var applicationLocationAvailability dai.ApplicationLocationAvailability applicationLocationAvailability.AppInfo = &appInfo applicationLocationAvailability.AssociateDevAppId = appContexts[appContextId].app.AssociateDevAppId appLocAv, response, err := daiClient.DevAppApi.AppLocationAvailabilityPOST(context.TODO(), applicationLocationAvailability) if err != nil { log.Error(err.Error()) http.Error(w, err.Error(), http.StatusInternalServerError) return } log.Debug("demo4DaiAppLocationAvailabilityPOST: Status: ", response.Status) // Send resp jsonResponse, err := json.Marshal(appLocAv) if err != nil { log.Error(err.Error()) http.Error(w, err.Error(), http.StatusInternalServerError) return } w.WriteHeader(http.StatusOK) fmt.Fprintf(w, string(jsonResponse)) } // Rest API handle user-app termination call-back notification func appTerminationNotificationCallback(w http.ResponseWriter, r *http.Request) { var notification asc.AppTerminationNotification Loading
examples/demo4-ue/src/demo-server/backend/server/routers.go +7 −0 Original line number Diff line number Diff line Loading @@ -119,6 +119,13 @@ var routes = Routes{ DaiDoPingPOST, }, Route{ "DaiAppLocationAvailabilityPOST", strings.ToUpper("Post"), "/dai/availability", DaiAppLocationAvailabilityPOST, }, Route{ "ServiceAvailNotificationCallback", strings.ToUpper("Post"), Loading