summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/PolicyController.java10
-rw-r--r--a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ServiceController.java4
-rw-r--r--a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ApplicationTest.java29
-rw-r--r--docs/offeredapis/swagger/pms-api.json112
4 files changed, 79 insertions, 76 deletions
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 256b4782..8dd2df61 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
@@ -97,13 +97,13 @@ public class PolicyController {
private static Gson gson = new GsonBuilder() //
.create(); //
- @GetMapping(path = Consts.V2_API_ROOT + "/policy-types/{policyTypeId}", produces = MediaType.APPLICATION_JSON_VALUE)
+ @GetMapping(path = "/v2/policy-types/{policytype_id:.+}", produces = MediaType.APPLICATION_JSON_VALUE)
@ApiOperation(value = "Returns a policy type definition")
@ApiResponses(value = { //
@ApiResponse(code = 200, message = "Policy type", response = PolicyTypeInfo.class), //
- @ApiResponse(code = 404, message = "Near-RT RIC is not found", response = ErrorResponse.ErrorInfo.class)})
+ @ApiResponse(code = 404, message = "Policy type is not found", response = ErrorResponse.ErrorInfo.class)})
public ResponseEntity<Object> getPolicyType( //
- @PathVariable("policyTypeId") String policyTypeId) {
+ @PathVariable("policytype_id") String policyTypeId) {
try {
PolicyType type = policyTypes.getType(policyTypeId);
PolicyTypeInfo info = new PolicyTypeInfo(type.schema());
@@ -134,7 +134,7 @@ public class PolicyController {
}
}
- @GetMapping(path = Consts.V2_API_ROOT + "/policies/{policy_id}", produces = MediaType.APPLICATION_JSON_VALUE)
+ @GetMapping(path = Consts.V2_API_ROOT + "/policies/{policy_id:.+}", produces = MediaType.APPLICATION_JSON_VALUE)
@ApiOperation(value = "Returns a policy") //
@ApiResponses(value = { //
@ApiResponse(code = 200, message = "Policy found", response = PolicyInfo.class), //
@@ -150,7 +150,7 @@ public class PolicyController {
}
}
- @DeleteMapping(Consts.V2_API_ROOT + "/policies/{policy_id}")
+ @DeleteMapping(Consts.V2_API_ROOT + "/policies/{policy_id:.+}")
@ApiOperation(value = "Delete a policy")
@ApiResponses(value = { //
@ApiResponse(code = 200, message = "Not used", response = VoidResponse.class),
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 b2fa029a..a8fc7e6d 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
@@ -143,9 +143,9 @@ public class ServiceController {
@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)})
- @DeleteMapping(Consts.V2_API_ROOT + "/services/{serviceId}")
+ @DeleteMapping(Consts.V2_API_ROOT + "/services/{service_id:.+}")
public ResponseEntity<Object> deleteService(//
- @PathVariable("serviceId") String serviceId) {
+ @PathVariable("service_id") String serviceId) {
try {
Service service = removeService(serviceId);
// Remove the policies from the repo and let the consistency monitoring
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 02fdaf9c..a0cb2af8 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
@@ -333,10 +333,10 @@ class ApplicationTest {
@Test
void testPutPolicy() throws Exception {
- String serviceName = "service1";
- String ricId = "ric1";
- String policyTypeName = "type1";
- String policyInstanceId = "instance1";
+ String serviceName = "service.1";
+ String ricId = "ric.1";
+ String policyTypeName = "type1_1.2.3";
+ String policyInstanceId = "instance_1.2.3";
putService(serviceName);
addPolicyType(policyTypeName, ricId);
@@ -352,7 +352,7 @@ class ApplicationTest {
assertThat(policy).isNotNull();
assertThat(policy.id()).isEqualTo(policyInstanceId);
assertThat(policy.ownerServiceId()).isEqualTo(serviceName);
- assertThat(policy.ric().id()).isEqualTo("ric1");
+ assertThat(policy.ric().id()).isEqualTo(ricId);
assertThat(policy.isTransient()).isTrue();
// Put a non transient policy
@@ -463,10 +463,11 @@ class ApplicationTest {
@Test
void testDeletePolicy() throws Exception {
- addPolicy("id", "typeName", "service1", "ric1");
+ String policyId = "id.1";
+ addPolicy(policyId, "typeName", "service1", "ric1");
assertThat(policies.size()).isEqualTo(1);
- String url = "/policies/id";
+ String url = "/policies/" + policyId;
ResponseEntity<String> entity = restClient().deleteForEntity(url).block();
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.NO_CONTENT);
@@ -478,11 +479,13 @@ class ApplicationTest {
@Test
void testGetPolicyType() throws Exception {
- addPolicyType("type1", "ric1");
+ String typeId = "AC.D";
+ addPolicyType(typeId, "ric1");
waitForRicState("ric1", RicState.AVAILABLE);
- String url = "/policy-types/type1";
+ String url = "/policy-types/" + typeId;
+
String rsp = this.restClient().get(url).block();
PolicyTypeInfo info = gson.fromJson(rsp, PolicyTypeInfo.class);
@@ -595,12 +598,12 @@ class ApplicationTest {
@Test
void testPutAndGetService() throws Exception {
// PUT
- String serviceName = "name";
+ String serviceName = "ac.dc";
putService(serviceName, 0, HttpStatus.CREATED);
putService(serviceName, 0, HttpStatus.OK);
// GET one service
- String url = "/services?service_id=name";
+ String url = "/services?service_id=" + serviceName;
String rsp = restClient().get(url).block();
ServiceStatusList info = gson.fromJson(rsp, ServiceStatusList.class);
assertThat(info.statusList).hasSize(1);
@@ -615,13 +618,13 @@ class ApplicationTest {
logger.info(rsp);
// Keep alive
- url = "/services/name/keepalive";
+ url = "/services/" + serviceName + "/keepalive";
ResponseEntity<?> entity = restClient().putForEntity(url).block();
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
// DELETE service
assertThat(services.size()).isEqualTo(1);
- url = "/services/name";
+ url = "/services/" + serviceName;
restClient().delete(url).block();
assertThat(services.size()).isZero();
diff --git a/docs/offeredapis/swagger/pms-api.json b/docs/offeredapis/swagger/pms-api.json
index 3f684b8b..b503ac0c 100644
--- a/docs/offeredapis/swagger/pms-api.json
+++ b/docs/offeredapis/swagger/pms-api.json
@@ -35,7 +35,7 @@
"summary": "Returns status and statistics of this service",
"deprecated": false,
"produces": ["application/json"],
- "operationId": "getStatusUsingGET_1",
+ "operationId": "getStatusUsingGET",
"responses": {
"200": {
"schema": {"$ref": "#/definitions/status_info_v2"},
@@ -137,6 +137,33 @@
"tags": ["A1 Policy Management Version 1.0"]
}
},
+ "/v2/services/{service_id}": {"delete": {
+ "summary": "Unregister a service",
+ "deprecated": false,
+ "produces": ["*/*"],
+ "operationId": "deleteServiceUsingDELETE",
+ "responses": {
+ "200": {"description": "Not used"},
+ "401": {"description": "Unauthorized"},
+ "204": {
+ "schema": {"type": "object"},
+ "description": "Service unregistered"
+ },
+ "403": {"description": "Forbidden"},
+ "404": {
+ "schema": {"$ref": "#/definitions/error_information"},
+ "description": "Service not found"
+ }
+ },
+ "parameters": [{
+ "in": "path",
+ "name": "service_id",
+ "description": "service_id",
+ "type": "string",
+ "required": true
+ }],
+ "tags": ["A1 Policy Management Version 2.0 (in progress)"]
+ }},
"/policy": {
"get": {
"summary": "Returns a policy configuration",
@@ -775,37 +802,11 @@
"tags": ["A1 Policy Management Version 2.0 (in progress)"],
"consumes": ["application/json"]
}},
- "/v2/policy-types/{policyTypeId}": {"get": {
- "summary": "Returns a policy type definition",
- "deprecated": false,
- "produces": ["application/json"],
- "operationId": "getPolicyTypeUsingGET",
- "responses": {
- "200": {
- "schema": {"$ref": "#/definitions/policytype_v2"},
- "description": "Policy type"
- },
- "401": {"description": "Unauthorized"},
- "403": {"description": "Forbidden"},
- "404": {
- "schema": {"$ref": "#/definitions/error_information"},
- "description": "Near-RT RIC is not found"
- }
- },
- "parameters": [{
- "in": "path",
- "name": "policyTypeId",
- "description": "policyTypeId",
- "type": "string",
- "required": true
- }],
- "tags": ["A1 Policy Management Version 2.0 (in progress)"]
- }},
"/status": {"get": {
"summary": "Returns status and statistics of this service",
"deprecated": false,
"produces": ["*/*"],
- "operationId": "getStatusUsingGET",
+ "operationId": "getStatusUsingGET_1",
"responses": {
"200": {
"schema": {"type": "string"},
@@ -855,33 +856,6 @@
],
"tags": ["A1 Policy Management Version 2.0 (in progress)"]
}},
- "/v2/services/{serviceId}": {"delete": {
- "summary": "Unregister a service",
- "deprecated": false,
- "produces": ["*/*"],
- "operationId": "deleteServiceUsingDELETE",
- "responses": {
- "200": {"description": "Not used"},
- "401": {"description": "Unauthorized"},
- "204": {
- "schema": {"type": "object"},
- "description": "Service unregistered"
- },
- "403": {"description": "Forbidden"},
- "404": {
- "schema": {"$ref": "#/definitions/error_information"},
- "description": "Service not found"
- }
- },
- "parameters": [{
- "in": "path",
- "name": "serviceId",
- "description": "serviceId",
- "type": "string",
- "required": true
- }],
- "tags": ["A1 Policy Management Version 2.0 (in progress)"]
- }},
"/r-app/pms-callback": {"post": {
"summary": "Callback for Near-RT RIC status",
"deprecated": false,
@@ -905,6 +879,32 @@
"tags": ["R-App Callbacks"],
"consumes": ["application/json"]
}},
+ "/v2/policy-types/{policytype_id}": {"get": {
+ "summary": "Returns a policy type definition",
+ "deprecated": false,
+ "produces": ["application/json"],
+ "operationId": "getPolicyTypeUsingGET",
+ "responses": {
+ "200": {
+ "schema": {"$ref": "#/definitions/policytype_v2"},
+ "description": "Policy type"
+ },
+ "401": {"description": "Unauthorized"},
+ "403": {"description": "Forbidden"},
+ "404": {
+ "schema": {"$ref": "#/definitions/error_information"},
+ "description": "Policy type is not found"
+ }
+ },
+ "parameters": [{
+ "in": "path",
+ "name": "policytype_id",
+ "description": "policytype_id",
+ "type": "string",
+ "required": true
+ }],
+ "tags": ["A1 Policy Management Version 2.0 (in progress)"]
+ }},
"/service": {"put": {
"summary": "Register a service",
"deprecated": false,
@@ -1015,7 +1015,7 @@
}
}
},
- "host": "localhost:38593",
+ "host": "localhost:36953",
"definitions": {
"error_information": {
"description": "Problem as defined in https://tools.ietf.org/html/rfc7807",