From a800ace09fe6ebe64cc455e4ba5ccb3abcfd79fc Mon Sep 17 00:00:00 2001 From: Tomasz Wrobel Date: Wed, 4 Aug 2021 12:29:37 +0200 Subject: Add pm-mapper local development tools Issue-ID: DCAEGEN2-2879 Signed-off-by: Tomasz Wrobel Change-Id: I1fc872230d1c15c1b70439b8cb69d9053f716dfb --- tools/development/Makefile | 38 +++++++ tools/development/README.md | 80 ++++++++++++++ tools/development/certs/cert.jks | Bin 0 -> 4654 bytes tools/development/certs/jks.pass | 1 + tools/development/certs/trust.jks | Bin 0 -> 1413 bytes tools/development/certs/trust.pass | 1 + tools/development/clean-environment.sh | 21 ++++ tools/development/config-dmaap.sh | 36 +++++++ tools/development/docker-compose.yml | 116 +++++++++++++++++++++ tools/development/dr-mount/node.properties | 87 ++++++++++++++++ tools/development/dr-mount/provserver.properties | 60 +++++++++++ tools/development/env/containers_ip | 26 +++++ tools/development/files-publisher/Dockerfile | 9 ++ .../files/A20181002.0000-1000-0015-1000_5G.xml | 88 ++++++++++++++++ .../files/A20181002.0000-1000-0015-1000_5G.xml.gz | Bin 0 -> 959 bytes .../files-publisher/files/C20190329.0000-0015.xml | 49 +++++++++ .../files/C20190329.0000-0015.xml.gz | Bin 0 -> 584 bytes ...01+020024C202007171207+0200-1215+0200_45678.xml | 88 ++++++++++++++++ ...020024C202007171207+0200-1215+0200_45678.xml.gz | Bin 0 -> 969 bytes tools/development/message-router/mrserver.js | 49 +++++++++ tools/development/resources/addSubscriber.json | 20 ++++ tools/development/resources/cbs.json | 7 ++ tools/development/resources/config.json | 35 +++++++ tools/development/resources/createFeed.json | 18 ++++ tools/development/restart-pm-mapper.sh | 21 ++++ tools/development/run-pm-mapper.sh | 31 ++++++ tools/development/send-meas-collec.sh | 22 ++++ tools/development/send-meas-data.sh | 22 ++++ tools/development/setup-local.sh | 46 ++++++++ tools/development/subscribe-pm-mapper.sh | 21 ++++ 30 files changed, 992 insertions(+) create mode 100644 tools/development/Makefile create mode 100644 tools/development/README.md create mode 100644 tools/development/certs/cert.jks create mode 100644 tools/development/certs/jks.pass create mode 100644 tools/development/certs/trust.jks create mode 100644 tools/development/certs/trust.pass create mode 100755 tools/development/clean-environment.sh create mode 100755 tools/development/config-dmaap.sh create mode 100644 tools/development/docker-compose.yml create mode 100644 tools/development/dr-mount/node.properties create mode 100644 tools/development/dr-mount/provserver.properties create mode 100755 tools/development/env/containers_ip create mode 100644 tools/development/files-publisher/Dockerfile create mode 100644 tools/development/files-publisher/files/A20181002.0000-1000-0015-1000_5G.xml create mode 100644 tools/development/files-publisher/files/A20181002.0000-1000-0015-1000_5G.xml.gz create mode 100644 tools/development/files-publisher/files/C20190329.0000-0015.xml create mode 100644 tools/development/files-publisher/files/C20190329.0000-0015.xml.gz create mode 100644 tools/development/files-publisher/files/PM202007171301+020024C202007171207+0200-1215+0200_45678.xml create mode 100644 tools/development/files-publisher/files/PM202007171301+020024C202007171207+0200-1215+0200_45678.xml.gz create mode 100644 tools/development/message-router/mrserver.js create mode 100644 tools/development/resources/addSubscriber.json create mode 100644 tools/development/resources/cbs.json create mode 100644 tools/development/resources/config.json create mode 100644 tools/development/resources/createFeed.json create mode 100755 tools/development/restart-pm-mapper.sh create mode 100755 tools/development/run-pm-mapper.sh create mode 100755 tools/development/send-meas-collec.sh create mode 100755 tools/development/send-meas-data.sh create mode 100755 tools/development/setup-local.sh create mode 100755 tools/development/subscribe-pm-mapper.sh (limited to 'tools/development') diff --git a/tools/development/Makefile b/tools/development/Makefile new file mode 100644 index 0000000..fc5cf39 --- /dev/null +++ b/tools/development/Makefile @@ -0,0 +1,38 @@ +# ============LICENSE_START======================================================= +# Copyright (C) 2021 NOKIA +# ================================================================================ +# 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========================================================= + +setup-all: setup-local run-pm-mapper config-dmaap subscribe-pm-mapper + +test: + @echo test + +setup-local: + @./setup-local.sh + +run-pm-mapper: + @./run-pm-mapper.sh + +config-dmaap: + @./config-dmaap.sh + +subscribe-pm-mapper: + @./subscribe-pm-mapper.sh + +clean-env: + @./clean-environment.sh + +list-files: + @ls files-publisher/files diff --git a/tools/development/README.md b/tools/development/README.md new file mode 100644 index 0000000..8c3dad8 --- /dev/null +++ b/tools/development/README.md @@ -0,0 +1,80 @@ +#PM-Mapper local development +This projects is based on pm-mapper CSIT aligned for local development + +##Run pm-mapper locally +To run pm-mapper execute following scripts +``` +make setup-all +``` +To change pm-mapper image go to script 'run-pm-mapper.sh' and edit': +``` +IMAGE=onap/org.onap.dcaegen2.services.pm-mapper:latest +``` + +To clean environment (remove all containers): +``` +make clean-env +``` + +##Send sample file + +1. To list avaiable files use: +``` +make list-files +``` + +2 a. To send MeasDataFile Enter to files publisher containers and go to files directory: +``` +./send-meas-data.sh +``` +E.g: +``` +./send-meas-data.sh C20190329.0000-0015.xml.gz +``` +MeasDataFile Examples: + +- C20190329.0000-0015.xml.gz +- PM202007171301+020024C202007171207+0200-1215+0200_45678.xml.gz + +2 b. To send MeasCollec file use: +``` +./send-meas-collec.sh A20181002.0000-1000-0015-1000_5G.xml +``` + +MeasCollec Examples: + +- A20181002.0000-1000-0015-1000_5G.xml.gz + +## HINTS: +File names must start with 'A', 'C' or 'PM' + +Files xml should be zipped by gzip. To send raw xml a small alignment is necessary: +Go to './send-meas-data.sh' or './send-meas-collec.sh' and change endpoint: +``` +https://dmaap-dr-node:8443/publish/1/Apm_TEST_REQUEST.xml.gz +``` +to: +``` +https://dmaap-dr-node:8443/publish/1/Apm_TEST_REQUEST.xml +``` + +To gzip file use: +``` +gzip -k +``` + +##Container logs: + +### PM-Mapper logs: +``` +docker logs -f pmmapper +``` + +### Message-Router simulator logs (output of processed messages by PM-Mapper): +``` +docker logs -f mr-simulator +``` + + +#####Info: +Certificate validity - 2023 August diff --git a/tools/development/certs/cert.jks b/tools/development/certs/cert.jks new file mode 100644 index 0000000..33dc9a3 Binary files /dev/null and b/tools/development/certs/cert.jks differ diff --git a/tools/development/certs/jks.pass b/tools/development/certs/jks.pass new file mode 100644 index 0000000..ae8f7e7 --- /dev/null +++ b/tools/development/certs/jks.pass @@ -0,0 +1 @@ +Er1tmip;T4w[%1}YE?x{fN9v \ No newline at end of file diff --git a/tools/development/certs/trust.jks b/tools/development/certs/trust.jks new file mode 100644 index 0000000..679c95a Binary files /dev/null and b/tools/development/certs/trust.jks differ diff --git a/tools/development/certs/trust.pass b/tools/development/certs/trust.pass new file mode 100644 index 0000000..d3d01b0 --- /dev/null +++ b/tools/development/certs/trust.pass @@ -0,0 +1 @@ +583Ls;XF(qDQu3p!L22gyh1t \ No newline at end of file diff --git a/tools/development/clean-environment.sh b/tools/development/clean-environment.sh new file mode 100755 index 0000000..22fe370 --- /dev/null +++ b/tools/development/clean-environment.sh @@ -0,0 +1,21 @@ +#!/bin/bash +# ============LICENSE_START======================================================= +# Copyright (C) 2021 NOKIA +# ================================================================================ +# 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========================================================= +source ./env/containers_ip + +docker stop pmmapper +docker rm pmmapper +docker-compose down diff --git a/tools/development/config-dmaap.sh b/tools/development/config-dmaap.sh new file mode 100755 index 0000000..a06d883 --- /dev/null +++ b/tools/development/config-dmaap.sh @@ -0,0 +1,36 @@ +#!/bin/bash +# ============LICENSE_START======================================================= +# Copyright (C) 2021 NOKIA +# ================================================================================ +# 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========================================================= +source ./env/containers_ip + +#Data Router healthcheck +echo "Waiting for DataRouter ready" +for i in $(seq 10); do + curl -sf 'http://localhost:8080/internal/prov' -o /dev/null + curl_status=$? + if [ curl_status -eq 0 ]; then + break + else + sleep 2 + fi +done + +# 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 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 @./resources/createFeed.json --post301 --location-trusted -k https://localhost:8443 diff --git a/tools/development/docker-compose.yml b/tools/development/docker-compose.yml new file mode 100644 index 0000000..ac30ec4 --- /dev/null +++ b/tools/development/docker-compose.yml @@ -0,0 +1,116 @@ +version: '3.3' + +services: + datarouter-prov: + image: nexus3.onap.org:10001/onap/dmaap/datarouter-prov + container_name: datarouter-prov + hostname: dmaap-dr-prov + ports: + - "443:8443" + - "8443:8443" + - "8080:8080" + volumes: + - ./dr-mount/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 + container_name: datarouter-node + hostname: dmaap-dr-node + ports: + - "9443:8443" + - "9090:8080" + volumes: + - ./dr-mount/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: + - ./message-router/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 + ports: + - "8500:8500" + 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 + + + files-publisher: + container_name: files-publisher + build: + context: . + dockerfile: files-publisher/Dockerfile + volumes: + - ./files-publisher/files/:/files/ + extra_hosts: + - "dmaap-dr-prov:$DR_PROV_IP" + - "dmaap-dr-node:$DR_NODE_IP" + networks: + pmmapper-network: + ipv4_address: $FILES_PUBLISHER_IP + + +networks: + pmmapper-network: + driver: bridge + ipam: + config: + - subnet: 172.18.0.0/16 + diff --git a/tools/development/dr-mount/node.properties b/tools/development/dr-mount/node.properties new file mode 100644 index 0000000..ddd4ebc --- /dev/null +++ b/tools/development/dr-mount/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/tools/development/dr-mount/provserver.properties b/tools/development/dr-mount/provserver.properties new file mode 100644 index 0000000..e242991 --- /dev/null +++ b/tools/development/dr-mount/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://172.18.0.6: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/tools/development/env/containers_ip b/tools/development/env/containers_ip new file mode 100755 index 0000000..b09ce01 --- /dev/null +++ b/tools/development/env/containers_ip @@ -0,0 +1,26 @@ +#!/bin/bash +# ============LICENSE_START======================================================= +# Copyright (C) 2021 NOKIA +# ================================================================================ +# 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========================================================= + +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 +export FILES_PUBLISHER_IP=172.18.0.9 diff --git a/tools/development/files-publisher/Dockerfile b/tools/development/files-publisher/Dockerfile new file mode 100644 index 0000000..23a275e --- /dev/null +++ b/tools/development/files-publisher/Dockerfile @@ -0,0 +1,9 @@ +FROM nexus3.onap.org:10001/alpine:latest + +RUN apk add --update curl +RUN rm -rf /var/cache/apk/* +ENV http_proxy="" +ENV https_proxy="" +ENV HTTP_PROXY="" +ENV HTTPS_PROXY="" +ENTRYPOINT ["/bin/sh", "-c", " while true; do sleep 30; done;"] diff --git a/tools/development/files-publisher/files/A20181002.0000-1000-0015-1000_5G.xml b/tools/development/files-publisher/files/A20181002.0000-1000-0015-1000_5G.xml new file mode 100644 index 0000000..fadc8a6 --- /dev/null +++ b/tools/development/files-publisher/files/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/tools/development/files-publisher/files/A20181002.0000-1000-0015-1000_5G.xml.gz b/tools/development/files-publisher/files/A20181002.0000-1000-0015-1000_5G.xml.gz new file mode 100644 index 0000000..32865fc Binary files /dev/null and b/tools/development/files-publisher/files/A20181002.0000-1000-0015-1000_5G.xml.gz differ diff --git a/tools/development/files-publisher/files/C20190329.0000-0015.xml b/tools/development/files-publisher/files/C20190329.0000-0015.xml new file mode 100644 index 0000000..9c1b985 --- /dev/null +++ b/tools/development/files-publisher/files/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/tools/development/files-publisher/files/C20190329.0000-0015.xml.gz b/tools/development/files-publisher/files/C20190329.0000-0015.xml.gz new file mode 100644 index 0000000..bf981d5 Binary files /dev/null and b/tools/development/files-publisher/files/C20190329.0000-0015.xml.gz differ diff --git a/tools/development/files-publisher/files/PM202007171301+020024C202007171207+0200-1215+0200_45678.xml b/tools/development/files-publisher/files/PM202007171301+020024C202007171207+0200-1215+0200_45678.xml new file mode 100644 index 0000000..8d42d62 --- /dev/null +++ b/tools/development/files-publisher/files/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/tools/development/files-publisher/files/PM202007171301+020024C202007171207+0200-1215+0200_45678.xml.gz b/tools/development/files-publisher/files/PM202007171301+020024C202007171207+0200-1215+0200_45678.xml.gz new file mode 100644 index 0000000..9d1add1 Binary files /dev/null and b/tools/development/files-publisher/files/PM202007171301+020024C202007171207+0200-1215+0200_45678.xml.gz differ diff --git a/tools/development/message-router/mrserver.js b/tools/development/message-router/mrserver.js new file mode 100644 index 0000000..ace7f9b --- /dev/null +++ b/tools/development/message-router/mrserver.js @@ -0,0 +1,49 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2021 Nokia. + * ================================================================================ + * 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ +var httpServer = function () { + var http = require('http'), + + start = function (port) { + var server = http.createServer(function (req, res) { + processHttpRequest(req, res); + }); + server.listen(port, function () { + console.log('Listening on ' + port + '...'); + }); + }, + + processHttpRequest = function (req, res) { + res.writeHead(200, {'Content-Type': 'text/plain'}); + console.log('Received message'); + req.on('data', chunk => { + console.log(`-----MESSAGE_CONTENT_BEGIN-----\n ${chunk}`); + console.log('-----MESSAGE_CONTENT_END-----'); + }); + setTimeout(() => { + res.end('Published' + ' Successfully.\n'); + }, 100) + }; + + return { + start: start + } +}(); + +httpServer.start(3904); diff --git a/tools/development/resources/addSubscriber.json b/tools/development/resources/addSubscriber.json new file mode 100644 index 0000000..0666a7d --- /dev/null +++ b/tools/development/resources/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/tools/development/resources/cbs.json b/tools/development/resources/cbs.json new file mode 100644 index 0000000..5e0b943 --- /dev/null +++ b/tools/development/resources/cbs.json @@ -0,0 +1,7 @@ +{ + "ID": "cbs", + "Name": "config_binding_service", + "Tags": ["cbs"], + "Address": "", + "Port": 10000 +} \ No newline at end of file diff --git a/tools/development/resources/config.json b/tools/development/resources/config.json new file mode 100644 index 0000000..3f1009d --- /dev/null +++ b/tools/development/resources/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/tools/development/resources/createFeed.json b/tools/development/resources/createFeed.json new file mode 100644 index 0000000..f93633d --- /dev/null +++ b/tools/development/resources/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/tools/development/restart-pm-mapper.sh b/tools/development/restart-pm-mapper.sh new file mode 100755 index 0000000..3574dd5 --- /dev/null +++ b/tools/development/restart-pm-mapper.sh @@ -0,0 +1,21 @@ +#!/bin/bash +# ============LICENSE_START======================================================= +# Copyright (C) 2021 NOKIA +# ================================================================================ +# 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========================================================= +source ./env/containers_ip + +docker restart pmmapper + + diff --git a/tools/development/run-pm-mapper.sh b/tools/development/run-pm-mapper.sh new file mode 100755 index 0000000..0a01243 --- /dev/null +++ b/tools/development/run-pm-mapper.sh @@ -0,0 +1,31 @@ +#!/bin/bash +# ============LICENSE_START======================================================= +# Copyright (C) 2021 NOKIA +# ================================================================================ +# 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========================================================= +source ./env/containers_ip +IMAGE=onap/org.onap.dcaegen2.services.pm-mapper:latest + +docker run -d -p 8081:8081 \ + --mount type=bind,source="$PWD/certs",target="/opt/app/pm-mapper/etc/certs/" \ + -e "CONFIG_BINDING_SERVICE_SERVICE_HOST=$CBS_IP" \ + -e "CONFIG_BINDING_SERVICE_SERVICE_PORT=10000" \ + -e "HOSTNAME=pmmapper" \ + -e "PROCESSING_LIMIT_RATE=1" \ + -e "THREADS_MULTIPLIER=1" \ + -e "PROCESSING_THREADS_COUNT=1" \ + --add-host "dmaap-dr-node:$DR_NODE_IP" \ + --add-host "message-router:$NODE_IP" \ + --network=development_pmmapper-network \ + --name=pmmapper $IMAGE diff --git a/tools/development/send-meas-collec.sh b/tools/development/send-meas-collec.sh new file mode 100755 index 0000000..3358eda --- /dev/null +++ b/tools/development/send-meas-collec.sh @@ -0,0 +1,22 @@ +#!/bin/bash +# ============LICENSE_START======================================================= +# Copyright (C) 2021 NOKIA +# ================================================================================ +# 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========================================================= +PUBLISH_FILE_NAME=$1 + +MEAS_COLLEC_META_DATA_HEADER="X-DMAAP-DR-META:{\"productName\":\"gnb\",\"vendorName\":\"Nokia\",\"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\"}" +docker exec -it files-publisher curl -v -L -k -X PUT -H "Content-Type:application/octet-stream" -H "X-ONAP-RequestID:X-ONAP-RequestID=15" -H "${MEAS_COLLEC_META_DATA_HEADER}" -H "X-DMAAP-DR-ON-BEHALF-OF:pm-mapper" -H "Authorization:Basic cG1tYXBwZXI6cG1tYXBwZXI=" --data-binary @"/files/${PUBLISH_FILE_NAME}" https://dmaap-dr-node:8443/publish/1/Apm_TEST_REQUEST.xml.gz + + diff --git a/tools/development/send-meas-data.sh b/tools/development/send-meas-data.sh new file mode 100755 index 0000000..79e0939 --- /dev/null +++ b/tools/development/send-meas-data.sh @@ -0,0 +1,22 @@ +#!/bin/bash +# ============LICENSE_START======================================================= +# Copyright (C) 2021 NOKIA +# ================================================================================ +# 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========================================================= +PUBLISH_FILE_NAME=$1 + +MEAS_DATA_META_DATA_HEADER="X-DMAAP-DR-META:{\"productName\":\"gnb\",\"vendorName\":\"Nokia\",\"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\"}" +docker exec -it files-publisher curl -v -L -k -X PUT -H "Content-Type:application/octet-stream" -H "X-ONAP-RequestID:X-ONAP-RequestID=15" -H "${MEAS_DATA_META_DATA_HEADER}" -H "X-DMAAP-DR-ON-BEHALF-OF:pm-mapper" -H "Authorization:Basic cG1tYXBwZXI6cG1tYXBwZXI=" --data-binary @"/files/${PUBLISH_FILE_NAME}" https://dmaap-dr-node:8443/publish/1/Apm_TEST_REQUEST.xml.gz + + diff --git a/tools/development/setup-local.sh b/tools/development/setup-local.sh new file mode 100755 index 0000000..8dae91f --- /dev/null +++ b/tools/development/setup-local.sh @@ -0,0 +1,46 @@ +#!/bin/bash +# ============LICENSE_START======================================================= +# Copyright (C) 2021 NOKIA +# ================================================================================ +# 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========================================================= +SCRIPT_DIR=$PWD + +source ./env/containers_ip + +sed -i 's/datarouter-mariadb/'$MARIADB_IP'/g' $SCRIPT_DIR/dr-mount/provserver.properties + +docker-compose -f $SCRIPT_DIR/docker-compose.yml up -d mariadb consul cbs node files-publisher + +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 $SCRIPT_DIR/docker-compose.yml up -d datarouter-node datarouter-prov + +#Config Consul +curl --request PUT --data @$SCRIPT_DIR/resources/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 @$SCRIPT_DIR/resources/config.json + diff --git a/tools/development/subscribe-pm-mapper.sh b/tools/development/subscribe-pm-mapper.sh new file mode 100755 index 0000000..bbc775e --- /dev/null +++ b/tools/development/subscribe-pm-mapper.sh @@ -0,0 +1,21 @@ +#!/bin/bash +# ============LICENSE_START======================================================= +# Copyright (C) 2021 NOKIA +# ================================================================================ +# 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========================================================= +source ./env/containers_ip + +# PM Mapper subscriber on data router + +curl -v -X POST -H "Content-Type:application/vnd.dmaap-dr.subscription" -H "X-DMAAP-DR-ON-BEHALF-OF:pmmapper" --data-ascii @./resources/addSubscriber.json --post301 --location-trusted -k https://localhost:8443/subscribe/1 -- cgit 1.2.3-korg