Commit ed4a8058 authored by supermikii's avatar supermikii
Browse files

feat demo frontend & docker container

parent d7e3e9d4
Loading
Loading
Loading
Loading
+27 −0
Original line number Diff line number Diff line
#!/bin/bash

# Get full path to script directory
SCRIPT=$(readlink -f "$0")
BASEDIR=$(dirname "$SCRIPT")

DEMOBIN=$BASEDIR/bin/demo-server

echo ""
echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
echo ">>> Building Demo Service Frontend"
echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
echo ""
$BASEDIR/src/frontend/build.sh

echo ""
echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
echo ">>> Building Demo 3 Go Server"
echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
echo ""
$BASEDIR/src/backend/build.sh $DEMOBIN

echo ""
echo ">>> Demo Service build completed"


+36 −0
Original line number Diff line number Diff line
#!/bin/bash

# Get full path to script directory
SCRIPT=$(readlink -f "$0")
BASEDIR=$(dirname "$SCRIPT")

DEMOBIN=$BASEDIR/bin/demo-server

echo ""
echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
echo ">>> Dockerizing Demo Server"
echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
echo ""

# Copy frontend to bin folder
rm -r $DEMOBIN/static
mkdir -p $DEMOBIN/static

# Copy frontend to static folder
echo ">>> Copying Demo Server"
cp -Rf $BASEDIR/bin/demo-frontend/* $DEMOBIN/static
echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
cp $BASEDIR/src/backend/Dockerfile $DEMOBIN
echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"

# Dockerize demo 
# cd $DEMOBIN
# docker build --no-cache --rm -t meep-docker-registry:30001/demo-server3 .
# docker push meep-docker-registry:30001/demo-server3

echo ""
echo ">>> Demo Service dockerize completed"



examples/demo3/src/Dockerfile

deleted100644 → 0
+0 −14
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"]
+0 −372
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