From 59bad158d7dd96c157fb9387db2de8ecb9214914 Mon Sep 17 00:00:00 2001 From: Joanna Jeremicz Date: Tue, 16 Feb 2021 09:34:13 +0100 Subject: [PATCH] Add CSITs for Pm-mapper files processing performance Issue-ID: DCAEGEN2-2600 Signed-off-by: Joanna Jeremicz Signed-off-by: Tomasz Wrobel Change-Id: Id7e4d345380fd5fd08f28a3ddff04a4fde8f7730 --- .../assets/addSubscriber.json | 20 +++ .../assets/cbs.json | 7 + .../assets/cert.jks | Bin 0 -> 4654 bytes .../assets/config.json | 35 +++++ .../assets/createFeed.json | 18 +++ .../assets/jks.pass | 1 + .../assets/mrserver.js | 28 ++++ .../assets/node.properties | 89 +++++++++++ .../assets/provserver.properties | 62 ++++++++ .../assets/trust.jks | Bin 0 -> 1413 bytes .../assets/trust.pass | 1 + .../docker-compose.yml | 119 +++++++++++++++ .../files-processing-config-pmmapper/setup.sh | 101 +++++++++++++ .../files-processing-config-pmmapper/teardown.sh | 8 + .../files-processing-config-pmmapper/testplan.txt | 3 + .../__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 ++ .../files-processing-config-pmmapper.robot | 148 +++++++++++++++++++ .../libraries/DockerContainerManager.py | 29 ++++ .../libraries/EnvsReader.py | 11 ++ .../libraries/LogReader.py | 22 +++ 26 files changed, 889 insertions(+) create mode 100644 plans/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/addSubscriber.json create mode 100644 plans/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/cbs.json create mode 100644 plans/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/cert.jks create mode 100644 plans/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/config.json create mode 100644 plans/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/createFeed.json create mode 100644 plans/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/jks.pass create mode 100644 plans/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/mrserver.js create mode 100644 plans/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/node.properties create mode 100644 plans/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/provserver.properties create mode 100644 plans/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/trust.jks create mode 100644 plans/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/trust.pass create mode 100644 plans/dcaegen2-pmmapper/files-processing-config-pmmapper/docker-compose.yml create mode 100644 plans/dcaegen2-pmmapper/files-processing-config-pmmapper/setup.sh create mode 100644 plans/dcaegen2-pmmapper/files-processing-config-pmmapper/teardown.sh create mode 100644 plans/dcaegen2-pmmapper/files-processing-config-pmmapper/testplan.txt create mode 100644 tests/dcaegen2-pmmapper/files-processing-config-pmmapper/__init__.robot create mode 100644 tests/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/.gitattributes create mode 100644 tests/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/ABigFile.xml create mode 100644 tests/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/config_10_1.env create mode 100644 tests/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/config_1_1.env create mode 100644 tests/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/config_1_10.env create mode 100644 tests/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/valid_metadata.json create mode 100644 tests/dcaegen2-pmmapper/files-processing-config-pmmapper/files-processing-config-pmmapper.robot create mode 100644 tests/dcaegen2-pmmapper/files-processing-config-pmmapper/libraries/DockerContainerManager.py create mode 100644 tests/dcaegen2-pmmapper/files-processing-config-pmmapper/libraries/EnvsReader.py create mode 100644 tests/dcaegen2-pmmapper/files-processing-config-pmmapper/libraries/LogReader.py diff --git a/plans/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/addSubscriber.json b/plans/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/addSubscriber.json new file mode 100644 index 00000000..0666a7d5 --- /dev/null +++ b/plans/dcaegen2-pmmapper/files-processing-config-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/plans/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/cbs.json b/plans/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/cbs.json new file mode 100644 index 00000000..a29956fb --- /dev/null +++ b/plans/dcaegen2-pmmapper/files-processing-config-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/plans/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/cert.jks b/plans/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/cert.jks new file mode 100644 index 0000000000000000000000000000000000000000..33dc9a31aa5574aa13620ca9b45b2fd583fef227 GIT binary patch literal 4654 zcmb_ec{tQ-8=lp^WE)FF%5L;SvKEp(vZO>g#u(EujAgPbro}F_h@!}nvgQztLW?!a z#Ia|~lD&}i#5efPxj0SVcYW9O{qdW5@B4Y)`+2wPd7ky@^=S|Y1fhQ5t&h_YjlyVc z{>TyBQ0{UBPb}4h3yvF)27%xZfCO6y*yxyK=)f?rG=u{ThJ#=v*aYwfgze}Qb|PGV z!MB*3@M<61v1T)^u}>7L1Av2HyYND{*<*N0>Uz@-vWN*c@*%ENk~DzDQEOM z;KRW<(5hwS#)@9$81wJsw^kYZ_!sRxEq?4J#t>Q_#xIlv_P)^<5-UFNhLazj(#8~< zGQi=E*S?r4Vfh~3bx=lk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p->aMPLq~|Q-}_Q)lc2eLMZ&7tR6Q-@I{7Z)1i4ySLJL6G4)Hph7p&?Jkd?0_JtuS pF6Fqkbw6K)&dE`v-#*ma@hbRionC>UZXc%`c1A})f(@9v_b=4(eop`Z literal 0 HcmV?d00001 diff --git a/plans/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/config.json b/plans/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/config.json new file mode 100644 index 00000000..3f1009d4 --- /dev/null +++ b/plans/dcaegen2-pmmapper/files-processing-config-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/plans/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/createFeed.json b/plans/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/createFeed.json new file mode 100644 index 00000000..f93633dc --- /dev/null +++ b/plans/dcaegen2-pmmapper/files-processing-config-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/plans/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/jks.pass b/plans/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/jks.pass new file mode 100644 index 00000000..ae8f7e72 --- /dev/null +++ b/plans/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/jks.pass @@ -0,0 +1 @@ +Er1tmip;T4w[%1}YE?x{fN9v \ No newline at end of file diff --git a/plans/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/mrserver.js b/plans/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/mrserver.js new file mode 100644 index 00000000..cc845712 --- /dev/null +++ b/plans/dcaegen2-pmmapper/files-processing-config-pmmapper/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/plans/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/node.properties b/plans/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/node.properties new file mode 100644 index 00000000..7abaf60a --- /dev/null +++ b/plans/dcaegen2-pmmapper/files-processing-config-pmmapper/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/plans/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/provserver.properties b/plans/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/provserver.properties new file mode 100644 index 00000000..cd333efb --- /dev/null +++ b/plans/dcaegen2-pmmapper/files-processing-config-pmmapper/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/plans/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/trust.jks b/plans/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/trust.jks new file mode 100644 index 0000000000000000000000000000000000000000..679c95a5c2c82666c1b78ff3786b5b12fe809d7e GIT binary patch literal 1413 zcmb7DYdF&j9NtyOZA)s_5Tc#skpHaJ6m3@IxP&wlidC2rsU!CXJGKzHNp-a=}&;N(<@> zIg83Y2{`{XBkqF8o-1r>Vg{>?x!MoJ8Msfz5P#NrPJOPxDh=tH{PuRgR=qJyaeF#M z>^10niFzK_-;mRKt8>ODRc1)d_sKGHlP3RhXzXfUU*~E?0NKbXF=HccJ@r0Z) zMdVRtLP&}Cdgg2@ti?|^d9*YuKazOdYpJVGMXM5bUMNC!wK*rxr@7OVpetRu2yc)Q*-9)89BkeeH*cq#5DLo24>V z-WQCMI6y%<4$0Y>H1=t*XRs%S$d8^>r+-1@O9@rc%J&g;1BPlxm0@K~&`6!_0Lc^9 zit0@!hoBfLm8!q-vnXi)7>m(GEZr@*V7w@$wcgrY1CV5vtRChY_So5PTR-O~35{UV zWCD}tQ&~2&!oFyW3$^i&O7({?83AHX!HeF+zqXXk$fbhg&|Ff@RQ{ci(u%b*ShZ@}OHbQ1u?mVn$6V4DTu{20T{ zR&2%)3?l1vGpoZ29csuJKZd!`_;h#Iw##zs8sbDkpgzGwvYI;t%?(w!x~`@~Mr3Ff z#l_fld5JSH^rS1f{7g3WfJb)Q!nz!**Q^`JY+WGdJ6(G*WV&+wV|7RId>_|N?3?rH zF_4xQ-oJ}<)Ixye&&LV83xnQ6q;H6_%|?UWG-@T}5-SyT(IS5&3;%DMh46M%nLE){-aKos`qXVW2wbt&J3UISZ{Pn_VplZcmVLUIJ9lavr2VLP>85wX44TQ(8XP`CU*uAP z^FE)6mQG!NQtsesAWhucd~XeTzl%3Du9ZD!`crxxHQ $WORKSPACE/archives/files-processing-config-pmmapper-docker-compose.log +docker-compose -f $TEST_PLANS_DIR/docker-compose.yml down -v diff --git a/plans/dcaegen2-pmmapper/files-processing-config-pmmapper/testplan.txt b/plans/dcaegen2-pmmapper/files-processing-config-pmmapper/testplan.txt new file mode 100644 index 00000000..543973d0 --- /dev/null +++ b/plans/dcaegen2-pmmapper/files-processing-config-pmmapper/testplan.txt @@ -0,0 +1,3 @@ +# Test suites are relative paths under [integration/csit.git]/tests/. +# Place the suites in run order. +dcaegen2-pmmapper/files-processing-config-pmmapper diff --git a/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/__init__.robot b/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/__init__.robot new file mode 100644 index 00000000..9eda6de0 --- /dev/null +++ b/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/__init__.robot @@ -0,0 +1,2 @@ +*** Settings *** +Documentation Files Processing Config PM Mapper Testcases diff --git a/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/.gitattributes b/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/.gitattributes new file mode 100644 index 00000000..57cdc503 --- /dev/null +++ b/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/.gitattributes @@ -0,0 +1 @@ +*.gz binary diff --git a/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/ABigFile.xml b/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/ABigFile.xml new file mode 100644 index 00000000..8a3bcf4d --- /dev/null +++ b/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/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/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/config_10_1.env b/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/config_10_1.env new file mode 100644 index 00000000..050d2f2a --- /dev/null +++ b/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/config_10_1.env @@ -0,0 +1,3 @@ +PROCESSING_LIMIT_RATE=10 +THREADS_MULTIPLIER=1 +PROCESSING_THREADS_COUNT=1 diff --git a/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/config_1_1.env b/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/config_1_1.env new file mode 100644 index 00000000..c138912b --- /dev/null +++ b/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/config_1_1.env @@ -0,0 +1,3 @@ +PROCESSING_LIMIT_RATE=1 +THREADS_MULTIPLIER=1 +PROCESSING_THREADS_COUNT=1 diff --git a/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/config_1_10.env b/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/config_1_10.env new file mode 100644 index 00000000..b4c290e8 --- /dev/null +++ b/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/config_1_10.env @@ -0,0 +1,3 @@ +PROCESSING_LIMIT_RATE=1 +THREADS_MULTIPLIER=1 +PROCESSING_THREADS_COUNT=10 diff --git a/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/valid_metadata.json b/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/valid_metadata.json new file mode 100644 index 00000000..da809d7b --- /dev/null +++ b/tests/dcaegen2-pmmapper/files-processing-config-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/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/files-processing-config-pmmapper.robot b/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/files-processing-config-pmmapper.robot new file mode 100644 index 00000000..09a7de4f --- /dev/null +++ b/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/files-processing-config-pmmapper.robot @@ -0,0 +1,148 @@ +*** 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 *** + +${NR_VALID_METADATA_PATH} %{WORKSPACE}/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/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} %{WORKSPACE}/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/ABigFile.xml +${CONFIG_ENVS_1_1} %{WORKSPACE}/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/config_1_1.env +${CONFIG_ENVS_4_1} %{WORKSPACE}/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/config_4_1.env +${CONFIG_ENVS_10_1} %{WORKSPACE}/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/config_10_1.env +${CONFIG_ENVS_1_10} %{WORKSPACE}/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/assets/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/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/libraries/DockerContainerManager.py b/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/libraries/DockerContainerManager.py new file mode 100644 index 00000000..3e3ae58e --- /dev/null +++ b/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/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/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/libraries/EnvsReader.py b/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/libraries/EnvsReader.py new file mode 100644 index 00000000..cc60eed6 --- /dev/null +++ b/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/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/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/libraries/LogReader.py b/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/libraries/LogReader.py new file mode 100644 index 00000000..01718e35 --- /dev/null +++ b/tests/dcaegen2-pmmapper/files-processing-config-pmmapper/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 -- 2.16.6