summaryrefslogtreecommitdiffstats
path: root/generic-resource-api
diff options
context:
space:
mode:
authorshashikanth.vh <shashikanth.vh@huawei.com>2019-04-17 16:03:06 +0530
committerShashikanth VH <shashikanth.vh@huawei.com>2019-04-19 05:48:13 +0000
commiteb15e84a42d99490f2cb6fc6c52beb99711713dd (patch)
treec3722a11698699b39adb9215e1801d9eadf5eafb /generic-resource-api
parent5750ce033f6ed5e3927114d1029cb87ff77d3381 (diff)
GRA vf module id validation removed
vf module id validation is removed, its not mandatory to input vf module id in the requests.code is modified to return vf module id if present in the request, if not return from the DG response object. Change-Id: I077e41ab7734cc46eebe97bbcacf6d3bfc3973d1 Issue-ID: SDNC-653 Signed-off-by: shashikanth.vh <shashikanth.vh@huawei.com>
Diffstat (limited to 'generic-resource-api')
-rw-r--r--generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiProvider.java19
-rw-r--r--generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/VfModuleTopologyOperationRPCTest.java4
2 files changed, 19 insertions, 4 deletions
diff --git a/generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiProvider.java b/generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiProvider.java
index 2a71e6d9..10ea31df 100644
--- a/generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiProvider.java
+++ b/generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiProvider.java
@@ -191,6 +191,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC
private static final String VNF_OBJECT_PATH_PARAM = "vnf-object-path";
private static final String PNF_OBJECT_PATH_PARAM = "pnf-object-path";
private static final String VF_MODULE_OBJECT_PATH_PARAM = "vf-module-object-path";
+ private static final String VF_MODULE_ID_PARAM = "vf-module-id";
private static final String UPDATING_MDSAL_ERROR_MESSAGE = "Caught Exception updating MD-SAL for {} [{}] \n";
private static final String UPDATING_MDSAL_ERROR_MESSAGE_2 = "Caught Exception updating MD-SAL for {} [{},{}] \n";
private static final String RETURNED_FAILED_MESSAGE = "Returned FAILED for {} [{}] {}";
@@ -1260,7 +1261,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC
return Futures.immediateFuture(rpcResult);
}
- if (hasInvalidVfModuleId(input)) {
+ /*if (hasInvalidVfModuleId(input)) {
log.debug("exiting {} because of null or empty vf-module-id", svcOperation);
responseBuilder.setResponseCode("403");
responseBuilder.setResponseMessage("invalid input, vf-module-id is null or empty");
@@ -1270,7 +1271,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC
.<VfModuleTopologyOperationOutput>status(true).withResult(responseBuilder.build()).build();
return Futures.immediateFuture(rpcResult);
- }
+ }*/
// Grab the service instance ID from the input buffer
String siid = input.getServiceInformation().getServiceInstanceId();
@@ -1326,6 +1327,20 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC
responseObject.setStatusCode(respProps.getProperty(ERROR_CODE_PARAM));
responseObject.setMessage(respProps.getProperty(ERROR_MESSAGE_PARAM));
ackFinal = respProps.getProperty(ACK_FINAL_PARAM, "Y");
+ if (vfModuleId == null) {
+ vfModuleId = respProps.getProperty(VF_MODULE_ID_PARAM);
+ if (vfModuleId == null) {
+ log.debug("exiting {} because vf-module-id not found in response", svcOperation);
+ responseBuilder.setResponseCode("403");
+ responseBuilder.setResponseMessage("failed to generate vf-module-id");
+ responseBuilder.setAckFinalIndicator("Y");
+
+ RpcResult<VfModuleTopologyOperationOutput> rpcResult = RpcResultBuilder
+ .<VfModuleTopologyOperationOutput>status(true).withResult(responseBuilder.build()).build();
+
+ return Futures.immediateFuture(rpcResult);
+ }
+ }
serviceObjectPath = respProps.getProperty(SERVICE_OBJECT_PATH_PARAM);
vnfObjectPath = respProps.getProperty(VNF_OBJECT_PATH_PARAM);
vfModuleObjectPath = respProps.getProperty(VF_MODULE_OBJECT_PATH_PARAM);
diff --git a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/VfModuleTopologyOperationRPCTest.java b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/VfModuleTopologyOperationRPCTest.java
index 2cadbfeb..927eee34 100644
--- a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/VfModuleTopologyOperationRPCTest.java
+++ b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/VfModuleTopologyOperationRPCTest.java
@@ -76,7 +76,7 @@ public class VfModuleTopologyOperationRPCTest extends GenericResourceApiProvider
assertEquals("Y", output.getAckFinalIndicator());
}
- @Test
+ /*@Test
public void should_fail_when_invalid_vf_module_id() throws Exception {
VfModuleTopologyOperationInput input = build(vfModuleTopologyOperationInput()
@@ -93,7 +93,7 @@ public class VfModuleTopologyOperationRPCTest extends GenericResourceApiProvider
assertEquals("403", output.getResponseCode());
assertEquals("invalid input, vf-module-id is null or empty", output.getResponseMessage());
assertEquals("Y", output.getAckFinalIndicator());
- }
+ }*/
@Test