From fff922790262500c1cced5e674179bf8873acb83 Mon Sep 17 00:00:00 2001 From: Sandeep Shah Date: Tue, 17 Dec 2019 00:22:14 -0600 Subject: 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 Change-Id: I023cf27ec9ac0305f1bc23bc9762603192c09e27 --- .../dmaapclient/A1AdapterPolicyDmaapConsumer.java | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'dmaap-listener') 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; } -- cgit 1.2.3-korg