summaryrefslogtreecommitdiffstats
path: root/appc-outbound/appc-network-inventory-client/provider/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'appc-outbound/appc-network-inventory-client/provider/src/main')
-rw-r--r--appc-outbound/appc-network-inventory-client/provider/src/main/java/org/onap/appc/instar/node/InstarClientNode.java27
-rwxr-xr-xappc-outbound/appc-network-inventory-client/provider/src/main/resources/templates/sampleKeyContents1
2 files changed, 17 insertions, 11 deletions
diff --git a/appc-outbound/appc-network-inventory-client/provider/src/main/java/org/onap/appc/instar/node/InstarClientNode.java b/appc-outbound/appc-network-inventory-client/provider/src/main/java/org/onap/appc/instar/node/InstarClientNode.java
index 797bbd5e7..4087e2ad2 100644
--- a/appc-outbound/appc-network-inventory-client/provider/src/main/java/org/onap/appc/instar/node/InstarClientNode.java
+++ b/appc-outbound/appc-network-inventory-client/provider/src/main/java/org/onap/appc/instar/node/InstarClientNode.java
@@ -5,6 +5,8 @@
* Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Copyright (C) 2017 Amdocs
+ * ================================================================================
+ * Modifications Copyright (C) 2018 Ericsson
* =============================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -46,6 +48,7 @@ public class InstarClientNode implements SvcLogicJavaPlugin {
private static final EELFLogger log = EELFManager.getInstance().getLogger(InstarClientNode.class);
+
public void getInstarInfo(Map<String, String> inParams, SvcLogicContext ctx)
throws SvcLogicException {
log.info("Received getInstarInfo call with params : " + inParams);
@@ -57,25 +60,26 @@ public class InstarClientNode implements SvcLogicJavaPlugin {
log.info("Processing Key : " + instarKey);
log.info("Searching key for : " + "INSTAR." + instarKey);
ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
- RuleHandlerInterface handler;
log.info("Received Context : " + ctx.getAttribute("INSTAR." + instarKey));
Parameter params = mapper
.readValue(ctx.getAttribute(InstarClientConstant.SOURCE_SYSTEM_INSTAR + "." + instarKey),
Parameter.class);
-
+ RuleHandlerInterface handler;
log.info("Processing rule Type : " + params.getRuleType());
if (params.getRuleType().equals(InstarClientConstant.INTERFACE_IP_ADDRESS)) {
- handler = new InterfaceIpAddressImpl(params, ctx);
+ handler = createHandler(params, ctx);
} else {
throw new SvcLogicException("No Rule Defined to process :" + params.getRuleType());
}
handler.processRule();
}
log.info("responsePrefix =" + responsePrefix);
+ log.info("instar key values =" + ctx.getAttribute(InstarClientConstant.INSTAR_KEY_VALUES));
ctx.setAttribute(responsePrefix + InstarClientConstant.INSTAR_KEY_VALUES,
ctx.getAttribute(InstarClientConstant.INSTAR_KEY_VALUES));
ctx.setAttribute(responsePrefix + InstarClientConstant.OUTPUT_PARAM_STATUS,
InstarClientConstant.OUTPUT_STATUS_SUCCESS);
+ log.info(ctx.getAttribute("TEST." + InstarClientConstant.OUTPUT_PARAM_STATUS));
ctx.setAttribute(InstarClientConstant.INSTAR_KEY_VALUES, null);
} catch (Exception e) {
ctx.setAttribute(responsePrefix + InstarClientConstant.OUTPUT_PARAM_STATUS,
@@ -88,12 +92,10 @@ public class InstarClientNode implements SvcLogicJavaPlugin {
private static String[] getKeys(String keyString) {
log.error("Received Key String as :" + keyString);
-
String key = keyString
.replace("[", "")
.replace("]", "")
.replace("\"", "");
-
if (key.contains(",")) {
return key.split(",");
} else {
@@ -108,14 +110,12 @@ public class InstarClientNode implements SvcLogicJavaPlugin {
try {
HashMap<String, String> input = new HashMap<>();
input.putAll(inParams);
- RestClientInterface rcINterface = new InstarRestClientImpl(input);
+ RestClientInterface rcINterface = createRestClientInterface(input);
String response = rcINterface.sendRequest(inParams.get("operationName"));
-
responsePrefix = StringUtils.isNotBlank(responsePrefix) ? responsePrefix + "." : "";
ctx.setAttribute(responsePrefix + InstarClientConstant.OUTPUT_PARAM_STATUS,
InstarClientConstant.OUTPUT_STATUS_SUCCESS);
ctx.setAttribute(responsePrefix + InstarClientConstant.INSTAR_KEY_VALUES, response);
-
} catch (Exception e) {
ctx.setAttribute(responsePrefix + InstarClientConstant.OUTPUT_PARAM_STATUS,
InstarClientConstant.OUTPUT_STATUS_FAILURE);
@@ -135,12 +135,11 @@ public class InstarClientNode implements SvcLogicJavaPlugin {
log.info("Processing Key : " + aaiKey);
log.info("Searching key for : " + "AAI." + aaiKey);
ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
- RuleHandlerInterface handler;
log.info("Received Context : " + ctx.getAttribute("AAI." + aaiKey));
Parameter params = mapper.readValue(
ctx.getAttribute(AaiClientConstant.SOURCE_SYSTEM_AAI + "." + aaiKey), Parameter.class);
log.info("Processing rule Type : " + params.getRuleType());
- handler = new AaiInterfaceRulesHandler(params, ctx);
+ RuleHandlerInterface handler = new AaiInterfaceRulesHandler(params, ctx);
handler.processRule();
}
log.info("responsePrefix =" + responsePrefix);
@@ -157,4 +156,12 @@ public class InstarClientNode implements SvcLogicJavaPlugin {
throw new SvcLogicException(e.getMessage());
}
}
+
+ protected RuleHandlerInterface createHandler(Parameter params, SvcLogicContext ctx) {
+ return new InterfaceIpAddressImpl(params, ctx);
+ }
+
+ protected RestClientInterface createRestClientInterface(Map<String, String> input) {
+ return new InstarRestClientImpl(input);
+ }
}
diff --git a/appc-outbound/appc-network-inventory-client/provider/src/main/resources/templates/sampleKeyContents b/appc-outbound/appc-network-inventory-client/provider/src/main/resources/templates/sampleKeyContents
deleted file mode 100755
index 90e3ec789..000000000
--- a/appc-outbound/appc-network-inventory-client/provider/src/main/resources/templates/sampleKeyContents
+++ /dev/null
@@ -1 +0,0 @@
-{"name":"LOCAL_ACCESS_IP_ADDR","description":"this is the node0 tacplus server IP address","type":"ipv4_address","required":true,"source":"INSTAR","rule-type":"interface-ip-address","default":null,"request-keys":null,"response-keys":[{"unique-key-name":"addressfqdn","unique-key-value":"00000000000000","field-key-name":"ipaddress-v4"}]} \ No newline at end of file