From f28594d423c9da9988d6a23ab49c4e787a5ae089 Mon Sep 17 00:00:00 2001 From: elinuxhenrik Date: Mon, 7 Dec 2020 14:54:19 +0100 Subject: Add generation of API yaml file Change-Id: I3f3091c76b926425f9a2187e43dd03a1cdb4bda6 Issue-ID: CCSDK-2736 Signed-off-by: elinuxhenrik --- .gitignore | 2 + a1-policy-management/api/README.md | 0 a1-policy-management/api/pms-api.json | 1449 ++++++++++++ a1-policy-management/api/pms-api.yaml | 1617 +++++++++++++ a1-policy-management/pom.xml | 22 + .../controllers/v2/ApplicationTest.java | 2 +- docs/offeredapis/swagger/pms-api.json | 2 +- docs/offeredapis/swagger/pms-api.yaml | 2408 +++++++++++--------- pom.xml | 25 + 9 files changed, 4418 insertions(+), 1109 deletions(-) create mode 100644 a1-policy-management/api/README.md create mode 100644 a1-policy-management/api/pms-api.json create mode 100644 a1-policy-management/api/pms-api.yaml diff --git a/.gitignore b/.gitignore index 16a25344..a8cc7dcb 100644 --- a/.gitignore +++ b/.gitignore @@ -41,3 +41,5 @@ out/ ## Documentation ignores ## .tox _build/ +.swagger* +docs/offeredapis/swagger/README.md diff --git a/a1-policy-management/api/README.md b/a1-policy-management/api/README.md new file mode 100644 index 00000000..e69de29b diff --git a/a1-policy-management/api/pms-api.json b/a1-policy-management/api/pms-api.json new file mode 100644 index 00000000..b1bea446 --- /dev/null +++ b/a1-policy-management/api/pms-api.json @@ -0,0 +1,1449 @@ +{ + "basePath": "/", + "paths": { + "/policy_types": {"get": { + "summary": "Query policy type names", + "deprecated": false, + "produces": ["*/*"], + "operationId": "getPolicyTypesUsingGET_1", + "responses": { + "200": { + "schema": { + "type": "array", + "items": {"type": "string"} + }, + "description": "Policy type names" + }, + "401": {"description": "Unauthorized"}, + "403": {"description": "Forbidden"}, + "404": { + "schema": {"type": "string"}, + "description": "Near-RT RIC is not found" + } + }, + "parameters": [{ + "in": "query", + "allowEmptyValue": false, + "name": "ric", + "description": "The name of the Near-RT RIC to get types for.", + "type": "string", + "required": false + }], + "tags": ["A1 Policy Management Version 1.0"] + }}, + "/v2/status": {"get": { + "summary": "Returns status and statistics of this service", + "deprecated": false, + "produces": ["application/json"], + "operationId": "getStatusUsingGET_1", + "responses": { + "200": { + "schema": {"$ref": "#/definitions/status_info_v2"}, + "description": "Service is living" + }, + "401": {"description": "Unauthorized"}, + "403": {"description": "Forbidden"}, + "404": {"description": "Not Found"} + }, + "tags": ["A1 Policy Management Version 2.0 (in progress)"] + }}, + "/v2/policy-types": {"get": { + "summary": "Query policy type identities", + "deprecated": false, + "produces": ["application/json"], + "operationId": "getPolicyTypesUsingGET", + "responses": { + "200": { + "schema": {"$ref": "#/definitions/policytype_id_list_v2"}, + "description": "Policy type IDs" + }, + "401": {"description": "Unauthorized"}, + "403": {"description": "Forbidden"}, + "404": { + "schema": {"$ref": "#/definitions/error_information"}, + "description": "Near-RT RIC is not found" + } + }, + "parameters": [{ + "in": "query", + "allowEmptyValue": false, + "name": "ric_id", + "description": "The identity of the Near-RT RIC to get types for.", + "type": "string", + "required": false + }], + "tags": ["A1 Policy Management Version 2.0 (in progress)"] + }}, + "/services": { + "get": { + "summary": "Returns service information", + "deprecated": false, + "produces": ["*/*"], + "operationId": "getServicesUsingGET", + "responses": { + "200": { + "schema": { + "type": "array", + "items": {"$ref": "#/definitions/service_status_v1"} + }, + "description": "OK" + }, + "401": {"description": "Unauthorized"}, + "403": {"description": "Forbidden"}, + "404": { + "schema": {"type": "string"}, + "description": "Service is not found" + } + }, + "parameters": [{ + "in": "query", + "allowEmptyValue": false, + "name": "name", + "description": "The name of the service", + "type": "string", + "required": false + }], + "tags": ["A1 Policy Management Version 1.0"] + }, + "delete": { + "summary": "Delete a service", + "deprecated": false, + "produces": ["*/*"], + "operationId": "deleteServiceUsingDELETE", + "responses": { + "200": { + "schema": {"type": "string"}, + "description": "OK" + }, + "401": {"description": "Unauthorized"}, + "204": { + "schema": {"type": "string"}, + "description": "Service deleted" + }, + "403": {"description": "Forbidden"}, + "404": { + "schema": {"type": "string"}, + "description": "Service not found" + } + }, + "parameters": [{ + "in": "query", + "allowEmptyValue": false, + "name": "name", + "description": "The name of the service", + "type": "string", + "required": true + }], + "tags": ["A1 Policy Management Version 1.0"] + } + }, + "/v2/services/{service_id}": {"delete": { + "summary": "Unregister a service", + "deprecated": false, + "produces": ["*/*"], + "operationId": "deleteServiceUsingDELETE_1", + "responses": { + "200": {"description": "Not used"}, + "401": {"description": "Unauthorized"}, + "204": { + "schema": {"type": "object"}, + "description": "Service unregistered" + }, + "403": {"description": "Forbidden"}, + "404": { + "schema": {"$ref": "#/definitions/error_information"}, + "description": "Service not found" + } + }, + "parameters": [{ + "in": "path", + "name": "service_id", + "description": "service_id", + "type": "string", + "required": true + }], + "tags": ["A1 Policy Management Version 2.0 (in progress)"] + }}, + "/policy": { + "get": { + "summary": "Returns a policy configuration", + "deprecated": false, + "produces": ["*/*"], + "operationId": "getPolicyUsingGET_1", + "responses": { + "200": { + "schema": {"type": "object"}, + "description": "Policy found" + }, + "401": {"description": "Unauthorized"}, + "403": {"description": "Forbidden"}, + "404": {"description": "Policy is not found"} + }, + "parameters": [{ + "in": "query", + "allowEmptyValue": false, + "name": "id", + "description": "The identity of the policy instance.", + "type": "string", + "required": true + }], + "tags": ["A1 Policy Management Version 1.0"] + }, + "delete": { + "summary": "Delete a policy", + "deprecated": false, + "produces": ["*/*"], + "operationId": "deletePolicyUsingDELETE_1", + "responses": { + "200": {"description": "Not used"}, + "401": {"description": "Unauthorized"}, + "423": { + "schema": {"type": "string"}, + "description": "Near-RT RIC is not operational" + }, + "204": {"description": "Policy deleted"}, + "403": {"description": "Forbidden"}, + "404": { + "schema": {"type": "string"}, + "description": "Policy is not found" + } + }, + "parameters": [{ + "in": "query", + "allowEmptyValue": false, + "name": "id", + "description": "The identity of the policy instance.", + "type": "string", + "required": true + }], + "tags": ["A1 Policy Management Version 1.0"] + }, + "put": { + "summary": "Put a policy", + "deprecated": false, + "produces": ["*/*"], + "operationId": "putPolicyUsingPUT_1", + "responses": { + "200": {"description": "Policy updated"}, + "201": {"description": "Policy created"}, + "401": {"description": "Unauthorized"}, + "423": { + "schema": {"type": "string"}, + "description": "Near-RT RIC is not operational" + }, + "403": {"description": "Forbidden"}, + "404": { + "schema": {"type": "string"}, + "description": "Near-RT RIC or policy type is not found" + } + }, + "parameters": [ + { + "in": "query", + "allowEmptyValue": false, + "name": "id", + "description": "The identity of the policy instance.", + "type": "string", + "required": true + }, + { + "schema": {"type": "object"}, + "in": "body", + "name": "jsonBody", + "description": "jsonBody", + "required": true + }, + { + "in": "query", + "allowEmptyValue": false, + "name": "ric", + "description": "The name of the Near-RT RIC where the policy will be created.", + "type": "string", + "required": true + }, + { + "in": "query", + "allowEmptyValue": false, + "name": "service", + "description": "The name of the service creating the policy.", + "type": "string", + "required": true + }, + { + "default": false, + "in": "query", + "allowEmptyValue": false, + "name": "transient", + "x-example": false, + "description": "If the policy is transient or not (boolean defaulted to false). A policy is transient if it will be forgotten when the service needs to reconnect to the Near-RT RIC.", + "type": "boolean", + "required": false + }, + { + "in": "query", + "allowEmptyValue": false, + "name": "type", + "description": "The name of the policy type.", + "type": "string", + "required": false + } + ], + "tags": ["A1 Policy Management Version 1.0"], + "consumes": ["application/json"] + } + }, + "/policies": {"get": { + "summary": "Query policies", + "deprecated": false, + "produces": ["*/*"], + "operationId": "getPoliciesUsingGET", + "responses": { + "200": { + "schema": { + "type": "array", + "items": {"$ref": "#/definitions/policy_info_v1"} + }, + "description": "Policies" + }, + "401": {"description": "Unauthorized"}, + "403": {"description": "Forbidden"}, + "404": { + "schema": {"type": "string"}, + "description": "Near-RT RIC or type not found" + } + }, + "parameters": [ + { + "in": "query", + "allowEmptyValue": false, + "name": "ric", + "description": "The name of the Near-RT RIC to get policies for.", + "type": "string", + "required": false + }, + { + "in": "query", + "allowEmptyValue": false, + "name": "service", + "description": "The name of the service to get policies for.", + "type": "string", + "required": false + }, + { + "in": "query", + "allowEmptyValue": false, + "name": "type", + "description": "The name of the policy type to get policies for.", + "type": "string", + "required": false + } + ], + "tags": ["A1 Policy Management Version 1.0"] + }}, + "/v2/policies/{policy_id}": { + "get": { + "summary": "Returns a policy", + "deprecated": false, + "produces": ["application/json"], + "operationId": "getPolicyUsingGET", + "responses": { + "200": { + "schema": {"$ref": "#/definitions/policy_info_v2"}, + "description": "Policy found" + }, + "401": {"description": "Unauthorized"}, + "403": {"description": "Forbidden"}, + "404": { + "schema": {"$ref": "#/definitions/error_information"}, + "description": "Policy is not found" + } + }, + "parameters": [{ + "in": "path", + "name": "policy_id", + "description": "policy_id", + "type": "string", + "required": true + }], + "tags": ["A1 Policy Management Version 2.0 (in progress)"] + }, + "delete": { + "summary": "Delete a policy", + "deprecated": false, + "produces": ["*/*"], + "operationId": "deletePolicyUsingDELETE", + "responses": { + "200": {"description": "Not used"}, + "401": {"description": "Unauthorized"}, + "423": { + "schema": {"$ref": "#/definitions/error_information"}, + "description": "Near-RT RIC is not operational" + }, + "204": {"description": "Policy deleted"}, + "403": {"description": "Forbidden"}, + "404": { + "schema": {"$ref": "#/definitions/error_information"}, + "description": "Policy is not found" + } + }, + "parameters": [{ + "in": "path", + "name": "policy_id", + "description": "policy_id", + "type": "string", + "required": true + }], + "tags": ["A1 Policy Management Version 2.0 (in progress)"] + } + }, + "/policy_schema": {"get": { + "summary": "Returns one policy type schema definition", + "deprecated": false, + "produces": ["*/*"], + "operationId": "getPolicySchemaUsingGET", + "responses": { + "200": { + "schema": {"type": "object"}, + "description": "Policy schema" + }, + "401": {"description": "Unauthorized"}, + "403": {"description": "Forbidden"}, + "404": { + "schema": {"type": "string"}, + "description": "The policy type is not found" + } + }, + "parameters": [{ + "in": "query", + "allowEmptyValue": false, + "name": "id", + "description": "The identity of the policy type to get the definition for.", + "type": "string", + "required": true + }], + "tags": ["A1 Policy Management Version 1.0"] + }}, + "/rics": {"get": { + "summary": "Query Near-RT RIC information", + "deprecated": false, + "produces": ["*/*"], + "operationId": "getRicsUsingGET_1", + "responses": { + "200": { + "schema": { + "type": "array", + "items": {"$ref": "#/definitions/ric_info_v1"} + }, + "description": "OK" + }, + "401": {"description": "Unauthorized"}, + "403": {"description": "Forbidden"}, + "404": { + "schema": {"type": "string"}, + "description": "Policy type is not found" + } + }, + "parameters": [{ + "in": "query", + "allowEmptyValue": false, + "name": "policyType", + "description": "The name of the policy type", + "type": "string", + "required": false + }], + "tags": ["A1 Policy Management Version 1.0"] + }}, + "/policy_status": {"get": { + "summary": "Returns a policy status", + "deprecated": false, + "produces": ["*/*"], + "operationId": "getPolicyStatusUsingGET_1", + "responses": { + "200": { + "schema": {"type": "object"}, + "description": "Policy status" + }, + "401": {"description": "Unauthorized"}, + "403": {"description": "Forbidden"}, + "404": { + "schema": {"type": "string"}, + "description": "Policy is not found" + } + }, + "parameters": [{ + "in": "query", + "allowEmptyValue": false, + "name": "id", + "description": "The identity of the policy.", + "type": "string", + "required": true + }], + "tags": ["A1 Policy Management Version 1.0"] + }}, + "/v2/policies/{policy_id}/status": {"get": { + "summary": "Returns a policy status", + "deprecated": false, + "produces": ["application/json"], + "operationId": "getPolicyStatusUsingGET", + "responses": { + "200": { + "schema": {"$ref": "#/definitions/policy_status_info_v2"}, + "description": "Policy status" + }, + "401": {"description": "Unauthorized"}, + "403": {"description": "Forbidden"}, + "404": { + "schema": {"$ref": "#/definitions/error_information"}, + "description": "Policy is not found" + } + }, + "parameters": [{ + "in": "path", + "name": "policy_id", + "description": "policy_id", + "type": "string", + "required": true + }], + "tags": ["A1 Policy Management Version 2.0 (in progress)"] + }}, + "/v2/rics": {"get": { + "summary": "Query Near-RT RIC information", + "deprecated": false, + "produces": ["application/json"], + "description": "The call returns all Near-RT RICs that supports a given policy type identity", + "operationId": "getRicsUsingGET", + "responses": { + "200": { + "schema": {"$ref": "#/definitions/ric_info_list_v2"}, + "description": "OK" + }, + "401": {"description": "Unauthorized"}, + "403": {"description": "Forbidden"}, + "404": { + "schema": {"$ref": "#/definitions/error_information"}, + "description": "Policy type is not found" + } + }, + "parameters": [{ + "in": "query", + "allowEmptyValue": false, + "name": "policytype_id", + "description": "The identity of a policy type. If given, all Near-RT RICs supporteing the policy type are returned", + "type": "string", + "required": false + }], + "tags": ["A1 Policy Management Version 2.0 (in progress)"] + }}, + "/v2/configuration": { + "get": { + "summary": "Returns the contents of the configuration file", + "deprecated": false, + "produces": ["application/json"], + "description": "Note that the file contents is not relevant if the Consul is used.", + "operationId": "getConfigurationUsingGET", + "responses": { + "200": { + "schema": {"type": "object"}, + "description": "Configuration" + }, + "401": {"description": "Unauthorized"}, + "403": {"description": "Forbidden"}, + "404": { + "schema": {"$ref": "#/definitions/error_information"}, + "description": "File is not found or readable" + } + }, + "tags": ["Component Configuration"] + }, + "put": { + "summary": "Replace the current configuration file with the given configuration", + "deprecated": false, + "produces": ["*/*"], + "description": "Note that the file is ignored if the Consul is used.", + "operationId": "putConfigurationUsingPUT", + "responses": { + "200": {"description": "Configuration updated"}, + "201": {"description": "Created"}, + "400": { + "schema": {"$ref": "#/definitions/error_information"}, + "description": "Invalid configuration provided" + }, + "401": {"description": "Unauthorized"}, + "500": { + "schema": {"$ref": "#/definitions/error_information"}, + "description": "Something went wrong when replacing the configuration. Try again." + }, + "403": {"description": "Forbidden"}, + "404": {"description": "Not Found"} + }, + "parameters": [{ + "schema": {"type": "object"}, + "in": "body", + "name": "configuration", + "description": "configuration", + "required": true + }], + "tags": ["Component Configuration"], + "consumes": ["application/json"] + } + }, + "/policy_ids": {"get": { + "summary": "Query policies, only policy identities returned", + "deprecated": false, + "produces": ["*/*"], + "operationId": "getPolicyIdsUsingGET_1", + "responses": { + "200": { + "schema": { + "type": "array", + "items": {"type": "string"} + }, + "description": "Policy identitiess" + }, + "401": {"description": "Unauthorized"}, + "403": {"description": "Forbidden"}, + "404": { + "schema": {"type": "string"}, + "description": "Near-RT RIC or type not found" + } + }, + "parameters": [ + { + "in": "query", + "allowEmptyValue": false, + "name": "ric", + "description": "The name of the Near-RT RIC to get policies for.", + "type": "string", + "required": false + }, + { + "in": "query", + "allowEmptyValue": false, + "name": "service", + "description": "The name of the service to get policies for.", + "type": "string", + "required": false + }, + { + "in": "query", + "allowEmptyValue": false, + "name": "type", + "description": "The name of the policy type to get policies for.", + "type": "string", + "required": false + } + ], + "tags": ["A1 Policy Management Version 1.0"] + }}, + "/policy_schemas": {"get": { + "summary": "Returns policy type schema definitions", + "deprecated": false, + "produces": ["*/*"], + "operationId": "getPolicySchemasUsingGET", + "responses": { + "200": { + "schema": { + "type": "array", + "items": {"type": "object"} + }, + "description": "Policy schemas" + }, + "401": {"description": "Unauthorized"}, + "403": {"description": "Forbidden"}, + "404": { + "schema": {"type": "string"}, + "description": "Near-RT RIC is not found" + } + }, + "parameters": [{ + "in": "query", + "allowEmptyValue": false, + "name": "ric", + "description": "The name of the Near-RT RIC to get the definitions for.", + "type": "string", + "required": false + }], + "tags": ["A1 Policy Management Version 1.0"] + }}, + "/v2/policy-instances": {"get": { + "summary": "Query for A1 policy instances", + "deprecated": false, + "produces": ["application/json"], + "description": "Returns a list of A1 policies matching given search criteria.
If several query parameters are defined, the policies matching all conditions are returned.", + "operationId": "getPolicyInstancesUsingGET", + "responses": { + "200": { + "schema": {"$ref": "#/definitions/policy_info_list_v2"}, + "description": "Policies" + }, + "401": {"description": "Unauthorized"}, + "403": {"description": "Forbidden"}, + "404": { + "schema": {"$ref": "#/definitions/error_information"}, + "description": "Near-RT RIC, policy type or service not found" + } + }, + "parameters": [ + { + "in": "query", + "allowEmptyValue": false, + "name": "policytype_id", + "description": "The identity of the policy type to get policies for.", + "type": "string", + "required": false + }, + { + "in": "query", + "allowEmptyValue": false, + "name": "ric_id", + "description": "The identity of the Near-RT RIC to get policies for.", + "type": "string", + "required": false + }, + { + "in": "query", + "allowEmptyValue": false, + "name": "service_id", + "description": "The identity of the service to get policies for.", + "type": "string", + "required": false + } + ], + "tags": ["A1 Policy Management Version 2.0 (in progress)"] + }}, + "/v2/services": { + "get": { + "summary": "Returns service information", + "deprecated": false, + "produces": ["application/json"], + "description": "Either information about a registered service with given identity or all registered services are returned.", + "operationId": "getServicesUsingGET_1", + "responses": { + "200": { + "schema": {"$ref": "#/definitions/service_list_v2"}, + "description": "OK" + }, + "401": {"description": "Unauthorized"}, + "403": {"description": "Forbidden"}, + "404": { + "schema": {"$ref": "#/definitions/error_information"}, + "description": "Service is not found" + } + }, + "parameters": [{ + "in": "query", + "allowEmptyValue": false, + "name": "service_id", + "description": "The identity of the service", + "type": "string", + "required": false + }], + "tags": ["A1 Policy Management Version 2.0 (in progress)"] + }, + "put": { + "summary": "Register a service", + "deprecated": false, + "produces": ["*/*"], + "description": "Registering a service is needed to: