Fix VES event fields
* timeZoneOffset uses default system timezone
* sourceName and reportingEntityName use the nodename of pnf-sim instance
Change-Id: Idf7f0b8d4a02cb533e81bdf69d5034cd842c3fb8
Issue-ID: DCAEGEN2-1225
Signed-off-by: RehanRaza <muhammad.rehan.raza@est.tech>
diff --git a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/config/netconf.env b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/config/netconf.env
index c4f7b4a..ef79365 100644
--- a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/config/netconf.env
+++ b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/config/netconf.env
@@ -8,4 +8,3 @@
NETCONF_PORT=830
NETCONF_MODEL=pnf-simulator
NETCONF_MAIN_CONTAINER=config
-TZ=Europe/Warsaw
diff --git a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/docker-compose-template.yml b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/docker-compose-template.yml
index aa0261c..2c9226a 100644
--- a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/docker-compose-template.yml
+++ b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/docker-compose-template.yml
@@ -19,6 +19,8 @@
- ./json_schema:/json_schema
- ./config/config.yml:/config/config.yml:rw
- ./files/:/files/:rw
+ environment:
+ TZ: "${TIMEZONE}"
env_file:
- ./config/netconf.env
restart: on-failure
diff --git a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/simulator.sh b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/simulator.sh
index 4c5d9f0..6ba7079 100755
--- a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/simulator.sh
+++ b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/simulator.sh
@@ -74,6 +74,8 @@
export PORTFTPS=$8
export IPFTPS=$9
export IPSFTP=${10}
+ LOCALTIME=$(ls -l /etc/localtime)
+ export TIMEZONE=${LOCALTIME//*zoneinfo\/}
#will insert $I to distinguish containers, networks properly
#docker compose cannot substitute these, as they are keys, not values.
diff --git a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/message/JSONObjectFactory.java b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/message/JSONObjectFactory.java
index 545a568..ded9910 100644
--- a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/message/JSONObjectFactory.java
+++ b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/message/JSONObjectFactory.java
@@ -70,7 +70,7 @@
commonEventHeader.put(INTERNAL_HEADER_FIELDS, new JSONObject());
commonEventHeader.put(VERSION, VERSION_NUMBER);
commonEventHeader.put(VES_EVENT_LISTENER_VERSION, VES_EVENT_LISTENER_VERSION_NUMBER);
- String absPath = System.getProperty("user.dir");
+ String absPath = new File("").getAbsolutePath();
String nodeName = absPath.substring(absPath.lastIndexOf(File.separator)+1);
commonEventHeader.put(SOURCE_NAME, nodeName);
commonEventHeader.put(REPORTING_ENTITY_NAME, nodeName);