openapi: 3.0.3
info:
  title: QoS Profiles
  description: |
    The Qualtiy-of-Service (QoS) Profiles API provides a set of predefined network performance characteristics, such as latency, throughput, and priority, identified by a unique name. These profiles allow application developers to specify the desired network behavior for their application's data traffic, ensuring optimal performance. By selecting an appropriate QoS profile, developers can request stable latency (reduced jitter) or throughput for specific data flows between client devices and application servers when used by the Quality-On-Demand APIs.

    # Introduction

    QoS Profiles are used in conjunction with other Quality-On-Demand APIs, to offer the API consumer the capability to request for stable latency (reduced jitter) or throughput for some specified application data flows between application clients (within a user device) and Application Servers (backend services). The API consumer has a pre-defined set of Quality of Service (QoS) profiles which they could choose from depending on their latency or throughput requirements. The QoS profiles are defined by the API provider and are mapped to the connectivity characteristics of the supported networks.

    # API functionality

    The QoS Profiles API provides the following functionality:
    - Discover all QoS profiles offered by the API provider
    - Discover the available QoS profiles for a specific device
    - Retrieve the characteristics of a specific QoS profile by name

    How QoS profiles are mapped to connectivity characteristics are subject to agreements between the API provider and the API consumer. Within the CAMARA project, you can find a sample for such a mapping of QoS profiles. [CAMARA QoS Profiles Mapping Table (REFERENCE DRAFT)](https://github.com/camaraproject/QualityOnDemand/blob/main/documentation/API_documentation/QoSProfile_Mapping_Table.md)

    # Authorization and authentication

    The "Camara Security and Interoperability Profile" provides details of how an API consumer requests an access token. Please refer to Identity and Consent Management (https://github.com/camaraproject/IdentityAndConsentManagement/) for the released version of the profile.

    The specific authorization flows to be used will be agreed upon during the onboarding process, happening between the API consumer and the API provider, taking into account the declared purpose for accessing the API, whilst also being subject to the prevailing legal framework dictated by local legislation.

    In cases where personal data is processed by the API and users can exercise their rights through mechanisms such as opt-in and/or opt-out, the use of three-legged access tokens is mandatory. This ensures that the API remains in compliance with privacy regulations, upholding the principles of transparency and user-centric privacy-by-design.

    # Identifying the device from the access token

    The two operations defined by this API (`getQosProfile` and `retrieveQoSProfiles`) both allow the API consumer to use a three-legged access token to specify a target device as a query filter. When provided, only profiles available to the specified target device will be returned. Additionally, when a two-legged access token is used, the operation `retrieveQoSProfiles` allows the API consumer to optionally specify the target device in the request body.

    Hence, for the `retrieveQoSProfiles` operation:
    - When invoked using a two-legged access token, the optional input device object will be used as filter if present.

    - When invoked using a three-legged access token, this optional identifier in the request body MUST NOT be provided, as the device to filter will be uniquely identified from the access token.

    This approach simplifies API usage for API consumers using a three-legged access token to invoke the API by relying on the information that is associated with the access token and was identified during the authentication process.

    ## Error handling:
    - If the device can be identified from the access token and the optional `device` object is also included in the request, then the server will return an error with the `422 UNNECESSARY_IDENTIFIER` error code. This will be the case even if the same device is identified by these two methods, as the server is unable to make this comparison.

    # Multi-SIM scenario handling

    In multi-SIM scenarios where more than one mobile device is associated with a phone number (e.g. a smartphone with an associated smartwatch), it might not be possible to uniquely identify a single device from that phone number. When filtering QoS profiles by device in such scenarios, one of the following options should be used:
    - Use the authorisation code flow to obtain a 3-legged access token, which will automatically identify the intended device
    - Identify the intended device from a unique identifier for that device, such as its source IP address and port
    - Check with the SIM provider whether a unique "secondary" phone number is already associated with each device, and use the secondary phone number to identify the intended device if available

    # Additional CAMARA error responses

    The list of error codes in this API specification is not exhaustive. Therefore the API specification may not document some non-mandatory error statuses as indicated in `CAMARA API Design Guide`.

    Please refer to the `CAMARA_common.yaml` of the Commonalities Release associated to this API version for a complete list of error responses. The applicable Commonalities Release can be identified in the `API Readiness Checklist` document associated to this API version.

    As a specific rule, error `501 - NOT_IMPLEMENTED` can be only a possible error response if it is explicitly documented in the API.

  # license:
  #   name: Apache 2.0
  #   url: https://www.apache.org/licenses/LICENSE-2.0.html
  version: wip
#   x-camara-commonalities: 0.5


# externalDocs:
#   description: Project documentation at Camara
#   url: https://github.com/camaraproject/QualityOnDemand

servers:
  - url: https://api-sandbox.vf-dmp.engineering.vodafone.com/qos-profiles/v1
    description: "Sandbox"
  - url: https://api.vf-dmp.engineering.vodafone.com/qos-profiles/v1
    description: "Production"

tags:
  - name: QoS Profiles
    description: Manage QoS Profiles

paths:
  /retrieve-qos-profiles:
    post:
      tags:
        - QoS Profiles
      summary: Retrieve QoS profiles
      description: |
        Returns all QoS Profiles that match the given criteria.
        **NOTES:**
        - The access token may be either a 2-legged or 3-legged access token.
        - If the access token is 3-legged, all returned QoS Profiles will be available to the subject (device) associated with the access token.
        - If the access token is 2-legged and a device filter is provided, all returned QoS Profiles will be available to that device. If multiple device identifiers are provided within the device property, only QoS Profiles available to the device identifier chosen by the implementation will be returned, even if the identifiers do not match the same device. API provider does not perform any logic to validate/correlate that the indicated device identifiers match the same device. No error should be returned if the identifiers are otherwise valid to prevent API consumers correlating different identifiers with a given end user.
        - This call uses the POST method instead of GET to comply with the CAMARA Commonalities guidelines for sending sensitive or complex data in API calls. Since the device field may contain personally identifiable information, it should not be sent via GET. Additionally, this call may include complex data structures.
          [CAMARA API Design Guidelines](https://github.com/camaraproject/Commonalities/blob/r2.3/documentation/API-design-guidelines.md#post-or-get-for-transferring-sensitive-or-complex-data)
      security:
        - oAuth2ClientCredentials: []
      # security:
      #   - openId:
      #       - qos-profiles:create
      operationId: retrieveQoSProfiles
      parameters:
        - $ref: "#/components/parameters/x-correlator"
      requestBody:
        description: Parameters to query QoS Profiles for a given device
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/QosProfileDeviceRequest"
        required: true
      responses:
        "200":
          description: Contains information about QoS Profiles
          headers:
            x-correlator:
              $ref: '#/components/headers/x-correlator'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/QosProfile"
              examples:
                List of QoS Profiles:
                  $ref: "#/components/examples/LIST_OF_QOS_PROFILES"
        "400":
          $ref: "#/components/responses/Generic400"
        "401":
          $ref: "#/components/responses/Generic401"
        "403":
          $ref: "#/components/responses/Generic403"
        "404":
          $ref: "#/components/responses/GenericDevice404"
        "422":
          $ref: "#/components/responses/Generic422"
        "429":
          $ref: "#/components/responses/Generic429"

  /qos-profiles/{name}:
    get:
      tags:
        - QoS Profiles
      summary: "Get QoS Profile for a given name"
      operationId: getQosProfile
      description: |
        Returns a QoS Profile that matches the given name.

        The access token may be either a 2-legged or 3-legged access token. If the access token is 3-legged, a QoS Profile is only returned if available to all subjects associated with the access token.
      security:
        - oAuth2ClientCredentials: []
      # security:
      #   - openId:
      #       - qos-profiles:read
      parameters:
        - name: name
          in: path
          description: Qos Profile name
          required: true
          schema:
            $ref: "#/components/schemas/QosProfileName"
        - $ref: "#/components/parameters/x-correlator"
      responses:
        "200":
          description: Contains information about QoS Profiles
          headers:
            x-correlator:
              $ref: '#/components/headers/x-correlator'
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/QosProfile"
        "400":
          $ref: "#/components/responses/Generic400"
        "401":
          $ref: "#/components/responses/Generic401"
        "403":
          $ref: "#/components/responses/Generic403"
        "404":
          $ref: "#/components/responses/Generic404"
        "429":
          $ref: "#/components/responses/Generic429"

  /ping:
    get:
      tags:
        - Monitoring
      summary: Check the upstream system is up and running.
      description: |-
        This API is to check the upstream system is up and running.

      security:
        - oAuth2ClientCredentials: []

      operationId: getPing

      parameters:
        - $ref: "#/components/parameters/x-correlator"

      responses:
        "200":
          description: "**OK**"
          content:
            application/json:
              examples:
                success_response:
                  value: {
                            "suffix": "/ping",
                            "client": "35.191.13.203",
                            "startTime": "2023-06-05T19:47:16.794Z",
                            "endTime": "2023-06-05T19:47:16.888Z",
                            "responseTime": 94,
                            "message": "PONG"
                          }
        "400":
          $ref: "#/components/responses/Generic400"
        "401":
          $ref: "#/components/responses/Generic401"

components:

  securitySchemes:
    oAuth2ClientCredentials:
      type: oauth2
      description: Oath2 grant type clientCredentials
      flows: 
        clientCredentials: 
          tokenUrl: /oauth2/v1/token
          scopes: 
            qos-profiles:read: " "
            qos-profiles:create: " "
  # securitySchemes:
  #   openId:
  #     type: openIdConnect
  #     openIdConnectUrl: https://example.com/.well-known/openid-configuration

  parameters:
    x-correlator:
      name: x-correlator
      in: header
      description: Correlation id for the different services
      schema:
        $ref: "#/components/schemas/XCorrelator"

  headers:
    x-correlator:
      description: Correlation id for the different services
      schema:
        $ref: "#/components/schemas/XCorrelator"

  schemas:
    XCorrelator:
      description: Value for the x-correlator
      type: string
      pattern: ^[a-zA-Z0-9-_:;.\/<>{}]{0,256}$
      example: "b4333c46-49c0-4f62-80d7-f0ef930f1c46"

    QosProfile:
      description: |
        Data type with attributes of a QosProfile
      type: object
      properties:
        name:
          $ref: "#/components/schemas/QosProfileName"
        description:
          description: |
            A description of the QoS profile.
          type: string
          example: "QoS profile for video streaming"
        status:
          $ref: "#/components/schemas/QosProfileStatusEnum"
        countryAvailability:
          description: |
            A list of countries, and optionally networks, for which the API provider makes the profile available.
            - When profiles are filtered for a specific device (i.e. using a 3-legged access token or an explicit device filter parameter), the profile can be used by that device in any of these countries when connected to any of the listed networks (assuming roaming is permitted for networks that are not the device's home network), or the API provider's own network if no networks are listed
            - When there is no device filter, availability for a given country means that the QoS profile may be available to some devices connected to the listed networks in that country (or to the API provider’s default network if none are listed). However, this does not imply that the profile is available to all devices, or that a particular device will be able to use the profile across all listed countries or networks. In particular, the response does not provide enough information to determine availability for roaming for specific devices; consumers should query the API with a specific device identifier to get definitive availability.
            - If this field is not present in the QoS profile, no assumption can be made about the availability of the profile in any given country or for any given network
          allOf:
            - $ref: "#/components/schemas/Availability"
        targetMinUpstreamRate:
          description: |
            This is the target minimum upload speed for the QoS profile.
            It represents the minimum rate that the network attempts to deliver.
            Please note that this is a target value—the network might not always be able to provide this rate under all conditions.
            It helps ensure that applications like video calls or live streaming perform consistently.
          allOf:
            - $ref: "#/components/schemas/Rate"
        maxUpstreamRate:
          description: |
            The maximum best effort data
          allOf:
            - $ref: "#/components/schemas/Rate"
        maxUpstreamBurstRate:
          description: |
            When defined, this is the maximum upstream burst rate for the QoS profile, that will enable
            the network to burst data at a higher rate than the maxUpstreamRate for a period of time.
          allOf:
            - $ref: "#/components/schemas/Rate"
        targetMinDownstreamRate:
          description: |
            This is the target maximum upload speed for the QoS profile.
            It represents the maximum rate that the network attempts to deliver.
            Please note that this is a target value—the network might not always be able to provide this rate under all conditions.
            It helps ensure that applications like video calls or live streaming perform consistently.
          allOf:
            - $ref: "#/components/schemas/Rate"
        maxDownstreamRate:
          description: |
            The maximum best effort rate
          allOf:
            - $ref: "#/components/schemas/Rate"
        maxDownstreamBurstRate:
          description: |
            When defined, this is the maximum downstream burst rate for the QoS profile, that will enable
            the network to burst data at a higher rate than the maxDownstreamRate for a period of time.
            This can result in improved user experience when there is additional network capacity.
            For instance, when a user is streaming a video, the network can burst data at a higher rate
            to fill the buffer, and then return to the maxUpstreamRate once the buffer is full.
          allOf:
            - $ref: "#/components/schemas/Rate"
        minDuration:
          description: |
            The shortest time period that this profile can be deployed.
          allOf:
            - $ref: "#/components/schemas/Duration"
        maxDuration:
          description: |
            The maximum time period that this profile can be deployed.
            Overall session duration must not exceed this value. This includes the initial requested duration plus any extensions.
          allOf:
            - $ref: "#/components/schemas/Duration"
        priority:
          type: integer
          example: 20
          description: |
            Priority levels allow efficient resource allocation and ensure optimal performance
            for various services in each technology, with the highest priority traffic receiving
            preferential treatment.
            The lower value the higher priority.
            Not all access networks use the same priority range, so this priority will be
            scaled to the access network's priority range.
          format: int32
          minimum: 1
          maximum: 100
        packetDelayBudget:
          description: |
            The packet delay budget is the maximum allowable one-way latency between the customer's device
            and the gateway from the operator's network to other networks. By limiting the delay, the network
            can provide an acceptable level of performance for various services, such as voice calls,
            video streaming, and data.
            The end-to-end or round trip latency will be about two times this value plus the latency not controlled
            by the operator
          allOf:
            - $ref: "#/components/schemas/Duration"
        jitter:
          description: |
            The jitter requirement aims to limit the maximum variation in round-trip
            packet delay for the 99th percentile of traffic, following ITU Y.1540
            standards. It considers only acknowledged packets in a session, which are
            packets that receive a confirmation of receipt from the recipient (e.g.,
            using TCP). This requirement helps maintain consistent latency, essential
            for real-time applications such as VoIP, video calls, and gaming.
          allOf:
            - $ref: "#/components/schemas/Duration"
        packetErrorLossRate:
          type: integer
          description: |
            This field specifies the acceptable level of data loss during transmission.
            The value is an exponent of 10, so a value of 3 means that up to 10⁻³, or 0.1%, of the
            data packets may be lost. This setting is part of a broader system that categorizes
            different types of network traffic (like phone calls, video streams, or data transfers)
            to ensure they perform reliably on the network.
          format: int32
          minimum: 1
          maximum: 10
          example: 3
        l4sQueueType:
          type: string
          enum:
            - non-l4s-queue
            - l4s-queue
            - mixed-queue
          description: |

            **NOTE**: l4sQueueType is experimental and could change or be removed in a future release.

            Specifies the type of queue for L4S (Low Latency, Low Loss, Scalable Throughput) traffic management. L4S is an advanced queue management approach designed to provide ultra-low latency and high throughput for internet traffic, particularly beneficial for interactive applications such as gaming, video conferencing, and virtual reality.

            **Queue Type Descriptions:**

            - **non-l4s-queue**:
              A traditional queue used for legacy internet traffic that does not utilize L4S enhancements. It provides standard latency and throughput levels.

            - **l4s-queue**:
              A dedicated queue optimized for L4S traffic, delivering ultra-low latency, low loss, and scalable throughput to support latency-sensitive applications.

            - **mixed-queue**:
              A shared queue that can handle both L4S and traditional traffic, offering a balance between ultra-low latency for L4S flows and compatibility with non-L4S flows.

          externalDocs:
            description: For more details, refer to the L4S standard.
            url: https://datatracker.ietf.org/doc/rfc9330/
        serviceClass:
          type: string
          description: |

            **NOTE**: serviceClass is experimental and could change or be removed in a future release.

            The name of a Service Class, representing a QoS Profile designed to provide optimized behavior for a specific application type. While DSCP values are commonly associated with Service Classes, their use may vary across network segments and may not be applied throughout the entire end-to-end QoS session. This aligns with the serviceClass concept used in HomeDevicesQoQ for consistent terminology.

            Service classes define specific QoS behaviors that map to DSCP (Differentiated Services Code Point) values or Microsoft QoS traffic types.

            The supported mappings are:
            1. Values aligned with the [RFC4594](https://datatracker.ietf.org/doc/html/rfc4594) guidelines for differentiated traffic classes.
            2. Microsoft [QOS_TRAFFIC_TYPE](https://learn.microsoft.com/en-us/windows/win32/api/qos2/ne-qos2-qos_traffic_type) values for Windows developers.

            **Supported Service Classes**:

            | Service Class Name    | DSCP Name | DSCP value (decimal) | DCSP value (binary) | Microsoft Value | Application Examples                                                 |
            |-----------------------|-----------|----------------------|---------------------|-----------------|----------------------------------------------------------------------|
            | Microsoft Voice       |    CS7    |          56          |        111000       |       4,5       | Microsoft QOSTrafficTypeVoice and QOSTrafficTypeControl              |
            | Microsoft Audio/Video |    CS5    |          40          |        101000       |       2,3       | Microsoft QOSTrafficTypeExcellentEffort and QOSTrafficTypeAudioVideo |
            | Real-Time Interactive |    CS4    |          32          |        100000       |                 | Video conferencing and Interactive gaming                            |
            | Multimedia Streaming  |    AF31   |          26          |        011010       |                 | Streaming video and audio on demand                                  |
            | Broadcast Video       |    CS3    |          24          |        011000       |                 | Broadcast TV & live events                                           |
            | Low-Latency Data      |    AF21   |          18          |        010010       |                 | Client/server transactions Web-based ordering                        |
            | High-Throughput Data  |    AF11   |          10          |        001010       |                 | Store and forward applications                                       |
            | Low-Priority Data     |    CS1    |           8          |        001000       |        1        | Any flow that has no BW assurance - also:                            |
            |                       |           |                      |                     |                 | Microsoft QOSTrafficTypeBackground                                   |
            | Standard              |  DF(CS0)  |           0          |        000000       |        0        | Undifferentiated applications - also:                                |
            |                       |           |                      |                     |                 | Microsoft QOSTrafficTypeBestEffort                                   |
          enum:
            - microsoft_voice                # Microsoft QOSTrafficTypeVoice or Control
            - microsoft_audio_video          # Microsoft QOSTrafficTypeExcellentEffort or AudioVideo
            - real_time_interactive          # Video conferencing and interactive gaming
            - multimedia_streaming           # Streaming video or audio on demand
            - broadcast_video                # Broadcast TV and live events
            - low_latency_data               # Client/server transactions Web-based ordering
            - high_throughput_data           # STore and forward applications
            - low_priority_data              # Low-priority background traffic
            - standard                       # Default traffic class
          example: real_time_interactive
      required:
        - name
        - status

    QosProfileName:
      description: |
        A unique name for identifying a specific QoS profile.
        This may follow different formats depending on the service providers implementation.
        Some options addresses:
          - A UUID style string
          - Support for predefined profile names like `QOS_E`, `QOS_S`, `QOS_M`, and `QOS_L`
          - A searchable descriptive name
      type: string
      example: voice
      minLength: 3
      maxLength: 256
      format: string
      pattern: "^[a-zA-Z0-9_.-]+$"

    Rate:
      description: Specification of rate
      type: object
      properties:
        value:
          description: Quantity of rate
          type: integer
          example: 10
          format: int32
          minimum: 0
          maximum: 1024
        unit:
          $ref: "#/components/schemas/RateUnitEnum"

    Duration:
      description: Specification of duration
      type: object
      properties:
        value:
          description: Quantity of duration
          type: integer
          example: 12
          format: int32
          minimum: 1
        unit:
          $ref: "#/components/schemas/TimeUnitEnum"

    TimeUnitEnum:
      description: Units of time
      type: string
      enum:
        - Days
        - Hours
        - Minutes
        - Seconds
        - Milliseconds
        - Microseconds
        - Nanoseconds

    QosProfileStatusEnum:
      description: |
        The current status of the QoS Profile
        - `ACTIVE`- QoS Profile is available to be used
        - `INACTIVE`- QoS Profile is not currently available to be deployed
        - `DEPRECATED`- QoS profile is actively being used in a QoD session, but can not be deployed in new QoD sessions
      type: string
      enum:
        - ACTIVE
        - INACTIVE
        - DEPRECATED

    RateUnitEnum:
      description: Units of rate
      type: string
      enum:
        - bps
        - kbps
        - Mbps
        - Gbps
        - Tbps

    QosProfileDeviceRequest:
      description: |
        Request object for QoS Profiles for a given device
      type: object
      properties:
        device:
          $ref: "#/components/schemas/Device"
        name:
          $ref: "#/components/schemas/QosProfileName"
        status:
          $ref: '#/components/schemas/QosProfileStatusEnum'

    Availability:
      description: A list of countries, and optionally networks, for which the API provider makes the profile available
      type: array
      items:
        type: object
        required:
          - countryName
        properties:
          countryName:
            description: The two letter ISO 3166-2 country code for the country in which the QoS profile is available in at least one network
            type: string
            pattern: ^[A-Z]{2}$
            example: "GB"
          networks:
            description: A list of networks within the country for which the QoS profile is available from the API provider
            type: array
            items:
              description: The network identifier. For mobile networks, this is the PLMN Identifier (MCC + MNC), which is a 5 or 6 digit integer.
              type: string
              example: "23591"
            example: ["23591", "23415"]
        example: {"countryName": "GB", "networks": ["23591", "23415"]}
      example: [{"countryName": "GB", "networks": ["23591", "23415"]}, {"countryName": "DE", "networks": ["26202"]}]

    Device:
      description: |
        End-user equipment able to connect to a mobile network. Examples of devices include smartphones or IoT sensors/actuators.

        The developer can choose to provide the below specified device identifiers:

        * `ipv4Address`
        * `ipv6Address`
        * `phoneNumber`
        NOTE1: the network operator might support only a subset of these options. The API consumer can provide multiple identifiers to be compatible across different operators. In this case the identifiers MUST belong to the same device.
        NOTE2: as for this Commonalities release, we are enforcing that the networkAccessIdentifier is only part of the schema for future-proofing, and CAMARA does not currently allow its use. After the CAMARA meta-release work is concluded and the relevant issues are resolved, its use will need to be explicitly documented in the guidelines.

      type: object
      properties:
        phoneNumber:
          $ref: "#/components/schemas/PhoneNumber"
        networkAccessIdentifier:
          $ref: "#/components/schemas/NetworkAccessIdentifier"
        ipv4Address:
          $ref: "#/components/schemas/DeviceIpv4Addr"
        ipv6Address:
          $ref: "#/components/schemas/DeviceIpv6Address"
      minProperties: 1

    NetworkAccessIdentifier:
      description: A public identifier addressing a subscription in a mobile network. In 3GPP terminology, it corresponds to the GPSI formatted with the External Identifier ({Local Identifier}@{Domain Identifier}). Unlike the telephone number, the network access identifier is not subjected to portability ruling in force, and is individually managed by each operator.
      type: string
      example: "123456789@domain.com"

    PhoneNumber:
      description: A public identifier addressing a telephone subscription. In mobile networks it corresponds to the MSISDN (Mobile Station International Subscriber Directory Number). In order to be globally unique it has to be formatted in international format, according to E.164 standard, prefixed with '+'.
      type: string
      pattern: '^\+[1-9][0-9]{4,14}$'
      example: "+123456789"

    DeviceIpv4Addr:
      type: object
      description: |
        The device should be identified by either the public (observed) IP address and port as seen by the application server, or the private (local) and any public (observed) IP addresses in use by the device (this information can be obtained by various means, for example from some DNS servers).

        If the allocated and observed IP addresses are the same (i.e. NAT is not in use) then  the same address should be specified for both publicAddress and privateAddress.

        If NAT64 is in use, the device should be identified by its publicAddress and publicPort, or separately by its allocated IPv6 address (field ipv6Address of the Device object)

        In all cases, publicAddress must be specified, along with at least one of either privateAddress or publicPort, dependent upon which is known. In general, mobile devices cannot be identified by their public IPv4 address alone.
      properties:
        publicAddress:
          $ref: "#/components/schemas/SingleIpv4Addr"
        privateAddress:
          $ref: "#/components/schemas/SingleIpv4Addr"
        publicPort:
          $ref: "#/components/schemas/Port"
      anyOf:
        - required: [publicAddress, privateAddress]
        - required: [publicAddress, publicPort]
      example:
        {
          "publicAddress": "203.0.113.0",
          "publicPort": 59765
        }

    Port:
      description: TCP or UDP port number
      type: integer
      minimum: 0
      maximum: 65535

    SingleIpv4Addr:
      description: A single IPv4 address with no subnet mask
      type: string
      format: ipv4
      example: "203.0.113.0"

    DeviceIpv6Address:
      description: |
        The device should be identified by the observed IPv6 address, or by any single IPv6 address from within the subnet allocated to the device (e.g. adding ::0 to the /64 prefix).

        The session shall apply to all IP flows between the device subnet and the specified application server, unless further restricted by the optional parameters devicePorts or applicationServerPorts.
      type: string
      format: ipv6
      example: 2001:db8:85a3:8d3:1319:8a2e:370:7344

    ErrorInfo:
      description: Common schema for errors
      type: object
      properties:
        status:
          type: integer
          description: HTTP status code returned along with this error response
        code:
          type: string
          description: Code given to this error
        message:
          type: string
          description: Detailed error description
      required:
        - status
        - code
        - message

  responses:
    Generic400:
      description: Bad Request
      headers:
        x-correlator:
          $ref: "#/components/headers/x-correlator"
      content:
        application/json:
          schema:
            allOf:
              - $ref: "#/components/schemas/ErrorInfo"
              - type: object
                properties:
                  status:
                    enum:
                      - 400
                  code:
                    enum:
                      - INVALID_ARGUMENT
                      - OUT_OF_RANGE
          examples:
            GENERIC_400_INVALID_ARGUMENT:
              description: Invalid Argument. Generic Syntax Exception
              value:
                status: 400
                code: INVALID_ARGUMENT
                message: Client specified an invalid argument, request body or query param.
            GENERIC_400_OUT_OF_RANGE:
              description: Out of Range. Specific Syntax Exception used when a given field has a pre-defined range or a invalid filter criteria combination is requested
              value:
                status: 400
                code: OUT_OF_RANGE
                message: Client specified an invalid range.

    Generic401:
      description: Unauthorized
      headers:
        x-correlator:
          $ref: "#/components/headers/x-correlator"
      content:
        application/json:
          schema:
            allOf:
              - $ref: "#/components/schemas/ErrorInfo"
              - type: object
                properties:
                  status:
                    enum:
                      - 401
                  code:
                    enum:
                      - UNAUTHENTICATED
          examples:
            GENERIC_401_UNAUTHENTICATED:
              description: Request cannot be authenticated and a new authentication is required
              value:
                status: 401
                code: UNAUTHENTICATED
                message: Request not authenticated due to missing, invalid, or expired credentials. A new authentication is required.

    Generic403:
      description: Forbidden
      headers:
        x-correlator:
          $ref: "#/components/headers/x-correlator"
      content:
        application/json:
          schema:
            allOf:
              - $ref: "#/components/schemas/ErrorInfo"
              - type: object
                properties:
                  status:
                    enum:
                      - 403
                  code:
                    enum:
                      - PERMISSION_DENIED
          examples:
            GENERIC_403_PERMISSION_DENIED:
              description: Permission denied. OAuth2 token access does not have the required scope or when the user fails operational security
              value:
                status: 403
                code: PERMISSION_DENIED
                message: Client does not have sufficient permissions to perform this action.

    Generic404:
      description: Not found
      headers:
        x-correlator:
          $ref: "#/components/headers/x-correlator"
      content:
        application/json:
          schema:
            allOf:
              - $ref: "#/components/schemas/ErrorInfo"
              - type: object
                properties:
                  status:
                    enum:
                      - 404
                  code:
                    enum:
                      - NOT_FOUND
          examples:
            GENERIC_404_NOT_FOUND:
              description: Resource is not found
              value:
                status: 404
                code: NOT_FOUND
                message: The specified resource is not found.

    GenericDevice404:
      description: Not found
      headers:
        x-correlator:
          $ref: "#/components/headers/x-correlator"
      content:
        application/json:
          schema:
            allOf:
              - $ref: "#/components/schemas/ErrorInfo"
              - type: object
                properties:
                  status:
                    enum:
                      - 404
                  code:
                    enum:
                      - NOT_FOUND
                      - IDENTIFIER_NOT_FOUND
          examples:
            GENERIC_404_NOT_FOUND:
              description: Resource is not found
              value:
                status: 404
                code: NOT_FOUND
                message: The specified resource is not found.
            GENERIC_404_DEVICE_NOT_FOUND:
              description: Device identifier not found
              value:
                status: 404
                code: IDENTIFIER_NOT_FOUND
                message: Device identifier not found.

    Generic422:
      description: Unprocessable Content
      headers:
        x-correlator:
          $ref: "#/components/headers/x-correlator"
      content:
        application/json:
          schema:
            allOf:
              - $ref: "#/components/schemas/ErrorInfo"
              - type: object
                properties:
                  status:
                    enum:
                      - 422
                  code:
                    enum:
                      - SERVICE_NOT_APPLICABLE
                      - UNSUPPORTED_IDENTIFIER
                      - UNNECESSARY_IDENTIFIER
          examples:
            GENERIC_422_SERVICE_NOT_APPLICABLE:
              description: Service not applicable for the provided identifier
              value:
                status: 422
                code: SERVICE_NOT_APPLICABLE
                message: The service is not available for the provided identifier.
            GENERIC_422_UNSUPPORTED_IDENTIFIER:
              description: None of the provided identifiers is supported by the implementation
              value:
                status: 422
                code: UNSUPPORTED_IDENTIFIER
                message: The identifier provided is not supported.
            GENERIC_422_UNNECESSARY_IDENTIFIER:
              description: An explicit identifier is provided when a device or phone number has already been identified from the access token
              value:
                status: 422
                code: UNNECESSARY_IDENTIFIER
                message: The device is already identified by the access token.

    Generic429:
      description: Too Many Requests
      headers:
        x-correlator:
          $ref: "#/components/headers/x-correlator"
      content:
        application/json:
          schema:
            allOf:
              - $ref: "#/components/schemas/ErrorInfo"
              - type: object
                properties:
                  status:
                    enum:
                      - 429
                  code:
                    enum:
                      - QUOTA_EXCEEDED
                      - TOO_MANY_REQUESTS
          examples:
            GENERIC_429_QUOTA_EXCEEDED:
              description: Request is rejected due to exceeding a business quota limit
              value:
                status: 429
                code: QUOTA_EXCEEDED
                message: Out of resource quota.
            GENERIC_429_TOO_MANY_REQUESTS:
              description: Access to the API has been temporarily blocked due to rate or spike arrest limits being reached
              value:
                status: 429
                code: TOO_MANY_REQUESTS
                message: Rate limit reached.

  examples:
    LIST_OF_QOS_PROFILES:
      summary: A list of QoS profiles with a single entry
      description: Example response when requesting a list of QoS profiles
      value:
        - name: "voice"
          description: "QoS profile for high-quality interactive voice"
          status: "ACTIVE"
          targetMinUpstreamRate:
            value: 100
            unit: "kbps"
          targetMinDownstreamRate:
            value: 100
            unit: "kbps"
          minDuration:
            value: 1
            unit: "Days"
          maxDuration:
            value: 10
            unit: "Days"
          priority: 10
          packetDelayBudget:
            value: 50
            unit: "Milliseconds"
          jitter:
            value: 5
            unit: "Milliseconds"
          packetErrorLossRate: 3
          l4sQueueType: "non-l4s-queue"
