Add missing payload in output of callDG in LcmProvider

Change-Id: Ibafc968b747ad93934e6fa2ad2607ad921a9225e
Issue-ID: CCSDK-1224
Signed-off-by: Enbo Wang <wangenbo@huawei.com>
diff --git a/lcm/provider/src/main/java/org/onap/ccsdk/sli/northbound/LcmProvider.java b/lcm/provider/src/main/java/org/onap/ccsdk/sli/northbound/LcmProvider.java
index d1f3ba5..0074dfc 100644
--- a/lcm/provider/src/main/java/org/onap/ccsdk/sli/northbound/LcmProvider.java
+++ b/lcm/provider/src/main/java/org/onap/ccsdk/sli/northbound/LcmProvider.java
@@ -59,10 +59,18 @@
 	private class CommonLcmFields {
 		private StatusBuilder statusBuilder;
 		private CommonHeaderBuilder commonHeaderBuilder;
+		private Payload payload;
 
 		public CommonLcmFields(StatusBuilder statusBuilder, CommonHeaderBuilder commonHeaderBuilder) {
 			this.statusBuilder = statusBuilder;
 			this.commonHeaderBuilder = commonHeaderBuilder;
+			this.payload = null;
+		}
+
+		public CommonLcmFields(StatusBuilder statusBuilder, CommonHeaderBuilder commonHeaderBuilder, Payload payload) {
+			this.statusBuilder = statusBuilder;
+			this.commonHeaderBuilder = commonHeaderBuilder;
+			this.payload = payload;
 		}
 
 		public StatusBuilder getStatusBuilder() {
@@ -72,6 +80,10 @@
 		public CommonHeaderBuilder getCommonHeaderBuilder() {
 			return commonHeaderBuilder;
 		}
+
+		public Payload getPayload() {
+			return payload;
+		}
 	}
 
 	private static final Logger LOG = LoggerFactory.getLogger(LcmProvider.class);
@@ -205,6 +217,9 @@
 			CommonLcmFields retval = callDG("rollback", iBuilder.build());
 			oBuilder.setStatus(retval.getStatusBuilder().build());
 			oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build());
+			if (retval.getPayload() != null) {
+				oBuilder.setPayload(retval.getPayload());
+			}
 		} catch (LcmRpcInvocationException e) {
 			LOG.debug(exceptionMessage, e);
 			oBuilder.setCommonHeader(e.getCommonHeader());
@@ -415,6 +430,9 @@
 			CommonLcmFields retval = callDG("upgrade-pre-check", iBuilder.build());
 			oBuilder.setStatus(retval.getStatusBuilder().build());
 			oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build());
+			if (retval.getPayload() != null) {
+				oBuilder.setPayload(retval.getPayload());
+			}
 		} catch (LcmRpcInvocationException e) {
 			LOG.debug(exceptionMessage, e);
 			oBuilder.setCommonHeader(e.getCommonHeader());
@@ -814,6 +832,9 @@
 			CommonLcmFields retval = callDG("upgrade-post-check", iBuilder.build());
 			oBuilder.setStatus(retval.getStatusBuilder().build());
 			oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build());
+			if (retval.getPayload() != null) {
+				oBuilder.setPayload(retval.getPayload());
+			}
 		} catch (LcmRpcInvocationException e) {
 			LOG.debug(exceptionMessage, e);
 			oBuilder.setCommonHeader(e.getCommonHeader());
@@ -1036,6 +1057,12 @@
 		MdsalHelper.toBuilder(respProps, sBuilder);
 		MdsalHelper.toBuilder(respProps, hBuilder);
 
+		Payload payload = null;
+		String payloadValue = respProps.getProperty("payload");
+		if (payloadValue != null) {
+			payload = new Payload(payloadValue);
+		}
+
 		String statusCode = sBuilder.getCode().toString();
 
 		if (!"400".equals(statusCode)) {
@@ -1044,7 +1071,7 @@
 			LOG.info("Returned SUCCESS for "+rpcName+" ");
 		}
 
-		return new CommonLcmFields(sBuilder,hBuilder);
+		return new CommonLcmFields(sBuilder, hBuilder, payload);
 
 	}