From 2609d3785019a3908feabfd748b27191d7223879 Mon Sep 17 00:00:00 2001 From: Fan Yang-ChinaUnicom <130550398+chinaunicomyangfan@users.noreply.github.com> Date: Thu, 27 Jun 2024 23:17:34 +0800 Subject: [PATCH 1/4] a --- code/API_definitions/NetworkSliceBooking.yaml | 294 ++++++++++++++++++ 1 file changed, 294 insertions(+) create mode 100644 code/API_definitions/NetworkSliceBooking.yaml diff --git a/code/API_definitions/NetworkSliceBooking.yaml b/code/API_definitions/NetworkSliceBooking.yaml new file mode 100644 index 0000000..e584d6e --- /dev/null +++ b/code/API_definitions/NetworkSliceBooking.yaml @@ -0,0 +1,294 @@ +openapi: 3.0.3 +info: + title: API for Network slicing Booking + description: Copyright (c) 2024 Huawei Technologies Co., Ltd. + version: 0.0.1 + license: + name: Apache 2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html +servers: + - url: "{apiRoot}/nsb/v0" + variables: + apiRoot: + default: http://localhost:9100 +tags: + - name: NSB Sessions + description: Manage NSB sessions +paths: + /sessions: + post: + tags: + - NSB Sessions + summary: Creates a new session + operationId: createSession + requestBody: + description: Parameters to create a new session + content: + application/json: + schema: + $ref: "#/components/schemas/CreateSession" + required: true + + responses: + "201": + description: Session created + content: + application/json: + schema: + $ref: "#/components/schemas/SessionInfo" + "400": + description: Invalid input for createSession operation + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorInfo" + + /sessions/{sessionId}: + delete: + tags: + - NSB Sessions + summary: Delete a NSB session + description: Deleting NSB session + operationId: deleteSession + parameters: + - name: sessionId + in: path + description: Session ID that was obtained from the createSession operation + required: true + schema: + $ref: "#/components/schemas/SessionId" + responses: + "204": + description: Session deleted + get: + tags: + - NSB Sessions + summary: Get NSB session information + description: Querying for NSB session resource information details + operationId: getSession + parameters: + - name: sessionId + in: path + description: Session ID that was obtained from the createSession operation + required: true + schema: + $ref: "#/components/schemas/SessionId" + responses: + "200": + description: Contains information about active session + content: + application/json: + schema: + $ref: "#/components/schemas/SessionInfo" +components: + schemas: + SessionId: + description: Session ID in UUID format + type: string + format: uuid + + SessionInfo: + description: Session related information. + allOf: + - $ref: "#/components/schemas/CreateSession" + - type: object + properties: + sessionId: + $ref: "#/components/schemas/SessionId" + result: + type: string + enum: + - Success + - Fail + required: + - result + + + + CreateSession: + description: Attributes required to create a session + type: object + properties: + ServiceTime: + $ref: "#/components/schemas/ServiceTime" + ServiceArea: + $ref: "#/components/schemas/Area" + SLAProfile: + $ref: "#/components/schemas/SLAProfile" + required: + - ServiceTime + - ServiceArea + - SLAProfile + + SLAProfile: + type: object + properties: + MaxNumofTerminals: + $ref: "#/components/schemas/NumofTerminals" + DLThroughputPerTerminal: + $ref: "#/components/schemas/Throughput" + ULThroughputPerTerminal: + $ref: "#/components/schemas/Throughput" + DLLatency: + $ref: "#/components/schemas/Latency" + ULLatency: + $ref: "#/components/schemas/Latency" + + + Latency: + type: integer + example: 10 + description: | + An attribute specifies the required DL packet transmission latency (millisecond) + through the RAN, CN, and TN part of 5G network. + format: int32 + + + NumofTerminals: + type: integer + example: 5 + description: Number of terminals + format: int32 + minimum: 1 + maximum: 20 + + + Throughput: + type: object + properties: + min: + $ref: "#/components/schemas/Float" + max: + $ref: "#/components/schemas/Float" + + ServiceTime: + description: Attributes required to service time + type: object + properties: + StartTime: + $ref: "#/components/schemas/TimeStamp" + EndTime: + $ref: "#/components/schemas/TimeStamp" + + Float: + type: number + + Area: + type: object + properties: + areaType: + $ref: "#/components/schemas/AreaType" + required: + - areaType + discriminator: + propertyName: areaType + mapping: + CIRCLE: "#/components/schemas/Circle" + POLYGON: "#/components/schemas/Polygon" + + AreaType: + type: string + description: | + Type of this area. + CIRCLE - The area is defined as a circle. + POLYGON - The area is defined as a polygon. + enum: + - CIRCLE + - POLYGON + + Circle: + description: Circular area + allOf: + - $ref: "#/components/schemas/Area" + - type: object + required: + - center + - radius + properties: + center: + $ref: "#/components/schemas/Point" + radius: + type: number + description: Distance from the center in meters + minimum: 1 + + Polygon: + allOf: + - $ref: "#/components/schemas/Area" + - type: object + required: + - boundary + properties: + boundary: + $ref: "#/components/schemas/PointList" + + PointList: + type: array + items: + $ref: "#/components/schemas/Point" + minItems: 3 + maxItems: 15 + + Point: + type: object + description: Coordinates (latitude, longitude) defining a location in a map + required: + - latitude + - longitude + properties: + latitude: + $ref: "#/components/schemas/Latitude" + longitude: + $ref: "#/components/schemas/Longitude" + example: + latitude: 31.22529 + longitude: 121.48905 + + Latitude: + description: Latitude component of a location + type: number + format: double + minimum: -90 + maximum: 90 + + Longitude: + description: Longitude component of location + type: number + format: double + minimum: -180 + maximum: 180 + + TimeStamp: + type: string + description: string with format "date-time" + + + + ErrorInfo: + 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 + + + + + + + + + + + + From 48e44f71f8471717f83f1ba1a3c3ebcadd3001b1 Mon Sep 17 00:00:00 2001 From: Fan Yang-ChinaUnicom <130550398+chinaunicomyangfan@users.noreply.github.com> Date: Mon, 1 Jul 2024 15:04:05 +0800 Subject: [PATCH 2/4] Update API version to wip --- code/API_definitions/NetworkSliceBooking.yaml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/code/API_definitions/NetworkSliceBooking.yaml b/code/API_definitions/NetworkSliceBooking.yaml index e584d6e..e939206 100644 --- a/code/API_definitions/NetworkSliceBooking.yaml +++ b/code/API_definitions/NetworkSliceBooking.yaml @@ -1,13 +1,12 @@ openapi: 3.0.3 info: title: API for Network slicing Booking - description: Copyright (c) 2024 Huawei Technologies Co., Ltd. - version: 0.0.1 + version: wip license: name: Apache 2.0 url: https://www.apache.org/licenses/LICENSE-2.0.html servers: - - url: "{apiRoot}/nsb/v0" + - url: "{apiRoot}/nsb/vwip" variables: apiRoot: default: http://localhost:9100 From f4b5633328351f7dc35d63315e7c53fab4508712 Mon Sep 17 00:00:00 2001 From: Fan Yang-ChinaUnicom <130550398+chinaunicomyangfan@users.noreply.github.com> Date: Wed, 4 Sep 2024 18:30:04 +0800 Subject: [PATCH 3/4] Update NetworkSliceBooking.yaml --- code/API_definitions/NetworkSliceBooking.yaml | 175 ++++++++++++++++-- 1 file changed, 156 insertions(+), 19 deletions(-) diff --git a/code/API_definitions/NetworkSliceBooking.yaml b/code/API_definitions/NetworkSliceBooking.yaml index e939206..c2066fc 100644 --- a/code/API_definitions/NetworkSliceBooking.yaml +++ b/code/API_definitions/NetworkSliceBooking.yaml @@ -1,6 +1,8 @@ openapi: 3.0.3 info: - title: API for Network slicing Booking + title: API for Network Slice Booking + description: | + The Network Slice Booking (NSB) API provides programmable interface for developers to reserve a slice resource of a selected area within a period, and manage device access control as needed. version: wip license: name: Apache 2.0 @@ -41,7 +43,15 @@ paths: application/json: schema: $ref: "#/components/schemas/ErrorInfo" - + "401": + $ref: "#/components/responses/Generic401" + "403": + $ref: "#/components/responses/Generic403" + "500": + $ref: "#/components/responses/Generic500" + "503": + $ref: "#/components/responses/Generic503" + /sessions/{sessionId}: delete: tags: @@ -59,6 +69,20 @@ paths: responses: "204": description: Session deleted + "400": + description: Invalid input for createSession operation + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorInfo" + "401": + $ref: "#/components/responses/Generic401" + "403": + $ref: "#/components/responses/Generic403" + "500": + $ref: "#/components/responses/Generic500" + "503": + $ref: "#/components/responses/Generic503" get: tags: - NSB Sessions @@ -79,6 +103,14 @@ paths: application/json: schema: $ref: "#/components/schemas/SessionInfo" + "401": + $ref: "#/components/responses/Generic401" + "403": + $ref: "#/components/responses/Generic403" + "500": + $ref: "#/components/responses/Generic500" + "503": + $ref: "#/components/responses/Generic503" components: schemas: SessionId: @@ -112,8 +144,8 @@ components: $ref: "#/components/schemas/ServiceTime" ServiceArea: $ref: "#/components/schemas/Area" - SLAProfile: - $ref: "#/components/schemas/SLAProfile" + QoSProfile: + $ref: "#/components/schemas/QoSProfile" required: - ServiceTime - ServiceArea @@ -125,24 +157,70 @@ components: MaxNumofTerminals: $ref: "#/components/schemas/NumofTerminals" DLThroughputPerTerminal: - $ref: "#/components/schemas/Throughput" + $ref: "#/components/schemas/Rate" ULThroughputPerTerminal: - $ref: "#/components/schemas/Throughput" + $ref: "#/components/schemas/Rate" DLLatency: - $ref: "#/components/schemas/Latency" + description: | + DLLatency is an attribute specifies the required DL packet transmission latency (millisecond) through the 5G network. + $ref: "#/components/schemas/Duration" ULLatency: - $ref: "#/components/schemas/Latency" + description: | + ULLatency is an attribute specifies the required UL packet transmission latency (millisecond) through the 5G network. + $ref: "#/components/schemas/Duration" - Latency: - type: integer - example: 10 - description: | - An attribute specifies the required DL packet transmission latency (millisecond) - through the RAN, CN, and TN part of 5G network. - format: int32 + 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 + + + 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" + + RateUnitEnum: + description: Units of rate + type: string + enum: + - bps + - kbps + - Mbps + - Gbps + - Tbps + NumofTerminals: type: integer example: 5 @@ -165,9 +243,15 @@ components: type: object properties: StartTime: - $ref: "#/components/schemas/TimeStamp" + description: Start the Slice Service From + type: string + format: date-time + example: "2024-06-01T12:00:00Z" EndTime: - $ref: "#/components/schemas/TimeStamp" + description: End the Slice Service At + type: string + format: date-time + example: "2024-06-01T12:00:00Z" Float: type: number @@ -262,7 +346,6 @@ components: description: string with format "date-time" - ErrorInfo: type: object properties: @@ -280,7 +363,61 @@ components: - code - message - + Generic401: + description: Unauthorized + headers: + x-correlator: + $ref: '#/components/headers/x-correlator' + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorInfo" + example: + status: 401 + code: UNAUTHENTICATED + message: "Authorization failed: ..." + + Generic403: + description: Forbidden + headers: + x-correlator: + $ref: '#/components/headers/x-correlator' + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorInfo" + example: + status: 403 + code: PERMISSION_DENIED + message: "Operation not allowed: ..." + + Generic500: + description: Internal server error + headers: + x-correlator: + $ref: '#/components/headers/x-correlator' + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorInfo" + example: + status: 500 + code: INTERNAL + message: "Internal server error: ..." + + Generic503: + description: Service unavailable + headers: + x-correlator: + $ref: '#/components/headers/x-correlator' + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorInfo" + example: + status: 503 + code: UNAVAILABLE + message: "Service unavailable" From 8135cb26318ee380e213295d016023f5e64105c4 Mon Sep 17 00:00:00 2001 From: Fan Yang-ChinaUnicom <130550398+chinaunicomyangfan@users.noreply.github.com> Date: Fri, 20 Sep 2024 10:23:45 +0800 Subject: [PATCH 4/4] Update NetworkSliceBooking.yaml --- code/API_definitions/NetworkSliceBooking.yaml | 212 ++++++++++++------ 1 file changed, 145 insertions(+), 67 deletions(-) diff --git a/code/API_definitions/NetworkSliceBooking.yaml b/code/API_definitions/NetworkSliceBooking.yaml index c2066fc..ec8d08b 100644 --- a/code/API_definitions/NetworkSliceBooking.yaml +++ b/code/API_definitions/NetworkSliceBooking.yaml @@ -1,6 +1,6 @@ openapi: 3.0.3 info: - title: API for Network Slice Booking + title: Network Slice Booking description: | The Network Slice Booking (NSB) API provides programmable interface for developers to reserve a slice resource of a selected area within a period, and manage device access control as needed. version: wip @@ -8,18 +8,19 @@ info: name: Apache 2.0 url: https://www.apache.org/licenses/LICENSE-2.0.html servers: - - url: "{apiRoot}/nsb/vwip" + - url: "{apiRoot}/network-slice-booking/vwip" variables: apiRoot: default: http://localhost:9100 + description: API root, defined by the service provider, e.g. `api.example.com` or `api.example.com/somepath` tags: - - name: NSB Sessions - description: Manage NSB sessions + - name: Network Slice Booking Sessions + description: Manage Network Slice Booking sessions paths: /sessions: post: tags: - - NSB Sessions + - Network Slice Booking Sessions summary: Creates a new session operationId: createSession requestBody: @@ -38,15 +39,15 @@ paths: schema: $ref: "#/components/schemas/SessionInfo" "400": - description: Invalid input for createSession operation - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorInfo" + $ref: "#/components/responses/Generic400" "401": $ref: "#/components/responses/Generic401" "403": $ref: "#/components/responses/Generic403" + "410": + $ref: "#/components/responses/Generic410" + "429": + $ref: "#/components/responses/Generic429" "500": $ref: "#/components/responses/Generic500" "503": @@ -55,7 +56,7 @@ paths: /sessions/{sessionId}: delete: tags: - - NSB Sessions + - Network Slice Booking Sessions summary: Delete a NSB session description: Deleting NSB session operationId: deleteSession @@ -70,19 +71,20 @@ paths: "204": description: Session deleted "400": - description: Invalid input for createSession operation - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorInfo" + $ref: "#/components/responses/Generic400" "401": $ref: "#/components/responses/Generic401" "403": $ref: "#/components/responses/Generic403" + "410": + $ref: "#/components/responses/Generic410" + "429": + $ref: "#/components/responses/Generic429" "500": $ref: "#/components/responses/Generic500" "503": $ref: "#/components/responses/Generic503" + get: tags: - NSB Sessions @@ -103,15 +105,27 @@ paths: application/json: schema: $ref: "#/components/schemas/SessionInfo" + "400": + $ref: "#/components/responses/Generic400" "401": - $ref: "#/components/responses/Generic401" + $ref: "#/components/responses/Generic401" "403": $ref: "#/components/responses/Generic403" + "410": + $ref: "#/components/responses/Generic410" + "429": + $ref: "#/components/responses/Generic429" "500": $ref: "#/components/responses/Generic500" "503": $ref: "#/components/responses/Generic503" + components: + headers: + x-correlator: + description: Correlation id for the different services + schema: + type: string schemas: SessionId: description: Session ID in UUID format @@ -149,13 +163,13 @@ components: required: - ServiceTime - ServiceArea - - SLAProfile + - QoSProfile - SLAProfile: + QoSProfile: type: object properties: MaxNumofTerminals: - $ref: "#/components/schemas/NumofTerminals" + $ref: "#/components/schemas/NumberOfTerminals" DLThroughputPerTerminal: $ref: "#/components/schemas/Rate" ULThroughputPerTerminal: @@ -221,7 +235,7 @@ components: - Gbps - Tbps - NumofTerminals: + NumberOfTerminals: type: integer example: 5 description: Number of terminals @@ -245,13 +259,13 @@ components: StartTime: description: Start the Slice Service From type: string - format: date-time - example: "2024-06-01T12:00:00Z" + format: date-time + example: "2024-06-01T12:00:00Z" EndTime: description: End the Slice Service At type: string - format: date-time - example: "2024-06-01T12:00:00Z" + format: date-time + example: "2024-06-01T12:00:00Z" Float: type: number @@ -362,7 +376,29 @@ components: - status - code - message - + responses: + Generic400: + description: Bad Request + headers: + x-correlator: + $ref: "#/components/headers/x-correlator" + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorInfo" + 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: @@ -377,47 +413,89 @@ components: code: UNAUTHENTICATED message: "Authorization failed: ..." - Generic403: - description: Forbidden - headers: - x-correlator: - $ref: '#/components/headers/x-correlator' - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorInfo" - example: - status: 403 - code: PERMISSION_DENIED - message: "Operation not allowed: ..." - - Generic500: - description: Internal server error - headers: - x-correlator: - $ref: '#/components/headers/x-correlator' - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorInfo" - example: - status: 500 - code: INTERNAL - message: "Internal server error: ..." - - Generic503: - description: Service unavailable - headers: - x-correlator: - $ref: '#/components/headers/x-correlator' - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorInfo" - example: - status: 503 - code: UNAVAILABLE - message: "Service unavailable" + Generic403: + description: Forbidden + headers: + x-correlator: + $ref: '#/components/headers/x-correlator' + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorInfo" + example: + status: 403 + code: PERMISSION_DENIED + message: "Operation not allowed: ..." + + Generic410: + description: Gone + headers: + x-correlator: + $ref: "#/components/headers/x-correlator" + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorInfo" + examples: + GENERIC_410_GONE: + description: Use in notifications flow to allow API Consumer to indicate that its callback is no longer available + value: + status: 410 + code: GONE + message: Access to the target resource is no longer available. + + Generic429: + description: Too Many Requests + headers: + x-correlator: + $ref: "#/components/headers/x-correlator" + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorInfo" + examples: + GENERIC_429_QUOTA_EXCEEDED: + description: Request is rejected due to exceeding a business quota limit + value: + status: 429 + code: QUOTA_EXCEEDED + message: Either out of resource quota or reaching rate limiting. + GENERIC_429_TOO_MANY_REQUESTS: + description: API Server request limit is overpassed + value: + status: 429 + code: TOO_MANY_REQUESTS + message: Either out of resource quota or reaching rate limiting. + + + Generic500: + description: Internal server error + headers: + x-correlator: + $ref: '#/components/headers/x-correlator' + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorInfo" + example: + status: 500 + code: INTERNAL + message: "Internal server error: ..." + + + Generic503: + description: Service unavailable + headers: + x-correlator: + $ref: '#/components/headers/x-correlator' + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorInfo" + example: + status: 503 + code: UNAVAILABLE + message: "Service unavailable"