Loading examples/demo3/src/backend/api/swagger.yaml +36 −25 Original line number Diff line number Diff line Loading @@ -489,36 +489,29 @@ components: href: http://example.com/aeiou callbackReference: http://example.com/aeiou MobilityProcedureNotification: title: MobilityProcedureNotification required: - associateId - links - mobilityStatus - notificationType type: object properties: notificationType: type: string description: Shall be set to "MobilityProcedureNotification". timeStamp: $ref: '#/components/schemas/TimeStamp' associateId: minItems: 0 type: array description: 0 to N identifiers to associate the information for specific UE(s) and flow(s). description: 1 to N identifiers to associate the information for specific items: $ref: '#/components/schemas/AssociateId' x-etsi-mec-cardinality: 0..N x-etsi-mec-origin-type: AssociateId mobilityStatus: type: integer description: "Indicate the status of the UE mobility. Values are defined\ \ as following: 1 = INTERHOST_MOVEOUT_TRIGGERED. 2 = INTERHOST_MOVEOUT_COMPLETED.\ \ 3 = INTERHOST_MOVEOUT_FAILED. Other values are reserved." x-etsi-mec-cardinality: "1" notificationType: type: string description: Shall be set to \"MobilityProcedureNotification\". x-etsi-mec-cardinality: "1" x-etsi-mec-origin-type: String $ref: '#/components/schemas/MobilityStatus' targetAppInfo: $ref: '#/components/schemas/MobilityProcedureNotification_targetAppInfo' timeStamp: $ref: '#/components/schemas/TimeStamp' x-etsi-ref: 7.4.2 _links: $ref: '#/components/schemas/LinkType' TimeStamp: required: - nanoSeconds Loading Loading @@ -552,24 +545,42 @@ components: $ref: '#/components/schemas/CommunicationInterface' description: Identifiers to associate the information of target application instance. MobilityProcedureNotification__links: required: - subscription type: object properties: subscription: $ref: '#/components/schemas/LinkType' description: Object containing hyperlinks related to the resource. CommunicationInterface: properties: ipAddresses: type: string AssociateId: title: AssociateId required: - type - value type: object properties: type: type: integer x-etsi-mec-cardinality: "1" x-etsi-mec-origin-type: Enum $ref: '#/components/schemas/Type' value: type: string description: Value for the identifier. x-etsi-mec-cardinality: "1" x-etsi-mec-origin-type: String example: type: 0 type: UE_IPv4_ADDRESS value: value Type: title: Type type: string description: Numeric value (0-255) corresponding to specified type of identifier enum: - UE_IPv4_ADDRESS - UE_IPV6_ADDRESS - NATED_IP_ADDRESS - GTP_TEID AppTerminationSubscription__links: required: - self Loading examples/demo3/src/backend/server/demo3_service.go +18 −7 Original line number Diff line number Diff line Loading @@ -640,6 +640,13 @@ func demo3DeleteAmsDevice(w http.ResponseWriter, r *http.Request) { http.Error(w, "Failed to retrieve ams subscription", http.StatusInternalServerError) return } if amsSubscriptionResp.SubscriptionType == "AdjacentAppInfoSubscription" { statusCode = "400" appActivityLogs = append(appActivityLogs, "Remove "+device+" to AMS resource ["+statusCode+"]") log.Error("AdjacentAppInfoSubscription not suported", err.Error()) http.Error(w, "AdjacentAppInfoSubscription not suported", http.StatusBadRequest) return } for i, v := range amsSubscriptionResp.FilterCriteria.AssociateId { if v.Value == device { Loading Loading @@ -829,7 +836,7 @@ func amsNotificationCallback(w http.ResponseWriter, r *http.Request) { } // Update AMS Resource _, amsUpdateError := amsUpdateDevice(amsResourceId, amsResource, amsNotification.AssociateId[0].Value, 1) _, amsUpdateError := amsUpdateDevice(amsResourceId, amsResource, amsNotification.AssociateId[0].Value, ams.USER_CONTEXT_TRANSFER_COMPLETED) if amsUpdateError != nil { w.WriteHeader(http.StatusInternalServerError) fmt.Fprintf(w, "Could not update ams") Loading Loading @@ -941,8 +948,9 @@ func updateAmsSubscription(subscriptionId string, device string, inlineSubscript return inLineSubscriptionResp, nil } var t_ ams.ModelType = ams.UE_I_PV4_ADDRESS associateId := ams.AssociateId{ Type_: 1, Type_: &t_, Value: device, } inlineSubscription.FilterCriteria.AssociateId = append(inlineSubscription.FilterCriteria.AssociateId, associateId) Loading Loading @@ -1013,12 +1021,14 @@ func amsSendService(appInstanceId string, device string) (string, error) { // Return ams id for update ams func amsAddDevice(amsId string, registerationBody ams.RegistrationInfo, device string) (ams.RegistrationInfo, error) { var associateId ams.AssociateId associateId.Type_ = 1 var t_ ams.ModelType = ams.UE_I_PV4_ADDRESS associateId.Type_ = &t_ associateId.Value = device var appMobilityServiceLevel ams.AppMobilityServiceLevel = "WITHOUT_CONFIRMATION" registerationBody.DeviceInformation = append(registerationBody.DeviceInformation, ams.RegistrationInfoDeviceInformation{ AssociateId: &associateId, AppMobilityServiceLevel: 3, AppMobilityServiceLevel: &appMobilityServiceLevel, }) registerationInfo, _, err := amsClient.AmsiApi.AppMobilityServiceByIdPUT(context.TODO(), registerationBody, amsId) Loading @@ -1032,10 +1042,10 @@ func amsAddDevice(amsId string, registerationBody ams.RegistrationInfo, device s // Update context state in ams resource to 0 or 1 // Return ams id for update ams func amsUpdateDevice(amsId string, registerationBody ams.RegistrationInfo, device string, contextState int32) (ams.RegistrationInfo, error) { func amsUpdateDevice(amsId string, registerationBody ams.RegistrationInfo, device string, contextState ams.ContextTransferState) (ams.RegistrationInfo, error) { for _, v := range registerationBody.DeviceInformation { if v.AssociateId.Value == device { v.ContextTransferState = contextState v.ContextTransferState = &contextState } } Loading Loading @@ -1080,7 +1090,8 @@ func amsSendSubscription(appInstanceId string, device string, callBackUrl string // Default tracking ue set to 10.100.0.3 var associateId ams.AssociateId associateId.Type_ = 1 var t_ ams.ModelType = ams.UE_I_PV4_ADDRESS associateId.Type_ = &t_ associateId.Value = device // Filter criteria Loading examples/demo3/src/backend/server/model_associate_id.go +2 −2 Original line number Diff line number Diff line Loading @@ -23,7 +23,7 @@ package server type AssociateId struct { Type_ int32 `json:"type,omitempty"` Type_ *ModelType `json:"type"` // Value for the identifier. Value string `json:"value,omitempty"` Value string `json:"value"` } examples/demo3/src/backend/server/model_communication_interface.go +1 −1 Original line number Diff line number Diff line Loading @@ -23,5 +23,5 @@ package server type CommunicationInterface struct { IpAddresses string `json:"ipAddresses,omitempty"` IpAddresses []CommunicationInterfaceIpAddresses `json:"ipAddresses,omitempty"` } examples/demo3/src/backend/server/model_communication_interface_ip_addresses.go 0 → 100644 +15 −0 Original line number Diff line number Diff line /* * ETSI GS MEC 021 Application Mobility Service API * * ETSI GS MEC 021 Application Mobility Service API described using OpenAPI. * * API version: 2.2.1 * Contact: cti_support@etsi.org * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package server type CommunicationInterfaceIpAddresses struct { Host string `json:"host"` Port int32 `json:"port"` } Loading
examples/demo3/src/backend/api/swagger.yaml +36 −25 Original line number Diff line number Diff line Loading @@ -489,36 +489,29 @@ components: href: http://example.com/aeiou callbackReference: http://example.com/aeiou MobilityProcedureNotification: title: MobilityProcedureNotification required: - associateId - links - mobilityStatus - notificationType type: object properties: notificationType: type: string description: Shall be set to "MobilityProcedureNotification". timeStamp: $ref: '#/components/schemas/TimeStamp' associateId: minItems: 0 type: array description: 0 to N identifiers to associate the information for specific UE(s) and flow(s). description: 1 to N identifiers to associate the information for specific items: $ref: '#/components/schemas/AssociateId' x-etsi-mec-cardinality: 0..N x-etsi-mec-origin-type: AssociateId mobilityStatus: type: integer description: "Indicate the status of the UE mobility. Values are defined\ \ as following: 1 = INTERHOST_MOVEOUT_TRIGGERED. 2 = INTERHOST_MOVEOUT_COMPLETED.\ \ 3 = INTERHOST_MOVEOUT_FAILED. Other values are reserved." x-etsi-mec-cardinality: "1" notificationType: type: string description: Shall be set to \"MobilityProcedureNotification\". x-etsi-mec-cardinality: "1" x-etsi-mec-origin-type: String $ref: '#/components/schemas/MobilityStatus' targetAppInfo: $ref: '#/components/schemas/MobilityProcedureNotification_targetAppInfo' timeStamp: $ref: '#/components/schemas/TimeStamp' x-etsi-ref: 7.4.2 _links: $ref: '#/components/schemas/LinkType' TimeStamp: required: - nanoSeconds Loading Loading @@ -552,24 +545,42 @@ components: $ref: '#/components/schemas/CommunicationInterface' description: Identifiers to associate the information of target application instance. MobilityProcedureNotification__links: required: - subscription type: object properties: subscription: $ref: '#/components/schemas/LinkType' description: Object containing hyperlinks related to the resource. CommunicationInterface: properties: ipAddresses: type: string AssociateId: title: AssociateId required: - type - value type: object properties: type: type: integer x-etsi-mec-cardinality: "1" x-etsi-mec-origin-type: Enum $ref: '#/components/schemas/Type' value: type: string description: Value for the identifier. x-etsi-mec-cardinality: "1" x-etsi-mec-origin-type: String example: type: 0 type: UE_IPv4_ADDRESS value: value Type: title: Type type: string description: Numeric value (0-255) corresponding to specified type of identifier enum: - UE_IPv4_ADDRESS - UE_IPV6_ADDRESS - NATED_IP_ADDRESS - GTP_TEID AppTerminationSubscription__links: required: - self Loading
examples/demo3/src/backend/server/demo3_service.go +18 −7 Original line number Diff line number Diff line Loading @@ -640,6 +640,13 @@ func demo3DeleteAmsDevice(w http.ResponseWriter, r *http.Request) { http.Error(w, "Failed to retrieve ams subscription", http.StatusInternalServerError) return } if amsSubscriptionResp.SubscriptionType == "AdjacentAppInfoSubscription" { statusCode = "400" appActivityLogs = append(appActivityLogs, "Remove "+device+" to AMS resource ["+statusCode+"]") log.Error("AdjacentAppInfoSubscription not suported", err.Error()) http.Error(w, "AdjacentAppInfoSubscription not suported", http.StatusBadRequest) return } for i, v := range amsSubscriptionResp.FilterCriteria.AssociateId { if v.Value == device { Loading Loading @@ -829,7 +836,7 @@ func amsNotificationCallback(w http.ResponseWriter, r *http.Request) { } // Update AMS Resource _, amsUpdateError := amsUpdateDevice(amsResourceId, amsResource, amsNotification.AssociateId[0].Value, 1) _, amsUpdateError := amsUpdateDevice(amsResourceId, amsResource, amsNotification.AssociateId[0].Value, ams.USER_CONTEXT_TRANSFER_COMPLETED) if amsUpdateError != nil { w.WriteHeader(http.StatusInternalServerError) fmt.Fprintf(w, "Could not update ams") Loading Loading @@ -941,8 +948,9 @@ func updateAmsSubscription(subscriptionId string, device string, inlineSubscript return inLineSubscriptionResp, nil } var t_ ams.ModelType = ams.UE_I_PV4_ADDRESS associateId := ams.AssociateId{ Type_: 1, Type_: &t_, Value: device, } inlineSubscription.FilterCriteria.AssociateId = append(inlineSubscription.FilterCriteria.AssociateId, associateId) Loading Loading @@ -1013,12 +1021,14 @@ func amsSendService(appInstanceId string, device string) (string, error) { // Return ams id for update ams func amsAddDevice(amsId string, registerationBody ams.RegistrationInfo, device string) (ams.RegistrationInfo, error) { var associateId ams.AssociateId associateId.Type_ = 1 var t_ ams.ModelType = ams.UE_I_PV4_ADDRESS associateId.Type_ = &t_ associateId.Value = device var appMobilityServiceLevel ams.AppMobilityServiceLevel = "WITHOUT_CONFIRMATION" registerationBody.DeviceInformation = append(registerationBody.DeviceInformation, ams.RegistrationInfoDeviceInformation{ AssociateId: &associateId, AppMobilityServiceLevel: 3, AppMobilityServiceLevel: &appMobilityServiceLevel, }) registerationInfo, _, err := amsClient.AmsiApi.AppMobilityServiceByIdPUT(context.TODO(), registerationBody, amsId) Loading @@ -1032,10 +1042,10 @@ func amsAddDevice(amsId string, registerationBody ams.RegistrationInfo, device s // Update context state in ams resource to 0 or 1 // Return ams id for update ams func amsUpdateDevice(amsId string, registerationBody ams.RegistrationInfo, device string, contextState int32) (ams.RegistrationInfo, error) { func amsUpdateDevice(amsId string, registerationBody ams.RegistrationInfo, device string, contextState ams.ContextTransferState) (ams.RegistrationInfo, error) { for _, v := range registerationBody.DeviceInformation { if v.AssociateId.Value == device { v.ContextTransferState = contextState v.ContextTransferState = &contextState } } Loading Loading @@ -1080,7 +1090,8 @@ func amsSendSubscription(appInstanceId string, device string, callBackUrl string // Default tracking ue set to 10.100.0.3 var associateId ams.AssociateId associateId.Type_ = 1 var t_ ams.ModelType = ams.UE_I_PV4_ADDRESS associateId.Type_ = &t_ associateId.Value = device // Filter criteria Loading
examples/demo3/src/backend/server/model_associate_id.go +2 −2 Original line number Diff line number Diff line Loading @@ -23,7 +23,7 @@ package server type AssociateId struct { Type_ int32 `json:"type,omitempty"` Type_ *ModelType `json:"type"` // Value for the identifier. Value string `json:"value,omitempty"` Value string `json:"value"` }
examples/demo3/src/backend/server/model_communication_interface.go +1 −1 Original line number Diff line number Diff line Loading @@ -23,5 +23,5 @@ package server type CommunicationInterface struct { IpAddresses string `json:"ipAddresses,omitempty"` IpAddresses []CommunicationInterfaceIpAddresses `json:"ipAddresses,omitempty"` }
examples/demo3/src/backend/server/model_communication_interface_ip_addresses.go 0 → 100644 +15 −0 Original line number Diff line number Diff line /* * ETSI GS MEC 021 Application Mobility Service API * * ETSI GS MEC 021 Application Mobility Service API described using OpenAPI. * * API version: 2.2.1 * Contact: cti_support@etsi.org * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package server type CommunicationInterfaceIpAddresses struct { Host string `json:"host"` Port int32 `json:"port"` }