summaryrefslogtreecommitdiffstats
path: root/dmaap-listener
diff options
context:
space:
mode:
authorSandeep Shah <sandeeplinux1068@gmail.com>2020-06-04 19:02:10 -0500
committerSandeep Shah <sandeeplinux1068@gmail.com>2020-06-04 19:02:10 -0500
commit1ed8346da11ee15694246c432a8ac3b27bce2468 (patch)
treefd6531f87ef99f2639c45a754bacbec8c3883dfb /dmaap-listener
parent9bfbca954ba6fe021e1c166990b86ab0d9830d79 (diff)
Aiign requestID, subrequestID for DMAAP msgs
Updated DMAAP listener to keep track of requestID and subRequestID for DMAAP message publication. These values are sent to DG as part of SLI parms Issue-ID: CCSDK-2413 Signed-off-by: SandeepLinux <Sandeep.Shah@ibm.com> Change-Id: I207a7d1223416475de0b44ba80944ed2f4f57305
Diffstat (limited to 'dmaap-listener')
-rw-r--r--dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/OofPciPocDmaapConsumers.java65
1 files changed, 61 insertions, 4 deletions
diff --git a/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/OofPciPocDmaapConsumers.java b/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/OofPciPocDmaapConsumers.java
index e8dacb959..9ff6fd616 100644
--- a/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/OofPciPocDmaapConsumers.java
+++ b/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/OofPciPocDmaapConsumers.java
@@ -64,6 +64,16 @@ public class OofPciPocDmaapConsumers extends SdncDmaapConsumerImpl {
private static final String RPC_NAME = "rpc-name";
private static final String BODY = "body";
private static final String INPUT = "input";
+ private static final String COMMON_HEADER = "CommonHeader";
+ private static final String TIME_STAMP = "TimeStamp";
+ private static final String REQUEST_ID = "RequestID";
+ private static final String SUB_REQUEST_ID = "SubRequestID";
+
+ private static final String TIME_STAMP_FOR_SLI = "timeStamp";
+ private static final String REQUEST_ID_FOR_SLI = "requestID";
+ private static final String SUB_REQUEST_ID_FOR_SLI = "subRequestID";
+
+ private static final String CONFIGURATION_PHY_CELL_ID_INPUT = "configuration-phy-cell-id-input.";
private static final String EMPTY = "";
private static final String ESCAPE_SEQUENCE_QUOTES = "\"";
@@ -104,9 +114,9 @@ public class OofPciPocDmaapConsumers extends SdncDmaapConsumerImpl {
protected String publish(String templatePath, String jsonString, JsonNode configurationsOrDataNode, boolean invokePciChangesPublish, boolean invokeAnrChangesPublish) throws IOException, InvalidMessageException
{
if (invokePciChangesPublish){
- return publishPciChangesFromPolicyToSDNR(templatePath, configurationsOrDataNode);
+ return publishPciChangesFromPolicyToSDNR(templatePath, configurationsOrDataNode, jsonString);
} else if (invokeAnrChangesPublish){
- return publishANRChangesFromPolicyToSDNR(templatePath, configurationsOrDataNode);
+ return publishANRChangesFromPolicyToSDNR(templatePath, configurationsOrDataNode, jsonString);
} else {
return publishFullMessage(templatePath, jsonString);
}
@@ -138,7 +148,7 @@ public class OofPciPocDmaapConsumers extends SdncDmaapConsumerImpl {
return writer.toString();
}
- private String publishANRChangesFromPolicyToSDNR(String templatePath, JsonNode dataNode) throws IOException, InvalidMessageException
+ private String publishANRChangesFromPolicyToSDNR(String templatePath, JsonNode dataNode, String msg) throws IOException, InvalidMessageException
{
VelocityContext context = new VelocityContext();
@@ -156,6 +166,29 @@ public class OofPciPocDmaapConsumers extends SdncDmaapConsumerImpl {
JSONObject alias = new JSONObject();
JSONArray sliParametersArray = new JSONArray();
+ ObjectMapper oMapper = new ObjectMapper();
+
+ JsonNode dmaapMessageRootNode;
+ try {
+ dmaapMessageRootNode = oMapper.readTree(msg);
+ } catch (Exception e) {
+ throw new InvalidMessageException("Cannot parse json object", e);
+ }
+
+ JsonNode commonHeader = dmaapMessageRootNode.get(BODY).get(INPUT).get(COMMON_HEADER);
+
+ JsonNode timeStamp = commonHeader.get(TIME_STAMP);
+
+ JsonNode requestID = commonHeader.get(REQUEST_ID);
+
+ JsonNode subRequestID = commonHeader.get(SUB_REQUEST_ID);
+
+ sliParametersArray.put(new JSONObject().put(PARAMETER_NAME, GENERIC_NEIGHBOR_CONFIGURATION_INPUT+TIME_STAMP_FOR_SLI).put(STRING_VALUE,timeStamp));
+
+ sliParametersArray.put(new JSONObject().put(PARAMETER_NAME, GENERIC_NEIGHBOR_CONFIGURATION_INPUT+REQUEST_ID_FOR_SLI).put(STRING_VALUE,requestID));
+
+ sliParametersArray.put(new JSONObject().put(PARAMETER_NAME, GENERIC_NEIGHBOR_CONFIGURATION_INPUT+SUB_REQUEST_ID_FOR_SLI).put(STRING_VALUE,subRequestID));
+
String aliasValue = dataNode.get(DATA).get(FAP_SERVICE).get(ALIAS_LABEL).textValue();
JsonNode nbrListInUse = dataNode.get(DATA).get(FAP_SERVICE).get(CELL_CONFIG).get(LTE).get(RAN).get(NEIGHBOR_LIST_IN_USE).get(LTE_CELL);
@@ -203,7 +236,7 @@ public class OofPciPocDmaapConsumers extends SdncDmaapConsumerImpl {
}
- private String publishPciChangesFromPolicyToSDNR(String templatePath, JsonNode configurationsJsonNode) throws IOException, InvalidMessageException
+ private String publishPciChangesFromPolicyToSDNR(String templatePath, JsonNode configurationsJsonNode, String msg) throws IOException, InvalidMessageException
{
String RPC_NAME_KEY_IN_VT = "rpc_name";
String RPC_NAME_VALUE_IN_VT = "configuration-phy-cell-id";
@@ -217,6 +250,29 @@ public class OofPciPocDmaapConsumers extends SdncDmaapConsumerImpl {
JsonNode configurations = configurationsJsonNode.get(CONFIGURATIONS);
+ ObjectMapper oMapper = new ObjectMapper();
+
+ JsonNode dmaapMessageRootNode;
+ try {
+ dmaapMessageRootNode = oMapper.readTree(msg);
+ } catch (Exception e) {
+ throw new InvalidMessageException("Cannot parse json object", e);
+ }
+
+ JsonNode commonHeader = dmaapMessageRootNode.get(BODY).get(INPUT).get(COMMON_HEADER);
+
+ JsonNode timeStamp = commonHeader.get(TIME_STAMP);
+
+ JsonNode requestID = commonHeader.get(REQUEST_ID);
+
+ JsonNode subRequestID = commonHeader.get(SUB_REQUEST_ID);
+
+ sliParametersArray.put(new JSONObject().put(PARAMETER_NAME, CONFIGURATION_PHY_CELL_ID_INPUT+TIME_STAMP_FOR_SLI).put(STRING_VALUE,timeStamp));
+
+ sliParametersArray.put(new JSONObject().put(PARAMETER_NAME, CONFIGURATION_PHY_CELL_ID_INPUT+REQUEST_ID_FOR_SLI).put(STRING_VALUE,requestID));
+
+ sliParametersArray.put(new JSONObject().put(PARAMETER_NAME, CONFIGURATION_PHY_CELL_ID_INPUT+SUB_REQUEST_ID_FOR_SLI).put(STRING_VALUE,subRequestID));
+
int entryCount = 0;
if(configurations.isArray()) {
@@ -390,6 +446,7 @@ public class OofPciPocDmaapConsumers extends SdncDmaapConsumerImpl {
return;
}
+
if(!MODIFY_CONFIG.equals(action.textValue())) {
LOG.info("Unknown Action {}", action);
return;