Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add api yaml #1

Merged
merged 1 commit into from
Jun 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
294 changes: 294 additions & 0 deletions code/API_definitions/NetworkSliceBooking.yaml
Original file line number Diff line number Diff line change
@@ -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