openapi: 3.0.0
info:
  title: Telco Cloud Automation Performance Management API
  description: Telco Cloud Automation Performance Management API
  termsOfService: https://www.vmware.com/help/legal.html
  contact:
    name: VMware
  license:
    name: Copyright (c) 2020-2021 VMware, Inc. All rights reserved.
  version: "1.0"
servers:
- url: https://{server}/hybridity/api
  variables:
    server:
      description: server host name
      default: localhost
security:
- x-hm-authorization: []
tags:
- name: PerformanceManagement
  description: Telco Cloud Automation Performance Management API
paths:
  /vnfpm/v1/{vnfInstanceId}/stats:
    post:
      tags:
      - PerformanceManagement
      summary: Get Stats from Vms given the vdu Id
      description: Get Stats from Vms given the vdu Id
      operationId: queryInventoryStats
      parameters:
      - name: vnfInstanceId
        in: path
        description: Network Function Instance Id
        required: true
        style: simple
        explode: false
        schema:
          type: string
      - name: Accept-Language
        in: header
        required: false
        style: simple
        explode: false
        schema:
          type: string
      requestBody:
        description: "null"
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/statsFilter'
        required: true
      responses:
        "200":
          description: Accepted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/vduStatsResponse'
        "401":
          description: Unauthorized
        "403":
          description: Forbidden
        "500":
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorResponse'
  /vnfpm/v1/pm_jobs:
    get:
      tags:
      - PerformanceManagement
      summary: Query existing Performance Management Jobs for reporting
      description: Query existing Performance Management Jobs for reporting
      operationId: getAllPmJobs
      parameters:
      - name: Accept-Language
        in: header
        required: false
        style: simple
        explode: false
        schema:
          type: string
      - name: filter
        in: query
        required: false
        style: form
        explode: true
        schema:
          type: string
          default: ""
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/pmJobs'
        "401":
          description: Unauthorized
        "403":
          description: Forbidden
        "500":
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorResponse'
    post:
      tags:
      - PerformanceManagement
      summary: Create Performance Management Job for reporting on given object Ids
      description: Create Performance Management Job for reporting on given object
        Ids and object Type
      operationId: createPmJob
      parameters:
      - name: Accept-Language
        in: header
        required: false
        style: simple
        explode: false
        schema:
          type: string
      requestBody:
        description: "null"
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/pmJobRequest'
        required: true
      responses:
        "200":
          description: Accepted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/pmJobCreateResponse'
        "401":
          description: Unauthorized
        "403":
          description: Forbidden
        "500":
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorResponse'
  /vnfpm/v1/pm_jobs/{pmJobId}:
    get:
      tags:
      - PerformanceManagement
      summary: Query existing Performance Management Job for reporting
      description: Query existing Performance Management Job for reporting
      operationId: getPmJob
      parameters:
      - name: pmJobId
        in: path
        description: Performance Management Job Id
        required: true
        style: simple
        explode: false
        schema:
          type: string
      - name: Accept-Language
        in: header
        required: false
        style: simple
        explode: false
        schema:
          type: string
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/pmJobs'
        "401":
          description: Unauthorized
        "403":
          description: Forbidden
        "500":
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorResponse'
    delete:
      tags:
      - PerformanceManagement
      summary: Delete existing Performance Management Job and reports
      description: Delete existing Performance Management Job and reports
      operationId: deletePmJob
      parameters:
      - name: pmJobId
        in: path
        description: Performance Management Job Id
        required: true
        style: simple
        explode: false
        schema:
          type: string
      - name: Accept-Language
        in: header
        required: false
        style: simple
        explode: false
        schema:
          type: string
      responses:
        "204":
          description: No Content
        "401":
          description: Unauthorized
        "403":
          description: Forbidden
        "500":
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorResponse'
  /vnfpm/v1/pm_jobs/{pmJobId}/reports/{reportId}:
    get:
      tags:
      - PerformanceManagement
      summary: Query existing Performance Management Job reort metadata
      description: Query existing Performance Management Job report metadata
      operationId: getPmJobReport
      parameters:
      - name: pmJobId
        in: path
        description: Performance Management Job Id
        required: true
        style: simple
        explode: false
        schema:
          type: string
      - name: reportId
        in: path
        description: Performance Management Job Report Id
        required: true
        style: simple
        explode: false
        schema:
          type: string
      - name: Accept-Language
        in: header
        required: false
        style: simple
        explode: false
        schema:
          type: string
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/pmJobReport'
        "401":
          description: Unauthorized
        "403":
          description: Forbidden
        "500":
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorResponse'
components:
  schemas:
    vduStats:
      type: object
      properties:
        vduId:
          type: string
        stats:
          type: array
          items:
            $ref: '#/components/schemas/metrics'
    errorResponse:
      type: object
      properties:
        errors:
          type: array
          items:
            $ref: '#/components/schemas/error'
    vduStatsResponse:
      type: object
      properties:
        paging:
          $ref: '#/components/schemas/paging'
        vduStats:
          type: array
          items:
            $ref: '#/components/schemas/vduStats'
        warnings:
          type: array
          items:
            $ref: '#/components/schemas/warning'
        errors:
          type: array
          items:
            $ref: '#/components/schemas/error'
    statsFilter:
      type: object
      properties:
        filter:
          $ref: '#/components/schemas/statsFilter_filter'
        paging:
          $ref: '#/components/schemas/paging'
    pmJobRequest:
      required:
      - objectIds
      - objectType
      - pmJobCriteria
      - pmJobName
      type: object
      properties:
        pmJobName:
          type: string
        objectIds:
          type: array
          items:
            type: string
        objectType:
          type: string
          enum:
          - VNF
          - CNF
        pmJobCriteria:
          $ref: '#/components/schemas/pmJobCriteria'
    pmJobCreateResponse:
      type: object
      properties:
        pmJobId:
          type: string
        pmJobName:
          type: string
        objectIds:
          type: array
          items:
            type: string
        objectType:
          type: string
        pmJobCriteria:
          $ref: '#/components/schemas/pmJobCriteria'
        warnings:
          type: array
          items:
            $ref: '#/components/schemas/warning'
        errors:
          type: array
          items:
            $ref: '#/components/schemas/error'
    pmJobs:
      type: object
      properties:
        pmJobs:
          type: array
          items:
            $ref: '#/components/schemas/pmJob'
        warnings:
          type: array
          items:
            $ref: '#/components/schemas/warning'
        errors:
          type: array
          items:
            $ref: '#/components/schemas/error'
    pmJob:
      type: object
      properties:
        pmJobId:
          type: string
        pmJobName:
          type: string
        objectId:
          type: string
        objectType:
          type: string
        status:
          type: string
          enum:
          - INITIALIZED
          - ACTIVE
          - COMPLETED
          - COMPLETED_WITH_ERROR
          - DELETED
          - REPORT_GENERATION_ERROR
          - FAILED
        errorMessage:
          type: string
        creationDate:
          type: integer
          format: int64
        pmJobCriteria:
          $ref: '#/components/schemas/pmJobCriteria'
        reportsAvailableForDownload:
          type: integer
        reports:
          type: array
          items:
            $ref: '#/components/schemas/pmJobReport'
        warnings:
          type: array
          items:
            $ref: '#/components/schemas/warning'
        errors:
          type: array
          items:
            $ref: '#/components/schemas/error'
    pmJobReport:
      type: object
      properties:
        reportId:
          type: string
        objectId:
          type: string
        objectType:
          type: string
        reportName:
          type: string
        link:
          type: string
        creationTime:
          type: integer
          format: int64
        expirationTime:
          type: integer
          format: int64
        fileSize:
          type: number
        status:
          type: string
          enum:
          - PENDING
          - FAILED
          - AVAILABLE
          - EXPIRED
        errorMessage:
          type: string
        warnings:
          type: array
          items:
            $ref: '#/components/schemas/warning'
        errors:
          type: array
          items:
            $ref: '#/components/schemas/error'
    pmJobResponse:
      type: object
      properties:
        pmJobId:
          type: string
        pmJobName:
          type: string
        objectIds:
          type: array
          items:
            type: string
        objectType:
          type: string
        pmJobCriteria:
          $ref: '#/components/schemas/pmJobCriteria'
        warnings:
          type: array
          items:
            $ref: '#/components/schemas/warning'
        errors:
          type: array
          items:
            $ref: '#/components/schemas/error'
    metrics:
      type: object
      properties:
        metricName:
          type: string
        units:
          type: string
        ts:
          type: array
          items:
            type: number
        values:
          type: array
          items:
            type: string
    error:
      type: object
      properties:
        code:
          type: string
        message:
          type: string
    paging:
      type: object
      properties:
        offset:
          type: string
        pageSize:
          type: integer
    warning:
      type: object
      properties:
        message:
          type: string
    pmJobCriteria:
      required:
      - reportingBoundary
      - reportingPeriod
      type: object
      properties:
        performanceMetric:
          type: array
          items:
            type: string
            enum:
            - VcpuUsageMeanVnf
            - VmemoryUsageMeanVnf
            - VdiskReadUsageMeanVnf
            - VdiskWriteUsageMeanVnf
            - ByteIncomingVnfCP
            - ByteOutgoingVnfCP
            - PacketIncomingVnfCP
            - PacketOutgoingVnfCP
        performanceMetricGroup:
          type: array
          items:
            type: string
            enum:
            - cpu
            - memory
            - disk
            - network
        collectionPeriod:
          maximum: 60
          minimum: 60
          type: integer
        reportingPeriod:
          maximum: 21600
          minimum: 300
          type: integer
        reportingBoundary:
          type: string
    statsFilter_filter_duration:
      type: object
      properties:
        from:
          type: string
        to:
          type: string
    statsFilter_filter:
      type: object
      properties:
        vduIds:
          type: array
          items:
            type: string
        metricGroupNames:
          type: array
          items:
            type: string
        metricNames:
          type: array
          items:
            type: string
        duration:
          $ref: '#/components/schemas/statsFilter_filter_duration'
  responses:
    InternalServerError:
      description: Internal Server Error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/errorResponse'
    BadRequest:
      description: Bad Request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/errorResponse'
    SucessStatsResponse:
      description: Accepted
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/vduStatsResponse'
    SucessPmJobCreateResponse:
      description: Accepted
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/pmJobCreateResponse'
    pmJobsResponse:
      description: OK
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/pmJobs'
    pmJobResponse:
      description: OK
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/pmJob'
    pmJobReportResponse:
      description: OK
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/pmJobReport'
  securitySchemes:
    x-hm-authorization:
      type: apiKey
      description: Obtained from /hybridity/api/session
      name: x-hm-authorization
      in: header
