summaryrefslogtreecommitdiffstats
path: root/a1-policy-management
diff options
context:
space:
mode:
Diffstat (limited to 'a1-policy-management')
-rw-r--r--a1-policy-management/api/pms-api.json1698
-rw-r--r--a1-policy-management/api/pms-api.yaml1071
-rw-r--r--a1-policy-management/pom.xml7
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/SwaggerConfig.java170
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/ServiceCallbackInfo.java11
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/VoidResponse.java4
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/Consts.java3
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/PolicyController.java188
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/PolicyInfo.java17
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/RicInfo.java13
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/RicRepositoryController.java41
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/ServiceController.java67
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/ServiceRegistrationInfo.java9
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/ServiceStatus.java13
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/StatusController.java18
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ConfigurationController.java49
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/Consts.java5
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ErrorResponse.java15
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyController.java161
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyIdList.java7
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyInfo.java21
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyInfoList.java7
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyStatusInfo.java9
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyTypeIdList.java7
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyTypeInfo.java8
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/RicInfo.java15
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/RicInfoList.java7
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/RicRepositoryController.java50
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ServiceController.java70
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ServiceRegistrationInfo.java16
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ServiceStatus.java13
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ServiceStatusList.java7
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/StatusController.java28
-rw-r--r--a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ApplicationTest.java15
-rw-r--r--a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/RappSimulatorController.java20
35 files changed, 1833 insertions, 2027 deletions
diff --git a/a1-policy-management/api/pms-api.json b/a1-policy-management/api/pms-api.json
index fe4554bf..9514f7ed 100644
--- a/a1-policy-management/api/pms-api.json
+++ b/a1-policy-management/api/pms-api.json
@@ -1,1438 +1,1254 @@
{
- "basePath": "/",
+ "components": {"schemas": {
+ "error_information": {
+ "description": "Problem as defined in https://tools.ietf.org/html/rfc7807",
+ "type": "object",
+ "properties": {
+ "detail": {
+ "description": " A human-readable explanation specific to this occurrence of the problem.",
+ "type": "string",
+ "example": "Policy type not found"
+ },
+ "status": {
+ "format": "int32",
+ "description": "The HTTP status code generated by the origin server for this occurrence of the problem. ",
+ "type": "integer",
+ "example": 503
+ }
+ }
+ },
+ "void": {
+ "description": "Void/empty",
+ "type": "object"
+ },
+ "status_info_v2": {
+ "type": "object",
+ "properties": {"status": {
+ "description": "status text",
+ "type": "string"
+ }}
+ },
+ "policy_info_v1": {
+ "type": "object",
+ "properties": {
+ "service": {
+ "description": "the name of the service owning the policy",
+ "type": "string"
+ },
+ "json": {
+ "description": "the configuration of the policy",
+ "type": "object"
+ },
+ "id": {
+ "description": "identity of the policy",
+ "type": "string"
+ },
+ "lastModified": {
+ "description": "timestamp, last modification time",
+ "type": "string"
+ },
+ "type": {
+ "description": "name of the policy type",
+ "type": "string"
+ },
+ "ric": {
+ "description": "identity of the target Near-RT RIC",
+ "type": "string"
+ }
+ }
+ },
+ "service_registration_info_v1": {
+ "type": "object",
+ "properties": {
+ "keepAliveIntervalSeconds": {
+ "format": "int64",
+ "description": "keep alive interval for the service. This is a heartbeat supervision of the service, which in regular intevals must invoke a 'keepAlive' REST call. When a service does not invoke this call within the given time, it is considered unavailble. An unavailable service will be automatically deregistered and its policies will be deleted. Value 0 means no timeout supervision.",
+ "type": "integer"
+ },
+ "callbackUrl": {
+ "description": "callback for notifying of RIC synchronization",
+ "type": "string"
+ },
+ "serviceName": {"type": "string"}
+ }
+ },
+ "ric_info_v2": {
+ "description": "Information for a Near-RT RIC",
+ "type": "object",
+ "properties": {
+ "ric_id": {
+ "description": "identity of the Near-RT RIC",
+ "type": "string"
+ },
+ "managed_element_ids": {
+ "description": "O1 identities for managed entities",
+ "type": "array",
+ "items": {
+ "description": "O1 identities for managed entities",
+ "type": "string"
+ }
+ },
+ "state": {
+ "description": "Represents the states for a Near-RT RIC",
+ "type": "string",
+ "enum": [
+ "UNAVAILABLE",
+ "AVAILABLE",
+ "SYNCHRONIZING",
+ "CONSISTENCY_CHECK"
+ ]
+ },
+ "policytype_ids": {
+ "description": "supported policy types",
+ "type": "array",
+ "items": {
+ "description": "supported policy types",
+ "type": "string"
+ }
+ }
+ }
+ },
+ "service_registration_info_v2": {
+ "description": "Information for one service",
+ "type": "object",
+ "required": ["service_id"],
+ "properties": {
+ "callback_url": {
+ "description": "callback for notifying of Near-RT RIC state changes",
+ "type": "string"
+ },
+ "service_id": {
+ "description": "identity of the service",
+ "type": "string"
+ },
+ "keep_alive_interval_seconds": {
+ "format": "int64",
+ "description": "keep alive interval for the service. This is a heartbeat supervision of the service, which in regular intevals must invoke a 'keepalive' REST call. When a service does not invoke this call within the given time, it is considered unavailble. An unavailable service will be automatically deregistered and its policies will be deleted. Value 0 means no timeout supervision.",
+ "type": "integer"
+ }
+ }
+ },
+ "policy_info_list_v2": {
+ "description": "List of policy information",
+ "type": "object",
+ "properties": {"policies": {
+ "description": "List of policy information",
+ "type": "array",
+ "items": {"$ref": "#/components/schemas/policy_info_v2"}
+ }}
+ },
+ "ric_info_v1": {
+ "type": "object",
+ "properties": {
+ "managedElementIds": {
+ "description": "O1 identities for managed entities",
+ "type": "array",
+ "items": {
+ "description": "O1 identities for managed entities",
+ "type": "string"
+ }
+ },
+ "policyTypes": {
+ "description": "supported policy types",
+ "type": "array",
+ "items": {
+ "description": "supported policy types",
+ "type": "string"
+ }
+ },
+ "state": {
+ "description": "state info",
+ "type": "string"
+ },
+ "ricName": {
+ "description": "identity of the Near-RT RIC",
+ "type": "string"
+ }
+ }
+ },
+ "service_status_v1": {
+ "type": "object",
+ "properties": {
+ "keepAliveIntervalSeconds": {
+ "format": "int64",
+ "description": "policy keep alive timeout",
+ "type": "integer"
+ },
+ "timeSinceLastActivitySeconds": {
+ "format": "int64",
+ "description": "time since last invocation by the service",
+ "type": "integer"
+ },
+ "callbackUrl": {
+ "description": "callback for notifying of RIC synchronization",
+ "type": "string"
+ },
+ "serviceName": {
+ "description": "identity of the service",
+ "type": "string"
+ }
+ }
+ },
+ "policy_status_info_v2": {
+ "description": "Status for one A1-P Policy",
+ "type": "object",
+ "properties": {
+ "last_modified": {
+ "description": "timestamp, last modification time",
+ "type": "string"
+ },
+ "status": {
+ "description": "the Policy status",
+ "type": "object"
+ }
+ }
+ },
+ "service_status_v2": {
+ "description": "List of service information",
+ "type": "object",
+ "properties": {
+ "callback_url": {
+ "description": "callback for notifying of RIC synchronization",
+ "type": "string"
+ },
+ "service_id": {
+ "description": "identity of the service",
+ "type": "string"
+ },
+ "keep_alive_interval_seconds": {
+ "format": "int64",
+ "description": "policy keep alive timeout",
+ "type": "integer"
+ },
+ "time_since_last_activity_seconds": {
+ "format": "int64",
+ "description": "time since last invocation by the service",
+ "type": "integer"
+ }
+ }
+ },
+ "ric_info_list_v2": {
+ "description": "List of Near-RT RIC information",
+ "type": "object",
+ "properties": {"rics": {
+ "description": "List of Near-RT RIC information",
+ "type": "array",
+ "items": {"$ref": "#/components/schemas/ric_info_v2"}
+ }}
+ },
+ "policytype_v2": {
+ "description": "Policy type",
+ "type": "object",
+ "properties": {"policy_schema": {
+ "description": "Policy type json scema. The schema is a json object following http://json-schema.org/draft-07/schema",
+ "type": "object"
+ }}
+ },
+ "policytype_id_list_v2": {
+ "description": "Information about policy types",
+ "type": "object",
+ "properties": {"policytype_ids": {
+ "description": "Policy type identities",
+ "type": "array",
+ "items": {
+ "description": "Policy type identities",
+ "type": "string"
+ }
+ }}
+ },
+ "policy_info_v2": {
+ "description": "Information for one A1-P Policy",
+ "type": "object",
+ "required": [
+ "policy_data",
+ "policy_id",
+ "policytype_id",
+ "ric_id",
+ "service_id"
+ ],
+ "properties": {
+ "ric_id": {
+ "description": "identity of the target Near-RT RIC",
+ "type": "string"
+ },
+ "policy_id": {
+ "description": "identity of the policy",
+ "type": "string"
+ },
+ "transient": {
+ "description": "if true, the policy is deleted at RIC restart. If false, its value is maintained by this service until explicitly deleted. Default false.",
+ "type": "boolean"
+ },
+ "service_id": {
+ "description": "the name of the service owning the policy",
+ "type": "string"
+ },
+ "policy_data": {
+ "description": "the configuration of the policy",
+ "type": "object"
+ },
+ "status_notification_uri": {
+ "description": "Callback URI for policy status updates",
+ "type": "string"
+ },
+ "policytype_id": {
+ "description": "identity of the policy type",
+ "type": "string"
+ }
+ }
+ },
+ "policy_id_list_v2": {
+ "description": "A list of policy identities",
+ "type": "object",
+ "properties": {"policy_ids": {
+ "description": "Policy identities",
+ "type": "array",
+ "items": {
+ "description": "Policy identities",
+ "type": "string"
+ }
+ }}
+ },
+ "service_list_v2": {
+ "description": "List of service information",
+ "type": "object",
+ "properties": {"service_list": {
+ "description": "List of service information",
+ "type": "array",
+ "items": {"$ref": "#/components/schemas/service_status_v2"}
+ }}
+ },
+ "service_callback_info_v2": {
+ "description": "Information transferred as in Service callbacks (callback_url)",
+ "type": "object",
+ "required": [
+ "event_type",
+ "ric_id"
+ ],
+ "properties": {
+ "ric_id": {
+ "description": "identity of a Near-RT RIC",
+ "type": "string"
+ },
+ "event_type": {
+ "description": "values:\nAVAILABLE: the Near-RT RIC has become available for A1 Policy management",
+ "type": "string",
+ "enum": ["AVAILABLE"]
+ }
+ }
+ }
+ }},
+ "openapi": "3.0.1",
"paths": {
"/policy_types": {"get": {
"summary": "Query policy type names",
- "deprecated": false,
- "produces": ["*/*"],
- "operationId": "getPolicyTypesUsingGET_1",
+ "operationId": "getPolicyTypes",
"responses": {
"200": {
- "schema": {
+ "description": "Policy type names",
+ "content": {"*/*": {"schema": {
"type": "array",
"items": {"type": "string"}
- },
- "description": "Policy type names"
+ }}}
},
- "401": {"description": "Unauthorized"},
- "403": {"description": "Forbidden"},
"404": {
- "schema": {"$ref": "#/definitions/error_information"},
- "description": "Near-RT RIC is not found"
+ "description": "Near-RT RIC is not found",
+ "content": {"*/*": {"schema": {"$ref": "#/components/schemas/error_information"}}}
}
},
"parameters": [{
+ "schema": {"type": "string"},
"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 (deprecated)"]
+ "tags": ["A1 Policy Management V1.0"]
}},
"/a1-policy/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. <br>If several query parameters are defined, the policies matching all conditions are returned.",
- "operationId": "getPolicyInstancesUsingGET",
+ "operationId": "getPolicyInstances",
"responses": {
"200": {
- "schema": {"$ref": "#/definitions/policy_info_list_v2"},
- "description": "Policies"
+ "description": "Policies",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/policy_info_list_v2"}}}
},
- "401": {"description": "Unauthorized"},
- "403": {"description": "Forbidden"},
"404": {
- "schema": {"$ref": "#/definitions/error_information"},
- "description": "Near-RT RIC, policy type or service not found"
+ "description": "Near-RT RIC, policy type or service not found",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/error_information"}}}
}
},
"parameters": [
{
+ "schema": {"type": "string"},
"in": "query",
- "allowEmptyValue": false,
"name": "policytype_id",
"description": "The identity of the policy type to get policies for.",
- "type": "string",
"required": false
},
{
+ "schema": {"type": "string"},
"in": "query",
- "allowEmptyValue": false,
"name": "ric_id",
"description": "The identity of the Near-RT RIC to get policies for.",
- "type": "string",
"required": false
},
{
+ "schema": {"type": "string"},
"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"]
+ "tags": ["A1 Policy Management"]
}},
"/a1-policy/v2/status": {"get": {
"summary": "Returns status and statistics of this service",
- "deprecated": false,
- "produces": ["application/json"],
- "operationId": "getStatusUsingGET",
- "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"]
+ "operationId": "getStatus_1",
+ "responses": {"200": {
+ "description": "Service is living",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/status_info_v2"}}}
+ }},
+ "tags": ["Health Check"]
}},
"/services": {
"get": {
"summary": "Returns service information",
- "deprecated": false,
- "produces": ["*/*"],
- "operationId": "getServicesUsingGET_1",
+ "operationId": "getServices",
"responses": {
"200": {
- "schema": {
+ "description": "OK",
+ "content": {"*/*": {"schema": {
"type": "array",
- "items": {"$ref": "#/definitions/service_status_v1"}
- },
- "description": "OK"
+ "items": {"$ref": "#/components/schemas/service_status_v1"}
+ }}}
},
- "401": {"description": "Unauthorized"},
- "403": {"description": "Forbidden"},
"404": {
- "schema": {"type": "string"},
- "description": "Service is not found"
+ "description": "Service is not found",
+ "content": {"*/*": {"schema": {"type": "string"}}}
}
},
"parameters": [{
+ "schema": {"type": "string"},
"in": "query",
- "allowEmptyValue": false,
"name": "name",
"description": "The name of the service",
- "type": "string",
"required": false
}],
- "tags": ["A1 Policy Management Version 1.0 (deprecated)"]
+ "tags": ["A1 Policy Management V1.0"]
},
"delete": {
"summary": "Delete a service",
- "deprecated": false,
- "produces": ["*/*"],
- "operationId": "deleteServiceUsingDELETE_1",
+ "operationId": "deleteService",
"responses": {
- "200": {
- "schema": {"type": "string"},
- "description": "OK"
- },
- "401": {"description": "Unauthorized"},
"204": {
- "schema": {"type": "string"},
- "description": "Service deleted"
+ "description": "Service deleted",
+ "content": {"*/*": {"schema": {"$ref": "#/components/schemas/void"}}}
},
- "403": {"description": "Forbidden"},
"404": {
- "schema": {"type": "string"},
- "description": "Service not found"
+ "description": "Service not found",
+ "content": {"*/*": {"schema": {"type": "string"}}}
}
},
"parameters": [{
+ "schema": {"type": "string"},
"in": "query",
- "allowEmptyValue": false,
"name": "name",
"description": "The name of the service",
- "type": "string",
"required": true
}],
- "tags": ["A1 Policy Management Version 1.0 (deprecated)"]
+ "tags": ["A1 Policy Management V1.0"]
}
},
"/a1-policy/v2/rics/ric": {"get": {
"summary": "Returns info for one Near-RT RIC",
- "deprecated": false,
- "produces": ["application/json"],
"description": "Either a Near-RT RIC identity or a Mananged Element identity can be specified.<br>The intention with Mananged Element identity is the ID used in O1 for accessing the traffical element (such as the ID of CU).",
- "operationId": "getRicUsingGET_1",
+ "operationId": "getRic_1",
"responses": {
"200": {
- "schema": {"$ref": "#/definitions/ric_info_v2"},
- "description": "Near-RT RIC is found"
+ "description": "Near-RT RIC is found",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ric_info_v2"}}}
},
- "401": {"description": "Unauthorized"},
- "403": {"description": "Forbidden"},
"404": {
- "schema": {"$ref": "#/definitions/error_information"},
- "description": "Near-RT RIC is not found"
+ "description": "Near-RT RIC is not found",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/error_information"}}}
}
},
"parameters": [
{
+ "schema": {"type": "string"},
"in": "query",
- "allowEmptyValue": false,
"name": "managed_element_id",
"description": "The identity of a Managed Element. If given, the Near-RT RIC managing the ME is returned.",
- "type": "string",
"required": false
},
{
+ "schema": {"type": "string"},
"in": "query",
- "allowEmptyValue": false,
"name": "ric_id",
"description": "The identity of a Near-RT RIC to get information for.",
- "type": "string",
"required": false
}
],
- "tags": ["A1 Policy Management Version 2.0"]
+ "tags": ["NearRT-RIC Repository"]
+ }},
+ "/a1-policy/v2/policy-types": {"get": {
+ "summary": "Query policy type identities",
+ "operationId": "getPolicyTypes_1",
+ "responses": {
+ "200": {
+ "description": "Policy type IDs",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/policytype_id_list_v2"}}}
+ },
+ "404": {
+ "description": "Near-RT RIC is not found",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/error_information"}}}
+ }
+ },
+ "parameters": [{
+ "schema": {"type": "string"},
+ "in": "query",
+ "name": "ric_id",
+ "description": "The identity of the Near-RT RIC to get types for.",
+ "required": false
+ }],
+ "tags": ["A1 Policy Management"]
}},
"/a1-policy/v2/policies/{policy_id}": {
"get": {
"summary": "Returns a policy",
- "deprecated": false,
- "produces": ["application/json"],
- "operationId": "getPolicyUsingGET",
+ "operationId": "getPolicy_1",
"responses": {
"200": {
- "schema": {"$ref": "#/definitions/policy_info_v2"},
- "description": "Policy found"
+ "description": "Policy found",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/policy_info_v2"}}}
},
- "401": {"description": "Unauthorized"},
- "403": {"description": "Forbidden"},
"404": {
- "schema": {"$ref": "#/definitions/error_information"},
- "description": "Policy is not found"
+ "description": "Policy is not found",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/error_information"}}}
}
},
"parameters": [{
+ "schema": {"type": "string"},
"in": "path",
"name": "policy_id",
- "description": "policy_id",
- "type": "string",
"required": true
}],
- "tags": ["A1 Policy Management Version 2.0"]
+ "tags": ["A1 Policy Management"]
},
"delete": {
"summary": "Delete a policy",
- "deprecated": false,
- "produces": ["*/*"],
- "operationId": "deletePolicyUsingDELETE",
+ "operationId": "deletePolicy_1",
"responses": {
- "200": {"description": "Not used"},
- "401": {"description": "Unauthorized"},
+ "200": {
+ "description": "Not used",
+ "content": {"*/*": {"schema": {"$ref": "#/components/schemas/void"}}}
+ },
"423": {
- "schema": {"$ref": "#/definitions/error_information"},
- "description": "Near-RT RIC is not operational"
+ "description": "Near-RT RIC is not operational",
+ "content": {"*/*": {"schema": {"$ref": "#/components/schemas/error_information"}}}
+ },
+ "204": {
+ "description": "Policy deleted",
+ "content": {"*/*": {"schema": {"$ref": "#/components/schemas/void"}}}
},
- "204": {"description": "Policy deleted"},
- "403": {"description": "Forbidden"},
"404": {
- "schema": {"$ref": "#/definitions/error_information"},
- "description": "Policy is not found"
+ "description": "Policy is not found",
+ "content": {"*/*": {"schema": {"$ref": "#/components/schemas/error_information"}}}
}
},
"parameters": [{
+ "schema": {"type": "string"},
"in": "path",
"name": "policy_id",
- "description": "policy_id",
- "type": "string",
"required": true
}],
- "tags": ["A1 Policy Management Version 2.0"]
+ "tags": ["A1 Policy Management"]
}
},
- "/a1-policy/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"]
- }},
"/a1-policy/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",
+ "operationId": "getConfiguration",
"responses": {
"200": {
- "schema": {"type": "object"},
- "description": "Configuration"
+ "description": "Configuration",
+ "content": {"application/json": {"schema": {"type": "object"}}}
},
- "401": {"description": "Unauthorized"},
- "403": {"description": "Forbidden"},
"404": {
- "schema": {"$ref": "#/definitions/error_information"},
- "description": "File is not found or readable"
+ "description": "File is not found or readable",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/error_information"}}}
}
},
- "tags": ["Component Configuration"]
+ "tags": ["Management of configuration"]
},
"put": {
"summary": "Replace the current configuration file with the given configuration",
- "deprecated": false,
- "produces": ["*/*"],
+ "requestBody": {
+ "content": {"application/json": {"schema": {"type": "object"}}},
+ "required": true
+ },
"description": "Note that the file is ignored if the Consul is used.",
- "operationId": "putConfigurationUsingPUT",
+ "operationId": "putConfiguration",
"responses": {
- "200": {"description": "Configuration updated"},
- "201": {"description": "Created"},
+ "200": {
+ "description": "Configuration updated",
+ "content": {"*/*": {"schema": {"$ref": "#/components/schemas/void"}}}
+ },
"400": {
- "schema": {"$ref": "#/definitions/error_information"},
- "description": "Invalid configuration provided"
+ "description": "Invalid configuration provided",
+ "content": {"*/*": {"schema": {"$ref": "#/components/schemas/error_information"}}}
},
- "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"}
+ "description": "Something went wrong when replacing the configuration. Try again.",
+ "content": {"*/*": {"schema": {"$ref": "#/components/schemas/error_information"}}}
+ }
},
- "parameters": [{
- "schema": {"type": "object"},
- "in": "body",
- "name": "configuration",
- "description": "configuration",
- "required": true
- }],
- "tags": ["Component Configuration"],
- "consumes": ["application/json"]
+ "tags": ["Management of configuration"]
}
},
"/policy": {
"get": {
"summary": "Returns a policy configuration",
- "deprecated": false,
- "produces": ["*/*"],
- "operationId": "getPolicyUsingGET_1",
+ "operationId": "getPolicy",
"responses": {
"200": {
- "schema": {"type": "object"},
- "description": "Policy found"
+ "description": "Policy found",
+ "content": {"*/*": {"schema": {"type": "object"}}}
},
- "401": {"description": "Unauthorized"},
- "403": {"description": "Forbidden"},
"404": {
- "schema": {"$ref": "#/definitions/error_information"},
- "description": "Policy is not found"
+ "description": "Policy is not found",
+ "content": {"*/*": {"schema": {"$ref": "#/components/schemas/error_information"}}}
}
},
"parameters": [{
+ "schema": {"type": "string"},
"in": "query",
- "allowEmptyValue": false,
"name": "id",
"description": "The identity of the policy instance.",
- "type": "string",
"required": true
}],
- "tags": ["A1 Policy Management Version 1.0 (deprecated)"]
+ "tags": ["A1 Policy Management V1.0"]
},
"delete": {
"summary": "Delete a policy",
- "deprecated": false,
- "produces": ["*/*"],
- "operationId": "deletePolicyUsingDELETE_1",
+ "operationId": "deletePolicy",
"responses": {
- "200": {"description": "Not used"},
- "401": {"description": "Unauthorized"},
+ "200": {
+ "description": "Not used",
+ "content": {"*/*": {"schema": {"$ref": "#/components/schemas/void"}}}
+ },
"423": {
- "schema": {"type": "string"},
- "description": "Near-RT RIC is not operational"
+ "description": "Near-RT RIC is not operational",
+ "content": {"*/*": {"schema": {"type": "string"}}}
+ },
+ "204": {
+ "description": "Policy deleted",
+ "content": {"*/*": {"schema": {"$ref": "#/components/schemas/void"}}}
},
- "204": {"description": "Policy deleted"},
- "403": {"description": "Forbidden"},
"404": {
- "schema": {"type": "string"},
- "description": "Policy is not found"
+ "description": "Policy is not found",
+ "content": {"*/*": {"schema": {"type": "string"}}}
}
},
"parameters": [{
+ "schema": {"type": "string"},
"in": "query",
- "allowEmptyValue": false,
"name": "id",
"description": "The identity of the policy instance.",
- "type": "string",
"required": true
}],
- "tags": ["A1 Policy Management Version 1.0 (deprecated)"]
+ "tags": ["A1 Policy Management V1.0"]
},
"put": {
"summary": "Put a policy",
- "deprecated": false,
- "produces": ["*/*"],
- "operationId": "putPolicyUsingPUT_1",
+ "requestBody": {
+ "content": {"application/json": {"schema": {"type": "object"}}},
+ "required": true
+ },
+ "operationId": "putPolicy",
"responses": {
- "200": {"description": "Policy updated"},
- "201": {"description": "Policy created"},
- "401": {"description": "Unauthorized"},
+ "200": {
+ "description": "Policy updated",
+ "content": {"*/*": {"schema": {"$ref": "#/components/schemas/void"}}}
+ },
+ "201": {
+ "description": "Policy created",
+ "content": {"*/*": {"schema": {"$ref": "#/components/schemas/void"}}}
+ },
"423": {
- "schema": {"type": "string"},
- "description": "Near-RT RIC is not operational"
+ "description": "Near-RT RIC is not operational",
+ "content": {"*/*": {"schema": {"type": "string"}}}
},
- "403": {"description": "Forbidden"},
"404": {
- "schema": {"type": "string"},
- "description": "Near-RT RIC or policy type is not found"
+ "description": "Near-RT RIC or policy type is not found",
+ "content": {"*/*": {"schema": {"type": "string"}}}
}
},
"parameters": [
{
+ "schema": {
+ "default": "",
+ "type": "string"
+ },
"in": "query",
- "allowEmptyValue": false,
- "name": "id",
- "description": "The identity of the policy instance.",
- "type": "string",
- "required": true
+ "name": "type",
+ "description": "The name of the policy type.",
+ "required": false
},
{
- "schema": {"type": "object"},
- "in": "body",
- "name": "jsonBody",
- "description": "jsonBody",
+ "schema": {"type": "string"},
+ "in": "query",
+ "name": "id",
+ "description": "The identity of the policy instance.",
"required": true
},
{
+ "schema": {"type": "string"},
"in": "query",
- "allowEmptyValue": false,
"name": "ric",
"description": "The name of the Near-RT RIC where the policy will be created.",
- "type": "string",
"required": true
},
{
+ "schema": {"type": "string"},
"in": "query",
- "allowEmptyValue": false,
"name": "service",
"description": "The name of the service creating the policy.",
- "type": "string",
"required": true
},
{
- "default": false,
+ "schema": {
+ "default": false,
+ "type": "boolean"
+ },
"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 (deprecated)"],
- "consumes": ["application/json"]
+ "tags": ["A1 Policy Management V1.0"]
}
},
"/policies": {"get": {
"summary": "Query policies",
- "deprecated": false,
- "produces": ["*/*"],
- "operationId": "getPoliciesUsingGET",
+ "operationId": "getPolicies",
"responses": {
"200": {
- "schema": {
+ "description": "Policies",
+ "content": {"*/*": {"schema": {
"type": "array",
- "items": {"$ref": "#/definitions/policy_info_v1"}
- },
- "description": "Policies"
+ "items": {"$ref": "#/components/schemas/policy_info_v1"}
+ }}}
},
- "401": {"description": "Unauthorized"},
- "403": {"description": "Forbidden"},
"404": {
- "schema": {"type": "string"},
- "description": "Near-RT RIC or type not found"
+ "description": "Near-RT RIC or type not found",
+ "content": {"*/*": {"schema": {"type": "string"}}}
}
},
"parameters": [
{
+ "schema": {"type": "string"},
"in": "query",
- "allowEmptyValue": false,
- "name": "ric",
- "description": "The name of the Near-RT RIC to get policies for.",
- "type": "string",
+ "name": "type",
+ "description": "The name of the policy type to get policies for.",
"required": false
},
{
+ "schema": {"type": "string"},
"in": "query",
- "allowEmptyValue": false,
- "name": "service",
- "description": "The name of the service to get policies for.",
- "type": "string",
+ "name": "ric",
+ "description": "The name of the Near-RT RIC to get policies for.",
"required": false
},
{
+ "schema": {"type": "string"},
"in": "query",
- "allowEmptyValue": false,
- "name": "type",
- "description": "The name of the policy type to get policies for.",
- "type": "string",
+ "name": "service",
+ "description": "The name of the service to get policies for.",
"required": false
}
],
- "tags": ["A1 Policy Management Version 1.0 (deprecated)"]
+ "tags": ["A1 Policy Management V1.0"]
}},
"/a1-policy/v2/services/{service_id}/keepalive": {"put": {
"summary": "Heartbeat indicates that the service is running",
- "deprecated": false,
- "produces": ["*/*"],
- "operationId": "keepAliveServiceUsingPUT",
+ "description": "A registerred service must call this in regular intervals to indicate that it is in operation. Absence of this call will lead to that teh service will be deregisterred and all its policies are removed.",
+ "operationId": "keepAliveService_1",
"responses": {
"200": {
- "schema": {"type": "object"},
- "description": "Service supervision timer refreshed, OK"
+ "description": "Service supervision timer refreshed, OK",
+ "content": {"*/*": {"schema": {"type": "object"}}}
},
- "201": {"description": "Created"},
- "401": {"description": "Unauthorized"},
- "403": {"description": "Forbidden"},
"404": {
- "schema": {"$ref": "#/definitions/error_information"},
- "description": "The service is not found, needs re-registration"
+ "description": "The service is not found, needs re-registration",
+ "content": {"*/*": {"schema": {"$ref": "#/components/schemas/error_information"}}}
}
},
"parameters": [{
+ "schema": {"type": "string"},
"in": "path",
"name": "service_id",
- "description": "service_id",
- "type": "string",
"required": true
}],
- "tags": ["A1 Policy Management Version 2.0"],
- "consumes": ["application/json"]
+ "tags": ["Service Registry and Supervision"]
}},
- "/policy_schema": {"get": {
- "summary": "Returns one policy type schema definition",
- "deprecated": false,
- "produces": ["*/*"],
- "operationId": "getPolicySchemaUsingGET",
+ "/rics": {"get": {
+ "summary": "Query Near-RT RIC information",
+ "operationId": "getRics",
"responses": {
"200": {
- "schema": {"type": "object"},
- "description": "Policy schema"
+ "description": "OK",
+ "content": {"*/*": {"schema": {
+ "type": "array",
+ "items": {"$ref": "#/components/schemas/ric_info_v1"}
+ }}}
},
- "401": {"description": "Unauthorized"},
- "403": {"description": "Forbidden"},
"404": {
- "schema": {"$ref": "#/definitions/error_information"},
- "description": "The policy type is not found"
+ "description": "Policy type is not found",
+ "content": {"*/*": {"schema": {"type": "string"}}}
}
},
"parameters": [{
+ "schema": {"type": "string"},
"in": "query",
- "allowEmptyValue": false,
- "name": "id",
- "description": "The identity of the policy type to get the definition for.",
- "type": "string",
- "required": true
+ "name": "policyType",
+ "description": "The name of the policy type",
+ "required": false
}],
- "tags": ["A1 Policy Management Version 1.0 (deprecated)"]
+ "tags": ["A1 Policy Management V1.0"]
}},
- "/rics": {"get": {
- "summary": "Query Near-RT RIC information",
- "deprecated": false,
- "produces": ["*/*"],
- "operationId": "getRicsUsingGET",
+ "/policy_schema": {"get": {
+ "summary": "Returns one policy type schema definition",
+ "operationId": "getPolicySchema",
"responses": {
"200": {
- "schema": {
- "type": "array",
- "items": {"$ref": "#/definitions/ric_info_v1"}
- },
- "description": "OK"
+ "description": "Policy schema",
+ "content": {"*/*": {"schema": {"type": "object"}}}
},
- "401": {"description": "Unauthorized"},
- "403": {"description": "Forbidden"},
"404": {
- "schema": {"type": "string"},
- "description": "Policy type is not found"
+ "description": "The policy type is not found",
+ "content": {"*/*": {"schema": {"$ref": "#/components/schemas/error_information"}}}
}
},
"parameters": [{
+ "schema": {"type": "string"},
"in": "query",
- "allowEmptyValue": false,
- "name": "policyType",
- "description": "The name of the policy type",
- "type": "string",
- "required": false
+ "name": "id",
+ "description": "The identity of the policy type to get the definition for.",
+ "required": true
}],
- "tags": ["A1 Policy Management Version 1.0 (deprecated)"]
+ "tags": ["A1 Policy Management V1.0"]
}},
"/policy_status": {"get": {
"summary": "Returns a policy status",
- "deprecated": false,
- "produces": ["*/*"],
- "operationId": "getPolicyStatusUsingGET_1",
+ "operationId": "getPolicyStatus",
"responses": {
"200": {
- "schema": {"type": "object"},
- "description": "Policy status"
+ "description": "Policy status",
+ "content": {"*/*": {"schema": {"type": "object"}}}
},
- "401": {"description": "Unauthorized"},
- "403": {"description": "Forbidden"},
"404": {
- "schema": {"type": "string"},
- "description": "Policy is not found"
+ "description": "Policy is not found",
+ "content": {"*/*": {"schema": {"type": "string"}}}
}
},
"parameters": [{
+ "schema": {"type": "string"},
"in": "query",
- "allowEmptyValue": false,
"name": "id",
"description": "The identity of the policy.",
- "type": "string",
"required": true
}],
- "tags": ["A1 Policy Management Version 1.0 (deprecated)"]
+ "tags": ["A1 Policy Management V1.0"]
}},
"/a1-policy/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_1",
+ "operationId": "getRics_1",
"responses": {
"200": {
- "schema": {"$ref": "#/definitions/ric_info_list_v2"},
- "description": "OK"
+ "description": "OK",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ric_info_list_v2"}}}
},
- "401": {"description": "Unauthorized"},
- "403": {"description": "Forbidden"},
"404": {
- "schema": {"$ref": "#/definitions/error_information"},
- "description": "Policy type is not found"
+ "description": "Policy type is not found",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/error_information"}}}
}
},
"parameters": [{
+ "schema": {"type": "string"},
"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"]
+ "tags": ["NearRT-RIC Repository"]
+ }},
+ "/policy_schemas": {"get": {
+ "summary": "Returns policy type schema definitions",
+ "operationId": "getPolicySchemas",
+ "responses": {
+ "200": {
+ "description": "Policy schemas",
+ "content": {"*/*": {"schema": {
+ "type": "array",
+ "items": {"type": "object"}
+ }}}
+ },
+ "404": {
+ "description": "Near-RT RIC is not found",
+ "content": {"*/*": {"schema": {"$ref": "#/components/schemas/error_information"}}}
+ }
+ },
+ "parameters": [{
+ "schema": {"type": "string"},
+ "in": "query",
+ "name": "ric",
+ "description": "The name of the Near-RT RIC to get the definitions for.",
+ "required": false
+ }],
+ "tags": ["A1 Policy Management V1.0"]
}},
"/policy_ids": {"get": {
"summary": "Query policies, only policy identities returned",
- "deprecated": false,
- "produces": ["*/*"],
- "operationId": "getPolicyIdsUsingGET_1",
+ "operationId": "getPolicyIds",
"responses": {
"200": {
- "schema": {
+ "description": "Policy identitiess",
+ "content": {"*/*": {"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"
+ "description": "Near-RT RIC or type not found",
+ "content": {"*/*": {"schema": {"type": "string"}}}
}
},
"parameters": [
{
+ "schema": {"type": "string"},
"in": "query",
- "allowEmptyValue": false,
- "name": "ric",
- "description": "The name of the Near-RT RIC to get policies for.",
- "type": "string",
+ "name": "type",
+ "description": "The name of the policy type to get policies for.",
"required": false
},
{
+ "schema": {"type": "string"},
"in": "query",
- "allowEmptyValue": false,
- "name": "service",
- "description": "The name of the service to get policies for.",
- "type": "string",
+ "name": "ric",
+ "description": "The name of the Near-RT RIC to get policies for.",
"required": false
},
{
+ "schema": {"type": "string"},
"in": "query",
- "allowEmptyValue": false,
- "name": "type",
- "description": "The name of the policy type to get policies for.",
- "type": "string",
+ "name": "service",
+ "description": "The name of the service to get policies for.",
"required": false
}
],
- "tags": ["A1 Policy Management Version 1.0 (deprecated)"]
- }},
- "/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": {"$ref": "#/definitions/error_information"},
- "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 (deprecated)"]
+ "tags": ["A1 Policy Management V1.0"]
}},
"/a1-policy/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",
+ "operationId": "getServices_1",
"responses": {
"200": {
- "schema": {"$ref": "#/definitions/service_list_v2"},
- "description": "OK"
+ "description": "OK",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/service_list_v2"}}}
},
- "401": {"description": "Unauthorized"},
- "403": {"description": "Forbidden"},
"404": {
- "schema": {"$ref": "#/definitions/error_information"},
- "description": "Service is not found"
+ "description": "Service is not found",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/error_information"}}}
}
},
"parameters": [{
+ "schema": {"type": "string"},
"in": "query",
- "allowEmptyValue": false,
"name": "service_id",
"description": "The identity of the service",
- "type": "string",
"required": false
}],
- "tags": ["A1 Policy Management Version 2.0"]
+ "tags": ["Service Registry and Supervision"]
},
"put": {
"summary": "Register a service",
- "deprecated": false,
- "produces": ["*/*"],
+ "requestBody": {
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/service_registration_info_v2"}}},
+ "required": true
+ },
"description": "Registering a service is needed to:<ul><li>Get callbacks.<\/li><li>Activate supervision of the service. If a service is inactive, its policies will be deleted.<\/li><\/ul>",
- "operationId": "putServiceUsingPUT",
+ "operationId": "putService_1",
"responses": {
"200": {
- "schema": {"type": "object"},
- "description": "Service updated"
+ "description": "Service updated",
+ "content": {"*/*": {"schema": {"type": "object"}}}
},
"201": {
- "schema": {"type": "object"},
- "description": "Service created"
+ "description": "Service created",
+ "content": {"*/*": {"schema": {"type": "object"}}}
},
"400": {
- "schema": {"$ref": "#/definitions/error_information"},
- "description": "The ServiceRegistrationInfo is not accepted"
- },
- "401": {"description": "Unauthorized"},
- "403": {"description": "Forbidden"},
- "404": {"description": "Not Found"}
+ "description": "The ServiceRegistrationInfo is not accepted",
+ "content": {"*/*": {"schema": {"$ref": "#/components/schemas/error_information"}}}
+ }
},
- "parameters": [{
- "schema": {"$ref": "#/definitions/service_registration_info_v2"},
- "in": "body",
- "name": "registrationInfo",
- "description": "registrationInfo",
- "required": true
- }],
- "tags": ["A1 Policy Management Version 2.0"],
- "consumes": ["application/json"]
+ "tags": ["Service Registry and Supervision"]
}
},
"/ric": {"get": {
"summary": "Returns the name of a RIC managing one Mananged Element",
- "deprecated": false,
- "produces": ["*/*"],
- "operationId": "getRicUsingGET",
+ "operationId": "getRic",
"responses": {
"200": {
- "schema": {"type": "string"},
- "description": "Near-RT RIC is found"
+ "description": "Near-RT RIC is found",
+ "content": {"*/*": {"schema": {"type": "string"}}}
},
- "401": {"description": "Unauthorized"},
- "403": {"description": "Forbidden"},
"404": {
- "schema": {"type": "string"},
- "description": "Near-RT RIC is not found"
+ "description": "Near-RT RIC is not found",
+ "content": {"*/*": {"schema": {"type": "string"}}}
}
},
"parameters": [{
+ "schema": {"type": "string"},
"in": "query",
- "allowEmptyValue": false,
"name": "managedElementId",
"description": "The identity of the Managed Element",
- "type": "string",
"required": true
}],
- "tags": ["A1 Policy Management Version 1.0 (deprecated)"]
+ "tags": ["A1 Policy Management V1.0"]
}},
"/services/keepalive": {"put": {
"summary": "Heartbeat from a service",
- "deprecated": false,
- "produces": ["*/*"],
- "operationId": "keepAliveServiceUsingPUT_1",
+ "operationId": "keepAliveService",
"responses": {
"200": {
- "schema": {"type": "string"},
- "description": "Service supervision timer refreshed, OK"
+ "description": "Service supervision timer refreshed, OK",
+ "content": {"*/*": {"schema": {"type": "string"}}}
},
- "201": {"description": "Created"},
- "401": {"description": "Unauthorized"},
- "403": {"description": "Forbidden"},
- "404": {"description": "The service is not found, needs re-registration"}
+ "404": {
+ "description": "The service is not found, needs re-registration",
+ "content": {"*/*": {"schema": {"type": "string"}}}
+ }
},
"parameters": [{
+ "schema": {"type": "string"},
"in": "query",
- "allowEmptyValue": false,
"name": "name",
"description": "The name of the service",
- "type": "string",
"required": true
}],
- "tags": ["A1 Policy Management Version 1.0 (deprecated)"],
- "consumes": ["application/json"]
+ "tags": ["A1 Policy Management V1.0"]
+ }},
+ "/status": {"get": {
+ "summary": "Returns status and statistics of this service",
+ "operationId": "getStatus",
+ "responses": {"200": {
+ "description": "Service is living",
+ "content": {"*/*": {"schema": {"type": "string"}}}
+ }},
+ "tags": ["A1 Policy Management V1.0"]
}},
"/a1-policy/v2/policy-types/{policytype_id}": {"get": {
"summary": "Returns a policy type definition",
- "deprecated": false,
- "produces": ["application/json"],
- "operationId": "getPolicyTypeUsingGET",
+ "operationId": "getPolicyType",
"responses": {
"200": {
- "schema": {"$ref": "#/definitions/policytype_v2"},
- "description": "Policy type"
+ "description": "Policy type",
+ "content": {"*/*": {"schema": {"$ref": "#/components/schemas/policytype_v2"}}}
},
- "401": {"description": "Unauthorized"},
- "403": {"description": "Forbidden"},
"404": {
- "schema": {"$ref": "#/definitions/error_information"},
- "description": "Policy type is not found"
+ "description": "Policy type is not found",
+ "content": {"*/*": {"schema": {"$ref": "#/components/schemas/error_information"}}}
}
},
"parameters": [{
+ "schema": {"type": "string"},
"in": "path",
"name": "policytype_id",
- "description": "policytype_id",
- "type": "string",
"required": true
}],
- "tags": ["A1 Policy Management Version 2.0"]
- }},
- "/status": {"get": {
- "summary": "Returns status and statistics of this service",
- "deprecated": false,
- "produces": ["*/*"],
- "operationId": "getStatusUsingGET_1",
- "responses": {
- "200": {
- "schema": {"type": "string"},
- "description": "Service is living"
- },
- "401": {"description": "Unauthorized"},
- "403": {"description": "Forbidden"},
- "404": {"description": "Not Found"}
- },
- "tags": ["A1 Policy Management Version 1.0 (deprecated)"]
+ "tags": ["A1 Policy Management"]
}},
"/a1-policy/v2/policies": {
"get": {
"summary": "Query policy identities",
- "deprecated": false,
- "produces": ["application/json"],
"description": "Returns a list of A1 policies matching given search criteria. <br>If several query parameters are defined, the policies matching all conditions are returned.",
- "operationId": "getPolicyIdsUsingGET",
+ "operationId": "getPolicyIds_1",
"responses": {
"200": {
- "schema": {"$ref": "#/definitions/policy_id_list_v2"},
- "description": "Policy identities"
+ "description": "Policy identities",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/policy_id_list_v2"}}}
},
- "401": {"description": "Unauthorized"},
- "403": {"description": "Forbidden"},
"404": {
- "schema": {"$ref": "#/definitions/error_information"},
- "description": "Near-RT RIC or type not found"
+ "description": "Near-RT RIC or type not found",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/error_information"}}}
}
},
"parameters": [
{
+ "schema": {"type": "string"},
"in": "query",
- "allowEmptyValue": false,
"name": "policytype_id",
"description": "The identity of the policy type to get policies for.",
- "type": "string",
"required": false
},
{
+ "schema": {"type": "string"},
"in": "query",
- "allowEmptyValue": false,
"name": "ric_id",
"description": "The identity of the Near-RT RIC to get policies for.",
- "type": "string",
"required": false
},
{
+ "schema": {"type": "string"},
"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"]
+ "tags": ["A1 Policy Management"]
},
"put": {
"summary": "Create or update a policy",
- "deprecated": false,
- "produces": ["application/json"],
- "operationId": "putPolicyUsingPUT",
+ "requestBody": {
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/policy_info_v2"}}},
+ "required": true
+ },
+ "operationId": "putPolicy_1",
"responses": {
- "200": {"description": "Policy updated"},
- "201": {"description": "Policy created"},
- "401": {"description": "Unauthorized"},
+ "200": {
+ "description": "Policy updated",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/void"}}}
+ },
+ "201": {
+ "description": "Policy created",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/void"}}}
+ },
"423": {
- "schema": {"$ref": "#/definitions/error_information"},
- "description": "Near-RT RIC is not operational"
+ "description": "Near-RT RIC is not operational",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/error_information"}}}
},
- "403": {"description": "Forbidden"},
"404": {
- "schema": {"$ref": "#/definitions/error_information"},
- "description": "Near-RT RIC or policy type is not found"
+ "description": "Near-RT RIC or policy type is not found",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/error_information"}}}
}
},
- "parameters": [{
- "schema": {"$ref": "#/definitions/policy_info_v2"},
- "in": "body",
- "name": "policyInfo",
- "description": "policyInfo",
- "required": true
- }],
- "tags": ["A1 Policy Management Version 2.0"],
- "consumes": ["application/json"]
+ "tags": ["A1 Policy Management"]
}
},
- "/r-app/pms-callback": {"post": {
+ "/r-app/near-rt-ric-status": {"post": {
"summary": "Callback for Near-RT RIC status",
- "deprecated": false,
- "produces": ["application/json"],
+ "requestBody": {
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/service_callback_info_v2"}}},
+ "required": true
+ },
"description": "The URL to this call is registerred at Service registration.",
- "operationId": "jobStatusCallbackUsingPOST",
+ "operationId": "jobStatusCallback",
+ "responses": {"200": {
+ "description": "OK",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/void"}}}
+ }},
+ "tags": ["Callbacks"]
+ }},
+ "/service": {"put": {
+ "summary": "Register a service",
+ "requestBody": {
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/service_registration_info_v1"}}},
+ "required": true
+ },
+ "operationId": "putService",
"responses": {
- "200": {"description": "OK"},
- "201": {"description": "Created"},
- "401": {"description": "Unauthorized"},
- "403": {"description": "Forbidden"},
- "404": {"description": "Not Found"}
+ "200": {
+ "description": "Service updated",
+ "content": {"*/*": {"schema": {"type": "string"}}}
+ },
+ "201": {
+ "description": "Service created",
+ "content": {"*/*": {"schema": {"type": "string"}}}
+ },
+ "400": {
+ "description": "The ServiceRegistrationInfo is not accepted",
+ "content": {"*/*": {"schema": {"type": "string"}}}
+ }
},
- "parameters": [{
- "schema": {"$ref": "#/definitions/service_callback_info_v2"},
- "in": "body",
- "name": "body",
- "description": "body",
- "required": true
- }],
- "tags": ["R-App Callbacks"],
- "consumes": ["application/json"]
+ "tags": ["A1 Policy Management V1.0"]
}},
"/a1-policy/v2/services/{service_id}": {"delete": {
"summary": "Unregister a service",
- "deprecated": false,
- "produces": ["*/*"],
- "operationId": "deleteServiceUsingDELETE",
+ "operationId": "deleteService_1",
"responses": {
- "200": {"description": "Not used"},
- "401": {"description": "Unauthorized"},
+ "200": {
+ "description": "Not used",
+ "content": {"*/*": {"schema": {"$ref": "#/components/schemas/void"}}}
+ },
"204": {
- "schema": {"type": "object"},
- "description": "Service unregistered"
+ "description": "Service unregistered",
+ "content": {"*/*": {"schema": {"type": "object"}}}
},
- "403": {"description": "Forbidden"},
"404": {
- "schema": {"$ref": "#/definitions/error_information"},
- "description": "Service not found"
+ "description": "Service not found",
+ "content": {"*/*": {"schema": {"$ref": "#/components/schemas/error_information"}}}
}
},
"parameters": [{
+ "schema": {"type": "string"},
"in": "path",
"name": "service_id",
- "description": "service_id",
- "type": "string",
"required": true
}],
- "tags": ["A1 Policy Management Version 2.0"]
- }},
- "/service": {"put": {
- "summary": "Register a service",
- "deprecated": false,
- "produces": ["*/*"],
- "operationId": "putServiceUsingPUT_1",
- "responses": {
- "200": {
- "schema": {"type": "string"},
- "description": "Service updated"
- },
- "201": {
- "schema": {"type": "string"},
- "description": "Service created"
- },
- "400": {
- "schema": {"type": "string"},
- "description": "The ServiceRegistrationInfo is not accepted"
- },
- "401": {"description": "Unauthorized"},
- "403": {"description": "Forbidden"},
- "404": {"description": "Not Found"}
- },
- "parameters": [{
- "schema": {"$ref": "#/definitions/service_registration_info_v1"},
- "in": "body",
- "name": "registrationInfo",
- "description": "registrationInfo",
- "required": true
- }],
- "tags": ["A1 Policy Management Version 1.0 (deprecated)"],
- "consumes": ["application/json"]
+ "tags": ["Service Registry and Supervision"]
}},
"/a1-policy/v2/policies/{policy_id}/status": {"get": {
"summary": "Returns a policy status",
- "deprecated": false,
- "produces": ["application/json"],
- "operationId": "getPolicyStatusUsingGET",
+ "operationId": "getPolicyStatus_1",
"responses": {
"200": {
- "schema": {"$ref": "#/definitions/policy_status_info_v2"},
- "description": "Policy status"
+ "description": "Policy status",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/policy_status_info_v2"}}}
},
- "401": {"description": "Unauthorized"},
- "403": {"description": "Forbidden"},
"404": {
- "schema": {"$ref": "#/definitions/error_information"},
- "description": "Policy is not found"
+ "description": "Policy is not found",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/error_information"}}}
}
},
"parameters": [{
+ "schema": {"type": "string"},
"in": "path",
"name": "policy_id",
- "description": "policy_id",
- "type": "string",
"required": true
}],
- "tags": ["A1 Policy Management Version 2.0"]
+ "tags": ["A1 Policy Management"]
}}
},
- "definitions": {
- "error_information": {
- "description": "Problem as defined in https://tools.ietf.org/html/rfc7807",
- "type": "object",
- "title": "error_information",
- "properties": {
- "detail": {
- "description": " A human-readable explanation specific to this occurrence of the problem.",
- "type": "string",
- "example": "Policy type not found"
- },
- "status": {
- "format": "int32",
- "description": "The HTTP status code generated by the origin server for this occurrence of the problem. ",
- "type": "integer",
- "example": 503
- }
- }
- },
- "status_info_v2": {
- "type": "object",
- "title": "status_info_v2",
- "properties": {"status": {
- "description": "status text",
- "type": "string"
- }}
- },
- "policy_info_v1": {
- "type": "object",
- "title": "policy_info_v1",
- "properties": {
- "service": {
- "description": "the name of the service owning the policy",
- "type": "string"
- },
- "json": {
- "description": "the configuration of the policy",
- "type": "object"
- },
- "id": {
- "description": "identity of the policy",
- "type": "string"
- },
- "lastModified": {
- "description": "timestamp, last modification time",
- "type": "string"
- },
- "type": {
- "description": "name of the policy type",
- "type": "string"
- },
- "ric": {
- "description": "identity of the target Near-RT RIC",
- "type": "string"
- }
- }
- },
- "ric_info_v2": {
- "description": "Information for a Near-RT RIC",
- "type": "object",
- "title": "ric_info_v2",
- "properties": {
- "ric_id": {
- "description": "identity of the Near-RT RIC",
- "type": "string"
- },
- "managed_element_ids": {
- "description": "O1 identities for managed entities",
- "type": "array",
- "items": {"type": "string"}
- },
- "state": {
- "description": "State for the Near-RT RIC, values: \nUNAVAILABLE: The Near-RT RIC is not avialable, information may be inconsistent \nAVAILABLE: The normal state. Policies can be configured. +\nSYNCHRONIZING: The Policy Management Service is synchronizing the view of the Near-RT RIC. Policies cannot be configured. \nCONSISTENCY_CHECK: A consistency check between the Policy Management Service and the Near-RT RIC. Policies cannot be configured.",
- "type": "string",
- "enum": [
- "UNAVAILABLE",
- "AVAILABLE",
- "SYNCHRONIZING",
- "CONSISTENCY_CHECK"
- ]
- },
- "policytype_ids": {
- "description": "supported policy types",
- "type": "array",
- "items": {"type": "string"}
- }
- }
- },
- "service_registration_info_v1": {
- "type": "object",
- "title": "service_registration_info_v1",
- "properties": {
- "keepAliveIntervalSeconds": {
- "format": "int64",
- "description": "keep alive interval for the service. This is a heartbeat supervision of the service, which in regular intevals must invoke a 'keepAlive' REST call. When a service does not invoke this call within the given time, it is considered unavailble. An unavailable service will be automatically deregistered and its policies will be deleted. Value 0 means no timeout supervision.",
- "type": "integer"
- },
- "callbackUrl": {
- "description": "callback for notifying of RIC synchronization",
- "type": "string"
- },
- "serviceName": {"type": "string"}
- }
- },
- "policy_info_list_v2": {
- "description": "List of policy information",
- "type": "object",
- "title": "policy_info_list_v2",
- "properties": {"policies": {
- "description": "List of policy information",
- "type": "array",
- "items": {"$ref": "#/definitions/policy_info_v2"}
- }}
- },
- "service_registration_info_v2": {
- "description": "Information for one service",
- "type": "object",
- "title": "service_registration_info_v2",
- "required": ["service_id"],
- "properties": {
- "callback_url": {
- "description": "callback for notifying of Near-RT RIC state changes",
- "type": "string"
- },
- "service_id": {
- "description": "identity of the service",
- "type": "string"
- },
- "keep_alive_interval_seconds": {
- "format": "int64",
- "description": "keep alive interval for the service. This is a heartbeat supervision of the service, which in regular intevals must invoke a 'keepAlive' REST call. When a service does not invoke this call within the given time, it is considered unavailble. An unavailable service will be automatically deregistered and its policies will be deleted. Value 0 means no timeout supervision.",
- "type": "integer"
- }
- }
- },
- "ric_info_v1": {
- "type": "object",
- "title": "ric_info_v1",
- "properties": {
- "managedElementIds": {
- "description": "O1 identities for managed entities",
- "type": "array",
- "items": {"type": "string"}
- },
- "policyTypes": {
- "description": "supported policy types",
- "type": "array",
- "items": {"type": "string"}
- },
- "state": {
- "description": "state info",
- "type": "string"
- },
- "ricName": {
- "description": "identity of the Near-RT RIC",
- "type": "string"
- }
- }
- },
- "policy_status_info_v2": {
- "description": "Status for one A1-P Policy",
- "type": "object",
- "title": "policy_status_info_v2",
- "properties": {
- "last_modified": {
- "description": "timestamp, last modification time",
- "type": "string"
- },
- "status": {
- "description": "the Policy status",
- "type": "object"
- }
- }
- },
- "service_status_v1": {
- "type": "object",
- "title": "service_status_v1",
- "properties": {
- "keepAliveIntervalSeconds": {
- "format": "int64",
- "description": "policy keep alive timeout",
- "type": "integer"
- },
- "callbackUrl": {
- "description": "callback for notifying of RIC synchronization",
- "type": "string"
- },
- "timeSinceLastActivitySeconds": {
- "format": "int64",
- "description": "time since last invocation by the service",
- "type": "integer"
- },
- "serviceName": {
- "description": "identity of the service",
- "type": "string"
- }
- }
- },
- "service_status_v2": {
- "type": "object",
- "title": "service_status_v2",
- "properties": {
- "callback_url": {
- "description": "callback for notifying of RIC synchronization",
- "type": "string"
- },
- "service_id": {
- "description": "identity of the service",
- "type": "string"
- },
- "keep_alive_interval_seconds": {
- "format": "int64",
- "description": "policy keep alive timeout",
- "type": "integer"
- },
- "time_since_last_activity_seconds": {
- "format": "int64",
- "description": "time since last invocation by the service",
- "type": "integer"
- }
- }
- },
- "policytype_v2": {
- "description": "Policy type",
- "type": "object",
- "title": "policytype_v2",
- "properties": {"policy_schema": {
- "description": "Policy type json scema. The schema is a json object following http://json-schema.org/draft-07/schema",
- "type": "object"
- }}
- },
- "ric_info_list_v2": {
- "description": "List of Near-RT RIC information",
- "type": "object",
- "title": "ric_info_list_v2",
- "properties": {"rics": {
- "description": "List of Near-RT RIC information",
- "type": "array",
- "items": {"$ref": "#/definitions/ric_info_v2"}
- }}
- },
- "policytype_id_list_v2": {
- "description": "Information about policy types",
- "type": "object",
- "title": "policytype_id_list_v2",
- "properties": {"policytype_ids": {
- "description": "Policy type identities",
- "type": "array",
- "items": {"type": "string"}
- }}
- },
- "policy_id_list_v2": {
- "description": "A list of policy identities",
- "type": "object",
- "title": "policy_id_list_v2",
- "properties": {"policy_ids": {
- "description": "Policy identities",
- "type": "array",
- "items": {"type": "string"}
- }}
- },
- "policy_info_v2": {
- "description": "Information for one A1-P Policy",
- "type": "object",
- "title": "policy_info_v2",
- "required": [
- "policy_data",
- "policy_id",
- "policytype_id",
- "ric_id",
- "service_id"
- ],
- "properties": {
- "ric_id": {
- "description": "identity of the target Near-RT RIC",
- "type": "string"
- },
- "policy_id": {
- "description": "identity of the policy",
- "type": "string"
- },
- "transient": {
- "description": "if true, the policy is deleted at RIC restart. If false, its value is maintained by this service until explicitly deleted. Default false.",
- "type": "boolean"
- },
- "service_id": {
- "description": "the name of the service owning the policy",
- "type": "string"
- },
- "policy_data": {
- "description": "the configuration of the policy",
- "type": "object"
- },
- "status_notification_uri": {
- "description": "Callback URI for policy status updates",
- "type": "string"
- },
- "policytype_id": {
- "description": "identity of the policy type",
- "type": "string"
- }
- }
- },
- "service_list_v2": {
- "description": "List of service information",
- "type": "object",
- "title": "service_list_v2",
- "properties": {"service_list": {
- "description": "List of service information",
- "type": "array",
- "items": {"$ref": "#/definitions/service_status_v2"}
- }}
- },
- "service_callback_info_v2": {
- "description": "Information transferred as in Service callbacks (callback_url)",
- "type": "object",
- "title": "service_callback_info_v2",
- "required": [
- "event_type",
- "ric_id"
- ],
- "properties": {
- "ric_id": {
- "description": "identity of a Near-RT RIC",
- "type": "string"
- },
- "event_type": {
- "description": "values:\nAVAILABLE: the Near-RT RIC has become available for A1 Policy management",
- "type": "string",
- "enum": ["AVAILABLE"]
- }
- }
- }
- },
- "swagger": "2.0",
"info": {
- "x-audience": "external-partner",
- "x-api-id": "60f9a0e7-343f-43bf-9194-d8d65688d465",
- "contact": {
- "name": "Ericsson Software Technology",
- "email": "nonrtric@est.tech"
+ "license": {
+ "name": "Copyright (C) 2020 Nordix Foundation. Licensed under the Apache License.",
+ "url": "http://www.apache.org/licenses/LICENSE-2.0"
},
- "description": "The O-RAN Non-RT RIC Policy Management Service provides a REST API for management of A1 policices. \nIt provides support for:<ul><li>A1 Policy creation and modification.<\/li><li>Maintaining a view of supported Near-RT RIC policy types <\/li><li>Supervision of using services (R-APPs). When a service is unavailble, its policies are removed. <\/li> <li>Monitoring and maintaining consistency of the SMO view of A1 policies and the Near-RT RICs <\/li><\/ul>",
+ "description": "<h2>General<\/h2><p>The O-RAN Non-RT RIC Policy Management Service provides a REST API for management of A1 policices. <br/>The main tasks of the service are:<\/p><ul><li>A1 Policy creation, modification and deletion.<\/li><li>Monitoring and maintaining consistency of the SMO view of A1 policies and the Near-RT RICs<\/li><li>Maintaining a view of supported Near-RT RIC policy types<\/li><li>Supervision of using services (R-APPs). When a service is unavailble, its policies are removed.<\/li><\/ul><h2>APIs provided by the service<\/h2><h3>A1 Policy Management<\/h3><p>This is an API for management of A1 Policies.<\/p><ul><li>A1 Policy retrieval, creation, modification and deletion.<\/li><li>Retrieval of supported A1 Policy types for a Near-RT RIC<\/li><li>Retrieval of status for existing A1 policies<\/li><\/ul><h3>Management of configuration<\/h3><p>API for updating and retrieval of the component configuration. Note that there other ways to maintain the configuration.<\/p><h3>Callbacks<\/h3><p>These are endpoints that are invoked by this service. The callbacks are registerred in this service at service registration.<\/p><h3>NearRT-RIC Repository<\/h3><p>This is an API that provides support for looking up a NearRT-RIC. Each A1 policy is targeted for one Near-RT RIC.<\/p><h3>Health Check<\/h3><p>API used for supervision of the PMS component.<\/p><h3>Service Registry and Supervision<\/h3><p>API used for registerring services that uses PMS. Each A1 policy is owned by a service. PMS can supervise each registerred service and will automatically remove policies for unavailable services.<\/p>",
"title": "A1 Policy management service",
"version": "1.1.0"
},
"tags": [
{
- "name": "A1 Policy Management Version 1.0 (deprecated)",
- "description": "Policy Controller"
- },
- {
- "name": "A1 Policy Management Version 2.0",
- "description": "Policy Controller"
+ "name": "A1 Policy Management V1.0",
+ "description": "(deprecated primitves)"
},
- {
- "name": "Component Configuration",
- "description": "Configuration Controller"
- },
- {
- "name": "R-App Callbacks",
- "description": "Rapp Simulator Controller"
- }
+ {"name": "Management of configuration"},
+ {"name": "A1 Policy Management"},
+ {"name": "NearRT-RIC Repository"},
+ {"name": "Service Registry and Supervision"},
+ {"name": "Health Check"},
+ {"name": "Callbacks"}
]
} \ No newline at end of file
diff --git a/a1-policy-management/api/pms-api.yaml b/a1-policy-management/api/pms-api.yaml
index eff705d0..d16fbe5f 100644
--- a/a1-policy-management/api/pms-api.yaml
+++ b/a1-policy-management/api/pms-api.yaml
@@ -1,41 +1,54 @@
openapi: 3.0.1
info:
title: A1 Policy management service
- description: "The O-RAN Non-RT RIC Policy Management Service provides a REST API\
- \ for management of A1 policices. \nIt provides support for:<ul><li>A1 Policy\
- \ creation and modification.</li><li>Maintaining a view of supported Near-RT RIC\
- \ policy types </li><li>Supervision of using services (R-APPs). When a service\
- \ is unavailble, its policies are removed. </li> <li>Monitoring and maintaining\
- \ consistency of the SMO view of A1 policies and the Near-RT RICs </li></ul>"
- contact:
- name: Ericsson Software Technology
- email: nonrtric@est.tech
+ description: <h2>General</h2><p>The O-RAN Non-RT RIC Policy Management Service provides
+ a REST API for management of A1 policices. <br/>The main tasks of the service
+ are:</p><ul><li>A1 Policy creation, modification and deletion.</li><li>Monitoring
+ and maintaining consistency of the SMO view of A1 policies and the Near-RT RICs</li><li>Maintaining
+ a view of supported Near-RT RIC policy types</li><li>Supervision of using services
+ (R-APPs). When a service is unavailble, its policies are removed.</li></ul><h2>APIs
+ provided by the service</h2><h3>A1 Policy Management</h3><p>This is an API for
+ management of A1 Policies.</p><ul><li>A1 Policy retrieval, creation, modification
+ and deletion.</li><li>Retrieval of supported A1 Policy types for a Near-RT RIC</li><li>Retrieval
+ of status for existing A1 policies</li></ul><h3>Management of configuration</h3><p>API
+ for updating and retrieval of the component configuration. Note that there other
+ ways to maintain the configuration.</p><h3>Callbacks</h3><p>These are endpoints
+ that are invoked by this service. The callbacks are registerred in this service
+ at service registration.</p><h3>NearRT-RIC Repository</h3><p>This is an API that
+ provides support for looking up a NearRT-RIC. Each A1 policy is targeted for one
+ Near-RT RIC.</p><h3>Health Check</h3><p>API used for supervision of the PMS component.</p><h3>Service
+ Registry and Supervision</h3><p>API used for registerring services that uses PMS.
+ Each A1 policy is owned by a service. PMS can supervise each registerred service
+ and will automatically remove policies for unavailable services.</p>
+ license:
+ name: Copyright (C) 2020 Nordix Foundation. Licensed under the Apache License.
+ url: http://www.apache.org/licenses/LICENSE-2.0
version: 1.1.0
- x-audience: external-partner
- x-api-id: 60f9a0e7-343f-43bf-9194-d8d65688d465
servers:
- url: /
tags:
-- name: A1 Policy Management Version 1.0 (deprecated)
- description: Policy Controller
-- name: A1 Policy Management Version 2.0
- description: Policy Controller
-- name: Component Configuration
- description: Configuration Controller
-- name: R-App Callbacks
- description: Rapp Simulator Controller
+- name: A1 Policy Management V1.0
+ description: (deprecated primitves)
+- name: Management of configuration
+- name: A1 Policy Management
+- name: NearRT-RIC Repository
+- name: Service Registry and Supervision
+- name: Health Check
+- name: Callbacks
paths:
/policy_types:
get:
tags:
- - A1 Policy Management Version 1.0 (deprecated)
+ - A1 Policy Management V1.0
summary: Query policy type names
- operationId: getPolicyTypesUsingGET_1
+ operationId: getPolicyTypes
parameters:
- name: ric
in: query
description: The name of the Near-RT RIC to get types for.
- allowEmptyValue: false
+ required: false
+ style: form
+ explode: true
schema:
type: string
responses:
@@ -47,45 +60,44 @@ paths:
type: array
items:
type: string
- 401:
- description: Unauthorized
- content: {}
- 403:
- description: Forbidden
- content: {}
404:
description: Near-RT RIC is not found
content:
'*/*':
schema:
$ref: '#/components/schemas/error_information'
- deprecated: false
/a1-policy/v2/policy-instances:
get:
tags:
- - A1 Policy Management Version 2.0
+ - A1 Policy Management
summary: Query for A1 policy instances
description: Returns a list of A1 policies matching given search criteria. <br>If
several query parameters are defined, the policies matching all conditions
are returned.
- operationId: getPolicyInstancesUsingGET
+ operationId: getPolicyInstances
parameters:
- name: policytype_id
in: query
description: The identity of the policy type to get policies for.
- allowEmptyValue: false
+ required: false
+ style: form
+ explode: true
schema:
type: string
- name: ric_id
in: query
description: The identity of the Near-RT RIC to get policies for.
- allowEmptyValue: false
+ required: false
+ style: form
+ explode: true
schema:
type: string
- name: service_id
in: query
description: The identity of the service to get policies for.
- allowEmptyValue: false
+ required: false
+ style: form
+ explode: true
schema:
type: string
responses:
@@ -95,25 +107,18 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/policy_info_list_v2'
- 401:
- description: Unauthorized
- content: {}
- 403:
- description: Forbidden
- content: {}
404:
description: Near-RT RIC, policy type or service not found
content:
application/json:
schema:
$ref: '#/components/schemas/error_information'
- deprecated: false
/a1-policy/v2/status:
get:
tags:
- - A1 Policy Management Version 2.0
+ - Health Check
summary: Returns status and statistics of this service
- operationId: getStatusUsingGET
+ operationId: getStatus_1
responses:
200:
description: Service is living
@@ -121,27 +126,19 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/status_info_v2'
- 401:
- description: Unauthorized
- content: {}
- 403:
- description: Forbidden
- content: {}
- 404:
- description: Not Found
- content: {}
- deprecated: false
/services:
get:
tags:
- - A1 Policy Management Version 1.0 (deprecated)
+ - A1 Policy Management V1.0
summary: Returns service information
- operationId: getServicesUsingGET_1
+ operationId: getServices
parameters:
- name: name
in: query
description: The name of the service
- allowEmptyValue: false
+ required: false
+ style: form
+ explode: true
schema:
type: string
responses:
@@ -153,79 +150,64 @@ paths:
type: array
items:
$ref: '#/components/schemas/service_status_v1'
- 401:
- description: Unauthorized
- content: {}
- 403:
- description: Forbidden
- content: {}
404:
description: Service is not found
content:
'*/*':
schema:
type: string
- deprecated: false
delete:
tags:
- - A1 Policy Management Version 1.0 (deprecated)
+ - A1 Policy Management V1.0
summary: Delete a service
- operationId: deleteServiceUsingDELETE_1
+ operationId: deleteService
parameters:
- name: name
in: query
description: The name of the service
required: true
- allowEmptyValue: false
+ style: form
+ explode: true
schema:
type: string
responses:
- 200:
- description: OK
- content:
- '*/*':
- schema:
- type: string
204:
description: Service deleted
content:
'*/*':
schema:
- type: string
- 401:
- description: Unauthorized
- content: {}
- 403:
- description: Forbidden
- content: {}
+ $ref: '#/components/schemas/void'
404:
description: Service not found
content:
'*/*':
schema:
type: string
- deprecated: false
/a1-policy/v2/rics/ric:
get:
tags:
- - A1 Policy Management Version 2.0
+ - NearRT-RIC Repository
summary: Returns info for one Near-RT RIC
description: Either a Near-RT RIC identity or a Mananged Element identity can
be specified.<br>The intention with Mananged Element identity is the ID used
in O1 for accessing the traffical element (such as the ID of CU).
- operationId: getRicUsingGET_1
+ operationId: getRic_1
parameters:
- name: managed_element_id
in: query
description: The identity of a Managed Element. If given, the Near-RT RIC
managing the ME is returned.
- allowEmptyValue: false
+ required: false
+ style: form
+ explode: true
schema:
type: string
- name: ric_id
in: query
description: The identity of a Near-RT RIC to get information for.
- allowEmptyValue: false
+ required: false
+ style: form
+ explode: true
schema:
type: string
responses:
@@ -235,30 +217,52 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/ric_info_v2'
- 401:
- description: Unauthorized
- content: {}
- 403:
- description: Forbidden
- content: {}
404:
description: Near-RT RIC is not found
content:
application/json:
schema:
$ref: '#/components/schemas/error_information'
- deprecated: false
+ /a1-policy/v2/policy-types:
+ get:
+ tags:
+ - A1 Policy Management
+ summary: Query policy type identities
+ operationId: getPolicyTypes_1
+ parameters:
+ - name: ric_id
+ in: query
+ description: The identity of the Near-RT RIC to get types for.
+ required: false
+ style: form
+ explode: true
+ schema:
+ type: string
+ responses:
+ 200:
+ description: Policy type IDs
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/policytype_id_list_v2'
+ 404:
+ description: Near-RT RIC is not found
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/error_information'
/a1-policy/v2/policies/{policy_id}:
get:
tags:
- - A1 Policy Management Version 2.0
+ - A1 Policy Management
summary: Returns a policy
- operationId: getPolicyUsingGET
+ operationId: getPolicy_1
parameters:
- name: policy_id
in: path
- description: policy_id
required: true
+ style: simple
+ explode: false
schema:
type: string
responses:
@@ -268,97 +272,57 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/policy_info_v2'
- 401:
- description: Unauthorized
- content: {}
- 403:
- description: Forbidden
- content: {}
404:
description: Policy is not found
content:
application/json:
schema:
$ref: '#/components/schemas/error_information'
- deprecated: false
delete:
tags:
- - A1 Policy Management Version 2.0
+ - A1 Policy Management
summary: Delete a policy
- operationId: deletePolicyUsingDELETE
+ operationId: deletePolicy_1
parameters:
- name: policy_id
in: path
- description: policy_id
required: true
+ style: simple
+ explode: false
schema:
type: string
responses:
200:
description: Not used
- content: {}
- 204:
- description: Policy deleted
- content: {}
- 401:
- description: Unauthorized
- content: {}
- 403:
- description: Forbidden
- content: {}
- 404:
- description: Policy is not found
content:
'*/*':
schema:
- $ref: '#/components/schemas/error_information'
+ $ref: '#/components/schemas/void'
423:
description: Near-RT RIC is not operational
content:
'*/*':
schema:
$ref: '#/components/schemas/error_information'
- deprecated: false
- /a1-policy/v2/policy-types:
- get:
- tags:
- - A1 Policy Management Version 2.0
- summary: Query policy type identities
- operationId: getPolicyTypesUsingGET
- parameters:
- - name: ric_id
- in: query
- description: The identity of the Near-RT RIC to get types for.
- allowEmptyValue: false
- schema:
- type: string
- responses:
- 200:
- description: Policy type IDs
+ 204:
+ description: Policy deleted
content:
- application/json:
+ '*/*':
schema:
- $ref: '#/components/schemas/policytype_id_list_v2'
- 401:
- description: Unauthorized
- content: {}
- 403:
- description: Forbidden
- content: {}
+ $ref: '#/components/schemas/void'
404:
- description: Near-RT RIC is not found
+ description: Policy is not found
content:
- application/json:
+ '*/*':
schema:
$ref: '#/components/schemas/error_information'
- deprecated: false
/a1-policy/v2/configuration:
get:
tags:
- - Component Configuration
+ - Management of configuration
summary: Returns the contents of the configuration file
description: Note that the file contents is not relevant if the Consul is used.
- operationId: getConfigurationUsingGET
+ operationId: getConfiguration
responses:
200:
description: Configuration
@@ -366,27 +330,19 @@ paths:
application/json:
schema:
type: object
- 401:
- description: Unauthorized
- content: {}
- 403:
- description: Forbidden
- content: {}
404:
description: File is not found or readable
content:
application/json:
schema:
$ref: '#/components/schemas/error_information'
- deprecated: false
put:
tags:
- - Component Configuration
+ - Management of configuration
summary: Replace the current configuration file with the given configuration
description: Note that the file is ignored if the Consul is used.
- operationId: putConfigurationUsingPUT
+ operationId: putConfiguration
requestBody:
- description: configuration
content:
application/json:
schema:
@@ -395,25 +351,16 @@ paths:
responses:
200:
description: Configuration updated
- content: {}
- 201:
- description: Created
- content: {}
+ content:
+ '*/*':
+ schema:
+ $ref: '#/components/schemas/void'
400:
description: Invalid configuration provided
content:
'*/*':
schema:
$ref: '#/components/schemas/error_information'
- 401:
- description: Unauthorized
- content: {}
- 403:
- description: Forbidden
- content: {}
- 404:
- description: Not Found
- content: {}
500:
description: Something went wrong when replacing the configuration. Try
again.
@@ -421,19 +368,19 @@ paths:
'*/*':
schema:
$ref: '#/components/schemas/error_information'
- deprecated: false
/policy:
get:
tags:
- - A1 Policy Management Version 1.0 (deprecated)
+ - A1 Policy Management V1.0
summary: Returns a policy configuration
- operationId: getPolicyUsingGET_1
+ operationId: getPolicy
parameters:
- name: id
in: query
description: The identity of the policy instance.
required: true
- allowEmptyValue: false
+ style: form
+ explode: true
schema:
type: string
responses:
@@ -443,44 +390,49 @@ paths:
'*/*':
schema:
type: object
- 401:
- description: Unauthorized
- content: {}
- 403:
- description: Forbidden
- content: {}
404:
description: Policy is not found
content:
'*/*':
schema:
$ref: '#/components/schemas/error_information'
- deprecated: false
put:
tags:
- - A1 Policy Management Version 1.0 (deprecated)
+ - A1 Policy Management V1.0
summary: Put a policy
- operationId: putPolicyUsingPUT_1
+ operationId: putPolicy
parameters:
+ - name: type
+ in: query
+ description: The name of the policy type.
+ required: false
+ style: form
+ explode: true
+ schema:
+ type: string
+ default: ""
- name: id
in: query
description: The identity of the policy instance.
required: true
- allowEmptyValue: false
+ style: form
+ explode: true
schema:
type: string
- name: ric
in: query
description: The name of the Near-RT RIC where the policy will be created.
required: true
- allowEmptyValue: false
+ style: form
+ explode: true
schema:
type: string
- name: service
in: query
description: The name of the service creating the policy.
required: true
- allowEmptyValue: false
+ style: form
+ explode: true
schema:
type: string
- name: transient
@@ -488,19 +440,13 @@ paths:
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.
- allowEmptyValue: false
+ required: false
+ style: form
+ explode: true
schema:
type: boolean
default: false
- example: false
- - name: type
- in: query
- description: The name of the policy type.
- allowEmptyValue: false
- schema:
- type: string
requestBody:
- description: jsonBody
content:
application/json:
schema:
@@ -509,91 +455,96 @@ paths:
responses:
200:
description: Policy updated
- content: {}
+ content:
+ '*/*':
+ schema:
+ $ref: '#/components/schemas/void'
201:
description: Policy created
- content: {}
- 401:
- description: Unauthorized
- content: {}
- 403:
- description: Forbidden
- content: {}
- 404:
- description: Near-RT RIC or policy type is not found
content:
'*/*':
schema:
- type: string
+ $ref: '#/components/schemas/void'
423:
description: Near-RT RIC is not operational
content:
'*/*':
schema:
type: string
- deprecated: false
+ 404:
+ description: Near-RT RIC or policy type is not found
+ content:
+ '*/*':
+ schema:
+ type: string
delete:
tags:
- - A1 Policy Management Version 1.0 (deprecated)
+ - A1 Policy Management V1.0
summary: Delete a policy
- operationId: deletePolicyUsingDELETE_1
+ operationId: deletePolicy
parameters:
- name: id
in: query
description: The identity of the policy instance.
required: true
- allowEmptyValue: false
+ style: form
+ explode: true
schema:
type: string
responses:
200:
description: Not used
- content: {}
- 204:
- description: Policy deleted
- content: {}
- 401:
- description: Unauthorized
- content: {}
- 403:
- description: Forbidden
- content: {}
- 404:
- description: Policy is not found
content:
'*/*':
schema:
- type: string
+ $ref: '#/components/schemas/void'
423:
description: Near-RT RIC is not operational
content:
'*/*':
schema:
type: string
- deprecated: false
+ 204:
+ description: Policy deleted
+ content:
+ '*/*':
+ schema:
+ $ref: '#/components/schemas/void'
+ 404:
+ description: Policy is not found
+ content:
+ '*/*':
+ schema:
+ type: string
/policies:
get:
tags:
- - A1 Policy Management Version 1.0 (deprecated)
+ - A1 Policy Management V1.0
summary: Query policies
- operationId: getPoliciesUsingGET
+ operationId: getPolicies
parameters:
+ - name: type
+ in: query
+ description: The name of the policy type to get policies for.
+ required: false
+ style: form
+ explode: true
+ schema:
+ type: string
- name: ric
in: query
description: The name of the Near-RT RIC to get policies for.
- allowEmptyValue: false
+ required: false
+ style: form
+ explode: true
schema:
type: string
- name: service
in: query
description: The name of the service to get policies for.
- allowEmptyValue: false
- schema:
- type: string
- - name: type
- in: query
- description: The name of the policy type to get policies for.
- allowEmptyValue: false
+ required: false
+ style: form
+ explode: true
schema:
type: string
responses:
@@ -605,30 +556,27 @@ paths:
type: array
items:
$ref: '#/components/schemas/policy_info_v1'
- 401:
- description: Unauthorized
- content: {}
- 403:
- description: Forbidden
- content: {}
404:
description: Near-RT RIC or type not found
content:
'*/*':
schema:
type: string
- deprecated: false
/a1-policy/v2/services/{service_id}/keepalive:
put:
tags:
- - A1 Policy Management Version 2.0
+ - Service Registry and Supervision
summary: Heartbeat indicates that the service is running
- operationId: keepAliveServiceUsingPUT
+ description: A registerred service must call this in regular intervals to indicate
+ that it is in operation. Absence of this call will lead to that teh service
+ will be deregisterred and all its policies are removed.
+ operationId: keepAliveService_1
parameters:
- name: service_id
in: path
- description: service_id
required: true
+ style: simple
+ explode: false
schema:
type: string
responses:
@@ -638,103 +586,83 @@ paths:
'*/*':
schema:
type: object
- 201:
- description: Created
- content: {}
- 401:
- description: Unauthorized
- content: {}
- 403:
- description: Forbidden
- content: {}
404:
description: The service is not found, needs re-registration
content:
'*/*':
schema:
$ref: '#/components/schemas/error_information'
- deprecated: false
- /policy_schema:
+ /rics:
get:
tags:
- - A1 Policy Management Version 1.0 (deprecated)
- summary: Returns one policy type schema definition
- operationId: getPolicySchemaUsingGET
+ - A1 Policy Management V1.0
+ summary: Query Near-RT RIC information
+ operationId: getRics
parameters:
- - name: id
+ - name: policyType
in: query
- description: The identity of the policy type to get the definition for.
- required: true
- allowEmptyValue: false
+ description: The name of the policy type
+ required: false
+ style: form
+ explode: true
schema:
type: string
responses:
200:
- description: Policy schema
+ description: OK
content:
'*/*':
schema:
- type: object
- 401:
- description: Unauthorized
- content: {}
- 403:
- description: Forbidden
- content: {}
+ type: array
+ items:
+ $ref: '#/components/schemas/ric_info_v1'
404:
- description: The policy type is not found
+ description: Policy type is not found
content:
'*/*':
schema:
- $ref: '#/components/schemas/error_information'
- deprecated: false
- /rics:
+ type: string
+ /policy_schema:
get:
tags:
- - A1 Policy Management Version 1.0 (deprecated)
- summary: Query Near-RT RIC information
- operationId: getRicsUsingGET
+ - A1 Policy Management V1.0
+ summary: Returns one policy type schema definition
+ operationId: getPolicySchema
parameters:
- - name: policyType
+ - name: id
in: query
- description: The name of the policy type
- allowEmptyValue: false
+ description: The identity of the policy type to get the definition for.
+ required: true
+ style: form
+ explode: true
schema:
type: string
responses:
200:
- description: OK
+ description: Policy schema
content:
'*/*':
schema:
- type: array
- items:
- $ref: '#/components/schemas/ric_info_v1'
- 401:
- description: Unauthorized
- content: {}
- 403:
- description: Forbidden
- content: {}
+ type: object
404:
- description: Policy type is not found
+ description: The policy type is not found
content:
'*/*':
schema:
- type: string
- deprecated: false
+ $ref: '#/components/schemas/error_information'
/policy_status:
get:
tags:
- - A1 Policy Management Version 1.0 (deprecated)
+ - A1 Policy Management V1.0
summary: Returns a policy status
- operationId: getPolicyStatusUsingGET_1
+ operationId: getPolicyStatus
parameters:
- name: id
in: query
description: The identity of the policy.
required: true
- allowEmptyValue: false
+ style: form
+ explode: true
schema:
type: string
responses:
@@ -744,33 +672,28 @@ paths:
'*/*':
schema:
type: object
- 401:
- description: Unauthorized
- content: {}
- 403:
- description: Forbidden
- content: {}
404:
description: Policy is not found
content:
'*/*':
schema:
type: string
- deprecated: false
/a1-policy/v2/rics:
get:
tags:
- - A1 Policy Management Version 2.0
+ - NearRT-RIC Repository
summary: Query Near-RT RIC information
description: The call returns all Near-RT RICs that supports a given policy
type identity
- operationId: getRicsUsingGET_1
+ operationId: getRics_1
parameters:
- name: policytype_id
in: query
description: The identity of a policy type. If given, all Near-RT RICs supporteing
the policy type are returned
- allowEmptyValue: false
+ required: false
+ style: form
+ explode: true
schema:
type: string
responses:
@@ -780,115 +703,103 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/ric_info_list_v2'
- 401:
- description: Unauthorized
- content: {}
- 403:
- description: Forbidden
- content: {}
404:
description: Policy type is not found
content:
application/json:
schema:
$ref: '#/components/schemas/error_information'
- deprecated: false
- /policy_ids:
+ /policy_schemas:
get:
tags:
- - A1 Policy Management Version 1.0 (deprecated)
- summary: Query policies, only policy identities returned
- operationId: getPolicyIdsUsingGET_1
+ - A1 Policy Management V1.0
+ summary: Returns policy type schema definitions
+ operationId: getPolicySchemas
parameters:
- name: ric
in: query
- description: The name of the Near-RT RIC to get policies for.
- allowEmptyValue: false
- schema:
- type: string
- - name: service
- in: query
- description: The name of the service to get policies for.
- allowEmptyValue: false
- schema:
- type: string
- - name: type
- in: query
- description: The name of the policy type to get policies for.
- allowEmptyValue: false
+ description: The name of the Near-RT RIC to get the definitions for.
+ required: false
+ style: form
+ explode: true
schema:
type: string
responses:
200:
- description: Policy identitiess
+ description: Policy schemas
content:
'*/*':
schema:
type: array
items:
- type: string
- 401:
- description: Unauthorized
- content: {}
- 403:
- description: Forbidden
- content: {}
+ type: object
404:
- description: Near-RT RIC or type not found
+ description: Near-RT RIC is not found
content:
'*/*':
schema:
- type: string
- deprecated: false
- /policy_schemas:
+ $ref: '#/components/schemas/error_information'
+ /policy_ids:
get:
tags:
- - A1 Policy Management Version 1.0 (deprecated)
- summary: Returns policy type schema definitions
- operationId: getPolicySchemasUsingGET
+ - A1 Policy Management V1.0
+ summary: Query policies, only policy identities returned
+ operationId: getPolicyIds
parameters:
+ - name: type
+ in: query
+ description: The name of the policy type to get policies for.
+ required: false
+ style: form
+ explode: true
+ schema:
+ type: string
- name: ric
in: query
- description: The name of the Near-RT RIC to get the definitions for.
- allowEmptyValue: false
+ description: The name of the Near-RT RIC to get policies for.
+ required: false
+ style: form
+ explode: true
+ schema:
+ type: string
+ - name: service
+ in: query
+ description: The name of the service to get policies for.
+ required: false
+ style: form
+ explode: true
schema:
type: string
responses:
200:
- description: Policy schemas
+ description: Policy identitiess
content:
'*/*':
schema:
type: array
items:
- type: object
- properties: {}
- 401:
- description: Unauthorized
- content: {}
- 403:
- description: Forbidden
- content: {}
+ type: string
404:
- description: Near-RT RIC is not found
+ description: Near-RT RIC or type not found
content:
'*/*':
schema:
- $ref: '#/components/schemas/error_information'
- deprecated: false
+ type: string
/a1-policy/v2/services:
get:
tags:
- - A1 Policy Management Version 2.0
+ - Service Registry and Supervision
summary: Returns service information
description: Either information about a registered service with given identity
or all registered services are returned.
- operationId: getServicesUsingGET
+ operationId: getServices_1
parameters:
- name: service_id
in: query
description: The identity of the service
- allowEmptyValue: false
+ required: false
+ style: form
+ explode: true
schema:
type: string
responses:
@@ -898,29 +809,21 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/service_list_v2'
- 401:
- description: Unauthorized
- content: {}
- 403:
- description: Forbidden
- content: {}
404:
description: Service is not found
content:
application/json:
schema:
$ref: '#/components/schemas/error_information'
- deprecated: false
put:
tags:
- - A1 Policy Management Version 2.0
+ - Service Registry and Supervision
summary: Register a service
description: Registering a service is needed to:<ul><li>Get callbacks.</li><li>Activate
supervision of the service. If a service is inactive, its policies will be
deleted.</li></ul>
- operationId: putServiceUsingPUT
+ operationId: putService_1
requestBody:
- description: registrationInfo
content:
application/json:
schema:
@@ -945,28 +848,19 @@ paths:
'*/*':
schema:
$ref: '#/components/schemas/error_information'
- 401:
- description: Unauthorized
- content: {}
- 403:
- description: Forbidden
- content: {}
- 404:
- description: Not Found
- content: {}
- deprecated: false
/ric:
get:
tags:
- - A1 Policy Management Version 1.0 (deprecated)
+ - A1 Policy Management V1.0
summary: Returns the name of a RIC managing one Mananged Element
- operationId: getRicUsingGET
+ operationId: getRic
parameters:
- name: managedElementId
in: query
description: The identity of the Managed Element
required: true
- allowEmptyValue: false
+ style: form
+ explode: true
schema:
type: string
responses:
@@ -976,31 +870,25 @@ paths:
'*/*':
schema:
type: string
- 401:
- description: Unauthorized
- content: {}
- 403:
- description: Forbidden
- content: {}
404:
description: Near-RT RIC is not found
content:
'*/*':
schema:
type: string
- deprecated: false
/services/keepalive:
put:
tags:
- - A1 Policy Management Version 1.0 (deprecated)
+ - A1 Policy Management V1.0
summary: Heartbeat from a service
- operationId: keepAliveServiceUsingPUT_1
+ operationId: keepAliveService
parameters:
- name: name
in: query
description: The name of the service
required: true
- allowEmptyValue: false
+ style: form
+ explode: true
schema:
type: string
responses:
@@ -1010,101 +898,84 @@ paths:
'*/*':
schema:
type: string
- 201:
- description: Created
- content: {}
- 401:
- description: Unauthorized
- content: {}
- 403:
- description: Forbidden
- content: {}
404:
description: The service is not found, needs re-registration
- content: {}
- deprecated: false
+ content:
+ '*/*':
+ schema:
+ type: string
+ /status:
+ get:
+ tags:
+ - A1 Policy Management V1.0
+ summary: Returns status and statistics of this service
+ operationId: getStatus
+ responses:
+ 200:
+ description: Service is living
+ content:
+ '*/*':
+ schema:
+ type: string
/a1-policy/v2/policy-types/{policytype_id}:
get:
tags:
- - A1 Policy Management Version 2.0
+ - A1 Policy Management
summary: Returns a policy type definition
- operationId: getPolicyTypeUsingGET
+ operationId: getPolicyType
parameters:
- name: policytype_id
in: path
- description: policytype_id
required: true
+ style: simple
+ explode: false
schema:
type: string
responses:
200:
description: Policy type
content:
- application/json:
+ '*/*':
schema:
$ref: '#/components/schemas/policytype_v2'
- 401:
- description: Unauthorized
- content: {}
- 403:
- description: Forbidden
- content: {}
404:
description: Policy type is not found
content:
- application/json:
- schema:
- $ref: '#/components/schemas/error_information'
- deprecated: false
- /status:
- get:
- tags:
- - A1 Policy Management Version 1.0 (deprecated)
- summary: Returns status and statistics of this service
- operationId: getStatusUsingGET_1
- responses:
- 200:
- description: Service is living
- content:
'*/*':
schema:
- type: string
- 401:
- description: Unauthorized
- content: {}
- 403:
- description: Forbidden
- content: {}
- 404:
- description: Not Found
- content: {}
- deprecated: false
+ $ref: '#/components/schemas/error_information'
/a1-policy/v2/policies:
get:
tags:
- - A1 Policy Management Version 2.0
+ - A1 Policy Management
summary: Query policy identities
description: Returns a list of A1 policies matching given search criteria. <br>If
several query parameters are defined, the policies matching all conditions
are returned.
- operationId: getPolicyIdsUsingGET
+ operationId: getPolicyIds_1
parameters:
- name: policytype_id
in: query
description: The identity of the policy type to get policies for.
- allowEmptyValue: false
+ required: false
+ style: form
+ explode: true
schema:
type: string
- name: ric_id
in: query
description: The identity of the Near-RT RIC to get policies for.
- allowEmptyValue: false
+ required: false
+ style: form
+ explode: true
schema:
type: string
- name: service_id
in: query
description: The identity of the service to get policies for.
- allowEmptyValue: false
+ required: false
+ style: form
+ explode: true
schema:
type: string
responses:
@@ -1114,26 +985,18 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/policy_id_list_v2'
- 401:
- description: Unauthorized
- content: {}
- 403:
- description: Forbidden
- content: {}
404:
description: Near-RT RIC or type not found
content:
application/json:
schema:
$ref: '#/components/schemas/error_information'
- deprecated: false
put:
tags:
- - A1 Policy Management Version 2.0
+ - A1 Policy Management
summary: Create or update a policy
- operationId: putPolicyUsingPUT
+ operationId: putPolicy_1
requestBody:
- description: policyInfo
content:
application/json:
schema:
@@ -1142,38 +1005,36 @@ paths:
responses:
200:
description: Policy updated
- content: {}
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/void'
201:
description: Policy created
- content: {}
- 401:
- description: Unauthorized
- content: {}
- 403:
- description: Forbidden
- content: {}
- 404:
- description: Near-RT RIC or policy type is not found
content:
application/json:
schema:
- $ref: '#/components/schemas/error_information'
+ $ref: '#/components/schemas/void'
423:
description: Near-RT RIC is not operational
content:
application/json:
schema:
$ref: '#/components/schemas/error_information'
- deprecated: false
- /r-app/pms-callback:
+ 404:
+ description: Near-RT RIC or policy type is not found
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/error_information'
+ /r-app/near-rt-ric-status:
post:
tags:
- - R-App Callbacks
+ - Callbacks
summary: Callback for Near-RT RIC status
description: The URL to this call is registerred at Service registration.
- operationId: jobStatusCallbackUsingPOST
+ operationId: jobStatusCallback
requestBody:
- description: body
content:
application/json:
schema:
@@ -1182,64 +1043,17 @@ paths:
responses:
200:
description: OK
- content: {}
- 201:
- description: Created
- content: {}
- 401:
- description: Unauthorized
- content: {}
- 403:
- description: Forbidden
- content: {}
- 404:
- description: Not Found
- content: {}
- deprecated: false
- /a1-policy/v2/services/{service_id}:
- delete:
- tags:
- - A1 Policy Management Version 2.0
- summary: Unregister a service
- operationId: deleteServiceUsingDELETE
- parameters:
- - name: service_id
- in: path
- description: service_id
- required: true
- schema:
- type: string
- responses:
- 200:
- description: Not used
- content: {}
- 204:
- description: Service unregistered
content:
- '*/*':
- schema:
- type: object
- 401:
- description: Unauthorized
- content: {}
- 403:
- description: Forbidden
- content: {}
- 404:
- description: Service not found
- content:
- '*/*':
+ application/json:
schema:
- $ref: '#/components/schemas/error_information'
- deprecated: false
+ $ref: '#/components/schemas/void'
/service:
put:
tags:
- - A1 Policy Management Version 1.0 (deprecated)
+ - A1 Policy Management V1.0
summary: Register a service
- operationId: putServiceUsingPUT_1
+ operationId: putService
requestBody:
- description: registrationInfo
content:
application/json:
schema:
@@ -1264,27 +1078,51 @@ paths:
'*/*':
schema:
type: string
- 401:
- description: Unauthorized
- content: {}
- 403:
- description: Forbidden
- content: {}
+ /a1-policy/v2/services/{service_id}:
+ delete:
+ tags:
+ - Service Registry and Supervision
+ summary: Unregister a service
+ operationId: deleteService_1
+ parameters:
+ - name: service_id
+ in: path
+ required: true
+ style: simple
+ explode: false
+ schema:
+ type: string
+ responses:
+ 200:
+ description: Not used
+ content:
+ '*/*':
+ schema:
+ $ref: '#/components/schemas/void'
+ 204:
+ description: Service unregistered
+ content:
+ '*/*':
+ schema:
+ type: object
404:
- description: Not Found
- content: {}
- deprecated: false
+ description: Service not found
+ content:
+ '*/*':
+ schema:
+ $ref: '#/components/schemas/error_information'
/a1-policy/v2/policies/{policy_id}/status:
get:
tags:
- - A1 Policy Management Version 2.0
+ - A1 Policy Management
summary: Returns a policy status
- operationId: getPolicyStatusUsingGET
+ operationId: getPolicyStatus_1
parameters:
- name: policy_id
in: path
- description: policy_id
required: true
+ style: simple
+ explode: false
schema:
type: string
responses:
@@ -1294,23 +1132,15 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/policy_status_info_v2'
- 401:
- description: Unauthorized
- content: {}
- 403:
- description: Forbidden
- content: {}
404:
description: Policy is not found
content:
application/json:
schema:
$ref: '#/components/schemas/error_information'
- deprecated: false
components:
schemas:
error_information:
- title: error_information
type: object
properties:
detail:
@@ -1325,15 +1155,16 @@ components:
format: int32
example: 503
description: Problem as defined in https://tools.ietf.org/html/rfc7807
+ void:
+ type: object
+ description: Void/empty
status_info_v2:
- title: status_info_v2
type: object
properties:
status:
type: string
description: status text
policy_info_v1:
- title: policy_info_v1
type: object
properties:
service:
@@ -1341,7 +1172,6 @@ components:
description: the name of the service owning the policy
json:
type: object
- properties: {}
description: the configuration of the policy
id:
type: string
@@ -1355,8 +1185,24 @@ components:
ric:
type: string
description: identity of the target Near-RT RIC
+ service_registration_info_v1:
+ type: object
+ properties:
+ keepAliveIntervalSeconds:
+ type: integer
+ description: keep alive interval for the service. This is a heartbeat supervision
+ of the service, which in regular intevals must invoke a 'keepAlive' REST
+ call. When a service does not invoke this call within the given time,
+ it is considered unavailble. An unavailable service will be automatically
+ deregistered and its policies will be deleted. Value 0 means no timeout
+ supervision.
+ format: int64
+ callbackUrl:
+ type: string
+ description: callback for notifying of RIC synchronization
+ serviceName:
+ type: string
ric_info_v2:
- title: ric_info_v2
type: object
properties:
ric_id:
@@ -1367,15 +1213,10 @@ components:
description: O1 identities for managed entities
items:
type: string
+ description: O1 identities for managed entities
state:
type: string
- description: "State for the Near-RT RIC, values: \nUNAVAILABLE: The Near-RT\
- \ RIC is not avialable, information may be inconsistent \nAVAILABLE: The\
- \ normal state. Policies can be configured. +\nSYNCHRONIZING: The Policy\
- \ Management Service is synchronizing the view of the Near-RT RIC. Policies\
- \ cannot be configured. \nCONSISTENCY_CHECK: A consistency check between\
- \ the Policy Management Service and the Near-RT RIC. Policies cannot be\
- \ configured."
+ description: Represents the states for a Near-RT RIC
enum:
- UNAVAILABLE
- AVAILABLE
@@ -1386,37 +1227,9 @@ components:
description: supported policy types
items:
type: string
+ description: supported policy types
description: Information for a Near-RT RIC
- service_registration_info_v1:
- title: service_registration_info_v1
- type: object
- properties:
- keepAliveIntervalSeconds:
- type: integer
- description: keep alive interval for the service. This is a heartbeat supervision
- of the service, which in regular intevals must invoke a 'keepAlive' REST
- call. When a service does not invoke this call within the given time,
- it is considered unavailble. An unavailable service will be automatically
- deregistered and its policies will be deleted. Value 0 means no timeout
- supervision.
- format: int64
- callbackUrl:
- type: string
- description: callback for notifying of RIC synchronization
- serviceName:
- type: string
- policy_info_list_v2:
- title: policy_info_list_v2
- type: object
- properties:
- policies:
- type: array
- description: List of policy information
- items:
- $ref: '#/components/schemas/policy_info_v2'
- description: List of policy information
service_registration_info_v2:
- title: service_registration_info_v2
required:
- service_id
type: object
@@ -1430,15 +1243,23 @@ components:
keep_alive_interval_seconds:
type: integer
description: keep alive interval for the service. This is a heartbeat supervision
- of the service, which in regular intevals must invoke a 'keepAlive' REST
+ of the service, which in regular intevals must invoke a 'keepalive' REST
call. When a service does not invoke this call within the given time,
it is considered unavailble. An unavailable service will be automatically
deregistered and its policies will be deleted. Value 0 means no timeout
supervision.
format: int64
description: Information for one service
+ policy_info_list_v2:
+ type: object
+ properties:
+ policies:
+ type: array
+ description: List of policy information
+ items:
+ $ref: '#/components/schemas/policy_info_v2'
+ description: List of policy information
ric_info_v1:
- title: ric_info_v1
type: object
properties:
managedElementIds:
@@ -1446,49 +1267,47 @@ components:
description: O1 identities for managed entities
items:
type: string
+ description: O1 identities for managed entities
policyTypes:
type: array
description: supported policy types
items:
type: string
+ description: supported policy types
state:
type: string
description: state info
ricName:
type: string
description: identity of the Near-RT RIC
- policy_status_info_v2:
- title: policy_status_info_v2
- type: object
- properties:
- last_modified:
- type: string
- description: timestamp, last modification time
- status:
- type: object
- properties: {}
- description: the Policy status
- description: Status for one A1-P Policy
service_status_v1:
- title: service_status_v1
type: object
properties:
keepAliveIntervalSeconds:
type: integer
description: policy keep alive timeout
format: int64
- callbackUrl:
- type: string
- description: callback for notifying of RIC synchronization
timeSinceLastActivitySeconds:
type: integer
description: time since last invocation by the service
format: int64
+ callbackUrl:
+ type: string
+ description: callback for notifying of RIC synchronization
serviceName:
type: string
description: identity of the service
+ policy_status_info_v2:
+ type: object
+ properties:
+ last_modified:
+ type: string
+ description: timestamp, last modification time
+ status:
+ type: object
+ description: the Policy status
+ description: Status for one A1-P Policy
service_status_v2:
- title: service_status_v2
type: object
properties:
callback_url:
@@ -1505,18 +1324,8 @@ components:
type: integer
description: time since last invocation by the service
format: int64
- policytype_v2:
- title: policytype_v2
- type: object
- properties:
- policy_schema:
- type: object
- properties: {}
- description: Policy type json scema. The schema is a json object following
- http://json-schema.org/draft-07/schema
- description: Policy type
+ description: List of service information
ric_info_list_v2:
- title: ric_info_list_v2
type: object
properties:
rics:
@@ -1525,8 +1334,15 @@ components:
items:
$ref: '#/components/schemas/ric_info_v2'
description: List of Near-RT RIC information
+ policytype_v2:
+ type: object
+ properties:
+ policy_schema:
+ type: object
+ description: Policy type json scema. The schema is a json object following
+ http://json-schema.org/draft-07/schema
+ description: Policy type
policytype_id_list_v2:
- title: policytype_id_list_v2
type: object
properties:
policytype_ids:
@@ -1534,19 +1350,9 @@ components:
description: Policy type identities
items:
type: string
+ description: Policy type identities
description: Information about policy types
- policy_id_list_v2:
- title: policy_id_list_v2
- type: object
- properties:
- policy_ids:
- type: array
- description: Policy identities
- items:
- type: string
- description: A list of policy identities
policy_info_v2:
- title: policy_info_v2
required:
- policy_data
- policy_id
@@ -1571,7 +1377,6 @@ components:
description: the name of the service owning the policy
policy_data:
type: object
- properties: {}
description: the configuration of the policy
status_notification_uri:
type: string
@@ -1580,8 +1385,17 @@ components:
type: string
description: identity of the policy type
description: Information for one A1-P Policy
+ policy_id_list_v2:
+ type: object
+ properties:
+ policy_ids:
+ type: array
+ description: Policy identities
+ items:
+ type: string
+ description: Policy identities
+ description: A list of policy identities
service_list_v2:
- title: service_list_v2
type: object
properties:
service_list:
@@ -1591,7 +1405,6 @@ components:
$ref: '#/components/schemas/service_status_v2'
description: List of service information
service_callback_info_v2:
- title: service_callback_info_v2
required:
- event_type
- ric_id
diff --git a/a1-policy-management/pom.xml b/a1-policy-management/pom.xml
index d1f74dd8..69d354b7 100644
--- a/a1-policy-management/pom.xml
+++ b/a1-policy-management/pom.xml
@@ -53,6 +53,11 @@
</properties>
<dependencies>
<dependency>
+ <groupId>org.springdoc</groupId>
+ <artifactId>springdoc-openapi-ui</artifactId>
+ <version>1.5.2</version>
+ </dependency>
+ <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot</artifactId>
</dependency>
@@ -423,4 +428,4 @@
</plugin>
</plugins>
</build>
-</project>
+</project> \ No newline at end of file
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/SwaggerConfig.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/SwaggerConfig.java
index 1197cc35..357aa7b6 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/SwaggerConfig.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/SwaggerConfig.java
@@ -20,26 +20,17 @@
package org.onap.ccsdk.oran.a1policymanagementservice;
-import com.google.common.base.Predicates;
+import io.swagger.v3.oas.annotations.OpenAPIDefinition;
+import io.swagger.v3.oas.annotations.info.Info;
+import io.swagger.v3.oas.annotations.info.License;
+import io.swagger.v3.oas.annotations.tags.Tag;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
-import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
-
-import springfox.documentation.builders.ApiInfoBuilder;
-import springfox.documentation.builders.PathSelectors;
-import springfox.documentation.builders.RequestHandlerSelectors;
-import springfox.documentation.service.ApiInfo;
-import springfox.documentation.service.Contact;
-import springfox.documentation.service.StringVendorExtension;
-import springfox.documentation.service.VendorExtension;
-import springfox.documentation.spi.DocumentationType;
-import springfox.documentation.spring.web.plugins.Docket;
-import springfox.documentation.swagger2.annotations.EnableSwagger2;
+import org.onap.ccsdk.oran.a1policymanagementservice.controllers.v2.ConfigurationController;
+import org.onap.ccsdk.oran.a1policymanagementservice.controllers.v2.Consts;
+import org.onap.ccsdk.oran.a1policymanagementservice.controllers.v2.PolicyController;
+import org.onap.ccsdk.oran.a1policymanagementservice.controllers.v2.RicRepositoryController;
+import org.onap.ccsdk.oran.a1policymanagementservice.controllers.v2.ServiceController;
+import org.onap.ccsdk.oran.a1policymanagementservice.controllers.v2.StatusController;
/**
* Swagger configuration class that uses swagger2 documentation type and scans
@@ -48,78 +39,81 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
* the swagger gui go to http://ip:port/swagger-ui.html
*
*/
-@Configuration
-@EnableSwagger2
-public class SwaggerConfig extends WebMvcConfigurationSupport {
-
- static final String API_TITLE = "A1 Policy management service";
- static final String DESCRIPTION = //
- "The O-RAN Non-RT RIC Policy Management Service provides a REST API for management of A1 policices. \n" //
- + "It provides support for:" //
- + "<ul>" //
- + "<li>A1 Policy creation and modification.</li>" //
- + "<li>Maintaining a view of supported Near-RT RIC policy types </li>" //
- + "<li>Supervision of using services (R-APPs). When a service is unavailble, its policies are removed. </li> " //
- + "<li>Monitoring and maintaining consistency of the SMO view of A1 policies and the Near-RT RICs </li>" //
- + "</ul>"//
- ;
- static final String VERSION = "1.1.0";
- @SuppressWarnings("squid:S1075") // Refactor your code to get this URI from a customizable parameter.
- static final String RESOURCES_PATH = "classpath:/META-INF/resources/";
- static final String WEBJARS_PATH = RESOURCES_PATH + "webjars/";
- static final String SWAGGER_UI = "swagger-ui.html";
- static final String WEBJARS = "/webjars/**";
-
- /**
- * Gets the API info.
- *
- * @return the API info.This page lists all the rest apis for the service.
- */
- @Bean
- public Docket api() {
- return new Docket(DocumentationType.SWAGGER_2) //
- .apiInfo(apiInfo()) //
- .select() //
- .apis(RequestHandlerSelectors.any()) //
- .paths(PathSelectors.any()) //
- .paths(PathSelectors.regex("/error").negate()) //
- // this endpoint is not implemented, but was visible for Swagger
- .paths(PathSelectors.regex("/actuator.*").negate()) //
- // this endpoint is implemented by spring framework, exclude for now
- .build();
- }
-
- private static ApiInfo apiInfo() {
- return new ApiInfoBuilder() //
- .title(API_TITLE) //
- .description(DESCRIPTION) //
- .version(VERSION) //
- .contact(contact()) //
- .extensions(vendorExtentions()) //
- .build();
- }
+@OpenAPIDefinition( //
+ tags = { //
+ @Tag(//
+ name = org.onap.ccsdk.oran.a1policymanagementservice.controllers.v1.Consts.V1_API_NAME, //
+ description = org.onap.ccsdk.oran.a1policymanagementservice.controllers.v1.Consts.V1_API_DESCRIPTION //
+ ), //
+ @Tag(//
+ name = ConfigurationController.API_NAME, //
+ description = ConfigurationController.API_DESCRIPTION //
+ ), //
+ @Tag(//
+ name = PolicyController.API_NAME, //
+ description = PolicyController.API_DESCRIPTION //
+ ), //
+ @Tag( //
+ name = RicRepositoryController.API_NAME, //
+ description = RicRepositoryController.API_DESCRIPTION //
+ ), //
+ @Tag( //
+ name = ServiceController.API_NAME, //
+ description = ServiceController.API_DESCRIPTION //
- @SuppressWarnings("java:S3740") // VendorExtension is a raw type. References to generic type VendorExtension<T>
- // should be parameterizedJava(16777788)
- private static List<VendorExtension> vendorExtentions() {
- final String URN = "60f9a0e7-343f-43bf-9194-d8d65688d465";
- List<VendorExtension> extentions = new ArrayList<>();
- extentions.add(new StringVendorExtension("x-api-id", URN));
- extentions.add(new StringVendorExtension("x-audience", "external-partner"));
- return extentions;
- }
+ ), //
+ @Tag( //
+ name = StatusController.API_NAME, //
+ description = StatusController.API_DESCRIPTION //
+ ), //
+ @Tag( //
+ name = Consts.V2_API_SERVICE_CALLBACKS_NAME, //
+ description = Consts.V2_API_SERVICE_CALLBACKS_DESCRIPTION //
+ ) //
+ }, //
+ info = @Info(title = SwaggerConfig.API_TITLE, //
+ version = SwaggerConfig.VERSION, //
+ description = SwaggerConfig.DESCRIPTION, //
+ license = @License(name = "Copyright (C) 2020 Nordix Foundation. Licensed under the Apache License.", //
+ url = "http://www.apache.org/licenses/LICENSE-2.0")) //
+)
+public class SwaggerConfig {
+ private SwaggerConfig() {}
- private static Contact contact() {
- return new Contact("Ericsson Software Technology", "", "nonrtric@est.tech");
- }
+ private static final String H3 = "<h3>";
+ private static final String H3_END = "</h3>";
- @Override
- protected void addResourceHandlers(ResourceHandlerRegistry registry) {
- registry.addResourceHandler(SWAGGER_UI) //
- .addResourceLocations(RESOURCES_PATH);
+ public static final String API_TITLE = "A1 Policy management service";
+ static final String DESCRIPTION = "<h2>General</h2>" + //
+ "<p>The O-RAN Non-RT RIC Policy Management Service provides a REST API for management of A1 policices. <br/>The main tasks of the service are:</p>"
+ + //
+ "<ul>" + //
+ "<li>A1 Policy creation, modification and deletion.</li>" + //
+ "<li>Monitoring and maintaining consistency of the SMO view of A1 policies and the Near-RT RICs</li>" + //
+ "<li>Maintaining a view of supported Near-RT RIC policy types</li>" + //
+ "<li>Supervision of using services (R-APPs). When a service is unavailble, its policies are removed.</li>" + //
+ "</ul>" + //
+ "<h2>APIs provided by the service</h2>" + //
+ H3 + PolicyController.API_NAME + H3_END + //
+ "<p>This is an API for management of A1 Policies.</p>" + //
+ "<ul>" + //
+ "<li>A1 Policy retrieval, creation, modification and deletion.</li>" + //
+ "<li>Retrieval of supported A1 Policy types for a Near-RT RIC</li>" + //
+ "<li>Retrieval of status for existing A1 policies</li>" + //
+ "</ul>" + //
- registry.addResourceHandler(WEBJARS) //
- .addResourceLocations(WEBJARS_PATH);
- }
+ H3 + ConfigurationController.API_NAME + H3_END + //
+ "<p>API for updating and retrieval of the component configuration. Note that there other ways to maintain the configuration.</p>"
+ + //
+ H3 + Consts.V2_API_SERVICE_CALLBACKS_NAME + H3_END + //
+ "<p>These are endpoints that are invoked by this service. The callbacks are registerred in this service at service registration.</p>"
+ + //
+ H3 + RicRepositoryController.API_NAME + H3_END + //
+ "<p>This is an API that provides support for looking up a NearRT-RIC. Each A1 policy is targeted for one Near-RT RIC.</p>"
+ + H3 + StatusController.API_NAME + H3_END + //
+ "<p>API used for supervision of the PMS component.</p>" + //
+ H3 + ServiceController.API_NAME + H3_END + //
+ "<p>API used for registerring services that uses PMS. Each A1 policy is owned by a service. PMS can supervise each registerred service and will automatically remove policies for unavailable services.</p>";
+ public static final String VERSION = "1.1.0";
}
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/ServiceCallbackInfo.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/ServiceCallbackInfo.java
index 7d5f003a..7d89206c 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/ServiceCallbackInfo.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/ServiceCallbackInfo.java
@@ -23,13 +23,12 @@ package org.onap.ccsdk.oran.a1policymanagementservice.controllers;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.gson.annotations.SerializedName;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
import org.immutables.gson.Gson;
@Gson.TypeAdapters
-@ApiModel(value = "service_callback_info_v2",
+@Schema(name = "service_callback_info_v2",
description = "Information transferred as in Service callbacks (callback_url)")
public class ServiceCallbackInfo {
@@ -37,17 +36,17 @@ public class ServiceCallbackInfo {
+ "AVAILABLE: the Near-RT RIC has become available for A1 Policy management";
@Gson.TypeAdapters
- @ApiModel(value = "event_type_v2", description = EVENT_TYPE_DESCRIPTION)
+ @Schema(name = "event_type_v2", description = EVENT_TYPE_DESCRIPTION)
public enum EventType {
AVAILABLE
}
- @ApiModelProperty(value = "identity of a Near-RT RIC", required = true)
+ @Schema(name = "ric_id", description = "identity of a Near-RT RIC", required = true)
@SerializedName("ric_id")
@JsonProperty(value = "ric_id", required = true)
public String ricId;
- @ApiModelProperty(value = EVENT_TYPE_DESCRIPTION, required = true)
+ @Schema(name = "event_type", description = EVENT_TYPE_DESCRIPTION, required = true)
@SerializedName("event_type")
@JsonProperty(value = "event_type", required = true)
public EventType eventType;
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/VoidResponse.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/VoidResponse.java
index a2b9af4b..754d1694 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/VoidResponse.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/VoidResponse.java
@@ -20,12 +20,12 @@
package org.onap.ccsdk.oran.a1policymanagementservice.controllers;
-import io.swagger.annotations.ApiModel;
+import io.swagger.v3.oas.annotations.media.Schema;
import org.immutables.gson.Gson;
@Gson.TypeAdapters
-@ApiModel(value = "void", description = "Void/empty")
+@Schema(name = "void", description = "Void/empty")
public class VoidResponse {
private VoidResponse() {}
}
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/Consts.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/Consts.java
index 69868d2d..44fc1cad 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/Consts.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/Consts.java
@@ -22,7 +22,8 @@ package org.onap.ccsdk.oran.a1policymanagementservice.controllers.v1;
public class Consts {
- public static final String V1_API_NAME = "A1 Policy Management Version 1.0 (deprecated)";
+ public static final String V1_API_NAME = "A1 Policy Management V1.0";
+ public static final String V1_API_DESCRIPTION = "(deprecated primitves)";
private Consts() {}
}
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/PolicyController.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/PolicyController.java
index 6c5ebd90..1f5f7ca9 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/PolicyController.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/PolicyController.java
@@ -23,11 +23,14 @@ package org.onap.ccsdk.oran.a1policymanagementservice.controllers.v1;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-import io.swagger.annotations.ApiResponse;
-import io.swagger.annotations.ApiResponses;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.media.ArraySchema;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
+import io.swagger.v3.oas.annotations.responses.ApiResponses;
+import io.swagger.v3.oas.annotations.tags.Tag;
import java.lang.invoke.MethodHandles;
import java.time.Instant;
@@ -66,7 +69,7 @@ import org.springframework.web.reactive.function.client.WebClientResponseExcepti
import reactor.core.publisher.Mono;
@RestController
-@Api(tags = Consts.V1_API_NAME)
+@Tag(name = Consts.V1_API_NAME)
public class PolicyController {
public static class RejectionException extends Exception {
@@ -94,13 +97,19 @@ public class PolicyController {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
private static Gson gson = new GsonBuilder().create();
- @GetMapping("/policy_schemas")
- @ApiOperation(value = "Returns policy type schema definitions")
- @ApiResponses(value = {
- @ApiResponse(code = 200, message = "Policy schemas", response = Object.class, responseContainer = "List"), //
- @ApiResponse(code = 404, message = "Near-RT RIC is not found", response = ErrorResponse.ErrorInfo.class)})
+ @GetMapping("/policy_schemas") //
+ @Operation(summary = "Returns policy type schema definitions") //
+ @ApiResponses(value = { //
+ @ApiResponse(responseCode = "200", //
+ description = "Policy schemas", //
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Object.class)))), //
+ @ApiResponse(responseCode = "404", //
+ description = "Near-RT RIC is not found", //
+ content = @Content(schema = @Schema(implementation = ErrorResponse.ErrorInfo.class))) //
+ })
public ResponseEntity<String> getPolicySchemas( //
- @ApiParam(name = "ric", required = false, value = "The name of the Near-RT RIC to get the definitions for.") //
+ @Parameter(name = "ric", required = false,
+ description = "The name of the Near-RT RIC to get the definitions for.") //
@RequestParam(name = "ric", required = false) String ricName) throws EntityNotFoundException {
if (ricName == null) {
Collection<PolicyType> types = this.policyTypes.getAll();
@@ -112,26 +121,35 @@ public class PolicyController {
}
@GetMapping("/policy_schema")
- @ApiOperation(value = "Returns one policy type schema definition")
+ @Operation(summary = "Returns one policy type schema definition")
@ApiResponses(value = { //
- @ApiResponse(code = 200, message = "Policy schema", response = Object.class), @ApiResponse(code = 404,
- message = "The policy type is not found", response = ErrorResponse.ErrorInfo.class)})
+ @ApiResponse(responseCode = "200", //
+ description = "Policy schema", //
+ content = @Content(schema = @Schema(implementation = Object.class))),
+ @ApiResponse(responseCode = "404", //
+ description = "The policy type is not found", //
+ content = @Content(schema = @Schema(implementation = ErrorResponse.ErrorInfo.class)))//
+ })
public ResponseEntity<String> getPolicySchema( //
- @ApiParam(name = "id", required = true,
- value = "The identity of the policy type to get the definition for.") //
+ @Parameter(name = "id", required = true,
+ description = "The identity of the policy type to get the definition for.") //
@RequestParam(name = "id", required = true) String id) throws EntityNotFoundException {
PolicyType type = policyTypes.getType(id);
return new ResponseEntity<>(type.schema(), HttpStatus.OK);
}
@GetMapping("/policy_types")
- @ApiOperation(value = "Query policy type names")
- @ApiResponses(value = {
- @ApiResponse(code = 200, message = "Policy type names", response = String.class,
- responseContainer = "List"),
- @ApiResponse(code = 404, message = "Near-RT RIC is not found", response = ErrorResponse.ErrorInfo.class)})
+ @Operation(summary = "Query policy type names")
+ @ApiResponses(value = { //
+ @ApiResponse(responseCode = "200", //
+ description = "Policy type names", //
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = String.class)))), //
+ @ApiResponse(responseCode = "404", //
+ description = "Near-RT RIC is not found", //
+ content = @Content(schema = @Schema(implementation = ErrorResponse.ErrorInfo.class)))//
+ })
public ResponseEntity<String> getPolicyTypes( //
- @ApiParam(name = "ric", required = false, value = "The name of the Near-RT RIC to get types for.") //
+ @Parameter(name = "ric", required = false, description = "The name of the Near-RT RIC to get types for.") //
@RequestParam(name = "ric", required = false) String ricName) throws EntityNotFoundException {
if (ricName == null) {
Collection<PolicyType> types = this.policyTypes.getAll();
@@ -143,27 +161,40 @@ public class PolicyController {
}
@GetMapping("/policy")
- @ApiOperation(value = "Returns a policy configuration") //
+ @Operation(summary = "Returns a policy configuration") //
@ApiResponses(value = { //
- @ApiResponse(code = 200, message = "Policy found", response = Object.class), //
- @ApiResponse(code = 404, message = "Policy is not found", response = ErrorResponse.ErrorInfo.class)} //
+ @ApiResponse(responseCode = "200", //
+ description = "Policy found", //
+ content = @Content(schema = @Schema(implementation = Object.class))), //
+ @ApiResponse(responseCode = "404", //
+ description = "Policy is not found", //
+ content = @Content(schema = @Schema(implementation = ErrorResponse.ErrorInfo.class))//
+ )} //
)
public ResponseEntity<String> getPolicy( //
- @ApiParam(name = "id", required = true, value = "The identity of the policy instance.") //
+ @Parameter(name = "id", required = true, description = "The identity of the policy instance.") //
@RequestParam(name = "id", required = true) String id) throws EntityNotFoundException {
Policy p = policies.getPolicy(id);
return new ResponseEntity<>(p.json(), HttpStatus.OK);
}
@DeleteMapping("/policy")
- @ApiOperation(value = "Delete a policy", response = Object.class)
+ @Operation(summary = "Delete a policy")
@ApiResponses(value = { //
- @ApiResponse(code = 200, message = "Not used", response = VoidResponse.class),
- @ApiResponse(code = 204, message = "Policy deleted", response = VoidResponse.class),
- @ApiResponse(code = 404, message = "Policy is not found", response = String.class),
- @ApiResponse(code = 423, message = "Near-RT RIC is not operational", response = String.class)})
+ @ApiResponse(responseCode = "200", //
+ description = "Not used", //
+ content = @Content(schema = @Schema(implementation = VoidResponse.class))),
+ @ApiResponse(responseCode = "204", //
+ description = "Policy deleted", //
+ content = @Content(schema = @Schema(implementation = VoidResponse.class))),
+ @ApiResponse(responseCode = "404", //
+ description = "Policy is not found", //
+ content = @Content(schema = @Schema(implementation = String.class))),
+ @ApiResponse(responseCode = "423", //
+ description = "Near-RT RIC is not operational", //
+ content = @Content(schema = @Schema(implementation = String.class)))})
public Mono<ResponseEntity<Object>> deletePolicy( //
- @ApiParam(name = "id", required = true, value = "The identity of the policy instance.") //
+ @Parameter(name = "id", required = true, description = "The identity of the policy instance.") //
@RequestParam(name = "id", required = true) String id) throws EntityNotFoundException {
Policy policy = policies.getPolicy(id);
keepServiceAlive(policy.ownerServiceId());
@@ -180,26 +211,37 @@ public class PolicyController {
}
@PutMapping(path = "/policy")
- @ApiOperation(value = "Put a policy", response = VoidResponse.class)
+ @Operation(summary = "Put a policy")
@ApiResponses(value = { //
- @ApiResponse(code = 201, message = "Policy created", response = VoidResponse.class), //
- @ApiResponse(code = 200, message = "Policy updated", response = VoidResponse.class), //
- @ApiResponse(code = 423, message = "Near-RT RIC is not operational", response = String.class), //
- @ApiResponse(code = 404, message = "Near-RT RIC or policy type is not found", response = String.class) //
+ @ApiResponse(responseCode = "201", //
+ description = "Policy created", //
+ content = @Content(schema = @Schema(implementation = VoidResponse.class))), //
+ @ApiResponse(responseCode = "200", //
+ description = "Policy updated", //
+ content = @Content(schema = @Schema(implementation = VoidResponse.class))), //
+ @ApiResponse(responseCode = "423", //
+ description = "Near-RT RIC is not operational", //
+ content = @Content(schema = @Schema(implementation = String.class))), //
+ @ApiResponse(responseCode = "404", //
+ description = "Near-RT RIC or policy type is not found", //
+ content = @Content(schema = @Schema(implementation = String.class))) //
})
public Mono<ResponseEntity<Object>> putPolicy( //
- @ApiParam(name = "type", required = false, value = "The name of the policy type.") //
+ @Parameter(name = "type", required = false, description = "The name of the policy type.") //
@RequestParam(name = "type", required = false, defaultValue = "") String typeName, //
- @ApiParam(name = "id", required = true, value = "The identity of the policy instance.") //
+ @Parameter(name = "id", required = true, description = "The identity of the policy instance.") //
@RequestParam(name = "id", required = true) String instanceId, //
- @ApiParam(name = "ric", required = true, value = "The name of the Near-RT RIC where the policy will be " + //
- "created.") //
+ @Parameter(name = "ric", required = true,
+ description = "The name of the Near-RT RIC where the policy will be " + //
+ "created.") //
@RequestParam(name = "ric", required = true) String ricName, //
- @ApiParam(name = "service", required = true, value = "The name of the service creating the policy.") //
+ @Parameter(name = "service", required = true, description = "The name of the service creating the policy.") //
@RequestParam(name = "service", required = true) String service, //
- @ApiParam(name = "transient", required = false, value = "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.") //
+ @Parameter(name = "transient", required = 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.") //
@RequestParam(name = "transient", required = false, defaultValue = "false") boolean isTransient, //
@RequestBody Object jsonBody) {
@@ -289,16 +331,21 @@ public class PolicyController {
}
@GetMapping("/policies")
- @ApiOperation(value = "Query policies")
- @ApiResponses(value = {
- @ApiResponse(code = 200, message = "Policies", response = PolicyInfo.class, responseContainer = "List"),
- @ApiResponse(code = 404, message = "Near-RT RIC or type not found", response = String.class)})
+ @Operation(summary = "Query policies")
+ @ApiResponses(value = { //
+ @ApiResponse(responseCode = "200", //
+ description = "Policies", //
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = PolicyInfo.class)))), //
+ @ApiResponse(responseCode = "404", //
+ description = "Near-RT RIC or type not found", //
+ content = @Content(schema = @Schema(implementation = String.class)))})
public ResponseEntity<String> getPolicies( //
- @ApiParam(name = "type", required = false, value = "The name of the policy type to get policies for.") //
+ @Parameter(name = "type", required = false,
+ description = "The name of the policy type to get policies for.") //
@RequestParam(name = "type", required = false) String type, //
- @ApiParam(name = "ric", required = false, value = "The name of the Near-RT RIC to get policies for.") //
+ @Parameter(name = "ric", required = false, description = "The name of the Near-RT RIC to get policies for.") //
@RequestParam(name = "ric", required = false) String ric, //
- @ApiParam(name = "service", required = false, value = "The name of the service to get policies for.") //
+ @Parameter(name = "service", required = false, description = "The name of the service to get policies for.") //
@RequestParam(name = "service", required = false) String service) //
{
if ((type != null && this.policyTypes.get(type) == null)) {
@@ -313,17 +360,21 @@ public class PolicyController {
}
@GetMapping("/policy_ids")
- @ApiOperation(value = "Query policies, only policy identities returned")
- @ApiResponses(value = {
- @ApiResponse(code = 200, message = "Policy identitiess", response = String.class,
- responseContainer = "List"),
- @ApiResponse(code = 404, message = "Near-RT RIC or type not found", response = String.class)})
+ @Operation(summary = "Query policies, only policy identities returned")
+ @ApiResponses(value = { //
+ @ApiResponse(responseCode = "200", //
+ description = "Policy identitiess", //
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = String.class)))),
+ @ApiResponse(responseCode = "404", //
+ description = "Near-RT RIC or type not found", //
+ content = @Content(schema = @Schema(implementation = String.class)))})
public ResponseEntity<String> getPolicyIds( //
- @ApiParam(name = "type", required = false, value = "The name of the policy type to get policies for.") //
+ @Parameter(name = "type", required = false,
+ description = "The name of the policy type to get policies for.") //
@RequestParam(name = "type", required = false) String type, //
- @ApiParam(name = "ric", required = false, value = "The name of the Near-RT RIC to get policies for.") //
+ @Parameter(name = "ric", required = false, description = "The name of the Near-RT RIC to get policies for.") //
@RequestParam(name = "ric", required = false) String ric, //
- @ApiParam(name = "service", required = false, value = "The name of the service to get policies for.") //
+ @Parameter(name = "service", required = false, description = "The name of the service to get policies for.") //
@RequestParam(name = "service", required = false) String service) //
{
if ((type != null && this.policyTypes.get(type) == null)) {
@@ -338,13 +389,18 @@ public class PolicyController {
}
@GetMapping("/policy_status")
- @ApiOperation(value = "Returns a policy status") //
+ @Operation(summary = "Returns a policy status") //
@ApiResponses(value = { //
- @ApiResponse(code = 200, message = "Policy status", response = Object.class), //
- @ApiResponse(code = 404, message = "Policy is not found", response = String.class)} //
- )
+ @ApiResponse(responseCode = "200", //
+ description = "Policy status", //
+ content = @Content(schema = @Schema(implementation = Object.class))), //
+ @ApiResponse(responseCode = "404", //
+ description = "Policy is not found", //
+ content = @Content(schema = @Schema(implementation = String.class))) //
+ })
public Mono<ResponseEntity<String>> getPolicyStatus( //
- @ApiParam(name = "id", required = true, value = "The identity of the policy.") @RequestParam(name = "id", //
+ @Parameter(name = "id", required = true, description = "The identity of the policy.") @RequestParam(
+ name = "id", //
required = true) String id)
throws EntityNotFoundException {
Policy policy = policies.getPolicy(id);
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/PolicyInfo.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/PolicyInfo.java
index 21e5b96c..0e3bf513 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/PolicyInfo.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/PolicyInfo.java
@@ -20,31 +20,30 @@
package org.onap.ccsdk.oran.a1policymanagementservice.controllers.v1;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
import org.immutables.gson.Gson;
@Gson.TypeAdapters
-@ApiModel(value = "policy_info_v1")
+@Schema(name = "policy_info_v1")
public class PolicyInfo {
- @ApiModelProperty(value = "identity of the policy")
+ @Schema(description = "identity of the policy")
public String id;
- @ApiModelProperty(value = "name of the policy type")
+ @Schema(description = "name of the policy type")
public String type;
- @ApiModelProperty(value = "identity of the target Near-RT RIC")
+ @Schema(description = "identity of the target Near-RT RIC")
public String ric;
- @ApiModelProperty(value = "the configuration of the policy")
+ @Schema(description = "the configuration of the policy")
public Object json;
- @ApiModelProperty(value = "the name of the service owning the policy")
+ @Schema(description = "the name of the service owning the policy")
public String service;
- @ApiModelProperty(value = "timestamp, last modification time")
+ @Schema(description = "timestamp, last modification time")
public String lastModified;
PolicyInfo() {}
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/RicInfo.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/RicInfo.java
index 467afdb9..b50277aa 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/RicInfo.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/RicInfo.java
@@ -20,26 +20,25 @@
package org.onap.ccsdk.oran.a1policymanagementservice.controllers.v1;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
import java.util.Collection;
import org.immutables.gson.Gson;
@Gson.TypeAdapters
-@ApiModel(value = "ric_info_v1")
+@Schema(name = "ric_info_v1")
class RicInfo {
- @ApiModelProperty(value = "identity of the Near-RT RIC")
+ @Schema(description = "identity of the Near-RT RIC")
public final String ricName;
- @ApiModelProperty(value = "O1 identities for managed entities")
+ @Schema(description = "O1 identities for managed entities")
public final Collection<String> managedElementIds;
- @ApiModelProperty(value = "supported policy types")
+ @Schema(description = "supported policy types")
public final Collection<String> policyTypes;
- @ApiModelProperty(value = "state info")
+ @Schema(description = "state info")
public final String state;
RicInfo(String name, Collection<String> managedElementIds, Collection<String> policyTypes, String state) {
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/RicRepositoryController.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/RicRepositoryController.java
index 224935e3..f7fdfa90 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/RicRepositoryController.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/RicRepositoryController.java
@@ -23,11 +23,14 @@ package org.onap.ccsdk.oran.a1policymanagementservice.controllers.v1;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-import io.swagger.annotations.ApiResponse;
-import io.swagger.annotations.ApiResponses;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.media.ArraySchema;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
+import io.swagger.v3.oas.annotations.responses.ApiResponses;
+import io.swagger.v3.oas.annotations.tags.Tag;
import java.util.ArrayList;
import java.util.List;
@@ -44,7 +47,7 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController
-@Api(tags = Consts.V1_API_NAME)
+@Tag(name = Consts.V1_API_NAME)
public class RicRepositoryController {
@Autowired
@@ -62,13 +65,18 @@ public class RicRepositoryController {
* @throws EntityNotFoundException
*/
@GetMapping("/ric")
- @ApiOperation(value = "Returns the name of a RIC managing one Mananged Element")
+ @Operation(summary = "Returns the name of a RIC managing one Mananged Element")
@ApiResponses(value = { //
- @ApiResponse(code = 200, message = "Near-RT RIC is found", response = String.class), //
- @ApiResponse(code = 404, message = "Near-RT RIC is not found", response = String.class) //
+ @ApiResponse(responseCode = "200", //
+ description = "Near-RT RIC is found", //
+ content = @Content(schema = @Schema(implementation = String.class))), //
+ @ApiResponse(responseCode = "404", //
+ description = "Near-RT RIC is not found", //
+ content = @Content(schema = @Schema(implementation = String.class))) //
})
+
public ResponseEntity<String> getRic( //
- @ApiParam(name = "managedElementId", required = true, value = "The identity of the Managed Element") //
+ @Parameter(name = "managedElementId", required = true, description = "The identity of the Managed Element") //
@RequestParam(name = "managedElementId", required = true) String managedElementId)
throws EntityNotFoundException {
Ric ric = this.rics.lookupRicForManagedElement(managedElementId);
@@ -79,12 +87,17 @@ public class RicRepositoryController {
* @return a Json array of all RIC data Example: http://localhost:8081/ric
*/
@GetMapping("/rics")
- @ApiOperation(value = "Query Near-RT RIC information")
+ @Operation(summary = "Query Near-RT RIC information")
@ApiResponses(value = { //
- @ApiResponse(code = 200, message = "OK", response = RicInfo.class, responseContainer = "List"), //
- @ApiResponse(code = 404, message = "Policy type is not found", response = String.class)})
+ @ApiResponse(responseCode = "200", //
+ description = "OK", //
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = RicInfo.class)))), //
+ @ApiResponse(responseCode = "404", //
+ description = "Policy type is not found", //
+ content = @Content(schema = @Schema(implementation = String.class))) //
+ })
public ResponseEntity<String> getRics( //
- @ApiParam(name = "policyType", required = false, value = "The name of the policy type") //
+ @Parameter(name = "policyType", required = false, description = "The name of the policy type") //
@RequestParam(name = "policyType", required = false) String supportingPolicyType) {
if ((supportingPolicyType != null) && (this.types.get(supportingPolicyType) == null)) {
return new ResponseEntity<>("Policy type not found", HttpStatus.NOT_FOUND);
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/ServiceController.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/ServiceController.java
index 548f4fe1..b4b7dca4 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/ServiceController.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/ServiceController.java
@@ -23,11 +23,14 @@ package org.onap.ccsdk.oran.a1policymanagementservice.controllers.v1;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-import io.swagger.annotations.ApiResponse;
-import io.swagger.annotations.ApiResponses;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.media.ArraySchema;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
+import io.swagger.v3.oas.annotations.responses.ApiResponses;
+import io.swagger.v3.oas.annotations.tags.Tag;
import java.net.MalformedURLException;
import java.net.URL;
@@ -52,7 +55,7 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController
-@Api(tags = Consts.V1_API_NAME)
+@Tag(name = Consts.V1_API_NAME)
public class ServiceController {
private final Services services;
@@ -67,12 +70,18 @@ public class ServiceController {
}
@GetMapping("/services")
- @ApiOperation(value = "Returns service information")
+ @Operation(summary = "Returns service information")
@ApiResponses(value = { //
- @ApiResponse(code = 200, message = "OK", response = ServiceStatus.class, responseContainer = "List"), //
- @ApiResponse(code = 404, message = "Service is not found", response = String.class)})
+ @ApiResponse(responseCode = "200", //
+ description = "OK", //
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = ServiceStatus.class)))), //
+ @ApiResponse(responseCode = "404", //
+ description = "Service is not found", //
+ content = @Content(schema = @Schema(implementation = String.class))) //
+ })
+
public ResponseEntity<String> getServices(//
- @ApiParam(name = "name", required = false, value = "The name of the service") //
+ @Parameter(name = "name", required = false, description = "The name of the service") //
@RequestParam(name = "name", required = false) String name) {
if (name != null && this.services.get(name) == null) {
return new ResponseEntity<>("Service not found", HttpStatus.NOT_FOUND);
@@ -107,11 +116,18 @@ public class ServiceController {
}
}
- @ApiOperation(value = "Register a service")
+ @Operation(summary = "Register a service")
@ApiResponses(value = { //
- @ApiResponse(code = 200, message = "Service updated", response = String.class),
- @ApiResponse(code = 201, message = "Service created", response = String.class), //
- @ApiResponse(code = 400, message = "The ServiceRegistrationInfo is not accepted", response = String.class)})
+ @ApiResponse(responseCode = "200", //
+ description = "Service updated", //
+ content = @Content(schema = @Schema(implementation = String.class))), //
+ @ApiResponse(responseCode = "201", //
+ description = "Service created", //
+ content = @Content(schema = @Schema(implementation = String.class))), //
+ @ApiResponse(responseCode = "400", //
+ description = "The ServiceRegistrationInfo is not accepted", //
+ content = @Content(schema = @Schema(implementation = String.class))) //
+ })
@PutMapping("/service")
public ResponseEntity<String> putService(//
@RequestBody ServiceRegistrationInfo registrationInfo) {
@@ -125,14 +141,16 @@ public class ServiceController {
}
}
- @ApiOperation(value = "Delete a service")
+ @Operation(summary = "Delete a service")
@ApiResponses(value = { //
- @ApiResponse(code = 204, message = "Service deleted"),
- @ApiResponse(code = 204, message = "Not used", response = VoidResponse.class),
- @ApiResponse(code = 404, message = "Service not found", response = String.class)})
+ @ApiResponse(responseCode = "204", description = "Service deleted"),
+ @ApiResponse(responseCode = "204", description = "Not used",
+ content = @Content(schema = @Schema(implementation = VoidResponse.class))),
+ @ApiResponse(responseCode = "404", description = "Service not found",
+ content = @Content(schema = @Schema(implementation = String.class)))})
@DeleteMapping("/services")
public ResponseEntity<String> deleteService(//
- @ApiParam(name = "name", required = true, value = "The name of the service") //
+ @Parameter(name = "name", required = true, description = "The name of the service") //
@RequestParam(name = "name", required = true) String serviceName) {
try {
Service service = removeService(serviceName);
@@ -145,13 +163,16 @@ public class ServiceController {
}
}
- @ApiOperation(value = "Heartbeat from a service")
+ @Operation(summary = "Heartbeat from a service")
@ApiResponses(value = { //
- @ApiResponse(code = 200, message = "Service supervision timer refreshed, OK"),
- @ApiResponse(code = 404, message = "The service is not found, needs re-registration")})
+ @ApiResponse(responseCode = "200", description = "Service supervision timer refreshed, OK"),
+ @ApiResponse(responseCode = "404", description = "The service is not found, needs re-registration")
+
+ })
+
@PutMapping("/services/keepalive")
public ResponseEntity<String> keepAliveService(//
- @ApiParam(name = "name", required = true, value = "The name of the service") //
+ @Parameter(name = "name", required = true, description = "The name of the service") //
@RequestParam(name = "name", required = true) String serviceName) {
try {
services.getService(serviceName).keepAlive();
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/ServiceRegistrationInfo.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/ServiceRegistrationInfo.java
index 38e9b3b4..a4fd59a8 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/ServiceRegistrationInfo.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/ServiceRegistrationInfo.java
@@ -22,19 +22,18 @@ package org.onap.ccsdk.oran.a1policymanagementservice.controllers.v1;
import com.google.gson.annotations.SerializedName;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
import org.immutables.gson.Gson;
@Gson.TypeAdapters
-@ApiModel(value = "service_registration_info_v1")
+@Schema(name = "service_registration_info_v1")
public class ServiceRegistrationInfo {
@SerializedName("serviceName")
public String serviceName = "";
- @ApiModelProperty(value = "keep alive interval for the service. This is a heartbeat supervision of the service, "
+ @Schema(description = "keep alive interval for the service. This is a heartbeat supervision of the service, "
+ "which in regular intevals must invoke a 'keepAlive' REST call. "
+ "When a service does not invoke this call within the given time, it is considered unavailble. "
+ "An unavailable service will be automatically deregistered and its policies will be deleted. "
@@ -42,7 +41,7 @@ public class ServiceRegistrationInfo {
@SerializedName("keepAliveIntervalSeconds")
public long keepAliveIntervalSeconds = 0;
- @ApiModelProperty(value = "callback for notifying of RIC synchronization", required = false, allowEmptyValue = true)
+ @Schema(description = "callback for notifying of RIC synchronization")
@SerializedName("callbackUrl")
public String callbackUrl = "";
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/ServiceStatus.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/ServiceStatus.java
index 8f6273f9..f3f57d8b 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/ServiceStatus.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/ServiceStatus.java
@@ -20,25 +20,24 @@
package org.onap.ccsdk.oran.a1policymanagementservice.controllers.v1;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
import org.immutables.gson.Gson;
@Gson.TypeAdapters
-@ApiModel(value = "service_status_v1")
+@Schema(name = "service_status_v1")
public class ServiceStatus {
- @ApiModelProperty(value = "identity of the service")
+ @Schema(description = "identity of the service")
public final String serviceName;
- @ApiModelProperty(value = "policy keep alive timeout")
+ @Schema(description = "policy keep alive timeout")
public final long keepAliveIntervalSeconds;
- @ApiModelProperty(value = "time since last invocation by the service")
+ @Schema(description = "time since last invocation by the service")
public final long timeSinceLastActivitySeconds;
- @ApiModelProperty(value = "callback for notifying of RIC synchronization")
+ @Schema(description = "callback for notifying of RIC synchronization")
public String callbackUrl;
ServiceStatus(String name, long keepAliveIntervalSeconds, long timeSincePingSeconds, String callbackUrl) {
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/StatusController.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/StatusController.java
index 492b1ea8..4dbe3b66 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/StatusController.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v1/StatusController.java
@@ -20,10 +20,12 @@
package org.onap.ccsdk.oran.a1policymanagementservice.controllers.v1;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiResponse;
-import io.swagger.annotations.ApiResponses;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
+import io.swagger.v3.oas.annotations.responses.ApiResponses;
+import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
@@ -32,14 +34,16 @@ import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Mono;
@RestController
-@Api(tags = Consts.V1_API_NAME)
+@Tag(name = Consts.V1_API_NAME)
public class StatusController {
@GetMapping("/status")
- @ApiOperation(value = "Returns status and statistics of this service")
+ @Operation(summary = "Returns status and statistics of this service")
@ApiResponses(value = { //
- @ApiResponse(code = 200, message = "Service is living", response = String.class) //
+ @ApiResponse(responseCode = "200", description = "Service is living",
+ content = @Content(schema = @Schema(implementation = String.class))) //
})
+
public Mono<ResponseEntity<String>> getStatus() {
return Mono.just(new ResponseEntity<>("hunky dory", HttpStatus.OK));
}
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ConfigurationController.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ConfigurationController.java
index 86ae2734..e6b938a0 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ConfigurationController.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ConfigurationController.java
@@ -23,10 +23,12 @@ import com.google.gson.GsonBuilder;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiResponse;
-import io.swagger.annotations.ApiResponses;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
+import io.swagger.v3.oas.annotations.responses.ApiResponses;
+import io.swagger.v3.oas.annotations.tags.Tag;
import java.io.IOException;
import java.util.Optional;
@@ -34,7 +36,6 @@ import java.util.Optional;
import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ApplicationConfigParser;
import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ConfigurationFile;
import org.onap.ccsdk.oran.a1policymanagementservice.controllers.VoidResponse;
-import org.onap.ccsdk.oran.a1policymanagementservice.controllers.v2.ErrorResponse.ErrorInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -47,10 +48,13 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
@RestController("ConfigurationControllerV2")
-@Api(tags = {Consts.V2_CONFIG_API_NAME})
+@Tag(name = ConfigurationController.API_NAME)
public class ConfigurationController {
private static final Logger logger = LoggerFactory.getLogger(ConfigurationController.class);
+ public static final String API_NAME = "Management of configuration";
+ public static final String API_DESCRIPTION = "";
+
@Autowired
ConfigurationFile configurationFile;
@@ -58,13 +62,18 @@ public class ConfigurationController {
.create(); //
@PutMapping(path = Consts.V2_API_ROOT + "/configuration", consumes = MediaType.APPLICATION_JSON_VALUE)
- @ApiOperation(value = "Replace the current configuration file with the given configuration", //
- notes = "Note that the file is ignored if the Consul is used.")
+ @Operation(summary = "Replace the current configuration file with the given configuration", //
+ description = "Note that the file is ignored if the Consul is used.")
@ApiResponses(value = { //
- @ApiResponse(code = 200, message = "Configuration updated", response = VoidResponse.class), //
- @ApiResponse(code = 400, message = "Invalid configuration provided", response = ErrorInfo.class), //
- @ApiResponse(code = 500, message = "Something went wrong when replacing the configuration. Try again.",
- response = ErrorResponse.ErrorInfo.class) //
+ @ApiResponse(responseCode = "200", //
+ description = "Configuration updated", //
+ content = @Content(schema = @Schema(implementation = VoidResponse.class))), //
+ @ApiResponse(responseCode = "400", //
+ description = "Invalid configuration provided", //
+ content = @Content(schema = @Schema(implementation = ErrorResponse.ErrorInfo.class))), //
+ @ApiResponse(responseCode = "500", //
+ description = "Something went wrong when replacing the configuration. Try again.", //
+ content = @Content(schema = @Schema(implementation = ErrorResponse.ErrorInfo.class))) //
})
public ResponseEntity<Object> putConfiguration(@RequestBody Object configuration) {
try {
@@ -86,13 +95,17 @@ public class ConfigurationController {
}
@GetMapping(path = Consts.V2_API_ROOT + "/configuration", produces = MediaType.APPLICATION_JSON_VALUE)
- @ApiOperation(value = "Returns the contents of the configuration file", //
- notes = "Note that the file contents is not relevant if the Consul is used.") //
+ @Operation(summary = "Returns the contents of the configuration file", //
+ description = "Note that the file contents is not relevant if the Consul is used.") //
@ApiResponses(value = { //
- @ApiResponse(code = 200, message = "Configuration", response = Object.class), //
- @ApiResponse(code = 404, message = "File is not found or readable",
- response = ErrorResponse.ErrorInfo.class)} //
- )
+ @ApiResponse(responseCode = "200", //
+ description = "Configuration", //
+ content = @Content(schema = @Schema(implementation = Object.class))), //
+ @ApiResponse(responseCode = "404", //
+ description = "File is not found or readable", //
+ content = @Content(schema = @Schema(implementation = ErrorResponse.ErrorInfo.class)))
+
+ })
public ResponseEntity<Object> getConfiguration() {
try {
Optional<JsonObject> rootObject = configurationFile.readFile();
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/Consts.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/Consts.java
index d365ad9a..c3eff84a 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/Consts.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/Consts.java
@@ -29,8 +29,9 @@ public class Consts {
public static final String MANAGED_ELEMENT_ID_PARAM = "managed_element_id";
public static final String V2_API_ROOT = "a1-policy/v2";
- public static final String V2_API_NAME = "A1 Policy Management Version 2.0";
- public static final String V2_CONFIG_API_NAME = "Component Configuration";
+
+ public static final String V2_API_SERVICE_CALLBACKS_NAME = "Callbacks";
+ public static final String V2_API_SERVICE_CALLBACKS_DESCRIPTION = "";
private Consts() {}
}
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ErrorResponse.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ErrorResponse.java
index da321655..c3ee1952 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ErrorResponse.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ErrorResponse.java
@@ -24,8 +24,7 @@ import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.annotations.SerializedName;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
@@ -38,7 +37,7 @@ public class ErrorResponse {
.create(); //
// Returned as body for all failed REST calls
- @ApiModel(value = "error_information", description = "Problem as defined in https://tools.ietf.org/html/rfc7807")
+ @Schema(name = "error_information", description = "Problem as defined in https://tools.ietf.org/html/rfc7807")
public static class ErrorInfo {
@SerializedName("type")
private String type = "about:blank";
@@ -60,21 +59,21 @@ public class ErrorResponse {
this.status = status;
}
- @ApiModelProperty(example = "503",
- value = "The HTTP status code generated by the origin server for this occurrence of the problem. ")
+ @Schema(example = "503",
+ description = "The HTTP status code generated by the origin server for this occurrence of the problem. ")
public Integer getStatus() {
return status;
}
- @ApiModelProperty(example = "Policy type not found",
- value = " A human-readable explanation specific to this occurrence of the problem.")
+ @Schema(example = "Policy type not found",
+ description = " A human-readable explanation specific to this occurrence of the problem.")
public String getDetail() {
return this.detail;
}
}
- @ApiModelProperty(value = "message")
+ @Schema(name = "message", description = "message")
public final String message;
ErrorResponse(String message) {
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyController.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyController.java
index 850635f6..1f0e1603 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyController.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyController.java
@@ -23,11 +23,13 @@ package org.onap.ccsdk.oran.a1policymanagementservice.controllers.v2;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-import io.swagger.annotations.ApiResponse;
-import io.swagger.annotations.ApiResponses;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
+import io.swagger.v3.oas.annotations.responses.ApiResponses;
+import io.swagger.v3.oas.annotations.tags.Tag;
import java.lang.invoke.MethodHandles;
import java.time.Instant;
@@ -67,9 +69,12 @@ import org.springframework.web.reactive.function.client.WebClientResponseExcepti
import reactor.core.publisher.Mono;
@RestController("PolicyControllerV2")
-@Api(tags = {Consts.V2_API_NAME})
+@Tag(name = PolicyController.API_NAME)
public class PolicyController {
+ public static final String API_NAME = "A1 Policy Management";
+ public static final String API_DESCRIPTION = "";
+
public static class RejectionException extends Exception {
private static final long serialVersionUID = 1L;
@@ -97,12 +102,16 @@ public class PolicyController {
private static Gson gson = new GsonBuilder() //
.create(); //
- @GetMapping(path = Consts.V2_API_ROOT + "/policy-types/{policytype_id:.+}",
- produces = MediaType.APPLICATION_JSON_VALUE)
- @ApiOperation(value = "Returns a policy type definition")
+ @GetMapping(path = Consts.V2_API_ROOT + "/policy-types/{policytype_id:.+}") //
+ @Operation(summary = "Returns a policy type definition") //
@ApiResponses(value = { //
- @ApiResponse(code = 200, message = "Policy type", response = PolicyTypeInfo.class), //
- @ApiResponse(code = 404, message = "Policy type is not found", response = ErrorResponse.ErrorInfo.class)})
+ @ApiResponse(responseCode = "200", //
+ description = "Policy type", //
+ content = @Content(schema = @Schema(implementation = PolicyTypeInfo.class))), //
+ @ApiResponse(responseCode = "404", //
+ description = "Policy type is not found", //
+ content = @Content(schema = @Schema(implementation = ErrorResponse.ErrorInfo.class)))//
+ })
public ResponseEntity<Object> getPolicyType( //
@PathVariable("policytype_id") String policyTypeId) throws EntityNotFoundException {
PolicyType type = policyTypes.getType(policyTypeId);
@@ -111,12 +120,18 @@ public class PolicyController {
}
@GetMapping(path = Consts.V2_API_ROOT + "/policy-types", produces = MediaType.APPLICATION_JSON_VALUE)
- @ApiOperation(value = "Query policy type identities", produces = MediaType.APPLICATION_JSON_VALUE)
- @ApiResponses(value = {@ApiResponse(code = 200, message = "Policy type IDs", response = PolicyTypeIdList.class),
- @ApiResponse(code = 404, message = "Near-RT RIC is not found", response = ErrorResponse.ErrorInfo.class)})
+ @Operation(summary = "Query policy type identities")
+ @ApiResponses(value = { //
+ @ApiResponse(responseCode = "200", //
+ description = "Policy type IDs", //
+ content = @Content(schema = @Schema(implementation = PolicyTypeIdList.class))), //
+ @ApiResponse(responseCode = "404", //
+ description = "Near-RT RIC is not found", //
+ content = @Content(schema = @Schema(implementation = ErrorResponse.ErrorInfo.class))) //
+ })
public ResponseEntity<Object> getPolicyTypes( //
- @ApiParam(name = Consts.RIC_ID_PARAM, required = false,
- value = "The identity of the Near-RT RIC to get types for.") //
+ @Parameter(name = Consts.RIC_ID_PARAM, required = false,
+ description = "The identity of the Near-RT RIC to get types for.") //
@RequestParam(name = Consts.RIC_ID_PARAM, required = false) String ricId) throws EntityNotFoundException {
if (ricId == null) {
Collection<PolicyType> types = this.policyTypes.getAll();
@@ -128,11 +143,15 @@ public class PolicyController {
}
@GetMapping(path = Consts.V2_API_ROOT + "/policies/{policy_id:.+}", produces = MediaType.APPLICATION_JSON_VALUE)
- @ApiOperation(value = "Returns a policy") //
+ @Operation(summary = "Returns a policy") //
@ApiResponses(value = { //
- @ApiResponse(code = 200, message = "Policy found", response = PolicyInfo.class), //
- @ApiResponse(code = 404, message = "Policy is not found", response = ErrorResponse.ErrorInfo.class)} //
- )
+ @ApiResponse(responseCode = "200", //
+ description = "Policy found", //
+ content = @Content(schema = @Schema(implementation = PolicyInfo.class))), //
+ @ApiResponse(responseCode = "404", //
+ description = "Policy is not found", //
+ content = @Content(schema = @Schema(implementation = ErrorResponse.ErrorInfo.class))) //
+ })
public ResponseEntity<Object> getPolicy( //
@PathVariable(name = Consts.POLICY_ID_PARAM, required = true) String id) throws EntityNotFoundException {
Policy p = policies.getPolicy(id);
@@ -140,18 +159,27 @@ public class PolicyController {
}
@DeleteMapping(Consts.V2_API_ROOT + "/policies/{policy_id:.+}")
- @ApiOperation(value = "Delete a policy")
+ @Operation(summary = "Delete a policy")
@ApiResponses(value = { //
- @ApiResponse(code = 200, message = "Not used", response = VoidResponse.class),
- @ApiResponse(code = 204, message = "Policy deleted", response = VoidResponse.class),
- @ApiResponse(code = 404, message = "Policy is not found", response = ErrorResponse.ErrorInfo.class),
- @ApiResponse(code = 423, message = "Near-RT RIC is not operational",
- response = ErrorResponse.ErrorInfo.class)})
+ @ApiResponse(responseCode = "200", //
+ description = "Not used", //
+ content = @Content(schema = @Schema(implementation = VoidResponse.class))), //
+ @ApiResponse(responseCode = "204", //
+ description = "Policy deleted", //
+ content = @Content(schema = @Schema(implementation = VoidResponse.class))), //
+ @ApiResponse(responseCode = "404", //
+ description = "Policy is not found", //
+ content = @Content(schema = @Schema(implementation = ErrorResponse.ErrorInfo.class))), //
+ @ApiResponse(responseCode = "423", //
+ description = "Near-RT RIC is not operational", //
+ content = @Content(schema = @Schema(implementation = ErrorResponse.ErrorInfo.class))) //
+ })
public Mono<ResponseEntity<Object>> deletePolicy( //
@PathVariable(Consts.POLICY_ID_PARAM) String policyId) throws EntityNotFoundException {
Policy policy = policies.getPolicy(policyId);
keepServiceAlive(policy.ownerServiceId());
Ric ric = policy.ric();
+
return ric.getLock().lock(LockType.SHARED) //
.flatMap(notUsed -> assertRicStateIdle(ric)) //
.flatMap(notUsed -> a1ClientFactory.createA1Client(policy.ric())) //
@@ -164,14 +192,20 @@ public class PolicyController {
}
@PutMapping(path = Consts.V2_API_ROOT + "/policies", produces = MediaType.APPLICATION_JSON_VALUE)
- @ApiOperation(value = "Create or update a policy")
+ @Operation(summary = "Create or update a policy")
@ApiResponses(value = { //
- @ApiResponse(code = 201, message = "Policy created", response = VoidResponse.class), //
- @ApiResponse(code = 200, message = "Policy updated", response = VoidResponse.class), //
- @ApiResponse(code = 423, message = "Near-RT RIC is not operational",
- response = ErrorResponse.ErrorInfo.class), //
- @ApiResponse(code = 404, message = "Near-RT RIC or policy type is not found",
- response = ErrorResponse.ErrorInfo.class) //
+ @ApiResponse(responseCode = "201", //
+ description = "Policy created", //
+ content = @Content(schema = @Schema(implementation = VoidResponse.class))), //
+ @ApiResponse(responseCode = "200", //
+ description = "Policy updated", //
+ content = @Content(schema = @Schema(implementation = VoidResponse.class))), //
+ @ApiResponse(responseCode = "423", //
+ description = "Near-RT RIC is not operational", //
+ content = @Content(schema = @Schema(implementation = ErrorResponse.ErrorInfo.class))), //
+ @ApiResponse(responseCode = "404", //
+ description = "Near-RT RIC or policy type is not found", //
+ content = @Content(schema = @Schema(implementation = ErrorResponse.ErrorInfo.class))) //
})
public Mono<ResponseEntity<Object>> putPolicy(@RequestBody PolicyInfo policyInfo) throws EntityNotFoundException {
@@ -263,20 +297,24 @@ public class PolicyController {
+ "If several query parameters are defined, the policies matching all conditions are returned.";
@GetMapping(path = Consts.V2_API_ROOT + "/policy-instances", produces = MediaType.APPLICATION_JSON_VALUE)
- @ApiOperation(value = "Query for A1 policy instances", notes = GET_POLICIES_QUERY_DETAILS)
+ @Operation(summary = "Query for A1 policy instances", description = GET_POLICIES_QUERY_DETAILS)
@ApiResponses(value = { //
- @ApiResponse(code = 200, message = "Policies", response = PolicyInfoList.class),
- @ApiResponse(code = 404, message = "Near-RT RIC, policy type or service not found",
- response = ErrorResponse.ErrorInfo.class)})
+ @ApiResponse(responseCode = "200", //
+ description = "Policies", //
+ content = @Content(schema = @Schema(implementation = PolicyInfoList.class))), //
+ @ApiResponse(responseCode = "404", //
+ description = "Near-RT RIC, policy type or service not found", //
+ content = @Content(schema = @Schema(implementation = ErrorResponse.ErrorInfo.class))) //
+ })
public ResponseEntity<Object> getPolicyInstances( //
- @ApiParam(name = Consts.POLICY_TYPE_ID_PARAM, required = false,
- value = "The identity of the policy type to get policies for.") //
+ @Parameter(name = Consts.POLICY_TYPE_ID_PARAM, required = false,
+ description = "The identity of the policy type to get policies for.") //
@RequestParam(name = Consts.POLICY_TYPE_ID_PARAM, required = false) String type, //
- @ApiParam(name = Consts.RIC_ID_PARAM, required = false,
- value = "The identity of the Near-RT RIC to get policies for.") //
+ @Parameter(name = Consts.RIC_ID_PARAM, required = false,
+ description = "The identity of the Near-RT RIC to get policies for.") //
@RequestParam(name = Consts.RIC_ID_PARAM, required = false) String ric, //
- @ApiParam(name = Consts.SERVICE_ID_PARAM, required = false,
- value = "The identity of the service to get policies for.") //
+ @Parameter(name = Consts.SERVICE_ID_PARAM, required = false,
+ description = "The identity of the service to get policies for.") //
@RequestParam(name = Consts.SERVICE_ID_PARAM, required = false) String service)
throws EntityNotFoundException //
{
@@ -291,20 +329,25 @@ public class PolicyController {
return new ResponseEntity<>(filteredPolicies, HttpStatus.OK);
}
- @GetMapping(path = Consts.V2_API_ROOT + "/policies", produces = MediaType.APPLICATION_JSON_VALUE)
- @ApiOperation(value = "Query policy identities", notes = GET_POLICIES_QUERY_DETAILS)
+ @GetMapping(path = Consts.V2_API_ROOT + "/policies", produces = MediaType.APPLICATION_JSON_VALUE) //
+ @Operation(summary = "Query policy identities", description = GET_POLICIES_QUERY_DETAILS) //
@ApiResponses(value = { //
- @ApiResponse(code = 200, message = "Policy identities", response = PolicyIdList.class), @ApiResponse(
- code = 404, message = "Near-RT RIC or type not found", response = ErrorResponse.ErrorInfo.class)})
+ @ApiResponse(responseCode = "200", //
+ description = "Policy identities", //
+ content = @Content(schema = @Schema(implementation = PolicyIdList.class))), //
+ @ApiResponse(responseCode = "404", //
+ description = "Near-RT RIC or type not found", //
+ content = @Content(schema = @Schema(implementation = ErrorResponse.ErrorInfo.class))) //
+ })
public ResponseEntity<Object> getPolicyIds( //
- @ApiParam(name = Consts.POLICY_TYPE_ID_PARAM, required = false,
- value = "The identity of the policy type to get policies for.") //
+ @Parameter(name = Consts.POLICY_TYPE_ID_PARAM, required = false,
+ description = "The identity of the policy type to get policies for.") //
@RequestParam(name = Consts.POLICY_TYPE_ID_PARAM, required = false) String policyTypeId, //
- @ApiParam(name = Consts.RIC_ID_PARAM, required = false,
- value = "The identity of the Near-RT RIC to get policies for.") //
+ @Parameter(name = Consts.RIC_ID_PARAM, required = false,
+ description = "The identity of the Near-RT RIC to get policies for.") //
@RequestParam(name = Consts.RIC_ID_PARAM, required = false) String ricId, //
- @ApiParam(name = Consts.SERVICE_ID_PARAM, required = false,
- value = "The identity of the service to get policies for.") //
+ @Parameter(name = Consts.SERVICE_ID_PARAM, required = false,
+ description = "The identity of the service to get policies for.") //
@RequestParam(name = Consts.SERVICE_ID_PARAM, required = false) String serviceId)
throws EntityNotFoundException //
{
@@ -320,11 +363,15 @@ public class PolicyController {
}
@GetMapping(path = Consts.V2_API_ROOT + "/policies/{policy_id}/status", produces = MediaType.APPLICATION_JSON_VALUE)
- @ApiOperation(value = "Returns a policy status") //
+ @Operation(summary = "Returns a policy status") //
@ApiResponses(value = { //
- @ApiResponse(code = 200, message = "Policy status", response = PolicyStatusInfo.class), //
- @ApiResponse(code = 404, message = "Policy is not found", response = ErrorResponse.ErrorInfo.class)} //
- )
+ @ApiResponse(responseCode = "200", //
+ description = "Policy status", //
+ content = @Content(schema = @Schema(implementation = PolicyStatusInfo.class))), //
+ @ApiResponse(responseCode = "404", //
+ description = "Policy is not found", //
+ content = @Content(schema = @Schema(implementation = ErrorResponse.ErrorInfo.class))) //
+ })
public Mono<ResponseEntity<Object>> getPolicyStatus( //
@PathVariable(Consts.POLICY_ID_PARAM) String policyId) throws EntityNotFoundException {
Policy policy = policies.getPolicy(policyId);
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyIdList.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyIdList.java
index 329ce5f0..cc9b83aa 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyIdList.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyIdList.java
@@ -23,18 +23,17 @@ package org.onap.ccsdk.oran.a1policymanagementservice.controllers.v2;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.gson.annotations.SerializedName;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
import java.util.Collection;
import org.immutables.gson.Gson;
@Gson.TypeAdapters
-@ApiModel(value = "policy_id_list_v2", description = "A list of policy identities")
+@Schema(name = "policy_id_list_v2", description = "A list of policy identities")
public class PolicyIdList {
- @ApiModelProperty(value = "Policy identities")
+ @Schema(description = "Policy identities")
@SerializedName("policy_ids")
@JsonProperty("policy_ids")
public final Collection<String> policyIds;
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyInfo.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyInfo.java
index 43684a33..d8b98105 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyInfo.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyInfo.java
@@ -23,48 +23,47 @@ package org.onap.ccsdk.oran.a1policymanagementservice.controllers.v2;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.gson.annotations.SerializedName;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
import org.immutables.gson.Gson;
@Gson.TypeAdapters
-@ApiModel(value = "policy_info_v2", description = "Information for one A1-P Policy")
+@Schema(name = "policy_info_v2", description = "Information for one A1-P Policy")
public class PolicyInfo {
- @ApiModelProperty(value = "identity of the policy", required = true)
+ @Schema(name = "policy_id", description = "identity of the policy", required = true)
@JsonProperty(value = "policy_id", required = true)
@SerializedName("policy_id")
public String policyId;
- @ApiModelProperty(value = "identity of the policy type", required = true)
+ @Schema(name = "policytype_id", description = "identity of the policy type", required = true)
@JsonProperty(value = "policytype_id", required = true)
@SerializedName("policytype_id")
public String policyTypeId;
- @ApiModelProperty(value = "identity of the target Near-RT RIC", required = true)
+ @Schema(name = "ric_id", description = "identity of the target Near-RT RIC", required = true)
@JsonProperty(value = "ric_id", required = true)
@SerializedName("ric_id")
public String ricId;
- @ApiModelProperty(value = "the configuration of the policy", required = true)
+ @Schema(name = "policy_data", description = "the configuration of the policy", required = true)
@JsonProperty(value = "policy_data", required = true)
@SerializedName("policy_data")
public Object policyData;
- @ApiModelProperty(value = "the name of the service owning the policy", required = true)
+ @Schema(name = "service_id", description = "the name of the service owning the policy", required = true)
@JsonProperty(value = "service_id", required = true)
@SerializedName("service_id")
public String serviceId;
- @ApiModelProperty(
- value = "if true, the policy is deleted at RIC restart. If false, its value is maintained by this service until explicitly deleted. Default false.",
+ @Schema(name = "transient",
+ description = "if true, the policy is deleted at RIC restart. If false, its value is maintained by this service until explicitly deleted. Default false.",
required = false)
@JsonProperty(value = "transient", required = false, defaultValue = "false")
@SerializedName("transient")
public boolean isTransient = false;
- @ApiModelProperty(value = "Callback URI for policy status updates", required = false)
+ @Schema(name = "status_notification_uri", description = "Callback URI for policy status updates", required = false)
@JsonProperty(value = "status_notification_uri", required = false)
@SerializedName("status_notification_uri")
public String statusNotificationUri = "";
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyInfoList.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyInfoList.java
index dde00a52..08923fd9 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyInfoList.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyInfoList.java
@@ -23,18 +23,17 @@ package org.onap.ccsdk.oran.a1policymanagementservice.controllers.v2;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.gson.annotations.SerializedName;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
import java.util.Collection;
import org.immutables.gson.Gson;
@Gson.TypeAdapters
-@ApiModel(value = "policy_info_list_v2", description = "List of policy information")
+@Schema(name = "policy_info_list_v2", description = "List of policy information")
public class PolicyInfoList {
- @ApiModelProperty(value = "List of policy information")
+ @Schema(description = "List of policy information")
@SerializedName("policies")
@JsonProperty("policies")
public final Collection<PolicyInfo> policies;
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyStatusInfo.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyStatusInfo.java
index 6292f049..bc95e54f 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyStatusInfo.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyStatusInfo.java
@@ -23,23 +23,22 @@ package org.onap.ccsdk.oran.a1policymanagementservice.controllers.v2;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.gson.annotations.SerializedName;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
import java.time.Instant;
import org.immutables.gson.Gson;
@Gson.TypeAdapters
-@ApiModel(value = "policy_status_info_v2", description = "Status for one A1-P Policy")
+@Schema(name = "policy_status_info_v2", description = "Status for one A1-P Policy")
public class PolicyStatusInfo {
- @ApiModelProperty(value = "timestamp, last modification time")
+ @Schema(description = "timestamp, last modification time")
@SerializedName("last_modified")
@JsonProperty("last_modified")
public String lastModified;
- @ApiModelProperty(value = "the Policy status")
+ @Schema(description = "the Policy status")
@SerializedName("status")
@JsonProperty("status")
public Object status;
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyTypeIdList.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyTypeIdList.java
index ede69d5d..deedf2f7 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyTypeIdList.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyTypeIdList.java
@@ -23,18 +23,17 @@ package org.onap.ccsdk.oran.a1policymanagementservice.controllers.v2;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.gson.annotations.SerializedName;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
import java.util.Collection;
import org.immutables.gson.Gson;
@Gson.TypeAdapters
-@ApiModel(value = "policytype_id_list_v2", description = "Information about policy types")
+@Schema(name = "policytype_id_list_v2", description = "Information about policy types")
public class PolicyTypeIdList {
- @ApiModelProperty(value = "Policy type identities")
+ @Schema(description = "Policy type identities")
@SerializedName("policytype_ids")
@JsonProperty("policytype_ids")
public final Collection<String> policyTypesIds;
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyTypeInfo.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyTypeInfo.java
index b97730e6..7449e94d 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyTypeInfo.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyTypeInfo.java
@@ -25,17 +25,15 @@ import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.google.gson.annotations.SerializedName;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
import org.immutables.gson.Gson;
@Gson.TypeAdapters
-@ApiModel(value = "policytype_v2", description = "Policy type")
+@Schema(name = "policytype_v2", description = "Policy type")
public class PolicyTypeInfo {
- @ApiModelProperty(
- value = "Policy type json scema. The schema is a json object following http://json-schema.org/draft-07/schema")
+ @Schema(description = "Policy type json scema. The schema is a json object following http://json-schema.org/draft-07/schema")
@SerializedName("policy_schema")
@JsonProperty("policy_schema")
public final Object schema;
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/RicInfo.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/RicInfo.java
index 85983080..38797cae 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/RicInfo.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/RicInfo.java
@@ -23,19 +23,18 @@ package org.onap.ccsdk.oran.a1policymanagementservice.controllers.v2;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.gson.annotations.SerializedName;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
import java.util.Collection;
import org.immutables.gson.Gson;
@Gson.TypeAdapters
-@ApiModel(value = "ric_info_v2", description = "Information for a Near-RT RIC")
+@Schema(name = "ric_info_v2", description = "Information for a Near-RT RIC")
public class RicInfo {
@Gson.TypeAdapters
- @ApiModel(value = "ric_state_v2", description = "Represents the states for a Near-RT RIC")
+ @Schema(name = "ric_state_v2", description = "Represents the states for a Near-RT RIC")
public enum RicState {
UNAVAILABLE, AVAILABLE, SYNCHRONIZING, CONSISTENCY_CHECK
}
@@ -46,22 +45,22 @@ public class RicInfo {
+ "SYNCHRONIZING: The Policy Management Service is synchronizing the view of the Near-RT RIC. Policies cannot be configured. \n"
+ "CONSISTENCY_CHECK: A consistency check between the Policy Management Service and the Near-RT RIC. Policies cannot be configured.";
- @ApiModelProperty(value = "identity of the Near-RT RIC")
+ @Schema(description = "identity of the Near-RT RIC")
@SerializedName("ric_id")
@JsonProperty("ric_id")
public final String ricId;
- @ApiModelProperty(value = "O1 identities for managed entities")
+ @Schema(description = "O1 identities for managed entities")
@SerializedName("managed_element_ids")
@JsonProperty("managed_element_ids")
public final Collection<String> managedElementIds;
- @ApiModelProperty(value = "supported policy types")
+ @Schema(description = "supported policy types")
@SerializedName("policytype_ids")
@JsonProperty("policytype_ids")
public final Collection<String> policyTypeIds;
- @ApiModelProperty(value = STATE_DESCRIPTION, name = "state")
+ @Schema(description = STATE_DESCRIPTION, name = "state")
@SerializedName("state")
@JsonProperty("state")
public final RicState state;
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/RicInfoList.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/RicInfoList.java
index 7932dc54..05b9569e 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/RicInfoList.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/RicInfoList.java
@@ -23,18 +23,17 @@ package org.onap.ccsdk.oran.a1policymanagementservice.controllers.v2;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.gson.annotations.SerializedName;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
import java.util.Collection;
import org.immutables.gson.Gson;
@Gson.TypeAdapters
-@ApiModel(value = "ric_info_list_v2", description = "List of Near-RT RIC information")
+@Schema(name = "ric_info_list_v2", description = "List of Near-RT RIC information")
public class RicInfoList {
- @ApiModelProperty(value = "List of Near-RT RIC information")
+ @Schema(description = "List of Near-RT RIC information")
@SerializedName("rics")
@JsonProperty("rics")
public final Collection<RicInfo> rics;
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/RicRepositoryController.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/RicRepositoryController.java
index f07efa2c..214f62d1 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/RicRepositoryController.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/RicRepositoryController.java
@@ -23,11 +23,13 @@ package org.onap.ccsdk.oran.a1policymanagementservice.controllers.v2;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-import io.swagger.annotations.ApiResponse;
-import io.swagger.annotations.ApiResponses;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
+import io.swagger.v3.oas.annotations.responses.ApiResponses;
+import io.swagger.v3.oas.annotations.tags.Tag;
import java.util.ArrayList;
import java.util.List;
@@ -46,9 +48,12 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController("RicRepositoryControllerV2")
-@Api(tags = {Consts.V2_API_NAME})
+@Tag(name = RicRepositoryController.API_NAME)
public class RicRepositoryController {
+ public static final String API_NAME = "NearRT-RIC Repository";
+ public static final String API_DESCRIPTION = "";
+
@Autowired
private Rics rics;
@@ -69,17 +74,21 @@ public class RicRepositoryController {
* @throws EntityNotFoundException
*/
@GetMapping(path = Consts.V2_API_ROOT + "/rics/ric", produces = MediaType.APPLICATION_JSON_VALUE)
- @ApiOperation(value = GET_RIC_BRIEF, notes = GET_RIC_DETAILS)
+ @Operation(summary = GET_RIC_BRIEF, description = GET_RIC_DETAILS)
@ApiResponses(value = { //
- @ApiResponse(code = 200, message = "Near-RT RIC is found", response = RicInfo.class), //
- @ApiResponse(code = 404, message = "Near-RT RIC is not found", response = ErrorResponse.ErrorInfo.class) //
+ @ApiResponse(responseCode = "200", //
+ description = "Near-RT RIC is found", //
+ content = @Content(schema = @Schema(implementation = RicInfo.class))), //
+ @ApiResponse(responseCode = "404", //
+ description = "Near-RT RIC is not found", //
+ content = @Content(schema = @Schema(implementation = ErrorResponse.ErrorInfo.class))) //
})
public ResponseEntity<Object> getRic( //
- @ApiParam(name = Consts.MANAGED_ELEMENT_ID_PARAM, required = false,
- value = "The identity of a Managed Element. If given, the Near-RT RIC managing the ME is returned.") //
+ @Parameter(name = Consts.MANAGED_ELEMENT_ID_PARAM, required = false,
+ description = "The identity of a Managed Element. If given, the Near-RT RIC managing the ME is returned.") //
@RequestParam(name = Consts.MANAGED_ELEMENT_ID_PARAM, required = false) String managedElementId,
- @ApiParam(name = Consts.RIC_ID_PARAM, required = false,
- value = "The identity of a Near-RT RIC to get information for.") //
+ @Parameter(name = Consts.RIC_ID_PARAM, required = false,
+ description = "The identity of a Near-RT RIC to get information for.") //
@RequestParam(name = Consts.RIC_ID_PARAM, required = false) String ricId)
throws EntityNotFoundException, InvalidRequestException {
if (managedElementId != null && ricId != null) {
@@ -103,13 +112,18 @@ public class RicRepositoryController {
* @throws EntityNotFoundException
*/
@GetMapping(path = Consts.V2_API_ROOT + "/rics", produces = MediaType.APPLICATION_JSON_VALUE)
- @ApiOperation(value = "Query Near-RT RIC information", notes = QUERY_RIC_INFO_DETAILS)
+ @Operation(summary = "Query Near-RT RIC information", description = QUERY_RIC_INFO_DETAILS)
@ApiResponses(value = { //
- @ApiResponse(code = 200, message = "OK", response = RicInfoList.class), //
- @ApiResponse(code = 404, message = "Policy type is not found", response = ErrorResponse.ErrorInfo.class)})
+ @ApiResponse(responseCode = "200", //
+ description = "OK", //
+ content = @Content(schema = @Schema(implementation = RicInfoList.class))), //
+ @ApiResponse(responseCode = "404", //
+ description = "Policy type is not found", //
+ content = @Content(schema = @Schema(implementation = ErrorResponse.ErrorInfo.class))) //
+ })
public ResponseEntity<Object> getRics( //
- @ApiParam(name = Consts.POLICY_TYPE_ID_PARAM, required = false,
- value = "The identity of a policy type. If given, all Near-RT RICs supporteing the policy type are returned") //
+ @Parameter(name = Consts.POLICY_TYPE_ID_PARAM, required = false,
+ description = "The identity of a policy type. If given, all Near-RT RICs supporteing the policy type are returned") //
@RequestParam(name = Consts.POLICY_TYPE_ID_PARAM, required = false) String supportingPolicyType)
throws EntityNotFoundException {
if ((supportingPolicyType != null) && (this.types.get(supportingPolicyType) == null)) {
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ServiceController.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ServiceController.java
index a8fc7e6d..d3ff999a 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ServiceController.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ServiceController.java
@@ -23,11 +23,13 @@ package org.onap.ccsdk.oran.a1policymanagementservice.controllers.v2;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-import io.swagger.annotations.ApiResponse;
-import io.swagger.annotations.ApiResponses;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
+import io.swagger.v3.oas.annotations.responses.ApiResponses;
+import io.swagger.v3.oas.annotations.tags.Tag;
import java.net.MalformedURLException;
import java.net.URL;
@@ -54,9 +56,12 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController("ServiceControllerV2")
-@Api(tags = Consts.V2_API_NAME)
+@Tag(name = ServiceController.API_NAME)
public class ServiceController {
+ public static final String API_NAME = "Service Registry and Supervision";
+ public static final String API_DESCRIPTION = "";
+
private final Services services;
private final Policies policies;
@@ -71,13 +76,18 @@ public class ServiceController {
private static final String GET_SERVICE_DETAILS =
"Either information about a registered service with given identity or all registered services are returned.";
- @GetMapping(path = Consts.V2_API_ROOT + "/services", produces = MediaType.APPLICATION_JSON_VALUE)
- @ApiOperation(value = "Returns service information", notes = GET_SERVICE_DETAILS)
+ @GetMapping(path = Consts.V2_API_ROOT + "/services", produces = MediaType.APPLICATION_JSON_VALUE) //
+ @Operation(summary = "Returns service information", description = GET_SERVICE_DETAILS) //
@ApiResponses(value = { //
- @ApiResponse(code = 200, message = "OK", response = ServiceStatusList.class), //
- @ApiResponse(code = 404, message = "Service is not found", response = ErrorResponse.ErrorInfo.class)})
+ @ApiResponse(responseCode = "200", //
+ description = "OK", //
+ content = @Content(schema = @Schema(implementation = ServiceStatusList.class))), //
+ @ApiResponse(responseCode = "404", //
+ description = "Service is not found", //
+ content = @Content(schema = @Schema(implementation = ErrorResponse.ErrorInfo.class)))//
+ })
public ResponseEntity<Object> getServices(//
- @ApiParam(name = Consts.SERVICE_ID_PARAM, required = false, value = "The identity of the service") //
+ @Parameter(name = Consts.SERVICE_ID_PARAM, required = false, description = "The identity of the service") //
@RequestParam(name = Consts.SERVICE_ID_PARAM, required = false) String name) {
if (name != null && this.services.get(name) == null) {
return ErrorResponse.create("Service not found", HttpStatus.NOT_FOUND);
@@ -119,13 +129,15 @@ public class ServiceController {
+ "</ul>" //
;
- @ApiOperation(value = "Register a service", notes = REGISTER_SERVICE_DETAILS)
- @ApiResponses(value = { //
- @ApiResponse(code = 200, message = "Service updated"),
- @ApiResponse(code = 201, message = "Service created"), //
- @ApiResponse(code = 400, message = "The ServiceRegistrationInfo is not accepted",
- response = ErrorResponse.ErrorInfo.class)})
@PutMapping(Consts.V2_API_ROOT + "/services")
+ @Operation(summary = "Register a service", description = REGISTER_SERVICE_DETAILS)
+ @ApiResponses(value = { //
+ @ApiResponse(responseCode = "200", description = "Service updated"),
+ @ApiResponse(responseCode = "201", description = "Service created"), //
+ @ApiResponse(responseCode = "400", //
+ description = "The ServiceRegistrationInfo is not accepted", //
+ content = @Content(schema = @Schema(implementation = ErrorResponse.ErrorInfo.class)))})
+
public ResponseEntity<Object> putService(//
@RequestBody ServiceRegistrationInfo registrationInfo) {
try {
@@ -138,11 +150,16 @@ public class ServiceController {
}
}
- @ApiOperation(value = "Unregister a service")
+ @Operation(summary = "Unregister a service")
@ApiResponses(value = { //
- @ApiResponse(code = 204, message = "Service unregistered"),
- @ApiResponse(code = 200, message = "Not used", response = VoidResponse.class),
- @ApiResponse(code = 404, message = "Service not found", response = ErrorResponse.ErrorInfo.class)})
+ @ApiResponse(responseCode = "204", description = "Service unregistered"),
+ @ApiResponse(responseCode = "200", description = "Not used",
+ content = @Content(schema = @Schema(implementation = VoidResponse.class))),
+ @ApiResponse(responseCode = "404", description = "Service not found",
+ content = @Content(schema = @Schema(implementation = ErrorResponse.ErrorInfo.class)))
+
+ })
+
@DeleteMapping(Consts.V2_API_ROOT + "/services/{service_id:.+}")
public ResponseEntity<Object> deleteService(//
@PathVariable("service_id") String serviceId) {
@@ -157,11 +174,14 @@ public class ServiceController {
}
}
- @ApiOperation(value = "Heartbeat indicates that the service is running")
+ @Operation(summary = "Heartbeat indicates that the service is running",
+ description = "A registerred service must call this in regular intervals to indicate that it is in operation. Absence of this call will lead to that teh service will be deregisterred and all its policies are removed.")
@ApiResponses(value = { //
- @ApiResponse(code = 200, message = "Service supervision timer refreshed, OK"), //
- @ApiResponse(code = 404, message = "The service is not found, needs re-registration",
- response = ErrorResponse.ErrorInfo.class)})
+ @ApiResponse(responseCode = "200", description = "Service supervision timer refreshed, OK"), //
+ @ApiResponse(responseCode = "404", description = "The service is not found, needs re-registration",
+ content = @Content(schema = @Schema(implementation = ErrorResponse.ErrorInfo.class)))
+
+ })
@PutMapping(Consts.V2_API_ROOT + "/services/{service_id}/keepalive")
public ResponseEntity<Object> keepAliveService(//
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ServiceRegistrationInfo.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ServiceRegistrationInfo.java
index 88711164..16f1f163 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ServiceRegistrationInfo.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ServiceRegistrationInfo.java
@@ -23,22 +23,21 @@ package org.onap.ccsdk.oran.a1policymanagementservice.controllers.v2;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.gson.annotations.SerializedName;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
import org.immutables.gson.Gson;
@Gson.TypeAdapters
-@ApiModel(value = "service_registration_info_v2", description = "Information for one service")
+@Schema(name = "service_registration_info_v2", description = "Information for one service")
public class ServiceRegistrationInfo {
- @ApiModelProperty(value = "identity of the service", required = true, allowEmptyValue = false)
- @SerializedName(value = "service_id")
+ @Schema(description = "identity of the service", required = true)
+ @SerializedName("service_id")
@JsonProperty("service_id")
public String serviceId = "";
- @ApiModelProperty(value = "keep alive interval for the service. This is a heartbeat supervision of the service, "
- + "which in regular intevals must invoke a 'keepAlive' REST call. "
+ @Schema(description = "keep alive interval for the service. This is a heartbeat supervision of the service, "
+ + "which in regular intevals must invoke a 'keepalive' REST call. "
+ "When a service does not invoke this call within the given time, it is considered unavailble. "
+ "An unavailable service will be automatically deregistered and its policies will be deleted. "
+ "Value 0 means no timeout supervision.")
@@ -46,8 +45,7 @@ public class ServiceRegistrationInfo {
@JsonProperty("keep_alive_interval_seconds")
public long keepAliveIntervalSeconds = 0;
- @ApiModelProperty(value = "callback for notifying of Near-RT RIC state changes", required = false,
- allowEmptyValue = true)
+ @Schema(description = "callback for notifying of Near-RT RIC state changes", required = false)
@SerializedName("callback_url")
@JsonProperty("callback_url")
public String callbackUrl = "";
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ServiceStatus.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ServiceStatus.java
index 221fef8d..02869485 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ServiceStatus.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ServiceStatus.java
@@ -23,31 +23,30 @@ package org.onap.ccsdk.oran.a1policymanagementservice.controllers.v2;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.gson.annotations.SerializedName;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
import org.immutables.gson.Gson;
@Gson.TypeAdapters
-@ApiModel(value = "service_status_v2")
+@Schema(name = "service_status_v2")
public class ServiceStatus {
- @ApiModelProperty(value = "identity of the service")
+ @Schema(description = "identity of the service")
@SerializedName("service_id")
@JsonProperty("service_id")
public final String serviceId;
- @ApiModelProperty(value = "policy keep alive timeout")
+ @Schema(description = "policy keep alive timeout")
@SerializedName("keep_alive_interval_seconds")
@JsonProperty("keep_alive_interval_seconds")
public final long keepAliveIntervalSeconds;
- @ApiModelProperty(value = "time since last invocation by the service")
+ @Schema(description = "time since last invocation by the service")
@SerializedName("time_since_last_activity_seconds")
@JsonProperty("time_since_last_activity_seconds")
public final long timeSinceLastActivitySeconds;
- @ApiModelProperty(value = "callback for notifying of RIC synchronization")
+ @Schema(description = "callback for notifying of RIC synchronization")
@SerializedName("callback_url")
@JsonProperty("callback_url")
public String callbackUrl;
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ServiceStatusList.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ServiceStatusList.java
index a7ffeca0..981c95b6 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ServiceStatusList.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ServiceStatusList.java
@@ -23,18 +23,17 @@ package org.onap.ccsdk.oran.a1policymanagementservice.controllers.v2;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.gson.annotations.SerializedName;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
import java.util.Collection;
import org.immutables.gson.Gson;
@Gson.TypeAdapters
-@ApiModel(value = "service_list_v2", description = "List of service information")
+@Schema(name = "service_list_v2", description = "List of service information")
public class ServiceStatusList {
- @ApiModelProperty(value = "List of service information")
+ @Schema(description = "List of service information")
@SerializedName("service_list")
@JsonProperty("service_list")
public final Collection<ServiceStatus> statusList;
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/StatusController.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/StatusController.java
index 1c5a473b..2318d55d 100644
--- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/StatusController.java
+++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/StatusController.java
@@ -20,12 +20,12 @@
package org.onap.ccsdk.oran.a1policymanagementservice.controllers.v2;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiResponse;
-import io.swagger.annotations.ApiResponses;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
+import io.swagger.v3.oas.annotations.responses.ApiResponses;
+import io.swagger.v3.oas.annotations.tags.Tag;
import org.immutables.gson.Gson;
import org.springframework.http.HttpStatus;
@@ -36,13 +36,16 @@ import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Mono;
@RestController("StatusControllerV2")
-@Api(tags = Consts.V2_API_NAME)
+@Tag(name = StatusController.API_NAME)
public class StatusController {
+ public static final String API_NAME = "Health Check";
+ public static final String API_DESCRIPTION = "";
+
@Gson.TypeAdapters
- @ApiModel(value = "status_info_v2")
+ @Schema(name = "status_info_v2")
class StatusInfo {
- @ApiModelProperty(value = "status text")
+ @Schema(description = "status text")
public final String status;
StatusInfo(String status) {
@@ -51,10 +54,13 @@ public class StatusController {
}
@GetMapping(path = Consts.V2_API_ROOT + "/status", produces = MediaType.APPLICATION_JSON_VALUE)
- @ApiOperation(value = "Returns status and statistics of this service")
+ @Operation(summary = "Returns status and statistics of this service")
@ApiResponses(value = { //
- @ApiResponse(code = 200, message = "Service is living", response = StatusInfo.class) //
+ @ApiResponse(responseCode = "200", //
+ description = "Service is living", //
+ content = @Content(schema = @Schema(implementation = StatusInfo.class))), //
})
+
public Mono<ResponseEntity<Object>> getStatus() {
StatusInfo info = new StatusInfo("hunky dory");
return Mono.just(new ResponseEntity<>(info, HttpStatus.OK));
diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ApplicationTest.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ApplicationTest.java
index 14843eb2..68255953 100644
--- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ApplicationTest.java
+++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ApplicationTest.java
@@ -98,7 +98,7 @@ import reactor.util.annotation.Nullable;
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
@TestPropertySource(properties = { //
"server.ssl.key-store=./config/keystore.jks", //
- "app.webclient.trust-store=./config/truststore.jks" })
+ "app.webclient.trust-store=./config/truststore.jks"})
class ApplicationTest {
private static final Logger logger = LoggerFactory.getLogger(ApplicationTest.class);
@@ -213,15 +213,12 @@ class ApplicationTest {
}
@Test
- void createApiDoc() throws IOException {
- String url = "https://localhost:" + this.port + "/v2/api-docs";
+ void generateApiDoc() throws IOException {
+ String url = "https://localhost:" + this.port + "/v3/api-docs";
ResponseEntity<String> resp = restClient("", false).getForEntity(url).block();
assertThat(resp.getStatusCode()).isEqualTo(HttpStatus.OK);
JSONObject jsonObj = new JSONObject(resp.getBody());
- jsonObj.remove("host");
- assertThat(jsonObj.getJSONObject("definitions").remove("Mono«ResponseEntity«object»»")).isNotNull();
- assertThat(jsonObj.getJSONObject("definitions").remove("void")).isNotNull();
- assertThat(jsonObj.getJSONObject("definitions").remove("Mono«ResponseEntity«string»»")).isNotNull();
+ assertThat(jsonObj.remove("servers")).isNotNull();
String indented = (jsonObj).toString(4);
String docDir = "api/";
@@ -773,8 +770,8 @@ class ApplicationTest {
for (int i = 0; i < 10; ++i) {
AsyncRestClient restClient = restClient();
- ConcurrencyTestRunnable test = new ConcurrencyTestRunnable(restClient, supervision, a1ClientFactory, rics,
- policyTypes);
+ ConcurrencyTestRunnable test =
+ new ConcurrencyTestRunnable(restClient, supervision, a1ClientFactory, rics, policyTypes);
Thread thread = new Thread(test, "TestThread_" + i);
thread.start();
threads.add(thread);
diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/RappSimulatorController.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/RappSimulatorController.java
index 0a679201..83a2d784 100644
--- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/RappSimulatorController.java
+++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/RappSimulatorController.java
@@ -23,10 +23,12 @@ package org.onap.ccsdk.oran.a1policymanagementservice.controllers.v2;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiResponse;
-import io.swagger.annotations.ApiResponses;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
+import io.swagger.v3.oas.annotations.responses.ApiResponses;
+import io.swagger.v3.oas.annotations.tags.Tag;
import java.lang.invoke.MethodHandles;
import java.util.Vector;
@@ -45,11 +47,11 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
@RestController("RappCallbacksController")
-@Api(tags = {"R-App Callbacks"})
+@Tag(name = Consts.V2_API_SERVICE_CALLBACKS_NAME)
public class RappSimulatorController {
private final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
- public static final String SERVICE_CALLBACK_URL = "/r-app/pms-callback";
+ public static final String SERVICE_CALLBACK_URL = "/r-app/near-rt-ric-status";
private static Gson gson = new GsonBuilder().create();
public static class TestResults {
@@ -67,10 +69,12 @@ public class RappSimulatorController {
private static final String CALLBACK_DESCRIPTION = "The URL to this call is registerred at Service registration.";
@PostMapping(path = SERVICE_CALLBACK_URL, produces = MediaType.APPLICATION_JSON_VALUE)
- @ApiOperation(value = "Callback for Near-RT RIC status", notes = CALLBACK_DESCRIPTION)
+ @Operation(summary = "Callback for Near-RT RIC status", description = CALLBACK_DESCRIPTION)
@ApiResponses(value = { //
- @ApiResponse(code = 200, message = "OK", response = VoidResponse.class)} //
+ @ApiResponse(responseCode = "200", description = "OK",
+ content = @Content(schema = @Schema(implementation = VoidResponse.class)))} //
)
+
public ResponseEntity<Object> jobStatusCallback( //
@RequestBody ServiceCallbackInfo body) {
logger.info("R-App callback body: {}", gson.toJson(body));