components:
  responses: {}
  schemas:
    GlobalNamedObject:
      type: object
      properties:
        name:
          description: |-
            Unique identifier for an object
          type: string
          format: global-unique
    Error.Details:
      type: object
      properties:
        errors:
          type: array
          items:
            $ref: '#/components/schemas/Error.Item'
    Warning.Details:
      type: object
      properties:
        warnings:
          type: array
          items:
            $ref: '#/components/schemas/Error.Item'
    Error.Item:
      type: object
      properties:
        message:
          type: string
        code:
          type: integer
        detail:
          type: string
    Config:
      description: |-
        The resources that define a fabric configuration.
      type: object
      properties:
        hosts:
          type: array
          items:
            $ref: '#/components/schemas/Host'
        fabric:
          $ref: '#/components/schemas/Fabric'
        dataflow:
          $ref: '#/components/schemas/Dataflow'
        chaos:
          $ref: '#/components/schemas/Chaos'
    Host:
      required:
      - address
      - name
      properties:
        name:
          description: |-
            The name, uniquely identifying the host
          type: string
        address:
          description: |-
            The test address of the host
          type: string
        prefix:
          description: |-
            The prefix of the host
          type: integer
          default: 24
    Fabric:
      type: object
      properties:
        choice:
          type: string
          enum:
          - spine_pod_rack
        spine_pod_rack:
          $ref: '#/components/schemas/Fabric.SpinePodRack'
        qos_profiles:
          description: |-
            A list of Quality of Service (QoS) profiles
          type: array
          items:
            $ref: '#/components/schemas/Fabric.QosProfile'
    Fabric.SpinePodRack:
      description: |-
        An emulation of a spine/pod/rack topology
      type: object
      properties:
        spines:
          description: |-
            The spines in the topology.
          type: array
          items:
            $ref: '#/components/schemas/Fabric.Spine'
        pods:
          description: |-
            The pods in the topology.
          type: array
          items:
            $ref: '#/components/schemas/Fabric.Pod'
        host_links:
          type: array
          items:
            $ref: '#/components/schemas/SwitchHostLink'
        pod_profiles:
          description: |-
            A list of pod profiles
          type: array
          items:
            $ref: '#/components/schemas/Fabric.PodProfile'
        rack_profiles:
          description: |-
            A list of rack profiles
          type: array
          items:
            $ref: '#/components/schemas/Fabric.RackProfile'
    Fabric.Spine:
      type: object
      properties:
        count:
          description: |-
            The number of spines to be created with each spine sharing the same
            downlink_ecmp_mode and qos_profile_name properties.
          type: integer
          default: 1
        downlink_ecmp_mode:
          description: "The algorithm for packet distribution over ECMP links.\n-\
            \ random_spray randomly puts each packet on an ECMP member links \n- hash_3_tuple\
            \ is a 3 tuple hash of ipv4 src, dst, protocol\n- hash_5_tuple is static_hash_ipv4_l4\
            \ but a different resulting RTAG7 hash mode"
          type: string
          enum:
          - random_spray
          - hash_3_tuple
          - hash_5_tuple
        qos_profile_name:
          description: |
            The name of a qos profile shared by the spines.

            x-constraint:
            - #/components/schemas/QosProfile/properties/name
          type: string
          x-constraint:
          - '#/components/schemas/QosProfile/properties/name'
    Fabric.Pod:
      type: object
      properties:
        count:
          description: |-
            The number of pods that will share the same profile
          type: integer
          default: 1
        pod_profile_name:
          description: |-
            The pod profile associated with this pod.
          type: array
          items:
            type: string
            x-constraint:
            - '#/components/schemas/PodProfile/properties/name'
            description: |
              TBD

              x-constraint:
              - #/components/schemas/PodProfile/properties/name
    Fabric.PodProfile:
      type: object
      properties:
        name:
          type: string
        pod_switch:
          $ref: '#/components/schemas/Fabric.PodSwitch'
        rack:
          $ref: '#/components/schemas/Fabric.Rack'
    Fabric.PodSwitch:
      type: object
      properties:
        count:
          type: integer
          default: 1
        pod_to_spine_oversubscription:
          description: |-
            oversubscription ratio of the pod switches
          type: string
        uplink_ecmp_mode:
          description: "The algorithm for packet distribution over ECMP links.\n-\
            \ random_spray randomly puts each packet on an ECMP member links \n- hash_3_tuple\
            \ is a 3 tuple hash of ipv4 src, dst, protocol\n- hash_5_tuple is static_hash_ipv4_l4\
            \ but a different resulting RTAG7 hash mode"
          type: string
          enum:
          - random_spray
          - hash_3_tuple
          - hash_5_tuple
        downlink_ecmp_mode:
          description: "The algorithm for packet distribution over ECMP links.\n-\
            \ random_spray randomly puts each packet on an ECMP member links \n- hash_3_tuple\
            \ is a 3 tuple hash of ipv4 src, dst, protocol\n- hash_5_tuple is static_hash_ipv4_l4\
            \ but a different resulting RTAG7 hash mode"
          type: string
          enum:
          - random_spray
          - hash_3_tuple
          - hash_5_tuple
        qos_profile_name:
          description: |
            The name of a qos profile associated with this pod switch.

            x-constraint:
            - #/components/schemas/QosProfile/properties/name
          type: string
          x-constraint:
          - '#/components/schemas/QosProfile/properties/name'
    Fabric.Rack:
      type: object
      properties:
        count:
          type: integer
          description: |-
            number of racks (and thus ToRs) in the pod
          default: 1
        rack_profile_names:
          description: |-
            The names of rack profiles associated with this rack.
          type: array
          items:
            type: string
            x-constraint:
            - '#/components/schemas/RackProfile/properties/name'
            description: |
              TBD

              x-constraint:
              - #/components/schemas/RackProfile/properties/name
    Fabric.RackProfile:
      type: object
      properties:
        name:
          type: string
        tor_uplink_ecmp_mode:
          description: "The algorithm for packet distribution over ECMP links.\n-\
            \ random_spray randomly puts each packet on an ECMP member links \n- hash_3_tuple\
            \ is a 3 tuple hash of ipv4 src, dst, protocol\n- hash_5_tuple is static_hash_ipv4_l4\
            \ but a different resulting RTAG7 hash mode"
          type: string
          enum:
          - random_spray
          - hash_3_tuple
          - hash_5_tuple
        tor_downlink_ecmp_mode:
          description: "The algorithm for packet distribution over ECMP links.\n-\
            \ random_spray randomly puts each packet on an ECMP member links \n- hash_3_tuple\
            \ is a 3 tuple hash of ipv4 src, dst, protocol\n- hash_5_tuple is static_hash_ipv4_l4\
            \ but a different resulting RTAG7 hash mode"
          type: string
          enum:
          - random_spray
          - hash_3_tuple
          - hash_5_tuple
        tor_qos_profile_name:
          description: |
            The name of a qos profile associated with the ToR of this rack

            x-constraint:
            - #/components/schemas/QosProfile/properties/name
          type: string
          x-constraint:
          - '#/components/schemas/QosProfile/properties/name'
        tor_to_pod_oversubscription:
          description: |-
            The oversubscription ratio of the ToR switch
          type: string
    Fabric.QosProfile:
      type: object
      required:
      - name
      properties:
        name:
          type: string
        ingress_admission:
          $ref: '#/components/schemas/Fabric.QosProfile.IngressAdmission'
        scheduler:
          $ref: '#/components/schemas/Fabric.QosProfile.Scheduler'
        packet_classification:
          $ref: '#/components/schemas/Fabric.QosProfile.PacketClassification'
    Fabric.QosProfile.IngressAdmission:
      type: object
      properties:
        reserved_buffer_bytes:
          description: |-
            Buffer space (in bytes) reserved for each port that this Qos profile applies to
          type: integer
          default: 0
        shared_buffer_bytes:
          description: |-
            Amount of shared buffer space (in bytes) available
          type: integer
          default: 0
    Fabric.QosProfile.Scheduler:
      type: object
      properties:
        scheduler_mode:
          description: "The queue scheduling discipline "
          type: string
          enum:
          - strict_priority
          - weighted_round_robin
        weight_list:
          description: |-
            A list of queue weights
          type: array
          items:
            type: integer
    Fabric.QosProfile.PacketClassification:
      type: object
      properties:
        map_dscp_to_traffic_class:
          $ref: '#/components/schemas/Fabric.QosProfile.PacketClassification.Map'
        map_traffic_class_to_queue:
          $ref: '#/components/schemas/Fabric.QosProfile.PacketClassification.Map'
    Fabric.QosProfile.PacketClassification.Map:
      type: object
      additionalProperties:
        type: string
    SwitchHostLink:
      type: object
      description: "The ingress point of a host which is the index of a spine switch,\
        \ \na pod/rack switch."
      required:
      - host_name
      properties:
        host_name:
          type: string
          x-constraint:
          - '#components/schemas/Host/properties/name'
          description: |
            TBD

            x-constraint:
            - #components/schemas/Host/properties/name
        front_panel_port:
          type: integer
          description: |-
            Optional front panel port number, if fabric is rendered on physical box
        choice:
          type: string
          enum:
          - spine
          - pod
          - rack
          default: rack
        spine:
          description: "One based index of the spine switch based on the number of\
            \ spines \nconfigured in the spine_pod_rack topology."
          type: integer
          minimum: 1
        pod:
          $ref: '#/components/schemas/SwitchHostLink.SwitchRef'
        rack:
          $ref: '#/components/schemas/SwitchHostLink.SwitchRef'
    SwitchHostLink.SwitchRef:
      description: |-
        Location of the switch based on pod and switch index
      type: object
      properties:
        pod_index:
          description: |-
            One-based index of the pod based on the number of pods in the fabric
          type: integer
          default: 1
          minimum: 1
        switch_index:
          description: |-
            One-based index of the pod or rack switch in the indicated pod
          type: integer
          default: 1
          minimum: 1
    Dataflow:
      type: object
      properties:
        host_management:
          type: array
          items:
            $ref: '#/components/schemas/Dataflow.HostManagement'
        workload:
          description: |-
            The workload items making up the dataflow
          type: array
          items:
            $ref: '#/components/schemas/Dataflow.WorkloadItem'
        flow_profiles:
          description: |-
            foo
          type: array
          items:
            $ref: '#/components/schemas/Dataflow.FlowProfile'
    Dataflow.FlowProfile:
      type: object
      required:
      - name
      - data_size
      properties:
        name:
          type: string
        data_size:
          type: integer
        l2_protocol_choice:
          description: |-
            layer2 protocol selection
          type: string
          enum:
          - ethernet
        ethernet:
          $ref: '#/components/schemas/Dataflow.FlowProfile.Ethernet'
        l4_protocol_choice:
          description: |-
            layer4 protocol selection
          type: string
          enum:
          - tcp
          - udp
        tcp:
          $ref: '#/components/schemas/Dataflow.FlowProfile.Tcp'
        udp:
          $ref: '#/components/schemas/Dataflow.FlowProfile.Udp'
    Dataflow.FlowProfile.Ethernet:
      type: object
      properties:
        mtu:
          type: integer
          description: |-
            Maximum Transmission Unit
          default: 1500
    Dataflow.FlowProfile.Tcp:
      type: object
      properties:
        congestion_algorithm:
          default: cubic
          description: |-
            The TCP congestion algorithm:
            bbr - Bottleneck Bandwidth and Round-trip propagation time
            dctcp - Data center TCP
            cubic - cubic window increase function
            reno - TCP New Reno
          type: string
          enum:
          - bbr
          - dctcp
          - cubic
          - reno
        initcwnd:
          description: |-
            initial congestion window
          type: integer
        send_buf:
          description: |-
            send buffer size
          type: integer
        receive_buf:
          description: |-
            receive buffer size
          type: integer
        destination_port:
          $ref: '#/components/schemas/L4PortRange'
        source_port:
          $ref: '#/components/schemas/L4PortRange'
    L4PortRange:
      description: |-
        Layer4 protocol source or destination port values
      type: object
      properties:
        choice:
          description: |-
            None
          type: string
          enum:
          - single_value
          - range
        single_value:
          $ref: '#/components/schemas/L4PortRange.SingleValue'
        range:
          $ref: '#/components/schemas/L4PortRange.Range'
    L4PortRange.SingleValue:
      type: object
      properties:
        value:
          type: integer
          default: 1
    L4PortRange.Range:
      type: object
      properties:
        start_value:
          type: integer
          default: 1
        increment:
          type: integer
          default: 1
          minimum: 1
    Dataflow.FlowProfile.Udp:
      type: object
    Dataflow.WorkloadItem:
      type: object
      required:
      - name
      - choice
      properties:
        name:
          description: |-
            uniquely identifies the workload item
          type: string
        choice:
          description: |-
            The type of workflow item
          type: string
          enum:
          - scatter
          - gather
          - all_reduce
          - loop
          - compute
          - broadcast
          - all_to_all
        scatter:
          $ref: '#/components/schemas/Dataflow.ScatterWorkload'
        gather:
          $ref: '#/components/schemas/Dataflow.GatherWorkload'
        loop:
          $ref: '#/components/schemas/Dataflow.LoopWorkload'
        compute:
          $ref: '#/components/schemas/Dataflow.ComputeWorkload'
        all_reduce:
          $ref: '#/components/schemas/Dataflow.AllReduceWorkload'
        broadcast:
          $ref: '#/components/schemas/Dataflow.BroadcastWorkload'
        all_to_all:
          $ref: '#/components/schemas/Dataflow.AlltoallWorkload'
    Dataflow.ScatterWorkload:
      type: object
      properties:
        sources:
          description: |-
            list of host names, indicating the originator of the data
          type: array
          items:
            type: string
        destinations:
          description: |-
            list of host names, indicating the destination of the data
          type: array
          items:
            type: string
        flow_profile_name:
          description: |-
            flow profile reference
          type: string
    Dataflow.BroadcastWorkload:
      type: object
      properties:
        sources:
          description: |-
            list of host names, indicating the originator of the data
          type: array
          items:
            type: string
        destinations:
          description: |-
            list of host names, indicating the destination of the data
          type: array
          items:
            type: string
        flow_profile_name:
          description: |-
            flow profile reference
          type: string
    Dataflow.GatherWorkload:
      type: object
      properties:
        sources:
          description: |-
            list of host names, indicating the originator of the data
          type: array
          items:
            type: string
        destinations:
          description: |-
            list of host names, indicating the destination of the data
          type: array
          items:
            type: string
        flow_profile_name:
          description: |-
            flow profile reference
          type: string
    Dataflow.AllReduceWorkload:
      type: object
      properties:
        nodes:
          type: array
          items:
            type: string
        flow_profile_name:
          description: |-
            flow profile reference
          type: string
        type:
          description: |-
            type of all reduce
          type: string
          enum:
          - ring
          - tree
          - butterfly
          default: ring
    Dataflow.AlltoallWorkload:
      type: object
      description: |-
        creates full-mesh flows between all nodes
      properties:
        nodes:
          type: array
          items:
            type: string
        flow_profile_name:
          description: |-
            flow profile reference
          type: string
    Dataflow.ComputeWorkload:
      type: object
      properties:
        nodes:
          type: array
          items:
            type: string
        choice:
          description: |-
            type of compute
          type: string
          enum:
          - simulated
        simulated:
          $ref: '#/components/schemas/Dataflow.SimulatedComputeWorkload'
    Dataflow.SimulatedComputeWorkload:
      type: object
      properties:
        duration:
          description: |-
            duration of the simulated compute workload in seconds
          type: number
    Dataflow.LoopWorkload:
      type: object
      properties:
        iterations:
          description: |-
            number of iterations in the loop
          type: integer
        children:
          description: |-
            list of workload items that are executed in this loop
          type: array
          items:
            $ref: '#/components/schemas/Dataflow.WorkloadItem'
    Dataflow.HostManagement:
      type: object
      description: |-
        auxillary host information needed to run dataflow experiments
      required:
      - host_name
      - management_address
      - nic_name
      properties:
        host_name:
          type: string
          x-constraint:
          - '#components/schemas/Host/properties/name'
          description: |
            TBD

            x-constraint:
            - #components/schemas/Host/properties/name
        management_address:
          type: string
          description: |-
            Hostname or address of management interface of a server running dataflow traffic
        nic_name:
          type: string
          description: |-
            unique idenfier for the network interface card (nic), e.g. "eth1"
    Chaos:
      type: object
      properties:
        background_traffic:
          $ref: '#/components/schemas/Chaos.BackgroundTraffic'
    Chaos.BackgroundTraffic:
      type: object
      properties:
        flows:
          type: array
          items:
            $ref: '#/components/schemas/Chaos.BackgroundTraffic.Flow'
    Chaos.BackgroundTraffic.Flow:
      type: object
      properties:
        name:
          type: string
        fabric_entry_point:
          $ref: '#/components/schemas/Chaos.BackgroundTraffic.Flow.EntryPoint'
        choice:
          type: string
          enum:
          - stateless
        stateless:
          type: array
          items:
            $ref: '#/components/schemas/Chaos.BackgroundTraffic.Flow.Stateless'
    Chaos.BackgroundTraffic.Flow.EntryPoint:
      type: object
      properties:
        choice:
          type: string
          enum:
          - switch_reference
          - front_panel_port
        switch_reference:
          $ref: '#/components/schemas/Chaos.BackgroundTraffic.Flow.EntryPoint.SwitchReference'
        front_panel_port:
          $ref: '#/components/schemas/Chaos.BackgroundTraffic.Flow.EntryPoint.FrontPanelPort'
    Chaos.BackgroundTraffic.Flow.EntryPoint.SwitchReference:
      type: object
      properties:
        choice:
          type: string
          enum:
          - spine
          - pod
          - tor
        spine:
          $ref: '#/components/schemas/Chaos.BackgroundTraffic.Flow.EntryPoint.SwitchReference.Spine'
        pod:
          $ref: '#/components/schemas/Chaos.BackgroundTraffic.Flow.EntryPoint.SwitchReference.PodSwitchReference'
        tor:
          $ref: '#/components/schemas/Chaos.BackgroundTraffic.Flow.EntryPoint.SwitchReference.PodSwitchReference'
    Chaos.BackgroundTraffic.Flow.EntryPoint.SwitchReference.Spine:
      type: object
      properties:
        switch_index:
          type: integer
    Chaos.BackgroundTraffic.Flow.EntryPoint.SwitchReference.PodSwitchReference:
      type: object
      properties:
        pod_index:
          type: integer
        switch_index:
          type: integer
    Chaos.BackgroundTraffic.Flow.EntryPoint.FrontPanelPort:
      type: object
      properties:
        front_panel_port:
          type: integer
          description: |-
            Front panel port number (if fabric is emulated on a device with front panel ports)
    Chaos.BackgroundTraffic.Flow.Stateless:
      type: object
      properties:
        name:
          type: string
        rate:
          type: integer
        rate_unit:
          type: string
          enum:
          - bps
          - Kbps
          - Mbps
          - Gbps
        packet:
          $ref: '#/components/schemas/Chaos.BackgroundTraffic.Flow.Stateless.Packet'
    Chaos.BackgroundTraffic.Flow.Stateless.Packet:
      type: object
      properties:
        src_address:
          description: |-
            source IP address
          type: string
        dst_address:
          description: |-
            destination IP address
          type: string
        src_port:
          type: integer
          description: |-
            Layer 4 source port
          maximum: 65535
          default: 1024
        dst_port:
          type: integer
          description: |-
            Layer 4 destination port
          maximum: 65535
          default: 1024
        size:
          type: integer
          description: |-
            total packet size
          minimum: 64
          default: 1000
        l4_protocol:
          type: string
          description: |-
            Layer 4 transport protocol
          enum:
          - tcp
          - udp
openapi: 3.0.3
info:
  title: ONEx Data Models
  description: |-
    The data models for the entire ONEx ecosystem
  version: 0.0.1
  contact:
    x-info: "Any feedback such as bugs/enhancements/questions regarding the \nONEx\
      \ data models is welcomed by using the contact url."
    url: https://github.com/onex/models/issues
  license:
    name: MIT
servers:
- url: /
paths:
  /config:
    post:
      tags:
      - Configuration
      operationId: set_config
      description: |-
        unused
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Config'
      responses:
        '400':
          description: |-
            error 4xx
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error.Details'
        '500':
          description: |-
            error 5xx
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error.Details'
        '200':
          description: |-
            Success with possible warnings
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Warning.Details'
