aboutsummaryrefslogtreecommitdiffstats
path: root/plans/dcaegen2-pmmapper/pmmapper
diff options
context:
space:
mode:
Diffstat (limited to 'plans/dcaegen2-pmmapper/pmmapper')
-rw-r--r--plans/dcaegen2-pmmapper/pmmapper/assets/addFeed3.txt44
-rw-r--r--plans/dcaegen2-pmmapper/pmmapper/assets/addSubscriber.txt35
-rw-r--r--plans/dcaegen2-pmmapper/pmmapper/assets/node.properties87
-rw-r--r--plans/dcaegen2-pmmapper/pmmapper/assets/provserver.properties60
-rw-r--r--plans/dcaegen2-pmmapper/pmmapper/composefile/docker-compose-e2e.yml67
-rw-r--r--plans/dcaegen2-pmmapper/pmmapper/composefile/docker-compose-pmmapper.yml14
-rw-r--r--plans/dcaegen2-pmmapper/pmmapper/docker-compose.yml117
-rw-r--r--plans/dcaegen2-pmmapper/pmmapper/setup.sh173
-rw-r--r--plans/dcaegen2-pmmapper/pmmapper/teardown.sh13
9 files changed, 416 insertions, 194 deletions
diff --git a/plans/dcaegen2-pmmapper/pmmapper/assets/addFeed3.txt b/plans/dcaegen2-pmmapper/pmmapper/assets/addFeed3.txt
new file mode 100644
index 00000000..60544d97
--- /dev/null
+++ b/plans/dcaegen2-pmmapper/pmmapper/assets/addFeed3.txt
@@ -0,0 +1,44 @@
+#-------------------------------------------------------------------------------
+# ============LICENSE_START==================================================
+# * org.onap.dmaap
+# * ===========================================================================
+# * Copyright © 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====================================================
+# *
+# * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+# *
+#-------------------------------------------------------------------------------
+{
+ "name": "Jettydemo",
+ "version": "m1.0",
+ "description": "Jettydemo",
+ "business_description": "Jettydemo",
+ "suspend": false,
+ "deleted": false,
+ "changeowner": true,
+ "authorization": {
+ "classification": "unclassified",
+ "endpoint_addrs": [
+ "<kafka-ip>",
+ ],
+ "endpoint_ids": [
+ {
+ "password": "rs873m",
+ "id": "rs873m"
+ }
+ ]
+ },
+}
+
diff --git a/plans/dcaegen2-pmmapper/pmmapper/assets/addSubscriber.txt b/plans/dcaegen2-pmmapper/pmmapper/assets/addSubscriber.txt
new file mode 100644
index 00000000..95cc2afb
--- /dev/null
+++ b/plans/dcaegen2-pmmapper/pmmapper/assets/addSubscriber.txt
@@ -0,0 +1,35 @@
+#-------------------------------------------------------------------------------
+# ============LICENSE_START==================================================
+# * org.onap.dmaap
+# * ===========================================================================
+# * Copyright © 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====================================================
+# *
+# * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+# *
+#-------------------------------------------------------------------------------
+{
+"delivery" :
+ {
+ "url" : "http://<kafka-ip>:7070/",
+ "user" : "datarouter",
+ "password" : "datarouter",
+ "use100" : true
+ },
+"metadataOnly" : false,
+"suspend" : false,
+"groupid" : 29,
+"subscriber" : "sg481n"
+}
diff --git a/plans/dcaegen2-pmmapper/pmmapper/assets/node.properties b/plans/dcaegen2-pmmapper/pmmapper/assets/node.properties
new file mode 100644
index 00000000..ddd4ebc8
--- /dev/null
+++ b/plans/dcaegen2-pmmapper/pmmapper/assets/node.properties
@@ -0,0 +1,87 @@
+#-------------------------------------------------------------------------------
+# ============LICENSE_START==================================================
+# * org.onap.dmaap
+# * ===========================================================================
+# * Copyright � 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====================================================
+# *
+# * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+# *
+#-------------------------------------------------------------------------------
+#
+# Configuration parameters set at startup for the DataRouter node
+#
+# URL to retrieve dynamic configuration
+ProvisioningURL = https://dmaap-dr-prov:8443/internal/prov
+#
+# URL to upload PUB/DEL/EXP logs
+LogUploadURL = https://dmaap-dr-prov:8443/internal/logs
+#
+# The port number for http as seen within the server
+IntHttpPort = 8080
+#
+# The port number for https as seen within the server
+IntHttpsPort = 8443
+#
+# The external port number for https taking port mapping into account
+ExtHttpsPort = 443
+#
+# The minimum interval between fetches of the dynamic configuration from the provisioning server
+MinProvFetchInterval = 10000
+#
+# The minimum interval between saves of the redirection data file
+MinRedirSaveInterval = 10000
+#
+# The path to the directory where log files are stored
+LogDir = /opt/app/datartr/logs
+#
+# The retention interval (in days) for log files
+LogRetention = 30
+#
+# The path to the directories where data and meta data files are stored
+SpoolDir = /opt/app/datartr/spool
+#
+# The path to the redirection data file
+RedirectionFile = etc/redirections.dat
+#
+# The type of keystore for https
+KeyStoreType = PKCS12
+#
+# The type of truststore for https
+TrustStoreType = jks
+#
+# The path to the file used to trigger an orderly shutdown
+QuiesceFile = etc/SHUTDOWN
+#
+# The key used to generate passwords for node to node transfers
+NodeAuthKey = Node123!
+#
+# DR_NODE DEFAULT ENABLED TLS PROTOCOLS
+NodeHttpsProtocols = TLSv1.1|TLSv1.2
+#
+# AAF type to generate permission string
+AAFType = org.onap.dmaap-dr.feed
+#
+# AAF default instance to generate permission string - default should be legacy
+AAFInstance = legacy
+#
+# AAF action to generate permission string - default should be publish
+AAFAction = publish
+#
+# AAF CADI enabled flag
+CadiEnabled = false
+#
+# AAF Props file path
+AAFPropsFilePath = /opt/app/osaaf/local/org.onap.dmaap-dr.props \ No newline at end of file
diff --git a/plans/dcaegen2-pmmapper/pmmapper/assets/provserver.properties b/plans/dcaegen2-pmmapper/pmmapper/assets/provserver.properties
new file mode 100644
index 00000000..20b5cb92
--- /dev/null
+++ b/plans/dcaegen2-pmmapper/pmmapper/assets/provserver.properties
@@ -0,0 +1,60 @@
+#-------------------------------------------------------------------------------
+# ============LICENSE_START==================================================
+# * org.onap.dmaap
+# * ===========================================================================
+# * Copyright � 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====================================================
+# *
+# * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+# *
+#-------------------------------------------------------------------------------
+
+#Jetty Server properties
+org.onap.dmaap.datarouter.provserver.http.port = 8080
+org.onap.dmaap.datarouter.provserver.https.port = 8443
+org.onap.dmaap.datarouter.provserver.https.relaxation = true
+
+org.onap.dmaap.datarouter.provserver.aafprops.path = /opt/app/osaaf/local/org.onap.dmaap-dr.props
+
+org.onap.dmaap.datarouter.provserver.accesslog.dir = /opt/app/datartr/logs
+org.onap.dmaap.datarouter.provserver.spooldir = /opt/app/datartr/spool
+org.onap.dmaap.datarouter.provserver.dbscripts = /opt/app/datartr/etc/misc
+org.onap.dmaap.datarouter.provserver.logretention = 30
+
+#DMAAP-597 (Tech Dept) REST request source IP auth
+# relaxation to accommodate OOM kubernetes deploy
+org.onap.dmaap.datarouter.provserver.isaddressauthenabled = false
+
+#Localhost address config
+org.onap.dmaap.datarouter.provserver.localhost = 127.0.0.1
+
+# Database access
+org.onap.dmaap.datarouter.db.driver = org.mariadb.jdbc.Driver
+org.onap.dmaap.datarouter.db.url = jdbc:mariadb://datarouter-mariadb:3306/datarouter
+org.onap.dmaap.datarouter.db.login = datarouter
+org.onap.dmaap.datarouter.db.password = datarouter
+
+# PROV - DEFAULT ENABLED TLS PROTOCOLS
+org.onap.dmaap.datarouter.provserver.https.include.protocols = TLSv1.1|TLSv1.2
+
+# AAF config
+org.onap.dmaap.datarouter.provserver.cadi.enabled = false
+
+org.onap.dmaap.datarouter.provserver.passwordencryption = PasswordEncryptionKey#@$%^&1234#
+org.onap.dmaap.datarouter.provserver.aaf.feed.type = org.onap.dmaap-dr.feed
+org.onap.dmaap.datarouter.provserver.aaf.sub.type = org.onap.dmaap-dr.sub
+org.onap.dmaap.datarouter.provserver.aaf.instance = legacy
+org.onap.dmaap.datarouter.provserver.aaf.action.publish = publish
+org.onap.dmaap.datarouter.provserver.aaf.action.subscribe = subscribe \ No newline at end of file
diff --git a/plans/dcaegen2-pmmapper/pmmapper/composefile/docker-compose-e2e.yml b/plans/dcaegen2-pmmapper/pmmapper/composefile/docker-compose-e2e.yml
deleted file mode 100644
index bf28b9fa..00000000
--- a/plans/dcaegen2-pmmapper/pmmapper/composefile/docker-compose-e2e.yml
+++ /dev/null
@@ -1,67 +0,0 @@
-version: '2.1'
-services:
- datarouter-prov:
- image: nexus3.onap.org:10001/onap/dmaap/datarouter-prov
- container_name: datarouter-prov
- hostname: dmaap-dr-prov
- ports:
- - "443:8443"
- - "8443:8443"
- - "8080:8080"
- volumes:
- - ../prov_data/provserver.properties:/opt/app/datartr/etc/provserver.properties
- - ../prov_data/addSubscriber.txt:/opt/app/datartr/addSubscriber.txt
- - ../prov_data/addFeed3.txt:/opt/app/datartr/addFeed3.txt
- depends_on:
- mariadb_container:
- condition: service_healthy
- healthcheck:
- test: ["CMD", "curl", "-f", "http://dmaap-dr-prov:8080/internal/prov"]
- interval: 10s
- timeout: 10s
- retries: 5
- extra_hosts:
- - "dmaap-dr-node:1.1.1.1"
- - "dcae-pm-mapper:3.3.3.3"
-
- datarouter-node:
- image: nexus3.onap.org:10001/onap/dmaap/datarouter-node
- container_name: datarouter-node
- hostname: dmaap-dr-node
- ports:
- - "9443:8443"
- - "9090:8080"
- volumes:
- - ../node_data/node.properties:/opt/app/datartr/etc/node.properties
- depends_on:
- datarouter-prov:
- condition: service_healthy
- extra_hosts:
- - "dmaap-dr-prov:2.2.2.2"
- - "dcae-pm-mapper:3.3.3.3"
-
- mariadb_container:
- image: mariadb:10.2.14
- container_name: mariadb
- ports:
- - "3306:3306"
- environment:
- MYSQL_ROOT_PASSWORD: datarouter
- MYSQL_DATABASE: datarouter
- MYSQL_USER: datarouter
- MYSQL_PASSWORD: datarouter
- healthcheck:
- test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost", "--silent"]
- interval: 10s
- timeout: 30s
- retries: 5
-
- consul:
- container_name: consul
- image: nexus3.onap.org:10001/consul:latest
-
- cbs:
- container_name: cbs
- image: nexus3.onap.org:10001/onap/org.onap.dcaegen2.platform.configbinding.app-app:latest
- environment:
- CONSUL_HOST: \ No newline at end of file
diff --git a/plans/dcaegen2-pmmapper/pmmapper/composefile/docker-compose-pmmapper.yml b/plans/dcaegen2-pmmapper/pmmapper/composefile/docker-compose-pmmapper.yml
deleted file mode 100644
index 7646c0b4..00000000
--- a/plans/dcaegen2-pmmapper/pmmapper/composefile/docker-compose-pmmapper.yml
+++ /dev/null
@@ -1,14 +0,0 @@
-version: '2.1'
-services:
- pmmapper:
- container_name: pmmapper
- image: nexus3.onap.org:10001/onap/org.onap.dcaegen2.services.pm-mapper:1.1.3
- ports:
- - "8081:8081"
- environment:
- CONFIG_BINDING_SERVICE_SERVICE_HOST: CBSIP
- CONFIG_BINDING_SERVICE_SERVICE_PORT: 10000
- HOSTNAME: pmmapper
- extra_hosts:
- - "dmaap-dr-node:1.1.1.1"
- - "message-router:4.4.4.4"
diff --git a/plans/dcaegen2-pmmapper/pmmapper/docker-compose.yml b/plans/dcaegen2-pmmapper/pmmapper/docker-compose.yml
new file mode 100644
index 00000000..0843650e
--- /dev/null
+++ b/plans/dcaegen2-pmmapper/pmmapper/docker-compose.yml
@@ -0,0 +1,117 @@
+version: '3.3'
+
+services:
+ datarouter-prov:
+ image: nexus3.onap.org:10001/onap/dmaap/datarouter-prov
+ container_name: datarouter-prov
+ hostname: dmaap-dr-prov
+ ports:
+ - "443:8443"
+ - "8443:8443"
+ - "8080:8080"
+ volumes:
+ - /var/tmp/provserver.properties:/opt/app/datartr/etc/provserver.properties
+ - /var/tmp/addSubscriber.txt:/opt/app/datartr/addSubscriber.txt
+ - /var/tmp/addFeed3.txt:/opt/app/datartr/addFeed3.txt
+ depends_on:
+ - mariadb
+ healthcheck:
+ test: ["CMD", "curl", "-f", "http://dmaap-dr-prov:8080/internal/prov"]
+ interval: 10s
+ timeout: 10s
+ retries: 5
+ networks:
+ pmmapper-network:
+ ipv4_address: $DR_PROV_IP
+ extra_hosts:
+ - "dmaap-dr-node:$DR_NODE_IP"
+ - "dcae-pm-mapper:$PMMAPPER_IP"
+
+ datarouter-node:
+ image: nexus3.onap.org:10001/onap/dmaap/datarouter-node
+ container_name: datarouter-node
+ hostname: dmaap-dr-node
+ ports:
+ - "9443:8443"
+ - "9090:8080"
+ volumes:
+ - /var/tmp/node.properties:/opt/app/datartr/etc/node.properties
+ depends_on:
+ - datarouter-prov
+ networks:
+ pmmapper-network:
+ ipv4_address: $DR_NODE_IP
+ extra_hosts:
+ - "dmaap-dr-prov:$DR_PROV_IP"
+ - "dcae-pm-mapper:$PMMAPPER_IP"
+
+ node:
+ image: node:10-slim
+ container_name: mr-simulator
+ volumes:
+ - /var/tmp/mrserver.js:/tmp/mrserver.js
+ command:
+ nodejs /tmp/mrserver.js
+ networks:
+ pmmapper-network:
+ ipv4_address: $NODE_IP
+
+ mariadb:
+ image: mariadb:10.2.14
+ container_name: mariadb
+ ports:
+ - "3306:3306"
+ environment:
+ MYSQL_ROOT_PASSWORD: datarouter
+ MYSQL_DATABASE: datarouter
+ MYSQL_USER: datarouter
+ MYSQL_PASSWORD: datarouter
+ healthcheck:
+ test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost", "--silent"]
+ interval: 10s
+ timeout: 30s
+ retries: 5
+ networks:
+ pmmapper-network:
+ ipv4_address: $MARIADB_IP
+
+ consul:
+ container_name: consul
+ image: nexus3.onap.org:10001/consul:latest
+ networks:
+ pmmapper-network:
+ ipv4_address: $CONSUL_IP
+
+ cbs:
+ container_name: cbs
+ image: nexus3.onap.org:10001/onap/org.onap.dcaegen2.platform.configbinding.app-app:latest
+ environment:
+ CONSUL_HOST: $CONSUL_IP
+ networks:
+ pmmapper-network:
+ ipv4_address: $CBS_IP
+
+ pmmapper:
+ container_name: pmmapper
+ image: nexus3.onap.org:10001/onap/org.onap.dcaegen2.services.pm-mapper:1.1.3
+ ports:
+ - "8081:8081"
+ environment:
+ CONFIG_BINDING_SERVICE_SERVICE_HOST: $CBS_IP
+ CONFIG_BINDING_SERVICE_SERVICE_PORT: 10000
+ HOSTNAME: pmmapper
+ networks:
+ pmmapper-network:
+ ipv4_address: $PMMAPPER_IP
+ extra_hosts:
+ - "dmaap-dr-node:$DR_NODE_IP"
+ - "message-router:$NODE_IP"
+
+
+networks:
+ pmmapper-network:
+ driver: bridge
+ ipam:
+ config:
+ - subnet: 172.18.0.0/16
+
diff --git a/plans/dcaegen2-pmmapper/pmmapper/setup.sh b/plans/dcaegen2-pmmapper/pmmapper/setup.sh
index 29b8d9c5..4645223a 100644
--- a/plans/dcaegen2-pmmapper/pmmapper/setup.sh
+++ b/plans/dcaegen2-pmmapper/pmmapper/setup.sh
@@ -2,136 +2,101 @@
# Place the scripts in run order:
source ${SCRIPTS}/common_functions.sh
-# Clone DMaaP Message Router repo
-mkdir -p $WORKSPACE/archives/dmaapmr
-cd $WORKSPACE/archives/dmaapmr
-git clone --depth 1 http://gerrit.onap.org/r/dmaap/messagerouter/messageservice -b master
-sed -i 's/enableCadi: false/enableCadi: "false"/g' /$WORKSPACE/archives/dmaapmr/messageservice/src/main/resources/docker-compose/docker-compose.yml
-cd $WORKSPACE/archives/dmaapmr/messageservice/src/main/resources/docker-compose
-cp $WORKSPACE/archives/dmaapmr/messageservice/bundleconfig-local/etc/appprops/MsgRtrApi.properties /var/tmp/
-
-# start DMaaP MR containers with docker compose and configuration from docker-compose.yml
docker login -u docker -p docker nexus3.onap.org:10001
-docker-compose up -d
-ZOOKEEPER=$(docker ps -a -q --filter="name=zookeeper_1")
-KAFKA=$(docker ps -a -q --filter="name=kafka_1")
-DMAAP=$(docker ps -a -q --filter="name=dmaap_1")
+TEST_PLANS_DIR=$WORKSPACE/plans/dcaegen2-pmmapper/pmmapper
-# Get IP address of KAFKA, Zookeeper
-KAFKA_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $KAFKA)
-ZOOKEEPER_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $ZOOKEEPER)
+export GATEWAY_IP=172.18.0.1
+export DR_NODE_IP=172.18.0.2
+export DR_PROV_IP=172.18.0.3
+export CONSUL_IP=172.18.0.4
+export CBS_IP=172.18.0.5
+export MARIADB_IP=172.18.0.6
+export NODE_IP=172.18.0.7
+export PMMAPPER_IP=172.18.0.8
-# Shutdown DMAAP Container
-docker kill $DMAAP
+for asset in provserver.properties addSubscriber.txt addFeed3.txt node.properties cbs.json mrserver.js; do
+ cp $TEST_PLANS_DIR/assets/${asset} /var/tmp/
+done
-# Initial docker-compose up and down is for populating kafka and zookeeper IPs in /var/tmp/MsgRtrApi.properites
-sed -i -e '/config.zk.servers=/ s/=.*/='$ZOOKEEPER_IP'/' /var/tmp/MsgRtrApi.properties
-sed -i -e '/kafka.metadata.broker.list=/ s/=.*/='$KAFKA_IP':9092/' /var/tmp/MsgRtrApi.properties
+sed -i 's/datarouter-mariadb/'$MARIADB_IP'/g' /var/tmp/provserver.properties
+#sed -i 's/<kafka-ip>/'$KAFKA_IP'/g' /var/tmp/addSubscriber.txt
+#sed -i 's/<kafka-ip>/'$KAFKA_IP'/g' /var/tmp/addFeed3.txt
+#sed -i 's/ipaddress/'$CBS_IP'/g' /var/tmp/cbs.json
+sed -i 's/ipaddress//g' /var/tmp/cbs.json
-# Start DMaaP MR containers with docker compose and configuration from docker-compose.yml
-docker login -u docker -p docker nexus3.onap.org:10001
-docker-compose up -d
-sleep 5
-
-# Get IP address of DMAAP Message Router.
-DMAAP_MR_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $DMAAP)
-
-# Clone DMaaP Data Router repo and Initialization of Data Router, Consul, Config Binding Service
-mkdir -p $WORKSPACE/archives/dmaapdr
-cd $WORKSPACE/archives/dmaapdr
-git clone --depth 1 https://gerrit.onap.org/r/dmaap/datarouter -b master
-cd $WORKSPACE/archives/dmaapdr/datarouter/datarouter-docker-compose/src/main/resources
-mkdir docker-compose
-cd $WORKSPACE/archives/dmaapdr/datarouter/datarouter-docker-compose/src/main/resources/docker-compose
-cp $WORKSPACE/plans/dcaegen2-pmmapper/pmmapper/composefile/docker-compose-e2e.yml $WORKSPACE/archives/dmaapdr/datarouter/datarouter-docker-compose/src/main/resources/docker-compose/docker-compose.yml
-docker login -u docker -p docker nexus3.onap.org:10001
-docker-compose up -d
-echo "Disregard the message ERROR: for datarouter-node Container 1234456 is unhealthy, this is expected behaiour at this stage"
-sleep 10
-docker kill cbs
-CONSUL_IP=$(docker inspect '--format={{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' consul )
-sed -i -e '/CONSUL_HOST:/ s/:.*/: '$CONSUL_IP'/' docker-compose.yml
-MARIADB=$(docker inspect '--format={{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' mariadb )
-sed -i 's/datarouter-mariadb/'$MARIADB'/g' $WORKSPACE/archives/dmaapdr/datarouter/datarouter-docker-compose/src/main/resources/prov_data/provserver.properties
-docker-compose up -d
-DR_PROV_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' datarouter-prov)
-DR_NODE_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' datarouter-node)
-
-# Consul Configuration for PM Mapper
-cp $WORKSPACE/plans/dcaegen2-pmmapper/pmmapper/assets/cbs.json /tmp/cbs.json
-sed -i 's/ipaddress/'${CBS_IP}'/g' /tmp/cbs.json
-curl --request PUT --data @/tmp/cbs.json http://$CONSUL_IP:8500/v1/agent/service/register
-curl 'http://'$CONSUL_IP':8500/v1/kv/pmmapper?dc=dc1' -X PUT -H 'Accept: application/json' -H 'Content-Type: application/json' -H 'X-Requested-With: XMLHttpRequest' --data @$WORKSPACE/plans/dcaegen2-pmmapper/pmmapper/assets/config.json
-
-# PM Mapper startup and configuration
-mkdir /tmp/docker-compose
-cd /tmp/docker-compose
-cp $WORKSPACE/plans/dcaegen2-pmmapper/pmmapper/composefile/docker-compose-pmmapper.yml /tmp/docker-compose/docker-compose.yml
-CBS_IP=$(docker inspect '--format={{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' cbs)
-sed -i 's/CBSIP/'$CBS_IP'/g' docker-compose.yml
-sed -i 's/1.1.1.1/'$DR_NODE_IP'/g' docker-compose.yml
-sed -i 's/4.4.4.4/'$MARIADB'/g' docker-compose.yml
-docker-compose up -d
-
-cd $WORKSPACE/archives/dmaapdr/datarouter/datarouter-docker-compose/src/main/resources/docker-compose
-PMMAPPER_IP=$(docker inspect '--format={{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' pmmapper)
-docker kill datarouter-node
-docker kill datarouter-prov
-sed -i 's/1.1.1.1/'$DR_NODE_IP'/g' docker-compose.yml
-sed -i 's/2.2.2.2/'$DR_PROV_IP'/g' docker-compose.yml
-sed -i 's/3.3.3.3/'$PMMAPPER_IP'/g' docker-compose.yml
-docker-compose up -d
+docker-compose -f $TEST_PLANS_DIR/docker-compose.yml up -d mariadb consul cbs node
+
+echo "Waiting for MariaDB to come up healthy..."
+for i in {1..30}; do
+ mariadb_state=$(docker inspect --format='{{json .State.Health.Status}}' mariadb)
+ if [ $mariadb_state = '"healthy"' ]
+ then
+ break
+ else
+ sleep 2
+ fi
+done
+[ "$mariadb_state" != '"healthy"' ] && echo "Error: MariaDB container state not healthy" && exit 1
+
+docker-compose -f $TEST_PLANS_DIR/docker-compose.yml up -d datarouter-node datarouter-prov
+
+curl --request PUT --data @/var/tmp/cbs.json http://$CONSUL_IP:8500/v1/agent/service/register
+curl 'http://'$CONSUL_IP':8500/v1/kv/pmmapper?dc=dc1' -X PUT \
+ -H 'Accept: application/json' \
+ -H 'Content-Type: application/json' \
+ -H 'X-Requested-With: XMLHttpRequest' \
+ --data @$TEST_PLANS_DIR/assets/config.json
+
+docker-compose -f $TEST_PLANS_DIR/docker-compose.yml up -d pmmapper
+sleep 2
# Setting up PM Mapper certs.
-docker cp $WORKSPACE/plans/dcaegen2-pmmapper/pmmapper/assets/cert.jks.b64 pmmapper:opt/app/pm-mapper/etc/
-docker cp $WORKSPACE/plans/dcaegen2-pmmapper/pmmapper/assets/jks.pass pmmapper:opt/app/pm-mapper/etc/
-docker cp $WORKSPACE/plans/dcaegen2-pmmapper/pmmapper/assets/trust.jks.b64 pmmapper:opt/app/pm-mapper/etc/
-docker cp $WORKSPACE/plans/dcaegen2-pmmapper/pmmapper/assets/trust.pass pmmapper:opt/app/pm-mapper/etc/
-docker restart pmmapper
+docker cp $TEST_PLANS_DIR/assets/cert.jks.b64 pmmapper:opt/app/pm-mapper/etc/
+docker cp $TEST_PLANS_DIR/assets/jks.pass pmmapper:opt/app/pm-mapper/etc/
+docker cp $TEST_PLANS_DIR/assets/trust.jks.b64 pmmapper:opt/app/pm-mapper/etc/
+docker cp $TEST_PLANS_DIR/assets/trust.pass pmmapper:opt/app/pm-mapper/etc/
+
+docker-compose -f $TEST_PLANS_DIR/docker-compose.yml restart pmmapper
# Wait for initialization of Docker container for datarouter-node, datarouter-prov and mariadb, Consul, CBS
+containers_ok=false
for i in {1..5}; do
if [ $(docker inspect --format '{{ .State.Running }}' datarouter-node) ] && \
[ $(docker inspect --format '{{ .State.Running }}' datarouter-prov) ] && \
[ $(docker inspect --format '{{ .State.Running }}' mariadb) ] && \
+ [ $(docker inspect --format '{{ .State.Running }}' mr-simulator) ] && \
[ $(docker inspect --format '{{ .State.Running }}' consul) ] && \
[ $(docker inspect --format '{{ .State.Running }}' cbs) ] && \
- [ $(docker inspect --format '{{ .State.Running }}' pmmapper) ] && \
- [ $(docker inspect --format '{{ .State.Running }}' $KAFKA) ] && \
- [ $(docker inspect --format '{{ .State.Running }}' $ZOOKEEPER) ] && \
- [ $(docker inspect --format '{{ .State.Running }}' $DMAAP) ]
+ [ $(docker inspect --format '{{ .State.Running }}' pmmapper) ]
then
- echo "Message Router, Data Router, Consul, Config Binding Service Running and PM Mapper services are running healthy"
+ echo "All required docker containers are up."
+ containers_ok=true
break
else
- echo sleep $i
sleep $i
fi
done
+[ "$containers_ok" = "false" ] && echo "Error: required container not running." && exit 1
+
# Data Router Configuration.
-DR_NODE_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' datarouter-node)
-DR_GATEWAY_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.Gateway}}{{end}}' datarouter-prov)
-docker exec -i datarouter-prov sh -c "curl -k -X PUT https://$DR_PROV_IP:8443/internal/api/NODES?val=dmaap-dr-node\|$DR_GATEWAY_IP"
-docker exec -i datarouter-prov sh -c "curl -k -X PUT https://$DR_PROV_IP:8443/internal/api/PROV_AUTH_ADDRESSES?val=dmaap-dr-prov\|$DR_GATEWAY_IP"
+docker exec -i datarouter-prov sh -c \
+ "curl -k -X PUT https://$DR_PROV_IP:8443/internal/api/NODES?val=dmaap-dr-node\|$GATEWAY_IP"
+docker exec -i datarouter-prov sh -c \
+ "curl -k -X PUT https://$DR_PROV_IP:8443/internal/api/PROV_AUTH_ADDRESSES?val=dmaap-dr-prov\|$GATEWAY_IP"
# Create PM Mapper feed and create PM Mapper subscriber on data router
-curl -v -X POST -H "Content-Type:application/vnd.dmaap-dr.feed" -H "X-DMAAP-DR-ON-BEHALF-OF:pmmapper" --data-ascii @$WORKSPACE/plans/dcaegen2-pmmapper/pmmapper/assets/createFeed.json --post301 --location-trusted -k https://${DR_PROV_IP}:8443
-curl -v -X POST -H "Content-Type:application/vnd.dmaap-dr.subscription" -H "X-DMAAP-DR-ON-BEHALF-OF:pmmapper" --data-ascii @$WORKSPACE/plans/dcaegen2-pmmapper/pmmapper/assets/addSubscriber.json --post301 --location-trusted -k https://${DR_PROV_IP}:8443/subscribe/1
-
-# Simulation setup for Message Router
-docker cp $WORKSPACE/plans/dcaegen2-pmmapper/pmmapper/assets/mrserver.js mariadb:/
-docker exec mariadb /bin/bash -c "apt update"
-sleep 2
-docker exec mariadb /bin/bash -c "apt install nodejs -y"
-sleep 10
-docker exec mariadb /bin/bash -c "nodejs mrserver.js &" &
-
-PMMAPPER_IP=$(docker inspect '--format={{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' pmmapper)
-docker exec pmmapper /bin/sh -c "cat /var/log/ONAP/dcaegen2/services/pm-mapper/pm-mapper_output.log" > /tmp/pmmapper.log
-cat /tmp/pmmapper.log
+curl -v -X POST -H "Content-Type:application/vnd.dmaap-dr.feed" -H "X-DMAAP-DR-ON-BEHALF-OF:pmmapper" \
+ --data-ascii @$TEST_PLANS_DIR/assets/createFeed.json \
+ --post301 --location-trusted -k https://${DR_PROV_IP}:8443
+curl -v -X POST -H "Content-Type:application/vnd.dmaap-dr.subscription" -H "X-DMAAP-DR-ON-BEHALF-OF:pmmapper" \
+ --data-ascii @$TEST_PLANS_DIR/assets/addSubscriber.json \
+ --post301 --location-trusted -k https://${DR_PROV_IP}:8443/subscribe/1
+
+docker cp pmmapper:/var/log/ONAP/dcaegen2/services/pm-mapper/pm-mapper_output.log /tmp/pmmapper.log
docker exec -it datarouter-prov sh -c "curl http://dmaap-dr-node:8080/internal/fetchProv"
sleep 10
curl -k https://$DR_PROV_IP:8443/internal/prov
+
#Pass any variables required by Robot test suites in ROBOT_VARIABLES
-ROBOT_VARIABLES="-v CONSUL_IP:${CONSUL_IP} -v DR_PROV_IP:${DR_PROV_IP} -v DMAAP_MR_IP:${DMAAP_MR_IP} -v CBS_IP:${CBS_IP} -v PMMAPPER_IP:${PMMAPPER_IP} -v DR_NODE_IP:${DR_NODE_IP}" \ No newline at end of file
+ROBOT_VARIABLES="-v CONSUL_IP:${CONSUL_IP} -v DR_PROV_IP:${DR_PROV_IP} -v DMAAP_MR_IP:${DMAAP_MR_IP} -v CBS_IP:${CBS_IP} -v PMMAPPER_IP:${PMMAPPER_IP} -v DR_NODE_IP:${DR_NODE_IP}"
diff --git a/plans/dcaegen2-pmmapper/pmmapper/teardown.sh b/plans/dcaegen2-pmmapper/pmmapper/teardown.sh
index 45ef0d93..77bed8e0 100644
--- a/plans/dcaegen2-pmmapper/pmmapper/teardown.sh
+++ b/plans/dcaegen2-pmmapper/pmmapper/teardown.sh
@@ -1,12 +1,7 @@
#!/bin/bash
echo "Starting teardown script"
+TEST_PLANS_DIR=$WORKSPACE/plans/dcaegen2-pmmapper/pmmapper
+mkdir -p $WORKSPACE/archives
docker exec pmmapper /bin/sh -c "cat /var/log/ONAP/dcaegen2/services/pm-mapper/pm-mapper_output.log"
-kill-instance.sh $DMAAP
-kill-instance.sh $KAFKA
-kill-instance.sh $ZOOKEEPER
-kill-instance.sh datarouter-node
-kill-instance.sh datarouter-prov
-kill-instance.sh mariadb
-kill-instance.sh cbs
-kill-instance.sh consul
-kill-instance.sh pmmapper \ No newline at end of file
+docker-compose -f $TEST_PLANS_DIR/docker-compose.yml logs > $WORKSPACE/archives/pmmapper-docker-compose.log
+docker-compose -f $TEST_PLANS_DIR/docker-compose.yml down -v