aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvidhyasree <sn141y@att.com>2018-06-29 16:18:12 -0400
committerTakamune Cho <tc012c@att.com>2018-07-02 18:15:47 +0000
commit41db847244b0ad79e1c9fe0caecddc2baae1372c (patch)
tree17376a3d5e3d4e007f0e14cbc4ebba87bfbe38de
parentf392eb16a6f0014d51b8072a0b4e0fc8f234036c (diff)
Adding responses to payload in LCM API
For HealthCheck, UpgradePrecheck and UpgradePostcheck Issue-ID: APPC-920 Change-Id: I7e7b681d98c5dc3eeac6f7ea2b070f614bf51a7c Signed-off-by: vidhyasree <sn141y@att.com>
-rw-r--r--appc-dispatcher/appc-request-handler/appc-request-handler-core/src/main/java/org/onap/appc/requesthandler/conv/Converter.java3
-rw-r--r--appc-dispatcher/appc-request-handler/appc-request-handler-core/src/test/java/org/onap/appc/requesthandler/ConverterTest.java106
-rw-r--r--appc-provider/appc-provider-model/src/main/yang/appc-provider-lcm.yang13
3 files changed, 118 insertions, 4 deletions
diff --git a/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/main/java/org/onap/appc/requesthandler/conv/Converter.java b/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/main/java/org/onap/appc/requesthandler/conv/Converter.java
index 6ec8ea9b9..0b8002b1b 100644
--- a/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/main/java/org/onap/appc/requesthandler/conv/Converter.java
+++ b/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/main/java/org/onap/appc/requesthandler/conv/Converter.java
@@ -100,6 +100,7 @@ public class Converter {
outObj = new HealthCheckOutputBuilder();
((HealthCheckOutputBuilder)outObj).setCommonHeader(commonHeader);
((HealthCheckOutputBuilder)outObj).setStatus(status);
+ ((HealthCheckOutputBuilder)outObj).setPayload(payload);
return outObj;
case LiveUpgrade:
outObj = new LiveUpgradeOutputBuilder();
@@ -242,6 +243,7 @@ public class Converter {
outObj = new UpgradePostCheckOutputBuilder();
((UpgradePostCheckOutputBuilder)outObj).setCommonHeader(commonHeader);
((UpgradePostCheckOutputBuilder)outObj).setStatus(status);
+ ((UpgradePostCheckOutputBuilder)outObj).setPayload(payload);
return outObj;
case UpgradeBackup:
outObj = new UpgradeBackupOutputBuilder();
@@ -257,6 +259,7 @@ public class Converter {
outObj = new UpgradePreCheckOutputBuilder();
((UpgradePreCheckOutputBuilder)outObj).setCommonHeader(commonHeader);
((UpgradePreCheckOutputBuilder)outObj).setStatus(status);
+ ((UpgradePreCheckOutputBuilder)outObj).setPayload(payload);
return outObj;
case AttachVolume:
outObj = new AttachVolumeOutputBuilder();
diff --git a/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/test/java/org/onap/appc/requesthandler/ConverterTest.java b/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/test/java/org/onap/appc/requesthandler/ConverterTest.java
index 58f69fdf1..3d3c350a3 100644
--- a/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/test/java/org/onap/appc/requesthandler/ConverterTest.java
+++ b/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/test/java/org/onap/appc/requesthandler/ConverterTest.java
@@ -41,7 +41,7 @@ public class ConverterTest {
private String expectedDmaapOutgoingMessageJsonStringRollback ="{\"body\":{\"output\":{\"common-header\":{\"api-ver\":\"2.0.0\",\"flags\":{},\"originator-id\":\"oid\",\"request-id\":\"reqid\",\"timestamp\":\"1970-01-01T00:00:01.000Z\"},\"status\":{\"code\":400,\"message\":\"SUCCESS - request has been processed successfully\"}}},\"cambria.partition\":\"MSO\",\"correlation-id\":\"reqid\",\"rpc-name\":\"rollback\",\"type\":\"response\"}";
private String expectedDmaapOutgoingMessageJsonStringSnapshot ="{\"body\":{\"output\":{\"common-header\":{\"api-ver\":\"2.0.0\",\"flags\":{},\"originator-id\":\"oid\",\"request-id\":\"reqid\",\"timestamp\":\"1970-01-01T00:00:01.000Z\"},\"status\":{\"code\":400,\"message\":\"SUCCESS - request has been processed successfully\"}}},\"cambria.partition\":\"MSO\",\"correlation-id\":\"reqid\",\"rpc-name\":\"snapshot\",\"type\":\"response\"}";
private String expectedDmaapOutgoingMessageJsonStringAudit ="{\"body\":{\"output\":{\"common-header\":{\"api-ver\":\"2.0.0\",\"flags\":{},\"originator-id\":\"oid\",\"request-id\":\"reqid\",\"timestamp\":\"1970-01-01T00:00:01.000Z\"},\"payload\":\"{}\",\"status\":{\"code\":400,\"message\":\"SUCCESS - request has been processed successfully\"}}},\"cambria.partition\":\"MSO\",\"correlation-id\":\"reqid\",\"rpc-name\":\"audit\",\"type\":\"response\"}";
- private String expectedDmaapOutgoingMessageJsonStringHealthCheck ="{\"body\":{\"output\":{\"common-header\":{\"api-ver\":\"2.0.0\",\"flags\":{},\"originator-id\":\"oid\",\"request-id\":\"reqid\",\"timestamp\":\"1970-01-01T00:00:01.000Z\"},\"status\":{\"code\":400,\"message\":\"SUCCESS - request has been processed successfully\"}}},\"cambria.partition\":\"MSO\",\"correlation-id\":\"reqid\",\"rpc-name\":\"health-check\",\"type\":\"response\"}";
+ private String expectedDmaapOutgoingMessageJsonStringHealthCheck ="{\"body\":{\"output\":{\"common-header\":{\"api-ver\":\"2.0.0\",\"flags\":{},\"originator-id\":\"oid\",\"request-id\":\"reqid\",\"timestamp\":\"1970-01-01T00:00:01.000Z\"},\"payload\":\"{}\",\"status\":{\"code\":400,\"message\":\"SUCCESS - request has been processed successfully\"}}},\"cambria.partition\":\"MSO\",\"correlation-id\":\"reqid\",\"rpc-name\":\"health-check\",\"type\":\"response\"}";
private String expectedDmaapOutgoingMessageJsonStringLiveUpgrade ="{\"body\":{\"output\":{\"common-header\":{\"api-ver\":\"2.0.0\",\"flags\":{},\"originator-id\":\"oid\",\"request-id\":\"reqid\",\"timestamp\":\"1970-01-01T00:00:01.000Z\"},\"status\":{\"code\":400,\"message\":\"SUCCESS - request has been processed successfully\"}}},\"cambria.partition\":\"MSO\",\"correlation-id\":\"reqid\",\"rpc-name\":\"live-upgrade\",\"type\":\"response\"}";
private String expectedDmaapOutgoingMessageJsonStringLock ="{\"body\":{\"output\":{\"common-header\":{\"api-ver\":\"2.0.0\",\"flags\":{},\"originator-id\":\"oid\",\"request-id\":\"reqid\",\"timestamp\":\"1970-01-01T00:00:01.000Z\"},\"status\":{\"code\":400,\"message\":\"SUCCESS - request has been processed successfully\"}}},\"cambria.partition\":\"MSO\",\"correlation-id\":\"reqid\",\"rpc-name\":\"lock\",\"type\":\"response\"}";
private String expectedDmaapOutgoingMessageJsonStringModifyConfig ="{\"body\":{\"output\":{\"common-header\":{\"api-ver\":\"2.0.0\",\"flags\":{},\"originator-id\":\"oid\",\"request-id\":\"reqid\",\"timestamp\":\"1970-01-01T00:00:01.000Z\"},\"payload\":\"{}\",\"status\":{\"code\":400,\"message\":\"SUCCESS - request has been processed successfully\"}}},\"cambria.partition\":\"MSO\",\"correlation-id\":\"reqid\",\"rpc-name\":\"config-modify\",\"type\":\"response\"}";
@@ -50,6 +50,12 @@ public class ConverterTest {
private String expectedDmaapOutgoingMessageJsonStringSync ="{\"body\":{\"output\":{\"common-header\":{\"api-ver\":\"2.0.0\",\"flags\":{},\"originator-id\":\"oid\",\"request-id\":\"reqid\",\"timestamp\":\"1970-01-01T00:00:01.000Z\"},\"payload\":\"{}\",\"status\":{\"code\":400,\"message\":\"SUCCESS - request has been processed successfully\"}}},\"cambria.partition\":\"MSO\",\"correlation-id\":\"reqid\",\"rpc-name\":\"sync\",\"type\":\"response\"}";
private String expectedDmaapOutgoingMessageJsonStringTerminate ="{\"body\":{\"output\":{\"common-header\":{\"api-ver\":\"2.0.0\",\"flags\":{},\"originator-id\":\"oid\",\"request-id\":\"reqid\",\"timestamp\":\"1970-01-01T00:00:01.000Z\"},\"status\":{\"code\":400,\"message\":\"SUCCESS - request has been processed successfully\"}}},\"cambria.partition\":\"MSO\",\"correlation-id\":\"reqid\",\"rpc-name\":\"terminate\",\"type\":\"response\"}";
private String expectedDmaapOutgoingMessageJsonStringUnlock ="{\"body\":{\"output\":{\"common-header\":{\"api-ver\":\"2.0.0\",\"flags\":{},\"originator-id\":\"oid\",\"request-id\":\"reqid\",\"timestamp\":\"1970-01-01T00:00:01.000Z\"},\"status\":{\"code\":400,\"message\":\"SUCCESS - request has been processed successfully\"}}},\"cambria.partition\":\"MSO\",\"correlation-id\":\"reqid\",\"rpc-name\":\"unlock\",\"type\":\"response\"}";
+ private String expectedDmaapOutgoingMessageJsonStringUpgradePreCheck ="{\"body\":{\"output\":{\"common-header\":{\"api-ver\":\"2.0.0\",\"flags\":{},\"originator-id\":\"oid\",\"request-id\":\"reqid\",\"timestamp\":\"1970-01-01T00:00:01.000Z\"},\"payload\":\"{}\",\"status\":{\"code\":400,\"message\":\"SUCCESS - request has been processed successfully\"}}},\"cambria.partition\":\"MSO\",\"correlation-id\":\"reqid\",\"rpc-name\":\"upgrade-pre-check\",\"type\":\"response\"}";
+ private String expectedDmaapOutgoingMessageJsonStringUpgradePostCheck ="{\"body\":{\"output\":{\"common-header\":{\"api-ver\":\"2.0.0\",\"flags\":{},\"originator-id\":\"oid\",\"request-id\":\"reqid\",\"timestamp\":\"1970-01-01T00:00:01.000Z\"},\"payload\":\"{}\",\"status\":{\"code\":400,\"message\":\"SUCCESS - request has been processed successfully\"}}},\"cambria.partition\":\"MSO\",\"correlation-id\":\"reqid\",\"rpc-name\":\"upgrade-post-check\",\"type\":\"response\"}";
+ private String expectedDmaapOutgoingMessageJsonStringUpgradeSoftware ="{\"body\":{\"output\":{\"common-header\":{\"api-ver\":\"2.0.0\",\"flags\":{},\"originator-id\":\"oid\",\"request-id\":\"reqid\",\"timestamp\":\"1970-01-01T00:00:01.000Z\"},\"status\":{\"code\":400,\"message\":\"SUCCESS - request has been processed successfully\"}}},\"cambria.partition\":\"MSO\",\"correlation-id\":\"reqid\",\"rpc-name\":\"upgradesoftware\",\"type\":\"response\"}";
+ private String expectedDmaapOutgoingMessageJsonStringUpgradeBackout ="{\"body\":{\"output\":{\"common-header\":{\"api-ver\":\"2.0.0\",\"flags\":{},\"originator-id\":\"oid\",\"request-id\":\"reqid\",\"timestamp\":\"1970-01-01T00:00:01.000Z\"},\"status\":{\"code\":400,\"message\":\"SUCCESS - request has been processed successfully\"}}},\"cambria.partition\":\"MSO\",\"correlation-id\":\"reqid\",\"rpc-name\":\"upgradebackout\",\"type\":\"response\"}";
+ private String expectedDmaapOutgoingMessageJsonStringUpgradeBackup ="{\"body\":{\"output\":{\"common-header\":{\"api-ver\":\"2.0.0\",\"flags\":{},\"originator-id\":\"oid\",\"request-id\":\"reqid\",\"timestamp\":\"1970-01-01T00:00:01.000Z\"},\"status\":{\"code\":400,\"message\":\"SUCCESS - request has been processed successfully\"}}},\"cambria.partition\":\"MSO\",\"correlation-id\":\"reqid\",\"rpc-name\":\"upgradebackup\",\"type\":\"response\"}";
+
private String expectedJsonBodyStrwithPayload ="{\"output\":{\"common-header\":{\"api-ver\":\"2.0.0\",\"flags\":{},\"originator-id\":\"oid\",\"request-id\":\"reqid\",\"timestamp\":\"1970-01-01T00:00:01.000Z\"},\"payload\":\"{}\",\"status\":{\"code\":400,\"message\":\"SUCCESS - request has been processed successfully\"}}}";
private String expectedDmaapOutgoingMessageJsonStringReboot ="{\"body\":{\"output\":{\"common-header\":{\"api-ver\":\"2.0.0\",\"flags\":{},\"originator-id\":\"oid\",\"request-id\":\"reqid\",\"timestamp\":\"1970-01-01T00:00:01.000Z\"},\"status\":{\"code\":400,\"message\":\"SUCCESS - request has been processed successfully\"}}},\"cambria.partition\":\"MSO\",\"correlation-id\":\"reqid\",\"rpc-name\":\"reboot\",\"type\":\"response\"}";
@@ -146,16 +152,16 @@ public class ConverterTest {
}
@Test
public void convAsyncResponseToBuilderHealthCheckTest() throws JsonProcessingException {
- ResponseContext asyncResponse = buildAsyncResponse();
+ ResponseContext asyncResponse = buildAsyncResponsewithPayload();
VNFOperation action = VNFOperation.HealthCheck;
String rpcName = convertActionNameToUrl(action.name());
String jsonStr = Converter.convAsyncResponseToJsonStringBody(action, rpcName, asyncResponse);
- Assert.assertEquals(expectedJsonBodyStr,jsonStr);
+ Assert.assertEquals(expectedJsonBodyStrwithPayload,jsonStr);
}
@Test
public void convAsyncResponseToDmaapOutgoingMessageJsonStringHealthCheckTest() throws JsonProcessingException {
- ResponseContext asyncResponse = buildAsyncResponse();
+ ResponseContext asyncResponse = buildAsyncResponsewithPayload();
VNFOperation action = VNFOperation.HealthCheck;
String rpcName = convertActionNameToUrl(action.name());
String jsonStr = Converter.convAsyncResponseToDmaapOutgoingMessageJsonString(action, rpcName, asyncResponse);
@@ -328,6 +334,98 @@ public class ConverterTest {
System.out.println("jsonStr = " + jsonStr);
Assert.assertEquals(expectedDmaapOutgoingMessageJsonStringReboot,jsonStr);
}
+ @Test
+ public void convAsyncResponseToBuilderUpgradePreCheckTest() throws JsonProcessingException {
+ ResponseContext asyncResponse = buildAsyncResponsewithPayload();
+ VNFOperation action = VNFOperation.UpgradePreCheck;
+ String rpcName = convertActionNameToUrl(action.name());
+ String jsonStr = Converter.convAsyncResponseToJsonStringBody(action, rpcName, asyncResponse);
+ Assert.assertEquals(expectedJsonBodyStrwithPayload,jsonStr);
+ }
+
+ @Test
+ public void convAsyncResponseToDmaapOutgoingMessageJsonStringUpgradePreCheckTest() throws JsonProcessingException {
+ ResponseContext asyncResponse = buildAsyncResponsewithPayload();
+ VNFOperation action = VNFOperation.UpgradePreCheck;
+ String rpcName = convertActionNameToUrl(action.name());
+ String jsonStr = Converter.convAsyncResponseToDmaapOutgoingMessageJsonString(action, rpcName, asyncResponse);
+ System.out.println("jsonStr = " + jsonStr);
+ Assert.assertEquals(expectedDmaapOutgoingMessageJsonStringUpgradePreCheck,jsonStr);
+ }
+
+ @Test
+ public void convAsyncResponseToBuilderUpgradePostCheckTest() throws JsonProcessingException {
+ ResponseContext asyncResponse = buildAsyncResponsewithPayload();
+ VNFOperation action = VNFOperation.UpgradePostCheck;
+ String rpcName = convertActionNameToUrl(action.name());
+ String jsonStr = Converter.convAsyncResponseToJsonStringBody(action, rpcName, asyncResponse);
+ Assert.assertEquals(expectedJsonBodyStrwithPayload,jsonStr);
+ }
+
+ @Test
+ public void convAsyncResponseToDmaapOutgoingMessageJsonStringUpgradePostCheckTest() throws JsonProcessingException {
+ ResponseContext asyncResponse = buildAsyncResponsewithPayload();
+ VNFOperation action = VNFOperation.UpgradePostCheck;
+ String rpcName = convertActionNameToUrl(action.name());
+ String jsonStr = Converter.convAsyncResponseToDmaapOutgoingMessageJsonString(action, rpcName, asyncResponse);
+ System.out.println("jsonStr = " + jsonStr);
+ Assert.assertEquals(expectedDmaapOutgoingMessageJsonStringUpgradePostCheck,jsonStr);
+ }
+ @Test
+ public void convAsyncResponseToBuilderUpgradeSoftwareTest() throws JsonProcessingException {
+ ResponseContext asyncResponse = buildAsyncResponse();
+ VNFOperation action = VNFOperation.UpgradeSoftware;
+ String rpcName = action.name().toLowerCase();
+ String jsonStr = Converter.convAsyncResponseToJsonStringBody(action, rpcName, asyncResponse);
+ Assert.assertEquals(expectedJsonBodyStr,jsonStr);
+ }
+
+ @Test
+ public void convAsyncResponseToDmaapOutgoingMessageJsonStringUpgradeSoftwareTest() throws JsonProcessingException {
+ ResponseContext asyncResponse = buildAsyncResponse();
+ VNFOperation action = VNFOperation.UpgradeSoftware;
+ String rpcName = action.name().toLowerCase();
+ String jsonStr = Converter.convAsyncResponseToDmaapOutgoingMessageJsonString(action, rpcName, asyncResponse);
+ System.out.println("jsonStr = " + jsonStr);
+ Assert.assertEquals(expectedDmaapOutgoingMessageJsonStringUpgradeSoftware,jsonStr);
+ }
+ @Test
+ public void convAsyncResponseToBuilderUpgradeBackoutTest() throws JsonProcessingException {
+ ResponseContext asyncResponse = buildAsyncResponse();
+ VNFOperation action = VNFOperation.UpgradeBackout;
+ String rpcName = action.name().toLowerCase();
+ String jsonStr = Converter.convAsyncResponseToJsonStringBody(action, rpcName, asyncResponse);
+ Assert.assertEquals(expectedJsonBodyStr,jsonStr);
+ }
+
+ @Test
+ public void convAsyncResponseToDmaapOutgoingMessageJsonStringUpgradeBackoutTest() throws JsonProcessingException {
+ ResponseContext asyncResponse = buildAsyncResponse();
+ VNFOperation action = VNFOperation.UpgradeBackout;
+ String rpcName = action.name().toLowerCase();
+ String jsonStr = Converter.convAsyncResponseToDmaapOutgoingMessageJsonString(action, rpcName, asyncResponse);
+ System.out.println("jsonStr = " + jsonStr);
+ Assert.assertEquals(expectedDmaapOutgoingMessageJsonStringUpgradeBackout,jsonStr);
+ }
+ @Test
+ public void convAsyncResponseToBuilderUpgradeBackupTest() throws JsonProcessingException {
+ ResponseContext asyncResponse = buildAsyncResponse();
+ VNFOperation action = VNFOperation.UpgradeBackup;
+ String rpcName = action.name().toLowerCase();
+ String jsonStr = Converter.convAsyncResponseToJsonStringBody(action, rpcName, asyncResponse);
+ Assert.assertEquals(expectedJsonBodyStr,jsonStr);
+ }
+
+ @Test
+ public void convAsyncResponseToDmaapOutgoingMessageJsonStringUpgradeBackupTest() throws JsonProcessingException {
+ ResponseContext asyncResponse = buildAsyncResponse();
+ VNFOperation action = VNFOperation.UpgradeBackup;
+ String rpcName = action.name().toLowerCase();
+ String jsonStr = Converter.convAsyncResponseToDmaapOutgoingMessageJsonString(action, rpcName, asyncResponse);
+ System.out.println("jsonStr = " + jsonStr);
+ Assert.assertEquals(expectedDmaapOutgoingMessageJsonStringUpgradeBackup,jsonStr);
+ }
+
/*@Test
public void convAsyncResponseToBuilderTest() throws JsonProcessingException {
AsyncResponse asyncResponse = buildAsyncResponse();
diff --git a/appc-provider/appc-provider-model/src/main/yang/appc-provider-lcm.yang b/appc-provider/appc-provider-model/src/main/yang/appc-provider-lcm.yang
index 2ef9e5438..423a1e8b3 100644
--- a/appc-provider/appc-provider-model/src/main/yang/appc-provider-lcm.yang
+++ b/appc-provider/appc-provider-model/src/main/yang/appc-provider-lcm.yang
@@ -536,6 +536,10 @@ module appc-provider-lcm {
output {
uses common-header;
uses status;
+ leaf payload {
+ type payload;
+ mandatory true;
+ }
}
}
@@ -582,6 +586,10 @@ module appc-provider-lcm {
output {
uses common-header;
uses status;
+ leaf payload {
+ type payload;
+ mandatory true;
+ }
}
}
@@ -960,6 +968,11 @@ module appc-provider-lcm {
output {
uses common-header;
uses status;
+ leaf payload {
+ type payload;
+ mandatory true;
+ }
+
}
}