Unverified Commit 7c57d3df authored by Kevin Di Lallo's avatar Kevin Di Lallo Committed by GitHub
Browse files

Merge pull request #339 from dilallkx/kd_sp51_demo3_fixes

Demo3 API fixes
parents 5dff5cdc c5655d9a
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -267,7 +267,7 @@ components:
      example:
        mecReady: true
        subscriptions:
          'SerAvailabilitySubscription:':
          SerAvailabilitySubscription:
            subId: subId
          AmsLinkListSubscription:
            subId: subId
@@ -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
+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]
@@ -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
+4 −4
Original line number Diff line number Diff line
@@ -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)
}
+10 −5
Original line number Diff line number Diff line
@@ -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]")
@@ -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]")

@@ -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
@@ -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())
@@ -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 {
+1 −1
Original line number Diff line number Diff line
@@ -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