aboutsummaryrefslogtreecommitdiffstats
path: root/test/mocks/mass-pnf-sim/pnf-sim-lightweight
diff options
context:
space:
mode:
authorTamasBakai <tamas.bakai@est.tech>2019-03-22 09:52:03 +0000
committerTamasBakai <tamas.bakai@est.tech>2019-03-22 09:52:03 +0000
commitb59bffb8203a2e52e45100723d1cba322b229385 (patch)
tree6ad569a914811ef5b597400435fa3b9b526fc802 /test/mocks/mass-pnf-sim/pnf-sim-lightweight
parent921c7baee8511eac0aa972139df3a238ac56299b (diff)
Mass-pnf-simulator publishing ports
Change-Id: If43f505967bd542c88956e11aef4cd4e52626255 Issue-ID: DCAEGEN2-1225 Signed-off-by: TamasBakai <tamas.bakai@est.tech>
Diffstat (limited to 'test/mocks/mass-pnf-sim/pnf-sim-lightweight')
-rw-r--r--test/mocks/mass-pnf-sim/pnf-sim-lightweight/README.md14
-rw-r--r--test/mocks/mass-pnf-sim/pnf-sim-lightweight/docker-compose-template.yml4
-rwxr-xr-xtest/mocks/mass-pnf-sim/pnf-sim-lightweight/simulator.sh19
-rw-r--r--test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/message/MessageProvider.java68
4 files changed, 50 insertions, 55 deletions
diff --git a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/README.md b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/README.md
index 2b20d261e..2940b65db 100644
--- a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/README.md
+++ b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/README.md
@@ -1,6 +1,6 @@
##Local development shortcuts:
####To start listening on port 10000 for test purposes
-`nc -l 10000`
+`nc -l -k -p 10000`
####Test the command above:
`echo "Hello World" | nc localhost 10000`
@@ -27,10 +27,12 @@ Accept-Encoding: gzip,deflate
```
```javascript
-{"commonEventHeader":{"startEpochMicrosec":"1551865758690","sourceId":"val13","eventId":"registration_51865758",
+{"event":{"commonEventHeader":{"startEpochMicrosec":"1551865758690","sourceId":"val13","eventId":"registration_51865758",
"nfcNamingCode":"oam","internalHeaderFields":{},"priority":"Normal","version":"4.0.1","reportingEntityName":"NOK6061ZW3",
-"sequence":"0","domain":"notification","lastEpochMicrosec":"1551865758690","eventName":"pnfRegistration_Nokia_5gDu","vesEventListenerVersion":"7.0.1",
-"sourceName":"NOK6061ZW3","nfNamingCode":"gNB"},"notificationFields":{"notificationFieldsVersion":"2.0","changeType":"FileReady",
-"changeIdentifier":"PM_MEAS_FILES","arrayOfNamedHashMap":{"name":"10MB.tar.gz",
-"hashMap":{"location":"10.11.0.68/10MB.tar.gz","fileFormatType":"org.3GPP.32.435#measCollec","fileFormatVersion":"V10","compression":"gzip"}}}}
+"sequence":"0","domain":"notification","lastEpochMicrosec":"1551865758690","eventName":"pnfRegistration_Nokia_5gDu",
+"vesEventListenerVersion":"7.0.1","sourceName":"NOK6061ZW3","nfNamingCode":"gNB"},
+"notificationFields":{"notificationFieldsVersion":"2.0","changeType":"FileReady","changeIdentifier":"PM_MEAS_FILES",
+"arrayOfNamedHashMap":[{"name":"10MB.tar.gz","hashMap":{
+"location":"ftpes://10.11.0.68/10MB.tar.gz","fileFormatType":"org.3GPP.32.435#measCollec",
+"fileFormatVersion":"V10","compression":"gzip"}}]}}}
``` \ No newline at end of file
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 f53226867..aa0261c0a 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
@@ -29,6 +29,8 @@ services:
networks:
front-${I}:
ipv4_address: "${IPSFTP}"
+ ports:
+ - "${PORTSFTP}:22"
volumes:
- ./files/onap/:/home/onap/
restart: on-failure
@@ -40,6 +42,8 @@ services:
networks:
front-${I}:
ipv4_address: "${IPFTPS}"
+ ports:
+ - "${PORTFTPS}:21"
environment:
FTP_USER: onap
FTP_PASSWORD: pano
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 bed64b0b7..86f15a8e2 100755
--- a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/simulator.sh
+++ b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/simulator.sh
@@ -20,8 +20,8 @@ function main(){
case $COMMAND in
"compose")
- compose $2 $3 $4 $5 $6 $7 $8;;
- #IPGW, #IPSUBNET, #I, #IPVES, #IPPNFSIM, #IPFTP, #IPSFTP,
+ compose $2 $3 $4 $5 $6 $7 $8 $9 "${10}" "${11}" ;;
+ #IPGW, #IPSUBNET, #I, #IPVES, #IPPNFSIM, #IPFILESERVER, #PORTSFTP, #PORTFTPS, #IPFTPS, #IPSFTP
"build")
build_image;;
"start")
@@ -64,8 +64,11 @@ function compose(){
export I=$3
export IPVES=$4
export IPPNFSIM=$5
- export IPFTPS=$6
- export IPSFTP=$7
+ export IPFILESERVER=$6
+ export PORTSFTP=$7
+ export PORTFTPS=$8
+ export IPFTPS=$9
+ export IPSFTP=${10}
#will insert $I to distinguish containers, networks properly
#docker compose cannot substitute these, as they are keys, not values.
@@ -78,7 +81,7 @@ function compose(){
set_vsftpd_file_owner
- write_config $IPVES $IPFTPS $IPSFTP $IPPNFSIM
+ write_config $IPVES $IPFILESERVER $PORTSFTP $PORTFTPS $IPPNFSIM
}
@@ -99,9 +102,9 @@ function set_vsftpd_file_owner() {
function write_config(){
#building a YML file for usage in Java
echo "vesip: $1" > config/config.yml
- echo "ipftps: $2" >> config/config.yml
- echo "ipsftp: $3" >> config/config.yml
- echo "ippnfsim: $4" >> config/config.yml
+ echo "ipsftp: $2:$3" >> config/config.yml
+ echo "ipftps: $2:$4" >> config/config.yml
+ echo "ippnfsim: $5" >> config/config.yml
}
function start(){
diff --git a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/message/MessageProvider.java b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/message/MessageProvider.java
index d59e82968..839d40269 100644
--- a/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/message/MessageProvider.java
+++ b/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/message/MessageProvider.java
@@ -114,24 +114,6 @@ public class MessageProvider {
JSONArray jsonArrayOfNamedHashMap = new JSONArray();
jsonArrayOfNamedHashMap.put(jsonHashMap);
-
-
- // // notification.put("name", "NAME_DUMMY");
- // JSONObject notification = new JSONObject();
- //
- // notificationParams.ifPresent(jsonObject -> {
- // copyParametersToFields(notification, notificationFields);
- // commonEventHeader.put(DOMAIN, DOMAIN_NOTIFICATION);
- // event.put(NOTIFICATION_FIELDS, notificationFields);
- // });
-
-
- // notificationParams.ifPresent(jsonObject -> {
- // copyParametersToFields(jsonObject.toMap(), notificationFields);
- // commonEventHeader.put(DOMAIN, DOMAIN_NOTIFICATION);
- // event.put(NOTIFICATION_FIELDS, notificationFields);
- // });
-
event.put(COMMON_EVENT_HEADER, commonEventHeader);
JSONObject root = new JSONObject();
root.put(EVENT, event);
@@ -141,7 +123,6 @@ public class MessageProvider {
public JSONObject createOneVesEvent(String xnfUrl, String fileName) {
- String notificationFields;
JSONObject nof = new JSONObject();
nof.put("notificationFieldsVersion", "2.0");
@@ -150,20 +131,20 @@ public class MessageProvider {
nof.put("changeIdentifier", "PM_MEAS_FILES");
JSONObject hm = new JSONObject();
- hm.put("location", xnfUrl.concat(fileName));
+ hm.put("location", "ftpes://".concat(xnfUrl).concat(fileName));
hm.put("fileFormatType", "org.3GPP.32.435#measCollec");
hm.put("fileFormatVersion", "V10");
hm.put("compression", "gzip");
- JSONObject aonh = new JSONObject();
- aonh.put("name", fileName);
+ JSONObject aonhElement = new JSONObject();
+ aonhElement.put("name", fileName);
+ aonhElement.put("hashMap", hm);
- aonh.put("hashMap", hm);
+ JSONArray aonh = new JSONArray();
+ aonh.put(aonhElement);
nof.put("arrayOfNamedHashMap", aonh);
- String nofString = nof.toString();
-
JSONObject ceh = new JSONObject(); // commonEventHandler
ceh.put("startEpochMicrosec", "1551865758690");
ceh.put("sourceId", "val13");
@@ -183,18 +164,23 @@ public class MessageProvider {
JSONObject ihf = new JSONObject(); // internalHeaderFields
ceh.put("internalHeaderFields", ihf);
+ JSONObject eventContent = new JSONObject();
+ eventContent.put("commonEventHeader", ceh);
+ eventContent.put("notificationFields", nof);
+
+
JSONObject event = new JSONObject();
- event.put("commonEventHeader", ceh);
- event.put("notificationFields", nof);
+ event.put("event", eventContent);
- System.out.println("event: ");
+ System.out.println("VES messages to be sent: ");
System.out.println(event.toString());
return event;
// @formatter:off
/*
- {
+ {
+ "event": {
"commonEventHeader": { <== "ceh"
"startEpochMicrosec": "1551865758690",
"sourceId": "val13",
@@ -217,21 +203,21 @@ public class MessageProvider {
"notificationFieldsVersion": "2.0",
"changeType": "FileReady",
"changeIdentifier": "PM_MEAS_FILES",
- "arrayOfNamedHashMap": { <== "aonh"
- "name": "A20161224.1030-1045.bin.gz",
- "hashMap": { <== "hm"
- "location": "ftpes://192.169.0.1:22/ftp/rop/A20161224.1030-1045.bin.gz",
- "fileFormatType": "org.3GPP.32.435#measCollec",
- "fileFormatVersion": "V10",
- "compression": "gzip"
+ "arrayOfNamedHashMap": [ <== "aonh"
+ { <== "aonhElement"
+ "name": "A20161224.1030-1045.bin.gz",
+ "hashMap": { <== "hm"
+ "location": "ftpes://192.169.0.1:22/ftp/rop/A20161224.1030-1045.bin.gz",
+ "fileFormatType": "org.3GPP.32.435#measCollec",
+ "fileFormatVersion": "V10",
+ "compression": "gzip"
+ }
}
- }
+ ]
}
}
-
- */
+ }
+ */
// @formatter:on
-
}
-
}