Loading examples/demo3/src/backend/api/swagger.yaml +3 −3 Original line number Diff line number Diff line Loading @@ -267,7 +267,7 @@ components: example: mecReady: true subscriptions: 'SerAvailabilitySubscription:': SerAvailabilitySubscription: subId: subId AmsLinkListSubscription: subId: subId Loading Loading @@ -348,13 +348,13 @@ components: properties: AppTerminationSubscription: $ref: '#/components/schemas/ApplicationInstance_AppTerminationSubscription' 'SerAvailabilitySubscription:': SerAvailabilitySubscription: $ref: '#/components/schemas/ApplicationInstance_SerAvailabilitySubscription' AmsLinkListSubscription: $ref: '#/components/schemas/ApplicationInstance_AmsLinkListSubscription' description: List of ams subscription unique to device and their id example: 'SerAvailabilitySubscription:': SerAvailabilitySubscription: subId: subId AmsLinkListSubscription: subId: subId Loading examples/demo3/src/backend/server/README.md +2 −2 Original line number Diff line number Diff line # Go API Server for server This section describes how to use AdvantEdge mec services with a scenario demonstrating use-case 1 - 3 Demo 3 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 [swagger-codegen] Loading @@ -13,7 +13,7 @@ To see how to make this your own, look here: [README](https://github.com/swagger-api/swagger-codegen/blob/master/README.md) - API version: 0.0.1 - Build date: 2021-11-24T04:23:06.407744-05:00[America/New_York] - Build date: 2021-12-14T11:16:00.513484-05:00[America/Toronto] ### Running the server Loading examples/demo3/src/backend/server/api_notification.go +4 −4 Original line number Diff line number Diff line Loading @@ -34,10 +34,10 @@ func AppTerminationNotificationCallback(w http.ResponseWriter, r *http.Request) appTerminationNotificationCallback(w, r) } func ServiceAvailNotificationCallback(w http.ResponseWriter, r *http.Request) { serviceAvailNotificationCallback(w, r) } func ContextTransferNotificationCallback(w http.ResponseWriter, r *http.Request) { stateTransferPOST(w, r) } func ServiceAvailNotificationCallback(w http.ResponseWriter, r *http.Request) { serviceAvailNotificationCallback(w, r) } examples/demo3/src/backend/server/demo3_service.go +10 −5 Original line number Diff line number Diff line Loading @@ -878,7 +878,7 @@ func stateTransferPOST(w http.ResponseWriter, r *http.Request) { var targetContextState ApplicationContextState decoder := json.NewDecoder(r.Body) err := decoder.Decode(&targetContextState) counter := strconv.Itoa(targetContextState.Counter) counter := strconv.Itoa(int(targetContextState.Counter)) if err != nil { log.Error(err.Error()) appActivityLogs = append(appActivityLogs, "=== Receive device "+targetContextState.Device+" context (state="+counter+") [500]") Loading Loading @@ -922,7 +922,7 @@ func stateTransferPOST(w http.ResponseWriter, r *http.Request) { } addToTrackingDevices(targetContextState.Device) terminalDeviceState[targetContextState.Device] = targetContextState.Counter terminalDeviceState[targetContextState.Device] = int(targetContextState.Counter) appActivityLogs = append(appActivityLogs, "=== Receive device "+targetContextState.Device+" context (state="+counter+") [200]") Loading Loading @@ -960,7 +960,7 @@ func sendContextTransfer(notifyUrl string, device string, targetId string) error // Context state transfer var contextState ApplicationContextState contextState.Counter = terminalDeviceState[device] contextState.Counter = int32(terminalDeviceState[device]) contextState.AppId = instanceName contextState.Mep = mep contextState.Device = device Loading @@ -972,7 +972,7 @@ func sendContextTransfer(notifyUrl string, device string, targetId string) error log.Error("Failed to marshal context state ", err.Error()) return err } counter := strconv.Itoa(contextState.Counter) counter := strconv.Itoa(int(contextState.Counter)) resp, err := http.Post(notifyUrl, "application/json", bytes.NewBuffer(jsonCounter)) if err != nil { log.Error(err.Error()) Loading Loading @@ -1193,7 +1193,12 @@ func subscribeAvailability(appInstanceId string, callbackReference string) (stri var filter smc.SerAvailabilityNotificationSubscriptionFilteringCriteria filter.SerNames = nil filter.IsLocal = true subscription := smc.SerAvailabilityNotificationSubscription{"SerAvailabilityNotificationSubscription", callbackReference, nil, &filter} subscription := smc.SerAvailabilityNotificationSubscription{ SubscriptionType: "SerAvailabilityNotificationSubscription", CallbackReference: callbackReference, Links: nil, FilteringCriteria: &filter, } serAvailabilityNotificationSubscription, resp, err := srvMgmtClient.MecServiceMgmtApi.ApplicationsSubscriptionsPOST(context.TODO(), subscription, appInstanceId) status := strconv.Itoa(resp.StatusCode) if err != nil { Loading examples/demo3/src/backend/server/model_application_context_state.go +1 −1 Original line number Diff line number Diff line Loading @@ -24,7 +24,7 @@ package server type ApplicationContextState struct { // Integer representing state of device being tracked Counter int `json:"Counter,omitempty"` Counter int32 `json:"Counter,omitempty"` // Application UUID AppId string `json:"AppId,omitempty"` // MEC platform name Loading Loading
examples/demo3/src/backend/api/swagger.yaml +3 −3 Original line number Diff line number Diff line Loading @@ -267,7 +267,7 @@ components: example: mecReady: true subscriptions: 'SerAvailabilitySubscription:': SerAvailabilitySubscription: subId: subId AmsLinkListSubscription: subId: subId Loading Loading @@ -348,13 +348,13 @@ components: properties: AppTerminationSubscription: $ref: '#/components/schemas/ApplicationInstance_AppTerminationSubscription' 'SerAvailabilitySubscription:': SerAvailabilitySubscription: $ref: '#/components/schemas/ApplicationInstance_SerAvailabilitySubscription' AmsLinkListSubscription: $ref: '#/components/schemas/ApplicationInstance_AmsLinkListSubscription' description: List of ams subscription unique to device and their id example: 'SerAvailabilitySubscription:': SerAvailabilitySubscription: subId: subId AmsLinkListSubscription: subId: subId Loading
examples/demo3/src/backend/server/README.md +2 −2 Original line number Diff line number Diff line # Go API Server for server This section describes how to use AdvantEdge mec services with a scenario demonstrating use-case 1 - 3 Demo 3 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 [swagger-codegen] Loading @@ -13,7 +13,7 @@ To see how to make this your own, look here: [README](https://github.com/swagger-api/swagger-codegen/blob/master/README.md) - API version: 0.0.1 - Build date: 2021-11-24T04:23:06.407744-05:00[America/New_York] - Build date: 2021-12-14T11:16:00.513484-05:00[America/Toronto] ### Running the server Loading
examples/demo3/src/backend/server/api_notification.go +4 −4 Original line number Diff line number Diff line Loading @@ -34,10 +34,10 @@ func AppTerminationNotificationCallback(w http.ResponseWriter, r *http.Request) appTerminationNotificationCallback(w, r) } func ServiceAvailNotificationCallback(w http.ResponseWriter, r *http.Request) { serviceAvailNotificationCallback(w, r) } func ContextTransferNotificationCallback(w http.ResponseWriter, r *http.Request) { stateTransferPOST(w, r) } func ServiceAvailNotificationCallback(w http.ResponseWriter, r *http.Request) { serviceAvailNotificationCallback(w, r) }
examples/demo3/src/backend/server/demo3_service.go +10 −5 Original line number Diff line number Diff line Loading @@ -878,7 +878,7 @@ func stateTransferPOST(w http.ResponseWriter, r *http.Request) { var targetContextState ApplicationContextState decoder := json.NewDecoder(r.Body) err := decoder.Decode(&targetContextState) counter := strconv.Itoa(targetContextState.Counter) counter := strconv.Itoa(int(targetContextState.Counter)) if err != nil { log.Error(err.Error()) appActivityLogs = append(appActivityLogs, "=== Receive device "+targetContextState.Device+" context (state="+counter+") [500]") Loading Loading @@ -922,7 +922,7 @@ func stateTransferPOST(w http.ResponseWriter, r *http.Request) { } addToTrackingDevices(targetContextState.Device) terminalDeviceState[targetContextState.Device] = targetContextState.Counter terminalDeviceState[targetContextState.Device] = int(targetContextState.Counter) appActivityLogs = append(appActivityLogs, "=== Receive device "+targetContextState.Device+" context (state="+counter+") [200]") Loading Loading @@ -960,7 +960,7 @@ func sendContextTransfer(notifyUrl string, device string, targetId string) error // Context state transfer var contextState ApplicationContextState contextState.Counter = terminalDeviceState[device] contextState.Counter = int32(terminalDeviceState[device]) contextState.AppId = instanceName contextState.Mep = mep contextState.Device = device Loading @@ -972,7 +972,7 @@ func sendContextTransfer(notifyUrl string, device string, targetId string) error log.Error("Failed to marshal context state ", err.Error()) return err } counter := strconv.Itoa(contextState.Counter) counter := strconv.Itoa(int(contextState.Counter)) resp, err := http.Post(notifyUrl, "application/json", bytes.NewBuffer(jsonCounter)) if err != nil { log.Error(err.Error()) Loading Loading @@ -1193,7 +1193,12 @@ func subscribeAvailability(appInstanceId string, callbackReference string) (stri var filter smc.SerAvailabilityNotificationSubscriptionFilteringCriteria filter.SerNames = nil filter.IsLocal = true subscription := smc.SerAvailabilityNotificationSubscription{"SerAvailabilityNotificationSubscription", callbackReference, nil, &filter} subscription := smc.SerAvailabilityNotificationSubscription{ SubscriptionType: "SerAvailabilityNotificationSubscription", CallbackReference: callbackReference, Links: nil, FilteringCriteria: &filter, } serAvailabilityNotificationSubscription, resp, err := srvMgmtClient.MecServiceMgmtApi.ApplicationsSubscriptionsPOST(context.TODO(), subscription, appInstanceId) status := strconv.Itoa(resp.StatusCode) if err != nil { Loading
examples/demo3/src/backend/server/model_application_context_state.go +1 −1 Original line number Diff line number Diff line Loading @@ -24,7 +24,7 @@ package server type ApplicationContextState struct { // Integer representing state of device being tracked Counter int `json:"Counter,omitempty"` Counter int32 `json:"Counter,omitempty"` // Application UUID AppId string `json:"AppId,omitempty"` // MEC platform name Loading