summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVENKATESH KUMAR <vv770d@att.com>2018-02-14 17:45:04 +0000
committerVENKATESH KUMAR <vv770d@att.com>2018-02-14 12:50:13 -0500
commit4d3624549f41aeda68b8626270fc491ea99e5ee0 (patch)
treeb7d931e1dc29a183b0f9b3496bdefe6f299ef74e
parent2dfdd151440cd80dc25c928f283df7bcd71cd195 (diff)
Fix keystore alais config and TC
Change-Id: I8e0349f411dc05625b14536afc0acb1fac9a55c2 Signed-off-by: VENKATESH KUMAR <vv770d@att.com> Issue-ID: DCAEGEN2-227
-rw-r--r--dpo/spec/vescollector-componentspec.json69
-rw-r--r--src/main/java/org/onap/dcae/commonFunction/CommonStartup.java630
-rw-r--r--src/main/java/org/onap/dcae/controller/FetchDynamicConfig.java54
-rw-r--r--src/main/java/org/onap/dcae/controller/LoadDynamicConfig.java73
-rw-r--r--src/main/scripts/VESrestfulCollector.sh23
-rw-r--r--src/test/java/org/onap/dcae/vestest/TestDmaapPropertyReader.java4
-rw-r--r--src/test/java/org/onap/dcae/vestest/TestEventProcessor.java23
-rw-r--r--src/test/java/org/onap/dcae/vestest/TestFetchConfig.java90
-rw-r--r--src/test/java/org/onap/dcae/vestest/TestLoadDynamicConfig.java57
-rw-r--r--src/test/java/org/onap/dcae/vestest/TestSchemaValidation.java18
-rw-r--r--src/test/java/org/onap/dcae/vestest/TestVESLogger.java115
-rw-r--r--src/test/resources/controller-config.json17
-rw-r--r--src/test/resources/controller-config_dmaap_ip.json239
-rw-r--r--src/test/resources/controller-config_singleline_ip.json1
-rw-r--r--src/test/resources/testDmaapConfig_ip.json (renamed from src/test/resources/testDmaapConfig.json)0
-rw-r--r--src/test/resources/test_collector_ip_op.properties78
-rw-r--r--src/test/resources/testcollector.properties150
17 files changed, 1082 insertions, 559 deletions
diff --git a/dpo/spec/vescollector-componentspec.json b/dpo/spec/vescollector-componentspec.json
index 1973e813..32144e2f 100644
--- a/dpo/spec/vescollector-componentspec.json
+++ b/dpo/spec/vescollector-componentspec.json
@@ -67,66 +67,6 @@
"version": "5.28.4",
"type": "message router",
"config_key": "ves-sipsignaling"
- },
- {
- "format": "VES_specification",
- "version": "5.28.4",
- "type": "message router",
- "config_key": "ves-fault-secondary"
- },
- {
- "format": "VES_specification",
- "version": "5.28.4",
- "type": "message router",
- "config_key": "ves-measurement-secondary"
- },
- {
- "format": "VES_specification",
- "version": "5.28.4",
- "type": "message router",
- "config_key": "ves-syslog-secondary"
- },
- {
- "format": "VES_specification",
- "version": "5.28.4",
- "type": "message router",
- "config_key": "ves-heartbeat-secondary"
- },
- {
- "format": "VES_specification",
- "version": "5.28.4",
- "type": "message router",
- "config_key": "ves-other-secondary"
- },
- {
- "format": "VES_specification",
- "version": "5.28.4",
- "type": "message router",
- "config_key": "ves-mobileflow-secondary"
- },
- {
- "format": "VES_specification",
- "version": "5.28.4",
- "type": "message router",
- "config_key": "ves-statechange-secondary"
- },
- {
- "format": "VES_specification",
- "version": "5.28.4",
- "type": "message router",
- "config_key": "ves-thresholdCrossingAlert-secondary"
- },
- {
- "format": "VES_specification",
- "version": "5.28.4",
- "type": "message router",
- "config_key": "ves-voicequality-secondary"
- },
- {
- "format": "VES_specification",
- "version": "5.28.4",
- "type": "message router",
- "config_key": "ves-sipsignaling-secondary"
}
]
},
@@ -228,7 +168,7 @@
},
{
"name": "collector.dmaap.streamid",
- "value": "fault=ves-fault,ves-fault-secondary|syslog=ves-syslog,ves-syslog-secondary|heartbeat=ves-heartbeat,ves-heartbeat-secondary|measurementsForVfScaling=ves-measurement,ves-measurement-secondary|mobileFlow=ves-mobileflow,ves-mobileflow-secondary|other=ves-other,ves-other-secondary|stateChange=ves-statechange,ves-statechange-secondary|thresholdCrossingAlert=ves-thresholdCrossingAlert,ves-thresholdCrossingAlert-secondary|voiceQuality=ves-voicequality,ves-voicequality-secondary|sipSignaling=ves-sipsignaling,ves-sipsignaling-secondary",
+ "value": "fault=ves-fault|syslog=ves-syslog|heartbeat=ves-heartbeat|measurementsForVfScaling=ves-measurement|mobileFlow=ves-mobileflow|other=ves-other|stateChange=ves-statechange|thresholdCrossingAlert=ves-thresholdCrossingAlert|voiceQuality=ves-voicequality|sipSignaling=ves-sipsignaling",
"description": "domain-streamid mapping"
},
{
@@ -284,7 +224,7 @@
"bind": "/opt/app/VESCollector/logs"
},
"host": {
- "path": "/opt/data/DCAE/VESCollector/logs"
+ "path": "/opt/logs/DCAE/VESCollector/logs"
}
}
],
@@ -295,10 +235,7 @@
"artifacts": [
{
"type": "docker image",
- "uri": "nexus.onap.org:10001/onap/org.onap.dcaegen2.collectors.ves.vescollector:1.1"
-
-
+ "uri": "nexus.onap.org:10001/onap/org.onap.dcaegen2.collectors.ves.vescollector:1.1"
}
]
}
-
diff --git a/src/main/java/org/onap/dcae/commonFunction/CommonStartup.java b/src/main/java/org/onap/dcae/commonFunction/CommonStartup.java
index d1dbca92..70da7744 100644
--- a/src/main/java/org/onap/dcae/commonFunction/CommonStartup.java
+++ b/src/main/java/org/onap/dcae/commonFunction/CommonStartup.java
@@ -1,316 +1,314 @@
-/*-
- * ============LICENSE_START=======================================================
- * PROJECT
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.dcae.commonFunction;
-
-import com.att.nsa.apiServer.ApiServer;
-import com.att.nsa.apiServer.ApiServerConnector;
-import com.att.nsa.apiServer.endpoints.NsaBaseEndpoint;
-import com.att.nsa.cmdLine.NsaCommandLineUtil;
-import com.att.nsa.drumlin.service.framework.DrumlinServlet;
-import com.att.nsa.drumlin.till.nv.impl.nvPropertiesFile;
-import com.att.nsa.drumlin.till.nv.impl.nvReadableStack;
-import com.att.nsa.drumlin.till.nv.impl.nvReadableTable;
-import com.att.nsa.drumlin.till.nv.rrNvReadable;
-import com.att.nsa.drumlin.till.nv.rrNvReadable.invalidSettingValue;
-import com.att.nsa.drumlin.till.nv.rrNvReadable.loadException;
-import com.att.nsa.drumlin.till.nv.rrNvReadable.missingReqdSetting;
-import com.fasterxml.jackson.core.JsonParseException;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.github.fge.jsonschema.exceptions.ProcessingException;
-import com.github.fge.jsonschema.main.JsonSchema;
-import com.github.fge.jsonschema.main.JsonSchemaFactory;
-import com.github.fge.jsonschema.report.ProcessingMessage;
-import com.github.fge.jsonschema.report.ProcessingReport;
-import com.github.fge.jsonschema.util.JsonLoader;
-import org.apache.catalina.LifecycleException;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-import org.onap.dcae.restapi.RestfulCollectorServlet;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.net.URL;
-import java.nio.charset.Charset;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Queue;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.LinkedBlockingQueue;
-import javax.servlet.ServletException;
-
-public class CommonStartup extends NsaBaseEndpoint implements Runnable {
-
- public static final String KCONFIG = "c";
-
- public static final String KSETTING_PORT = "collector.service.port";
- public static final int KDEFAULT_PORT = 8080;
-
- public static final String KSETTING_SECUREPORT = "collector.service.secure.port";
- public static final int KDEFAULT_SECUREPORT = -1;
-
- public static final String KSETTING_KEYSTOREPASSFILE = "collector.keystore.passwordfile";
- public static final String KDEFAULT_KEYSTOREPASSFILE = "../etc/passwordfile";
- public static final String KSETTING_KEYSTOREFILE = "collector.keystore.file.location";
- public static final String KDEFAULT_KEYSTOREFILE = "../etc/keystore";
- public static final String KSETTING_KEYALIAS = "collector.keystore.alias";
- public static final String KDEFAULT_KEYALIAS = "tomcat";
-
- public static final String KSETTING_DMAAPCONFIGS = "collector.dmaapfile";
- private static final String[] KDEFAULT_DMAAPCONFIGS = new String[] { "/etc/DmaapConfig.json" };
-
- public static final String KSETTING_MAXQUEUEDEVENTS = "collector.inputQueue.maxPending";
- public static final int KDEFAULT_MAXQUEUEDEVENTS = 1024 * 4;
-
- public static final String KSETTING_SCHEMAVALIDATOR = "collector.schema.checkflag";
- public static final int KDEFAULT_SCHEMAVALIDATOR = -1;
-
- public static final String KSETTING_SCHEMAFILE = "collector.schema.file";
- public static final String KDEFAULT_SCHEMAFILE = "{\"v5\":\"./etc/CommonEventFormat_28.3.json\"}";
- public static final String KSETTING_EXCEPTIONCONFIG = "exceptionConfig";
-
- public static final String KSETTING_DMAAPSTREAMID = "collector.dmaap.streamid";
-
- public static final String KSETTING_AUTHFLAG = "header.authflag";
- public static final int KDEFAULT_AUTHFLAG = 0;
-
- public static final String KSETTING_AUTHLIST = "header.authlist";
-
- public static final String KSETTING_EVENTTRANSFORMFLAG = "event.transform.flag";
- public static final int KDEFAULT_EVENTTRANSFORMFLAG = 1;
-
- public static final Logger inlog = LoggerFactory.getLogger("org.onap.dcae.commonFunction.input");
- public static final Logger oplog = LoggerFactory.getLogger("org.onap.dcae.commonFunction.output");
- public static final Logger eplog = LoggerFactory.getLogger("org.onap.dcae.commonFunction.error");
- public static final Logger metriclog = LoggerFactory.getLogger("com.att.ecomp.metrics");
-
- public static int schemaValidatorflag = -1;
- public static int authflag = 1;
- public static int eventTransformFlag = 1;
- public static String schemaFile;
- public static JSONObject schemaFileJson;
- public static String exceptionConfig;
- public static String cambriaConfigFile;
- private boolean listnerstatus;
- public static String streamid;
-
- public static LinkedBlockingQueue<JSONObject> fProcessingInputQueue;
- private static ApiServer fTomcatServer = null;
- private static final Logger log = LoggerFactory.getLogger(CommonStartup.class);
-
- private CommonStartup(rrNvReadable settings) throws loadException, IOException, rrNvReadable.missingReqdSetting,
- rrNvReadable.invalidSettingValue, ServletException, InterruptedException {
- final List<ApiServerConnector> connectors = new LinkedList<ApiServerConnector>();
-
- if (settings.getInt(KSETTING_PORT, KDEFAULT_PORT) > 0) {
- // http service
- connectors.add(new ApiServerConnector.Builder(settings.getInt(KSETTING_PORT, KDEFAULT_PORT)).secure(false)
- .build());
- }
-
- // optional https service
- final int securePort = settings.getInt(KSETTING_SECUREPORT, KDEFAULT_SECUREPORT);
- final String keystoreFile = settings.getString(KSETTING_KEYSTOREFILE, KDEFAULT_KEYSTOREFILE);
- final String keystorePasswordFile = settings.getString(KSETTING_KEYSTOREPASSFILE, KDEFAULT_KEYSTOREPASSFILE);
- final String keyAlias = settings.getString(KSETTING_KEYALIAS, KDEFAULT_KEYALIAS);
-
- if (securePort > 0) {
- final String KSETTING_KEYSTOREPASS = readFile(keystorePasswordFile, Charset.defaultCharset());
- connectors.add(new ApiServerConnector.Builder(securePort).secure(true)
- .keystorePassword(KSETTING_KEYSTOREPASS).keystoreFile(keystoreFile).keyAlias(keyAlias).build());
-
- }
-
- // Reading other config properties
-
- schemaValidatorflag = settings.getInt(KSETTING_SCHEMAVALIDATOR, KDEFAULT_SCHEMAVALIDATOR);
- if (schemaValidatorflag > 0) {
- schemaFile = settings.getString(KSETTING_SCHEMAFILE, KDEFAULT_SCHEMAFILE);
- // System.out.println("SchemaFile:" + schemaFile);
- schemaFileJson = new JSONObject(schemaFile);
-
- }
- exceptionConfig = settings.getString(KSETTING_EXCEPTIONCONFIG, null);
- authflag = settings.getInt(CommonStartup.KSETTING_AUTHFLAG, CommonStartup.KDEFAULT_AUTHFLAG);
- String[] currentconffile = settings.getStrings(CommonStartup.KSETTING_DMAAPCONFIGS,
- CommonStartup.KDEFAULT_DMAAPCONFIGS);
- cambriaConfigFile = currentconffile[0];
- streamid = settings.getString(KSETTING_DMAAPSTREAMID, null);
- eventTransformFlag = settings.getInt(KSETTING_EVENTTRANSFORMFLAG, KDEFAULT_EVENTTRANSFORMFLAG);
-
- fTomcatServer = new ApiServer.Builder(connectors, new RestfulCollectorServlet(settings)).encodeSlashes(true)
- .name("collector").build();
-
- // Load override exception map
- CustomExceptionLoader.LoadMap();
- setListnerstatus(true);
- }
-
- public static void main(String[] args) {
- ExecutorService executor = null;
- try {
- // process command line arguments
- final Map<String, String> argMap = NsaCommandLineUtil.processCmdLine(args, true);
- final String config = NsaCommandLineUtil.getSetting(argMap, KCONFIG, "collector.properties");
- final URL settingStream = DrumlinServlet.findStream(config, CommonStartup.class);
-
- final nvReadableStack settings = new nvReadableStack();
- settings.push(new nvPropertiesFile(settingStream));
- settings.push(new nvReadableTable(argMap));
-
- fProcessingInputQueue = new LinkedBlockingQueue<JSONObject>(CommonStartup.KDEFAULT_MAXQUEUEDEVENTS);
-
- VESLogger.setUpEcompLogging();
-
- CommonStartup cs = new CommonStartup(settings);
-
- Thread csmain = new Thread(cs);
- csmain.start();
-
- EventProcessor ep = new EventProcessor();
- // Thread epThread=new Thread(ep);
- // epThread.start();
- executor = Executors.newFixedThreadPool(20);
- //executor.execute(ep);
- for (int i = 0; i < 20; ++i) {
- executor.execute(ep);
- }
-
- } catch (loadException | missingReqdSetting | IOException | invalidSettingValue | ServletException
- | InterruptedException e) {
- CommonStartup.eplog.error("FATAL_STARTUP_ERROR" + e.getMessage());
- throw new RuntimeException(e);
- } catch (Throwable e) {
- System.err.println("Uncaught exception - " + e.getMessage());
- CommonStartup.eplog.error("FATAL_ERROR" + e.getMessage());
- e.printStackTrace(System.err);
- } finally {
- // This will make the executor accept no new threads
- // and finish all existing threads in the queue
- if (executor != null) {
- executor.shutdown();
- }
-
- }
- }
-
- public void run() {
- try {
- fTomcatServer.start();
- } catch (LifecycleException | IOException e) {
-
- log.error("lifecycle or IO: ", e);
- }
- fTomcatServer.await();
- }
-
- public boolean isListnerstatus() {
- return listnerstatus;
- }
-
- public void setListnerstatus(boolean listnerstatus) {
- this.listnerstatus = listnerstatus;
- }
-
- public static Queue<JSONObject> getProcessingInputQueue() {
- return fProcessingInputQueue;
- }
-
- public static class QueueFullException extends Exception {
-
- private static final long serialVersionUID = 1L;
- }
-
- public static void handleEvents(JSONArray a) throws QueueFullException, JSONException, IOException {
- final Queue<JSONObject> queue = getProcessingInputQueue();
- try {
-
- CommonStartup.metriclog.info("EVENT_PUBLISH_START");
- for (int i = 0; i < a.length(); i++) {
- if (!queue.offer(a.getJSONObject(i))) {
- throw new QueueFullException();
- }
-
- }
- log.debug("CommonStartup.handleEvents:EVENTS has been published successfully!");
- CommonStartup.metriclog.info("EVENT_PUBLISH_END");
- // ecomplogger.debug(secloggerMessageEnum.SEC_COLLECT_AND_PULIBISH_SUCCESS);
-
- } catch (JSONException e) {
- throw e;
-
- }
- }
-
- static String readFile(String path, Charset encoding) throws IOException {
- byte[] encoded = Files.readAllBytes(Paths.get(path));
- String pwd = new String(encoded);
- return pwd.substring(0, pwd.length() - 1);
- }
-
- public static String schemavalidate(String jsonData, String jsonSchema) {
- ProcessingReport report;
- String result = "false";
-
- try {
- // System.out.println("Applying schema: @<@<"+jsonSchema+">@>@ to
- // data: #<#<"+jsonData+">#>#");
- log.trace("Schema validation for event:" + jsonData);
- JsonNode schemaNode = JsonLoader.fromString(jsonSchema);
- JsonNode data = JsonLoader.fromString(jsonData);
- JsonSchemaFactory factory = JsonSchemaFactory.byDefault();
- JsonSchema schema = factory.getJsonSchema(schemaNode);
- report = schema.validate(data);
- } catch (JsonParseException e) {
- log.error("schemavalidate:JsonParseException for event:" + jsonData);
- return e.getMessage();
- } catch (ProcessingException e) {
- log.error("schemavalidate:Processing exception for event:" + jsonData);
- return e.getMessage();
- } catch (IOException e) {
- log.error(
- "schemavalidate:IO exception; something went wrong trying to read json data for event:" + jsonData);
- return e.getMessage();
- }
- if (report != null) {
- Iterator<ProcessingMessage> iter = report.iterator();
- while (iter.hasNext()) {
- ProcessingMessage pm = iter.next();
- log.trace("Processing Message: " + pm.getMessage());
- }
- result = String.valueOf(report.isSuccess());
- }
- try {
- log.debug("Validation Result:" + result + " Validation report:" + report);
- } catch (NullPointerException e) {
- log.error("schemavalidate:NullpointerException on report");
- }
- return result;
- }
-
-
-}
+/*-
+ * ============LICENSE_START=======================================================
+ * PROJECT
+ * ================================================================================
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.dcae.commonFunction;
+
+import com.att.nsa.apiServer.ApiServer;
+import com.att.nsa.apiServer.ApiServerConnector;
+import com.att.nsa.apiServer.endpoints.NsaBaseEndpoint;
+import com.att.nsa.cmdLine.NsaCommandLineUtil;
+import com.att.nsa.drumlin.service.framework.DrumlinServlet;
+import com.att.nsa.drumlin.till.nv.impl.nvPropertiesFile;
+import com.att.nsa.drumlin.till.nv.impl.nvReadableStack;
+import com.att.nsa.drumlin.till.nv.impl.nvReadableTable;
+import com.att.nsa.drumlin.till.nv.rrNvReadable;
+import com.att.nsa.drumlin.till.nv.rrNvReadable.invalidSettingValue;
+import com.att.nsa.drumlin.till.nv.rrNvReadable.loadException;
+import com.att.nsa.drumlin.till.nv.rrNvReadable.missingReqdSetting;
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.github.fge.jsonschema.exceptions.ProcessingException;
+import com.github.fge.jsonschema.main.JsonSchema;
+import com.github.fge.jsonschema.main.JsonSchemaFactory;
+import com.github.fge.jsonschema.report.ProcessingMessage;
+import com.github.fge.jsonschema.report.ProcessingReport;
+import com.github.fge.jsonschema.util.JsonLoader;
+import org.apache.catalina.LifecycleException;
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+import org.onap.dcae.restapi.RestfulCollectorServlet;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.net.URL;
+import java.nio.charset.Charset;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Queue;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.LinkedBlockingQueue;
+import javax.servlet.ServletException;
+
+public class CommonStartup extends NsaBaseEndpoint implements Runnable {
+
+ public static final String KCONFIG = "c";
+
+ public static final String KSETTING_PORT = "collector.service.port";
+ public static final int KDEFAULT_PORT = 8080;
+
+ public static final String KSETTING_SECUREPORT = "collector.service.secure.port";
+ public static final int KDEFAULT_SECUREPORT = -1;
+
+ public static final String KSETTING_KEYSTOREPASSFILE = "collector.keystore.passwordfile";
+ public static final String KDEFAULT_KEYSTOREPASSFILE = "../etc/passwordfile";
+ public static final String KSETTING_KEYSTOREFILE = "collector.keystore.file.location";
+ public static final String KDEFAULT_KEYSTOREFILE = "../etc/keystore";
+ public static final String KSETTING_KEYALIAS = "collector.keystore.alias";
+ public static final String KDEFAULT_KEYALIAS = "tomcat";
+
+ public static final String KSETTING_DMAAPCONFIGS = "collector.dmaapfile";
+ protected static final String[] KDEFAULT_DMAAPCONFIGS = new String[] { "/etc/DmaapConfig.json" };
+
+ public static final String KSETTING_MAXQUEUEDEVENTS = "collector.inputQueue.maxPending";
+ public static final int KDEFAULT_MAXQUEUEDEVENTS = 1024 * 4;
+
+ public static final String KSETTING_SCHEMAVALIDATOR = "collector.schema.checkflag";
+ public static final int KDEFAULT_SCHEMAVALIDATOR = -1;
+
+ public static final String KSETTING_SCHEMAFILE = "collector.schema.file";
+ public static final String KDEFAULT_SCHEMAFILE = "{\"v5\":\"./etc/CommonEventFormat_28.3.json\"}";
+ public static final String KSETTING_EXCEPTIONCONFIG = "exceptionConfig";
+
+ public static final String KSETTING_DMAAPSTREAMID = "collector.dmaap.streamid";
+
+ public static final String KSETTING_AUTHFLAG = "header.authflag";
+ public static final int KDEFAULT_AUTHFLAG = 0;
+
+ public static final String KSETTING_AUTHLIST = "header.authlist";
+
+ public static final String KSETTING_EVENTTRANSFORMFLAG = "event.transform.flag";
+ public static final int KDEFAULT_EVENTTRANSFORMFLAG = 1;
+
+ public static final Logger inlog = LoggerFactory.getLogger("org.onap.dcae.commonFunction.input");
+ public static final Logger oplog = LoggerFactory.getLogger("org.onap.dcae.commonFunction.output");
+ public static final Logger eplog = LoggerFactory.getLogger("org.onap.dcae.commonFunction.error");
+ public static final Logger metriclog = LoggerFactory.getLogger("com.att.ecomp.metrics");
+
+ public static int schemaValidatorflag = -1;
+ public static int authflag = 1;
+ public static int eventTransformFlag = 1;
+ public static String schemaFile;
+ public static JSONObject schemaFileJson;
+ public static String exceptionConfig;
+ public static String cambriaConfigFile;
+ private boolean listnerstatus;
+ public static String streamid;
+
+ public static LinkedBlockingQueue<JSONObject> fProcessingInputQueue;
+ private static ApiServer fTomcatServer = null;
+ private static final Logger log = LoggerFactory.getLogger(CommonStartup.class);
+
+ private CommonStartup(rrNvReadable settings) throws loadException, IOException, rrNvReadable.missingReqdSetting,
+ rrNvReadable.invalidSettingValue, ServletException, InterruptedException {
+ final List<ApiServerConnector> connectors = new LinkedList<ApiServerConnector>();
+
+ if (settings.getInt(KSETTING_PORT, KDEFAULT_PORT) > 0) {
+ // http service
+ connectors.add(new ApiServerConnector.Builder(settings.getInt(KSETTING_PORT, KDEFAULT_PORT)).secure(false)
+ .build());
+ }
+
+ // optional https service
+ final int securePort = settings.getInt(KSETTING_SECUREPORT, KDEFAULT_SECUREPORT);
+ final String keystoreFile = settings.getString(KSETTING_KEYSTOREFILE, KDEFAULT_KEYSTOREFILE);
+ final String keystorePasswordFile = settings.getString(KSETTING_KEYSTOREPASSFILE, KDEFAULT_KEYSTOREPASSFILE);
+ final String keyAlias = settings.getString(KSETTING_KEYALIAS, KDEFAULT_KEYALIAS);
+
+ if (securePort > 0) {
+ final String KSETTING_KEYSTOREPASS = readFile(keystorePasswordFile, Charset.defaultCharset());
+ connectors.add(new ApiServerConnector.Builder(securePort).secure(true)
+ .keystorePassword(KSETTING_KEYSTOREPASS).keystoreFile(keystoreFile).keyAlias(keyAlias).build());
+
+ }
+
+ // Reading other config properties
+
+ schemaValidatorflag = settings.getInt(KSETTING_SCHEMAVALIDATOR, KDEFAULT_SCHEMAVALIDATOR);
+ if (schemaValidatorflag > 0) {
+ schemaFile = settings.getString(KSETTING_SCHEMAFILE, KDEFAULT_SCHEMAFILE);
+ // System.out.println("SchemaFile:" + schemaFile);
+ schemaFileJson = new JSONObject(schemaFile);
+
+ }
+ exceptionConfig = settings.getString(KSETTING_EXCEPTIONCONFIG, null);
+ authflag = settings.getInt(CommonStartup.KSETTING_AUTHFLAG, CommonStartup.KDEFAULT_AUTHFLAG);
+ String[] currentconffile = settings.getStrings(CommonStartup.KSETTING_DMAAPCONFIGS,
+ CommonStartup.KDEFAULT_DMAAPCONFIGS);
+ cambriaConfigFile = currentconffile[0];
+ streamid = settings.getString(KSETTING_DMAAPSTREAMID, null);
+ eventTransformFlag = settings.getInt(KSETTING_EVENTTRANSFORMFLAG, KDEFAULT_EVENTTRANSFORMFLAG);
+
+ fTomcatServer = new ApiServer.Builder(connectors, new RestfulCollectorServlet(settings)).encodeSlashes(true)
+ .name("collector").build();
+
+ // Load override exception map
+ CustomExceptionLoader.LoadMap();
+ setListnerstatus(true);
+ }
+
+ public static void main(String[] args) {
+ ExecutorService executor = null;
+ try {
+ // process command line arguments
+ final Map<String, String> argMap = NsaCommandLineUtil.processCmdLine(args, true);
+ final String config = NsaCommandLineUtil.getSetting(argMap, KCONFIG, "collector.properties");
+ final URL settingStream = DrumlinServlet.findStream(config, CommonStartup.class);
+
+ final nvReadableStack settings = new nvReadableStack();
+ settings.push(new nvPropertiesFile(settingStream));
+ settings.push(new nvReadableTable(argMap));
+
+ fProcessingInputQueue = new LinkedBlockingQueue<JSONObject>(CommonStartup.KDEFAULT_MAXQUEUEDEVENTS);
+
+ VESLogger.setUpEcompLogging();
+
+ CommonStartup cs = new CommonStartup(settings);
+
+ Thread csmain = new Thread(cs);
+ csmain.start();
+
+ EventProcessor ep = new EventProcessor();
+ executor = Executors.newFixedThreadPool(20);
+ //executor.execute(ep);
+ for (int i = 0; i < 20; ++i) {
+ executor.execute(ep);
+ }
+
+ } catch (loadException | missingReqdSetting | IOException | invalidSettingValue | ServletException
+ | InterruptedException e) {
+ CommonStartup.eplog.error("FATAL_STARTUP_ERROR" + e.getMessage());
+ throw new RuntimeException(e);
+ } catch (Throwable e) {
+ System.err.println("Uncaught exception - " + e.getMessage());
+ CommonStartup.eplog.error("FATAL_ERROR" + e.getMessage());
+ e.printStackTrace(System.err);
+ } finally {
+ // This will make the executor accept no new threads
+ // and finish all existing threads in the queue
+ /*if (executor != null) {
+ executor.shutdown();
+ }*/
+
+ }
+ }
+
+ public void run() {
+ try {
+ fTomcatServer.start();
+ } catch (LifecycleException | IOException e) {
+
+ log.error("lifecycle or IO: ", e);
+ }
+ fTomcatServer.await();
+ }
+
+ public boolean isListnerstatus() {
+ return listnerstatus;
+ }
+
+ public void setListnerstatus(boolean listnerstatus) {
+ this.listnerstatus = listnerstatus;
+ }
+
+ public static Queue<JSONObject> getProcessingInputQueue() {
+ return fProcessingInputQueue;
+ }
+
+ public static class QueueFullException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+ }
+
+ public static void handleEvents(JSONArray a) throws QueueFullException, JSONException, IOException {
+ final Queue<JSONObject> queue = getProcessingInputQueue();
+ try {
+
+ CommonStartup.metriclog.info("EVENT_PUBLISH_START");
+ for (int i = 0; i < a.length(); i++) {
+ if (!queue.offer(a.getJSONObject(i))) {
+ throw new QueueFullException();
+ }
+
+ }
+ log.debug("CommonStartup.handleEvents:EVENTS has been published successfully!");
+ CommonStartup.metriclog.info("EVENT_PUBLISH_END");
+ // ecomplogger.debug(secloggerMessageEnum.SEC_COLLECT_AND_PULIBISH_SUCCESS);
+
+ } catch (JSONException e) {
+ throw e;
+
+ }
+ }
+
+ static String readFile(String path, Charset encoding) throws IOException {
+ byte[] encoded = Files.readAllBytes(Paths.get(path));
+ String pwd = new String(encoded);
+ return pwd.substring(0, pwd.length() - 1);
+ }
+
+ public static String schemavalidate(String jsonData, String jsonSchema) {
+ ProcessingReport report;
+ String result = "false";
+
+ try {
+ // System.out.println("Applying schema: @<@<"+jsonSchema+">@>@ to
+ // data: #<#<"+jsonData+">#>#");
+ log.trace("Schema validation for event:" + jsonData);
+ JsonNode schemaNode = JsonLoader.fromString(jsonSchema);
+ JsonNode data = JsonLoader.fromString(jsonData);
+ JsonSchemaFactory factory = JsonSchemaFactory.byDefault();
+ JsonSchema schema = factory.getJsonSchema(schemaNode);
+ report = schema.validate(data);
+ } catch (JsonParseException e) {
+ log.error("schemavalidate:JsonParseException for event:" + jsonData);
+ return e.getMessage();
+ } catch (ProcessingException e) {
+ log.error("schemavalidate:Processing exception for event:" + jsonData);
+ return e.getMessage();
+ } catch (IOException e) {
+ log.error(
+ "schemavalidate:IO exception; something went wrong trying to read json data for event:" + jsonData);
+ return e.getMessage();
+ }
+ if (report != null) {
+ Iterator<ProcessingMessage> iter = report.iterator();
+ while (iter.hasNext()) {
+ ProcessingMessage pm = iter.next();
+ log.trace("Processing Message: " + pm.getMessage());
+ }
+ result = String.valueOf(report.isSuccess());
+ }
+ try {
+ log.debug("Validation Result:" + result + " Validation report:" + report);
+ } catch (NullPointerException e) {
+ log.error("schemavalidate:NullpointerException on report");
+ }
+ return result;
+ }
+
+
+}
diff --git a/src/main/java/org/onap/dcae/controller/FetchDynamicConfig.java b/src/main/java/org/onap/dcae/controller/FetchDynamicConfig.java
index 82d4bba3..95e95747 100644
--- a/src/main/java/org/onap/dcae/controller/FetchDynamicConfig.java
+++ b/src/main/java/org/onap/dcae/controller/FetchDynamicConfig.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* PROJECT
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -36,7 +36,7 @@ public class FetchDynamicConfig {
private static final Logger log = LoggerFactory.getLogger(FetchDynamicConfig.class);
- static String configFile = "/opt/app/KV-Configuration.json";
+ public static String configFile = "/opt/app/KV-Configuration.json";
static String url;
static String retString;
@@ -49,8 +49,8 @@ public class FetchDynamicConfig {
log.info("%s=%s%n", entry.getKey(), entry.getValue());
}
- if (env.containsKey("CONSUL_HOST") && env.containsKey("CONFIG_BINDING_SERVICE")
- && env.containsKey("HOSTNAME")) {
+ if (env.containsKey("CONSUL_HOST") && env.containsKey("CONFIG_BINDING_SERVICE")) {
+// && env.containsKey("HOSTNAME")) {
log.info(">>>Dynamic configuration to be fetched from ConfigBindingService");
url = env.get("CONSUL_HOST") + ":8500/v1/catalog/service/" + env.get("CONFIG_BINDING_SERVICE");
@@ -65,23 +65,47 @@ public class FetchDynamicConfig {
}
log.info("CONFIG_BINDING_SERVICE DNS RESOLVED:" + urlPart1);
- url = urlPart1 + "/service_component/" + env.get("HOSTNAME");
- retString = executecurl(url);
-
- JSONObject jsonObject = new JSONObject(new JSONTokener(retString));
- try (FileWriter file = new FileWriter(configFile)) {
- file.write(jsonObject.toString());
-
- log.info("Successfully Copied JSON Object to file /opt/app/KV-Configuration.json");
- } catch (IOException e) {
- log.error("Error in writing configuration into file /opt/app/KV-Configuration.json " + jsonObject, e);
- e.printStackTrace();
+ FetchDynamicConfig fc= new FetchDynamicConfig();
+ if (env.containsKey("HOSTNAME"))
+ {
+ url = urlPart1 + "/service_component/" + env.get("HOSTNAME");
+ retString = executecurl(url);
+ }
+ else if (env.containsKey("SERVICE_NAME"))
+ {
+ url = urlPart1 + "/service_component/" + env.get("SERVICE_NAME");
+ retString = executecurl(url);
+ }
+ else
+ {
+ log.error("Service name environment variable - HOSTNAME/SERVICE_NAME not found within container ");
}
+ fc.writefile(retString);
+
+
} else {
log.info(">>>Static configuration to be used");
}
}
+
+ public void writefile (String retString)
+ {
+ log.info("URL to fetch configuration:" + url + " Return String:" + retString);
+
+
+ String indentedretstring=(new JSONObject(retString)).toString(4);
+
+ try (FileWriter file = new FileWriter(FetchDynamicConfig.configFile)) {
+ file.write(indentedretstring);
+
+ log.info("Successfully Copied JSON Object to file /opt/app/KV-Configuration.json");
+ } catch (IOException e) {
+ log.error("Error in writing configuration into file /opt/app/KV-Configuration.json " + retString, e);
+ e.printStackTrace();
+ }
+
+ }
public static String executecurl(String url) {
diff --git a/src/main/java/org/onap/dcae/controller/LoadDynamicConfig.java b/src/main/java/org/onap/dcae/controller/LoadDynamicConfig.java
index 2db4ff42..9184c3e7 100644
--- a/src/main/java/org/onap/dcae/controller/LoadDynamicConfig.java
+++ b/src/main/java/org/onap/dcae/controller/LoadDynamicConfig.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* PROJECT
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -42,6 +42,7 @@ public class LoadDynamicConfig {
public String configFile = "/opt/app/KV-Configuration.json";
static String url;
static String retString;
+ public String dmaapoutputfile = "./etc/DmaapConfig.json";
public LoadDynamicConfig() {
@@ -59,35 +60,10 @@ public class LoadDynamicConfig {
LoadDynamicConfig lc = new LoadDynamicConfig();
String jsonData = readFile(lc.configFile);
JSONObject jsonObject = new JSONObject(jsonData);
+ lc.writeconfig(jsonObject);
+
- PropertiesConfiguration conf;
- conf = new PropertiesConfiguration(lc.propFile);
- conf.setEncoding(null);
-
- // update properties based on consul dynamic configuration
- Iterator<?> keys = jsonObject.keys();
-
- while (keys.hasNext()) {
- String key = (String) keys.next();
- // check if any configuration is related to dmaap
- // and write into dmaapconfig.json
- if (key.startsWith("streams_publishes")) {
- // VESCollector only have publish streams
- try (FileWriter file = new FileWriter("./etc/DmaapConfig.json")) {
- file.write(jsonObject.get(key).toString());
- log.info("Successfully written JSON Object to DmaapConfig.json");
- file.close();
- } catch (IOException e) {
- log.info("Error in writing dmaap configuration into DmaapConfig.json", e);
- }
- } else {
- conf.setProperty(key, jsonObject.get(key).toString());
- }
-
- }
- conf.save();
-
- } catch (ConfigurationException e) {
+ } catch (Exception e) {
log.error(e.getLocalizedMessage(), e);
e.printStackTrace();
@@ -98,6 +74,45 @@ public class LoadDynamicConfig {
}
}
+
+ public void writeconfig (JSONObject jsonObject)
+ {
+
+ PropertiesConfiguration conf;
+ try {
+ conf = new PropertiesConfiguration(propFile);
+
+ conf.setEncoding(null);
+
+ // update properties based on consul dynamic configuration
+ Iterator<?> keys = jsonObject.keys();
+
+ while (keys.hasNext()) {
+ String key = (String) keys.next();
+ // check if any configuration is related to dmaap
+ // and write into dmaapconfig.json
+ if (key.startsWith("streams_publishes")) {
+ // VESCollector only have publish streams
+ try (FileWriter file = new FileWriter(dmaapoutputfile)) {
+
+ String indentedretstring=(new JSONObject(jsonObject.get(key).toString())).toString(4);
+ file.write(indentedretstring);
+ log.info("Successfully written JSON Object to DmaapConfig.json");
+ file.close();
+ } catch (IOException e) {
+ log.info("Error in writing dmaap configuration into DmaapConfig.json", e);
+ }
+ } else {
+ conf.setProperty(key, jsonObject.get(key).toString());
+ }
+
+ }
+ conf.save();
+ } catch (ConfigurationException e) {
+ log.error(e.getLocalizedMessage(), e);
+ e.printStackTrace();
+ }
+ }
public static String readFile(String filename) {
String result = "";
diff --git a/src/main/scripts/VESrestfulCollector.sh b/src/main/scripts/VESrestfulCollector.sh
index 45bdc6ef..14e90cc9 100644
--- a/src/main/scripts/VESrestfulCollector.sh
+++ b/src/main/scripts/VESrestfulCollector.sh
@@ -4,7 +4,7 @@
# ============LICENSE_START=======================================================
# PROJECT
# ================================================================================
-# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+# Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
# ================================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -28,7 +28,6 @@ usage() {
}
-#BASEDIR=/opt/app/d1gfp1m7/extra/VES/VESCollector-1.1.4-SNAPSHOT/
BASEDIR=/opt/app/VESCollector/
collector_start() {
@@ -108,6 +107,26 @@ collector_configupdate() {
else
echo "INFO: Dynamic config updated successfully into VESCollector configuration!"
fi
+
+ # Identify alias names from keystore and password provided
+
+ paramName="collector.keystore.alias"
+ localpropertyfile="/opt/app/VESCollector/etc/collector.properties"
+ tmpfile="/opt/app/VESCollector/etc/collector.properties.tmp"
+
+ keystore=`grep collector.keystore.file.location $localpropertyfile | tr -d '[:space:]' | cut -d"=" -f2`
+ keypwdfile=`grep collector.keystore.passwordfile $localpropertyfile | tr -d '[:space:]' | cut -d"=" -f2`
+
+ echo "/usr/bin/keytool -list -keystore $keystore < $keypwdfile | grep "PrivateKeyEntry" | cut -d"," -f1"
+ tmpalias=`/usr/bin/keytool -list -keystore $keystore < $keypwdfile | grep "PrivateKeyEntry" | cut -d"," -f1`
+ echo "tmpalias:" $tmpalias
+ alias=`echo $tmpalias | cut -d":" -f2`
+ echo "alias:" $alias
+ sed "s~$paramName=.*~$paramName=$alias~g" $localpropertyfile > $tmpfile
+ echo `cat $tmpfile > $localpropertyfile`
+ rm $tmpfile
+ echo "INFO: Keystore alias updated into configuration"
+
else
echo "ERROR: Configuration file /opt/app/KV-Configuration.json missing"
fi
diff --git a/src/test/java/org/onap/dcae/vestest/TestDmaapPropertyReader.java b/src/test/java/org/onap/dcae/vestest/TestDmaapPropertyReader.java
index e54b4cbb..2a7a205e 100644
--- a/src/test/java/org/onap/dcae/vestest/TestDmaapPropertyReader.java
+++ b/src/test/java/org/onap/dcae/vestest/TestDmaapPropertyReader.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* PROJECT
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -29,7 +29,7 @@ import org.onap.dcae.commonFunction.DmaapPropertyReader;
public class TestDmaapPropertyReader {
DmaapPropertyReader dr;
- String testinput = "src/test/resources/testDmaapConfig.json";
+ String testinput = "src/test/resources/testDmaapConfig_ip.json";
Boolean flag = false;
@Before
diff --git a/src/test/java/org/onap/dcae/vestest/TestEventProcessor.java b/src/test/java/org/onap/dcae/vestest/TestEventProcessor.java
index f11cc905..47672956 100644
--- a/src/test/java/org/onap/dcae/vestest/TestEventProcessor.java
+++ b/src/test/java/org/onap/dcae/vestest/TestEventProcessor.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* PROJECT
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,7 +23,6 @@ import static org.junit.Assert.*;
import java.io.File;
-import java.io.FileReader;
import java.net.URL;
import java.util.Map;
@@ -47,13 +46,13 @@ public class TestEventProcessor {
EventProcessor ec;
String ev= "{\"event\": {\"commonEventHeader\": { \"reportingEntityName\": \"VM name will be provided by ECOMP\", \"startEpochMicrosec\": 1477012779802988,\"lastEpochMicrosec\": 1477012789802988,\"eventId\": \"83\",\"sourceName\": \"Dummy VM name - No Metadata available\",\"sequence\": 83,\"priority\": \"Normal\",\"functionalRole\": \"vFirewall\",\"domain\": \"measurementsForVfScaling\",\"reportingEntityId\": \"VM UUID will be provided by ECOMP\",\"sourceId\": \"Dummy VM UUID - No Metadata available\",\"version\": 1.1},\"measurementsForVfScalingFields\": {\"measurementInterval\": 10,\"measurementsForVfScalingVersion\": 1.1,\"vNicUsageArray\": [{\"multicastPacketsIn\": 0,\"bytesIn\": 3896,\"unicastPacketsIn\": 0, \"multicastPacketsOut\": 0,\"broadcastPacketsOut\": 0, \"packetsOut\": 28,\"bytesOut\": 12178,\"broadcastPacketsIn\": 0,\"packetsIn\": 58,\"unicastPacketsOut\": 0,\"vNicIdentifier\": \"eth0\"}]}}}";
-
+ String testinput;
@Before
public void setUp() throws Exception {
CommonStartup.streamid="fault=sec_fault|syslog=sec_syslog|heartbeat=sec_heartbeat|measurementsForVfScaling=sec_measurement|mobileFlow=sec_mobileflow|other=sec_other|stateChange=sec_statechange|thresholdCrossingAlert=sec_thresholdCrossingAlert|voiceQuality=ves_voicequality|sipSignaling=ves_sipsignaling";
CommonStartup.eventTransformFlag = 1;
-
+ testinput = "src/test/resources/testDmaapConfig_ip.json";
}
@@ -81,7 +80,7 @@ public class TestEventProcessor {
DmaapPropertyReader dr;
EventPublisher ep = null;
- String testinput = "src/test/resources/testDmaapConfig.json";
+
Boolean flag = false;
dr = new DmaapPropertyReader(testinput);
@@ -106,9 +105,11 @@ public class TestEventProcessor {
DmaapPropertyReader dr;
EventPublisherHash eph = null;
+
Boolean flag = false;
+ dr = new DmaapPropertyReader(testinput);
eph = EventPublisherHash.getInstance();
-
+
if (eph.equals(null))
{
@@ -128,13 +129,14 @@ public class TestEventProcessor {
DmaapPropertyReader dr;
EventPublisherHash eph = null;
- String testinput = "src/test/resources/testDmaapConfig.json";
+
Boolean flag = false;
dr = new DmaapPropertyReader(testinput);
eph = EventPublisherHash.getInstance();
EventProcessor ec = new EventProcessor();
ec.event=new org.json.JSONObject(ev);
- CommonStartup.cambriaConfigFile="src/test/resources/testDmaapConfig.json";
+ CommonStartup.cambriaConfigFile="src/test/resources/testDmaapConfig_ip.json";
+
CambriaBatchingPublisher pub = eph.Dmaaphash("sec_fault_ueb");
if (pub == null || pub.equals(null))
@@ -154,7 +156,7 @@ public class TestEventProcessor {
DmaapPropertyReader dr;
EventPublisherHash eph = null;
- String testinput = "src/test/resources/testDmaapConfig.json";
+
Boolean flag = true;
dr = new DmaapPropertyReader(testinput);
eph = EventPublisherHash.getInstance();
@@ -162,7 +164,7 @@ public class TestEventProcessor {
EventProcessor ec = new EventProcessor();
ec.event=new org.json.JSONObject(ev);
- CommonStartup.cambriaConfigFile="src/test/resources/testDmaapConfig.json";
+ CommonStartup.cambriaConfigFile="src/test/resources/testDmaapConfig_ip.json";
eph.sendEvent(ec.event, "sec_fault_ueb");
assertEquals(true, flag);
@@ -170,4 +172,3 @@ public class TestEventProcessor {
}
}
-
diff --git a/src/test/java/org/onap/dcae/vestest/TestFetchConfig.java b/src/test/java/org/onap/dcae/vestest/TestFetchConfig.java
new file mode 100644
index 00000000..ed3e1086
--- /dev/null
+++ b/src/test/java/org/onap/dcae/vestest/TestFetchConfig.java
@@ -0,0 +1,90 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * PROJECT
+ * ================================================================================
+ * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.dcae.vestest;
+
+import static org.junit.Assert.*;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.FileReader;
+import java.io.IOException;
+import org.json.JSONObject;
+import com.google.gson.JsonParser;
+import com.google.gson.JsonObject;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.dcae.commonFunction.CommonStartup;
+import org.onap.dcae.commonFunction.DmaapPropertyReader;
+import org.onap.dcae.commonFunction.EventProcessor;
+import org.onap.dcae.commonFunction.EventPublisherHash;
+import org.onap.dcae.controller.FetchDynamicConfig;
+
+
+public class TestFetchConfig {
+
+ JSONObject jsonObject;
+
+ @Before
+ public void setUp() throws Exception {
+
+
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+
+
+ @Test
+ public void testwritefile() {
+ Boolean flag = false;
+
+ FetchDynamicConfig fc = new FetchDynamicConfig();
+ FetchDynamicConfig.configFile = "src/test/resources/controller-config_formatted_op.json";
+
+
+
+ try{
+ JsonParser parser = new JsonParser();
+ FileReader fr = new FileReader ("src/test/resources/controller-config_singleline_ip.json" );
+ final JsonObject jo = (JsonObject) parser.parse (fr);
+ final String jsonText = jo.toString ();
+ jsonObject = new JSONObject ( jsonText );
+ fc.writefile(jsonObject.toString());
+ }
+ catch(Exception e){
+ System.out.println("Exception while opening the file");
+ e.printStackTrace();
+ }
+ if(jsonObject.has("streams_publishes"))
+ {
+ flag = true;
+ }
+
+ assertEquals(true, flag);
+
+ }
+
+
+}
+
diff --git a/src/test/java/org/onap/dcae/vestest/TestLoadDynamicConfig.java b/src/test/java/org/onap/dcae/vestest/TestLoadDynamicConfig.java
index 902add73..765d9c61 100644
--- a/src/test/java/org/onap/dcae/vestest/TestLoadDynamicConfig.java
+++ b/src/test/java/org/onap/dcae/vestest/TestLoadDynamicConfig.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* PROJECT
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,30 +21,29 @@ package org.onap.dcae.vestest;
import static org.junit.Assert.*;
-import java.io.File;
import java.io.FileReader;
-import java.net.URL;
-import java.util.Map;
-
-import org.json.simple.JSONObject;
+import org.json.JSONObject;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
+import org.onap.dcae.controller.FetchDynamicConfig;
import org.onap.dcae.controller.LoadDynamicConfig;
+import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class TestLoadDynamicConfig {
LoadDynamicConfig lc;
- String propop = "src/test/resources/testcollector.properties";
+ String propop = "src/test/resources/test_collector_ip_op.properties";
+
@Before
public void setUp() throws Exception {
-
+ lc = new LoadDynamicConfig();
}
@@ -55,18 +54,50 @@ public class TestLoadDynamicConfig {
@Test
public void testLoad() {
- // File file = new File(".");
- // for(String fileNames : file.list()) System.out.println(fileNames);
Boolean flag=false;
- lc = new LoadDynamicConfig();
- lc.propFile = "src/test/resources/testcollector.properties";
- lc.configFile = "src/test/resources/controller-config.json";
+
+
+ lc.propFile = "src/test/resources/test_collector_ip_op.properties";
+ lc.configFile = "src/test/resources/controller-config_dmaap_ip.json";
String data = LoadDynamicConfig.readFile(propop);
assertEquals(data.isEmpty(), flag);
}
+ @Test
+ public void testwrite() {
+
+
+ Boolean flag=false;
+
+ lc.propFile = "src/test/resources/test_collector_ip_op.properties";
+ lc.configFile = "src/test/resources/controller-config_dmaap_ip.json";
+ lc.dmaapoutputfile = "src/test/resources/DmaapConfig-op.json";
+
+ String data = LoadDynamicConfig.readFile(lc.configFile);
+ JSONObject jsonObject = new JSONObject(data);
+ lc.writeconfig(jsonObject);
+
+ try{
+ JsonParser parser = new JsonParser();
+ FileReader fr = new FileReader ( lc.dmaapoutputfile );
+ final JsonObject jo = (JsonObject) parser.parse (fr);
+ final String jsonText = jo.toString ();
+ jsonObject = new JSONObject ( jsonText );
+ }
+ catch(Exception e){
+ System.out.println("Exception while opening the file");
+ e.printStackTrace();
+ }
+ if(jsonObject.has("ves-fault-secondary"))
+ {
+ flag = true;
+ }
+
+ assertEquals(true, flag);
+
+ }
}
diff --git a/src/test/java/org/onap/dcae/vestest/TestSchemaValidation.java b/src/test/java/org/onap/dcae/vestest/TestSchemaValidation.java
index a34b3336..af8a62f3 100644
--- a/src/test/java/org/onap/dcae/vestest/TestSchemaValidation.java
+++ b/src/test/java/org/onap/dcae/vestest/TestSchemaValidation.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* PROJECT
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -83,30 +83,22 @@ public class TestSchemaValidation {
}
-
+/*
@Test
public void testeventReceipt() {
- //com.att.nsa.drumlin.service.framework.context.DrumlinRequestContext.DrumlinRequestContext(DrumlinServlet webServlet,
- //HttpServletRequest req, HttpServletResponse resp, DrumlinConnection s, Map<String, Object> objects, DrumlinRequestRouter router)
- //HttpServletRequest req = new HttpServletRequest();
- //HttpServletResponse res = new HttpServletResponse();
DrumlinServlet webServlet = new DrumlinServlet();
- //webServlet.addToBaseContext(key, o);
- //Map<String,Object> mp = new Map<String, Object>();
DrumlinRequestContext ctx = new DrumlinRequestContext(webServlet, null, null, null, null, null);
EventReceipt er= new EventReceipt();
try {
EventReceipt.receiveVESEvent(null);
} catch ( NullPointerException e) {
- // TODO Auto-generated catch block
-
+
+ e.printStackTrace();
}
-
-
Assert.assertEquals("true", "true");
- }
+ }*/
@Test
public void testsafeclosefr() {
diff --git a/src/test/java/org/onap/dcae/vestest/TestVESLogger.java b/src/test/java/org/onap/dcae/vestest/TestVESLogger.java
new file mode 100644
index 00000000..3d41eed6
--- /dev/null
+++ b/src/test/java/org/onap/dcae/vestest/TestVESLogger.java
@@ -0,0 +1,115 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * PROJECT
+ * ================================================================================
+ * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.dcae.vestest;
+
+import static org.junit.Assert.*;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.UUID;
+
+import org.json.JSONObject;
+import com.google.gson.JsonParser;
+import com.att.nsa.logging.LoggingContext;
+import com.google.gson.JsonObject;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.dcae.commonFunction.CommonStartup;
+import org.onap.dcae.commonFunction.DmaapPropertyReader;
+import org.onap.dcae.commonFunction.EventProcessor;
+import org.onap.dcae.commonFunction.EventPublisherHash;
+import org.onap.dcae.commonFunction.VESLogger;
+import org.onap.dcae.controller.FetchDynamicConfig;
+
+
+public class TestVESLogger {
+
+ LoggingContext threadLC;
+
+ @Before
+ public void setUp() throws Exception {
+
+ threadLC = null;
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+
+
+ @Test
+ public void testgetCommonLoggingContext() {
+ Boolean flag = false;
+ threadLC = VESLogger.getCommonLoggingContext();
+ if(!threadLC.equals(""))
+ {
+ flag = true;
+ }
+
+ assertEquals(true, flag);
+
+ }
+ @Test
+ public void testUuidgetLoggingContextForThread() {
+ Boolean flag = false;
+ final UUID uuid = UUID.randomUUID();
+ threadLC = VESLogger.getLoggingContextForThread(uuid);
+ //if(threadLC.get("REQUEST_ID", null) != null)
+ if(!threadLC.equals(""))
+ {
+ flag = true;
+ }
+
+ assertEquals(true, flag);
+
+
+ }
+ @Test
+ public void testStringgetLoggingContextForThread() {
+ Boolean flag = false;
+ final UUID uuid = UUID.randomUUID();
+ threadLC = VESLogger.getLoggingContextForThread(uuid.toString());
+ //if(threadLC.get("REQUEST_ID", null) != null)
+ if(!threadLC.equals(""))
+ {
+ flag = true;
+ }
+
+ assertEquals(true, flag);
+
+ }
+
+ @Test
+ public void testsetUpEcompLogging() {
+ Boolean flag = false;
+ VESLogger.setUpEcompLogging();
+
+
+ assertEquals(true, true);
+
+ }
+
+}
+
diff --git a/src/test/resources/controller-config.json b/src/test/resources/controller-config.json
deleted file mode 100644
index c71f434d..00000000
--- a/src/test/resources/controller-config.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "services_calls": {},
- "collector.schema.checkflag": 1,
- "collector.inputQueue.maxPending": 8096,
- "collector.keystore.alias": "dynamically generated",
- "collector.schema.file": "{\"v1\":\"./etc/CommonEventFormat_27.2.json\",\"v2\":\"./etc/CommonEventFormat_27.2.json\",\"v3\":\"./etc/CommonEventFormat_27.2.json\",\"v4\":\"./etc/CommonEventFormat_27.2.json\",\"v5\":\"./etc/CommonEventFormat_28.4.json\"}",
- "header.authlist": "userid1,base64encodepwd1|userid2,base64encodepwd2",
- "streams_subscribes": {},
- "tomcat.maxthreads": "200",
- "collector.service.secure.port": 8443,
- "collector.dmaap.streamid": "fault=ves_fault|syslog=ves_syslog|heartbeat=ves_heartbeat|measurementsForVfScaling=ves_measurement|mobileFlow=ves_mobileflow|other=ves_other|stateChange=ves_statechange|thresholdCrossingAlert=ves_thresholdCrossingAlert|voiceQuality=ves_voicequality|sipSignaling=ves_sipsignaling",
- "event.transform.flag": 0,
- "collector.keystore.file.location": "/opt/app/dcae-certificate/keystore.jks",
- "collector.keystore.passwordfile": "/opt/app/dcae-certificate/.password",
- "header.authflag": 0,
- "collector.service.port": 8080
-}
diff --git a/src/test/resources/controller-config_dmaap_ip.json b/src/test/resources/controller-config_dmaap_ip.json
new file mode 100644
index 00000000..8979a614
--- /dev/null
+++ b/src/test/resources/controller-config_dmaap_ip.json
@@ -0,0 +1,239 @@
+{
+ "header.authflag": 1,
+ "collector.inputQueue.maxPending": 8096,
+ "collector.keystore.alias": "dynamically generated",
+ "collector.schema.checkflag": 1,
+ "collector.keystore.file.location": "/opt/app/dcae-certificate/keystore.jks",
+ "tomcat.maxthreads": "200",
+ "collector.keystore.passwordfile": "/opt/app/dcae-certificate/.password",
+ "collector.service.secure.port": 8443,
+ "collector.schema.file": "{\"v1\":\"./etc/CommonEventFormat_27.2.json\",\"v2\":\"./etc/CommonEventFormat_27.2.json\",\"v3\":\"./etc/CommonEventFormat_27.2.json\",\"v4\":\"./etc/CommonEventFormat_27.2.json\",\"v5\":\"./etc/CommonEventFormat_28.4.json\"}",
+ "collector.dmaap.streamid": "fault=ves-fault,ves-fault-secondary|syslog=ves-syslog,ves-syslog-secondary|heartbeat=ves-heartbeat,ves-heartbeat-secondary|measurementsForVfScaling=ves-measurement,ves-measurement-secondary|mobileFlow=ves-mobileflow,ves-mobileflow-secondary|other=ves-other,ves-other-secondary|stateChange=ves-statechange,ves-statechange-secondary|thresholdCrossingAlert=ves-thresholdCrossingAlert,ves-thresholdCrossingAlert-secondary|voiceQuality=ves-voicequality,ves-voicequality-secondary|sipSignaling=ves-sipsignaling,ves-sipsignaling-secondary",
+ "streams_subscribes": {},
+ "collector.service.port": -1,
+ "services_calls": {},
+ "streams_publishes": {
+ "ves-other": {
+ "aaf_username": null,
+ "type": "message_router",
+ "aaf_password": null,
+ "dmaap_info": {
+ "client_id": null,
+ "location": "mtl5",
+ "client_role": null,
+ "topic_url": "http://UEBHOST:3904/events/DCAE-SE-COLLECTOR-EVENTS-DEV"
+ }
+ },
+ "ves-fault": {
+ "aaf_username": null,
+ "type": "message_router",
+ "aaf_password": null,
+ "dmaap_info": {
+ "client_id": null,
+ "location": "mtl5",
+ "client_role": null,
+ "topic_url": "http://UEBHOST:3904/events/DCAE-SE-COLLECTOR-EVENTS-DEV"
+ }
+ },
+ "ves-syslog": {
+ "aaf_username": null,
+ "type": "message_router",
+ "aaf_password": null,
+ "dmaap_info": {
+ "client_id": null,
+ "location": "mtl5",
+ "client_role": null,
+ "topic_url": "http://UEBHOST:3904/events/DCAE-SE-COLLECTOR-EVENTS-DEV"
+ }
+ },
+ "ves-other-secondary": {
+ "aaf_username": null,
+ "type": "message_router",
+ "aaf_password": null,
+ "dmaap_info": {
+ "client_id": null,
+ "location": "mtl5",
+ "client_role": null,
+ "topic_url": "http://UEBHOST:3904/events/DCAE-SE-COLLECTOR-EVENTS-DEV"
+ }
+ },
+ "ves-syslog-secondary": {
+ "aaf_username": null,
+ "type": "message_router",
+ "aaf_password": null,
+ "dmaap_info": {
+ "client_id": null,
+ "location": "mtl5",
+ "client_role": null,
+ "topic_url": "http://UEBHOST:3904/events/DCAE-SE-COLLECTOR-EVENTS-DEV"
+ }
+ },
+ "ves-thresholdCrossingAlert-secondary": {
+ "aaf_username": null,
+ "type": "message_router",
+ "aaf_password": null,
+ "dmaap_info": {
+ "client_id": null,
+ "location": "mtl5",
+ "client_role": null,
+ "topic_url": "http://UEBHOST:3904/events/DCAE-SE-COLLECTOR-EVENTS-DEV"
+ }
+ },
+ "ves-voicequality": {
+ "aaf_username": null,
+ "type": "message_router",
+ "aaf_password": null,
+ "dmaap_info": {
+ "client_id": null,
+ "location": "mtl5",
+ "client_role": null,
+ "topic_url": "http://UEBHOST:3904/events/DCAE-SE-COLLECTOR-EVENTS-DEV"
+ }
+ },
+ "ves-sipsignaling-secondary": {
+ "aaf_username": null,
+ "type": "message_router",
+ "aaf_password": null,
+ "dmaap_info": {
+ "client_id": null,
+ "location": "mtl5",
+ "client_role": null,
+ "topic_url": "http://UEBHOST:3904/events/DCAE-SE-COLLECTOR-EVENTS-DEV"
+ }
+ },
+ "ves-heartbeat": {
+ "aaf_username": null,
+ "type": "message_router",
+ "aaf_password": null,
+ "dmaap_info": {
+ "client_id": null,
+ "location": "mtl5",
+ "client_role": null,
+ "topic_url": "http://UEBHOST:3904/events/DCAE-SE-COLLECTOR-EVENTS-DEV"
+ }
+ },
+ "ves-mobileflow-secondary": {
+ "aaf_username": null,
+ "type": "message_router",
+ "aaf_password": null,
+ "dmaap_info": {
+ "client_id": null,
+ "location": "mtl5",
+ "client_role": null,
+ "topic_url": "http://UEBHOST:3904/events/DCAE-SE-COLLECTOR-EVENTS-DEV"
+ }
+ },
+ "ves-heartbeat-secondary": {
+ "aaf_username": null,
+ "type": "message_router",
+ "aaf_password": null,
+ "dmaap_info": {
+ "client_id": null,
+ "location": "mtl5",
+ "client_role": null,
+ "topic_url": "http://UEBHOST:3904/events/DCAE-SE-COLLECTOR-EVENTS-DEV"
+ }
+ },
+ "ves-measurement-secondary": {
+ "aaf_username": null,
+ "type": "message_router",
+ "aaf_password": null,
+ "dmaap_info": {
+ "client_id": null,
+ "location": "mtl5",
+ "client_role": null,
+ "topic_url": "http://UEBHOST:3904/events/DCAE-SE-COLLECTOR-EVENTS-DEV"
+ }
+ },
+ "ves-measurement": {
+ "aaf_username": null,
+ "type": "message_router",
+ "aaf_password": null,
+ "dmaap_info": {
+ "client_id": null,
+ "location": "mtl5",
+ "client_role": null,
+ "topic_url": "http://UEBHOST:3904/events/DCAE-SE-COLLECTOR-EVENTS-DEV"
+ }
+ },
+ "ves-sipsignaling": {
+ "aaf_username": null,
+ "type": "message_router",
+ "aaf_password": null,
+ "dmaap_info": {
+ "client_id": null,
+ "location": "mtl5",
+ "client_role": null,
+ "topic_url": "http://UEBHOST:3904/events/DCAE-SE-COLLECTOR-EVENTS-DEV"
+ }
+ },
+ "ves-statechange-secondary": {
+ "aaf_username": null,
+ "type": "message_router",
+ "aaf_password": null,
+ "dmaap_info": {
+ "client_id": null,
+ "location": "mtl5",
+ "client_role": null,
+ "topic_url": "http://UEBHOST:3904/events/DCAE-SE-COLLECTOR-EVENTS-DEV"
+ }
+ },
+ "ves-voicequality-secondary": {
+ "aaf_username": null,
+ "type": "message_router",
+ "aaf_password": null,
+ "dmaap_info": {
+ "client_id": null,
+ "location": "mtl5",
+ "client_role": null,
+ "topic_url": "http://UEBHOST:3904/events/DCAE-SE-COLLECTOR-EVENTS-DEV"
+ }
+ },
+ "ves-fault-secondary": {
+ "aaf_username": null,
+ "type": "message_router",
+ "aaf_password": null,
+ "dmaap_info": {
+ "client_id": null,
+ "location": "mtl5",
+ "client_role": null,
+ "topic_url": "http://UEBHOST:3904/events/DCAE-SE-COLLECTOR-EVENTS-DEV"
+ }
+ },
+ "ves-statechange": {
+ "aaf_username": null,
+ "type": "message_router",
+ "aaf_password": null,
+ "dmaap_info": {
+ "client_id": null,
+ "location": "mtl5",
+ "client_role": null,
+ "topic_url": "http://UEBHOST:3904/events/DCAE-SE-COLLECTOR-EVENTS-DEV"
+ }
+ },
+ "ves-mobileflow": {
+ "aaf_username": null,
+ "type": "message_router",
+ "aaf_password": null,
+ "dmaap_info": {
+ "client_id": null,
+ "location": "mtl5",
+ "client_role": null,
+ "topic_url": "http://UEBHOST:3904/events/DCAE-SE-COLLECTOR-EVENTS-DEV"
+ }
+ },
+ "ves-thresholdCrossingAlert": {
+ "aaf_username": null,
+ "type": "message_router",
+ "aaf_password": null,
+ "dmaap_info": {
+ "client_id": null,
+ "location": "mtl5",
+ "client_role": null,
+ "topic_url": "http://UEBHOST:3904/events/DCAE-SE-COLLECTOR-EVENTS-DEV"
+ }
+ }
+ },
+ "event.transform.flag": 1,
+ "header.authlist": "sample1,c2FtcGxlMQ==|userid1,base64encodepwd1|userid2,base64encodepwd2"
+}
diff --git a/src/test/resources/controller-config_singleline_ip.json b/src/test/resources/controller-config_singleline_ip.json
new file mode 100644
index 00000000..220e3f1b
--- /dev/null
+++ b/src/test/resources/controller-config_singleline_ip.json
@@ -0,0 +1 @@
+{"header.authflag": "1", "collector.schema.file": "{\"v1\": \"./etc/CommonEventFormat_27.2.json\", \"v2\": \"./etc/CommonEventFormat_27.2.json\", \"v3\": \"./etc/CommonEventFormat_27.2.json\", \"v4\": \"./etc/CommonEventFormat_27.2.json\", \"v5\": \"./etc/CommonEventFormat_28.4.json\"}", "collector.keystore.passwordfile": "/opt/app/dcae-certificate/.password", "tomcat.maxthreads": "200", "collector.dmaap.streamid": "fault=ves-fault|syslog=ves-syslog|heartbeat=ves-heartbeat|measurementsForVfScaling=ves-measurement|mobileFlow=ves-mobileflow|other=ves-other|stateChange=ves-statechange|thresholdCrossingAlert=ves-thresholdCrossingAlert|voiceQuality=ves-voicequality|sipSignaling=ves-sipsignaling", "streams_subscribes": {}, "collector.inputQueue.maxPending": "8096", "collector.keystore.alias": "dynamically generated", "streams_publishes": {"ves-mobileflow": {"type": "message_router", "dmaap_info": {"client_id": "1517590629043", "client_role": "com.att.secCollector.member", "location": "rdm5bdcc2", "topic_url": "https://DMAAPHOST:3905/events/com.att.dcae.dmaap.FTL.24256-SEC-MOBILEFLOW-OUTPUT-v1"}, "aaf_username": "userid@namespace", "aaf_password": "authpwd"}, "ves-measurement": {"type": "message_router", "dmaap_info": {"client_id": "1517590433916", "client_role": "com.att.secCollector.member", "location": "rdm5bdcc2", "topic_url": "https://DMAAPHOST:3905/events/com.att.dcae.dmaap.FTL.24256-ENC-MEASUREMENT-OUTPUT-v1"}, "aaf_username": "userid@namespace", "aaf_password": "authpwd"}, "ves-voicequality": {"type": "message_router", "dmaap_info": {"client_id": "1517590778397", "client_role": "com.att.secCollector.member", "location": "rdm5bdcc2", "topic_url": "https://DMAAPHOST:3905/events/com.att.dcae.dmaap.FTL.24256-VES-VOICEQUALITY-OUTPUT-v1"}, "aaf_username": "userid@namespace", "aaf_password": "authpwd"}, "ves-thresholdCrossingAlert": {"type": "message_router", "dmaap_info": {"client_id": "1517590728150", "client_role": "com.att.secCollector.member", "location": "rdm5bdcc2", "topic_url": "https://DMAAPHOST:3905/events/com.att.dcae.dmaap.FTL.24256-SEC-TCA-OUTPUT-v1"}, "aaf_username": "userid@namespace", "aaf_password": "authpwd"}, "ves-fault": {"type": "message_router", "dmaap_info": {"client_id": "1517590384670", "client_role": "com.att.secCollector.member", "location": "rdm5bdcc2", "topic_url": "https://DMAAPHOST:3905/events/com.att.dcae.dmaap.FTL.24256-SEC-FAULT-OUTPUT-v1"}, "aaf_username": "userid@namespace", "aaf_password": "authpwd"}, "ves-heartbeat": {"type": "message_router", "dmaap_info": {"client_id": "1517590530041", "client_role": "com.att.secCollector.member", "location": "rdm5bdcc2", "topic_url": "https://DMAAPHOST:3905/events/com.att.dcae.dmaap.FTL.24256-SEC-HEARTBEAT-OUTPUT-v1"}, "aaf_username": "userid@namespace", "aaf_password": "authpwd"}, "ves-sipsignaling": {"type": "message_router", "dmaap_info": {"client_id": "1517590828736", "client_role": "com.att.secCollector.member", "location": "rdm5bdcc2", "topic_url": "https://DMAAPHOST:3905/events/com.att.dcae.dmaap.FTL.24256-VES-SIPSIGNALING-OUTPUT-v1"}, "aaf_username": "userid@namespace", "aaf_password": "authpwd"}, "ves-syslog": {"type": "message_router", "dmaap_info": {"client_id": "1517590482019", "client_role": "com.att.secCollector.member", "location": "rdm5bdcc2", "topic_url": "https://DMAAPHOST:3905/events/com.att.dcae.dmaap.FTL.24256-SEC-SYSLOG-OUTPUT-v1"}, "aaf_username": "userid@namespace", "aaf_password": "authpwd"}, "ves-other": {"type": "message_router", "dmaap_info": {"client_id": "1517590581045", "client_role": "com.att.secCollector.member", "location": "rdm5bdcc2", "topic_url": "https://DMAAPHOST:3905/events/com.att.dcae.dmaap.FTL.24256-SEC-OTHER-OUTPUT-v1"}, "aaf_username": "userid@namespace", "aaf_password": "authpwd"}, "ves-statechange": {"type": "message_router", "dmaap_info": {"client_id": "1517590677649", "client_role": "com.att.secCollector.member", "location": "rdm5bdcc2", "topic_url": "https://DMAAPHOST:3905/events/com.att.dcae.dmaap.FTL.24256-SEC-STATECHANGE-OUTPUT-v1"}, "aaf_username": "userid@namespace", "aaf_password": "authpwd"}}, "collector.schema.checkflag": "1", "services_calls": {}, "event.transform.flag": "1", "collector.keystore.file.location": "/opt/app/dcae-certificate/keystore.jks", "header.authlist": "sample1,c2FtcGxlMQ==|userid1,base64encodepwd1|userid2,base64encodepwd2", "collector.service.secure.port": "8443", "collector.service.port": "-1"} \ No newline at end of file
diff --git a/src/test/resources/testDmaapConfig.json b/src/test/resources/testDmaapConfig_ip.json
index 247db789..247db789 100644
--- a/src/test/resources/testDmaapConfig.json
+++ b/src/test/resources/testDmaapConfig_ip.json
diff --git a/src/test/resources/test_collector_ip_op.properties b/src/test/resources/test_collector_ip_op.properties
new file mode 100644
index 00000000..ad3ee2f1
--- /dev/null
+++ b/src/test/resources/test_collector_ip_op.properties
@@ -0,0 +1,78 @@
+###############################################################################
+##
+## Collector Server config
+##
+## - Default values are shown as commented settings.
+##
+###############################################################################
+##
+## HTTP(S) service
+##
+## Normally:
+##
+## - 8080 is http service
+## - https is disabled by default (-1)
+##
+## - At this time, the server always binds to 0.0.0.0
+##
+## The default port when header.authflag is disabled (0)
+collector.service.port=-1
+
+## The secure port is required if header.authflag is set to 1 (true)
+## Authentication is only supported via secure port
+## When enabled - require valid keystore defined
+collector.service.secure.port=8443
+
+## The keystore must be setup per installation when secure port is configured
+collector.keystore.file.location=/opt/app/dcae-certificate/keystore.jks
+collector.keystore.passwordfile=/opt/app/dcae-certificate/.password
+collector.keystore.alias=dynamically generated
+
+
+###############################################################################
+## Processing
+##
+## If there's a problem that prevents the collector from processing alarms,
+## it's normally better to apply back pressure to the caller than to try to
+## buffer beyond a reasonable size limit. With a limit, the server won't crash
+## due to being out of memory, and the caller will get a 5xx reply saying the
+## server is in trouble.
+collector.inputQueue.maxPending=8096
+
+## Schema Validation checkflag
+## default no validation checkflag (-1)
+## If enabled (1) - schemafile location must be specified
+collector.schema.checkflag=1
+collector.schema.file={\"v1\":\"./etc/CommonEventFormat_27.2.json\",\"v2\":\"./etc/CommonEventFormat_27.2.json\",\"v3\":\"./etc/CommonEventFormat_27.2.json\",\"v4\":\"./etc/CommonEventFormat_27.2.json\",\"v5\":\"./etc/CommonEventFormat_28.4.json\"}
+
+## List all streamid per domain to be supported. The streamid should match to channel name on dmaapfile
+collector.dmaap.streamid=fault=ves-fault,ves-fault-secondary|syslog=ves-syslog,ves-syslog-secondary|heartbeat=ves-heartbeat,ves-heartbeat-secondary|measurementsForVfScaling=ves-measurement,ves-measurement-secondary|mobileFlow=ves-mobileflow,ves-mobileflow-secondary|other=ves-other,ves-other-secondary|stateChange=ves-statechange,ves-statechange-secondary|thresholdCrossingAlert=ves-thresholdCrossingAlert,ves-thresholdCrossingAlert-secondary|voiceQuality=ves-voicequality,ves-voicequality-secondary|sipSignaling=ves-sipsignaling,ves-sipsignaling-secondary
+collector.dmaapfile=./etc/DmaapConfig.json
+
+## Custom ExceptionConfiguration
+exceptionConfig=./etc/ExceptionConfig.json
+
+## authflag control authentication by the collector
+## If enabled (1) - then authlist has to be defined
+## When authflag is enabled, only secure port will be supported
+## To disable enter 0
+header.authflag=1
+## Combination of userid,base64 encoded pwd list to be supported
+## userid and pwd comma separated; pipe delimitation between each pair
+header.authlist=sample1,c2FtcGxlMQ==|userid1,base64encodepwd1|userid2,base64encodepwd2
+
+## Event transformation Flag - when set expects configurable transformation
+## defined under ./etc/eventTransform.json
+## Enabled by default; to disable set to 0
+event.transform.flag=1
+streams_subscribes = {}
+services_calls = {}
+tomcat.maxthreads = 200
+
+###############################################################################
+##
+## Tomcat control
+##
+#tomcat.maxthreads=(tomcat default, which is usually 200)
+
+
diff --git a/src/test/resources/testcollector.properties b/src/test/resources/testcollector.properties
index 6b166b04..7c00a208 100644
--- a/src/test/resources/testcollector.properties
+++ b/src/test/resources/testcollector.properties
@@ -1,75 +1,75 @@
-###############################################################################
-##
-## Collector Server config
-##
-## - Default values are shown as commented settings.
-##
-###############################################################################
-##
-## HTTP(S) service
-##
-## Normally:
-##
-## - 8080 is http service
-## - https is disabled by default (-1)
-##
-## - At this time, the server always binds to 0.0.0.0
-##
-## The default port when header.authflag is disabled (0)
-collector.service.port=9999
-
-## The secure port is required if header.authflag is set to 1 (true)
-## Authentication is only supported via secure port
-## When enabled - require valid keystore defined
-collector.service.secure.port=8443
-
-## The keystore must be setup per installation when secure port is configured
-collector.keystore.file.location=../etc/keystore
-collector.keystore.passwordfile=./etc/passwordfile
-collector.keystore.alias=tomcat
-
-
-###############################################################################
-## Processing
-##
-## If there's a problem that prevents the collector from processing alarms,
-## it's normally better to apply back pressure to the caller than to try to
-## buffer beyond a reasonable size limit. With a limit, the server won't crash
-## due to being out of memory, and the caller will get a 5xx reply saying the
-## server is in trouble.
-collector.inputQueue.maxPending=8096
-
-## Schema Validation checkflag
-## default no validation checkflag (-1)
-## If enabled (1) - schemafile location must be specified
-collector.schema.checkflag=1
-collector.schema.file={\"v1\":\"./etc/CommonEventFormat_27.2.json\",\"v2\":\"./etc/CommonEventFormat_27.2.json\",\"v3\":\"./etc/CommonEventFormat_27.2.json\",\"v4\":\"./etc/CommonEventFormat_27.2.json\",\"v5\":\"./etc/CommonEventFormat_28.4.json\"}
-
-## List all streamid per domain to be supported. The streamid should match to channel name on dmaapfile
-collector.dmaap.streamid=fault=sec_fault|syslog=sec_syslog|heartbeat=sec_heartbeat|measurementsForVfScaling=sec_measurement|mobileFlow=sec_mobileflow|other=sec_other|stateChange=sec_statechange|thresholdCrossingAlert=sec_thresholdCrossingAlert|voiceQuality=ves_voicequality|sipSignaling=ves_sipsignaling
-collector.dmaapfile=./etc/DmaapConfig.json
-
-## Custom ExceptionConfiguration
-exceptionConfig=./etc/ExceptionConfig.json
-
-## authflag control authentication by the collector
-## If enabled (1) - then authlist has to be defined
-## When authflag is enabled, only secure port will be supported
-## To disable enter 0
-header.authflag=1
-## Combination of userid,base64 encoded pwd list to be supported
-## userid and pwd comma separated; pipe delimitation between each pair
-header.authlist=secureid,IWRjYWVSb2FkbTEyMyEt|sample1,c2FtcGxlMQ==|vdnsagg,dmRuc2FnZw==
-
-## Event transformation Flag - when set expects configurable transformation
-## defined under ./etc/eventTransform.json
-## Enabled by default; to disable set to 0
-event.transform.flag=1
-
-###############################################################################
-##
-## Tomcat control
-##
-#tomcat.maxthreads=(tomcat default, which is usually 200)
-
-
+###############################################################################
+##
+## Collector Server config
+##
+## - Default values are shown as commented settings.
+##
+###############################################################################
+##
+## HTTP(S) service
+##
+## Normally:
+##
+## - 8080 is http service
+## - https is disabled by default (-1)
+##
+## - At this time, the server always binds to 0.0.0.0
+##
+## The default port when header.authflag is disabled (0)
+collector.service.port=9999
+
+## The secure port is required if header.authflag is set to 1 (true)
+## Authentication is only supported via secure port
+## When enabled - require valid keystore defined
+collector.service.secure.port=8443
+
+## The keystore must be setup per installation when secure port is configured
+collector.keystore.file.location=../etc/keystore
+collector.keystore.passwordfile=./etc/passwordfile
+collector.keystore.alias=tomcat
+
+
+###############################################################################
+## Processing
+##
+## If there's a problem that prevents the collector from processing alarms,
+## it's normally better to apply back pressure to the caller than to try to
+## buffer beyond a reasonable size limit. With a limit, the server won't crash
+## due to being out of memory, and the caller will get a 5xx reply saying the
+## server is in trouble.
+collector.inputQueue.maxPending=8096
+
+## Schema Validation checkflag
+## default no validation checkflag (-1)
+## If enabled (1) - schemafile location must be specified
+collector.schema.checkflag=1
+collector.schema.file={\"v1\":\"./etc/CommonEventFormat_27.2.json\",\"v2\":\"./etc/CommonEventFormat_27.2.json\",\"v3\":\"./etc/CommonEventFormat_27.2.json\",\"v4\":\"./etc/CommonEventFormat_27.2.json\",\"v5\":\"./etc/CommonEventFormat_28.4.json\"}
+
+## List all streamid per domain to be supported. The streamid should match to channel name on dmaapfile
+collector.dmaap.streamid=fault=sec_fault|syslog=sec_syslog|heartbeat=sec_heartbeat|measurementsForVfScaling=sec_measurement|mobileFlow=sec_mobileflow|other=sec_other|stateChange=sec_statechange|thresholdCrossingAlert=sec_thresholdCrossingAlert|voiceQuality=ves_voicequality|sipSignaling=ves_sipsignaling
+collector.dmaapfile=./etc/DmaapConfig.json
+
+## Custom ExceptionConfiguration
+exceptionConfig=./etc/ExceptionConfig.json
+
+## authflag control authentication by the collector
+## If enabled (1) - then authlist has to be defined
+## When authflag is enabled, only secure port will be supported
+## To disable enter 0
+header.authflag=1
+## Combination of userid,base64 encoded pwd list to be supported
+## userid and pwd comma separated; pipe delimitation between each pair
+header.authlist=secureid,IWRjYWVSb2FkbTEyMyEt|sample1,c2FtcGxlMQ==
+
+## Event transformation Flag - when set expects configurable transformation
+## defined under ./etc/eventTransform.json
+## Enabled by default; to disable set to 0
+event.transform.flag=1
+
+###############################################################################
+##
+## Tomcat control
+##
+#tomcat.maxthreads=(tomcat default, which is usually 200)
+
+