openapi: 3.2.0
info:
  title: 'Forward: L2VPNs API'
  summary: Model the provider L2VPNs extending a broadcast domain across a WAN
  description: |-
    An L2VPN acts as a distributed virtual bridge, bringing every access circuit into a single broadcast domain. It is
    one kind of [synthetic device](https://docs.fwd.app/latest/application/sources/configure-collection/synthetic-devices/),
    and its connections are customer edge interfaces, each with an optional VLAN. For the modeling details, see
    [L2 VPN](https://docs.fwd.app/latest/application/sources/configure-collection/synthetic-devices/reference/#l2-vpn).

    Changes to a network’s L2VPNs affect future Snapshots.
  contact:
    email: support@forwardnetworks.com
  license:
    name: MIT
    url: https://spdx.org/licenses/MIT
  version: 26.8
servers:
  - url: /api
security:
  - api_token: []
tags:
  - name: Collection Sources
    description: Specify the devices, endpoints, and other sources to collect from
  - name: Synthetic Devices
    description: Model a network’s internet connections, intranets, L2VPNs, L3VPNs, WAN circuits, and encryptors
    parent: Collection Sources
  - name: L2VPNs
    description: Model the provider L2VPNs extending a broadcast domain across a WAN
    parent: Synthetic Devices
paths:
  /networks/{networkId}/l2-vpns:
    get:
      tags:
        - L2VPNs
      summary: Get a network’s L2VPNs
      operationId: getL2Vpns
      parameters:
        - name: networkId
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/L2VpnList'
    put:
      tags:
        - L2VPNs
      summary: Replace all of a network’s L2VPNs
      operationId: putL2Vpns
      parameters:
        - name: networkId
          in: path
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/L2VpnList'
        required: true
      responses:
        '204':
          description: No Content
          content: {}
  /networks/{networkId}/l2-vpns/{l2VpnName}:
    get:
      tags:
        - L2VPNs
      summary: Get an L2VPN
      operationId: getL2Vpn
      parameters:
        - name: networkId
          in: path
          required: true
          schema:
            type: string
        - name: l2VpnName
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/L2Vpn'
    put:
      tags:
        - L2VPNs
      summary: Add or replace an L2VPN
      operationId: putL2Vpn
      parameters:
        - name: networkId
          in: path
          required: true
          schema:
            type: string
        - name: l2VpnName
          in: path
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/L2Vpn'
        required: true
      responses:
        '204':
          description: No Content
          content: {}
    patch:
      tags:
        - L2VPNs
      summary: Update an L2VPN
      description: |-
        All JSON properties in the request body are optional. Include only the properties you wish to
        change.
      operationId: patchL2Vpn
      parameters:
        - name: networkId
          in: path
          required: true
          schema:
            type: string
        - name: l2VpnName
          in: path
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/L2VpnPatch'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/L2Vpn'
    delete:
      tags:
        - L2VPNs
      summary: Remove an L2VPN
      operationId: deleteL2Vpn
      parameters:
        - name: networkId
          in: path
          required: true
          schema:
            type: string
        - name: l2VpnName
          in: path
          required: true
          schema:
            type: string
      responses:
        '204':
          description: No Content
          content: {}
  /networks/{networkId}/l2-vpns/{l2VpnName}/connections:
    get:
      tags:
        - L2VPNs
      summary: Get an L2VPN’s connections
      operationId: getL2VpnConnections
      parameters:
        - name: networkId
          in: path
          required: true
          schema:
            type: string
        - name: l2VpnName
          in: path
          required: true
          schema:
            type: string
        - name: device
          in: query
          schema:
            type: string
        - name: port
          in: query
          schema:
            type: string
        - name: vlan
          in: query
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/L2VpnConnections'
    post:
      tags:
        - L2VPNs
      summary: Add a connection to an L2VPN
      operationId: addL2VpnConnection
      parameters:
        - name: networkId
          in: path
          required: true
          schema:
            type: string
        - name: l2VpnName
          in: path
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/L2VpnConnection'
        required: true
      responses:
        '204':
          description: No Content
          content: {}
    delete:
      tags:
        - L2VPNs
      summary: Remove an L2VPN’s connections
      operationId: deleteL2VpnConnections
      parameters:
        - name: networkId
          in: path
          required: true
          schema:
            type: string
        - name: l2VpnName
          in: path
          required: true
          schema:
            type: string
        - name: device
          in: query
          schema:
            type: string
        - name: port
          in: query
          schema:
            type: string
        - name: vlan
          in: query
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/L2VpnConnections'
components:
  schemas:
    L2Vpn:
      type: object
      required:
        - name
        - connections
      properties:
        name:
          type: string
          examples:
            - l2vpn
        connections:
          type: array
          items:
            $ref: '#/components/schemas/L2VpnConnection'
    L2VpnConnection:
      type: object
      required:
        - device
        - port
      properties:
        device:
          type: string
          description: The customer edge device.
        port:
          type: string
          description: The physical edge port on the customer edge device.
          examples:
            - eth1/1
        vlan:
          type: integer
          format: int32
          examples:
            - 100
        name:
          type: string
          description: |-
            An optional name for this connection, which will be used as the interface name created on the synthetic
            device that links to the customer edge device.
    L2VpnConnections:
      type: object
      required:
        - connections
      properties:
        connections:
          type: array
          items:
            $ref: '#/components/schemas/L2VpnConnection'
    L2VpnList:
      type: object
      required:
        - l2Vpns
      properties:
        l2Vpns:
          type: array
          items:
            $ref: '#/components/schemas/L2Vpn'
    L2VpnPatch:
      type: object
      properties:
        connections:
          type: array
          items:
            $ref: '#/components/schemas/L2VpnConnection'
          description: If specified, this list will **replace** all existing connections on the L2 VPN node.
        name:
          type: string
  securitySchemes:
    api_token:
      type: http
      scheme: basic
