diff options
author | Sandeep Shah <sandeeplinux1068@gmail.com> | 2019-12-17 00:22:14 -0600 |
---|---|---|
committer | Sandeep Shah <sandeeplinux1068@gmail.com> | 2019-12-17 00:22:14 -0600 |
commit | fff922790262500c1cced5e674179bf8873acb83 (patch) | |
tree | 20bf4ca3cec9642529877d7eb8145b8f767661cd /dmaap-listener | |
parent | 2a3c5a197236f7ba01b39c8bb51a6b977c964eeb (diff) |
Bug fix in DMAAP listener for A1 Adapter
Modification to use the payload node to be sent as an
RPC message to stay in alignment with YANG model for
A1 adapter
Issue-ID: CCSDK-2001
Signed-off-by: SandeepLinux <Sandeep.Shah@ibm.com>
Change-Id: I023cf27ec9ac0305f1bc23bc9762603192c09e27
Diffstat (limited to 'dmaap-listener')
-rw-r--r-- | dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/A1AdapterPolicyDmaapConsumer.java | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/A1AdapterPolicyDmaapConsumer.java b/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/A1AdapterPolicyDmaapConsumer.java index 778a77b80..dd59f5868 100644 --- a/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/A1AdapterPolicyDmaapConsumer.java +++ b/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/A1AdapterPolicyDmaapConsumer.java @@ -34,6 +34,9 @@ public class A1AdapterPolicyDmaapConsumer extends SdncDmaapConsumerImpl { private static final String BODY = "body"; private static final String RPC = "rpc-name"; + private static final String INPUT = "input"; + private static final String PAYLOAD = "Payload"; + @Override public void processMsg(String msg) throws InvalidMessageException { @@ -55,13 +58,26 @@ public class A1AdapterPolicyDmaapConsumer extends SdncDmaapConsumerImpl { LOG.warn("Missing body in A1-ADAPTER-DMAAP message"); return; } + + JsonNode input = bodyNode.get(INPUT); + if(input == null) { + LOG.info("Missing input node."); + return; + } + + JsonNode payloadNode = input.get(PAYLOAD); + if(payloadNode == null) { + LOG.info("Missing payload node."); + return; + } + String rpcMsgbody; try { ObjectMapper mapper = new ObjectMapper(); - rpcMsgbody = mapper.writeValueAsString(bodyNode); + rpcMsgbody = mapper.writeValueAsString(payloadNode); } catch (Exception e) { - LOG.error("Unable to parse body in A1-ADAPTER-DMAAP message", e); + LOG.error("Unable to parse payload in A1-ADAPTER-DMAAP message", e); return; } |