# Copyright 2022-2024 ETSI OSG/SDG TeraFlowSDN (TFS) (https://tfs.etsi.org/)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

---
swagger: "2.0"
info:
  description: "connection API generated from yang definitions"
  version: "1.0"
  title: "connection API"
host: "localhost:1234"
consumes:
- "application/yang-data+json"
produces:
- "application/yang-data+json"
paths:
  /data/connection/:
    post:
      tags:
      - "connection"
      description: "creates connection.Connection"
      parameters:
      - in: "body"
        name: "connection.Connection.body-param"
        description: "connection.Connection to be added to list"
        required: false
        schema:
          $ref: "#/definitions/connection.Connection"
      responses:
        201:
          description: "Object created"
        400:
          description: "Internal error"
        409:
          description: "Object already exists"
  /data/connection={connection-id}/:
    get:
      tags:
      - "connection"
      description: "returns connection.Connection"
      parameters:
      - name: "connection-id"
        in: "path"
        description: "Id of connection"
        required: true
        type: "string"
      responses:
        200:
          description: "connection.Connection"
          schema:
            $ref: "#/definitions/connection.Connection"
        400:
          description: "Internal error"
    post:
      tags:
      - "connection"
      description: "creates connection.Connection"
      parameters:
      - name: "connection-id"
        in: "path"
        description: "Id of connection"
        required: true
        type: "string"
      - in: "body"
        name: "connection.Connection.body-param"
        description: "connection.Connection to be added to list"
        required: false
        schema:
          $ref: "#/definitions/connection.Connection"
      responses:
        201:
          description: "Object created"
        400:
          description: "Internal error"
        409:
          description: "Object already exists"
    put:
      tags:
      - "connection"
      description: "creates or updates connection.Connection"
      parameters:
      - name: "connection-id"
        in: "path"
        description: "Id of connection"
        required: true
        type: "string"
      - in: "body"
        name: "connection.Connection.body-param"
        description: "connection.Connection to be added or updated"
        required: false
        schema:
          $ref: "#/definitions/connection.Connection"
      responses:
        201:
          description: "Object created"
        400:
          description: "Internal error"
        204:
          description: "Object modified"
    delete:
      tags:
      - "connection"
      description: "removes connection.Connection"
      parameters:
      - name: "connection-id"
        in: "path"
        description: "Id of connection"
        required: true
        type: "string"
      responses:
        400:
          description: "Internal error"
        204:
          description: "Object deleted"
definitions:
  connection.Connection:
    type: "object"
    properties:
      target-port:
        type: "string"
        x-path: "/topology:topology/topology:node/topology:port/topology:port-id"
      source-port:
        type: "string"
        x-path: "/topology:topology/topology:node/topology:port/topology:port-id"
      target-node:
        type: "string"
        x-path: "/topology:topology/topology:node/topology:node-id"
      connection-id:
        type: "string"
      bandwidth:
        type: "integer"
        format: "int64"
      source-node:
        type: "string"
        x-path: "/topology:topology/topology:node/topology:node-id"
      layer-protocol-name:
        $ref: "#/definitions/topology.LayerProtocolName"
  topology.LayerProtocolName:
    type: "string"
    enum:
    - "ETH"
    - "OPTICAL"
