From fa357dfc37bb5a71689a8390a287f7ec74a3fdd9 Mon Sep 17 00:00:00 2001 From: TamasBakai Date: Thu, 15 Aug 2019 08:25:27 +0000 Subject: Simulator integration for CSIT of generalized DfC Issue-ID: DCAEGEN2-1719 Change-Id: I963cfaef30bc4e85d76fecddd310f091e8c00bd0 Signed-off-by: TamasBakai --- .../dr-sim/dmaapDR.js | 2 +- .../dr-sim/docker-compose.yml | 2 +- .../datafilecollector-testharness/mr-sim/mr-sim.py | 3 +- .../simulator-group/consul/c12_feed2_PM.json | 2 +- .../simulator-group/consul/c12_feed2_PM_MEAS.json | 32 ++++++++++++++++++++++ .../simulator-group/consul/consul_config.json | 0 .../simulator-group/consul_config.sh | 19 ++++--------- .../simulator-group/simulators-start.sh | 2 +- 8 files changed, 43 insertions(+), 19 deletions(-) create mode 100644 test/mocks/datafilecollector-testharness/simulator-group/consul/c12_feed2_PM_MEAS.json create mode 100644 test/mocks/datafilecollector-testharness/simulator-group/consul/consul_config.json diff --git a/test/mocks/datafilecollector-testharness/dr-sim/dmaapDR.js b/test/mocks/datafilecollector-testharness/dr-sim/dmaapDR.js index f94600ae4..e307cf66f 100644 --- a/test/mocks/datafilecollector-testharness/dr-sim/dmaapDR.js +++ b/test/mocks/datafilecollector-testharness/dr-sim/dmaapDR.js @@ -35,7 +35,7 @@ const tc_10p_error_response = "10p_error_response"; const tc_10first_error_response = "10first_error_response"; const tc_100first_error_response = "100first_error_response"; -var drr_sim_ip = '127.0.0.1'; //IP for redirect to DR redir sim. Can be changed by env DRR_SIM_IP +var drr_sim_ip = 'drsim_redir'; //IP for redirect to DR redir sim. Can be changed by env DRR_SIM_IP //Counters var ctr_publish_query = []; diff --git a/test/mocks/datafilecollector-testharness/dr-sim/docker-compose.yml b/test/mocks/datafilecollector-testharness/dr-sim/docker-compose.yml index 1ad478886..4d98c708e 100644 --- a/test/mocks/datafilecollector-testharness/dr-sim/docker-compose.yml +++ b/test/mocks/datafilecollector-testharness/dr-sim/docker-compose.yml @@ -14,4 +14,4 @@ services: - "3908:3908" - "3909:3909" container_name: drsim_redir - command: node dmaapDR_redir.js \ No newline at end of file + command: node dmaapDR_redir.js \ No newline at end of file diff --git a/test/mocks/datafilecollector-testharness/mr-sim/mr-sim.py b/test/mocks/datafilecollector-testharness/mr-sim/mr-sim.py index eefc61e1d..51e0badef 100644 --- a/test/mocks/datafilecollector-testharness/mr-sim/mr-sim.py +++ b/test/mocks/datafilecollector-testharness/mr-sim/mr-sim.py @@ -18,7 +18,7 @@ sftp_hosts=[] sftp_ports=[] ftps_hosts=[] ftps_ports=[] -num_ftp_servers=0 +num_ftp_servers=1 def sumList(ctrArray): tmp=0 @@ -1218,6 +1218,7 @@ if __name__ == "__main__": ftps_ports.append(hp[1]) groups = os.environ.get('MR_GROUPS', 'OpenDcae-c12:PM_MEAS_FILES') + print("Groups detected: " + groups ) configuredPrefixes = os.environ.get('MR_FILE_PREFIX_MAPPING', 'PM_MEAS_FILES:A') if (len(groups) == 0 ): diff --git a/test/mocks/datafilecollector-testharness/simulator-group/consul/c12_feed2_PM.json b/test/mocks/datafilecollector-testharness/simulator-group/consul/c12_feed2_PM.json index 9974c187f..8b87a5c3a 100644 --- a/test/mocks/datafilecollector-testharness/simulator-group/consul/c12_feed2_PM.json +++ b/test/mocks/datafilecollector-testharness/simulator-group/consul/c12_feed2_PM.json @@ -24,7 +24,7 @@ "streams_subscribes":{ "dmaap_subscriber":{ "dmaap_info":{ - "topic_url":"http://dradmin:dradmin@mrsim:2222/events/unauthenticated.VES_NOTIFICATION_OUTPUT/OpenDcae-c12/C12" + "topic_url":"http://dradmin:dradmin@dfc_mr-sim:2222/events/unauthenticated.VES_NOTIFICATION_OUTPUT/OpenDcae-c12/C12" }, "type":"message_router" } diff --git a/test/mocks/datafilecollector-testharness/simulator-group/consul/c12_feed2_PM_MEAS.json b/test/mocks/datafilecollector-testharness/simulator-group/consul/c12_feed2_PM_MEAS.json new file mode 100644 index 000000000..9974c187f --- /dev/null +++ b/test/mocks/datafilecollector-testharness/simulator-group/consul/c12_feed2_PM_MEAS.json @@ -0,0 +1,32 @@ +{ + "dmaap.ftpesConfig.keyCert":"config/dfc.jks", + "dmaap.ftpesConfig.keyPassword":"secret", + "dmaap.ftpesConfig.trustedCa":"config/ftp.jks", + "dmaap.ftpesConfig.trustedCaPassword":"secret", + "dmaap.security.trustStorePath":"change it", + "dmaap.security.trustStorePasswordPath":"trustStorePasswordPath", + "dmaap.security.keyStorePath":"keyStorePath", + "dmaap.security.keyStorePasswordPath":"change it", + "dmaap.security.enableDmaapCertAuth":"false", + "streams_publishes":{ + "PM_MEAS_FILES":{ + "type":"data_router", + "dmaap_info":{ + "username": "user", + "log_url": "https://drsim:3907/feedlog/2", + "publish_url": "https://drsim:3907/publish/2", + "location": "loc00", + "password": "password", + "publisher_id": "972.360gm" + } + } + }, + "streams_subscribes":{ + "dmaap_subscriber":{ + "dmaap_info":{ + "topic_url":"http://dradmin:dradmin@mrsim:2222/events/unauthenticated.VES_NOTIFICATION_OUTPUT/OpenDcae-c12/C12" + }, + "type":"message_router" + } + } +} diff --git a/test/mocks/datafilecollector-testharness/simulator-group/consul/consul_config.json b/test/mocks/datafilecollector-testharness/simulator-group/consul/consul_config.json new file mode 100644 index 000000000..e69de29bb diff --git a/test/mocks/datafilecollector-testharness/simulator-group/consul_config.sh b/test/mocks/datafilecollector-testharness/simulator-group/consul_config.sh index a3492b93d..5e8f7e2d4 100755 --- a/test/mocks/datafilecollector-testharness/simulator-group/consul_config.sh +++ b/test/mocks/datafilecollector-testharness/simulator-group/consul_config.sh @@ -1,4 +1,5 @@ #!/bin/bash +bash -x # Script to configure consul with json configuration files with 'localhost' urls. This # is needed when running the simulator as as a stand-alone app or via a dfc container in 'host' network mode. @@ -24,20 +25,10 @@ if ! [ -f $3 ]; then exit 1 fi -if [ $1 == "app" ]; then - appname=$DFC_APP_BASE$2 - echo "Replacing 'mrsim' with 'localhost' in json app config for consul" - sed 's/mrsim/localhost/g' $3 > .tmp_file.json -elif [ $1 == "dmaap" ]; then - appname=$DFC_APP_BASE$2":dmaap" - echo "Replacing 'drsim' with 'localhost' in json dmaap config for consul" - sed 's/drsim/localhost/g' $3 > .tmp_file.json -else - __print_err "config type should be 'app' or 'dmaap'" - exit 1 -fi - echo "Configuring consul for " $appname " from " $3 -curl -s http://127.0.0.1:${CONSUL_PORT}/v1/kv/${appname}?dc=dc1 -X PUT -H 'Accept: application/json' -H 'Content-Type: application/json' -H 'X-Requested-With: XMLHttpRequest' --data-binary "@"$tmp_file.json >/dev/null +curl -s http://127.0.0.1:${CONSUL_PORT}/v1/kv/${appname}?dc=dc1 -X PUT -H 'Accept: application/json' -H 'Content-Type: application/json' -H 'X-Requested-With: XMLHttpRequest' --data-binary "@"$3 + +echo "Reading back from consul:" +curl "http://127.0.0.1:${CONSUL_PORT}/v1/kv/${appname}?dc=dc1&raw=0" echo "done" \ No newline at end of file diff --git a/test/mocks/datafilecollector-testharness/simulator-group/simulators-start.sh b/test/mocks/datafilecollector-testharness/simulator-group/simulators-start.sh index 82ad6aa1e..9370f99a6 100755 --- a/test/mocks/datafilecollector-testharness/simulator-group/simulators-start.sh +++ b/test/mocks/datafilecollector-testharness/simulator-group/simulators-start.sh @@ -1,5 +1,5 @@ #!/bin/bash - +set -x server_check() { for i in {1..10}; do res=$(curl -s -o /dev/null -w "%{http_code}" localhost:$2$3) -- cgit 1.2.3-korg