openapi: 3.2.0
info:
  title: 'Forward: Internet Node API'
  summary: Model the public internet that the network uses to reach its other sites
  description: |-
    An internet node routes public addresses only, and it owns the public space that your collected infrastructure and
    connected sites do not. It is one kind of
    [synthetic device](https://docs.fwd.app/latest/application/sources/configure-collection/synthetic-devices/).
    Every network has exactly one, inert until it has connections. For the modeling details, see
    [Internet node](https://docs.fwd.app/latest/application/sources/configure-collection/synthetic-devices/reference/#internet-node).

    Changes to a network’s internet node 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: Internet Node
    description: Model the public internet that the network uses to reach its other sites
    parent: Synthetic Devices
paths:
  /networks/{networkId}/internet-node:
    get:
      tags:
        - Internet Node
      summary: Get the network’s internet node
      operationId: getInternetNode
      parameters:
        - name: networkId
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternetNode'
    put:
      tags:
        - Internet Node
      summary: Replace the network’s internet node
      operationId: putInternetNode
      parameters:
        - name: networkId
          in: path
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InternetNode'
        required: true
      responses:
        '204':
          description: No Content
          content: {}
    patch:
      tags:
        - Internet Node
      summary: Update the network’s internet node
      description: |-
        All JSON properties in the request body are optional. Include only the properties you wish to
        change.
      operationId: updateInternetNode
      parameters:
        - name: networkId
          in: path
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InternetNodePatch'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternetNode'
  /networks/{networkId}/internet-node/connections:
    get:
      tags:
        - Internet Node
      summary: Get the internet node’s connections
      operationId: getInternetNodeConnections
      parameters:
        - name: networkId
          in: path
          required: true
          schema:
            type: string
        - name: uplinkDevice
          in: query
          schema:
            type: string
        - name: uplinkPort
          in: query
          schema:
            type: string
        - name: gatewayDevice
          in: query
          schema:
            type: string
        - name: gatewayPort
          in: query
          schema:
            type: string
        - name: vlan
          in: query
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/L3SyntheticWanConnections'
    post:
      tags:
        - Internet Node
      summary: Add a connection to the internet node
      operationId: addInternetNodeConnection
      parameters:
        - name: networkId
          in: path
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/L3SyntheticWanConnection'
        required: true
      responses:
        '204':
          description: No Content
          content: {}
    delete:
      tags:
        - Internet Node
      summary: Remove internet node connections
      operationId: deleteInternetNodeConnections
      parameters:
        - name: networkId
          in: path
          required: true
          schema:
            type: string
        - name: uplinkDevice
          in: query
          schema:
            type: string
        - name: uplinkPort
          in: query
          schema:
            type: string
        - name: gatewayDevice
          in: query
          schema:
            type: string
        - name: gatewayPort
          in: query
          schema:
            type: string
        - name: vlan
          in: query
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/L3SyntheticWanConnections'
components:
  schemas:
    InternetNode:
      type: object
      required:
        - name
        - connections
      properties:
        name:
          type: string
          examples:
            - inet
        connections:
          type: array
          items:
            $ref: '#/components/schemas/L3SyntheticWanConnection'
        translations:
          type: array
          items:
            $ref: '#/components/schemas/SyntheticNatEntry'
        subnetsToExclude:
          type: array
          items:
            type: string
          description: Public subnets that should not be located at this device.
    InternetNodePatch:
      type: object
      properties:
        connections:
          type: array
          items:
            $ref: '#/components/schemas/L3SyntheticWanConnection'
          description: If specified, this list will **replace** all existing connections on the internet node.
        name:
          type: string
        translations:
          type: array
          items:
            $ref: '#/components/schemas/SyntheticNatEntry'
          description: If specified, this list will **replace** all existing translations on the internet node.
        subnetsToExclude:
          type: array
          items:
            type: string
          description: If specified, this list will **replace** all existing excluded subnets on the internet node.
    L3SyntheticWanConnection:
      type: object
      required:
        - uplinkPort
      properties:
        uplinkPort:
          $ref: '#/components/schemas/DevicePort'
          description: The physical uplink port on the edge device.
          examples:
            - device: nyc-rtr-01
              port: eth1/1
        gatewayPort:
          $ref: '#/components/schemas/DevicePort'
          description: The virtual gateway port, if different than `uplinkPort`.
          examples:
            - device: nyc-rtr-01
              port: vlan100
        vlan:
          type: integer
          format: int32
          description: The VLAN of traffic from `uplinkPort`, if tagged.
          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 physical edge port.
        vrf:
          type: string
          description: An optional name for the VRF on the synthetic device under which this connection resides.
        site:
          type: string
          description: |-
            An optional name for the site in which this connection's gateway device resides. A site is a collection of
            devices that redistribute routes learned from the synthetic device to each other. Grouping connections
            together into a single site enables more accurate site subnet autodiscovery when using `IP_ROUTES` or
            `BGP_ROUTES`.
        subnets:
          type: array
          items:
            type: string
          description: |-
            Advertised subnets. Routes for these subnets are created on the synthetic device if received by another CE.
            Required (and must not be empty) if `subnetAutoDiscovery` is `NONE`.
          examples:
            - - 123.223.47.0/24
        subnetAutoDiscovery:
          $ref: '#/components/schemas/AutoDiscoverySource'
          description: |-
            The types of routes from which advertised subnets are automatically inferred in the gateway device’s routing
            table. Defaults to `NONE`. If `INTERFACE_ADDRESSES`, the gateway port’s IP address is used. If `IP_ROUTES`,
            subnets are inferred from the gateway device’s RIB. If `BGP_ROUTES`, subnets are inferred from the gateway
            device’s Adj-RIB-Out.

            Note: If not `NONE`, routes are created on the synthetic device for both autodiscovered subnets, as well any
            subnets specified in `subnets`, that are received by another CE.

            Note: Using `BGP_ROUTES` will automatically enable collection of Adj-RIB-Out from the gateway device in
            future network collections.
          examples:
            - NONE
        peerIps:
          type: array
          items:
            type: string
          description: |-
            IP addresses of BGP peers to which this connection’s site subnets are advertised. If empty, routes
            advertised to all BGP peers are examined.

            Note: This set is only used if `subnetAutoDiscovery` is `BGP_ROUTES`.
          examples:
            - - 1.1.1.1
        backdoorLinkPorts:
          type: array
          items:
            $ref: '#/components/schemas/DevicePort'
          description: L3 interfaces that provide backdoor connectivity between sites.
        advertisesDefaultRoute:
          type: boolean
          description: |-
            Whether the CE advertises the default route. Defaults to `false`.

            Note: This property is only used if `subnetAutoDiscovery` is `IP_ROUTES`, which should be the case when BGP
            collection is not enabled on the CE. If the Adj-RIB-Out is not collected, the RIB is examined and a default
            route forwarded out `gatewayPort` is skipped if this property is false.
    L3SyntheticWanConnections:
      type: object
      required:
        - connections
      properties:
        connections:
          type: array
          items:
            $ref: '#/components/schemas/L3SyntheticWanConnection'
    DevicePort:
      type: object
      properties:
        device:
          type: string
        port:
          type: string
    AutoDiscoverySource:
      type: string
      enum:
        - NONE
        - IP_ROUTES
        - BGP_ROUTES
        - INTERFACE_ADDRESSES
    SyntheticNatEntry:
      type: object
      required:
        - insideAddress
        - outsideAddress
      properties:
        insideAddress:
          type: string
          examples:
            - 10.0.0.1
        outsideAddress:
          type: string
          description: A public (non-RFC1918) address
          examples:
            - 1.1.1.1
  securitySchemes:
    api_token:
      type: http
      scheme: basic
