From 0736c9f21b579973214d1a65ac218b9da7d11086 Mon Sep 17 00:00:00 2001 From: Sumithra Date: Tue, 5 Jan 2021 03:33:28 -0800 Subject: Add CSIT for slice-analysis-ms Issue-ID: DCAEGEN2-2560 Signed-off-by: Sumithra Change-Id: Ib776f759ba10e1d95d68ac4bc9da576b6063a59a --- .../testsuites/config/dmaap/MsgRtrApi.properties | 171 +++++++++++++++++++++ .../config/sliceanalysisms/config_all.json | 86 +++++++++++ .../testsuites/config/sliceanalysisms/trust.jks | Bin 0 -> 1413 bytes .../testsuites/config/sliceanalysisms/trust.pass | 1 + .../testsuites/docker-compose.yaml | 97 ++++++++++++ .../testsuites/setup.sh | 60 ++++++++ .../testsuites/teardown.sh | 9 ++ .../testsuites/testplan.txt | 3 + 8 files changed, 427 insertions(+) create mode 100644 plans/dcaegen2-services-slice-analysis-ms/testsuites/config/dmaap/MsgRtrApi.properties create mode 100644 plans/dcaegen2-services-slice-analysis-ms/testsuites/config/sliceanalysisms/config_all.json create mode 100644 plans/dcaegen2-services-slice-analysis-ms/testsuites/config/sliceanalysisms/trust.jks create mode 100644 plans/dcaegen2-services-slice-analysis-ms/testsuites/config/sliceanalysisms/trust.pass create mode 100644 plans/dcaegen2-services-slice-analysis-ms/testsuites/docker-compose.yaml create mode 100644 plans/dcaegen2-services-slice-analysis-ms/testsuites/setup.sh create mode 100644 plans/dcaegen2-services-slice-analysis-ms/testsuites/teardown.sh create mode 100644 plans/dcaegen2-services-slice-analysis-ms/testsuites/testplan.txt (limited to 'plans') diff --git a/plans/dcaegen2-services-slice-analysis-ms/testsuites/config/dmaap/MsgRtrApi.properties b/plans/dcaegen2-services-slice-analysis-ms/testsuites/config/dmaap/MsgRtrApi.properties new file mode 100644 index 00000000..61f3f033 --- /dev/null +++ b/plans/dcaegen2-services-slice-analysis-ms/testsuites/config/dmaap/MsgRtrApi.properties @@ -0,0 +1,171 @@ +# LICENSE_START======================================================= +# org.onap.dmaap +# ================================================================================ +# Copyright © 2017 AT&T Intellectual Property. All rights reserved. +# Copyright (C) 2020 Wipro Limited. +# ================================================================================ +# 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. +# +############################################################################### +############################################################################### +## +## Cambria API Server config +## +## - Default values are shown as commented settings. +## + +############################################################################### +## +## HTTP service +## +## - 3904 is standard as of 7/29/14. +# +## Zookeeper Connection +## +## Both Cambria and Kafka make use of Zookeeper. +## +#config.zk.servers=172.18.1.1 +config.zk.servers=zookeeper:2181 +#config.zk.root=/fe3c/cambria/config + + +############################################################################### +## +## Kafka Connection +## +## Items below are passed through to Kafka's producer and consumer +## configurations (after removing "kafka.") +## if you want to change request.required.acks it can take this one value +#kafka.metadata.broker.list=localhost:9092,localhost:9093 +kafka.metadata.broker.list=kafka:9092 +##kafka.request.required.acks=-1 +#kafka.client.zookeeper=${config.zk.servers} +consumer.timeout.ms=100 +zookeeper.connection.timeout.ms=6000 +zookeeper.session.timeout.ms=20000 +zookeeper.sync.time.ms=2000 +auto.commit.interval.ms=1000 +fetch.message.max.bytes =1000000 +auto.commit.enable=false + +#(backoff*retries > zksessiontimeout) +kafka.rebalance.backoff.ms=10000 +kafka.rebalance.max.retries=6 + + +############################################################################### +## +## Secured Config +## +## Some data stored in the config system is sensitive -- API keys and secrets, +## for example. to protect it, we use an encryption layer for this section +## of the config. +## +## The key is a base64 encode AES key. This must be created/configured for +## each installation. +#cambria.secureConfig.key= +## +## The initialization vector is a 16 byte value specific to the secured store. +## This must be created/configured for each installation. +#cambria.secureConfig.iv= + +## Southfield Sandbox +cambria.secureConfig.key=b/7ouTn9FfEw2PQwL0ov/Q== +cambria.secureConfig.iv=wR9xP5k5vbz/xD0LmtqQLw== +authentication.adminSecret=fe3cCompound +#cambria.secureConfig.key[pc569h]=YT3XPyxEmKCTLI2NK+Sjbw== +#cambria.secureConfig.iv[pc569h]=rMm2jhR3yVnU+u2V9Ugu3Q== + + +############################################################################### +## +## Consumer Caching +## +## Kafka expects live connections from the consumer to the broker, which +## obviously doesn't work over connectionless HTTP requests. The Cambria +## server proxies HTTP requests into Kafka consumer sessions that are kept +## around for later re-use. Not doing so is costly for setup per request, +## which would substantially impact a high volume consumer's performance. +## +## This complicates Cambria server failover, because we often need server +## A to close its connection before server B brings up the replacement. +## + +## The consumer cache is normally enabled. +#cambria.consumer.cache.enabled=true + +## Cached consumers are cleaned up after a period of disuse. The server inspects +## consumers every sweepFreqSeconds and will clean up any connections that are +## dormant for touchFreqMs. +#cambria.consumer.cache.sweepFreqSeconds=15 +cambria.consumer.cache.touchFreqMs=120000 +##stickforallconsumerrequests=false +## The cache is managed through ZK. The default value for the ZK connection +## string is the same as config.zk.servers. +#cambria.consumer.cache.zkConnect=${config.zk.servers} + +## +## Shared cache information is associated with this node's name. The default +## name is the hostname plus the HTTP service port this host runs on. (The +## hostname is determined via InetAddress.getLocalHost ().getCanonicalHostName(), +## which is not always adequate.) You can set this value explicitly here. +## +#cambria.api.node.identifier= + +#cambria.rateLimit.maxEmptyPollsPerMinute=30 +#cambria.rateLimitActual.delay.ms=10 + +############################################################################### +## +## Metrics Reporting +## +## This server can report its metrics periodically on a topic. +## +#metrics.send.cambria.enabled=true +#metrics.send.cambria.topic=cambria.apinode.metrics #msgrtr.apinode.metrics.dmaap +#metrics.send.cambria.sendEverySeconds=60 + +cambria.consumer.cache.zkBasePath=/fe3c/cambria/consumerCache +consumer.timeout=17 +default.partitions=3 +default.replicas=3 +############################################################################## +#100mb +maxcontentlength=10000 + + +############################################################################## +#AAF Properties +msgRtr.namespace.aaf=org.onap.dmaap.mr.topic +msgRtr.topicfactory.aaf=org.onap.dmaap.mr.topicFactory|:org.onap.dmaap.mr.topic: +enforced.topic.name.AAF=org.onap +forceAAF=false +transidUEBtopicreqd=false +defaultNSforUEB=org.onap.dmaap.mr +############################################################################## +#Mirror Maker Agent +msgRtr.mirrormakeradmin.aaf=com.onap.dmaap.mr.dev.mirrormaker|*|admin +msgRtr.mirrormakeruser.aaf=com.onap.dmaap.mr.dev.mirrormaker|*|user +msgRtr.mirrormakeruser.aaf.create=com.onap.dmaap.mr.dev.topicFactory|:com.onap.dmaap.mr.dev.topic: +msgRtr.mirrormaker.timeout=15000 +msgRtr.mirrormaker.topic=com.onap.dmaap.mr.prod.mm.agent +msgRtr.mirrormaker.consumergroup=mmagentserver +msgRtr.mirrormaker.consumerid=1 + +kafka.max.poll.interval.ms=300000 +kafka.heartbeat.interval.ms=60000 +kafka.session.timeout.ms=240000 +kafka.max.poll.records=1000 + diff --git a/plans/dcaegen2-services-slice-analysis-ms/testsuites/config/sliceanalysisms/config_all.json b/plans/dcaegen2-services-slice-analysis-ms/testsuites/config/sliceanalysisms/config_all.json new file mode 100644 index 00000000..b084b57d --- /dev/null +++ b/plans/dcaegen2-services-slice-analysis-ms/testsuites/config/sliceanalysisms/config_all.json @@ -0,0 +1,86 @@ +{ + "config": { + "streams_subscribes": { + "performance_management_topic": { + "aaf_password": null, + "type": "message-router", + "dmaap_info": { + "topic_url": "http://message-router.onap.svc.cluster.local:3904/events/unauthenticated.PERFORMANCE_MEASUREMENTS", + "client_role": "sliceanalysis-subscriber", + "location": "onap", + "client_id": "sdnr-sliceanalysis-1" + }, + "aaf_username": null + }, + "dcae_cl_response_topic": { + "aaf_password": null, + "type": "message-router", + "dmaap_info": { + "topic_url": "http://message-router.onap.svc.cluster.local:3904/events/DCAE_CL_RSP", + "client_role": "sliceanalysis-subscriber", + "location": "onap", + "client_id": "sdnr-sliceanalysis-1" + }, + "aaf_username": null + }, + "intelligent_slicing_topic": { + "aaf_password": null, + "type": "message-router", + "dmaap_info": { + "topic_url": "http://message-router.onap.svc.cluster.local::3904/events/unauthenticated.ML_RESPONSE_TOPIC", + "client_role": "sliceanalysis-subscriber", + "location": "onap", + "client_id": "sdnr-sliceanalysis-1" + }, + "aaf_username": null + } + }, + "streams_publishes": { + "CL_topic": { + "aaf_password": null, + "type": "message-router", + "dmaap_info": { + "topic_url": "http://message-router.onap.svc.cluster.local::3904/events/unauthenticated.DCAE_CL_OUTPUT", + "client_role": "sliceanalysis-subscriber", + "location": "onap", + "client_id": "sdnr-sliceanalysis-1" + }, + "aaf_username": null + } + }, + "postgres.password": "postgres", + "postgres.username": "sliceanalysisms_admin", + "postgres.host": "postgres", + "postgres.port": "5432", + "sliceanalysisms.dmaap.server": [ + "dmaap" + ], + "cbsPollingInterval": 60, + "sliceanalysisms.cg": "sliceanalysisms-cg", + "sliceanalysisms.pollingInterval": 20, + "sliceanalysisms.samples": 3, + "sliceanalysisms.minPercentageChange": 5, + "sliceanalysisms.initialDelaySeconds": 300000, + "sliceanalysisms.pollingTimeout": 60, + "sliceanalysisms.cid": "sliceanalysisms-cid", + "sliceanalysisms.configDb.service": "http://configdb_sim:5000", + "service_calls": { + "policy-req": [] + }, + "trust_store_path": "/opt/app/sliceanalysisms/etc/cert/trust.jks", + "trust_store_pass_path": "/opt/app/sliceanalysisms/etc/cert/trust.pass" + }, + "policies": { + "event": { + "action": "gathered", + "timestamp": "2019-09-18T14:57:55.320Z", + "update_id": "dbb88da8-8df1-489d-b51d-8d5cbbfbcd99", + "policies_count": 1 + }, + "items": [ + { + "policyName": "com.Config_PCIMS_CONFIG_POLICY.1.xml" + } + ] + } +} diff --git a/plans/dcaegen2-services-slice-analysis-ms/testsuites/config/sliceanalysisms/trust.jks b/plans/dcaegen2-services-slice-analysis-ms/testsuites/config/sliceanalysisms/trust.jks new file mode 100644 index 00000000..33d9c569 Binary files /dev/null and b/plans/dcaegen2-services-slice-analysis-ms/testsuites/config/sliceanalysisms/trust.jks differ diff --git a/plans/dcaegen2-services-slice-analysis-ms/testsuites/config/sliceanalysisms/trust.pass b/plans/dcaegen2-services-slice-analysis-ms/testsuites/config/sliceanalysisms/trust.pass new file mode 100644 index 00000000..86edc20c --- /dev/null +++ b/plans/dcaegen2-services-slice-analysis-ms/testsuites/config/sliceanalysisms/trust.pass @@ -0,0 +1 @@ +YPHcOFZP}sptD;*RV8N!46rG \ No newline at end of file diff --git a/plans/dcaegen2-services-slice-analysis-ms/testsuites/docker-compose.yaml b/plans/dcaegen2-services-slice-analysis-ms/testsuites/docker-compose.yaml new file mode 100644 index 00000000..cac148c3 --- /dev/null +++ b/plans/dcaegen2-services-slice-analysis-ms/testsuites/docker-compose.yaml @@ -0,0 +1,97 @@ +# ============LICENSE_START======================================================= +# slice-analysis-ms +# ================================================================================ +# Copyright (C) 2020 Wipro Limited. +# ============================================================================== +# 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========================================================= + +version: '3.3' +networks: + slice-analysis-ms-default: + driver: bridge + driver_opts: + com.docker.network.driver.mtu: 1400 +services: + zookeeper: + image: wurstmeister/zookeeper + container_name: zookeeper + ports: + - "2181:2181" + networks: + - slice-analysis-ms-default + kafka: + image: wurstmeister/kafka + container_name: kafka + ports: + - "9092:9092" + environment: + KAFKA_ADVERTISED_HOST_NAME: "kafka" + KAFKA_AUTO_CREATE_TOPICS_ENABLE: 'true' + KAFKA_ZOOKEEPER_CONNECT: "zookeeper:2181" + KAFKA_ADVERTISED_LISTENERS: "PLAINTEXT://kafka:9092" + volumes: + - /var/run/docker.sock:/var/run/docker.sock + depends_on: + - zookeeper + networks: + - slice-analysis-ms-default + dmaap: + image: nexus3.onap.org:10001/onap/dmaap/dmaap-mr:1.1.8 + container_name: dmaap + ports: + - "3904:3904" + - "3905:3905" + volumes: + - ./config/dmaap/MsgRtrApi.properties:/appl/dmaapMR1/bundleconfig/etc/appprops/MsgRtrApi.properties + depends_on: + - zookeeper + - kafka + networks: + - slice-analysis-ms-default + postgres: + image: 'postgres:12-alpine' + container_name: slice-analysis-ms-postgres + hostname: postgres + environment: + - POSTGRES_USER=sliceanalysisms_admin + - POSTGRES_PASSWORD=postgres + - POSTGRES_DB=sliceanalysisms + ports: + - 5432 + healthcheck: + test: ["CMD", "nc", "-z", "localhost", "5432"] + interval: 30s + timeout: 10s + retries: 5 + networks: + - slice-analysis-ms-default + sliceanalysisms: + image: "nexus3.onap.org:10003/onap/org.onap.dcaegen2.services.components.slice-analysis-ms:latest" + container_name: sliceanalysisms + hostname: sliceanalysisms + environment: + - STANDALONE=true + - CONFIG_FILE=/etc/config_all.json + ports: + - "8080:8080" + volumes: + - ./config/sliceanalysisms/config_all.json:/etc/config_all.json + - ./config/sliceanalysisms/trust12.jks:/opt/app/sliceanalysisms/etc/cert/trust.jks + - ./config/sliceanalysisms/trust.pass:/opt/app/sliceanalysisms/etc/cert/trust.pass + # - ./config/sliceanalysisms/trust.jks:/opt/app/sliceanalysisms/etc/cert/trustjss.jks + depends_on: + - postgres + networks: + - slice-analysis-ms-default + diff --git a/plans/dcaegen2-services-slice-analysis-ms/testsuites/setup.sh b/plans/dcaegen2-services-slice-analysis-ms/testsuites/setup.sh new file mode 100644 index 00000000..1c52d718 --- /dev/null +++ b/plans/dcaegen2-services-slice-analysis-ms/testsuites/setup.sh @@ -0,0 +1,60 @@ +#!/bin/bash + +docker login -u docker -p docker nexus3.onap.org:10001 + +TEST_PLANS_DIR=$WORKSPACE/plans/dcaegen2-services-slice-analysis-ms/testsuites +TEST_SCRIPTS_DIR=$WORKSPACE/scripts/dcaegen2-services-slice-analysis-ms/slice-analysis-ms +TEST_ROBOT_DIR=$WORKSPACE/tests/dcaegen2-services-slice-analysis-ms/testcases + +docker-compose up -d + +ZOOKEEPER_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' zookeeper) +KAFKA_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' kafka) +DMAAP_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' dmaap) +SLICE_ANALYSIS_MS_POSTGRES_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' slice-analysis-ms-postgres) +SLICE_ANALYSIS_MS_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' sliceanalysisms) + +echo "Waiting for dmaap to come up ..." +for i in {1..10}; do + dmaap_state=$(curl --write-out '%{http_code}' --silent --output /dev/null $DMAAP_IP:3904/topics) + if [ $dmaap_state == "200" ] + then + break + else + sleep 60 + fi +done + +#create topics in dmaap +curl --header "Content-type: application/json" \ +--request POST \ +--data '{"topicName": "org.onap.dmaap.mr.PERFORMANCE_MEASUREMENTS"}' \ +http://$DMAAP_IP:3904/events/unauthenticated.PERFORMANCE_MEASUREMENTS + +curl --header "Content-type: application/json" \ +--request POST \ +--data '{"topicName": "DCAE_CL_RSP"}' \ +http://$DMAAP_IP:3904/events/DCAE_CL_RSP + +curl --header "Content-type: application/json" \ +--request POST \ +--data '{"topicName": "unauthenticated.ML_RESPONSE_TOPIC"}' \ +http://$DMAAP_IP:3904/events/unauthenticated.ML_RESPONSE_TOPIC + +curl --header "Content-type: application/json" \ +--request POST \ +--data '{"topicName": "unauthenticated.DCAE_CL_OUTPUT"}' \ +http://$DMAAP_IP:3904/events/unauthenticated.DCAE_CL_OUTPUT + +#build configdb-sim image +cd $TEST_SCRIPTS_DIR +docker build -t configdb_sim . + +#run configdb-sim +docker run -d --name configdb_sim --network=testsuites_slice-analysis-ms-default -p "5000:5000" configdb_sim:latest; +sleep 10 +CONFIGDB_SIM_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' configdb_sim) +echo "CONFIGDB_SIM_IP=${CONFIGDB_SIM_IP}" + + +ROBOT_VARIABLES="-v ZOOKEEPER_IP:${ZOOKEEPER_IP} -v KAFKA_IP:${KAFKA_IP} -v DMAAP_IP:${DMAAP_IP} -v SLICE_ANALYSIS_MS_POSTGRES_IP:${SLICE_ANALYSIS_MS_POSTGRES_IP} -v SLICE_ANALYSIS_MS_IP:${SLICE_ANALYSIS_MS_IP} -v CONFIGDB_SIM_IP:${CONFIGDB_SIM_IP} -v TEST_ROBOT_DIR:${TEST_ROBOT_DIR}" diff --git a/plans/dcaegen2-services-slice-analysis-ms/testsuites/teardown.sh b/plans/dcaegen2-services-slice-analysis-ms/testsuites/teardown.sh new file mode 100644 index 00000000..516bf8cb --- /dev/null +++ b/plans/dcaegen2-services-slice-analysis-ms/testsuites/teardown.sh @@ -0,0 +1,9 @@ +#!/bin/bash +echo "Starting teardown script" +TEST_PLANS_DIR=$WORKSPACE/plans/dcaegen2-services-slice-analysis-ms/testsuites +mkdir -p $WORKSPACE/archives + +docker container stop configdb_sim +docker container rm configdb_sim +docker-compose -f $TEST_PLANS_DIR/docker-compose.yaml logs > $WORKSPACE/archives/sonhandler-docker-compose.log +docker-compose -f $TEST_PLANS_DIR/docker-compose.yaml down -v diff --git a/plans/dcaegen2-services-slice-analysis-ms/testsuites/testplan.txt b/plans/dcaegen2-services-slice-analysis-ms/testsuites/testplan.txt new file mode 100644 index 00000000..a8b2bdab --- /dev/null +++ b/plans/dcaegen2-services-slice-analysis-ms/testsuites/testplan.txt @@ -0,0 +1,3 @@ +# Test suites are relative paths under [integration/csit.git]/tests/. +# Place the suites in run order. +dcaegen2-services-slice-analysis-ms/testcases -- cgit 1.2.3-korg