From 0736c9f21b579973214d1a65ac218b9da7d11086 Mon Sep 17 00:00:00 2001 From: Sumithra Date: Tue, 5 Jan 2021 03:33:28 -0800 Subject: [PATCH] Add CSIT for slice-analysis-ms Issue-ID: DCAEGEN2-2560 Signed-off-by: Sumithra Change-Id: Ib776f759ba10e1d95d68ac4bc9da576b6063a59a --- .../testsuites/config/dmaap/MsgRtrApi.properties | 171 ++++++++++ .../config/sliceanalysisms/config_all.json | 86 +++++ .../testsuites/config/sliceanalysisms/trust.jks | Bin 0 -> 1413 bytes .../testsuites/config/sliceanalysisms/trust.pass | 1 + .../testsuites/docker-compose.yaml | 97 ++++++ .../testsuites/setup.sh | 60 ++++ .../testsuites/teardown.sh | 9 + .../testsuites/testplan.txt | 3 + .../dcaegen2-services-slice-analysis-ms/Dockerfile | 15 + .../configdb-sim.py | 115 +++++++ .../sim-data/du_cell_list_001_00110.json | 111 +++++++ .../sim-data/du_cell_list_001_010000.json | 323 ++++++++++++++++++ .../sim-data/du_list_001_00110.json | 129 ++++++++ .../sim-data/du_list_001_010000.json | 359 +++++++++++++++++++++ .../sim-data/profile_config_001_00110.json | 9 + .../sim-data/profile_config_001_010000.json | 9 + .../sim-data/slice_config_001_00110.json | 15 + .../sim-data/slice_config_001_010000.json | 27 ++ .../sim-data/subscriber-details_001_00110.json | 13 + .../sim-data/subscriber-details_001_010000.json | 13 + .../slice-analysis-ms/Dockerfile | 15 + .../slice-analysis-ms/configdb-sim.py | 115 +++++++ .../sim-data/du_cell_list_001_00110.json | 111 +++++++ .../sim-data/du_cell_list_001_010000.json | 323 ++++++++++++++++++ .../sim-data/du_list_001_00110.json | 129 ++++++++ .../sim-data/du_list_001_010000.json | 359 +++++++++++++++++++++ .../sim-data/profile_config_001_00110.json | 9 + .../sim-data/profile_config_001_010000.json | 9 + .../sim-data/slice_config_001_00110.json | 15 + .../sim-data/slice_config_001_010000.json | 27 ++ .../sim-data/subscriber-details_001_00110.json | 13 + .../sim-data/subscriber-details_001_010000.json | 13 + .../testcases/data/expected_ml_payload.json | 1 + .../testcases/data/expected_ml_response.json | 1 + .../testcases/data/expected_payload_pm1.json | 1 + .../testcases/data/expected_payload_pm2.json | 1 + .../testcases/data/expected_pm.json | 1 + .../testcases/data/expected_pm1.json | 1 + .../testcases/data/expected_pm2.json | 1 + .../testcases/data/expected_pm3.json | 1 + .../testcases/data/ml_response.json | 69 ++++ .../testcases/data/performance_notification1.json | 56 ++++ .../testcases/data/performance_notification2.json | 56 ++++ .../testcases/data/performance_notification3.json | 1 + .../testcases/data/performance_notification4.json | 1 + .../testcases/data/performance_notification5.json | 1 + .../testcases/data/performance_notification6.json | 1 + .../testcases/data/performance_notification7.json | 1 + .../testcases/data/performance_notification8.json | 1 + .../testcases/slice-analysis-ms-test.robot | 124 +++++++ 50 files changed, 3022 insertions(+) create mode 100644 plans/dcaegen2-services-slice-analysis-ms/testsuites/config/dmaap/MsgRtrApi.properties create mode 100644 plans/dcaegen2-services-slice-analysis-ms/testsuites/config/sliceanalysisms/config_all.json create mode 100644 plans/dcaegen2-services-slice-analysis-ms/testsuites/config/sliceanalysisms/trust.jks create mode 100644 plans/dcaegen2-services-slice-analysis-ms/testsuites/config/sliceanalysisms/trust.pass create mode 100644 plans/dcaegen2-services-slice-analysis-ms/testsuites/docker-compose.yaml create mode 100644 plans/dcaegen2-services-slice-analysis-ms/testsuites/setup.sh create mode 100644 plans/dcaegen2-services-slice-analysis-ms/testsuites/teardown.sh create mode 100644 plans/dcaegen2-services-slice-analysis-ms/testsuites/testplan.txt create mode 100644 scripts/dcaegen2-services-slice-analysis-ms/Dockerfile create mode 100644 scripts/dcaegen2-services-slice-analysis-ms/configdb-sim.py create mode 100644 scripts/dcaegen2-services-slice-analysis-ms/sim-data/du_cell_list_001_00110.json create mode 100644 scripts/dcaegen2-services-slice-analysis-ms/sim-data/du_cell_list_001_010000.json create mode 100644 scripts/dcaegen2-services-slice-analysis-ms/sim-data/du_list_001_00110.json create mode 100644 scripts/dcaegen2-services-slice-analysis-ms/sim-data/du_list_001_010000.json create mode 100644 scripts/dcaegen2-services-slice-analysis-ms/sim-data/profile_config_001_00110.json create mode 100644 scripts/dcaegen2-services-slice-analysis-ms/sim-data/profile_config_001_010000.json create mode 100644 scripts/dcaegen2-services-slice-analysis-ms/sim-data/slice_config_001_00110.json create mode 100644 scripts/dcaegen2-services-slice-analysis-ms/sim-data/slice_config_001_010000.json create mode 100644 scripts/dcaegen2-services-slice-analysis-ms/sim-data/subscriber-details_001_00110.json create mode 100644 scripts/dcaegen2-services-slice-analysis-ms/sim-data/subscriber-details_001_010000.json create mode 100644 scripts/dcaegen2-services-slice-analysis-ms/slice-analysis-ms/Dockerfile create mode 100644 scripts/dcaegen2-services-slice-analysis-ms/slice-analysis-ms/configdb-sim.py create mode 100644 scripts/dcaegen2-services-slice-analysis-ms/slice-analysis-ms/sim-data/du_cell_list_001_00110.json create mode 100644 scripts/dcaegen2-services-slice-analysis-ms/slice-analysis-ms/sim-data/du_cell_list_001_010000.json create mode 100644 scripts/dcaegen2-services-slice-analysis-ms/slice-analysis-ms/sim-data/du_list_001_00110.json create mode 100644 scripts/dcaegen2-services-slice-analysis-ms/slice-analysis-ms/sim-data/du_list_001_010000.json create mode 100644 scripts/dcaegen2-services-slice-analysis-ms/slice-analysis-ms/sim-data/profile_config_001_00110.json create mode 100644 scripts/dcaegen2-services-slice-analysis-ms/slice-analysis-ms/sim-data/profile_config_001_010000.json create mode 100644 scripts/dcaegen2-services-slice-analysis-ms/slice-analysis-ms/sim-data/slice_config_001_00110.json create mode 100644 scripts/dcaegen2-services-slice-analysis-ms/slice-analysis-ms/sim-data/slice_config_001_010000.json create mode 100644 scripts/dcaegen2-services-slice-analysis-ms/slice-analysis-ms/sim-data/subscriber-details_001_00110.json create mode 100644 scripts/dcaegen2-services-slice-analysis-ms/slice-analysis-ms/sim-data/subscriber-details_001_010000.json create mode 100644 tests/dcaegen2-services-slice-analysis-ms/testcases/data/expected_ml_payload.json create mode 100644 tests/dcaegen2-services-slice-analysis-ms/testcases/data/expected_ml_response.json create mode 100644 tests/dcaegen2-services-slice-analysis-ms/testcases/data/expected_payload_pm1.json create mode 100644 tests/dcaegen2-services-slice-analysis-ms/testcases/data/expected_payload_pm2.json create mode 100644 tests/dcaegen2-services-slice-analysis-ms/testcases/data/expected_pm.json create mode 100644 tests/dcaegen2-services-slice-analysis-ms/testcases/data/expected_pm1.json create mode 100644 tests/dcaegen2-services-slice-analysis-ms/testcases/data/expected_pm2.json create mode 100644 tests/dcaegen2-services-slice-analysis-ms/testcases/data/expected_pm3.json create mode 100644 tests/dcaegen2-services-slice-analysis-ms/testcases/data/ml_response.json create mode 100644 tests/dcaegen2-services-slice-analysis-ms/testcases/data/performance_notification1.json create mode 100644 tests/dcaegen2-services-slice-analysis-ms/testcases/data/performance_notification2.json create mode 100644 tests/dcaegen2-services-slice-analysis-ms/testcases/data/performance_notification3.json create mode 100644 tests/dcaegen2-services-slice-analysis-ms/testcases/data/performance_notification4.json create mode 100644 tests/dcaegen2-services-slice-analysis-ms/testcases/data/performance_notification5.json create mode 100644 tests/dcaegen2-services-slice-analysis-ms/testcases/data/performance_notification6.json create mode 100644 tests/dcaegen2-services-slice-analysis-ms/testcases/data/performance_notification7.json create mode 100644 tests/dcaegen2-services-slice-analysis-ms/testcases/data/performance_notification8.json create mode 100644 tests/dcaegen2-services-slice-analysis-ms/testcases/slice-analysis-ms-test.robot diff --git a/plans/dcaegen2-services-slice-analysis-ms/testsuites/config/dmaap/MsgRtrApi.properties b/plans/dcaegen2-services-slice-analysis-ms/testsuites/config/dmaap/MsgRtrApi.properties new file mode 100644 index 00000000..61f3f033 --- /dev/null +++ b/plans/dcaegen2-services-slice-analysis-ms/testsuites/config/dmaap/MsgRtrApi.properties @@ -0,0 +1,171 @@ +# LICENSE_START======================================================= +# org.onap.dmaap +# ================================================================================ +# Copyright © 2017 AT&T Intellectual Property. All rights reserved. +# Copyright (C) 2020 Wipro Limited. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# +############################################################################### +############################################################################### +## +## Cambria API Server config +## +## - Default values are shown as commented settings. +## + +############################################################################### +## +## HTTP service +## +## - 3904 is standard as of 7/29/14. +# +## Zookeeper Connection +## +## Both Cambria and Kafka make use of Zookeeper. +## +#config.zk.servers=172.18.1.1 +config.zk.servers=zookeeper:2181 +#config.zk.root=/fe3c/cambria/config + + +############################################################################### +## +## Kafka Connection +## +## Items below are passed through to Kafka's producer and consumer +## configurations (after removing "kafka.") +## if you want to change request.required.acks it can take this one value +#kafka.metadata.broker.list=localhost:9092,localhost:9093 +kafka.metadata.broker.list=kafka:9092 +##kafka.request.required.acks=-1 +#kafka.client.zookeeper=${config.zk.servers} +consumer.timeout.ms=100 +zookeeper.connection.timeout.ms=6000 +zookeeper.session.timeout.ms=20000 +zookeeper.sync.time.ms=2000 +auto.commit.interval.ms=1000 +fetch.message.max.bytes =1000000 +auto.commit.enable=false + +#(backoff*retries > zksessiontimeout) +kafka.rebalance.backoff.ms=10000 +kafka.rebalance.max.retries=6 + + +############################################################################### +## +## Secured Config +## +## Some data stored in the config system is sensitive -- API keys and secrets, +## for example. to protect it, we use an encryption layer for this section +## of the config. +## +## The key is a base64 encode AES key. This must be created/configured for +## each installation. +#cambria.secureConfig.key= +## +## The initialization vector is a 16 byte value specific to the secured store. +## This must be created/configured for each installation. +#cambria.secureConfig.iv= + +## Southfield Sandbox +cambria.secureConfig.key=b/7ouTn9FfEw2PQwL0ov/Q== +cambria.secureConfig.iv=wR9xP5k5vbz/xD0LmtqQLw== +authentication.adminSecret=fe3cCompound +#cambria.secureConfig.key[pc569h]=YT3XPyxEmKCTLI2NK+Sjbw== +#cambria.secureConfig.iv[pc569h]=rMm2jhR3yVnU+u2V9Ugu3Q== + + +############################################################################### +## +## Consumer Caching +## +## Kafka expects live connections from the consumer to the broker, which +## obviously doesn't work over connectionless HTTP requests. The Cambria +## server proxies HTTP requests into Kafka consumer sessions that are kept +## around for later re-use. Not doing so is costly for setup per request, +## which would substantially impact a high volume consumer's performance. +## +## This complicates Cambria server failover, because we often need server +## A to close its connection before server B brings up the replacement. +## + +## The consumer cache is normally enabled. +#cambria.consumer.cache.enabled=true + +## Cached consumers are cleaned up after a period of disuse. The server inspects +## consumers every sweepFreqSeconds and will clean up any connections that are +## dormant for touchFreqMs. +#cambria.consumer.cache.sweepFreqSeconds=15 +cambria.consumer.cache.touchFreqMs=120000 +##stickforallconsumerrequests=false +## The cache is managed through ZK. The default value for the ZK connection +## string is the same as config.zk.servers. +#cambria.consumer.cache.zkConnect=${config.zk.servers} + +## +## Shared cache information is associated with this node's name. The default +## name is the hostname plus the HTTP service port this host runs on. (The +## hostname is determined via InetAddress.getLocalHost ().getCanonicalHostName(), +## which is not always adequate.) You can set this value explicitly here. +## +#cambria.api.node.identifier= + +#cambria.rateLimit.maxEmptyPollsPerMinute=30 +#cambria.rateLimitActual.delay.ms=10 + +############################################################################### +## +## Metrics Reporting +## +## This server can report its metrics periodically on a topic. +## +#metrics.send.cambria.enabled=true +#metrics.send.cambria.topic=cambria.apinode.metrics #msgrtr.apinode.metrics.dmaap +#metrics.send.cambria.sendEverySeconds=60 + +cambria.consumer.cache.zkBasePath=/fe3c/cambria/consumerCache +consumer.timeout=17 +default.partitions=3 +default.replicas=3 +############################################################################## +#100mb +maxcontentlength=10000 + + +############################################################################## +#AAF Properties +msgRtr.namespace.aaf=org.onap.dmaap.mr.topic +msgRtr.topicfactory.aaf=org.onap.dmaap.mr.topicFactory|:org.onap.dmaap.mr.topic: +enforced.topic.name.AAF=org.onap +forceAAF=false +transidUEBtopicreqd=false +defaultNSforUEB=org.onap.dmaap.mr +############################################################################## +#Mirror Maker Agent +msgRtr.mirrormakeradmin.aaf=com.onap.dmaap.mr.dev.mirrormaker|*|admin +msgRtr.mirrormakeruser.aaf=com.onap.dmaap.mr.dev.mirrormaker|*|user +msgRtr.mirrormakeruser.aaf.create=com.onap.dmaap.mr.dev.topicFactory|:com.onap.dmaap.mr.dev.topic: +msgRtr.mirrormaker.timeout=15000 +msgRtr.mirrormaker.topic=com.onap.dmaap.mr.prod.mm.agent +msgRtr.mirrormaker.consumergroup=mmagentserver +msgRtr.mirrormaker.consumerid=1 + +kafka.max.poll.interval.ms=300000 +kafka.heartbeat.interval.ms=60000 +kafka.session.timeout.ms=240000 +kafka.max.poll.records=1000 + diff --git a/plans/dcaegen2-services-slice-analysis-ms/testsuites/config/sliceanalysisms/config_all.json b/plans/dcaegen2-services-slice-analysis-ms/testsuites/config/sliceanalysisms/config_all.json new file mode 100644 index 00000000..b084b57d --- /dev/null +++ b/plans/dcaegen2-services-slice-analysis-ms/testsuites/config/sliceanalysisms/config_all.json @@ -0,0 +1,86 @@ +{ + "config": { + "streams_subscribes": { + "performance_management_topic": { + "aaf_password": null, + "type": "message-router", + "dmaap_info": { + "topic_url": "http://message-router.onap.svc.cluster.local:3904/events/unauthenticated.PERFORMANCE_MEASUREMENTS", + "client_role": "sliceanalysis-subscriber", + "location": "onap", + "client_id": "sdnr-sliceanalysis-1" + }, + "aaf_username": null + }, + "dcae_cl_response_topic": { + "aaf_password": null, + "type": "message-router", + "dmaap_info": { + "topic_url": "http://message-router.onap.svc.cluster.local:3904/events/DCAE_CL_RSP", + "client_role": "sliceanalysis-subscriber", + "location": "onap", + "client_id": "sdnr-sliceanalysis-1" + }, + "aaf_username": null + }, + "intelligent_slicing_topic": { + "aaf_password": null, + "type": "message-router", + "dmaap_info": { + "topic_url": "http://message-router.onap.svc.cluster.local::3904/events/unauthenticated.ML_RESPONSE_TOPIC", + "client_role": "sliceanalysis-subscriber", + "location": "onap", + "client_id": "sdnr-sliceanalysis-1" + }, + "aaf_username": null + } + }, + "streams_publishes": { + "CL_topic": { + "aaf_password": null, + "type": "message-router", + "dmaap_info": { + "topic_url": "http://message-router.onap.svc.cluster.local::3904/events/unauthenticated.DCAE_CL_OUTPUT", + "client_role": "sliceanalysis-subscriber", + "location": "onap", + "client_id": "sdnr-sliceanalysis-1" + }, + "aaf_username": null + } + }, + "postgres.password": "postgres", + "postgres.username": "sliceanalysisms_admin", + "postgres.host": "postgres", + "postgres.port": "5432", + "sliceanalysisms.dmaap.server": [ + "dmaap" + ], + "cbsPollingInterval": 60, + "sliceanalysisms.cg": "sliceanalysisms-cg", + "sliceanalysisms.pollingInterval": 20, + "sliceanalysisms.samples": 3, + "sliceanalysisms.minPercentageChange": 5, + "sliceanalysisms.initialDelaySeconds": 300000, + "sliceanalysisms.pollingTimeout": 60, + "sliceanalysisms.cid": "sliceanalysisms-cid", + "sliceanalysisms.configDb.service": "http://configdb_sim:5000", + "service_calls": { + "policy-req": [] + }, + "trust_store_path": "/opt/app/sliceanalysisms/etc/cert/trust.jks", + "trust_store_pass_path": "/opt/app/sliceanalysisms/etc/cert/trust.pass" + }, + "policies": { + "event": { + "action": "gathered", + "timestamp": "2019-09-18T14:57:55.320Z", + "update_id": "dbb88da8-8df1-489d-b51d-8d5cbbfbcd99", + "policies_count": 1 + }, + "items": [ + { + "policyName": "com.Config_PCIMS_CONFIG_POLICY.1.xml" + } + ] + } +} diff --git a/plans/dcaegen2-services-slice-analysis-ms/testsuites/config/sliceanalysisms/trust.jks b/plans/dcaegen2-services-slice-analysis-ms/testsuites/config/sliceanalysisms/trust.jks new file mode 100644 index 0000000000000000000000000000000000000000..33d9c569a19cae5e9dff651546af0e32c75c02cd GIT binary patch literal 1413 zcmb7DYdF&j9NtyOZA)s_5F%&oQ2$x0DH;#kxoi_K}aw~J~5LPVa zlIxaon>BgT$%FBzC*`=8q?*Hd&WApnFXzMWd7ts4FSs zxc1!7>R_-c90Zu)5rCQ!lm=5(gFCxfTifB)0o6^eq6Tw5VeNuf1(Y|bk|u=a2JF&O z$CH2q012(-vPrxP&Nb!0@x502pa+hb()vkYt+>- z&_TPNWHKM?NJ?bl(%L; z#6E-m7bs`3lE&P&_@~o;X>uH;z%SdxLzeQ#;e#`L!&aoDcQY?eD&$ZzM4 zDkG0D6GBUU*RnpO!CC|KQ%1_N3!;cNJ`3IbYC2Wev+W{OcZX}zt(bLp?ATOB@KVzw z+nXm6+$-9Ikty+_%yp!naN@Pgupn8#;)zwO#9?hu^woKGR)n=7hCy2Bu%$3y;&${ z=YPhyhy#^mW02hKNu!?zdk1@SiGr93P5Ng43NBG zZK%E!awv+SR;B)%AlnLkk!3kDZ%p?HDI6bgrOSr|xL&H`mbEhh(y&M- zO)lL3Y%<%PR@5J3d9Lo}gEGV63nqZrTll;$(dOG^QlV4a?L`}eadImlPyf?Wwv~j# zq<*YH9p+~vM=jAE_^l6zIv5e|Ut*Ns4R{6IJEZ}Ef1TZYxO;7f8Z@Hwft0j&n1Q`qBLuO0YKGt-V%=YuBV*lJv z4}tXj2+0o85ii|utShHQ#+|(HIWO+RibJlC@4OzKa<|}tEu-wKL!YF!)7!SPq|i$< ztA9^*?0YM5mzlgSn4xd?e!;tKIG23GHQuPFW!92XsRWWX#MduAAk_&ByQ z5xe6p$JBEi1{Z_{F^+b+Wu%*Pb2|9Qa-1TT#j$ob{$)|J8k)}EjtxrUoV_xCj*XG0 z=&j$cs6-K-s$!S1V?naa^7TNLIYy8{NY(BOYqG%V|5ciQTvJHcKjkm?C0iUTzgKBM z*BopQpuA-kgDY42rbfsOoqNAXsl~57a!!`;W=@QObRU!~-0*FjMl;zugTsgE^E|7N z{FPHNvdL?YDxAEHWQn_5?yMs3cJn94baH0Qe#)q)1RhhkkelvwpbWZhj$d~5I~~BW zl1`CX-_NDcEw+6^M=Pj&seog6GQEr_)_FV{bp!bxwKMu1Z~n!ri#l4N+?j%$Yb(jl Si{& $WORKSPACE/archives/sonhandler-docker-compose.log +docker-compose -f $TEST_PLANS_DIR/docker-compose.yaml down -v diff --git a/plans/dcaegen2-services-slice-analysis-ms/testsuites/testplan.txt b/plans/dcaegen2-services-slice-analysis-ms/testsuites/testplan.txt new file mode 100644 index 00000000..a8b2bdab --- /dev/null +++ b/plans/dcaegen2-services-slice-analysis-ms/testsuites/testplan.txt @@ -0,0 +1,3 @@ +# Test suites are relative paths under [integration/csit.git]/tests/. +# Place the suites in run order. +dcaegen2-services-slice-analysis-ms/testcases diff --git a/scripts/dcaegen2-services-slice-analysis-ms/Dockerfile b/scripts/dcaegen2-services-slice-analysis-ms/Dockerfile new file mode 100644 index 00000000..52d54a57 --- /dev/null +++ b/scripts/dcaegen2-services-slice-analysis-ms/Dockerfile @@ -0,0 +1,15 @@ +FROM python:alpine3.7 + +ADD configdb-sim.py / + +ADD ./sim-data / + +RUN pip install Flask --trusted-host pypi.org --trusted-host files.pythonhosted.org + +RUN pip install requests --trusted-host pypi.org --trusted-host files.pythonhosted.org + +EXPOSE 5000 + +CMD ["flask", "run", "--host", "0.0.0.0"] + +CMD [ "python", "./configdb-sim.py" ] diff --git a/scripts/dcaegen2-services-slice-analysis-ms/configdb-sim.py b/scripts/dcaegen2-services-slice-analysis-ms/configdb-sim.py new file mode 100644 index 00000000..bcda08d5 --- /dev/null +++ b/scripts/dcaegen2-services-slice-analysis-ms/configdb-sim.py @@ -0,0 +1,115 @@ +import flask +import json +from flask import Flask, render_template +from flask import request +from flask import jsonify +import requests +import threading +import time + +app = flask.Flask(__name__) +app.config["DEBUG"] = True + + +def get_du_list_for_nssai(snssai): + if str(snssai) == '001-00110': + with open('du_list_001_00110.json') as du_list: + data = json.load(du_list) + else: + with open('du_list_001_010000.json') as du_list: + data = json.load(du_list) + if not data: + return {"Error": "Unable to read file"}, 503 + return data, None + + +def get_du_cell_list_for_nssai(snssai): + if str(snssai) == '001-00110': + with open('du_cell_list_001_00110.json') as du_cell_list: + data = json.load(du_cell_list) + else: + with open('du_cell_list_001_010000.json') as du_cell_list: + data = json.load(du_cell_list) + if not data: + return {"Error": "Unable to read file"}, 503 + return data, None + + +def get_slice_config_for_nssai(snssai): + if str(snssai) == '001-00110': + with open('slice_config_001_00110.json') as slice_config: + data = json.load(slice_config) + else: + with open('slice_config_001_010000.json') as slice_config: + data = json.load(slice_config) + if not data: + return {"Error": "Unable to read file"}, 503 + return data, None + + +def get_profile_config_for_nssai(snssai): + if str(snssai) == '001-00110': + with open('profile_config_001_00110.json') as profile_config: + data = json.load(profile_config) + else: + with open('profile_config_001_010000.json') as profile_config: + data = json.load(profile_config) + if not data: + return {"Error": "Unable to read file"}, 503 + return data, None + + +def get_subscriber_details_for_nssai(snssai): + if str(snssai) == '001-00110': + with open('subscriber-details_001_00110.json') as subscriber_details: + data = json.load(subscriber_details) + else: + with open('subscriber-details_001_010000.json') as subscriber_details: + data = json.load(subscriber_details) + if not data: + return {"Error": "Unable to read file"}, 503 + return data, None + + +@app.route("/api/sdnc-config-db/v4/du-list/", methods=["GET"]) +def get_du_list(snssai): + data, status = get_du_list_for_nssai(snssai) + if not status: + return jsonify(data) + return data, 503 + + +@app.route("/api/sdnc-config-db/v4/du-cell-list/", methods=["GET"]) +def get_du_cell_list(snssai): + data, status = get_du_cell_list_for_nssai(snssai) + if not status: + return jsonify(data) + return data, 503 + + +@app.route("/api/sdnc-config-db/v4/slice-config/", methods=["GET"]) +def get_slice_config(snssai): + data, status = get_slice_config_for_nssai(snssai) + if not status: + return jsonify(data) + return data, 503 + + +@app.route("/api/sdnc-config-db/v4/profile-config/", methods=["GET"]) +def get_profile_config(snssai): + data, status = get_profile_config_for_nssai(snssai) + if not status: + return jsonify(data) + return data, 503 + + +@app.route("/api/sdnc-config-db/v4/subscriber-details/", + methods=["GET"]) +def get_subscriber_details(snssai): + data, status = get_subscriber_details_for_nssai(snssai) + if not status: + return jsonify(data) + return data, 503 + + +app.run(host='0.0.0.0') diff --git a/scripts/dcaegen2-services-slice-analysis-ms/sim-data/du_cell_list_001_00110.json b/scripts/dcaegen2-services-slice-analysis-ms/sim-data/du_cell_list_001_00110.json new file mode 100644 index 00000000..f01f0b98 --- /dev/null +++ b/scripts/dcaegen2-services-slice-analysis-ms/sim-data/du_cell_list_001_00110.json @@ -0,0 +1,111 @@ +{ + +"11":[ + +{ + +"cellLocalId":103593999, + +"operationalState":"ENABLED", + +"administrativeState":"UNLOCKED", + +"cellState":"ACTIVE", + +"pLMNInfoList":[ + +{ + +"pLMNId":"310-410", + +"sNSSAI":{ + +"sNSSAI":"001-00110", + +"status":"ACTIVE", + +"globalSubscriberId":null, + +"subscriptionServiceType":null, + +"configData":{ + +"dLThptPerSlice":20, + +"uLThptPerSlice":15, + +"maxNumberOfConns":null, + +"lastUpdatedTS":"2020-10-13T07:02:28.000+0000" + +} + +} + +} + +], + +"nRPCI":12, + +"nRTAC":310, + +"resourceType":"PRB" + +}, + +{ + +"cellLocalId":103593989, + +"operationalState":"ENABLED", + +"administrativeState":"UNLOCKED", + +"cellState":"ACTIVE", + +"pLMNInfoList":[ + +{ + +"pLMNId":"310-410", + +"sNSSAI":{ + +"sNSSAI":"001-00110", + +"status":"ACTIVE", + +"globalSubscriberId":null, + +"subscriptionServiceType":null, + +"configData":{ + +"dLThptPerSlice":20, + +"uLThptPerSlice":15, + +"maxNumberOfConns":null, + +"lastUpdatedTS":"2020-10-13T12:03:56.000+0000" + +} + +} + +} + +], + +"nRPCI":12, + +"nRTAC":310, + +"resourceType":"PRB" + +} + +] + +} diff --git a/scripts/dcaegen2-services-slice-analysis-ms/sim-data/du_cell_list_001_010000.json b/scripts/dcaegen2-services-slice-analysis-ms/sim-data/du_cell_list_001_010000.json new file mode 100644 index 00000000..54b2b7c5 --- /dev/null +++ b/scripts/dcaegen2-services-slice-analysis-ms/sim-data/du_cell_list_001_010000.json @@ -0,0 +1,323 @@ +{ + + "22":[ + + { + + "cellLocalId":112951562, + + "operationalState":"ENABLED", + + "administrativeState":"UNLOCKED", + + "cellState":"ACTIVE", + + "pLMNInfoList":[ + + { + + "pLMNId":"310-410", + + "sNSSAI":{ + + "sNSSAI":"001-010000", + + "status":"ACTIVE", + + "globalSubscriberId":null, + + "subscriptionServiceType":null, + + "configData":{ + + "dLThptPerSlice":9, + + "uLThptPerSlice":10, + + "maxNumberOfConns":null, + + "lastUpdatedTS":"2020-11-03T07:41:34.000+0000" + + } + + } + + } + + ], + + "nRPCI":12, + + "nRTAC":310, + + "resourceType":"PRB" + + }, + + { + + "cellLocalId":112951561, + + "operationalState":"ENABLED", + + "administrativeState":"UNLOCKED", + + "cellState":"ACTIVE", + + "pLMNInfoList":[ + + { + + "pLMNId":"310-410", + + "sNSSAI":{ + + "sNSSAI":"001-010000", + + "status":"ACTIVE", + + "globalSubscriberId":null, + + "subscriptionServiceType":null, + + "configData":{ + + "dLThptPerSlice":9, + + "uLThptPerSlice":10, + + "maxNumberOfConns":null, + + "lastUpdatedTS":"2020-11-03T07:41:34.000+0000" + + } + + } + + } + + ], + + "nRPCI":12, + + "nRTAC":310, + + "resourceType":"PRB" + + }, + + { + + "cellLocalId":112951568, + + "operationalState":"ENABLED", + + "administrativeState":"UNLOCKED", + + "cellState":"ACTIVE", + + "pLMNInfoList":[ + + { + + "pLMNId":"310-410", + + "sNSSAI":{ + + "sNSSAI":"001-010000", + + "status":"ACTIVE", + + "globalSubscriberId":null, + + "subscriptionServiceType":null, + + "configData":{ + + "dLThptPerSlice":9, + + "uLThptPerSlice":10, + + "maxNumberOfConns":null, + + "lastUpdatedTS":"2020-11-03T07:41:34.000+0000" + + } + + } + + } + + ], + + "nRPCI":12, + + "nRTAC":310, + + "resourceType":"PRB" + + } + + ], + + "11":[ + + { + + "cellLocalId":95697174, + + "operationalState":"ENABLED", + + "administrativeState":"UNLOCKED", + + "cellState":"ACTIVE", + + "pLMNInfoList":[ + + { + + "pLMNId":"310-410", + + "sNSSAI":{ + + "sNSSAI":"001-010000", + + "status":"ACTIVE", + + "globalSubscriberId":null, + + "subscriptionServiceType":null, + + "configData":{ + + "dLThptPerSlice":9, + + "uLThptPerSlice":10, + + "maxNumberOfConns":null, + + "lastUpdatedTS":"2020-11-03T07:41:13.000+0000" + + } + + } + + } + + ], + + "nRPCI":12, + + "nRTAC":310, + + "resourceType":"PRB" + + }, + + { + + "cellLocalId":95697175, + + "operationalState":"ENABLED", + + "administrativeState":"UNLOCKED", + + "cellState":"ACTIVE", + + "pLMNInfoList":[ + + { + + "pLMNId":"310-410", + + "sNSSAI":{ + + "sNSSAI":"001-010000", + + "status":"ACTIVE", + + "globalSubscriberId":null, + + "subscriptionServiceType":null, + + "configData":{ + + "dLThptPerSlice":9, + + "uLThptPerSlice":10, + + "maxNumberOfConns":null, + + "lastUpdatedTS":"2020-11-03T07:41:13.000+0000" + + } + + } + + } + + ], + + "nRPCI":12, + + "nRTAC":310, + + "resourceType":"PRB" + + }, + + { + + "cellLocalId":95697155, + + "operationalState":"ENABLED", + + "administrativeState":"UNLOCKED", + + "cellState":"ACTIVE", + + "pLMNInfoList":[ + + { + + "pLMNId":"310-410", + + "sNSSAI":{ + + "sNSSAI":"001-010000", + + "status":"ACTIVE", + + "globalSubscriberId":null, + + "subscriptionServiceType":null, + + "configData":{ + + "dLThptPerSlice":9, + + "uLThptPerSlice":10, + + "maxNumberOfConns":null, + + "lastUpdatedTS":"2020-11-03T07:41:13.000+0000" + + } + + } + + } + + ], + + "nRPCI":12, + + "nRTAC":310, + + "resourceType":"PRB" + + } + + ] + +} diff --git a/scripts/dcaegen2-services-slice-analysis-ms/sim-data/du_list_001_00110.json b/scripts/dcaegen2-services-slice-analysis-ms/sim-data/du_list_001_00110.json new file mode 100644 index 00000000..a4c6f2ff --- /dev/null +++ b/scripts/dcaegen2-services-slice-analysis-ms/sim-data/du_list_001_00110.json @@ -0,0 +1,129 @@ +[ + +{ + +"gNBDUId":1, + +"gNBId":98763, + +"gNBIdLength":5, + +"gNBDUName":"gnduserver1", + +"pLMNId":"310-410", + +"nFType":"DU", + +"cellDUList":[ + +{ + +"cellLocalId":103593989, + +"operationalState":"ENABLED", + +"administrativeState":"UNLOCKED", + +"cellState":"ACTIVE", + +"pLMNInfoList":[ + +{ + +"pLMNId":"310-410", + +"sNSSAI":{ + +"sNSSAI":"001-00110", + +"status":"ACTIVE", + +"globalSubscriberId":null, + +"subscriptionServiceType":null, + +"configData":{ + +"dLThptPerSlice":20, + +"uLThptPerSlice":15, + +"maxNumberOfConns":null, + +"lastUpdatedTS":"2020-10-13T12:03:56.000+0000" + +} + +} + +} + +], + +"nRPCI":12, + +"nRTAC":310, + +"resourceType":"PRB" + +}, + +{ + +"cellLocalId":103593999, + +"operationalState":"ENABLED", + +"administrativeState":"UNLOCKED", + +"cellState":"ACTIVE", + +"pLMNInfoList":[ + +{ + +"pLMNId":"310-410", + +"sNSSAI":{ + +"sNSSAI":"001-00110", + +"status":"ACTIVE", + +"globalSubscriberId":null, + +"subscriptionServiceType":null, + +"configData":{ + +"dLThptPerSlice":20, + +"uLThptPerSlice":15, + +"maxNumberOfConns":null, + +"lastUpdatedTS":"2020-10-13T07:02:28.000+0000" + +} + +} + +} + +], + +"nRPCI":12, + +"nRTAC":310, + +"resourceType":"PRB" + +} + +], + +"nearRTRICId":null + +} + +] diff --git a/scripts/dcaegen2-services-slice-analysis-ms/sim-data/du_list_001_010000.json b/scripts/dcaegen2-services-slice-analysis-ms/sim-data/du_list_001_010000.json new file mode 100644 index 00000000..82d7fb1a --- /dev/null +++ b/scripts/dcaegen2-services-slice-analysis-ms/sim-data/du_list_001_010000.json @@ -0,0 +1,359 @@ +[ + + { + + "gNBDUId":2, + + "gNBId":98763, + + "gNBIdLength":5, + + "gNBDUName":"gnduserver2", + + "pLMNId":"310-410", + + "nFType":"DU", + + "cellDUList":[ + + { + + "cellLocalId":95697155, + + "operationalState":"ENABLED", + + "administrativeState":"UNLOCKED", + + "cellState":"ACTIVE", + + "pLMNInfoList":[ + + { + + "pLMNId":"310-410", + + "sNSSAI":{ + + "sNSSAI":"001-010000", + + "status":"ACTIVE", + + "globalSubscriberId":null, + + "subscriptionServiceType":null, + + "configData":{ + + "dLThptPerSlice":9, + + "uLThptPerSlice":10, + + "maxNumberOfConns":null, + + "lastUpdatedTS":"2020-11-03T07:41:13.000+0000" + + } + + } + + } + + ], + + "nRPCI":12, + + "nRTAC":310, + + "resourceType":"PRB" + + }, + + { + + "cellLocalId":95697174, + + "operationalState":"ENABLED", + + "administrativeState":"UNLOCKED", + + "cellState":"ACTIVE", + + "pLMNInfoList":[ + + { + + "pLMNId":"310-410", + + "sNSSAI":{ + + "sNSSAI":"001-010000", + + "status":"ACTIVE", + + "globalSubscriberId":null, + + "subscriptionServiceType":null, + + "configData":{ + + "dLThptPerSlice":9, + + "uLThptPerSlice":10, + + "maxNumberOfConns":null, + + "lastUpdatedTS":"2020-11-03T07:41:13.000+0000" + + } + + } + + } + + ], + + "nRPCI":12, + + "nRTAC":310, + + "resourceType":"PRB" + + }, + + { + + "cellLocalId":95697175, + + "operationalState":"ENABLED", + + "administrativeState":"UNLOCKED", + + "cellState":"ACTIVE", + + "pLMNInfoList":[ + + { + + "pLMNId":"310-410", + + "sNSSAI":{ + + "sNSSAI":"001-010000", + + "status":"ACTIVE", + + "globalSubscriberId":null, + + "subscriptionServiceType":null, + + "configData":{ + + "dLThptPerSlice":9, + + "uLThptPerSlice":10, + + "maxNumberOfConns":null, + + "lastUpdatedTS":"2020-11-03T07:41:13.000+0000" + + } + + } + + } + + ], + + "nRPCI":12, + + "nRTAC":310, + + "resourceType":"PRB" + + } + + ], + + "nearRTRICId":null + + }, + + { + + "gNBDUId":4, + + "gNBId":98763, + + "gNBIdLength":5, + + "gNBDUName":"gnduserver4", + + "pLMNId":"310-410", + + "nFType":"DU", + + "cellDUList":[ + + { + + "cellLocalId":112951561, + + "operationalState":"ENABLED", + + "administrativeState":"UNLOCKED", + + "cellState":"ACTIVE", + + "pLMNInfoList":[ + + { + + "pLMNId":"310-410", + + "sNSSAI":{ + + "sNSSAI":"001-010000", + + "status":"ACTIVE", + + "globalSubscriberId":null, + + "subscriptionServiceType":null, + + "configData":{ + + "dLThptPerSlice":9, + + "uLThptPerSlice":10, + + "maxNumberOfConns":null, + + "lastUpdatedTS":"2020-11-03T07:41:34.000+0000" + + } + + } + + } + + ], + + "nRPCI":12, + + "nRTAC":310, + + "resourceType":"PRB" + + }, + + { + + "cellLocalId":112951562, + + "operationalState":"ENABLED", + + "administrativeState":"UNLOCKED", + + "cellState":"ACTIVE", + + "pLMNInfoList":[ + + { + + "pLMNId":"310-410", + + "sNSSAI":{ + + "sNSSAI":"001-010000", + + "status":"ACTIVE", + + "globalSubscriberId":null, + + "subscriptionServiceType":null, + + "configData":{ + + "dLThptPerSlice":9, + + "uLThptPerSlice":10, + + "maxNumberOfConns":null, + + "lastUpdatedTS":"2020-11-03T07:41:34.000+0000" + + } + + } + + } + + ], + + "nRPCI":12, + + "nRTAC":310, + + "resourceType":"PRB" + + }, + + { + + "cellLocalId":112951568, + + "operationalState":"ENABLED", + + "administrativeState":"UNLOCKED", + + "cellState":"ACTIVE", + + "pLMNInfoList":[ + + { + + "pLMNId":"310-410", + + "sNSSAI":{ + + "sNSSAI":"001-010000", + + "status":"ACTIVE", + + "globalSubscriberId":null, + + "subscriptionServiceType":null, + + "configData":{ + + "dLThptPerSlice":9, + + "uLThptPerSlice":10, + + "maxNumberOfConns":null, + + "lastUpdatedTS":"2020-11-03T07:41:34.000+0000" + + } + + } + + } + + ], + + "nRPCI":12, + + "nRTAC":310, + + "resourceType":"PRB" + + } + + ], + + "nearRTRICId":null + + } + +] diff --git a/scripts/dcaegen2-services-slice-analysis-ms/sim-data/profile_config_001_00110.json b/scripts/dcaegen2-services-slice-analysis-ms/sim-data/profile_config_001_00110.json new file mode 100644 index 00000000..533095fc --- /dev/null +++ b/scripts/dcaegen2-services-slice-analysis-ms/sim-data/profile_config_001_00110.json @@ -0,0 +1,9 @@ +{ + +"maxNumberOfConns":3000, + +"dLThptPerSlice":50, + +"uLThptPerSlice":40 + +} diff --git a/scripts/dcaegen2-services-slice-analysis-ms/sim-data/profile_config_001_010000.json b/scripts/dcaegen2-services-slice-analysis-ms/sim-data/profile_config_001_010000.json new file mode 100644 index 00000000..422a6fa3 --- /dev/null +++ b/scripts/dcaegen2-services-slice-analysis-ms/sim-data/profile_config_001_010000.json @@ -0,0 +1,9 @@ +{ + + "maxNumberOfConns":3000, + + "dLThptPerSlice":54, + + "uLThptPerSlice":60 + +} diff --git a/scripts/dcaegen2-services-slice-analysis-ms/sim-data/slice_config_001_00110.json b/scripts/dcaegen2-services-slice-analysis-ms/sim-data/slice_config_001_00110.json new file mode 100644 index 00000000..013318a2 --- /dev/null +++ b/scripts/dcaegen2-services-slice-analysis-ms/sim-data/slice_config_001_00110.json @@ -0,0 +1,15 @@ +{ + +"11":{ + +"dLThptPerSlice":20, + +"uLThptPerSlice":15, + +"maxNumberOfConns":null, + +"lastUpdatedTS":"2020-10-13T12:01:34.000+0000" + +} + +} diff --git a/scripts/dcaegen2-services-slice-analysis-ms/sim-data/slice_config_001_010000.json b/scripts/dcaegen2-services-slice-analysis-ms/sim-data/slice_config_001_010000.json new file mode 100644 index 00000000..7d326c20 --- /dev/null +++ b/scripts/dcaegen2-services-slice-analysis-ms/sim-data/slice_config_001_010000.json @@ -0,0 +1,27 @@ +{ + + "22":{ + + "dLThptPerSlice":27, + + "uLThptPerSlice":30, + + "maxNumberOfConns":3000, + + "lastUpdatedTS":"2020-11-03T07:40:45.000+0000" + + }, + + "11":{ + + "dLThptPerSlice":27, + + "uLThptPerSlice":30, + + "maxNumberOfConns":3000, + + "lastUpdatedTS":"2020-11-03T07:40:28.000+0000" + + } + +} diff --git a/scripts/dcaegen2-services-slice-analysis-ms/sim-data/subscriber-details_001_00110.json b/scripts/dcaegen2-services-slice-analysis-ms/sim-data/subscriber-details_001_00110.json new file mode 100644 index 00000000..5149513e --- /dev/null +++ b/scripts/dcaegen2-services-slice-analysis-ms/sim-data/subscriber-details_001_00110.json @@ -0,0 +1,13 @@ +{ + +"subscriptionServiceType":"Premium", + +"sliceProfileId":"878f32c0-3699-4dbd-95a3-1f01d6c763fd", + +"ranNFNSSIId":"3f2f23fa-c567-4dd8-8f15-f95ae3e6fd82", + +"globalSubscriberId":"Customer-001", + +"sNSSAI":"001-00110" + +} diff --git a/scripts/dcaegen2-services-slice-analysis-ms/sim-data/subscriber-details_001_010000.json b/scripts/dcaegen2-services-slice-analysis-ms/sim-data/subscriber-details_001_010000.json new file mode 100644 index 00000000..e7026672 --- /dev/null +++ b/scripts/dcaegen2-services-slice-analysis-ms/sim-data/subscriber-details_001_010000.json @@ -0,0 +1,13 @@ +{ + + "subscriptionServiceType":"Premium", + + "sliceProfileId":"878f32c0-3699-4dbd-95a3-1f01d6c763fd", + + "ranNFNSSIId":"3f2f23fa-c567-4dd8-8f15-f95ae3e6fd82", + + "globalSubscriberId":"Customer-001", + + "sNSSAI":"001-010000" + +} diff --git a/scripts/dcaegen2-services-slice-analysis-ms/slice-analysis-ms/Dockerfile b/scripts/dcaegen2-services-slice-analysis-ms/slice-analysis-ms/Dockerfile new file mode 100644 index 00000000..52d54a57 --- /dev/null +++ b/scripts/dcaegen2-services-slice-analysis-ms/slice-analysis-ms/Dockerfile @@ -0,0 +1,15 @@ +FROM python:alpine3.7 + +ADD configdb-sim.py / + +ADD ./sim-data / + +RUN pip install Flask --trusted-host pypi.org --trusted-host files.pythonhosted.org + +RUN pip install requests --trusted-host pypi.org --trusted-host files.pythonhosted.org + +EXPOSE 5000 + +CMD ["flask", "run", "--host", "0.0.0.0"] + +CMD [ "python", "./configdb-sim.py" ] diff --git a/scripts/dcaegen2-services-slice-analysis-ms/slice-analysis-ms/configdb-sim.py b/scripts/dcaegen2-services-slice-analysis-ms/slice-analysis-ms/configdb-sim.py new file mode 100644 index 00000000..bcda08d5 --- /dev/null +++ b/scripts/dcaegen2-services-slice-analysis-ms/slice-analysis-ms/configdb-sim.py @@ -0,0 +1,115 @@ +import flask +import json +from flask import Flask, render_template +from flask import request +from flask import jsonify +import requests +import threading +import time + +app = flask.Flask(__name__) +app.config["DEBUG"] = True + + +def get_du_list_for_nssai(snssai): + if str(snssai) == '001-00110': + with open('du_list_001_00110.json') as du_list: + data = json.load(du_list) + else: + with open('du_list_001_010000.json') as du_list: + data = json.load(du_list) + if not data: + return {"Error": "Unable to read file"}, 503 + return data, None + + +def get_du_cell_list_for_nssai(snssai): + if str(snssai) == '001-00110': + with open('du_cell_list_001_00110.json') as du_cell_list: + data = json.load(du_cell_list) + else: + with open('du_cell_list_001_010000.json') as du_cell_list: + data = json.load(du_cell_list) + if not data: + return {"Error": "Unable to read file"}, 503 + return data, None + + +def get_slice_config_for_nssai(snssai): + if str(snssai) == '001-00110': + with open('slice_config_001_00110.json') as slice_config: + data = json.load(slice_config) + else: + with open('slice_config_001_010000.json') as slice_config: + data = json.load(slice_config) + if not data: + return {"Error": "Unable to read file"}, 503 + return data, None + + +def get_profile_config_for_nssai(snssai): + if str(snssai) == '001-00110': + with open('profile_config_001_00110.json') as profile_config: + data = json.load(profile_config) + else: + with open('profile_config_001_010000.json') as profile_config: + data = json.load(profile_config) + if not data: + return {"Error": "Unable to read file"}, 503 + return data, None + + +def get_subscriber_details_for_nssai(snssai): + if str(snssai) == '001-00110': + with open('subscriber-details_001_00110.json') as subscriber_details: + data = json.load(subscriber_details) + else: + with open('subscriber-details_001_010000.json') as subscriber_details: + data = json.load(subscriber_details) + if not data: + return {"Error": "Unable to read file"}, 503 + return data, None + + +@app.route("/api/sdnc-config-db/v4/du-list/", methods=["GET"]) +def get_du_list(snssai): + data, status = get_du_list_for_nssai(snssai) + if not status: + return jsonify(data) + return data, 503 + + +@app.route("/api/sdnc-config-db/v4/du-cell-list/", methods=["GET"]) +def get_du_cell_list(snssai): + data, status = get_du_cell_list_for_nssai(snssai) + if not status: + return jsonify(data) + return data, 503 + + +@app.route("/api/sdnc-config-db/v4/slice-config/", methods=["GET"]) +def get_slice_config(snssai): + data, status = get_slice_config_for_nssai(snssai) + if not status: + return jsonify(data) + return data, 503 + + +@app.route("/api/sdnc-config-db/v4/profile-config/", methods=["GET"]) +def get_profile_config(snssai): + data, status = get_profile_config_for_nssai(snssai) + if not status: + return jsonify(data) + return data, 503 + + +@app.route("/api/sdnc-config-db/v4/subscriber-details/", + methods=["GET"]) +def get_subscriber_details(snssai): + data, status = get_subscriber_details_for_nssai(snssai) + if not status: + return jsonify(data) + return data, 503 + + +app.run(host='0.0.0.0') diff --git a/scripts/dcaegen2-services-slice-analysis-ms/slice-analysis-ms/sim-data/du_cell_list_001_00110.json b/scripts/dcaegen2-services-slice-analysis-ms/slice-analysis-ms/sim-data/du_cell_list_001_00110.json new file mode 100644 index 00000000..f01f0b98 --- /dev/null +++ b/scripts/dcaegen2-services-slice-analysis-ms/slice-analysis-ms/sim-data/du_cell_list_001_00110.json @@ -0,0 +1,111 @@ +{ + +"11":[ + +{ + +"cellLocalId":103593999, + +"operationalState":"ENABLED", + +"administrativeState":"UNLOCKED", + +"cellState":"ACTIVE", + +"pLMNInfoList":[ + +{ + +"pLMNId":"310-410", + +"sNSSAI":{ + +"sNSSAI":"001-00110", + +"status":"ACTIVE", + +"globalSubscriberId":null, + +"subscriptionServiceType":null, + +"configData":{ + +"dLThptPerSlice":20, + +"uLThptPerSlice":15, + +"maxNumberOfConns":null, + +"lastUpdatedTS":"2020-10-13T07:02:28.000+0000" + +} + +} + +} + +], + +"nRPCI":12, + +"nRTAC":310, + +"resourceType":"PRB" + +}, + +{ + +"cellLocalId":103593989, + +"operationalState":"ENABLED", + +"administrativeState":"UNLOCKED", + +"cellState":"ACTIVE", + +"pLMNInfoList":[ + +{ + +"pLMNId":"310-410", + +"sNSSAI":{ + +"sNSSAI":"001-00110", + +"status":"ACTIVE", + +"globalSubscriberId":null, + +"subscriptionServiceType":null, + +"configData":{ + +"dLThptPerSlice":20, + +"uLThptPerSlice":15, + +"maxNumberOfConns":null, + +"lastUpdatedTS":"2020-10-13T12:03:56.000+0000" + +} + +} + +} + +], + +"nRPCI":12, + +"nRTAC":310, + +"resourceType":"PRB" + +} + +] + +} diff --git a/scripts/dcaegen2-services-slice-analysis-ms/slice-analysis-ms/sim-data/du_cell_list_001_010000.json b/scripts/dcaegen2-services-slice-analysis-ms/slice-analysis-ms/sim-data/du_cell_list_001_010000.json new file mode 100644 index 00000000..54b2b7c5 --- /dev/null +++ b/scripts/dcaegen2-services-slice-analysis-ms/slice-analysis-ms/sim-data/du_cell_list_001_010000.json @@ -0,0 +1,323 @@ +{ + + "22":[ + + { + + "cellLocalId":112951562, + + "operationalState":"ENABLED", + + "administrativeState":"UNLOCKED", + + "cellState":"ACTIVE", + + "pLMNInfoList":[ + + { + + "pLMNId":"310-410", + + "sNSSAI":{ + + "sNSSAI":"001-010000", + + "status":"ACTIVE", + + "globalSubscriberId":null, + + "subscriptionServiceType":null, + + "configData":{ + + "dLThptPerSlice":9, + + "uLThptPerSlice":10, + + "maxNumberOfConns":null, + + "lastUpdatedTS":"2020-11-03T07:41:34.000+0000" + + } + + } + + } + + ], + + "nRPCI":12, + + "nRTAC":310, + + "resourceType":"PRB" + + }, + + { + + "cellLocalId":112951561, + + "operationalState":"ENABLED", + + "administrativeState":"UNLOCKED", + + "cellState":"ACTIVE", + + "pLMNInfoList":[ + + { + + "pLMNId":"310-410", + + "sNSSAI":{ + + "sNSSAI":"001-010000", + + "status":"ACTIVE", + + "globalSubscriberId":null, + + "subscriptionServiceType":null, + + "configData":{ + + "dLThptPerSlice":9, + + "uLThptPerSlice":10, + + "maxNumberOfConns":null, + + "lastUpdatedTS":"2020-11-03T07:41:34.000+0000" + + } + + } + + } + + ], + + "nRPCI":12, + + "nRTAC":310, + + "resourceType":"PRB" + + }, + + { + + "cellLocalId":112951568, + + "operationalState":"ENABLED", + + "administrativeState":"UNLOCKED", + + "cellState":"ACTIVE", + + "pLMNInfoList":[ + + { + + "pLMNId":"310-410", + + "sNSSAI":{ + + "sNSSAI":"001-010000", + + "status":"ACTIVE", + + "globalSubscriberId":null, + + "subscriptionServiceType":null, + + "configData":{ + + "dLThptPerSlice":9, + + "uLThptPerSlice":10, + + "maxNumberOfConns":null, + + "lastUpdatedTS":"2020-11-03T07:41:34.000+0000" + + } + + } + + } + + ], + + "nRPCI":12, + + "nRTAC":310, + + "resourceType":"PRB" + + } + + ], + + "11":[ + + { + + "cellLocalId":95697174, + + "operationalState":"ENABLED", + + "administrativeState":"UNLOCKED", + + "cellState":"ACTIVE", + + "pLMNInfoList":[ + + { + + "pLMNId":"310-410", + + "sNSSAI":{ + + "sNSSAI":"001-010000", + + "status":"ACTIVE", + + "globalSubscriberId":null, + + "subscriptionServiceType":null, + + "configData":{ + + "dLThptPerSlice":9, + + "uLThptPerSlice":10, + + "maxNumberOfConns":null, + + "lastUpdatedTS":"2020-11-03T07:41:13.000+0000" + + } + + } + + } + + ], + + "nRPCI":12, + + "nRTAC":310, + + "resourceType":"PRB" + + }, + + { + + "cellLocalId":95697175, + + "operationalState":"ENABLED", + + "administrativeState":"UNLOCKED", + + "cellState":"ACTIVE", + + "pLMNInfoList":[ + + { + + "pLMNId":"310-410", + + "sNSSAI":{ + + "sNSSAI":"001-010000", + + "status":"ACTIVE", + + "globalSubscriberId":null, + + "subscriptionServiceType":null, + + "configData":{ + + "dLThptPerSlice":9, + + "uLThptPerSlice":10, + + "maxNumberOfConns":null, + + "lastUpdatedTS":"2020-11-03T07:41:13.000+0000" + + } + + } + + } + + ], + + "nRPCI":12, + + "nRTAC":310, + + "resourceType":"PRB" + + }, + + { + + "cellLocalId":95697155, + + "operationalState":"ENABLED", + + "administrativeState":"UNLOCKED", + + "cellState":"ACTIVE", + + "pLMNInfoList":[ + + { + + "pLMNId":"310-410", + + "sNSSAI":{ + + "sNSSAI":"001-010000", + + "status":"ACTIVE", + + "globalSubscriberId":null, + + "subscriptionServiceType":null, + + "configData":{ + + "dLThptPerSlice":9, + + "uLThptPerSlice":10, + + "maxNumberOfConns":null, + + "lastUpdatedTS":"2020-11-03T07:41:13.000+0000" + + } + + } + + } + + ], + + "nRPCI":12, + + "nRTAC":310, + + "resourceType":"PRB" + + } + + ] + +} diff --git a/scripts/dcaegen2-services-slice-analysis-ms/slice-analysis-ms/sim-data/du_list_001_00110.json b/scripts/dcaegen2-services-slice-analysis-ms/slice-analysis-ms/sim-data/du_list_001_00110.json new file mode 100644 index 00000000..a4c6f2ff --- /dev/null +++ b/scripts/dcaegen2-services-slice-analysis-ms/slice-analysis-ms/sim-data/du_list_001_00110.json @@ -0,0 +1,129 @@ +[ + +{ + +"gNBDUId":1, + +"gNBId":98763, + +"gNBIdLength":5, + +"gNBDUName":"gnduserver1", + +"pLMNId":"310-410", + +"nFType":"DU", + +"cellDUList":[ + +{ + +"cellLocalId":103593989, + +"operationalState":"ENABLED", + +"administrativeState":"UNLOCKED", + +"cellState":"ACTIVE", + +"pLMNInfoList":[ + +{ + +"pLMNId":"310-410", + +"sNSSAI":{ + +"sNSSAI":"001-00110", + +"status":"ACTIVE", + +"globalSubscriberId":null, + +"subscriptionServiceType":null, + +"configData":{ + +"dLThptPerSlice":20, + +"uLThptPerSlice":15, + +"maxNumberOfConns":null, + +"lastUpdatedTS":"2020-10-13T12:03:56.000+0000" + +} + +} + +} + +], + +"nRPCI":12, + +"nRTAC":310, + +"resourceType":"PRB" + +}, + +{ + +"cellLocalId":103593999, + +"operationalState":"ENABLED", + +"administrativeState":"UNLOCKED", + +"cellState":"ACTIVE", + +"pLMNInfoList":[ + +{ + +"pLMNId":"310-410", + +"sNSSAI":{ + +"sNSSAI":"001-00110", + +"status":"ACTIVE", + +"globalSubscriberId":null, + +"subscriptionServiceType":null, + +"configData":{ + +"dLThptPerSlice":20, + +"uLThptPerSlice":15, + +"maxNumberOfConns":null, + +"lastUpdatedTS":"2020-10-13T07:02:28.000+0000" + +} + +} + +} + +], + +"nRPCI":12, + +"nRTAC":310, + +"resourceType":"PRB" + +} + +], + +"nearRTRICId":null + +} + +] diff --git a/scripts/dcaegen2-services-slice-analysis-ms/slice-analysis-ms/sim-data/du_list_001_010000.json b/scripts/dcaegen2-services-slice-analysis-ms/slice-analysis-ms/sim-data/du_list_001_010000.json new file mode 100644 index 00000000..82d7fb1a --- /dev/null +++ b/scripts/dcaegen2-services-slice-analysis-ms/slice-analysis-ms/sim-data/du_list_001_010000.json @@ -0,0 +1,359 @@ +[ + + { + + "gNBDUId":2, + + "gNBId":98763, + + "gNBIdLength":5, + + "gNBDUName":"gnduserver2", + + "pLMNId":"310-410", + + "nFType":"DU", + + "cellDUList":[ + + { + + "cellLocalId":95697155, + + "operationalState":"ENABLED", + + "administrativeState":"UNLOCKED", + + "cellState":"ACTIVE", + + "pLMNInfoList":[ + + { + + "pLMNId":"310-410", + + "sNSSAI":{ + + "sNSSAI":"001-010000", + + "status":"ACTIVE", + + "globalSubscriberId":null, + + "subscriptionServiceType":null, + + "configData":{ + + "dLThptPerSlice":9, + + "uLThptPerSlice":10, + + "maxNumberOfConns":null, + + "lastUpdatedTS":"2020-11-03T07:41:13.000+0000" + + } + + } + + } + + ], + + "nRPCI":12, + + "nRTAC":310, + + "resourceType":"PRB" + + }, + + { + + "cellLocalId":95697174, + + "operationalState":"ENABLED", + + "administrativeState":"UNLOCKED", + + "cellState":"ACTIVE", + + "pLMNInfoList":[ + + { + + "pLMNId":"310-410", + + "sNSSAI":{ + + "sNSSAI":"001-010000", + + "status":"ACTIVE", + + "globalSubscriberId":null, + + "subscriptionServiceType":null, + + "configData":{ + + "dLThptPerSlice":9, + + "uLThptPerSlice":10, + + "maxNumberOfConns":null, + + "lastUpdatedTS":"2020-11-03T07:41:13.000+0000" + + } + + } + + } + + ], + + "nRPCI":12, + + "nRTAC":310, + + "resourceType":"PRB" + + }, + + { + + "cellLocalId":95697175, + + "operationalState":"ENABLED", + + "administrativeState":"UNLOCKED", + + "cellState":"ACTIVE", + + "pLMNInfoList":[ + + { + + "pLMNId":"310-410", + + "sNSSAI":{ + + "sNSSAI":"001-010000", + + "status":"ACTIVE", + + "globalSubscriberId":null, + + "subscriptionServiceType":null, + + "configData":{ + + "dLThptPerSlice":9, + + "uLThptPerSlice":10, + + "maxNumberOfConns":null, + + "lastUpdatedTS":"2020-11-03T07:41:13.000+0000" + + } + + } + + } + + ], + + "nRPCI":12, + + "nRTAC":310, + + "resourceType":"PRB" + + } + + ], + + "nearRTRICId":null + + }, + + { + + "gNBDUId":4, + + "gNBId":98763, + + "gNBIdLength":5, + + "gNBDUName":"gnduserver4", + + "pLMNId":"310-410", + + "nFType":"DU", + + "cellDUList":[ + + { + + "cellLocalId":112951561, + + "operationalState":"ENABLED", + + "administrativeState":"UNLOCKED", + + "cellState":"ACTIVE", + + "pLMNInfoList":[ + + { + + "pLMNId":"310-410", + + "sNSSAI":{ + + "sNSSAI":"001-010000", + + "status":"ACTIVE", + + "globalSubscriberId":null, + + "subscriptionServiceType":null, + + "configData":{ + + "dLThptPerSlice":9, + + "uLThptPerSlice":10, + + "maxNumberOfConns":null, + + "lastUpdatedTS":"2020-11-03T07:41:34.000+0000" + + } + + } + + } + + ], + + "nRPCI":12, + + "nRTAC":310, + + "resourceType":"PRB" + + }, + + { + + "cellLocalId":112951562, + + "operationalState":"ENABLED", + + "administrativeState":"UNLOCKED", + + "cellState":"ACTIVE", + + "pLMNInfoList":[ + + { + + "pLMNId":"310-410", + + "sNSSAI":{ + + "sNSSAI":"001-010000", + + "status":"ACTIVE", + + "globalSubscriberId":null, + + "subscriptionServiceType":null, + + "configData":{ + + "dLThptPerSlice":9, + + "uLThptPerSlice":10, + + "maxNumberOfConns":null, + + "lastUpdatedTS":"2020-11-03T07:41:34.000+0000" + + } + + } + + } + + ], + + "nRPCI":12, + + "nRTAC":310, + + "resourceType":"PRB" + + }, + + { + + "cellLocalId":112951568, + + "operationalState":"ENABLED", + + "administrativeState":"UNLOCKED", + + "cellState":"ACTIVE", + + "pLMNInfoList":[ + + { + + "pLMNId":"310-410", + + "sNSSAI":{ + + "sNSSAI":"001-010000", + + "status":"ACTIVE", + + "globalSubscriberId":null, + + "subscriptionServiceType":null, + + "configData":{ + + "dLThptPerSlice":9, + + "uLThptPerSlice":10, + + "maxNumberOfConns":null, + + "lastUpdatedTS":"2020-11-03T07:41:34.000+0000" + + } + + } + + } + + ], + + "nRPCI":12, + + "nRTAC":310, + + "resourceType":"PRB" + + } + + ], + + "nearRTRICId":null + + } + +] diff --git a/scripts/dcaegen2-services-slice-analysis-ms/slice-analysis-ms/sim-data/profile_config_001_00110.json b/scripts/dcaegen2-services-slice-analysis-ms/slice-analysis-ms/sim-data/profile_config_001_00110.json new file mode 100644 index 00000000..533095fc --- /dev/null +++ b/scripts/dcaegen2-services-slice-analysis-ms/slice-analysis-ms/sim-data/profile_config_001_00110.json @@ -0,0 +1,9 @@ +{ + +"maxNumberOfConns":3000, + +"dLThptPerSlice":50, + +"uLThptPerSlice":40 + +} diff --git a/scripts/dcaegen2-services-slice-analysis-ms/slice-analysis-ms/sim-data/profile_config_001_010000.json b/scripts/dcaegen2-services-slice-analysis-ms/slice-analysis-ms/sim-data/profile_config_001_010000.json new file mode 100644 index 00000000..422a6fa3 --- /dev/null +++ b/scripts/dcaegen2-services-slice-analysis-ms/slice-analysis-ms/sim-data/profile_config_001_010000.json @@ -0,0 +1,9 @@ +{ + + "maxNumberOfConns":3000, + + "dLThptPerSlice":54, + + "uLThptPerSlice":60 + +} diff --git a/scripts/dcaegen2-services-slice-analysis-ms/slice-analysis-ms/sim-data/slice_config_001_00110.json b/scripts/dcaegen2-services-slice-analysis-ms/slice-analysis-ms/sim-data/slice_config_001_00110.json new file mode 100644 index 00000000..013318a2 --- /dev/null +++ b/scripts/dcaegen2-services-slice-analysis-ms/slice-analysis-ms/sim-data/slice_config_001_00110.json @@ -0,0 +1,15 @@ +{ + +"11":{ + +"dLThptPerSlice":20, + +"uLThptPerSlice":15, + +"maxNumberOfConns":null, + +"lastUpdatedTS":"2020-10-13T12:01:34.000+0000" + +} + +} diff --git a/scripts/dcaegen2-services-slice-analysis-ms/slice-analysis-ms/sim-data/slice_config_001_010000.json b/scripts/dcaegen2-services-slice-analysis-ms/slice-analysis-ms/sim-data/slice_config_001_010000.json new file mode 100644 index 00000000..7d326c20 --- /dev/null +++ b/scripts/dcaegen2-services-slice-analysis-ms/slice-analysis-ms/sim-data/slice_config_001_010000.json @@ -0,0 +1,27 @@ +{ + + "22":{ + + "dLThptPerSlice":27, + + "uLThptPerSlice":30, + + "maxNumberOfConns":3000, + + "lastUpdatedTS":"2020-11-03T07:40:45.000+0000" + + }, + + "11":{ + + "dLThptPerSlice":27, + + "uLThptPerSlice":30, + + "maxNumberOfConns":3000, + + "lastUpdatedTS":"2020-11-03T07:40:28.000+0000" + + } + +} diff --git a/scripts/dcaegen2-services-slice-analysis-ms/slice-analysis-ms/sim-data/subscriber-details_001_00110.json b/scripts/dcaegen2-services-slice-analysis-ms/slice-analysis-ms/sim-data/subscriber-details_001_00110.json new file mode 100644 index 00000000..5149513e --- /dev/null +++ b/scripts/dcaegen2-services-slice-analysis-ms/slice-analysis-ms/sim-data/subscriber-details_001_00110.json @@ -0,0 +1,13 @@ +{ + +"subscriptionServiceType":"Premium", + +"sliceProfileId":"878f32c0-3699-4dbd-95a3-1f01d6c763fd", + +"ranNFNSSIId":"3f2f23fa-c567-4dd8-8f15-f95ae3e6fd82", + +"globalSubscriberId":"Customer-001", + +"sNSSAI":"001-00110" + +} diff --git a/scripts/dcaegen2-services-slice-analysis-ms/slice-analysis-ms/sim-data/subscriber-details_001_010000.json b/scripts/dcaegen2-services-slice-analysis-ms/slice-analysis-ms/sim-data/subscriber-details_001_010000.json new file mode 100644 index 00000000..e7026672 --- /dev/null +++ b/scripts/dcaegen2-services-slice-analysis-ms/slice-analysis-ms/sim-data/subscriber-details_001_010000.json @@ -0,0 +1,13 @@ +{ + + "subscriptionServiceType":"Premium", + + "sliceProfileId":"878f32c0-3699-4dbd-95a3-1f01d6c763fd", + + "ranNFNSSIId":"3f2f23fa-c567-4dd8-8f15-f95ae3e6fd82", + + "globalSubscriberId":"Customer-001", + + "sNSSAI":"001-010000" + +} diff --git a/tests/dcaegen2-services-slice-analysis-ms/testcases/data/expected_ml_payload.json b/tests/dcaegen2-services-slice-analysis-ms/testcases/data/expected_ml_payload.json new file mode 100644 index 00000000..73425aaf --- /dev/null +++ b/tests/dcaegen2-services-slice-analysis-ms/testcases/data/expected_ml_payload.json @@ -0,0 +1 @@ +{"name":"3f2f23fa-c567-4dd8-8f15-f95ae3e6fd82","serviceInstanceID":"3f2f23fa-c567-4dd8-8f15-f95ae3e6fd82","globalSubscriberId":"Customer-001","subscriptionServiceType":"Premium","networkType":"AN","additionalProperties":{"modifyAction":"reconfigure","snssaiList":["001-00110"],"sliceProfileId":"878f32c0-3699-4dbd-95a3-1f01d6c763fd","resourceConfig":{"snssai":"001-00110","data":[{"gNBCUName":"cucpserver1","nearRTRICId":"11","cellCUList":[{"cellLocalId":103593989,"configData":{"maxNumberofConns":"20","predictedMaxNumberofConns":"25","lastUpdatedTS":"yyyy/MM/dd HH:mm:ss"}}]}]},"nsiInfo":{"nsiName":"","nsiId":"23b250a7-61f3-460a-9bb2-d35923148541"},"scriptName":"AN"}} diff --git a/tests/dcaegen2-services-slice-analysis-ms/testcases/data/expected_ml_response.json b/tests/dcaegen2-services-slice-analysis-ms/testcases/data/expected_ml_response.json new file mode 100644 index 00000000..576fc891 --- /dev/null +++ b/tests/dcaegen2-services-slice-analysis-ms/testcases/data/expected_ml_response.json @@ -0,0 +1 @@ +{"closedLoopControlName":"ControlLoop-Slicing-116d7b00-dbeb-4d03-8719-d0a658fa735b","closedLoopAlarmStart":1604468227374,"closedLoopEventClient":"microservice.sliceAnalysisMS","closedLoopEventStatus":"ONSET","requestID":"0196f8a4-117b-4e51-b013-92e0b7ad95a8","target":"vserver.vserver-name","payload":{"name":"3f2f23fa-c567-4dd8-8f15-f95ae3e6fd82","serviceInstanceID":"3f2f23fa-c567-4dd8-8f15-f95ae3e6fd82","globalSubscriberId":"Customer-001","subscriptionServiceType":"Premium","networkType":"AN","additionalProperties":{"modifyAction":"reconfigure","snssaiList":["001-00110"],"sliceProfileId":"878f32c0-3699-4dbd-95a3-1f01d6c763fd","resourceConfig":{"snssai":"001-00110","data":[{"gNBCUName":"cucpserver1","nearRTRICId":"11","cellCUList":[{"cellLocalId":103593989,"configData":{"maxNumberofConns":"20","predictedMaxNumberofConns":"25","lastUpdatedTS":"yyyy/MM/dd HH:mm:ss"}}]}]},"nsiInfo":{"nsiName":"","nsiId":"2d43ff64-76bd-437b-ab98-1e7aa3e5df5f"},"scriptName":"AN"}},"from":"DCAE","version":"1.0.2","target_type":"VNF","AAI":{"vserver.is-closed-loop-disabled":"false","vserver.prov-status":"ACTIVE","vserver.vserver-name":"3f2f23fa-c567-4dd8-8f15-f95ae3e6fd82"}} diff --git a/tests/dcaegen2-services-slice-analysis-ms/testcases/data/expected_payload_pm1.json b/tests/dcaegen2-services-slice-analysis-ms/testcases/data/expected_payload_pm1.json new file mode 100644 index 00000000..545b90c7 --- /dev/null +++ b/tests/dcaegen2-services-slice-analysis-ms/testcases/data/expected_payload_pm1.json @@ -0,0 +1 @@ +{"name":"3f2f23fa-c567-4dd8-8f15-f95ae3e6fd82","serviceInstanceID":"3f2f23fa-c567-4dd8-8f15-f95ae3e6fd82","globalSubscriberId":"Customer-001","subscriptionServiceType":"Premium","networkType":"AN","additionalProperties":{"modifyAction":"reconfigure","snssaiList":["001-00110"],"sliceProfileId":"878f32c0-3699-4dbd-95a3-1f01d6c763fd","resourceConfig":{"11":{"dLThptPerSlice":50,"uLThptPerSlice":40}},"nsiInfo":{"nsiName":"","nsiId":"b149c982-a124-4aaf-a917-89c32ec7b284"},"scriptName":"AN"}} diff --git a/tests/dcaegen2-services-slice-analysis-ms/testcases/data/expected_payload_pm2.json b/tests/dcaegen2-services-slice-analysis-ms/testcases/data/expected_payload_pm2.json new file mode 100644 index 00000000..b1ea24b1 --- /dev/null +++ b/tests/dcaegen2-services-slice-analysis-ms/testcases/data/expected_payload_pm2.json @@ -0,0 +1 @@ +{"name":"3f2f23fa-c567-4dd8-8f15-f95ae3e6fd82","serviceInstanceID":"3f2f23fa-c567-4dd8-8f15-f95ae3e6fd82","globalSubscriberId":"Customer-001","subscriptionServiceType":"Premium","networkType":"AN","additionalProperties":{"modifyAction":"reconfigure","snssaiList":["001-010000"],"sliceProfileId":"878f32c0-3699-4dbd-95a3-1f01d6c763fd","resourceConfig":{"11":{"dLThptPerSlice":29,"uLThptPerSlice":32},"22":{"dLThptPerSlice":25,"uLThptPerSlice":28}},"nsiInfo":{"nsiName":"","nsiId":"493bf7aa-59a5-4f72-b1bc-f1bad9fc8600"},"scriptName":"AN"}} diff --git a/tests/dcaegen2-services-slice-analysis-ms/testcases/data/expected_pm.json b/tests/dcaegen2-services-slice-analysis-ms/testcases/data/expected_pm.json new file mode 100644 index 00000000..a1b49165 --- /dev/null +++ b/tests/dcaegen2-services-slice-analysis-ms/testcases/data/expected_pm.json @@ -0,0 +1 @@ +{"closedLoopControlName":"ControlLoop-Slicing-116d7b00-dbeb-4d03-8719-d0a658fa735b","closedLoopAlarmStart":1608198244852,"closedLoopEventClient":"microservice.sliceAnalysisMS","closedLoopEventStatus":"ONSET","requestID":"4fae9c22-59f1-47e8-a8a2-c4cbb79418cc","target":"vserver.vserver-name","payload":{"name":"3f2f23fa-c567-4dd8-8f15-f95ae3e6fd82","serviceInstanceID":"3f2f23fa-c567-4dd8-8f15-f95ae3e6fd82","globalSubscriberId":"Customer-001","subscriptionServiceType":"Premium","networkType":"AN","additionalProperties":{"modifyAction":"reconfigure","snssaiList":["001-010000"],"sliceProfileId":"878f32c0-3699-4dbd-95a3-1f01d6c763fd","resourceConfig":{"11":{"dLThptPerSlice":29,"uLThptPerSlice":32},"22":{"dLThptPerSlice":25,"uLThptPerSlice":28}},"nsiInfo":{"nsiName":"","nsiId":"f61681df-cbbe-4851-9ab6-fab24c8c77b4"},"scriptName":"AN"}},"from":"DCAE","version":"1.0.2","target_type":"VNF","AAI":{"vserver.is-closed-loop-disabled":"false","vserver.prov-status":"ACTIVE","vserver.vserver-name":"3f2f23fa-c567-4dd8-8f15-f95ae3e6fd82"}} diff --git a/tests/dcaegen2-services-slice-analysis-ms/testcases/data/expected_pm1.json b/tests/dcaegen2-services-slice-analysis-ms/testcases/data/expected_pm1.json new file mode 100644 index 00000000..bd4ca924 --- /dev/null +++ b/tests/dcaegen2-services-slice-analysis-ms/testcases/data/expected_pm1.json @@ -0,0 +1 @@ +{"closedLoopControlName":"ControlLoop-Slicing-116d7b00-dbeb-4d03-8719-d0a658fa735b","closedLoopAlarmStart":1604494201291,"closedLoopEventClient":"microservice.sliceAnalysisMS","closedLoopEventStatus":"ONSET","requestID":"0afb48b6-db08-45d6-aff3-675255f51ed5","target":"vserver.vserver-name","payload":{"name":"3f2f23fa-c567-4dd8-8f15-f95ae3e6fd82","serviceInstanceID":"3f2f23fa-c567-4dd8-8f15-f95ae3e6fd82","globalSubscriberId":"Customer-001","subscriptionServiceType":"Premium","networkType":"AN","additionalProperties":{"modifyAction":"reconfigure","snssaiList":["001-00110"],"sliceProfileId":"878f32c0-3699-4dbd-95a3-1f01d6c763fd","resourceConfig":{"11":{"dLThptPerSlice":50,"uLThptPerSlice":40}},"nsiInfo":{"nsiName":"","nsiId":"a7f1242d-5889-46c3-bb0a-800c6ae388d1"},"scriptName":"AN"}},"from":"DCAE","version":"1.0.2","target_type":"VNF","AAI":{"vserver.is-closed-loop-disabled":"false","vserver.prov-status":"ACTIVE","vserver.vserver-name":"3f2f23fa-c567-4dd8-8f15-f95ae3e6fd82"}} diff --git a/tests/dcaegen2-services-slice-analysis-ms/testcases/data/expected_pm2.json b/tests/dcaegen2-services-slice-analysis-ms/testcases/data/expected_pm2.json new file mode 100644 index 00000000..bd4ca924 --- /dev/null +++ b/tests/dcaegen2-services-slice-analysis-ms/testcases/data/expected_pm2.json @@ -0,0 +1 @@ +{"closedLoopControlName":"ControlLoop-Slicing-116d7b00-dbeb-4d03-8719-d0a658fa735b","closedLoopAlarmStart":1604494201291,"closedLoopEventClient":"microservice.sliceAnalysisMS","closedLoopEventStatus":"ONSET","requestID":"0afb48b6-db08-45d6-aff3-675255f51ed5","target":"vserver.vserver-name","payload":{"name":"3f2f23fa-c567-4dd8-8f15-f95ae3e6fd82","serviceInstanceID":"3f2f23fa-c567-4dd8-8f15-f95ae3e6fd82","globalSubscriberId":"Customer-001","subscriptionServiceType":"Premium","networkType":"AN","additionalProperties":{"modifyAction":"reconfigure","snssaiList":["001-00110"],"sliceProfileId":"878f32c0-3699-4dbd-95a3-1f01d6c763fd","resourceConfig":{"11":{"dLThptPerSlice":50,"uLThptPerSlice":40}},"nsiInfo":{"nsiName":"","nsiId":"a7f1242d-5889-46c3-bb0a-800c6ae388d1"},"scriptName":"AN"}},"from":"DCAE","version":"1.0.2","target_type":"VNF","AAI":{"vserver.is-closed-loop-disabled":"false","vserver.prov-status":"ACTIVE","vserver.vserver-name":"3f2f23fa-c567-4dd8-8f15-f95ae3e6fd82"}} diff --git a/tests/dcaegen2-services-slice-analysis-ms/testcases/data/expected_pm3.json b/tests/dcaegen2-services-slice-analysis-ms/testcases/data/expected_pm3.json new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/tests/dcaegen2-services-slice-analysis-ms/testcases/data/expected_pm3.json @@ -0,0 +1 @@ + diff --git a/tests/dcaegen2-services-slice-analysis-ms/testcases/data/ml_response.json b/tests/dcaegen2-services-slice-analysis-ms/testcases/data/ml_response.json new file mode 100644 index 00000000..d287d036 --- /dev/null +++ b/tests/dcaegen2-services-slice-analysis-ms/testcases/data/ml_response.json @@ -0,0 +1,69 @@ +{ + + + +"snssai":"001-00110", + + + +"data":[ + + + +{ + + + +"gNBCUName":"cucpserver1", + + + +"cellCUList":[ + + + +{ + + + +"cellLocalId":103593989, + + + +"configData":{ + + + +"maxNumberofConns":"20", + + + +"predictedMaxNumberofConns":"25", + + + +"lastUpdatedTS":"yyyy/MM/dd HH:mm:ss" + + + +} + + + +} + + + +] + + + +} + + + +] + + + +} diff --git a/tests/dcaegen2-services-slice-analysis-ms/testcases/data/performance_notification1.json b/tests/dcaegen2-services-slice-analysis-ms/testcases/data/performance_notification1.json new file mode 100644 index 00000000..1919e95d --- /dev/null +++ b/tests/dcaegen2-services-slice-analysis-ms/testcases/data/performance_notification1.json @@ -0,0 +1,56 @@ +{ + "event": { + "commonEventHeader": { + "domain": "perf3gpp", + "eventId": "9e7c7db8-7a51-4bff-94f5-b530296edd7c", + "sequence": 0, + "eventName": "perf3gpp_AcmeNode-Acme_pmMeasResult", + "sourceName": "oteNB5309", + "reportingEntityName": "", + "priority": "Normal", + "startEpochMicrosec": 1538478000000, + "lastEpochMicrosec": 1538478900000, + "version": "4.0", + "vesEventListenerVersion": "7.1", + "timeZoneOffset": "UTC+05:00" + }, + "perf3gppFields": { + "perf3gppFieldsVersion": "1.0", + "measDataCollection": { + "granularityPeriod": 1538482500000, + "measuredEntityUserName": "", + "measuredEntityDn": "1", + "measuredEntitySoftwareVersion": "r0.1", + "measInfoList": [{ + "measInfoId": { + "sMeasInfoId": "some measInfoId" + }, + "measTypes": { + "sMeasTypesList": ["SM.PrbUsedDl.001-00110", "SM.PrbUsedUl.001-00110"] + }, + "measValuesList": [{ + "measObjInstId": "103593989", + "suspectFlag": "false", + "measResults": [{ + "p": 1, + "sValue": "75" + }, { + "p": 2, + "sValue": "84" + }] + }, { + "measObjInstId": "103593999", + "suspectFlag": "false", + "measResults": [{ + "p": 1, + "sValue": "90" + }, { + "p": 2, + "sValue": "95" + }] + }] + }] + } + } + } +} diff --git a/tests/dcaegen2-services-slice-analysis-ms/testcases/data/performance_notification2.json b/tests/dcaegen2-services-slice-analysis-ms/testcases/data/performance_notification2.json new file mode 100644 index 00000000..7ca8a652 --- /dev/null +++ b/tests/dcaegen2-services-slice-analysis-ms/testcases/data/performance_notification2.json @@ -0,0 +1,56 @@ +{ + "event": { + "commonEventHeader": { + "domain": "perf3gpp", + "eventId": "9e7c7db8-7a51-4bff-94f5-b530296edd7c", + "sequence": 0, + "eventName": "perf3gpp_AcmeNode-Acme_pmMeasResult", + "sourceName": "oteNB5309", + "reportingEntityName": "", + "priority": "Normal", + "startEpochMicrosec": 1538478000000, + "lastEpochMicrosec": 1538478900000, + "version": "4.0", + "vesEventListenerVersion": "7.1", + "timeZoneOffset": "UTC+05:00" + }, + "perf3gppFields": { + "perf3gppFieldsVersion": "1.0", + "measDataCollection": { + "granularityPeriod": 1538482500000, + "measuredEntityUserName": "", + "measuredEntityDn": "1", + "measuredEntitySoftwareVersion": "r0.1", + "measInfoList": [{ + "measInfoId": { + "sMeasInfoId": "some measInfoId" + }, + "measTypes": { + "sMeasTypesList": ["SM.PrbUsedDl.001-010000", "SM.PrbUsedUl.001-010000"] + }, + "measValuesList": [{ + "measObjInstId": "103593989", + "suspectFlag": "false", + "measResults": [{ + "p": 1, + "sValue": "75" + }, { + "p": 2, + "sValue": "84" + }] + }, { + "measObjInstId": "103593999", + "suspectFlag": "false", + "measResults": [{ + "p": 1, + "sValue": "90" + }, { + "p": 2, + "sValue": "95" + }] + }] + }] + } + } + } +} diff --git a/tests/dcaegen2-services-slice-analysis-ms/testcases/data/performance_notification3.json b/tests/dcaegen2-services-slice-analysis-ms/testcases/data/performance_notification3.json new file mode 100644 index 00000000..78f5ccb6 --- /dev/null +++ b/tests/dcaegen2-services-slice-analysis-ms/testcases/data/performance_notification3.json @@ -0,0 +1 @@ +{"event": {"commonEventHeader": {"domain":"perf3gpp","eventId": "65e9a550-5f74-4952-bb89-07ce5aa51ce3","sequence": 0,"eventName": "perf3gpp_AcmeNode-Acme_pmMeasResult","sourceName": "oteNB5309","reportingEntityName": "","priority": "Normal","startEpochMicrosec": 1538478000000,"lastEpochMicrosec": 1538478900000,"version": "4.0","vesEventListenerVersion": "7.1","timeZoneOffset": "UTC+05:00"},"perf3gppFields": {"perf3gppFieldsVersion": "1.0","measDataCollection": {"granularityPeriod": 1538482500000,"measuredEntityUserName": "","measuredEntityDn": "2","measuredEntitySoftwareVersion": "r0.1","measInfoList": [{"measInfoId": {"sMeasInfoId": "some measInfoId"},"measTypes": {"sMeasTypesList":["SM.PrbUsedDl.001-010000","SM.PrbUsedUl.001-010000"]},"measValuesList": [{"measObjInstId": "95697155","suspectFlag": "false","measResults": [{"p": 1,"sValue": "80"},{"p": 2,"sValue": "70"}]},{"measObjInstId": "95697175","suspectFlag": "false","measResults": [{"p": 1,"sValue": "82"},{"p": 2,"sValue": "72"}]},{"measObjInstId": "95697174","suspectFlag": "false","measResults": [{"p": 1,"sValue": "85"},{"p": 2,"sValue": "75"}]}]}]}}}} diff --git a/tests/dcaegen2-services-slice-analysis-ms/testcases/data/performance_notification4.json b/tests/dcaegen2-services-slice-analysis-ms/testcases/data/performance_notification4.json new file mode 100644 index 00000000..4f81e9ba --- /dev/null +++ b/tests/dcaegen2-services-slice-analysis-ms/testcases/data/performance_notification4.json @@ -0,0 +1 @@ +{"event": {"commonEventHeader": {"domain": "perf3gpp","eventId": "0556fcae-e684-41fe-b85f-d033a11fe161","sequence": 0,"eventName": "perf3gpp_AcmeNode-Acme_pmMeasResult","sourceName": "oteNB5309","reportingEntityName": "","priority": "Normal","startEpochMicrosec": 1538478000000,"lastEpochMicrosec": 1538478900000,"version": "4.0","vesEventListenerVersion": "7.1","timeZoneOffset": "UTC+05:00"},"perf3gppFields": {"perf3gppFieldsVersion": "1.0","measDataCollection": {"granularityPeriod": 1538482500000,"measuredEntityUserName": "","measuredEntityDn": "2","measuredEntitySoftwareVersion": "r0.1","measInfoList": [{"measInfoId": {"sMeasInfoId": "some measInfoId"},"measTypes": {"sMeasTypesList":["SM.PrbUsedDl.001-010000","SM.PrbUsedUl.001-010000"]},"measValuesList": [{"measObjInstId": "95697155","suspectFlag": "false","measResults": [{"p": 1,"sValue": "81"},{"p": 2,"sValue": "71"}]},{"measObjInstId": "95697175","suspectFlag": "false","measResults": [{"p": 1,"sValue": "83"},{"p": 2,"sValue": "73"}]},{"measObjInstId": "95697174","suspectFlag": "false","measResults": [{"p": 1,"sValue": "86"},{"p": 2,"sValue": "76"}]}]}]}}}} diff --git a/tests/dcaegen2-services-slice-analysis-ms/testcases/data/performance_notification5.json b/tests/dcaegen2-services-slice-analysis-ms/testcases/data/performance_notification5.json new file mode 100644 index 00000000..877d205b --- /dev/null +++ b/tests/dcaegen2-services-slice-analysis-ms/testcases/data/performance_notification5.json @@ -0,0 +1 @@ +{"event": {"commonEventHeader": {"domain": "perf3gpp","eventId": "246cd43f-3e6e-4e54-84cd-c9dcf2723c3c","sequence": 0,"eventName": "perf3gpp_AcmeNode-Acme_pmMeasResult","sourceName": "oteNB5309","reportingEntityName": "","priority": "Normal","startEpochMicrosec": 1538478000000,"lastEpochMicrosec": 1538478900000,"version": "4.0","vesEventListenerVersion": "7.1","timeZoneOffset": "UTC+05:00"},"perf3gppFields": {"perf3gppFieldsVersion": "1.0","measDataCollection": {"granularityPeriod": 1538482500000,"measuredEntityUserName": "","measuredEntityDn": "2","measuredEntitySoftwareVersion": "r0.1","measInfoList": [{"measInfoId": {"sMeasInfoId": "some measInfoId"},"measTypes": {"sMeasTypesList":["SM.PrbUsedDl.001-010000","SM.PrbUsedUl.001-010000"]},"measValuesList": [{"measObjInstId": "95697155","suspectFlag": "false","measResults": [{"p": 1,"sValue": "82"},{"p": 2,"sValue": "72"}]},{"measObjInstId": "95697175","suspectFlag": "false","measResults": [{"p": 1,"sValue": "84"},{"p": 2,"sValue": "74"}]},{"measObjInstId": "95697174","suspectFlag": "false","measResults": [{"p": 1,"sValue": "87"},{"p": 2,"sValue": "77"}]}]}]}}}} diff --git a/tests/dcaegen2-services-slice-analysis-ms/testcases/data/performance_notification6.json b/tests/dcaegen2-services-slice-analysis-ms/testcases/data/performance_notification6.json new file mode 100644 index 00000000..74857e02 --- /dev/null +++ b/tests/dcaegen2-services-slice-analysis-ms/testcases/data/performance_notification6.json @@ -0,0 +1 @@ +{"event": {"commonEventHeader": {"domain": "perf3gpp","eventId": "c37b045f-4339-4ef2-9b64-3b781d6d8378","sequence": 0,"eventName": "perf3gpp_AcmeNode-Acme_pmMeasResult","sourceName": "oteNB5309","reportingEntityName": "","priority": "Normal","startEpochMicrosec": 1538478000000,"lastEpochMicrosec": 1538478900000,"version": "4.0","vesEventListenerVersion": "7.1","timeZoneOffset": "UTC+05:00"},"perf3gppFields": {"perf3gppFieldsVersion": "1.0","measDataCollection": {"granularityPeriod": 1538482500000,"measuredEntityUserName": "","measuredEntityDn": "4","measuredEntitySoftwareVersion": "r0.1","measInfoList": [{"measInfoId": {"sMeasInfoId": "some measInfoId"},"measTypes": {"sMeasTypesList":["SM.PrbUsedDl.001-010000","SM.PrbUsedUl.001-010000"]},"measValuesList": [{"measObjInstId": "112951561","suspectFlag": "false","measResults": [{"p": 1,"sValue": "70"},{"p": 2,"sValue": "60"}]},{"measObjInstId": "112951562","suspectFlag": "false","measResults": [{"p": 1,"sValue": "72"},{"p": 2,"sValue": "63"}]},{"measObjInstId": "112951568","suspectFlag": "false","measResults": [{"p": 1,"sValue": "75"},{"p": 2,"sValue": "65"}]}]}]}}}} diff --git a/tests/dcaegen2-services-slice-analysis-ms/testcases/data/performance_notification7.json b/tests/dcaegen2-services-slice-analysis-ms/testcases/data/performance_notification7.json new file mode 100644 index 00000000..312bc547 --- /dev/null +++ b/tests/dcaegen2-services-slice-analysis-ms/testcases/data/performance_notification7.json @@ -0,0 +1 @@ +{"event": {"commonEventHeader": {"domain": "perf3gpp","eventId": "88a3ad1f-9b58-4f49-85ba-2645856bb885","sequence": 0,"eventName": "perf3gpp_AcmeNode-Acme_pmMeasResult","sourceName": "oteNB5309","reportingEntityName": "","priority": "Normal","startEpochMicrosec": 1538478000000,"lastEpochMicrosec": 1538478900000,"version": "4.0","vesEventListenerVersion": "7.1","timeZoneOffset": "UTC+05:00"},"perf3gppFields": {"perf3gppFieldsVersion": "1.0","measDataCollection": {"granularityPeriod": 1538482500000,"measuredEntityUserName": "","measuredEntityDn": "4","measuredEntitySoftwareVersion": "r0.1","measInfoList": [{"measInfoId": {"sMeasInfoId": "some measInfoId"},"measTypes": {"sMeasTypesList":["SM.PrbUsedDl.001-010000","SM.PrbUsedUl.001-010000"]},"measValuesList": [{"measObjInstId": "112951561","suspectFlag": "false","measResults": [{"p": 1,"sValue": "71"},{"p": 2,"sValue": "61"}]},{"measObjInstId": "112951562","suspectFlag": "false","measResults": [{"p": 1,"sValue": "73"},{"p": 2,"sValue": "63"}]},{"measObjInstId": "112951568","suspectFlag": "false","measResults": [{"p": 1,"sValue": "76"},{"p": 2,"sValue": "66"}]}]}]}}}} diff --git a/tests/dcaegen2-services-slice-analysis-ms/testcases/data/performance_notification8.json b/tests/dcaegen2-services-slice-analysis-ms/testcases/data/performance_notification8.json new file mode 100644 index 00000000..82cec2c6 --- /dev/null +++ b/tests/dcaegen2-services-slice-analysis-ms/testcases/data/performance_notification8.json @@ -0,0 +1 @@ +{"event": {"commonEventHeader": {"domain": "perf3gpp","eventId": "c99eb88b-2907-4aec-8bf3-4532ebd9d50b","sequence": 0,"eventName": "perf3gpp_AcmeNode-Acme_pmMeasResult","sourceName": "oteNB5309","reportingEntityName": "","priority": "Normal","startEpochMicrosec": 1538478000000,"lastEpochMicrosec": 1538478900000,"version": "4.0","vesEventListenerVersion": "7.1","timeZoneOffset": "UTC+05:00"},"perf3gppFields": {"perf3gppFieldsVersion": "1.0","measDataCollection": {"granularityPeriod": 1538482500000,"measuredEntityUserName": "","measuredEntityDn": "4","measuredEntitySoftwareVersion": "r0.1","measInfoList": [{"measInfoId": {"sMeasInfoId": "some measInfoId"},"measTypes": {"sMeasTypesList":["SM.PrbUsedDl.001-010000","SM.PrbUsedUl.001-010000"]},"measValuesList": [{"measObjInstId": "112951561","suspectFlag": "false","measResults": [{"p": 1,"sValue": "72"},{"p": 2,"sValue": "62"}]},{"measObjInstId": "112951562","suspectFlag": "false","measResults": [{"p": 1,"sValue": "74"},{"p": 2,"sValue": "64"}]},{"measObjInstId": "112951568","suspectFlag": "false","measResults": [{"p": 1,"sValue": "77"},{"p": 2,"sValue": "67"}]}]}]}}}} diff --git a/tests/dcaegen2-services-slice-analysis-ms/testcases/slice-analysis-ms-test.robot b/tests/dcaegen2-services-slice-analysis-ms/testcases/slice-analysis-ms-test.robot new file mode 100644 index 00000000..db9925f8 --- /dev/null +++ b/tests/dcaegen2-services-slice-analysis-ms/testcases/slice-analysis-ms-test.robot @@ -0,0 +1,124 @@ +*** Settings *** +Library Collections +Library Process +Library RequestsLibrary +Library String +Library OperatingSystem + +Suite Teardown Delete All Sessions + +*** Variables *** +${SLICE_ANALYSIS_MS_BASE_URL} http://${SLICE_ANALYSIS_MS_IP}:8080 +${HEALTHCHECK_ENDPOINT} /healthcheck +${DMAAP_URL} http://${DMAAP_IP}:3904/events +${unauthenticated.DCAE_CL_OUTPUT} /unauthenticated.DCAE_CL_OUTPUT/23/23 +${POST_DMAAP_EVENT_FOR_ML_NOTIF_URL} http://${DMAAP_IP}:3904/events/unauthenticated.ML_RESPONSE_TOPIC +${POST_DMAAP_EVENT_FOR_PM_NOTIF_URL} http://${DMAAP_IP}:3904/events/unauthenticated.PERFORMANCE_MEASUREMENTS + + +*** Test Cases *** + +HealthCheck + + Create Session sliceanalysisms ${SLICE_ANALYSIS_MS_BASE_URL} + ${resp}= Get Request sliceanalysisms ${HEALTHCHECK_ENDPOINT} + Should Be Equal As Strings ${resp.status_code} 200 + + +Post ml notification to dmaap + Create Session dmaap ${DMAAP_URL} + ${headers}= Create Dictionary Content-Type application/json + ${data}= Get File ${TEST_ROBOT_DIR}/data/ml_response.json + ${response}= Evaluate requests.post('${POST_DMAAP_EVENT_FOR_ML_NOTIF_URL}', data=$data) + Should Be Equal As Strings ${response.status_code} 200 + + +Verify ml notification trigger + Create Session dmaap ${DMAAP_URL} + FOR ${i} IN RANGE 30 + ${result}= Get Request dmaap ${unauthenticated.DCAE_CL_OUTPUT} + Exit For Loop If ${result.json()} != @{EMPTY} + Log Waiting for slice-analysis-ms to handle trigger... console=${True} + Sleep 5s + END + + ${expected_string}= Get File ${TEST_ROBOT_DIR}/data/expected_ml_payload.json + ${expected_payload}= Evaluate json.loads("""${expected_string}""") json + ${result}= Convert To String ${result.content} + ${result_string}= Get Substring ${result} 2 -2 + ${actual_data}= Evaluate json.loads("""${result_string}""") json + ${actual_payload_str}= Set Variable ${actual_data['payload']} + ${actual_payload}= Evaluate json.loads("""${actual_payload_str}""") json + set to dictionary ${expected_payload['additionalProperties']['nsiInfo']} nsiId=${actual_payload['additionalProperties']['nsiInfo']['nsiId']} + Should Be True """${actual_payload}""".strip() == """${expected_payload}""".strip() + + +Post pm notification-1 to dmaap + ${data}= Get File ${TEST_ROBOT_DIR}/data/performance_notification1.json + FOR ${j} IN RANGE 6 + ${response}= Evaluate requests.post('${POST_DMAAP_EVENT_FOR_PM_NOTIF_URL}', data=$data) + Sleep 10s + END + Should Be Equal As Strings ${response.status_code} 200 + + +Verify pm notification-1 trigger + Create Session dmaap ${DMAAP_URL} + FOR ${i} IN RANGE 20 + ${result}= Get Request dmaap ${unauthenticated.DCAE_CL_OUTPUT} + Exit For Loop If ${result.json()} != @{EMPTY} + Log Waiting for sliceanalysisms to handle trigger... console=${True} + Sleep 30s + END + ${expected_string}= Get File ${TEST_ROBOT_DIR}/data/expected_payload_pm1.json + ${expected_payload}= Evaluate json.loads("""${expected_string}""") json + ${result}= Convert To String ${result.content} + ${result_string}= Get Substring ${result} 2 -2 + ${actual_data}= Evaluate json.loads("""${result_string}""") json + ${actual_payload_str}= Set Variable ${actual_data['payload']} + ${actual_payload}= Evaluate json.loads("""${actual_payload_str}""") json + set to dictionary ${expected_payload['additionalProperties']['nsiInfo']} nsiId=${actual_payload['additionalProperties']['nsiInfo']['nsiId']} + Should Be True """${actual_payload}""".strip() == """${expected_payload}""".strip() + + + +Post pm notification-2 to dmaap + ${data}= Get File ${TEST_ROBOT_DIR}/data/performance_notification3.json + ${data1}= Get File ${TEST_ROBOT_DIR}/data/performance_notification4.json + ${data2}= Get File ${TEST_ROBOT_DIR}/data/performance_notification5.json + ${data3}= Get File ${TEST_ROBOT_DIR}/data/performance_notification6.json + ${data4}= Get File ${TEST_ROBOT_DIR}/data/performance_notification7.json + ${data5}= Get File ${TEST_ROBOT_DIR}/data/performance_notification8.json + FOR ${i} IN RANGE 6 + ${response}= Evaluate requests.post('${POST_DMAAP_EVENT_FOR_PM_NOTIF_URL}', data=$data) + ${response1}= Evaluate requests.post('${POST_DMAAP_EVENT_FOR_PM_NOTIF_URL}', data=$data1) + ${response2}= Evaluate requests.post('${POST_DMAAP_EVENT_FOR_PM_NOTIF_URL}', data=$data2) + ${response3}= Evaluate requests.post('${POST_DMAAP_EVENT_FOR_PM_NOTIF_URL}', data=$data3) + ${response4}= Evaluate requests.post('${POST_DMAAP_EVENT_FOR_PM_NOTIF_URL}', data=$data4) + ${response5}= Evaluate requests.post('${POST_DMAAP_EVENT_FOR_PM_NOTIF_URL}', data=$data5) + END + Should Be Equal As Strings ${response.status_code} 200 + Should Be Equal As Strings ${response1.status_code} 200 + Should Be Equal As Strings ${response2.status_code} 200 + Should Be Equal As Strings ${response3.status_code} 200 + Should Be Equal As Strings ${response4.status_code} 200 + Should Be Equal As Strings ${response5.status_code} 200 + + +Verify pm notification-2 trigger + Create Session dmaap ${DMAAP_URL} + FOR ${i} IN RANGE 20 + ${result}= Get Request dmaap ${unauthenticated.DCAE_CL_OUTPUT} + Exit For Loop If ${result.json()} != @{EMPTY} + Log Waiting for sliceanalysisms to handle trigger... console=${True} + Sleep 30s + END + ${expected_string}= Get File ${TEST_ROBOT_DIR}/data/expected_payload_pm2.json + ${expected_payload}= Evaluate json.loads("""${expected_string}""") json + ${result}= Convert To String ${result.content} + ${result_string}= Get Substring ${result} 2 -2 + ${actual_data}= Evaluate json.loads("""${result_string}""") json + ${actual_payload_str}= Set Variable ${actual_data['payload']} + ${actual_payload}= Evaluate json.loads("""${actual_payload_str}""") json + set to dictionary ${expected_payload['additionalProperties']['nsiInfo']} nsiId=${actual_payload['additionalProperties']['nsiInfo']['nsiId']} + Should Be True """${actual_payload}""".strip() == """${expected_payload}""".strip() -- 2.16.6