From a3f68d14609fc94ec89e3eb724664a62bc2b0210 Mon Sep 17 00:00:00 2001 From: Lasse Kaihlavirta Date: Fri, 21 May 2021 12:59:08 +0300 Subject: Move PM-Mapper CSIT to project repo Issue-ID: DCAEGEN2-2746 Signed-off-by: Lasse Kaihlavirta Change-Id: Ib96f8453fd7fecbaddaada1b11d3b8551bb7f8fa --- csit/.gitignore | 2 + csit/README.md | 38 +++ .../assets/addSubscriber.json | 20 ++ .../filesprocessingconfigpmmapper/assets/cbs.json | 7 + .../filesprocessingconfigpmmapper/assets/cert.jks | Bin 0 -> 4654 bytes .../assets/config.json | 35 +++ .../assets/createFeed.json | 18 ++ .../filesprocessingconfigpmmapper/assets/jks.pass | 1 + .../assets/mrserver.js | 28 +++ .../assets/node.properties | 89 +++++++ .../assets/provserver.properties | 62 +++++ .../filesprocessingconfigpmmapper/assets/trust.jks | Bin 0 -> 1413 bytes .../assets/trust.pass | 1 + .../docker-compose.yml | 119 ++++++++++ csit/plans/filesprocessingconfigpmmapper/setup.sh | 101 ++++++++ .../filesprocessingconfigpmmapper/teardown.sh | 8 + .../filesprocessingconfigpmmapper/testplan.txt | 3 + csit/plans/pmmapper/assets/addFeed3.txt | 44 ++++ csit/plans/pmmapper/assets/addSubscriber.json | 20 ++ csit/plans/pmmapper/assets/addSubscriber.txt | 35 +++ csit/plans/pmmapper/assets/cbs.json | 7 + csit/plans/pmmapper/assets/cert.jks | Bin 0 -> 4654 bytes csit/plans/pmmapper/assets/config.json | 35 +++ csit/plans/pmmapper/assets/createFeed.json | 18 ++ csit/plans/pmmapper/assets/jks.pass | 1 + csit/plans/pmmapper/assets/mrserver.js | 25 ++ csit/plans/pmmapper/assets/node.properties | 87 +++++++ csit/plans/pmmapper/assets/provserver.properties | 60 +++++ csit/plans/pmmapper/assets/trust.jks | Bin 0 -> 1413 bytes csit/plans/pmmapper/assets/trust.pass | 1 + csit/plans/pmmapper/docker-compose.yml | 121 ++++++++++ csit/plans/pmmapper/setup.sh | 94 ++++++++ csit/plans/pmmapper/teardown.sh | 7 + csit/plans/pmmapper/testplan.txt | 3 + csit/prepare-csit.sh | 49 ++++ csit/run-csit.sh | 191 +++++++++++++++ csit/run-project-csit.sh | 33 +++ csit/scripts/common_functions.sh | 263 +++++++++++++++++++++ csit/scripts/kill-instance.sh | 31 +++ .../filesprocessingconfigpmmapper/__init__.robot | 2 + .../assets/.gitattributes | 1 + .../assets/ABigFile.xml | 163 +++++++++++++ .../assets/config_10_1.env | 3 + .../assets/config_1_1.env | 3 + .../assets/config_1_10.env | 3 + .../assets/valid_metadata.json | 12 + .../filesprocessingconfigpmmapper.robot | 149 ++++++++++++ .../libraries/DockerContainerManager.py | 29 +++ .../libraries/DockerContainerManager.pyc | Bin 0 -> 1989 bytes .../libraries/EnvsReader.py | 11 + .../libraries/EnvsReader.pyc | Bin 0 -> 824 bytes .../libraries/LogReader.py | 22 ++ .../libraries/LogReader.pyc | Bin 0 -> 1953 bytes csit/tests/pmmapper/__init__.robot | 2 + csit/tests/pmmapper/assets/.gitattributes | 1 + .../assets/A20181002.0000-1000-0015-1000_5G.xml | 88 +++++++ .../assets/A20181002.0000-1000-0015-1000_5G.xml.gz | Bin 0 -> 959 bytes .../tests/pmmapper/assets/A_no_managed_element.xml | 27 +++ csit/tests/pmmapper/assets/A_no_measdata.xml | 11 + csit/tests/pmmapper/assets/C20190328.0000-0015.xml | 49 ++++ .../pmmapper/assets/diff_vendor_metadata.json | 12 + .../new_radio/A20181004.0000-1000-0015-1000_5G.xml | 88 +++++++ .../assets/new_radio/C20190329.0000-0015.xml | 49 ++++ ...01+020024C202007171207+0200-1215+0200_45678.xml | 88 +++++++ .../pmmapper/assets/new_radio/valid_metadata.json | 12 + csit/tests/pmmapper/assets/pm_filter_config.json | 42 ++++ .../pmmapper/assets/pm_filter_regex_config.json | 42 ++++ csit/tests/pmmapper/assets/valid_metadata.json | 12 + .../pmmapper/assets/vendor_filter_config.json | 42 ++++ csit/tests/pmmapper/pmmapper.robot | 201 ++++++++++++++++ 70 files changed, 2821 insertions(+) create mode 100644 csit/.gitignore create mode 100644 csit/README.md create mode 100644 csit/plans/filesprocessingconfigpmmapper/assets/addSubscriber.json create mode 100644 csit/plans/filesprocessingconfigpmmapper/assets/cbs.json create mode 100644 csit/plans/filesprocessingconfigpmmapper/assets/cert.jks create mode 100644 csit/plans/filesprocessingconfigpmmapper/assets/config.json create mode 100644 csit/plans/filesprocessingconfigpmmapper/assets/createFeed.json create mode 100644 csit/plans/filesprocessingconfigpmmapper/assets/jks.pass create mode 100644 csit/plans/filesprocessingconfigpmmapper/assets/mrserver.js create mode 100644 csit/plans/filesprocessingconfigpmmapper/assets/node.properties create mode 100644 csit/plans/filesprocessingconfigpmmapper/assets/provserver.properties create mode 100644 csit/plans/filesprocessingconfigpmmapper/assets/trust.jks create mode 100644 csit/plans/filesprocessingconfigpmmapper/assets/trust.pass create mode 100644 csit/plans/filesprocessingconfigpmmapper/docker-compose.yml create mode 100644 csit/plans/filesprocessingconfigpmmapper/setup.sh create mode 100644 csit/plans/filesprocessingconfigpmmapper/teardown.sh create mode 100644 csit/plans/filesprocessingconfigpmmapper/testplan.txt create mode 100644 csit/plans/pmmapper/assets/addFeed3.txt create mode 100644 csit/plans/pmmapper/assets/addSubscriber.json create mode 100644 csit/plans/pmmapper/assets/addSubscriber.txt create mode 100644 csit/plans/pmmapper/assets/cbs.json create mode 100644 csit/plans/pmmapper/assets/cert.jks create mode 100644 csit/plans/pmmapper/assets/config.json create mode 100644 csit/plans/pmmapper/assets/createFeed.json create mode 100644 csit/plans/pmmapper/assets/jks.pass create mode 100644 csit/plans/pmmapper/assets/mrserver.js create mode 100644 csit/plans/pmmapper/assets/node.properties create mode 100644 csit/plans/pmmapper/assets/provserver.properties create mode 100644 csit/plans/pmmapper/assets/trust.jks create mode 100644 csit/plans/pmmapper/assets/trust.pass create mode 100644 csit/plans/pmmapper/docker-compose.yml create mode 100644 csit/plans/pmmapper/setup.sh create mode 100644 csit/plans/pmmapper/teardown.sh create mode 100644 csit/plans/pmmapper/testplan.txt create mode 100755 csit/prepare-csit.sh create mode 100755 csit/run-csit.sh create mode 100755 csit/run-project-csit.sh create mode 100755 csit/scripts/common_functions.sh create mode 100755 csit/scripts/kill-instance.sh create mode 100644 csit/tests/filesprocessingconfigpmmapper/__init__.robot create mode 100644 csit/tests/filesprocessingconfigpmmapper/assets/.gitattributes create mode 100644 csit/tests/filesprocessingconfigpmmapper/assets/ABigFile.xml create mode 100644 csit/tests/filesprocessingconfigpmmapper/assets/config_10_1.env create mode 100644 csit/tests/filesprocessingconfigpmmapper/assets/config_1_1.env create mode 100644 csit/tests/filesprocessingconfigpmmapper/assets/config_1_10.env create mode 100644 csit/tests/filesprocessingconfigpmmapper/assets/valid_metadata.json create mode 100644 csit/tests/filesprocessingconfigpmmapper/filesprocessingconfigpmmapper.robot create mode 100644 csit/tests/filesprocessingconfigpmmapper/libraries/DockerContainerManager.py create mode 100644 csit/tests/filesprocessingconfigpmmapper/libraries/DockerContainerManager.pyc create mode 100644 csit/tests/filesprocessingconfigpmmapper/libraries/EnvsReader.py create mode 100644 csit/tests/filesprocessingconfigpmmapper/libraries/EnvsReader.pyc create mode 100644 csit/tests/filesprocessingconfigpmmapper/libraries/LogReader.py create mode 100644 csit/tests/filesprocessingconfigpmmapper/libraries/LogReader.pyc create mode 100644 csit/tests/pmmapper/__init__.robot create mode 100644 csit/tests/pmmapper/assets/.gitattributes create mode 100644 csit/tests/pmmapper/assets/A20181002.0000-1000-0015-1000_5G.xml create mode 100644 csit/tests/pmmapper/assets/A20181002.0000-1000-0015-1000_5G.xml.gz create mode 100644 csit/tests/pmmapper/assets/A_no_managed_element.xml create mode 100644 csit/tests/pmmapper/assets/A_no_measdata.xml create mode 100644 csit/tests/pmmapper/assets/C20190328.0000-0015.xml create mode 100644 csit/tests/pmmapper/assets/diff_vendor_metadata.json create mode 100644 csit/tests/pmmapper/assets/new_radio/A20181004.0000-1000-0015-1000_5G.xml create mode 100644 csit/tests/pmmapper/assets/new_radio/C20190329.0000-0015.xml create mode 100644 csit/tests/pmmapper/assets/new_radio/PM202007171301+020024C202007171207+0200-1215+0200_45678.xml create mode 100644 csit/tests/pmmapper/assets/new_radio/valid_metadata.json create mode 100644 csit/tests/pmmapper/assets/pm_filter_config.json create mode 100644 csit/tests/pmmapper/assets/pm_filter_regex_config.json create mode 100644 csit/tests/pmmapper/assets/valid_metadata.json create mode 100644 csit/tests/pmmapper/assets/vendor_filter_config.json create mode 100644 csit/tests/pmmapper/pmmapper.robot diff --git a/csit/.gitignore b/csit/.gitignore new file mode 100644 index 0000000..c8865c2 --- /dev/null +++ b/csit/.gitignore @@ -0,0 +1,2 @@ +env.properties +archives/ diff --git a/csit/README.md b/csit/README.md new file mode 100644 index 0000000..88d0411 --- /dev/null +++ b/csit/README.md @@ -0,0 +1,38 @@ +## Continuous System and Integration Testing (CSIT) for DCAEGEN2 PM-Mapper + +The directory structure: + +- **plans/** contains testing plans, each sub-folder represents a separate test plan with contents processed subsequently: + _startup.sh_ (serves docker containers startup), _testplan.txt_ (lists test suites), _teardown.sh_ (serves docker containers stopping and images removal) +- **scripts/** contains shell scripts used on tests executions +- **tests/** contains test suites that are processed by folder name (relative to _tests_ folder) taken from _testplan.txt_ + +Test suites are executed using Robot framework. + +### Running on local environment + +Prerequisites: +- maven +- docker +- docker-compose +- settings.xml corresponding to the one under oparent repository + +```bash + +Navigate to project directory +```bash +cd ~//pm-mapper +``` + +Build a docker image from your pm-mapper directory: + +```bash +mvn clean install docker:build +``` + +Execute tests from pm-mapper/csit folder: +```bash +cd csit +./run-project-csit.sh +``` + diff --git a/csit/plans/filesprocessingconfigpmmapper/assets/addSubscriber.json b/csit/plans/filesprocessingconfigpmmapper/assets/addSubscriber.json new file mode 100644 index 0000000..0666a7d --- /dev/null +++ b/csit/plans/filesprocessingconfigpmmapper/assets/addSubscriber.json @@ -0,0 +1,20 @@ +{ + "delivery":{ + "url":"http://dcae-pm-mapper:8081/delivery", + "user":"username", + "password":"password", + "use100":true + }, + "follow_redirect":false, + "metadataOnly":false, + "suspend":false, + "groupid":0, + "links":{ + "self": "https://dmaap-dr-prov/subscribe/1", + "log": "https://dmaap-dr-prov/feedlog/1", + "feed": "https://dmaap-dr-prov/feed/1" + }, + "subscriber":"pmmapper", + "decompress":true, + "privilegedSubscriber": true + } \ No newline at end of file diff --git a/csit/plans/filesprocessingconfigpmmapper/assets/cbs.json b/csit/plans/filesprocessingconfigpmmapper/assets/cbs.json new file mode 100644 index 0000000..a29956f --- /dev/null +++ b/csit/plans/filesprocessingconfigpmmapper/assets/cbs.json @@ -0,0 +1,7 @@ +{ + "ID": "cbs", + "Name": "config_binding_service", + "Tags": ["cbs"], + "Address": "ipaddress", + "Port": 10000 +} \ No newline at end of file diff --git a/csit/plans/filesprocessingconfigpmmapper/assets/cert.jks b/csit/plans/filesprocessingconfigpmmapper/assets/cert.jks new file mode 100644 index 0000000..33dc9a3 Binary files /dev/null and b/csit/plans/filesprocessingconfigpmmapper/assets/cert.jks differ diff --git a/csit/plans/filesprocessingconfigpmmapper/assets/config.json b/csit/plans/filesprocessingconfigpmmapper/assets/config.json new file mode 100644 index 0000000..3f1009d --- /dev/null +++ b/csit/plans/filesprocessingconfigpmmapper/assets/config.json @@ -0,0 +1,35 @@ +{ + "pm-mapper-filter": { "filters":[]}, + "key_store_path": "/opt/app/pm-mapper/etc/certs/cert.jks", + "key_store_pass_path": "/opt/app/pm-mapper/etc/certs/jks.pass", + "trust_store_path": "/opt/app/pm-mapper/etc/certs/trust.jks", + "trust_store_pass_path": "/opt/app/pm-mapper/etc/certs/trust.pass", + "dmaap_dr_delete_endpoint": "https://dmaap-dr-node:8443/delete", + "dmaap_dr_feed_name": "1", + "aaf_identity": "aaf_admin@people.osaaf.org", + "aaf_password": "demo123456!", + "enable_http": true, + "streams_publishes": { + "dmaap_publisher": { + "type": "message_router", + "dmaap_info": { + "topic_url": "http://message-router:3904/events/org.onap.dmaap.mr.VES_PM", + "client_role": "org.onap.dcae.pmPublisher", + "location": "csit-pmmapper", + "client_id": "1562763644939" + } + } + }, + "streams_subscribes": { + "dmaap_subscriber": { + "type": "data_router", + "dmaap_info": { + "username": "username", + "password": "password", + "location": "csit-pmmapper", + "delivery_url": "http://dcae-pm-mapper:8081/delivery", + "subscriber_id": 1 + } + } + } +} \ No newline at end of file diff --git a/csit/plans/filesprocessingconfigpmmapper/assets/createFeed.json b/csit/plans/filesprocessingconfigpmmapper/assets/createFeed.json new file mode 100644 index 0000000..f93633d --- /dev/null +++ b/csit/plans/filesprocessingconfigpmmapper/assets/createFeed.json @@ -0,0 +1,18 @@ +{ + "name": "PM Mapper Feed", + "version": "m1.0", + "description": "PM Mapper Feed", + "business_description": "PM Mapper", + "suspend": false, + "deleted": false, + "changeowner": true, + "authorization": { + "classification": "unclassified", + "endpoint_addrs": [], + "endpoint_ids": [ + { + "password": "pmmapper", + "id": "pmmapper" + }] + } + } \ No newline at end of file diff --git a/csit/plans/filesprocessingconfigpmmapper/assets/jks.pass b/csit/plans/filesprocessingconfigpmmapper/assets/jks.pass new file mode 100644 index 0000000..ae8f7e7 --- /dev/null +++ b/csit/plans/filesprocessingconfigpmmapper/assets/jks.pass @@ -0,0 +1 @@ +Er1tmip;T4w[%1}YE?x{fN9v \ No newline at end of file diff --git a/csit/plans/filesprocessingconfigpmmapper/assets/mrserver.js b/csit/plans/filesprocessingconfigpmmapper/assets/mrserver.js new file mode 100644 index 0000000..cc84571 --- /dev/null +++ b/csit/plans/filesprocessingconfigpmmapper/assets/mrserver.js @@ -0,0 +1,28 @@ +var httpServer = function () { + var http = require('http'), + url = require('url'), + fs = require('fs'), + + start = function (port) { + var server = http.createServer(function (req, res) { + processHttpRequest(res); + }); + server.listen(port, function () { + console.log('Listening on ' + port + '...'); + }); + }, + + processHttpRequest = function (res) { + res.writeHead(200, {'Content-Type': 'text/plain'}); + console.log('received message'); + setTimeout(() => { + res.end('Published Successfully.\n'); + }, 100); + }; + + return { + start: start + } +}(); + +httpServer.start(3904); diff --git a/csit/plans/filesprocessingconfigpmmapper/assets/node.properties b/csit/plans/filesprocessingconfigpmmapper/assets/node.properties new file mode 100644 index 0000000..7abaf60 --- /dev/null +++ b/csit/plans/filesprocessingconfigpmmapper/assets/node.properties @@ -0,0 +1,89 @@ +#------------------------------------------------------------------------------- +# ============LICENSE_START================================================== +# * org.onap.dmaap +# * =========================================================================== +# * Copyright � 2017 AT&T Intellectual Property. All rights reserved. +# * =========================================================================== +# * Modifications Copyright (C) 2021 Nokia Intellectual Property +# * =========================================================================== +# * 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 diff --git a/csit/plans/filesprocessingconfigpmmapper/assets/provserver.properties b/csit/plans/filesprocessingconfigpmmapper/assets/provserver.properties new file mode 100644 index 0000000..cd333ef --- /dev/null +++ b/csit/plans/filesprocessingconfigpmmapper/assets/provserver.properties @@ -0,0 +1,62 @@ +#------------------------------------------------------------------------------- +# ============LICENSE_START================================================== +# * org.onap.dmaap +# * =========================================================================== +# * Copyright � 2017 AT&T Intellectual Property. All rights reserved. +# * =========================================================================== +# * Modifications Copyright (C) 2021 Nokia Intellectual Property +# * =========================================================================== +# * 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 diff --git a/csit/plans/filesprocessingconfigpmmapper/assets/trust.jks b/csit/plans/filesprocessingconfigpmmapper/assets/trust.jks new file mode 100644 index 0000000..679c95a Binary files /dev/null and b/csit/plans/filesprocessingconfigpmmapper/assets/trust.jks differ diff --git a/csit/plans/filesprocessingconfigpmmapper/assets/trust.pass b/csit/plans/filesprocessingconfigpmmapper/assets/trust.pass new file mode 100644 index 0000000..d3d01b0 --- /dev/null +++ b/csit/plans/filesprocessingconfigpmmapper/assets/trust.pass @@ -0,0 +1 @@ +583Ls;XF(qDQu3p!L22gyh1t \ No newline at end of file diff --git a/csit/plans/filesprocessingconfigpmmapper/docker-compose.yml b/csit/plans/filesprocessingconfigpmmapper/docker-compose.yml new file mode 100644 index 0000000..19edc25 --- /dev/null +++ b/csit/plans/filesprocessingconfigpmmapper/docker-compose.yml @@ -0,0 +1,119 @@ +version: '3.3' + +services: + datarouter-prov: + image: nexus3.onap.org:10001/onap/dmaap/datarouter-prov:latest + 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 + 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:latest + 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: nexus3.onap.org:10001/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: nexus3.onap.org:10001/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: onap/org.onap.dcaegen2.services.pm-mapper:latest + ports: + - "8081:8081" + volumes: + - /var/tmp/:/opt/app/pm-mapper/etc/certs/ + depends_on: + - datarouter-prov + 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/csit/plans/filesprocessingconfigpmmapper/setup.sh b/csit/plans/filesprocessingconfigpmmapper/setup.sh new file mode 100644 index 0000000..5f0b41b --- /dev/null +++ b/csit/plans/filesprocessingconfigpmmapper/setup.sh @@ -0,0 +1,101 @@ +#!/bin/bash +# Place the scripts in run order: +source ${SCRIPTS}/common_functions.sh + +docker login -u docker -p docker nexus3.onap.org:10001 + +TEST_PLANS_DIR=$WORKSPACE/plans/filesprocessingconfigpmmapper + +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 + +for asset in provserver.properties node.properties cbs.json mrserver.js cert.jks jks.pass trust.jks trust.pass; do + cp $TEST_PLANS_DIR/assets/${asset} /var/tmp/ +done + +sed -i 's/datarouter-mariadb/'$MARIADB_IP'/g' /var/tmp/provserver.properties +sed -i 's/ipaddress//g' /var/tmp/cbs.json + +# ------------------------------------ +#Prepare enviroment for client +#install docker sdk +echo "Uninstall docker-py and reinstall docker." +pip uninstall -y docker-py +pip uninstall -y docker +pip install -U docker==2.7.0 + +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 + +unset http_proxy +unset https_proxy +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 + +# 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) ] + then + echo "All required docker containers are up." + containers_ok=true + break + else + sleep $i + fi +done +[ "$containers_ok" = "false" ] && echo "Error: required container not running." && exit 1 + +# Data Router Configuration. +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 @$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 +sleep 10 +docker exec -it datarouter-prov sh -c "curl http://dmaap-dr-node:8080/internal/fetchProv" +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} -v NODE_IP:${NODE_IP}" diff --git a/csit/plans/filesprocessingconfigpmmapper/teardown.sh b/csit/plans/filesprocessingconfigpmmapper/teardown.sh new file mode 100644 index 0000000..e08a34c --- /dev/null +++ b/csit/plans/filesprocessingconfigpmmapper/teardown.sh @@ -0,0 +1,8 @@ +#!/bin/bash +echo "Starting teardown script" +TEST_PLANS_DIR=$WORKSPACE/plans/filesprocessingconfigpmmapper +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 pmmapper +docker-compose -f $TEST_PLANS_DIR/docker-compose.yml logs > $WORKSPACE/archives/filesprocessingconfigpmmapper-docker-compose.log +docker-compose -f $TEST_PLANS_DIR/docker-compose.yml down -v diff --git a/csit/plans/filesprocessingconfigpmmapper/testplan.txt b/csit/plans/filesprocessingconfigpmmapper/testplan.txt new file mode 100644 index 0000000..902faca --- /dev/null +++ b/csit/plans/filesprocessingconfigpmmapper/testplan.txt @@ -0,0 +1,3 @@ +# Test suites are relative paths under [dcaegen2/services/pm-mapper.git]/csit/tests/. +# Place the suites in run order. +filesprocessingconfigpmmapper diff --git a/csit/plans/pmmapper/assets/addFeed3.txt b/csit/plans/pmmapper/assets/addFeed3.txt new file mode 100644 index 0000000..60544d9 --- /dev/null +++ b/csit/plans/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": [ + "", + ], + "endpoint_ids": [ + { + "password": "rs873m", + "id": "rs873m" + } + ] + }, +} + diff --git a/csit/plans/pmmapper/assets/addSubscriber.json b/csit/plans/pmmapper/assets/addSubscriber.json new file mode 100644 index 0000000..0666a7d --- /dev/null +++ b/csit/plans/pmmapper/assets/addSubscriber.json @@ -0,0 +1,20 @@ +{ + "delivery":{ + "url":"http://dcae-pm-mapper:8081/delivery", + "user":"username", + "password":"password", + "use100":true + }, + "follow_redirect":false, + "metadataOnly":false, + "suspend":false, + "groupid":0, + "links":{ + "self": "https://dmaap-dr-prov/subscribe/1", + "log": "https://dmaap-dr-prov/feedlog/1", + "feed": "https://dmaap-dr-prov/feed/1" + }, + "subscriber":"pmmapper", + "decompress":true, + "privilegedSubscriber": true + } \ No newline at end of file diff --git a/csit/plans/pmmapper/assets/addSubscriber.txt b/csit/plans/pmmapper/assets/addSubscriber.txt new file mode 100644 index 0000000..95cc2af --- /dev/null +++ b/csit/plans/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://:7070/", + "user" : "datarouter", + "password" : "datarouter", + "use100" : true + }, +"metadataOnly" : false, +"suspend" : false, +"groupid" : 29, +"subscriber" : "sg481n" +} diff --git a/csit/plans/pmmapper/assets/cbs.json b/csit/plans/pmmapper/assets/cbs.json new file mode 100644 index 0000000..a29956f --- /dev/null +++ b/csit/plans/pmmapper/assets/cbs.json @@ -0,0 +1,7 @@ +{ + "ID": "cbs", + "Name": "config_binding_service", + "Tags": ["cbs"], + "Address": "ipaddress", + "Port": 10000 +} \ No newline at end of file diff --git a/csit/plans/pmmapper/assets/cert.jks b/csit/plans/pmmapper/assets/cert.jks new file mode 100644 index 0000000..33dc9a3 Binary files /dev/null and b/csit/plans/pmmapper/assets/cert.jks differ diff --git a/csit/plans/pmmapper/assets/config.json b/csit/plans/pmmapper/assets/config.json new file mode 100644 index 0000000..3f1009d --- /dev/null +++ b/csit/plans/pmmapper/assets/config.json @@ -0,0 +1,35 @@ +{ + "pm-mapper-filter": { "filters":[]}, + "key_store_path": "/opt/app/pm-mapper/etc/certs/cert.jks", + "key_store_pass_path": "/opt/app/pm-mapper/etc/certs/jks.pass", + "trust_store_path": "/opt/app/pm-mapper/etc/certs/trust.jks", + "trust_store_pass_path": "/opt/app/pm-mapper/etc/certs/trust.pass", + "dmaap_dr_delete_endpoint": "https://dmaap-dr-node:8443/delete", + "dmaap_dr_feed_name": "1", + "aaf_identity": "aaf_admin@people.osaaf.org", + "aaf_password": "demo123456!", + "enable_http": true, + "streams_publishes": { + "dmaap_publisher": { + "type": "message_router", + "dmaap_info": { + "topic_url": "http://message-router:3904/events/org.onap.dmaap.mr.VES_PM", + "client_role": "org.onap.dcae.pmPublisher", + "location": "csit-pmmapper", + "client_id": "1562763644939" + } + } + }, + "streams_subscribes": { + "dmaap_subscriber": { + "type": "data_router", + "dmaap_info": { + "username": "username", + "password": "password", + "location": "csit-pmmapper", + "delivery_url": "http://dcae-pm-mapper:8081/delivery", + "subscriber_id": 1 + } + } + } +} \ No newline at end of file diff --git a/csit/plans/pmmapper/assets/createFeed.json b/csit/plans/pmmapper/assets/createFeed.json new file mode 100644 index 0000000..f93633d --- /dev/null +++ b/csit/plans/pmmapper/assets/createFeed.json @@ -0,0 +1,18 @@ +{ + "name": "PM Mapper Feed", + "version": "m1.0", + "description": "PM Mapper Feed", + "business_description": "PM Mapper", + "suspend": false, + "deleted": false, + "changeowner": true, + "authorization": { + "classification": "unclassified", + "endpoint_addrs": [], + "endpoint_ids": [ + { + "password": "pmmapper", + "id": "pmmapper" + }] + } + } \ No newline at end of file diff --git a/csit/plans/pmmapper/assets/jks.pass b/csit/plans/pmmapper/assets/jks.pass new file mode 100644 index 0000000..ae8f7e7 --- /dev/null +++ b/csit/plans/pmmapper/assets/jks.pass @@ -0,0 +1 @@ +Er1tmip;T4w[%1}YE?x{fN9v \ No newline at end of file diff --git a/csit/plans/pmmapper/assets/mrserver.js b/csit/plans/pmmapper/assets/mrserver.js new file mode 100644 index 0000000..a6a6130 --- /dev/null +++ b/csit/plans/pmmapper/assets/mrserver.js @@ -0,0 +1,25 @@ +var httpServer = function() { +var http = require('http'), +url = require('url'), +fs = require('fs'), + +start = function(port) { + var server = http.createServer(function(req, res) { + processHttpRequest(res); + }); + server.listen(port, function() { + console.log('Listening on ' + port + '...'); + }); +}, + +processHttpRequest = function(res) { + res.writeHead(200, {'Content-Type': 'text/plain'}); + res.end('Published Successfully.\n'); +}; + +return { + start: start +} +}(); + +httpServer.start(3904); \ No newline at end of file diff --git a/csit/plans/pmmapper/assets/node.properties b/csit/plans/pmmapper/assets/node.properties new file mode 100644 index 0000000..ddd4ebc --- /dev/null +++ b/csit/plans/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/csit/plans/pmmapper/assets/provserver.properties b/csit/plans/pmmapper/assets/provserver.properties new file mode 100644 index 0000000..20b5cb9 --- /dev/null +++ b/csit/plans/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/csit/plans/pmmapper/assets/trust.jks b/csit/plans/pmmapper/assets/trust.jks new file mode 100644 index 0000000..679c95a Binary files /dev/null and b/csit/plans/pmmapper/assets/trust.jks differ diff --git a/csit/plans/pmmapper/assets/trust.pass b/csit/plans/pmmapper/assets/trust.pass new file mode 100644 index 0000000..d3d01b0 --- /dev/null +++ b/csit/plans/pmmapper/assets/trust.pass @@ -0,0 +1 @@ +583Ls;XF(qDQu3p!L22gyh1t \ No newline at end of file diff --git a/csit/plans/pmmapper/docker-compose.yml b/csit/plans/pmmapper/docker-compose.yml new file mode 100644 index 0000000..d612de2 --- /dev/null +++ b/csit/plans/pmmapper/docker-compose.yml @@ -0,0 +1,121 @@ +version: '3.3' + +services: + datarouter-prov: + image: nexus3.onap.org:10001/onap/dmaap/datarouter-prov:latest + 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:latest + 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: onap/org.onap.dcaegen2.services.pm-mapper:latest + ports: + - "8081:8081" + volumes: + - /var/tmp/:/opt/app/pm-mapper/etc/certs/ + depends_on: + - datarouter-prov + 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/csit/plans/pmmapper/setup.sh b/csit/plans/pmmapper/setup.sh new file mode 100644 index 0000000..918b7f6 --- /dev/null +++ b/csit/plans/pmmapper/setup.sh @@ -0,0 +1,94 @@ +#!/bin/bash +# Place the scripts in run order: +source ${SCRIPTS}/common_functions.sh + +docker login -u docker -p docker nexus3.onap.org:10001 + +TEST_PLANS_DIR=$WORKSPACE/plans/pmmapper + +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 + +for asset in provserver.properties addSubscriber.txt addFeed3.txt node.properties cbs.json mrserver.js cert.jks jks.pass trust.jks trust.pass; do + cp $TEST_PLANS_DIR/assets/${asset} /var/tmp/ +done + +sed -i 's/datarouter-mariadb/'$MARIADB_IP'/g' /var/tmp/provserver.properties +#sed -i 's//'$KAFKA_IP'/g' /var/tmp/addSubscriber.txt +#sed -i 's//'$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 + +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 + +# 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) ] + then + echo "All required docker containers are up." + containers_ok=true + break + else + sleep $i + fi +done +[ "$containers_ok" = "false" ] && echo "Error: required container not running." && exit 1 + +# Data Router Configuration. +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 @$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 +sleep 10 +docker exec -it datarouter-prov sh -c "curl http://dmaap-dr-node:8080/internal/fetchProv" +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}" diff --git a/csit/plans/pmmapper/teardown.sh b/csit/plans/pmmapper/teardown.sh new file mode 100644 index 0000000..8ca608d --- /dev/null +++ b/csit/plans/pmmapper/teardown.sh @@ -0,0 +1,7 @@ +#!/bin/bash +echo "Starting teardown script" +TEST_PLANS_DIR=$WORKSPACE/plans/pmmapper +mkdir -p $WORKSPACE/archives +docker exec pmmapper /bin/sh -c "cat /var/log/ONAP/dcaegen2/services/pm-mapper/pm-mapper_output.log" +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 diff --git a/csit/plans/pmmapper/testplan.txt b/csit/plans/pmmapper/testplan.txt new file mode 100644 index 0000000..a2cc01b --- /dev/null +++ b/csit/plans/pmmapper/testplan.txt @@ -0,0 +1,3 @@ +# Test suites are relative paths under [dcaegen2/services/pm-mapper.git]/csit/tests/. +# Place the suites in run order. +pmmapper diff --git a/csit/prepare-csit.sh b/csit/prepare-csit.sh new file mode 100755 index 0000000..3cc143d --- /dev/null +++ b/csit/prepare-csit.sh @@ -0,0 +1,49 @@ +#!/bin/bash -x +# +# Copyright 2019-2021 © Samsung Electronics Co., Ltd. +# +# 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. +# +# This script installs common libraries required by CSIT tests +# + +if [ -z "$WORKSPACE" ]; then + export WORKSPACE=`git rev-parse --show-toplevel` +fi + +TESTPLANDIR=${WORKSPACE}/${TESTPLAN} + +# Assume that if ROBOT_VENV is set and virtualenv with system site packages can be activated, +# ci-management/jjb/integration/include-raw-integration-install-robotframework.sh has already +# been executed + +if [ -f ${WORKSPACE}/env.properties ]; then + source ${WORKSPACE}/env.properties +fi +if [ -f ${ROBOT_VENV}/bin/activate ]; then + source ${ROBOT_VENV}/bin/activate +else + rm -rf /tmp/ci-management + rm -f ${WORKSPACE}/env.properties + cd /tmp + git clone "https://gerrit.onap.org/r/ci-management" + source /tmp/ci-management/jjb/integration/include-raw-integration-install-robotframework.sh +fi + +# install eteutils +mkdir -p ${ROBOT_VENV}/src/onap +rm -rf ${ROBOT_VENV}/src/onap/testsuite +pip install --upgrade --extra-index-url="https://nexus3.onap.org/repository/PyPi.staging/simple" 'robotframework-onap==0.5.1.*' --pre + +pip freeze + diff --git a/csit/run-csit.sh b/csit/run-csit.sh new file mode 100755 index 0000000..fcbcbe1 --- /dev/null +++ b/csit/run-csit.sh @@ -0,0 +1,191 @@ +#!/bin/bash -x +# +# Copyright 2016-2017 Huawei Technologies Co., Ltd. +# Modification Copyright 2019-2021 © Samsung Electronics Co., Ltd. +# +# 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. +# +# $1 project/functionality +# $2 robot options +# + +function on_exit(){ + rc=$? + if [[ ${WORKSPACE} ]]; then + if [[ ${WORKDIR} ]]; then + rsync -av "$WORKDIR/" "$WORKSPACE/archives/$TESTPLAN" + fi + # Record list of active docker containers + docker ps --format "{{.Image}}" > "$WORKSPACE/archives/$TESTPLAN/_docker-images.log" + + # show memory consumption after all docker instances initialized + docker_stats | tee "$WORKSPACE/archives/$TESTPLAN/_sysinfo-2-after-robot.txt" + fi + # Run teardown script plan if it exists + cd "${TESTPLANDIR}" + TEARDOWN="${TESTPLANDIR}/teardown.sh" + if [ -f "${TEARDOWN}" ]; then + echo "Running teardown script ${TEARDOWN}" + source_safely "${TEARDOWN}" + fi + exit $rc +} +# ensure that teardown and other finalizing steps are always executed +trap on_exit EXIT + +function docker_stats(){ + #General memory details + echo "> top -bn1 | head -3" + top -bn1 | head -3 + echo + + echo "> free -h" + free -h + echo + + #Memory details per Docker + echo "> docker ps" + docker ps + echo + + echo "> docker stats --no-stream" + docker stats --no-stream + echo +} + +# save current set options +function save_set() { + RUN_CSIT_SAVE_SET="$-" + RUN_CSIT_SHELLOPTS="$SHELLOPTS" +} + +# load the saved set options +function load_set() { + _setopts="$-" + + # bash shellopts + for i in $(echo "$SHELLOPTS" | tr ':' ' ') ; do + set +o ${i} + done + for i in $(echo "$RUN_CSIT_SHELLOPTS" | tr ':' ' ') ; do + set -o ${i} + done + + # other options + for i in $(echo "$_setopts" | sed 's/./& /g') ; do + set +${i} + done + set -${RUN_CSIT_SAVE_SET} +} + +# set options for quick bailout when error +function harden_set() { + set -xeo pipefail + set +u # enabled it would probably fail too many often +} + +# relax set options so the sourced file will not fail +# the responsibility is shifted to the sourced file... +function relax_set() { + set +e + set +o pipefail +} + +# wrapper for sourcing a file +function source_safely() { + [ -z "$1" ] && return 1 + relax_set + . "$1" + load_set +} + +# +# main +# + +# set and save options for quick failure +harden_set && save_set + +if [ $# -eq 0 ] +then + echo + echo "Usage: $0 plans// []" + echo + echo " , , : " + echo " The same values as for the '{project}-csit-{functionality}' JJB job template." + echo + exit 1 +fi + +if [ -z "$WORKSPACE" ]; then + export WORKSPACE=$(git rev-parse --show-toplevel) +fi + +if [ -f "${WORKSPACE}/${1}/testplan.txt" ]; then + export TESTPLAN="${1}" +else + echo "testplan not found: ${WORKSPACE}/${TESTPLAN}/testplan.txt" + exit 2 +fi + +export TESTOPTIONS="${2}" + +rm -rf "$WORKSPACE/archives/$TESTPLAN" +mkdir -p "$WORKSPACE/archives/$TESTPLAN" + +TESTPLANDIR="${WORKSPACE}/${TESTPLAN}" + +# Run installation of prerequired libraries +source_safely "${WORKSPACE}/prepare-csit.sh" + +# Activate the virtualenv containing all the required libraries installed by prepare-csit.sh +source_safely "${ROBOT_VENV}/bin/activate" + +WORKDIR=$(mktemp -d --suffix=-robot-workdir) +cd "${WORKDIR}" + +# Add csit scripts to PATH +export PATH="${PATH}:${WORKSPACE}/docker/scripts:${WORKSPACE}/scripts:${ROBOT_VENV}/bin" +export SCRIPTS="${WORKSPACE}/scripts" +export ROBOT_VARIABLES= + +# Sign in to nexus3 docker repo +docker login -u docker -p docker nexus3.onap.org:10001 + +# Run setup script plan if it exists +cd "${TESTPLANDIR}" +SETUP="${TESTPLANDIR}/setup.sh" +if [ -f "${SETUP}" ]; then + echo "Running setup script ${SETUP}" + source_safely "${SETUP}" +fi + +# show memory consumption after all docker instances initialized +docker_stats | tee "$WORKSPACE/archives/$TESTPLAN/_sysinfo-1-after-setup.txt" + +# Run test plan +cd "$WORKDIR" +echo "Reading the testplan:" +cat "${TESTPLANDIR}/testplan.txt" | egrep -v '(^[[:space:]]*#|^[[:space:]]*$)' | sed "s|^|${WORKSPACE}/tests/|" > testplan.txt +cat testplan.txt +SUITES=$( xargs -a testplan.txt ) + +echo ROBOT_VARIABLES="${ROBOT_VARIABLES}" +echo "Starting Robot test suites ${SUITES} ..." +relax_set +python -m robot.run -N ${TESTPLAN} -v WORKSPACE:/tmp ${ROBOT_VARIABLES} ${TESTOPTIONS} ${SUITES} +RESULT=$? +load_set +echo "RESULT: $RESULT" +# Note that the final steps are done in on_exit function after this exit! +exit $RESULT diff --git a/csit/run-project-csit.sh b/csit/run-project-csit.sh new file mode 100755 index 0000000..12eb349 --- /dev/null +++ b/csit/run-project-csit.sh @@ -0,0 +1,33 @@ +#!/bin/bash -x +# +# Copyright 2020-2021 © Samsung Electronics Co., Ltd. +# +# 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. +# + +# $1 test options (passed on to run-csit.sh as such) +# + +export TESTOPTIONS=${1} +export WORKSPACE=$(git rev-parse --show-toplevel)/csit + +rm -rf ${WORKSPACE}/archives +mkdir -p ${WORKSPACE}/archives +cd ${WORKSPACE} + +# Execute all testsuites defined under plans subdirectory +for dir in plans/*/ +do + dir=${dir%*/} # remove the trailing / + ./run-csit.sh ${dir} ${TESTOPTIONS} +done diff --git a/csit/scripts/common_functions.sh b/csit/scripts/common_functions.sh new file mode 100755 index 0000000..684c418 --- /dev/null +++ b/csit/scripts/common_functions.sh @@ -0,0 +1,263 @@ +#!/bin/bash + +# Copyright 2016-2017 Huawei Technologies Co., Ltd. +# +# 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. + +function memory_details(){ + #General memory details + echo "> top -bn1 | head -3" + top -bn1 | head -3 + echo + + echo "> free -h" + free -h + echo + + #Memory details per Docker + echo "> docker ps" + docker ps + echo + + echo "> docker stats --no-stream" + docker stats --no-stream + echo +} +function fibonacci_number(){ + set +x + if [ $1 -le 1 ] + then + echo "1" + elif [ $1 -le 10 ] + then + Num=$1 + f1=0 + f2=1 + fn=-1 + for i in `eval echo {1..$Num}`;do + fn=$((f1+f2)) + f1=$f2 + f2=$fn + done + echo $fn + else + echo "30" + fi +} +function wait_curl_driver(){ + #Parameters: + #CURL_COMMAND - the URL on which the curl command will be executed + #GREP_STRING - Desired string to be found inside the body response of the + # previous curl command + #EXCLUDE_STRING - If the filtered string (GREP_STRING) must not exist in + # the body response of the curl + #WAIT_MESSAGE - the message to be displayed for logging purpose. (optional) + #REPEAT_NUMBER - the maximum number of tries before abandoning the curl + # command (optional, by default = 15) + #MAX_TIME - Maximum time allowed for the transfer (in seconds) + #STATUS_CODE - A HTTP status code desired to be found by getting the link + # /!\ IMPORTANT NOTICE: the usage of STATUS_CODE option turn GREP_STRING/ + # /!\ EXCLUDE_STRING/and the MAX_TIME options becomes obsolete with no + # /!\ execution impact + #MEMORY_USAGE - If Parameters exists shows the memory usage after curl + # execution(s) + + repeat_max=15 + parameters="$@" + + #WAIT_MESSAGE + if [[ $parameters == *"WAIT_MESSAGE"* ]] + then + wait_message=`echo $parameters | sed -e "s/.*WAIT_MESSAGE=//g"` + wait_message=`echo $wait_message | sed -e "s/ .*//g"` + else + wait_message="wait ..." + fi + + #REPEAT_NUMBER + if [[ $parameters == *"REPEAT_NUMBER"* ]] + then + repeat_max=`echo $parameters | sed -e "s/.*REPEAT_NUMBER=//g"` + repeat_max=`echo $repeat_max | sed -e "s/ .*//g"` + fi + + #CURL_COMMAND + if [[ $parameters == *"CURL_COMMAND"* ]] + then + curl_command=`echo $parameters | sed -e 's/.*CURL_COMMAND=//g'` + curl_command=`echo $curl_command | sed -e 's/ .*//g'` + else + echo "-Curl is empty-" # Or no parameterseter passed. + return 0 + fi + + #MAX_TIME + if [[ $parameters == *"MAX_TIME"* ]] + then + max_time=`echo $parameters | sed -e 's/.*MAX_TIME=//g'` + max_time=`echo $max_time | sed -e 's/ .*//g'` + else + max_time="5" + fi + + exclude_string="" + #EXCLUDE_STRING + if [[ $parameters == *"EXCLUDE_STRING"* ]] + then + exclude_string="-v" + fi + + status_code="" + #STATUS_CODE + if [[ $parameters == *"STATUS_CODE"* ]] + then + status_code=`echo $parameters | sed -e 's/.*STATUS_CODE=//g'` + status_code=`echo $status_code | sed -e 's/ .*//g'` + fi + + for i in `eval echo {1..$repeat_max}`; do + response_code=`curl -o /dev/null --silent --head --write-out '%{http_code}' $curl_command` + echo "..." + if [[ ! -z $status_code ]] ; then + if [ "$status_code" -eq "$response_code" ] + then + echo "SUCCESS:Actual Status code <$response_code> match the expected code <$status_code>" + return 0 + else + echo "WARNING:Expected <$status_code> but Actual <$response_code>" + fi + else + #GREP_STRING + if [[ $parameters == *"GREP_STRING"* ]] + then + grep_command=`echo $parameters | sed -e 's/.*GREP_STRING=//g'` + grep_command=`echo $grep_command | sed -e 's/ REPEAT_NUMBER=.*//g' | sed -e 's/ CURL_COMMAND=.*//g' | sed -e 's/ WAIT_MESSAGE=.*//g' | sed -e 's/ MAX_TIME=.*//g' | sed -e 's/ EXCLUDE_STRING.*//g'` + else + echo "-Grep_command is empty-" # Or no parameters passed. + return 0 + fi + + str=`curl -sS -m$max_time $curl_command | grep "$grep_command"` + echo "BODY::$str" + if [[ ! -z $exclude_string ]] + then + if [[ -z $str ]] + then + echo "SUCCESS: body response does not contains '$grep_command'"; + break; + else + echo "Fall_Short: Body response still contains '$grep_command'" + fi + else + if [[ ! -z $str ]] + then + echo "SUCCESS: body response contains '$grep_command'"; + break; + else + echo "Fall_Short: Element '$grep_command' not found yet # "$i"" + fi + fi + + if [ "$?" = "7" ]; then + echo 'Connection refused or can not connect to server/proxy'; + str='' + fi + fi + seconds2sleep=`fibonacci_number $i` + echo $wait_message + echo "Iteration::$i out of $repeat_max " + echo "Quiet time for $seconds2sleep seconds ..." + sleep $seconds2sleep + + # if waiting for a long time, log system load + if [ $i -gt 45 ] + then + memory_details + fi + done + #MEMORY_USAGE + if [[ $parameters == *"MEMORY_USAGE"* ]] + then + echo "==========================MEMORY USAGE==================================" + memory_details + echo "========================================================================" + fi + return 0 +} + +function run_simulator () +{ + run_robottestlib + run_simulator_docker $1 +} + +function run_robottestlib () +{ + #Start the robottest REST library if not started + if ! pgrep -f robottest > /dev/null + then + #Download the latest robottest jar + wget -q -O ${SCRIPTS}/integration/mockserver/org.openo.robottest.jar "https://nexus.open-o.org/service/local/artifact/maven/redirect?r=snapshots&g=org.openo.integration&a=org.openo.robottest&e=jar&v=LATEST" + chmod +x ${SCRIPTS}/integration/mockserver/org.openo.robottest.jar + eval `java -cp ${SCRIPTS}/integration/mockserver/org.openo.robottest.jar org.openo.robot.test.robottest.MyRemoteLibrary` & + fi +} + +function run_simulator_docker () +{ + #Start the simulator docker if not started + SIMULATOR_IP=`docker inspect --format '{{ .NetworkSettings.IPAddress }}' simulator` + if [[ -z $SIMULATOR_IP ]] + then + echo "Starting simulator docker..." + SIMULATOR_JSON=$1 + if [[ -z $SIMULATOR_JSON ]] + then + SIMULATOR_JSON=main.json + fi + docker run -d -i -t --name simulator -e SIMULATOR_JSON=$SIMULATOR_JSON -p 18009:18009 -p 18008:18008 openoint/simulate-test-docker + SIMULATOR_IP=`docker inspect --format '{{ .NetworkSettings.IPAddress }}' simulator` + fi + + #Set the simulator IP in robot variables + ROBOT_VARIABLES=${ROBOT_VARIABLES}" -v SIMULATOR_IP:${SIMULATOR_IP} -v SCRIPTS:${SCRIPTS}" + echo ${ROBOT_VARIABLES} +} + +function get_docker_compose_service () +{ + local service=$1 + local compose_file=${2:-docker-compose.yml} + + echo $(docker-compose --file ./${compose_file} ps | grep $service | cut -d " " -f1 ) +} + +function bypass_ip_adress () +{ + local ip_address=$1 + + if [[ $no_proxy && $no_proxy != *$ip_address* ]]; then + export no_proxy=$no_proxy,$ip_address + fi +} + +function wait_for_service_init () +{ + local service_url=$1 + + for delay in {1..50}; do + curl -sS ${service_url} && break + echo "$delay - Waiting for $service_url..." + sleep $delay + done +} diff --git a/csit/scripts/kill-instance.sh b/csit/scripts/kill-instance.sh new file mode 100755 index 0000000..5997098 --- /dev/null +++ b/csit/scripts/kill-instance.sh @@ -0,0 +1,31 @@ +#!/bin/bash +# +# Copyright 2016-2017 Huawei Technologies Co., Ltd. +# +# 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. +# +# $1 nickname for the instance + +mkdir -p $WORKSPACE/archives + +running_containers=$(docker ps --filter name=$1 -q) +if [ -z "$running_containers" ] +then + echo "$1 already terminated" +else + echo "Stopping and removing containers" + docker logs $running_containers >> $WORKSPACE/archives/$1.log + docker stop $running_containers + docker rm $running_containers +fi + diff --git a/csit/tests/filesprocessingconfigpmmapper/__init__.robot b/csit/tests/filesprocessingconfigpmmapper/__init__.robot new file mode 100644 index 0000000..9eda6de --- /dev/null +++ b/csit/tests/filesprocessingconfigpmmapper/__init__.robot @@ -0,0 +1,2 @@ +*** Settings *** +Documentation Files Processing Config PM Mapper Testcases diff --git a/csit/tests/filesprocessingconfigpmmapper/assets/.gitattributes b/csit/tests/filesprocessingconfigpmmapper/assets/.gitattributes new file mode 100644 index 0000000..57cdc50 --- /dev/null +++ b/csit/tests/filesprocessingconfigpmmapper/assets/.gitattributes @@ -0,0 +1 @@ +*.gz binary diff --git a/csit/tests/filesprocessingconfigpmmapper/assets/ABigFile.xml b/csit/tests/filesprocessingconfigpmmapper/assets/ABigFile.xml new file mode 100644 index 0000000..8a3bcf4 --- /dev/null +++ b/csit/tests/filesprocessingconfigpmmapper/assets/ABigFile.xml @@ -0,0 +1,163 @@ + + + + + + + + + + + + + + attTCHSeizures + succTCHSeizures + attImmediateAssignProcs + succImmediateAssignProcs + + 234 + 345 + 567 + 789 + + + 890 + 901 + 123 + 234 + + + 456 + 567 + 678 + 789 + true + + + + + + + attTCHSeizures1 + succTCHSeizures2 + attImmediateAssignProcs3 + succImmediateAssignProcs4 + + 4 + 86,87,2,6,77,96,75,33,24 + 40 + 90 + false + + + + + + + attTCHSeizures5 + succTCHSeizures6 + attImmediateAssignProcs7 + succImmediateAssignProcs8 + + 238 + 344 + 563 + 787 + + + 898 + 905 + 127 + 238 + + + 454 + 569 + 672 + 785 + true + + + + + + + + + + attTCHSeizures + succTCHSeizures + attImmediateAssignProcs + succImmediateAssignProcs + + 234 + 345 + 567 + 789 + + + 890 + 901 + 123 + 234 + + + 456 + 567 + 678 + 789 + true + + + + + + + attTCHSeizures1 + succTCHSeizures2 + attImmediateAssignProcs3 + succImmediateAssignProcs4 + + 4 + 86,87,2,6,77,96,75,33,24 + 40 + 90 + false + + + + + + + attTCHSeizures5 + succTCHSeizures6 + attImmediateAssignProcs7 + succImmediateAssignProcs8 + + 238 + 344 + 563 + 787 + + + 898 + 905 + 127 + 238 + + + 454 + 569 + 672 + 785 + true + + + + + + + diff --git a/csit/tests/filesprocessingconfigpmmapper/assets/config_10_1.env b/csit/tests/filesprocessingconfigpmmapper/assets/config_10_1.env new file mode 100644 index 0000000..050d2f2 --- /dev/null +++ b/csit/tests/filesprocessingconfigpmmapper/assets/config_10_1.env @@ -0,0 +1,3 @@ +PROCESSING_LIMIT_RATE=10 +THREADS_MULTIPLIER=1 +PROCESSING_THREADS_COUNT=1 diff --git a/csit/tests/filesprocessingconfigpmmapper/assets/config_1_1.env b/csit/tests/filesprocessingconfigpmmapper/assets/config_1_1.env new file mode 100644 index 0000000..c138912 --- /dev/null +++ b/csit/tests/filesprocessingconfigpmmapper/assets/config_1_1.env @@ -0,0 +1,3 @@ +PROCESSING_LIMIT_RATE=1 +THREADS_MULTIPLIER=1 +PROCESSING_THREADS_COUNT=1 diff --git a/csit/tests/filesprocessingconfigpmmapper/assets/config_1_10.env b/csit/tests/filesprocessingconfigpmmapper/assets/config_1_10.env new file mode 100644 index 0000000..b4c290e --- /dev/null +++ b/csit/tests/filesprocessingconfigpmmapper/assets/config_1_10.env @@ -0,0 +1,3 @@ +PROCESSING_LIMIT_RATE=1 +THREADS_MULTIPLIER=1 +PROCESSING_THREADS_COUNT=10 diff --git a/csit/tests/filesprocessingconfigpmmapper/assets/valid_metadata.json b/csit/tests/filesprocessingconfigpmmapper/assets/valid_metadata.json new file mode 100644 index 0000000..da809d7 --- /dev/null +++ b/csit/tests/filesprocessingconfigpmmapper/assets/valid_metadata.json @@ -0,0 +1,12 @@ +{ + "productName": "gnb", + "vendorName": "Ericsson", + "lastEpochMicrosec": "1538478000000", + "sourceName": "oteNB5309", + "startEpochMicrosec": "1538478900000", + "timeZoneOffset": "UTC+05.00", + "location": "ftpes://192.168.0.101:22/ftp/rop/A20161224.1045-1100.bin.gz", + "compression": "gzip", + "fileFormatType": "org.3GPP.32.435#measCollec", + "fileFormatVersion": "V9" + } \ No newline at end of file diff --git a/csit/tests/filesprocessingconfigpmmapper/filesprocessingconfigpmmapper.robot b/csit/tests/filesprocessingconfigpmmapper/filesprocessingconfigpmmapper.robot new file mode 100644 index 0000000..9648ef8 --- /dev/null +++ b/csit/tests/filesprocessingconfigpmmapper/filesprocessingconfigpmmapper.robot @@ -0,0 +1,149 @@ +*** Settings *** +Documentation Testing PM Mapper functionality +Library Collections +Library OperatingSystem +Library RequestsLibrary +Library Process +Library String +Library libraries/DockerContainerManager.py +Library libraries/LogReader.py + +*** Variables *** + +${ASSETS_PATH} %{WORKSPACE}/tests/filesprocessingconfigpmmapper/assets +${NR_VALID_METADATA_PATH} ${ASSETS_PATH}/valid_metadata.json +${CLI_EXEC_CLI_PM_LOG_CLEAR} docker exec pmmapper /bin/sh -c "echo -n "" > /var/log/ONAP/dcaegen2/services/pm-mapper/pm-mapper_output.log" +${PUBLISH_NODE_URL} https://${DR_NODE_IP}:8443/publish/1 +${CLI_EXEC_LOGS_LIST} docker exec datarouter-node /bin/sh -c "ls /opt/app/datartr/logs" +${DOCKER_CLIENT_IMAGE} nexus3.onap.org:10001/onap/org.onap.dcaegen2.services.pm-mapper:latest +${CLIENT_CONTAINER_NAME} pmmapper +${FILE_PATH} ${ASSETS_PATH}/ABigFile.xml +${CONFIG_ENVS_1_1} ${ASSETS_PATH}/config_1_1.env +${CONFIG_ENVS_4_1} ${ASSETS_PATH}/config_4_1.env +${CONFIG_ENVS_10_1} ${ASSETS_PATH}/config_10_1.env +${CONFIG_ENVS_1_10} ${ASSETS_PATH}/config_1_10.env + +*** Test Cases *** + +Verify that PM Mapper rejects 6-9 messages when limitRate is 1 and threads count is 1 + [Tags] FILES_PROCESSING_CONFIG_PM_MAPPER_1 + [Documentation] Verify that PM Mapper rejects 6-9/10 messages. Configuration: limitRate=1, threadsCount=1 + [Timeout] 15 minute + + RestartPmmapper ${CONFIG_ENVS_1_1} + + ${testname}= Set Variable Afirst- + + SendFilesToDatarouter ${testname} + ${alllogs}= GetLogsOutput + ${filtered_logs}= GetFilteredLogs ${alllogs} ${testname} + ${dropped_nr}= GetDroppedNumber ${filtered_logs} + + Sleep 40s + ${isCorrectDroppedCount}= Evaluate ${5} < ${dropped_nr} < ${10} + SavePmMapperLogsAndDroppedCount config_1_1 ${dropped_nr} + Should Be True ${isCorrectDroppedCount} Pm-mapper drop: ${dropped_nr} messages. Expected drop count: 6-9 + ClearLogs + +Verify that PM Mapper rejects 0 messages when limitRate is 10 and threads count is 1 + [Tags] FILES_PROCESSING_CONFIG_PM_MAPPER_2 + [Documentation] Verify that PM Mapper rejects 0/10 messages. Configuration: limitRate=10, threadsCount=1 + [Timeout] 25 minute + + RestartPmmapper ${CONFIG_ENVS_10_1} + + ${testname}= Set Variable Athird- + + SendFilesToDatarouter ${testname} + ${alllogs}= GetLogsOutput + ${filtered_logs}= GetFilteredLogs ${alllogs} ${testname} + ${dropped_nr}= GetDroppedNumber ${filtered_logs} + + Sleep 15s + SavePmMapperLogsAndDroppedCount config_10_1 ${dropped_nr} + Should Be Equal As Numbers ${dropped_nr} 0 Pm-mapper drop: ${dropped_nr} messages. Expected drop count: 0 + ClearLogs + +Verify that PM Mapper rejects 0 messages when limitRate is 1 and threads count is 10 + [Tags] FILES_PROCESSING_CONFIG_PM_MAPPER_3 + [Documentation] Verify that PM Mapper rejects 0/10 messages. Configuration: limitRate=1, threadsCount=10 + [Timeout] 25 minute + + RestartPmmapper ${CONFIG_ENVS_1_10} + + ${testname}= Set Variable Afourth- + + SendFilesToDatarouter ${testname} + ${alllogs}= GetLogsOutput + ${filtered_logs}= GetFilteredLogs ${alllogs} ${testname} + ${dropped_nr}= GetDroppedNumber ${filtered_logs} + + Sleep 15s + SavePmMapperLogsAndDroppedCount config_1_10 ${dropped_nr} + Should Be Equal As Numbers ${dropped_nr} 0 Pm-mapper drop: ${dropped_nr} messages. Expected drop count: 0 + ClearLogs + +*** Keywords *** + +SendFilesToDatarouter + [Arguments] ${testnr} + FOR ${i} IN RANGE 10 + SendToDatarouter ${FILE_PATH} ${NR_VALID_METADATA_PATH} X-ONAP-RequestID=${i} ${testnr} ${i} + END + Sleep 20s + +SendToDatarouter + [Arguments] ${filepath} ${metadatapath} ${request_id} ${testnr} ${i} + ${pmdata}= Get File ${filepath} + ${metatdata} Get File ${metadatapath} + ${newFilename} Catenate SEPARATOR= ${testnr} ${i} .xml + ${resp}= PutCall ${PUBLISH_NODE_URL}/${newFilename} ${request_id} ${pmdata} ${metatdata.replace("\n","")} pmmapper + VerifyResponse ${resp.status_code} 204 + +PutCall + [Arguments] ${url} ${request_id} ${data} ${meta} ${user} + ${headers}= Create Dictionary X-ONAP-RequestID=${request_id} X-DMAAP-DR-META=${meta} Content-Type=application/octet-stream X-DMAAP-DR-ON-BEHALF-OF=${user} Authorization=Basic cG1tYXBwZXI6cG1tYXBwZXI= + ${resp}= Evaluate requests.put('${url}', data="""${data}""", headers=${headers}, verify=False, allow_redirects=False) requests + [Return] ${resp} + +VerifyResponse + [Arguments] ${actual_response_value} ${expected_response_value} + Should Be Equal As Strings ${actual_response_value} ${expected_response_value} + +ClearLogs + Run Process ${CLI_EXEC_CLI_PM_LOG_CLEAR} shell=yes + +GetLogsOutput + ${filesString}= Run Process ${CLI_EXEC_LOGS_LIST} shell=yes + ${filesList}= Get Log Files List ${filesString.stdout} + ${output}= Set Variable ${EMPTY} + FOR ${file} IN @{filesList} + ${file_path}= Catenate SEPARATOR= "cat /opt/app/datartr/logs/ ${file} " + ${exec}= Catenate docker exec datarouter-node /bin/sh -c ${file_path} + ${single_file}= Run Process ${exec} shell=yes + ${output}= Catenate SEPARATOR=\n ${output} ${single_file.stdout} + END + [Return] ${output} + +GetFilteredLogs + [Arguments] ${all_logs} ${testname} + ${filtered_logs}= Filter Unique ${all_logs} ${testname} + [Return] ${filtered_logs} + +GetDroppedNumber + [Arguments] ${logs_output} + ${number}= Get Number Of Dropped Messages ${logs_output} + [Return] ${number} + +RestartPmmapper + [Arguments] ${envs} + Remove Container ${CLIENT_CONTAINER_NAME} + Sleep 5s + Run Pmmapper Container ${DOCKER_CLIENT_IMAGE} ${CLIENT_CONTAINER_NAME} ${envs} ${DR_NODE_IP} ${NODE_IP} + Sleep 15s + +SavePmMapperLogsAndDroppedCount + [Arguments] ${test_name} ${dropped_count} + Run Process echo "Dropped: ${dropped_count}" > %{WORKSPACE}/archives/${test_name}_dropped_count.log shell=yes + Run Process docker logs ${CLIENT_CONTAINER_NAME} > %{WORKSPACE}/archives/${test_name}_pm_mapper_container_logs.log shell=yes + diff --git a/csit/tests/filesprocessingconfigpmmapper/libraries/DockerContainerManager.py b/csit/tests/filesprocessingconfigpmmapper/libraries/DockerContainerManager.py new file mode 100644 index 0000000..3e3ae58 --- /dev/null +++ b/csit/tests/filesprocessingconfigpmmapper/libraries/DockerContainerManager.py @@ -0,0 +1,29 @@ +import docker +from EnvsReader import EnvsReader +from docker.types import Mount + +class DockerContainerManager: + + def run_pmmapper_container(self, client_image, container_name, path_to_env, dr_node_ip, mr_ip): + client = docker.from_env() + environment = EnvsReader().read_env_list_from_file(path_to_env) + environment.append("CONFIG_BINDING_SERVICE_SERVICE_HOST=172.18.0.5") + environment.append("CONFIG_BINDING_SERVICE_SERVICE_PORT=10000") + environment.append("HOSTNAME=pmmapper") + client.containers.run( + image=client_image, + name=container_name, + environment=environment, + ports={'8081': 8081}, + network='filesprocessingconfigpmmapper_pmmapper-network', + extra_hosts={'dmaap-dr-node': dr_node_ip, 'message-router': mr_ip}, + user='root', + mounts=[Mount(target='/opt/app/pm-mapper/etc/certs/', source='/var/tmp/', type='bind')], + detach=True + ) + + def remove_container(self, container_name): + client = docker.from_env() + container = client.containers.get(container_name) + container.stop() + container.remove() diff --git a/csit/tests/filesprocessingconfigpmmapper/libraries/DockerContainerManager.pyc b/csit/tests/filesprocessingconfigpmmapper/libraries/DockerContainerManager.pyc new file mode 100644 index 0000000..2bf62c3 Binary files /dev/null and b/csit/tests/filesprocessingconfigpmmapper/libraries/DockerContainerManager.pyc differ diff --git a/csit/tests/filesprocessingconfigpmmapper/libraries/EnvsReader.py b/csit/tests/filesprocessingconfigpmmapper/libraries/EnvsReader.py new file mode 100644 index 0000000..cc60eed --- /dev/null +++ b/csit/tests/filesprocessingconfigpmmapper/libraries/EnvsReader.py @@ -0,0 +1,11 @@ + +class EnvsReader: + + def read_env_list_from_file(self, path): + f = open(path, "r") + r_list = [] + for line in f: + line = line.strip() + if line[0] != "#": + r_list.append(line) + return r_list diff --git a/csit/tests/filesprocessingconfigpmmapper/libraries/EnvsReader.pyc b/csit/tests/filesprocessingconfigpmmapper/libraries/EnvsReader.pyc new file mode 100644 index 0000000..831aa34 Binary files /dev/null and b/csit/tests/filesprocessingconfigpmmapper/libraries/EnvsReader.pyc differ diff --git a/csit/tests/filesprocessingconfigpmmapper/libraries/LogReader.py b/csit/tests/filesprocessingconfigpmmapper/libraries/LogReader.py new file mode 100644 index 0000000..01718e3 --- /dev/null +++ b/csit/tests/filesprocessingconfigpmmapper/libraries/LogReader.py @@ -0,0 +1,22 @@ +import re + +class LogReader: + + def filter_unique(self, merged_logs_output, testname): + logs = merged_logs_output.splitlines() + del_logs = list(filter(lambda line: "|DEL|" in line, logs)) + nrs_set = set() + ret_logs = set() + for log in del_logs: + filename = re.findall(testname + "\d", log) + if len(filename) > 0 and filename[0] not in nrs_set: + ret_logs.add(log) + nrs_set.add(filename[0]) + return ret_logs + + def get_number_of_dropped_messages(self, logs_output): + return len(list(filter(lambda line: "|429|" in line, logs_output))) + + def get_log_files_list(self, fileNames): + files = fileNames.split() + return files diff --git a/csit/tests/filesprocessingconfigpmmapper/libraries/LogReader.pyc b/csit/tests/filesprocessingconfigpmmapper/libraries/LogReader.pyc new file mode 100644 index 0000000..d8e936c Binary files /dev/null and b/csit/tests/filesprocessingconfigpmmapper/libraries/LogReader.pyc differ diff --git a/csit/tests/pmmapper/__init__.robot b/csit/tests/pmmapper/__init__.robot new file mode 100644 index 0000000..3e4501c --- /dev/null +++ b/csit/tests/pmmapper/__init__.robot @@ -0,0 +1,2 @@ +*** Settings *** +Documentation PM Mapper Testcases diff --git a/csit/tests/pmmapper/assets/.gitattributes b/csit/tests/pmmapper/assets/.gitattributes new file mode 100644 index 0000000..57cdc50 --- /dev/null +++ b/csit/tests/pmmapper/assets/.gitattributes @@ -0,0 +1 @@ +*.gz binary diff --git a/csit/tests/pmmapper/assets/A20181002.0000-1000-0015-1000_5G.xml b/csit/tests/pmmapper/assets/A20181002.0000-1000-0015-1000_5G.xml new file mode 100644 index 0000000..fadc8a6 --- /dev/null +++ b/csit/tests/pmmapper/assets/A20181002.0000-1000-0015-1000_5G.xml @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + attTCHSeizures + succTCHSeizures + attImmediateAssignProcs + succImmediateAssignProcs + + 234 + 345 + 567 + 789 + + + 890 + 901 + 123 + 234 + + + 456 + 567 + 678 + 789 + true + + + + + + + attTCHSeizures1 + succTCHSeizures2 + attImmediateAssignProcs3 + succImmediateAssignProcs4 + + 4 + 86,87,2,6,77,96,75,33,24 + 40 + 90 + false + + + + + + + attTCHSeizures5 + succTCHSeizures6 + attImmediateAssignProcs7 + succImmediateAssignProcs8 + + 238 + 344 + 563 + 787 + + + 898 + 905 + 127 + 238 + + + 454 + 569 + 672 + 785 + true + + + + + + + diff --git a/csit/tests/pmmapper/assets/A20181002.0000-1000-0015-1000_5G.xml.gz b/csit/tests/pmmapper/assets/A20181002.0000-1000-0015-1000_5G.xml.gz new file mode 100644 index 0000000..32865fc Binary files /dev/null and b/csit/tests/pmmapper/assets/A20181002.0000-1000-0015-1000_5G.xml.gz differ diff --git a/csit/tests/pmmapper/assets/A_no_managed_element.xml b/csit/tests/pmmapper/assets/A_no_managed_element.xml new file mode 100644 index 0000000..23e5c21 --- /dev/null +++ b/csit/tests/pmmapper/assets/A_no_managed_element.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + a + b + c + + 86 + 67 + 14 + false + + + + + + + \ No newline at end of file diff --git a/csit/tests/pmmapper/assets/A_no_measdata.xml b/csit/tests/pmmapper/assets/A_no_measdata.xml new file mode 100644 index 0000000..855b2e9 --- /dev/null +++ b/csit/tests/pmmapper/assets/A_no_measdata.xml @@ -0,0 +1,11 @@ + + + + + + + + + + diff --git a/csit/tests/pmmapper/assets/C20190328.0000-0015.xml b/csit/tests/pmmapper/assets/C20190328.0000-0015.xml new file mode 100644 index 0000000..b6a3b43 --- /dev/null +++ b/csit/tests/pmmapper/assets/C20190328.0000-0015.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + z1 a1 zz1 b1 + + 1 11 111 1111 + false + + + + + + + + + + z2 a2 zz2 b2 + + 2 22 222 2222 + false + + + + + + + + + + z3 a3 zz3 b3 + + 3 33 333 3333 + false + + + + + + + diff --git a/csit/tests/pmmapper/assets/diff_vendor_metadata.json b/csit/tests/pmmapper/assets/diff_vendor_metadata.json new file mode 100644 index 0000000..0abf8e3 --- /dev/null +++ b/csit/tests/pmmapper/assets/diff_vendor_metadata.json @@ -0,0 +1,12 @@ +{ + "productName": "gnb", + "vendorName": "Anon", + "lastEpochMicrosec": "1538478000000", + "sourceName": "oteNB5309", + "startEpochMicrosec": "1538478900000", + "timeZoneOffset": "UTC+05.00", + "location": "ftpes://192.168.0.101:22/ftp/rop/A20161224.1045-1100.bin.gz", + "compression": "gzip", + "fileFormatType": "org.3GPP.32.435#measCollec", + "fileFormatVersion": "V9" + } \ No newline at end of file diff --git a/csit/tests/pmmapper/assets/new_radio/A20181004.0000-1000-0015-1000_5G.xml b/csit/tests/pmmapper/assets/new_radio/A20181004.0000-1000-0015-1000_5G.xml new file mode 100644 index 0000000..8d42d62 --- /dev/null +++ b/csit/tests/pmmapper/assets/new_radio/A20181004.0000-1000-0015-1000_5G.xml @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + attTCHSeizures + succTCHSeizures + attImmediateAssignProcs + succImmediateAssignProcs + + 234 + 345 + 567 + 789 + + + 890 + 901 + 123 + 234 + + + 456 + 567 + 678 + 789 + true + + + + + + + attTCHSeizures1 + succTCHSeizures2 + attImmediateAssignProcs3 + succImmediateAssignProcs4 + + 4 + 86,87,2,6,77,96,75,33,24 + 40 + 90 + false + + + + + + + attTCHSeizures5 + succTCHSeizures6 + attImmediateAssignProcs7 + succImmediateAssignProcs8 + + 238 + 344 + 563 + 787 + + + 898 + 905 + 127 + 238 + + + 454 + 569 + 672 + 785 + true + + + + + + + diff --git a/csit/tests/pmmapper/assets/new_radio/C20190329.0000-0015.xml b/csit/tests/pmmapper/assets/new_radio/C20190329.0000-0015.xml new file mode 100644 index 0000000..9c1b985 --- /dev/null +++ b/csit/tests/pmmapper/assets/new_radio/C20190329.0000-0015.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + z1 a1 zz1 b1 + + 1 11 111 1111 + false + + + + + + + + + + attTCHSeizures succTCHSeizures2 zz2 b2 + + 2 22 222 2222 + false + + + + + + + + + + z3 a3 zz3 succImmediateAssignProcs8 + + 3 33 333 3333 + false + + + + + + + diff --git a/csit/tests/pmmapper/assets/new_radio/PM202007171301+020024C202007171207+0200-1215+0200_45678.xml b/csit/tests/pmmapper/assets/new_radio/PM202007171301+020024C202007171207+0200-1215+0200_45678.xml new file mode 100644 index 0000000..8d42d62 --- /dev/null +++ b/csit/tests/pmmapper/assets/new_radio/PM202007171301+020024C202007171207+0200-1215+0200_45678.xml @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + attTCHSeizures + succTCHSeizures + attImmediateAssignProcs + succImmediateAssignProcs + + 234 + 345 + 567 + 789 + + + 890 + 901 + 123 + 234 + + + 456 + 567 + 678 + 789 + true + + + + + + + attTCHSeizures1 + succTCHSeizures2 + attImmediateAssignProcs3 + succImmediateAssignProcs4 + + 4 + 86,87,2,6,77,96,75,33,24 + 40 + 90 + false + + + + + + + attTCHSeizures5 + succTCHSeizures6 + attImmediateAssignProcs7 + succImmediateAssignProcs8 + + 238 + 344 + 563 + 787 + + + 898 + 905 + 127 + 238 + + + 454 + 569 + 672 + 785 + true + + + + + + + diff --git a/csit/tests/pmmapper/assets/new_radio/valid_metadata.json b/csit/tests/pmmapper/assets/new_radio/valid_metadata.json new file mode 100644 index 0000000..f75adb8 --- /dev/null +++ b/csit/tests/pmmapper/assets/new_radio/valid_metadata.json @@ -0,0 +1,12 @@ +{ + "productName": "gnb", + "vendorName": "Ericsson", + "lastEpochMicrosec": "1538478000000", + "sourceName": "oteNB5309", + "startEpochMicrosec": "1538478900000", + "timeZoneOffset": "UTC+05.00", + "location": "ftpes://192.168.0.101:22/ftp/rop/A20161224.1045-1100.bin.gz", + "compression": "gzip", + "fileFormatType": "org.3GPP.28.532#measData", + "fileFormatVersion": "V9" +} diff --git a/csit/tests/pmmapper/assets/pm_filter_config.json b/csit/tests/pmmapper/assets/pm_filter_config.json new file mode 100644 index 0000000..79e3f98 --- /dev/null +++ b/csit/tests/pmmapper/assets/pm_filter_config.json @@ -0,0 +1,42 @@ +{ + "pm-mapper-filter": { + "filters":[{ + "pmDefVsn": "1.0", + "nfType": "gnb", + "vendor": "Ericsson", + "measTypes": ["attTCHSeizures","succTCHSeizures2","succImmediateAssignProcs8"] + }] + }, + "key_store_path": "/opt/app/pm-mapper/etc/cert.jks", + "key_store_pass_path": "/opt/app/pm-mapper/etc/jks.pass", + "trust_store_path": "/opt/app/pm-mapper/etc/trust.jks", + "trust_store_pass_path": "/opt/app/pm-mapper/etc/trust.pass", + "dmaap_dr_delete_endpoint": "https://dmaap-dr-node:8443/delete", + "dmaap_dr_feed_name": "1", + "aaf_identity": "aaf_admin@people.osaaf.org", + "aaf_password": "demo123456!", + "enable_http": true, + "streams_publishes": { + "dmaap_publisher": { + "type": "message_router", + "dmaap_info": { + "topic_url": "http://message-router:3904/events/org.onap.dmaap.mr.VES_PM", + "client_role": "org.onap.dcae.pmPublisher", + "location": "csit-pmmapper", + "client_id": "1562763644939" + } + } + }, + "streams_subscribes": { + "dmaap_subscriber": { + "type": "data_router", + "dmaap_info": { + "username": "username", + "password": "password", + "location": "csit-pmmapper", + "delivery_url": "http://dcae-pm-mapper:8081/delivery", + "subscriber_id": 1 + } + } + } +} \ No newline at end of file diff --git a/csit/tests/pmmapper/assets/pm_filter_regex_config.json b/csit/tests/pmmapper/assets/pm_filter_regex_config.json new file mode 100644 index 0000000..5cd7146 --- /dev/null +++ b/csit/tests/pmmapper/assets/pm_filter_regex_config.json @@ -0,0 +1,42 @@ +{ + "pm-mapper-filter": { + "filters":[{ + "pmDefVsn": "1.0", + "nfType": "gnb", + "vendor": "Ericsson", + "measTypes": ["att.*"] + }] + }, + "key_store_path": "/opt/app/pm-mapper/etc/cert.jks.b64", + "key_store_pass_path": "/opt/app/pm-mapper/etc/jks.pass", + "trust_store_path": "/opt/app/pm-mapper/etc/trust.jks.b64", + "trust_store_pass_path": "/opt/app/pm-mapper/etc/trust.pass", + "dmaap_dr_delete_endpoint": "https://dmaap-dr-node:8443/delete", + "dmaap_dr_feed_name": "1", + "aaf_identity": "aaf_admin@people.osaaf.org", + "aaf_password": "demo123456!", + "enable_http": true, + "streams_publishes": { + "dmaap_publisher": { + "type": "message_router", + "dmaap_info": { + "topic_url": "http://message-router:3904/events/org.onap.dmaap.mr.VES_PM", + "client_role": "org.onap.dcae.pmPublisher", + "location": "csit-pmmapper", + "client_id": "1562763644939" + } + } + }, + "streams_subscribes": { + "dmaap_subscriber": { + "type": "data_router", + "dmaap_info": { + "username": "username", + "password": "password", + "location": "csit-pmmapper", + "delivery_url": "http://dcae-pm-mapper:8081/delivery", + "subscriber_id": 1 + } + } + } +} \ No newline at end of file diff --git a/csit/tests/pmmapper/assets/valid_metadata.json b/csit/tests/pmmapper/assets/valid_metadata.json new file mode 100644 index 0000000..da809d7 --- /dev/null +++ b/csit/tests/pmmapper/assets/valid_metadata.json @@ -0,0 +1,12 @@ +{ + "productName": "gnb", + "vendorName": "Ericsson", + "lastEpochMicrosec": "1538478000000", + "sourceName": "oteNB5309", + "startEpochMicrosec": "1538478900000", + "timeZoneOffset": "UTC+05.00", + "location": "ftpes://192.168.0.101:22/ftp/rop/A20161224.1045-1100.bin.gz", + "compression": "gzip", + "fileFormatType": "org.3GPP.32.435#measCollec", + "fileFormatVersion": "V9" + } \ No newline at end of file diff --git a/csit/tests/pmmapper/assets/vendor_filter_config.json b/csit/tests/pmmapper/assets/vendor_filter_config.json new file mode 100644 index 0000000..94d0911 --- /dev/null +++ b/csit/tests/pmmapper/assets/vendor_filter_config.json @@ -0,0 +1,42 @@ +{ + "pm-mapper-filter": { + "filters":[{ + "pmDefVsn": "1.0", + "nfType": "gnb", + "vendor": "Ericsson", + "measTypes": [] + }] + }, + "key_store_path": "/opt/app/pm-mapper/etc/cert.jks", + "key_store_pass_path": "/opt/app/pm-mapper/etc/jks.pass", + "trust_store_path": "/opt/app/pm-mapper/etc/trust.jks", + "trust_store_pass_path": "/opt/app/pm-mapper/etc/trust.pass", + "dmaap_dr_delete_endpoint": "https://dmaap-dr-node:8443/delete", + "dmaap_dr_feed_name": "1", + "aaf_identity": "aaf_admin@people.osaaf.org", + "aaf_password": "demo123456!", + "enable_http": true, + "streams_publishes": { + "dmaap_publisher": { + "type": "message_router", + "dmaap_info": { + "topic_url": "http://message-router:3904/events/org.onap.dmaap.mr.VES_PM", + "client_role": "org.onap.dcae.pmPublisher", + "location": "csit-pmmapper", + "client_id": "1562763644939" + } + } + }, + "streams_subscribes": { + "dmaap_subscriber": { + "type": "data_router", + "dmaap_info": { + "username": "username", + "password": "password", + "location": "csit-pmmapper", + "delivery_url": "http://dcae-pm-mapper:8081/delivery", + "subscriber_id": 1 + } + } + } +} \ No newline at end of file diff --git a/csit/tests/pmmapper/pmmapper.robot b/csit/tests/pmmapper/pmmapper.robot new file mode 100644 index 0000000..f23d33c --- /dev/null +++ b/csit/tests/pmmapper/pmmapper.robot @@ -0,0 +1,201 @@ +*** Settings *** +Documentation Testing PM Mapper functionality +Library Collections +Library OperatingSystem +Library RequestsLibrary +Library Process +Library String + +Test Setup Create Session mapper_session ${PMMAPPER_BASE_URL} +Test Teardown CleanSessionsAndLogs + +*** Variables *** +${CLI_EXEC_CLI_CONFIG} { head -n 100 | tail -50;} < /tmp/pmmapper.log +${CLI_EXEC_CLI_SUBS} curl -k https://${DR_PROV_IP}:8443/internal/prov +${PMMAPPER_BASE_URL} http://${PMMAPPER_IP}:8081 +${DELIVERY_ENDPOINT} /delivery +${HEALTHCHECK_ENDPOINT} /healthcheck +${RECONFIGURE_ENDPOINT} /reconfigure +${ASSETS_PATH} %{WORKSPACE}/tests/pmmapper/assets +${NO_MANAGED_ELEMENT_PATH} ${ASSETS_PATH}/A_no_managed_element.xml +${NO_MEASDATA_PATH} ${ASSETS_PATH}/A_no_measdata.xml +${VALID_METADATA_PATH} ${ASSETS_PATH}/valid_metadata.json +${NR_VALID_METADATA_PATH} ${ASSETS_PATH}/new_radio/valid_metadata.json +${DIFF_VENDOR_METADATA} ${ASSETS_PATH}/diff_vendor_metadata.json +${NON_XML_FILE} ${ASSETS_PATH}/diff_vendor_metadata.json +${CLI_EXEC_CLI_PM_LOG} docker exec pmmapper /bin/sh -c "cat /var/log/ONAP/dcaegen2/services/pm-mapper/pm-mapper_output.log" +${CLI_EXEC_CLI_PM_LOG_CLEAR} docker exec pmmapper /bin/sh -c "echo -n "" > /var/log/ONAP/dcaegen2/services/pm-mapper/pm-mapper_output.log" +${PUBLISH_NODE_URL} https://${DR_NODE_IP}:8443/publish/1 +${TYPE-A_PM_DATA_FILE_PATH} ${ASSETS_PATH}/A20181002.0000-1000-0015-1000_5G.xml +${TYPE-C_PM_DATA_FILE_PATH} ${ASSETS_PATH}/C20190328.0000-0015.xml +${NR-TYPE-A_PM_DATA_FILE_PATH} ${ASSETS_PATH}/new_radio/A20181004.0000-1000-0015-1000_5G.xml +${NR-TYPE-C_PM_DATA_FILE_PATH} ${ASSETS_PATH}/new_radio/C20190329.0000-0015.xml +${NR-TYPE-PM_DATA_FILE_PATH} ${ASSETS_PATH}/new_radio/PM202007171301+020024C202007171207+0200-1215+0200_45678.xml +${CLI_EXEC_VENDOR_FILTER} curl 'http://${CONSUL_IP}:8500/v1/kv/pmmapper?dc=dc1' -X PUT -H 'Accept: application/^Con' -H 'Content-Type: application/json' -H 'X-Requested-With: XMLHttpRequest' --data @${ASSETS_PATH}/vendor_filter_config.json +${CLI_EXEC_PM_FILTER} curl 'http://${CONSUL_IP}:8500/v1/kv/pmmapper?dc=dc1' -X PUT -H 'Accept: application/^Con' -H 'Content-Type: application/json' -H 'X-Requested-With: XMLHttpRequest' --data @${ASSETS_PATH}/pm_filter_config.json +${CLI_EXEC_PM_FILTER_regex} curl 'http://${CONSUL_IP}:8500/v1/kv/pmmapper?dc=dc1' -X PUT -H 'Accept: application/^Con' -H 'Content-Type: application/json' -H 'X-Requested-With: XMLHttpRequest' --data @${ASSETS_PATH}/pm_filter_regex_config.json +${CLI_MESSAGE_ROUTER_TOPIC} curl http://${DMAAP_MR_IP}:3904/events/PM_MAPPER/CG1/C1?timeout=1000 > /tmp/mr.log +${CLI_MR_LOG} cat /tmp/mr.log + + +*** Test Cases *** +Verify PM Mapper Receive Configuraton From Config Binding Service + [Tags] PM_MAPPER_01 + [Documentation] Verify 3gpp pm mapper successfully receive config data from CBS + CheckLog ${CLI_EXEC_CLI_CONFIG} Received pm-mapper configuration from ConfigBinding Service + +Verify Health Check returns 200 when a REST GET request to healthcheck url + [Tags] PM_MAPPER_02 + [Documentation] Verify Health Check returns 200 when a REST GET request to healthcheck url + [Timeout] 1 minute + ${resp}= Get Request mapper_session ${HEALTHCHECK_ENDPOINT} + VerifyResponse ${resp.status_code} 200 + +Verify 3GPP PM Mapper responds appropriately when no metadata is provided + [Tags] PM_MAPPER_03 + [Documentation] Verify 3GPP PM Mapper responds 400 with the message "Missing Metadata." when no metadata is provided + [Timeout] 1 minute + ${headers}= Create Dictionary X-ONAP-RequestID=3 Content-Type=application/xml + ${resp}= Put Request mapper_session ${DELIVERY_ENDPOINT}/filename data='${EMPTY}' headers=${headers} + VerifyResponse ${resp.status_code} 400 + VerifyResponse ${resp.content} Missing Metadata. + CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=3 + +Verify 3GPP PM Mapper responds appropriately when invalid metadata is provided + [Tags] PM_MAPPER_04 + [Documentation] Verify 3GPP PM Mapper responds 400 with the message "Malformed Metadata." when invalid metadata is provided + [Timeout] 1 minute + ${headers}= Create Dictionary X-ONAP-RequestID=4 X-DMAAP-DR-META='not metadata' Content-Type=application/xml + ${resp}= Put Request mapper_session ${DELIVERY_ENDPOINT}/filename data='${EMPTY}' headers=${headers} + VerifyResponse ${resp.status_code} 400 + VerifyResponse ${resp.content} Malformed Metadata. + CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=4 + +Verify that PM Mapper logs successful when a file that contains no measdata is provided + [Tags] PM_MAPPER_05 + [Documentation] Verify that PM Mapper logs successful when a file that contains no measdata is provided + [Timeout] 1 minute + SendToDatarouter ${NO_MEASDATA_PATH} ${VALID_METADATA_PATH} X-ONAP-RequestID=5 + CheckLog ${CLI_EXEC_CLI_PM_LOG} MeasData is empty + CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=5 + +Verify that PM Mapper throws Event failed validation against schema error when no managed element content is provided + [Tags] PM_MAPPER_06 + [Documentation] Verify 3gpp pm mapper responds with an error when no managed element content is provided + [Timeout] 1 minute + SendToDatarouter ${NO_MANAGED_ELEMENT_PATH} ${VALID_METADATA_PATH} X-ONAP-RequestID=6 + CheckLog ${CLI_EXEC_CLI_PM_LOG} XML validation failed + CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=6 + +Verify that PM Mapper maps Type-C xml file and publish 3gpp perf VES evnets to message router + [Tags] PM_MAPPER_07 + [Documentation] Verify that PM Mapper maps Type-C xml file and publish 3gpp perf VES evnets to message router. + [Timeout] 1 minute + SendToDatarouter ${TYPE-C_PM_DATA_FILE_PATH} ${VALID_METADATA_PATH} X-ONAP-RequestID=7 + CheckLog ${CLI_EXEC_CLI_PM_LOG} Successfully published VES events to messagerouter + +Verify 3GPP PM Mapper maps Type-A file based on counter filtering and publish 3gpp perf VES evnets to message router + [Tags] PM_MAPPER_08 + [Documentation] Verify 3GPP PM Mapper maps Type-A file and publish 3gpp perf VES evnets to message router. + [Timeout] 1 minute + ${cli_cmd_output}= Run Process ${CLI_EXEC_PM_FILTER} shell=yes + ${resp}= Get Request mapper_session ${RECONFIGURE_ENDPOINT} + Sleep 5s + SendToDatarouter ${TYPE-A_PM_DATA_FILE_PATH} ${VALID_METADATA_PATH} X-ONAP-RequestID=8 + CheckLog ${CLI_EXEC_CLI_PM_LOG} Successfully published VES events to messagerouter + +Verify that PM Mapper correctly identifies a file that should not be mapped based on metadata filtering. + [Tags] PM_MAPPER_09 + [Documentation] Verify that PM Mapper correctly identifies a file that should not be mapped based on metadata filtering. + [Timeout] 1 minute + ${cli_cmd_output}= Run Process ${CLI_EXEC_VENDOR_FILTER} shell=yes + Should Be Equal As Strings ${cli_cmd_output.rc} 0 + ${resp}= Get Request mapper_session ${RECONFIGURE_ENDPOINT} + Sleep 5s + SendToDatarouter ${TYPE-A_PM_DATA_FILE_PATH} ${DIFF_VENDOR_METADATA} X-ONAP-RequestID=9 + CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=9 + CheckLog ${CLI_EXEC_CLI_PM_LOG} Metadata does not match any filters + +Verify that PM Mapper correctly identifies a non-xml file. + [Tags] PM_MAPPER_10 + [Documentation] Verify that PM Mapper correctly identifies a non-xml file. + [Timeout] 1 minute + SendToDatarouter ${NON_XML_FILE} ${VALID_METADATA_PATH} X-ONAP-RequestID=10 + CheckLog ${CLI_EXEC_CLI_PM_LOG} PM measurement file must have an extension of .xml + CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=10 + +Verify that PM Mapper correctly maps an NR Type-A file based on counter filtering and publish 3gpp perf VES events to message router. + [Tags] PM_MAPPER_11 + [Documentation] Verify 3GPP PM Mapper maps an NR Type-A file and publish 3gpp perf VES evnets to message router. + [Timeout] 1 minute + ${cli_cmd_output}= Run Process ${CLI_EXEC_PM_FILTER} shell=yes + ${resp}= Get Request mapper_session ${RECONFIGURE_ENDPOINT} + Sleep 5s + SendToDatarouter ${NR-TYPE-A_PM_DATA_FILE_PATH} ${NR_VALID_METADATA_PATH} X-ONAP-RequestID=11 + CheckLog ${CLI_EXEC_CLI_PM_LOG} Successfully published VES events to messagerouter + +Verify that PM Mapper correctly maps an NR Type-C file based on counter filtering and publish 3gpp perf VES events to message router. + [Tags] PM_MAPPER_12 + [Documentation] Verify that PM Mapper maps an NR Type-C xml file and publish 3gpp perf VES evnets to message router. + [Timeout] 1 minute + SendToDatarouter ${NR-TYPE-C_PM_DATA_FILE_PATH} ${NR_VALID_METADATA_PATH} X-ONAP-RequestID=12 + CheckLog ${CLI_EXEC_CLI_PM_LOG} Successfully published VES events to messagerouter + +Verify 3GPP PM Mapper maps Type-A file based on counter filtering with regexp + [Tags] PM_MAPPER_13 + [Documentation] Verify 3GPP PM Mapper maps Type-A file based on counter filtering with wildcards/regexp and publish 3gpp perf VES evnets to message router. + [Timeout] 1 minute + ${cli_cmd_output}= Run Process ${CLI_EXEC_PM_FILTER_regex} shell=yes + ${resp}= Get Request mapper_session ${RECONFIGURE_ENDPOINT} + Sleep 5s + SendToDatarouter ${TYPE-A_PM_DATA_FILE_PATH} ${VALID_METADATA_PATH} X-ONAP-RequestID=13 + CheckLog ${CLI_EXEC_CLI_PM_LOG} Successfully published VES events to messagerouter + +Verify that password receive from CBS are successfully encrypted + [Tags] PM_MAPPER_14 + [Documentation] Verify that password receive from CBS are successfully encrypted. + CheckLog ${CLI_EXEC_CLI_CONFIG} "aaf_password": ***** + CheckLog ${CLI_EXEC_CLI_CONFIG} "password": ***** + +Verify that PM Mapper correctly maps an NR Type-PM file based on counter filtering and publish 3gpp perf VES events to message router. + [Tags] PM_MAPPER_15 + [Documentation] Verify that PM Mapper maps an NR Type-PM xml file and publish 3gpp perf VES evnets to message router. + [Timeout] 1 minute + SendToDatarouter ${NR-TYPE-PM_DATA_FILE_PATH} ${NR_VALID_METADATA_PATH} X-ONAP-RequestID=15 + CheckLog ${CLI_EXEC_CLI_PM_LOG} RequestID=15 + CheckLog ${CLI_EXEC_CLI_PM_LOG} Successfully published VES events to messagerouter + +*** Keywords *** + +SendToDatarouter + [Arguments] ${filepath} ${metadatapath} ${request_id} + ${pmdata}= Get File ${filepath} + ${metatdata} Get File ${metadatapath} + ${filename} Fetch From Right ${filepath} / + ${resp}= PutCall ${PUBLISH_NODE_URL}/${filename} ${request_id} ${pmdata} ${metatdata.replace("\n","")} pmmapper + VerifyResponse ${resp.status_code} 204 + Sleep 10s + +PutCall + [Arguments] ${url} ${request_id} ${data} ${meta} ${user} + ${headers}= Create Dictionary X-ONAP-RequestID=${request_id} X-DMAAP-DR-META=${meta} Content-Type=application/octet-stream X-DMAAP-DR-ON-BEHALF-OF=${user} Authorization=Basic cG1tYXBwZXI6cG1tYXBwZXI= + ${resp}= Evaluate requests.put('${url}', data="""${data}""", headers=${headers}, verify=False, allow_redirects=False) requests + [Return] ${resp} + +CheckLog + [Arguments] ${cli_exec_log_Path} ${string_to_check_in_log} + ${cli_cmd_output}= Run Process ${cli_exec_log_Path} shell=yes + Log ${cli_cmd_output.stdout} + Should Be Equal As Strings ${cli_cmd_output.rc} 0 + Should Contain ${cli_cmd_output.stdout} ${string_to_check_in_log} + +VerifyResponse + [Arguments] ${actual_response_value} ${expected_response_value} + Should Be Equal As Strings ${actual_response_value} ${expected_response_value} + +ClearLogs + Run Process ${CLI_EXEC_CLI_PM_LOG_CLEAR} shell=yes + +CleanSessionsAndLogs + Delete All Sessions + ClearLogs -- cgit 1.2.3-korg