diff options
author | Enbo Wang <wangenbo@huawei.com> | 2019-04-14 23:46:33 +0800 |
---|---|---|
committer | Enbo Wang <wangenbo@huawei.com> | 2019-04-14 23:47:21 +0800 |
commit | cd856c935cd050be3c3d3a657830853fd57f9147 (patch) | |
tree | c160f333cb9e705c0f6a112f710e41f6c4d8fabf /lcm/provider/src/main | |
parent | cd1d3ffe4a39154f6bef75108635761828907dd9 (diff) |
Add missing payload in output of callDG in LcmProvider
Change-Id: Ibafc968b747ad93934e6fa2ad2607ad921a9225e
Issue-ID: CCSDK-1224
Signed-off-by: Enbo Wang <wangenbo@huawei.com>
Diffstat (limited to 'lcm/provider/src/main')
-rw-r--r-- | lcm/provider/src/main/java/org/onap/ccsdk/sli/northbound/LcmProvider.java | 29 |
1 files changed, 28 insertions, 1 deletions
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 d1f3ba53f..0074dfc65 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 @@ public class LcmProvider implements AutoCloseable, LCMService { 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 class LcmProvider implements AutoCloseable, LCMService { public CommonHeaderBuilder getCommonHeaderBuilder() { return commonHeaderBuilder; } + + public Payload getPayload() { + return payload; + } } private static final Logger LOG = LoggerFactory.getLogger(LcmProvider.class); @@ -205,6 +217,9 @@ public class LcmProvider implements AutoCloseable, LCMService { 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 @@ public class LcmProvider implements AutoCloseable, LCMService { 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 @@ public class LcmProvider implements AutoCloseable, LCMService { 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 @@ public class LcmProvider implements AutoCloseable, LCMService { 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 @@ public class LcmProvider implements AutoCloseable, LCMService { LOG.info("Returned SUCCESS for "+rpcName+" "); } - return new CommonLcmFields(sBuilder,hBuilder); + return new CommonLcmFields(sBuilder, hBuilder, payload); } |