Unverified Commit 0df55846 authored by Kevin Di Lallo's avatar Kevin Di Lallo Committed by GitHub
Browse files

Merge pull request #313 from supermikii/my_sp37_demo3

Demo 3 
parents e2b09e3c 1a414bea
Loading
Loading
Loading
Loading
+32 −0
Original line number Diff line number Diff line
# Demo3

## Quick start 

|Operations: | Notes:|
|------------|-------|
|1. Login via the frontend & select Sandbox tab|
|2. Select a network to deploy in the user sandbox | Choose dual-mep network scenario to utilize app mobility service use-case |
|3. Create a unique MEC Application Instance ID | If using dual-mep network and walkthrough app mobility service use-case then both MEC Application Instance IDs must be created with the same MEC Application name|
|4. Apply configuration values by copying the MEC Sandbox endpoint into app_instance1.yaml sandbox mecUrl value  | For example: <br> Endpoints `mep1`:  `https://<the-mec-url>/<the-sandbox-key>/mep1` <br>Endpoints `mep2`: `https://<the-mec-url>/<the-sandbox-key>/mep2` |
|5. Select & copy the MEC Application Instance Id into app_instance1.yaml appid | |
|6. Select & copy your running app ip address into app_instace1.yaml localurl & port | |
|7. Run main.go pass in arguments with path of your config | |
|8. You can choose to launch swagger as client to intereact with api's and find responses in the logs demo 3 app | 

  
## What's inside?

A quick look at the top-level relevant files and directories in demo 3 project.

    .
    ├── api
    ├── server
    ├── util
    ├── main.go
    ├── go.mod
    

- api (swagger documentation)
- server (server code)
- util (configurations)
- main (entry)
+23 −0
Original line number Diff line number Diff line
# Swagger Codegen Ignore
# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen

# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.

# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line:
#ApiClient.cs

# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux

# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux

# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md
+1 −0
Original line number Diff line number Diff line
3.0.22
 No newline at end of file
+14 −0
Original line number Diff line number Diff line
FROM golang:1.10 AS build
WORKDIR /go/src
COPY go ./go
COPY main.go .

ENV CGO_ENABLED=0
RUN go get -d -v ./...

RUN go build -a -installsuffix cgo -o swagger .

FROM scratch AS runtime
COPY --from=build /go/src/swagger ./
EXPOSE 8080/tcp
ENTRYPOINT ["./swagger"]
+372 −0
Original line number Diff line number Diff line
openapi: 3.0.2
info:
  title: MEC Demo 3 API
  description: This section describes use case 3 - 5 that the user can accomplish using
    the MEC Sandbox APIs from a MEC application
  license:
    name: Apache 2.0
    url: http://www.apache.org/licenses/LICENSE-2.0
  version: 0.0.1
servers:
- url: 'http://10.190.115.162:8093'
- url: 'http://10.190.115.162:8094'
paths:
  /services/discover:
    post:
      tags:
      - frontend_mec_service
      description: This method retrieves information about a list of mec service resources & subscribes to service availability notification subscription
      responses:
        "200":
          description: OK
        "400":
          description: Bad request
        "404":
          description: Not found
  /service/create:
    post:
      tags:
      - frontend_mec_service
      description: This method creates a mec service on mec platform
      responses:
        "200":
          description: OK
        "400":
          description: Bad request
        "404":
          description: Not found
  /service/delete:
    delete:
      tags:
      - frontend_mec_service
      description: This method deletes a mecService resource. This method is typically used in the service deregistration procedure.
      responses:
        "200":
          description: OK
        "400":
          description: Bad request
        "404":
          description: Not found
  /service/ams/create: 
    post: 
      tags:
      - frontend_mec_service
      description: Create a new application mobility service for the service requester & create subscription to ams.
      responses:
        "200":
          description: OK
        "400":
          description: Bad request
        "404":
          description: Not found
  /services/callback/amsevent: 
    post: 
      tags:
      - 'frontend_notification'
      summary: MEC021 ams notifcation
      description: Handle Application Mobility Service notifications.
      requestBody:
                description: Subscription notification
                content:
                  application/json:
                    schema:
                      $ref: '#/components/schemas/MobilityProcedureNotification'
                required: true
      responses:
        "200":
          description: OK
        "400":
          description: Bad request
        "404":
          description: Not found
  /ams/subscriptions:
    post:
      tags:
      - frontend_mec_service
      description: 'Create a new subscription to Application Mobility Service notifications.'
      operationId: AmsSubscriptionPOST 
      responses:
        "200":
          description: OK
        "400":
          description: Bad request
        "404":
          description: Not found
  /services/callback/service-availability:
    post:
      tags:
      - 'frontend_notification'
      summary: 'MEC011 service availability notification'
      description: '.'
      operationId: NotificationPOST
      responses:
        "200":
          description: OK
        "400":
          description: Bad request
        "404":
          description: Not found
      requestBody:
        description: 'service availability notification details'
        required: true
        content: 
          application/json:
            schema:
              $ref: '#/components/schemas/ServiceAvailabilityNotification'
  /application/termination:
    post:
      tags:
      - 'frontend_notification'
      summary: 'MEC011 app termination notification'
      description: '.'
      operationId: TerminateNotificatonPOST
      responses:
        "200":
          description: OK
        "400":
          description: Bad request
        "404":
          description: Not found
      requestBody:
        description: 'app termination notification details'
        required: true
        content: 
          application/json:
            schema: 
              $ref: '#/components/schemas/AppTerminationNotificationSubscription'
components: 
  schemas:
    ServiceAvailabilityNotification:
        description: >-
          This type represents the service availability information.
        type: object
        required: 
          - notificationType
          - serviceReferences
          - _links
        properties:
          notificationType: 
            description: Shall be set to SerAvailabilityNotification
            type: string
            example: "SerAvailabilityNotification"
          serviceReferences:
            type: array
            items: 
              description: List of links to services whose availability has changed.
              type: object
              required:
                - serName
                - serInstanceId
                - state
                - changeType
              properties:
                link: 
                  $ref: '#/components/schemas/LinkType'
                serName: 
                  $ref: '#/components/schemas/SerName'
                serInstanceId:
                  $ref: '#/components/schemas/SerInstanceId'
                state:
                  $ref: '#/components/schemas/ServiceState'
                changeType:
                  description: >-
                   Type of the change. Valid values:
                    ADDED: The service was newly added.
                     REMOVED: The service was removed.
                     STATE_CHANGED: Only the state of the service was changed. 
                     ATTRIBUTES_CHANGED: At least one attribute of the service other than state was changed. The change may or may not include changing the state.
                  type: string
                  enum:
                    - ADDED
                    - REMOVED
                    - STATE_CHANGED
                    - ATTRIBUTES_CHANGED
          _links:
            $ref: '#/components/schemas/Subscription'
    AppTerminationNotificationSubscription:
      required:
      - _links
      - appInstanceId
      - callbackReference
      - subscriptionType
      type: object
      properties:
        subscriptionType:
          type: string
          description: Shall be set to AppTerminationNotificationSubscription.
        callbackReference:
          type: string
          description: URI selected by the MEC application instance to receive notifications
            on the subscribed MEC application instance management information. This
            shall be included in both the request and the response.
          format: uri
        _links:
          $ref: '#/components/schemas/AppTerminationNotificationSubscription__links'
        appInstanceId:
          type: string
          description: It is used as the filtering criterion for the subscribed events.
      description: This type represents the information that the MEC platform notifies
        the subscribed application instance about  the corresponding application instance
        termination/stop.
      example:
        appInstanceId: appInstanceId
        subscriptionType: subscriptionType
        _links:
          self:
            href: http://example.com/aeiou
        callbackReference: http://example.com/aeiou
    MobilityProcedureNotification:
      required:
      - mobilityStatus
      - notificationType
      type: object
      properties:
        associateId:
          minItems: 0
          type: array
          description: 0 to N identifiers to associate the information for specific
            UE(s) and flow(s).
          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
        targetAppInfo:
          $ref: '#/components/schemas/MobilityProcedureNotification_targetAppInfo'
        timeStamp:
          $ref: '#/components/schemas/TimeStamp'
      x-etsi-ref: 7.4.2
    TimeStamp:
      required:
      - nanoSeconds
      - seconds
      type: object
      properties:
        nanoSeconds:
          type: integer
          description: The nanoseconds part of the time. Time is defined as Unix-time
            since January 1, 1970, 00:00:00 UTC.
          format: int32
          x-etsi-mec-cardinality: "1"
          x-etsi-mec-origin-type: Uint32
        seconds:
          type: integer
          description: The seconds part of the time. Time is defined as Unixtime since
            January 1, 1970, 00:00:00 UTC.
          format: int32
          x-etsi-mec-cardinality: "1"
          x-etsi-mec-origin-type: Uint32
    MobilityProcedureNotification_targetAppInfo:
      type: object
      properties:
        appInstanceId:
          type: string
          example: '10.100.0.3'
          description: Identifiers of the target application instance.
          x-etsi-mec-cardinality: 0..1
          x-etsi-mec-origin-type: String
        commInterface:
          $ref: '#/components/schemas/CommunicationInterface'
      description: Identifiers to associate the information of target application
        instance.
    CommunicationInterface:
      properties:
        ipAddresses:
          type: array
          items:
            $ref: '#/components/schemas/CommunicationInterface_ipAddresses'
      example:
        ipAddresses:
        - port: 0
          host: host
        - port: 0
          host: host
    AssociateId:
      properties:
        type:
          type: integer
          description: 'Numeric value (0-255) corresponding to specified type of identifier
            as following: <p>0 = reserved. <p>1 = UE_IPv4_ADDRESS. <p>2 = UE_IPV6_ADDRESS.
            <p>3 = NATED_IP_ADDRESS. <p>4 = GTP_TEID.'
          x-etsi-mec-cardinality: "1"
          x-etsi-mec-origin-type: Enum
        value:
          type: string
          description: Value for the identifier.
          x-etsi-mec-cardinality: "1"
          x-etsi-mec-origin-type: String
      example:
        type: 0
        value: value
    AppTerminationNotificationSubscription__links:
      required:
      - self
      type: object
      properties:
        self:
          $ref: '#/components/schemas/LinkType'
      description: Self-referring URI.
      example:
        self:
          href: http://example.com/aeiou
    LinkType:
      description: This type represents a type of link and may be referenced from data structures
      type: object
      properties:
        href: 
          description: URI referring to a resource
          type: string
          format: uri
          example: '/mecSerMgmtApi/example'
    SerName:
      description: >-
        The name of the service. This is how the service producing MEC
        application identifies the service instance it produces.
      type: string
    SerInstanceId:
      description: >-
        Identifier of the service instance assigned by the MEC platform.
      type: string
      readOnly: true
    ServiceState:
      description: This enumeration defines the possible states of a service.
      type: string
      enum:
        - ACTIVE
        - INACTIVE
    Subscription:
      description: A link to the related subscription
      type: object
      required:
        - subscription
      properties:
        subscription:
          $ref: '#/components/schemas/LinkType'
  parameters: 
    Path.AppInstanceId:
      name: appInstanceId
      description: >-
        Represents a MEC application instance. Note that the
        appInstanceId is allocated by the MEC platform manager.
      in: path
      required: true
      schema:
        type: string
    Path.ServiceId:
      name: serviceId
      description: Represents a MEC service instance.
      in: path
      required: true
      schema:
        type: string
      
 No newline at end of file
Loading