diff --git a/examples/demo4-ue/README.md b/examples/demo4-ue/README.md index 3cde8bce58fc307ec7df34aead44fa390dd8f0b4..de91540ec8838822c719772131b79b4327d5bdae 100644 --- a/examples/demo4-ue/README.md +++ b/examples/demo4-ue/README.md @@ -24,42 +24,55 @@ By default, there is one onboarded MEC application named onboarded-demo4, descri "appList": [ { - "appInfoList": + "appDId": "onboarded-demo4", + "appName": "onboarded-demo4", + "appProvider": "ETSI", + "appSoftVersion": "v0.1.0", + "appDVersion": "v0.1.0", + "appDescription": "Basic HTTP Ping Pong", + "appLocation": [ { - "appDId": "onboarded-demo4", - "appName": "onboarded-demo4", - "appProvider": "ETSI", - "appSoftVersion": "v0.1.0", - "appDVersion": "v0.1.0", - "appDescription": "Basic HTTP Ping Pong", - "appLocation": + "area": + { + "coordinates": + [ + [ + [7.420433,43.729942],[7.420659,43.73036],[7.420621,43.731045],[7.420922,43.73129] + ], + [ + [7.43166,43.736156],[7.431723,43.736115],[7.431162,43.735607],[7.430685,43.73518] + ] + ] + }, + "civicAddressElement": [ { - "area": null, - "civicAddressElement": null, - "countryCode": "33" - } - ], - "appCharcs": - [ + "caType": 1, + "caValue": "A1" + }, { - "memory": 1024, - "storage": 1024, - "latency": 1024, - "bandwidth": 1024, - "serviceCont": 0 + "caType": 2, + "caValue": "A2" } ], - "cmd": "/onboardedapp/onboarded-demo/onboarded-demo4", - "args":null + "countryCode": "492" } ], - "vendorSpecificExt": { - "vendorId": "ETSI" + "appCharcs": + { + "memory": 1024, + "storage": 1024, + "latency": 1024, + "bandwidth": 1024, + "serviceCont": 0 } } - ] + ], + "vendorSpecificExt": + { + "vendorId": "ETSI" + } } ``` diff --git a/examples/demo4-ue/src/demo-server/backend/api/swagger.yaml b/examples/demo4-ue/src/demo-server/backend/api/swagger.yaml index 345ccded7b29563019193340318503c8bdc5b132..c728acb535b4ed8b6fff30847c354832edc13ef7 100644 --- a/examples/demo4-ue/src/demo-server/backend/api/swagger.yaml +++ b/examples/demo4-ue/src/demo-server/backend/api/swagger.yaml @@ -162,7 +162,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/AppLocationAvailability' + $ref: '#/components/schemas/ApplicationLocationAvailability' "400": description: Bad request. It is used to indicate that incorrect parameters were passed to the request. diff --git a/examples/demo4-ue/src/demo-server/backend/build.sh b/examples/demo4-ue/src/demo-server/backend/build.sh index d11f77bc9fdc103df720045e4d3f5c7aeb3293b0..7bfb5b2d90ee698e7d7dfb4abb49331e040479c3 100755 --- a/examples/demo4-ue/src/demo-server/backend/build.sh +++ b/examples/demo4-ue/src/demo-server/backend/build.sh @@ -22,4 +22,6 @@ go build -o $BINDIR/demo-server . cp -Rp ./api/ $BINDIR mv $BINDIR/api/swagger.yaml $BINDIR/api/MEC\ Demo\ 4\ API -cp $BINDIR/api/* $BINDIR/user-api \ No newline at end of file +cp $BINDIR/api/* $BINDIR/user-api + +cp ../demo4-ue-config.yaml $BINDIR diff --git a/examples/demo4-ue/src/onboarded-demo/onboarded-demo-test1.json b/examples/demo4-ue/src/onboarded-demo/onboarded-demo-test1.json deleted file mode 100644 index 927f8cbdd07aa6c0ea2650887ba8b2ea4d165600..0000000000000000000000000000000000000000 --- a/examples/demo4-ue/src/onboarded-demo/onboarded-demo-test1.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "appList": - [ - { - "appInfoList": - [ - { - "appDId": "appDId1", - "appName": "appName1", - "appProvider": "appProvider1", - "appSoftVersion": "appSoftVersion1", - "appDVersion": "appDVersion1", - "appDescription": "appDescription1", - "appLocation": - [ - { - "area": - { - "coordinates": - [ - [ - [7.43166,43.736156],[7.431723,43.736115],[7.431162,43.735607],[7.430685,43.73518] - ] - ] - }, - "countryCode": "countryCode1" - }, - { - "civicAddressElement": - [ - { - "caType": 2, - "caValue": "Value2" - }, - { - "caType": 20, - "caValue": "Value20" - } - ] - } - ], - "appCharcs": - [ - { - "memory": 2048, - "storage": 2048, - "latency": 2048, - "bandwidth": 2048, - "serviceCont": 1 - } - ], - "cmd": "uptime", - "args":null - } - ], - "vendorSpecificExt": { - "vendorId": "vendorId1" - } - } - ] -} diff --git a/examples/demo4-ue/src/onboarded-demo/server/onboarded-demo-service.go b/examples/demo4-ue/src/onboarded-demo/server/onboarded-demo-service.go index 90483511bcbb342057d463d85179cec5dccdf5ae..58704903fdb5de51f22f3e6fe04a9a10e63d1807 100644 --- a/examples/demo4-ue/src/onboarded-demo/server/onboarded-demo-service.go +++ b/examples/demo4-ue/src/onboarded-demo/server/onboarded-demo-service.go @@ -140,12 +140,12 @@ func Init() (err error) { // Create DAI client cfgDai := tm.DaiCfg{ - Name: amName, - Namespace: amNamespace, - User: amDBUser, - Pwd: amDBPwd, - Host: amDBHost, - Port: amDBPort, + // Name: amName, + // Namespace: amNamespace, + // User: amDBUser, + // Pwd: amDBPwd, + // Host: amDBHost, + // Port: amDBPort, NotifyAppContextDeletion: nil, } daiMgr, err := tm.NewDaiMgr(cfgDai) diff --git a/go-apps/meep-dai/api/swagger.yaml b/go-apps/meep-dai/api/swagger.yaml index a120492a4ba335912ac6e8f12f34d72c95c6c2e3..b911f57646989b8f184435b917402b218d950903 100644 --- a/go-apps/meep-dai/api/swagger.yaml +++ b/go-apps/meep-dai/api/swagger.yaml @@ -122,7 +122,7 @@ paths: summary: Creation of a new application context. description: "Used to create a new application context. Upon success, the response\ \ contains entity body describing the created application context." - operationId: devAppContextsGET + operationId: devAppContextsPOST parameters: [] requestBody: description: Entity body in the request contains the Application Context as diff --git a/go-apps/meep-dai/server/api_dai.go b/go-apps/meep-dai/server/api_dai.go index 8bff32e8efb0ff63dc4274bb6bbcfd24ba64e16e..9f96582ea2b1f9fe08bb9f887c14a45e68c12f07 100644 --- a/go-apps/meep-dai/server/api_dai.go +++ b/go-apps/meep-dai/server/api_dai.go @@ -39,8 +39,8 @@ func DevAppContextPUT(w http.ResponseWriter, r *http.Request) { devAppContextPUT(w, r) } -func DevAppContextsGET(w http.ResponseWriter, r *http.Request) { - devAppContextsGET(w, r) +func DevAppContextsPOST(w http.ResponseWriter, r *http.Request) { + devAppContextsPOST(w, r) } diff --git a/go-apps/meep-dai/server/dai.go b/go-apps/meep-dai/server/dai.go index 76606b8b4f21c93dcac7c93e8ea16d89d0b66e96..e1f2dcd571c7898ff9808c95482672612414f137 100644 --- a/go-apps/meep-dai/server/dai.go +++ b/go-apps/meep-dai/server/dai.go @@ -698,7 +698,7 @@ func meAppListGET(w http.ResponseWriter, r *http.Request) { fmt.Fprintf(w, string(jsonResponse)) } -func devAppContextsGET(w http.ResponseWriter, r *http.Request) { +func devAppContextsPOST(w http.ResponseWriter, r *http.Request) { // Retrieve the AppContext message body var appContext AppContext bodyBytes, _ := ioutil.ReadAll(r.Body) @@ -708,7 +708,7 @@ func devAppContextsGET(w http.ResponseWriter, r *http.Request) { http.Error(w, err.Error(), http.StatusInternalServerError) return } - log.Info("devAppContextsGET: ", appContext) + log.Info("devAppContextsPOST: ", appContext) // Create the AppContext var appContextSbi meepdaimgr.AppContext @@ -752,17 +752,17 @@ func devAppContextsGET(w http.ResponseWriter, r *http.Request) { appContextSbi.CallbackReference = new(meepdaimgr.Uri) *appContextSbi.CallbackReference = meepdaimgr.Uri(appContext.CallbackReference) appContextSbi.ContextId = "" - log.Debug("devAppContextsGET: Before appContextSbi: ", appContextSbi) + log.Debug("devAppContextsPOST: Before appContextSbi: ", appContextSbi) appContextSbi_, err := sbi.CreateAppContext(&appContextSbi) if err != nil { log.Error(err.Error()) errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) return } - log.Debug("devAppContextsGET: After appContextSbi_: ", appContextSbi_) - log.Debug("devAppContextsGET: *appContextSbi_.ContextId: ", appContextSbi_.ContextId) - log.Debug("devAppContextsGET: appContextSbi_.AppInfo: ", appContextSbi_.AppInfo) - log.Debug("devAppContextsGET: appContextSbi_.AppInfo.UserAppInstanceInfo: ", appContextSbi_.AppInfo.UserAppInstanceInfo) + log.Debug("devAppContextsPOST: After appContextSbi_: ", appContextSbi_) + log.Debug("devAppContextsPOST: *appContextSbi_.ContextId: ", appContextSbi_.ContextId) + log.Debug("devAppContextsPOST: appContextSbi_.AppInfo: ", appContextSbi_.AppInfo) + log.Debug("devAppContextsPOST: appContextSbi_.AppInfo.UserAppInstanceInfo: ", appContextSbi_.AppInfo.UserAppInstanceInfo) // Update AppContext appContext.ContextId = appContextSbi_.ContextId @@ -771,7 +771,7 @@ func devAppContextsGET(w http.ResponseWriter, r *http.Request) { appContext.AppInfo.UserAppInstanceInfo[i].ReferenceURI = string(item.ReferenceURI) } // End of 'for' statement - log.Debug("devAppContextsGET: appContext: ", appContext) + log.Debug("devAppContextsPOST: appContext: ", appContext) // Build the response var jsonResponse string = convertAppContextToJson(&appContext) @@ -922,8 +922,8 @@ func appLocationAvailabilityPOST(w http.ResponseWriter, r *http.Request) { } // Build response: only update AvailableLocations field - log.Debug("devAppContextsGET: applicationLocationAvailabilitySbi_.AppInfo.AvailableLocations: ", applicationLocationAvailabilitySbi_.AppInfo.AvailableLocations) - log.Debug("devAppContextsGET: len(applicationLocationAvailabilitySbi_.AppInfo.AvailableLocations): ", len(*applicationLocationAvailabilitySbi_.AppInfo.AvailableLocations)) + log.Debug("devAppContextsPOST: applicationLocationAvailabilitySbi_.AppInfo.AvailableLocations: ", applicationLocationAvailabilitySbi_.AppInfo.AvailableLocations) + log.Debug("devAppContextsPOST: len(applicationLocationAvailabilitySbi_.AppInfo.AvailableLocations): ", len(*applicationLocationAvailabilitySbi_.AppInfo.AvailableLocations)) applicationLocationAvailability.AppInfo.AvailableLocations = make([]ApplicationLocationAvailabilityAppInfoAvailableLocations, len(*applicationLocationAvailabilitySbi_.AppInfo.AvailableLocations)) if len(applicationLocationAvailability.AppInfo.AvailableLocations) != 0 { for i, item := range *applicationLocationAvailabilitySbi_.AppInfo.AvailableLocations { @@ -943,13 +943,13 @@ func appLocationAvailabilityPOST(w http.ResponseWriter, r *http.Request) { } if (*item.AppLocation).CountryCode != nil { - log.Debug("devAppContextsGET: *(*item.AppLocation).CountryCode: ", *(*item.AppLocation).CountryCode) + log.Debug("devAppContextsPOST: *(*item.AppLocation).CountryCode: ", *(*item.AppLocation).CountryCode) applicationLocationAvailability.AppInfo.AvailableLocations[i].AppLocation.CountryCode = *(*item.AppLocation).CountryCode } - log.Debug("devAppContextsGET: applicationLocationAvailability.AppInfo.AvailableLocations[i].AppLocation: ", applicationLocationAvailability.AppInfo.AvailableLocations[i].AppLocation) + log.Debug("devAppContextsPOST: applicationLocationAvailability.AppInfo.AvailableLocations[i].AppLocation: ", applicationLocationAvailability.AppInfo.AvailableLocations[i].AppLocation) } // End of 'for' statement } - log.Debug("devAppContextsGET: applicationLocationAvailability.AppInfo.AvailableLocations: ", applicationLocationAvailability.AppInfo.AvailableLocations) + log.Debug("devAppContextsPOST: applicationLocationAvailability.AppInfo.AvailableLocations: ", applicationLocationAvailability.AppInfo.AvailableLocations) // Build the response var jsonResponse string = convertApplicationLocationAvailabilityToJson(&applicationLocationAvailability) diff --git a/go-apps/meep-dai/server/dai_test.go b/go-apps/meep-dai/server/dai_test.go index b341289a58f672b67793f50bdc57ea8525cfca5e..78c6b9aed494cbfb8229b3d6fc12917bd28ea41e 100644 --- a/go-apps/meep-dai/server/dai_test.go +++ b/go-apps/meep-dai/server/dai_test.go @@ -1051,7 +1051,7 @@ func testDevAppContextsPOST(t *testing.T) *AppContext { /****************************** * request execution section ******************************/ - rr, err := sendRequest(http.MethodPost, "/app_contexts", bytes.NewBuffer(body), nil, nil, http.StatusCreated, DevAppContextsGET) + rr, err := sendRequest(http.MethodPost, "/app_contexts", bytes.NewBuffer(body), nil, nil, http.StatusCreated, DevAppContextsPOST) if err != nil { t.Fatalf(err.Error()) } diff --git a/go-apps/meep-dai/server/routers.go b/go-apps/meep-dai/server/routers.go index 6306b0322fe635c85a272d644b769ba99de0dd0e..0dbddb3b1cb0f82ce51506ea4bd0a8f650e3d3e4 100644 --- a/go-apps/meep-dai/server/routers.go +++ b/go-apps/meep-dai/server/routers.go @@ -117,10 +117,10 @@ var routes = Routes{ }, Route{ - "DevAppContextsGET", + "DevAppContextsPOST", strings.ToUpper("Post"), "/dev_app/v1/app_contexts", - DevAppContextsGET, + DevAppContextsPOST, }, Route{ diff --git a/go-packages/meep-dai-client/api/swagger.yaml b/go-packages/meep-dai-client/api/swagger.yaml index 68e79b6be6acf6ace9c86271e63fb1eb4c52212a..29dc8a5cdb07d15a31705a182595a483a3a4475c 100644 --- a/go-packages/meep-dai-client/api/swagger.yaml +++ b/go-packages/meep-dai-client/api/swagger.yaml @@ -122,7 +122,7 @@ paths: summary: Creation of a new application context. description: "Used to create a new application context. Upon success, the response\ \ contains entity body describing the created application context." - operationId: devAppContextsGET + operationId: devAppContextsPOST parameters: [] requestBody: description: Entity body in the request contains the Application Context as diff --git a/go-packages/meep-dai-client/api_dai.go b/go-packages/meep-dai-client/api_dai.go index 1782ce9c820245edd535103a60dc0c28c1e7c799..50a5e2635a6f793482719cb72e71caa1e91eafb0 100644 --- a/go-packages/meep-dai-client/api_dai.go +++ b/go-packages/meep-dai-client/api_dai.go @@ -392,7 +392,7 @@ Used to create a new application context. Upon success, the response contains en * @param body Entity body in the request contains the Application Context as requested by the device application. @return AppContext */ -func (a *DevAppApiService) DevAppContextsGET(ctx context.Context, body AppContext) (AppContext, *http.Response, error) { +func (a *DevAppApiService) DevAppContextsPOST(ctx context.Context, body AppContext) (AppContext, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Post") localVarPostBody interface{} diff --git a/go-packages/meep-dai-client/docs/DevAppApi.md b/go-packages/meep-dai-client/docs/DevAppApi.md index b3029a61d6f975fb46943c927c6bafbc89c4e700..971c6c6de73c877e8c5aba6b5b4ce0330b2e563f 100644 --- a/go-packages/meep-dai-client/docs/DevAppApi.md +++ b/go-packages/meep-dai-client/docs/DevAppApi.md @@ -7,7 +7,7 @@ Method | HTTP request | Description [**AppLocationAvailabilityPOST**](DevAppApi.md#AppLocationAvailabilityPOST) | **Post** /obtain_app_loc_availability | Obtain the location constraints for a new application context. [**DevAppContextDELETE**](DevAppApi.md#DevAppContextDELETE) | **Delete** /app_contexts/{contextId} | Deletion of an existing application context. [**DevAppContextPUT**](DevAppApi.md#DevAppContextPUT) | **Put** /app_contexts/{contextId} | Updating the callbackReference and/or appLocation of an existing application context. -[**DevAppContextsGET**](DevAppApi.md#DevAppContextsGET) | **Post** /app_contexts | Creation of a new application context. +[**DevAppContextsPOST**](DevAppApi.md#DevAppContextsPOST) | **Post** /app_contexts | Creation of a new application context. [**MeAppListGET**](DevAppApi.md#MeAppListGET) | **Get** /app_list | Get available application information. # **AppLocationAvailabilityPOST** @@ -95,8 +95,8 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -# **DevAppContextsGET** -> AppContext DevAppContextsGET(ctx, body) +# **DevAppContextsPOST** +> AppContext DevAppContextsPOST(ctx, body) Creation of a new application context. Used to create a new application context. Upon success, the response contains entity body describing the created application context. diff --git a/go-packages/meep-dai-mgr/meep-dai-mgr.go b/go-packages/meep-dai-mgr/meep-dai-mgr.go index 88500fdd1231eb5ee5e8c4a13d3cb5bfa5cfc403..ec7156fe27aad9d51e0d710eb3ffb5884e59c6fb 100644 --- a/go-packages/meep-dai-mgr/meep-dai-mgr.go +++ b/go-packages/meep-dai-mgr/meep-dai-mgr.go @@ -230,7 +230,7 @@ type AppExecEntry struct { var appExecEntries map[int]AppExecEntry = make(map[int]AppExecEntry) -// DAI confioguration +// DAI configuration type DaiCfg struct { NotifyAppContextDeletion func(string, string) }