Uplift from master and step versions 83/5483/3
authorelinuxhenrik <henrik.b.andersson@est.tech>
Wed, 20 Jan 2021 13:55:41 +0000 (14:55 +0100)
committerelinuxhenrik <henrik.b.andersson@est.tech>
Wed, 20 Jan 2021 15:37:17 +0000 (16:37 +0100)
Step enrichment-coordinator-service to 1.1.1.
Step r-app-catalogue to 1.1.1.
Step policy-agent to 2.2.1.

This is squash of the following commits:

git cherry-pick 7a09fbb9eeb282cf89b88d5b38e75f483be15350
git cherry-pick ff5f78e7e6b14e37b3ac1620e38c8e6bf5a191b8
git cherry-pick d1702a33a3527cf46527c7cd61f435bd7ed08522
git cherry-pick 1da5c887797ae8cb715ad0b16b388aae18cda948
git cherry-pick a1db481e9f360a136081bdb7c7b5b3683d1cff91
git cherry-pick 89b64ab194785ec389c8353e4b90e3e7edd08662
git cherry-pick e1eebe59d712b5439b2813d69944a870be1e93ad
git cherry-pick bfe1c4049297589c4ade863b12e3d6a6cb7abc99
git cherry-pick 7851a89c67279990a6d1b063ca62d49fdcb5be87
git cherry-pick 81ba9036a53ea3fc0fb4699005d86c7794faf8d6
git cherry-pick c760c62129b21c31243a331cf3c8f1963a1058a3
git cherry-pick f2bfafab18e7fb197a7e351a4f6a89c2936cbb5c
git cherry-pick bc89f17bf07fc2aca8e8004b769c52eaafb117b8
git cherry-pick b61264738a459de5f1b9333ee4cb486df9f3b9f4
git cherry-pick e912ee4367d6a305ac038c86dec816b5ce71191b
git cherry-pick e0b665e3ff544bb78411bdc7f6b3ba2818fdeed4
git cherry-pick b7f412244f9b5e8698f57b7921b30dc86853434d
git cherry-pick f0019c8168b9d59f132ba47e939e8aa3ef324b7d
git cherry-pick 4f7f0cda2f07f62dcbb2e371fc09764b2337a8e9
git cherry-pick 10e254d9b7bc522bb2c25d590e6d203bf25a592d
git cherry-pick 2dbde318f013212c81c4a1f477d7638ec3367aa5
git cherry-pick beb7839bbfce438d984a6362fc02cb90257851d7
git cherry-pick 32180137b6aca9c3a4519ac00cb573cbae9dca83
git cherry-pick 132dcaf425bc2ce6f13b0725f11a9dd99a08eccb
git cherry-pick fed5fc967794cb3d9d9abf3d48283908eff36cc9
git cherry-pick 7f685c3b730ce857b32bbd4bdbb214795511ec62
git cherry-pick 1e539490bc37fed791895dd1f2f898caa3b0ca5c
git cherry-pick 27db02f21e9d2fce2bb57f64a17cf6f7044e0a4f
git cherry-pick d658528f47b628595d6f2355a411736b0e58691d
git cherry-pick 64cb483277e5162c1fbc943df043f44aff7f85f9
git cherry-pick 6296305fad90e21103fa92e05e0d21a3ba1356a2
git cherry-pick 28ea034c54771d3680743f3885c97d6bc9eb7f7b
git cherry-pick 7bef63e604a6391d6f9264c049a51e6d0680e07a
git cherry-pick 38c1f88849d9b529007ac07daeeca2ca0291793b

Signed-off-by: elinuxhenrik <henrik.b.andersson@est.tech>
Signed-off-by: PatrikBuhr <patrik.buhr@est.tech>
Issue-ID: NONRTRIC-385
Change-Id: Ia3ad7f4a3f058e9d180aa51d34f7c2b7ccf17f33

165 files changed:
.gitignore
docker-compose/README.md
docker-compose/a1-sim/docker-compose.yaml [moved from docker-compose/nosdnc/docker-compose.yml with 57% similarity]
docker-compose/control-panel/config/nginx.conf [new file with mode: 0644]
docker-compose/control-panel/docker-compose.yaml [new file with mode: 0644]
docker-compose/docker-compose.yaml [new file with mode: 0644]
docker-compose/ecs/docker-compose.yaml [moved from docker-compose/ecs/docker-compose.yml with 83% similarity]
docker-compose/mr/MsgRtrApi.properties [moved from docker-compose/withDmaap_nosdnc/mr/MsgRtrApi.properties with 100% similarity]
docker-compose/mr/cadi.properties [moved from docker-compose/withDmaap_nosdnc/mr/cadi.properties with 100% similarity]
docker-compose/mr/docker-compose.yml
docker-compose/mr/logback.xml [moved from docker-compose/withDmaap_nosdnc/mr/logback.xml with 100% similarity]
docker-compose/mr/zk_client_jaas.conf [moved from docker-compose/withDmaap_nosdnc/kafka/zk_client_jaas.conf with 100% similarity]
docker-compose/mr/zk_server_jaas.conf [moved from docker-compose/withDmaap_nosdnc/zk/zk_server_jaas.conf with 100% similarity]
docker-compose/policy-service/config/application-policyagent.yaml [moved from docker-compose/nosdnc/config/application-policyagent.yaml with 100% similarity]
docker-compose/policy-service/config/application_configuration.controller.json [moved from docker-compose/sdnc/config/application_configuration.json with 80% similarity]
docker-compose/policy-service/config/application_configuration.nocontroller.json [moved from docker-compose/nosdnc/config/application_configuration.json with 100% similarity]
docker-compose/policy-service/docker-compose.yaml [new file with mode: 0644]
docker-compose/rapp/docker-compose.yaml [moved from docker-compose/rapp/docker-compose.yml with 95% similarity]
docker-compose/sdnc/config/application-policyagent.yaml [deleted file]
docker-compose/sdnc/docker-compose.yml
docker-compose/withDmaap_nosdnc/pms/application-policyagent.yaml [deleted file]
docker-compose/withDmaap_nosdnc/pms/application_configuration.json [deleted file]
docs/api-docs.rst
docs/conf.py
enrichment-coordinator-service/api/ecs-api.json [moved from docs/offeredapis/swagger/ecs-api.json with 82% similarity]
enrichment-coordinator-service/api/ecs-api.yaml [new file with mode: 0644]
enrichment-coordinator-service/config/application.yaml
enrichment-coordinator-service/pom.xml
enrichment-coordinator-service/src/main/java/org/oransc/enrichment/BeanFactory.java
enrichment-coordinator-service/src/main/java/org/oransc/enrichment/clients/AsyncRestClient.java
enrichment-coordinator-service/src/main/java/org/oransc/enrichment/clients/AsyncRestClientFactory.java
enrichment-coordinator-service/src/main/java/org/oransc/enrichment/configuration/ApplicationConfig.java
enrichment-coordinator-service/src/main/java/org/oransc/enrichment/configuration/WebClientConfig.java
enrichment-coordinator-service/src/main/java/org/oransc/enrichment/controllers/VoidResponse.java
enrichment-coordinator-service/src/main/java/org/oransc/enrichment/controllers/consumer/ConsumerCallbacks.java
enrichment-coordinator-service/src/main/java/org/oransc/enrichment/controllers/consumer/ConsumerController.java
enrichment-coordinator-service/src/main/java/org/oransc/enrichment/controllers/producer/ProducerCallbacks.java
enrichment-coordinator-service/src/main/java/org/oransc/enrichment/controllers/producer/ProducerConsts.java
enrichment-coordinator-service/src/main/java/org/oransc/enrichment/controllers/producer/ProducerController.java
enrichment-coordinator-service/src/main/java/org/oransc/enrichment/controllers/producer/ProducerEiTypeInfo.java
enrichment-coordinator-service/src/main/java/org/oransc/enrichment/controllers/producer/ProducerJobInfo.java
enrichment-coordinator-service/src/main/java/org/oransc/enrichment/controllers/producer/ProducerRegistrationInfo.java
enrichment-coordinator-service/src/main/java/org/oransc/enrichment/repository/EiJob.java
enrichment-coordinator-service/src/main/java/org/oransc/enrichment/repository/EiJobs.java
enrichment-coordinator-service/src/main/java/org/oransc/enrichment/repository/EiProducer.java
enrichment-coordinator-service/src/main/java/org/oransc/enrichment/repository/EiProducers.java
enrichment-coordinator-service/src/main/java/org/oransc/enrichment/repository/EiType.java
enrichment-coordinator-service/src/main/java/org/oransc/enrichment/repository/EiTypes.java
enrichment-coordinator-service/src/main/java/org/oransc/enrichment/repository/MultiMap.java
enrichment-coordinator-service/src/main/java/org/oransc/enrichment/tasks/ProducerSupervision.java
enrichment-coordinator-service/src/test/java/org/oransc/enrichment/ApplicationTest.java
enrichment-coordinator-service/src/test/java/org/oransc/enrichment/clients/AsyncRestClientTest.java
enrichment-coordinator-service/src/test/java/org/oransc/enrichment/controller/ConsumerSimulatorController.java
enrichment-coordinator-service/src/test/java/org/oransc/enrichment/controller/ProducerSimulatorController.java
onap/oran
policy-agent/.gitignore
policy-agent/README.md
policy-agent/pom.xml
pom.xml
r-app-catalogue/Dockerfile
r-app-catalogue/config/application.yaml
r-app-catalogue/config/r-app-catalogue-keystore.jks [new file with mode: 0644]
r-app-catalogue/eclipse-formatter.xml [new file with mode: 0644]
r-app-catalogue/pom.xml
r-app-catalogue/src/main/java/org/oransc/rappcatalogue/api/GeneralRappCatalogueControllerAdvisor.java
r-app-catalogue/src/main/java/org/oransc/rappcatalogue/api/ServicesApiDelegateImpl.java
r-app-catalogue/src/main/java/org/oransc/rappcatalogue/configuration/TomcatConfig.java [new file with mode: 0644]
r-app-catalogue/src/main/java/org/oransc/rappcatalogue/exception/HeaderException.java
r-app-catalogue/src/main/java/org/oransc/rappcatalogue/exception/InvalidServiceException.java
r-app-catalogue/src/main/java/org/oransc/rappcatalogue/exception/ServiceNotFoundException.java
r-app-catalogue/src/test/java/org/oransc/rappcatalogue/HttpsRequestTest.java [new file with mode: 0644]
r-app-catalogue/src/test/java/org/oransc/rappcatalogue/api/ServicesApiDelegateImplTest.java
test/auto-test/.gitignore
test/auto-test/FTC1.sh
test/auto-test/FTC10.sh
test/auto-test/FTC100.sh
test/auto-test/FTC110.sh
test/auto-test/FTC1100.sh
test/auto-test/FTC150.sh
test/auto-test/FTC1800.sh
test/auto-test/FTC300.sh
test/auto-test/FTC310.sh
test/auto-test/FTC350.sh
test/auto-test/FTC800.sh
test/auto-test/FTC810.sh
test/auto-test/FTC850.sh
test/auto-test/FTC900.sh
test/auto-test/FTC_HELM-RECEPIE.sh [new file with mode: 0755]
test/auto-test/PM_DEMO.sh
test/auto-test/PM_EI_DEMO.sh
test/auto-test/README.md
test/common/.gitignore [new file with mode: 0644]
test/common/README.md
test/common/agent_api_functions.sh
test/common/api_curl.sh
test/common/clean_kube.sh [new file with mode: 0755]
test/common/consul_cbs_functions.sh [new file with mode: 0644]
test/common/control_panel_api_functions.sh [new file with mode: 0644]
test/common/controller_api_functions.sh
test/common/cr_api_functions.sh
test/common/ecs_api_functions.sh
test/common/http_proxy_api_functions.sh [new file with mode: 0644]
test/common/mr_api_functions.sh [new file with mode: 0644]
test/common/prodstub_api_functions.sh
test/common/rapp_catalogue_api_functions.sh
test/common/ricsimulator_api_functions.sh
test/common/test_env-onap-guilin.sh
test/common/test_env-onap-honolulu.sh [new file with mode: 0644]
test/common/test_env-onap-master.sh [deleted file]
test/common/test_env-oran-cherry.sh
test/common/test_env-oran-dawn.sh [new file with mode: 0755]
test/common/test_env.sh [deleted file]
test/common/testcase_common.sh
test/mrstub/app/main.py
test/mrstub/app/nginx.conf
test/mrstub/app/requirements.txt
test/mrstub/basic_test.sh
test/mrstub/mrstub-build-start.sh
test/simulator-group/control_panel/app.yaml [new file with mode: 0644]
test/simulator-group/control_panel/application.properties [new file with mode: 0644]
test/simulator-group/control_panel/docker-compose.yml
test/simulator-group/control_panel/svc.yaml [new file with mode: 0644]
test/simulator-group/cr/app.yaml [new file with mode: 0644]
test/simulator-group/cr/svc.yaml [new file with mode: 0644]
test/simulator-group/dmaapmr/app.yaml [new file with mode: 0644]
test/simulator-group/dmaapmr/docker-compose.yaml [moved from docker-compose/withDmaap_nosdnc/docker-compose.yml with 51% similarity]
test/simulator-group/dmaapmr/mnt/kafka/zk_client_jaas.conf [new file with mode: 0644]
test/simulator-group/dmaapmr/mnt/mr/KUBE-MsgRtrApi.properties [new file with mode: 0644]
test/simulator-group/dmaapmr/mnt/mr/MsgRtrApi.properties [new file with mode: 0644]
test/simulator-group/dmaapmr/mnt/mr/cadi.properties [new file with mode: 0644]
test/simulator-group/dmaapmr/mnt/mr/logback.xml [new file with mode: 0644]
test/simulator-group/dmaapmr/mnt/zk/zk_server_jaas.conf [new file with mode: 0644]
test/simulator-group/dmaapmr/svc.yaml [new file with mode: 0644]
test/simulator-group/ecs/app.yaml [new file with mode: 0644]
test/simulator-group/ecs/application.yaml [new file with mode: 0644]
test/simulator-group/ecs/pvc.yaml [new file with mode: 0644]
test/simulator-group/ecs/svc.yaml [new file with mode: 0644]
test/simulator-group/httpproxy/.gitignore [new file with mode: 0644]
test/simulator-group/httpproxy/app.yaml [new file with mode: 0644]
test/simulator-group/httpproxy/docker-compose.yaml [moved from test/simulator-group/mr/docker-compose.yml with 79% similarity]
test/simulator-group/httpproxy/svc.yaml [new file with mode: 0644]
test/simulator-group/mrstub/.gitignore [moved from test/simulator-group/mr/.gitignore with 100% similarity]
test/simulator-group/mrstub/app.yaml [new file with mode: 0644]
test/simulator-group/mrstub/cert/cert.crt [moved from test/simulator-group/mr/cert/cert.crt with 100% similarity]
test/simulator-group/mrstub/cert/key.crt [moved from test/simulator-group/mr/cert/key.crt with 100% similarity]
test/simulator-group/mrstub/cert/pass [moved from test/simulator-group/mr/cert/pass with 100% similarity]
test/simulator-group/mrstub/docker-compose.yml [moved from test/simulator-group/consul_cbs/consul/cbs_localhost_config.hcl with 63% similarity]
test/simulator-group/mrstub/svc.yaml [new file with mode: 0644]
test/simulator-group/policy_agent/app.yaml [new file with mode: 0644]
test/simulator-group/policy_agent/application.yaml [new file with mode: 0644]
test/simulator-group/policy_agent/docker-compose.yml
test/simulator-group/policy_agent/mnt/.gitignore [new file with mode: 0644]
test/simulator-group/policy_agent/mnt/application.yaml [new file with mode: 0644]
test/simulator-group/policy_agent/svc.yaml [new file with mode: 0644]
test/simulator-group/prodstub/app.yaml [new file with mode: 0644]
test/simulator-group/prodstub/svc.yaml [new file with mode: 0644]
test/simulator-group/rapp_catalogue/app.yaml [new file with mode: 0644]
test/simulator-group/rapp_catalogue/docker-compose.yml
test/simulator-group/rapp_catalogue/svc.yaml [new file with mode: 0644]
test/simulator-group/ric/app.yaml [new file with mode: 0644]
test/simulator-group/ric/svc.yaml [new file with mode: 0644]
test/simulator-group/sdnc/app.yaml [new file with mode: 0644]
test/simulator-group/sdnc/docker-compose.yml
test/simulator-group/sdnc/svc.yaml [new file with mode: 0644]
test/simulator-group/sim-monitor.js

index 26c6731..02f4f98 100644 (file)
@@ -3,6 +3,8 @@
 .tox
 docs/_build/
 .DS_STORE
+.swagger*
+docs/offeredapis/swagger/README.md
 
 # Eclipse
 .checkstyle
index fdcb5f5..d2f25c2 100644 (file)
@@ -1,25 +1,51 @@
-# O-RAN-SC docker-compose files
-
-The docker-compose.yml file will create an entire nonrtric system with one command:
-docker-compose up
-
-Two docker-compose files are provided in this folder:
-
-nosdnc/docker-compose.yml
-This file is to create nonrtric system without sdnc a1-controller
-
-sdnc/docker-compose.yml
-This file is to create nonrtric system with sdnc a1-controller
+## License
+Copyright (C) 2020 Nordix Foundation.
+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
 
-Howto:
-cd nosdnc/
-docker-compose up
+      http://www.apache.org/licenses/LICENSE-2.0
 
-or
+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.
 
-cd sdnc/
-docker-compose up
+For more information about license please see the [LICENSE](LICENSE.txt) file for details.
 
+## O-RAN-SC docker-compose files:
+The docker compose file helps the user to deploy all or partial components of nonrtric with one command.
+
+All the components in nonrtric has individual docker compose file so you can simply mix and match different components and deploy
+it at your preference.
+
+For ex.
+I want to Control Panel, A1 Policy Management Service & A1 Simulator,
+docker-compose -f docker-compose.yaml -f control-panel/docker-compose.yaml -f policy-service/docker-compose.yaml -f a1-sim/docker-compose.yaml up -d
+
+To remove all the containers use the same command,
+docker-compose -f docker-compose.yaml -f control-panel/docker-compose.yaml -f policy-service/docker-compose.yaml -f a1-sim/docker-compose.yaml down
+
+It can be used with any combination to deploy nonrtric components.
+
+## Policy Service Prerequisite:
+The A1 Policy Service can perform A1 Policy management with or without A1 Adapter. To enable/disable A1 Adapter all you have to do is,
+With SDNC A1 Adapter:
+Rename application_configuration.controller.json to application_configuration.json & start the container. Don't forget to add the A1 Adapter url,username & password in the application_configuration.json file.
+You also need to update the A1 Adapter url & credentials in the application_configuration file.
+Ex:
+For example if you use the OSC A1 Adapter then,
+"baseUrl": "http://a1controller:8282"
+"userName": "admin",
+"password": "Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U"
+docker-compose -f docker-compose.yaml -f policy-service/docker-compose.yaml -f a1-sim/docker-compose.yaml up -d
+Without SDNC A1 Adapter:
+Rename application_configuration.nocontroller.json to application_configuration.json & start the container.
+Ex:
+docker-compose -f docker-compose.yaml -f policy-service/docker-compose.yaml -f a1-sim/docker-compose.yaml up -d
+
+## To create sample data:
 The scripts in data/ will generate some dummy data in the running system.
 It will create:
 one policy type in a1-sim-OSC
@@ -43,21 +69,4 @@ prepareEcsData.sh
 This is to generate some data into the ECS microservice
 
 prepareDmaapMsg.sh
-This is to generate some data into the Dmaap MR, so that PMS reads message from MR
-
-## License
-
-Copyright (C) 2020 Nordix Foundation.
-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.
-
-For more information about license please see the [LICENSE](LICENSE.txt) file for details.
+This is to generate some data into the Dmaap MR, so that PMS reads message from MR
\ No newline at end of file
similarity index 57%
rename from docker-compose/nosdnc/docker-compose.yml
rename to docker-compose/a1-sim/docker-compose.yaml
index c57cd29..25bcf74 100644 (file)
@@ -21,24 +21,6 @@ networks:
     name: nonrtric-docker-net
 
 services:
-  policy-agent:
-    image: nexus3.o-ran-sc.org:10004/o-ran-sc/nonrtric-policy-agent:2.2.0
-    container_name: policy-agent
-    networks:
-      default:
-        aliases:
-          - policy-agent-container
-    ports:
-      - 8081:8081
-      - 8433:8433
-    volumes:
-      - ./config/application_configuration.json:/opt/app/policy-agent/data/application_configuration.json:ro
-    # For using own certs instead of the default ones (built into the container),
-    # place them in config/ directory, update the application-policyagent.yaml file, and uncomment the following lines
-    #  - ./config/keystore-policyagent.jks:/opt/app/policy-agent/etc/cert/keystore.jks:ro
-    #  - ./config/truststore-policyagent.jks:/opt/app/policy-agent/etc/cert/truststore.jks:ro
-    #  - ./config/application-policyagent.yaml:/opt/app/policy-agent/config/application.yaml:ro
-
   a1-sim-OSC:
     image: nexus3.o-ran-sc.org:10004/o-ran-sc/a1-simulator:2.1.0
     container_name: a1-sim-OSC
@@ -64,12 +46,3 @@ services:
       - A1_VERSION=STD_1.1.3
       - REMOTE_HOSTS_LOGGING=1
       - ALLOW_HTTP=true
-
-  policy-control-panel:
-    image: nexus3.o-ran-sc.org:10004/o-ran-sc/nonrtric-controlpanel:2.2.0
-    container_name: policy-control-panel
-    networks:
-      - default
-    ports:
-      - 8080:8080
-      - 8082:8082
diff --git a/docker-compose/control-panel/config/nginx.conf b/docker-compose/control-panel/config/nginx.conf
new file mode 100644 (file)
index 0000000..81102eb
--- /dev/null
@@ -0,0 +1,19 @@
+events{}
+
+http {
+    include /etc/nginx/mime.types;
+
+    upstream backend {
+        server  nonrtric-gateway:9090;
+    }
+
+    server {
+        listen 8080;
+        server_name localhost;
+        root /usr/share/nginx/html;
+        index index.html;
+        location /api/ {
+            proxy_pass  http://backend;
+        }
+    }
+}
\ No newline at end of file
diff --git a/docker-compose/control-panel/docker-compose.yaml b/docker-compose/control-panel/docker-compose.yaml
new file mode 100644 (file)
index 0000000..bc56c3d
--- /dev/null
@@ -0,0 +1,33 @@
+#  Copyright (C) 2020 Nordix Foundation. 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=================================================
+#
+version: '3.5'
+
+networks:
+  default:
+    driver: bridge
+    name: nonrtric-docker-net
+
+services:
+  policy-control-panel:
+    image: nexus3.o-ran-sc.org:10004/o-ran-sc/nonrtric-controlpanel:2.2.0
+    container_name: policy-control-panel
+    networks:
+      - default
+    ports:
+      - 8080:8080
+      - 8082:8082
+    volumes:
+      - ./control-panel/config/nginx.conf:/etc/nginx/nginx.conf:ro
diff --git a/docker-compose/docker-compose.yaml b/docker-compose/docker-compose.yaml
new file mode 100644 (file)
index 0000000..67f3810
--- /dev/null
@@ -0,0 +1,21 @@
+#  Copyright (C) 2020 Nordix Foundation. 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=================================================
+#
+version: '3.5'
+
+networks:
+  default:
+    driver: bridge
+    name: nonrtric-docker-net
\ No newline at end of file
similarity index 83%
rename from docker-compose/ecs/docker-compose.yml
rename to docker-compose/ecs/docker-compose.yaml
index 8b64e25..5cf391c 100644 (file)
@@ -22,7 +22,7 @@ networks:
 
 services:
   ecs:
-    image: nexus3.o-ran-sc.org:10004/o-ran-sc/nonrtric-enrichment-coordinator-service:1.1.0
+    image: nexus3.o-ran-sc.org:10004/o-ran-sc/nonrtric-enrichment-coordinator-service:1.1.1
     container_name: ecs
     networks:
       default:
@@ -31,16 +31,6 @@ services:
     ports:
       - 8083:8083
       - 8434:8434
-
-  policy-control-panel:
-    image: nexus3.o-ran-sc.org:10004/o-ran-sc/nonrtric-controlpanel:2.2.0
-    container_name: policy-control-panel
-    networks:
-      - default
-    ports:
-      - 8080:8080
-      - 8082:8082
-
   producer:
     image: eexit/mirror-http-server
     container_name: producer
@@ -48,4 +38,3 @@ services:
       - default
     ports:
       - 8088:80
-
index 48cc04c..e2948f4 100644 (file)
@@ -38,7 +38,7 @@ services:
      KAFKA_OPTS: -Djava.security.auth.login.config=/etc/zookeeper/secrets/jaas/zk_server_jaas.conf -Dzookeeper.kerberos.removeHostFromPrincipal=true -Dzookeeper.kerberos.removeRealmFromPrincipal=true -Dzookeeper.authProvider.1=org.apache.zookeeper.server.auth.SASLAuthenticationProvider -Dzookeeper.requireClientAuthScheme=sasl
      ZOOKEEPER_SERVER_ID: 1
     volumes:
-      -  ./zk/zk_server_jaas.conf:/etc/zookeeper/secrets/jaas/zk_server_jaas.conf
+      -  ./mr/zk/zk_server_jaas.conf:/etc/zookeeper/secrets/jaas/zk_server_jaas.conf
     networks:
       - default
 
@@ -63,7 +63,7 @@ services:
     # Reduced the number of partitions only to avoid the timeout error for the first subscribe call in slow environment
     KAFKA_OFFSETS_TOPIC_NUM_PARTITIONS: 1
    volumes:
-     -  ./kafka/zk_client_jaas.conf:/etc/kafka/secrets/jaas/zk_client_jaas.conf
+     -  ./mr/kafka/zk_client_jaas.conf:/etc/kafka/secrets/jaas/zk_client_jaas.conf
    networks:
       - default
    depends_on:
@@ -78,9 +78,9 @@ services:
     environment:
      enableCadi: 'false'
     volumes:
-      - ./mr/MsgRtrApi.properties:/appl/dmaapMR1/bundleconfig/etc/appprops/MsgRtrApi.properties
-      - ./mr/logback.xml:/appl/dmaapMR1/bundleconfig/etc/logback.xml
-      - ./mr/cadi.properties:/appl/dmaapMR1/etc/cadi.properties
+      - ./mr/mr/MsgRtrApi.properties:/appl/dmaapMR1/bundleconfig/etc/appprops/MsgRtrApi.properties
+      - ./mr/mr/logback.xml:/appl/dmaapMR1/bundleconfig/etc/logback.xml
+      - ./mr/mr/cadi.properties:/appl/dmaapMR1/etc/cadi.properties
     networks:
       - default
     depends_on:
@@ -1,10 +1,19 @@
 {
     "config":{
        "//description":"Application configuration",
+       "controller": [
+         {
+           "name": "controller1",
+           "baseUrl": "",
+           "userName": "",
+           "password": ""
+         }
+       ],
        "ric":[
           {
              "name":"ric1",
              "baseUrl":"https://a1-sim-OSC:8185/",
+             "controller": "controller1",
              "managedElementIds":[
                 "kista_1",
                 "kista_2"
@@ -13,6 +22,7 @@
           {
              "name":"ric2",
              "baseUrl":"https://a1-sim-STD:8185/",
+             "controller": "controller1",
              "managedElementIds":[
                 "kista_1",
                 "kista_2"
diff --git a/docker-compose/policy-service/docker-compose.yaml b/docker-compose/policy-service/docker-compose.yaml
new file mode 100644 (file)
index 0000000..af4c0ab
--- /dev/null
@@ -0,0 +1,40 @@
+#  Copyright (C) 2020 Nordix Foundation. 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=================================================
+#
+version: '3.5'
+
+networks:
+  default:
+    driver: bridge
+    name: nonrtric-docker-net
+
+services:
+  policy-agent:
+    image: nexus3.o-ran-sc.org:10004/o-ran-sc/nonrtric-policy-agent:2.2.1
+    container_name: policy-agent
+    networks:
+      default:
+        aliases:
+          - policy-agent-container
+    ports:
+      - 8081:8081
+      - 8433:8433
+    volumes:
+      - ./policy-service/config/application_configuration.json:/opt/app/policy-agent/data/application_configuration.json:ro
+    # For using own certs instead of the default ones (built into the container),
+    # place them in config/ directory, update the application-policyagent.yaml file, and uncomment the following lines
+    #  - ./policy-service/config/keystore-policyagent.jks:/opt/app/policy-agent/etc/cert/keystore.jks:ro
+    #  - ./policy-service/config/truststore-policyagent.jks:/opt/app/policy-agent/etc/cert/truststore.jks:ro
+    #  - ./policy-service/config/application-policyagent.yaml:/opt/app/policy-agent/config/application.yaml:ro
similarity index 95%
rename from docker-compose/rapp/docker-compose.yml
rename to docker-compose/rapp/docker-compose.yaml
index 3265408..a7f215f 100644 (file)
@@ -22,14 +22,13 @@ networks:
 
 services:
   r-app:
-    image: nexus3.o-ran-sc.org:10004/o-ran-sc/nonrtric-r-app-catalogue:1.1.0
+    image: nexus3.o-ran-sc.org:10004/o-ran-sc/nonrtric-r-app-catalogue:1.1.1
     container_name: r-app
     networks:
       default:
         aliases:
           - r-app-catalogue
     ports:
-      - 8080:8080
-      - 8433:8433
-
+      - 8680:8680
+      - 8633:8633
 
diff --git a/docker-compose/sdnc/config/application-policyagent.yaml b/docker-compose/sdnc/config/application-policyagent.yaml
deleted file mode 100755 (executable)
index e9146e0..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-spring:
-  profiles:
-    active: prod
-  main:
-    allow-bean-definition-overriding: true
-  aop:
-    auto: false
-management:
-  endpoints:
-    web:
-      exposure:
-        include: "loggers,logfile,health,info,metrics,threaddump,heapdump"
-
-logging:
-  level:
-    ROOT: ERROR
-    org.springframework: ERROR
-    org.springframework.data: ERROR
-    org.springframework.web.reactive.function.client.ExchangeFunctions: ERROR
-    org.oransc.policyagent: INFO
-  file: /var/log/policy-agent/application.log
-server:
-   port : 8433
-   http-port: 8081
-   ssl:
-      key-store-type: JKS
-      key-store-password: policy_agent
-      key-store: /opt/app/policy-agent/etc/cert/keystore.jks
-      key-password: policy_agent
-      key-alias: policy_agent
-app:
-  filepath: /opt/app/policy-agent/data/application_configuration.json
-  webclient:
-    trust-store-used: false
-    trust-store-password: policy_agent
-    trust-store: /opt/app/policy-agent/etc/cert/truststore.jks
-
index 9796ece..fc5b013 100644 (file)
@@ -21,59 +21,6 @@ networks:
     name: nonrtric-docker-net
 
 services:
-  policy-agent:
-    image: nexus3.o-ran-sc.org:10004/o-ran-sc/nonrtric-policy-agent:2.2.0
-    container_name: policy-agent
-    networks:
-      default:
-        aliases:
-          - policy-agent-container
-    ports:
-      - 8081:8081
-      - 8433:8433
-    volumes:
-      - ./config/application_configuration.json:/opt/app/policy-agent/data/application_configuration.json:ro
-    # For using own certs instead of the default ones (built into the container),
-    # place them in config/ directory, update the application-policyagent.yaml file, and uncomment the following lines
-    #  - ./config/keystore-policyagent.jks:/opt/app/policy-agent/etc/cert/keystore.jks:ro
-    #  - ./config/truststore-policyagent.jks:/opt/app/policy-agent/etc/cert/truststore.jks:ro
-    #  - ./config/application-policyagent.yaml:/opt/app/policy-agent/config/application.yaml:ro
-
-  a1-sim-OSC:
-    image: nexus3.o-ran-sc.org:10004/o-ran-sc/a1-simulator:2.1.0
-    container_name: a1-sim-OSC
-    networks:
-      - default
-    ports:
-      - 30001:8085
-      - 30002:8185
-    environment:
-      - A1_VERSION=OSC_2.1.0
-      - REMOTE_HOSTS_LOGGING=1
-      - ALLOW_HTTP=true
-
-  a1-sim-STD:
-    image: nexus3.o-ran-sc.org:10004/o-ran-sc/a1-simulator:2.1.0
-    container_name: a1-sim-STD
-    networks:
-      - default
-    ports:
-      - 30003:8085
-      - 30004:8185
-    environment:
-      - A1_VERSION=STD_1.1.3
-      - REMOTE_HOSTS_LOGGING=1
-      - ALLOW_HTTP=true
-
-  policy-control-panel:
-    image: nexus3.o-ran-sc.org:10004/o-ran-sc/nonrtric-controlpanel:2.2.0
-    container_name: policy-control-panel
-    networks:
-      - default
-    ports:
-      - 8080:8080
-      - 8082:8082
-
   db:
     image: mysql/mysql-server:5.6
     container_name: sdnc-db
@@ -111,9 +58,9 @@ services:
     # For using own certs instead of the default ones (built into the container),
     # place them in config/ directory, update the https-props-a1controller.properties file, and uncomment the following lines
     #volumes:
-    #  - ./config/keystore-a1controller.jks:/etc/ssl/certs/java/keystore.jks:ro
-    #  - ./config/truststore-a1controller.jks:/etc/ssl/certs/java/truststore.jks:ro
-    #  - ./config/https-props-a1controller.properties:/opt/onap/sdnc/data/properties/https-props.properties:ro
+    #  - ./sdnc/config/keystore-a1controller.jks:/etc/ssl/certs/java/keystore.jks:ro
+    #  - ./sdnc/config/truststore-a1controller.jks:/etc/ssl/certs/java/truststore.jks:ro
+    #  - ./sdnc/config/https-props-a1controller.properties:/opt/onap/sdnc/data/properties/https-props.properties:ro
     logging:
       driver:   "json-file"
       options:
diff --git a/docker-compose/withDmaap_nosdnc/pms/application-policyagent.yaml b/docker-compose/withDmaap_nosdnc/pms/application-policyagent.yaml
deleted file mode 100755 (executable)
index 58b3f81..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-spring:
-  profiles:
-    active: prod
-  main:
-    allow-bean-definition-overriding: true
-  aop:
-    auto: false
-management:
-  endpoints:
-    web:
-      exposure:
-        include: "loggers,logfile,health,info,metrics,threaddump,heapdump"
-
-logging:
-  level:
-    ROOT: ERROR
-    org.springframework: ERROR
-    org.springframework.data: ERROR
-    org.springframework.web.reactive.function.client.ExchangeFunctions: ERROR
-    org.oransc.policyagent: TRACE
-  file: /var/log/policy-agent/application.log
-server:
-   port : 8433
-   http-port: 8081
-   ssl:
-      key-store-type: JKS
-      key-store-password: policy_agent
-      key-store: /opt/app/policy-agent/etc/cert/keystore.jks
-      key-password: policy_agent
-      key-alias: policy_agent
-app:
-  filepath: /opt/app/policy-agent/data/application_configuration.json
-  webclient:
-    trust-store-used: false
-    trust-store-password: policy_agent
-    trust-store: /opt/app/policy-agent/etc/cert/truststore.jks
-
diff --git a/docker-compose/withDmaap_nosdnc/pms/application_configuration.json b/docker-compose/withDmaap_nosdnc/pms/application_configuration.json
deleted file mode 100644 (file)
index 0925703..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-{
-    "config":{
-       "//description":"Application configuration",
-       "ric":[
-          {
-             "name":"ric1",
-             "baseUrl":"https://a1-sim-OSC:8185/",
-             "managedElementIds":[
-                "kista_1",
-                "kista_2"
-             ]
-          },
-          {
-             "name":"ric2",
-             "baseUrl":"https://a1-sim-STD:8185/",
-             "managedElementIds":[
-                "kista_1",
-                "kista_2"
-             ]
-          }
-       ],
-       "streams_publishes":{
-          "dmaap_publisher":{
-             "type":"message_router",
-             "dmaap_info":{
-                "topic_url":"http://dmaap-mr:3904/events/A1-POLICY-AGENT-WRITE"
-             }
-          }
-       },
-       "streams_subscribes":{
-          "dmaap_subscriber":{
-             "type":"message_router",
-             "dmaap_info":{
-                "topic_url":"http://dmaap-mr:3904/events/A1-POLICY-AGENT-READ/users/policy-agent?timeout=15000&limit=100"
-             }
-          }
-       }
-    }
- }
\ No newline at end of file
index 5d0e1b1..9e438f6 100644 (file)
@@ -37,10 +37,10 @@ Enrichment Coordinator Service
 See `ECS API <./ecs-api.html>`_ for how to use the API.
 
 .. csv-table::
-   :header: "API name", "|swagger-icon|"
-   :widths: 10,5
+   :header: "API name", "|swagger-icon|", "|yaml-icon|"
+   :widths: 10,5,5
 
-   "ECS API", ":download:`link <./offeredapis/swagger/ecs-api.json>`"
+   "ECS API", ":download:`link <../enrichment-coordinator-service/api/ecs-api.json>`", ":download:`link <../enrichment-coordinator-service/api/ecs-api.yaml>`"
 
 
 rAPP Catalogue
index 09eeb37..85721c6 100644 (file)
@@ -24,7 +24,7 @@ redoc = [
             {
                 'name': 'ECS API',
                 'page': 'ecs-api',
-                'spec': './offeredapis/swagger/ecs-api.json',
+                'spec': '../enrichment-coordinator-service/api/ecs-api.json',
                 'embed': True,
             }
         ]
similarity index 82%
rename from docs/offeredapis/swagger/ecs-api.json
rename to enrichment-coordinator-service/api/ecs-api.json
index 3684c0e..37416ac 100644 (file)
@@ -20,7 +20,7 @@
                 "description": "request",
                 "required": true
             }],
-            "tags": ["Producer Callbacks"],
+            "tags": ["Data Producer Job Control (example producer)"],
             "consumes": ["application/json"]
         }},
         "/A1-EI/v1/eitypes/{eiTypeId}": {"get": {
@@ -77,7 +77,7 @@
                     "required": true
                 }
             ],
-            "tags": ["Consumer Callbacks"],
+            "tags": ["A1-EI (enrichment information) callbacks"],
             "consumes": ["application/json"]
         }},
         "/ei-producer/v1/eitypes": {"get": {
@@ -97,7 +97,7 @@
                 "403": {"description": "Forbidden"},
                 "404": {"description": "Not Found"}
             },
-            "tags": ["Enrichment Data Producer API"]
+            "tags": ["Data Producer Registry API"]
         }},
         "/A1-EI/v1/eitypes": {"get": {
             "summary": "EI type identifiers",
             "responses": {
                 "200": {
                     "schema": {"$ref": "#/definitions/producer_status"},
-                    "description": "EI jobs"
+                    "description": "EI producer status"
                 },
                 "401": {"description": "Unauthorized"},
                 "403": {"description": "Forbidden"},
                 "type": "string",
                 "required": true
             }],
-            "tags": ["Enrichment Data Producer API"]
+            "tags": ["Data Producer Registry API"]
         }},
         "/producer_simulator/ei_job/{eiJobId}": {"delete": {
             "summary": "Callback for EI job deletion",
                 "type": "string",
                 "required": true
             }],
-            "tags": ["Producer Callbacks"]
+            "tags": ["Data Producer Job Control (example producer)"]
         }},
         "/ei-producer/v1/eiproducers": {"get": {
             "summary": "EI producer identifiers",
                 "403": {"description": "Forbidden"},
                 "404": {"description": "Not Found"}
             },
-            "tags": ["Enrichment Data Producer API"]
-        }},
-        "/ei-producer/v1/eitypes/{eiTypeId}": {"get": {
-            "summary": "Individual EI type",
-            "deprecated": false,
-            "produces": ["application/json"],
-            "operationId": "getEiTypeUsingGET_1",
-            "responses": {
-                "200": {
-                    "schema": {"$ref": "#/definitions/producer_ei_type_info"},
-                    "description": "EI type"
-                },
-                "401": {"description": "Unauthorized"},
-                "403": {"description": "Forbidden"},
-                "404": {
-                    "schema": {"$ref": "#/definitions/ProblemDetails"},
-                    "description": "Enrichment Information type is not found"
-                }
-            },
             "parameters": [{
-                "in": "path",
-                "name": "eiTypeId",
-                "description": "eiTypeId",
+                "in": "query",
+                "allowEmptyValue": false,
+                "name": "ei_type_id",
+                "description": "If given, only the producers for the EI Data type is returned.",
                 "type": "string",
-                "required": true
+                "required": false
             }],
-            "tags": ["Enrichment Data Producer API"]
+            "tags": ["Data Producer Registry API"]
         }},
+        "/ei-producer/v1/eitypes/{eiTypeId}": {
+            "get": {
+                "summary": "Individual EI type",
+                "deprecated": false,
+                "produces": ["application/json"],
+                "operationId": "getEiTypeUsingGET_1",
+                "responses": {
+                    "200": {
+                        "schema": {"$ref": "#/definitions/producer_ei_type_info"},
+                        "description": "EI type"
+                    },
+                    "401": {"description": "Unauthorized"},
+                    "403": {"description": "Forbidden"},
+                    "404": {
+                        "schema": {"$ref": "#/definitions/ProblemDetails"},
+                        "description": "Enrichment Information type is not found"
+                    }
+                },
+                "parameters": [{
+                    "in": "path",
+                    "name": "eiTypeId",
+                    "description": "eiTypeId",
+                    "type": "string",
+                    "required": true
+                }],
+                "tags": ["Data Producer Registry API"]
+            },
+            "delete": {
+                "summary": "Individual EI type",
+                "deprecated": false,
+                "produces": ["application/json"],
+                "operationId": "deleteEiTypeUsingDELETE",
+                "responses": {
+                    "200": {"description": "Not used"},
+                    "401": {"description": "Unauthorized"},
+                    "204": {"description": "Producer deleted"},
+                    "403": {"description": "Forbidden"},
+                    "404": {
+                        "schema": {"$ref": "#/definitions/ProblemDetails"},
+                        "description": "Enrichment Information type is not found"
+                    },
+                    "406": {
+                        "schema": {"$ref": "#/definitions/ProblemDetails"},
+                        "description": "The Enrichment Information type has one or several active producers"
+                    }
+                },
+                "parameters": [{
+                    "in": "path",
+                    "name": "eiTypeId",
+                    "description": "eiTypeId",
+                    "type": "string",
+                    "required": true
+                }],
+                "tags": ["Data Producer Registry API"]
+            },
+            "put": {
+                "summary": "Individual EI type",
+                "deprecated": false,
+                "produces": ["application/json"],
+                "operationId": "putEiTypeUsingPUT",
+                "responses": {
+                    "200": {"description": "Type updated"},
+                    "201": {"description": "Type created"},
+                    "400": {
+                        "schema": {"$ref": "#/definitions/ProblemDetails"},
+                        "description": "Bad request"
+                    },
+                    "401": {"description": "Unauthorized"},
+                    "403": {"description": "Forbidden"},
+                    "404": {"description": "Not Found"}
+                },
+                "parameters": [
+                    {
+                        "in": "path",
+                        "name": "eiTypeId",
+                        "description": "eiTypeId",
+                        "type": "string",
+                        "required": true
+                    },
+                    {
+                        "schema": {"$ref": "#/definitions/producer_ei_type_info"},
+                        "in": "body",
+                        "name": "registrationInfo",
+                        "description": "registrationInfo",
+                        "required": true
+                    }
+                ],
+                "tags": ["Data Producer Registry API"],
+                "consumes": ["application/json"]
+            }
+        },
         "/status": {"get": {
             "summary": "Returns status and statistics of this service",
             "deprecated": false,
                 "responses": {
                     "200": {
                         "schema": {"$ref": "#/definitions/producer_registration_info"},
-                        "description": "EI jobs"
+                        "description": "EI producer"
                     },
                     "401": {"description": "Unauthorized"},
                     "403": {"description": "Forbidden"},
                     "type": "string",
                     "required": true
                 }],
-                "tags": ["Enrichment Data Producer API"]
+                "tags": ["Data Producer Registry API"]
             },
             "delete": {
                 "summary": "Individual EI producer",
                     "type": "string",
                     "required": true
                 }],
-                "tags": ["Enrichment Data Producer API"]
+                "tags": ["Data Producer Registry API"]
             },
             "put": {
                 "summary": "Individual EI producer",
                         "required": true
                     }
                 ],
-                "tags": ["Enrichment Data Producer API"],
+                "tags": ["Data Producer Registry API"],
                 "consumes": ["application/json"]
             }
         },
                 "403": {"description": "Forbidden"},
                 "404": {"description": "Not Found"}
             },
-            "tags": ["Producer Callbacks"]
+            "tags": ["Data Producer Job Control (example producer)"]
         }},
         "/ei-producer/v1/eiproducers/{eiProducerId}/eijobs": {"get": {
             "summary": "EI job definitions",
                         "type": "array",
                         "items": {"$ref": "#/definitions/producer_ei_job_request"}
                     },
-                    "description": "EI jobs"
+                    "description": "EI producer"
                 },
                 "401": {"description": "Unauthorized"},
                 "403": {"description": "Forbidden"},
                 "type": "string",
                 "required": true
             }],
-            "tags": ["Enrichment Data Producer API"]
+            "tags": ["Data Producer Registry API"]
         }},
         "/A1-EI/v1/eijobs": {"get": {
             "summary": "EI job identifiers",
             "tags": ["A1-EI (enrichment information)"]
         }}
     },
-    "host": "localhost:34053",
     "definitions": {
         "producer_ei_job_request": {
             "description": "The body of the EI producer callbacks for EI job creation and deletion",
                     "description": "Idenitity of the EI job",
                     "type": "string"
                 },
+                "last_updated": {
+                    "description": "The time when the job was last updated or created (ISO-8601)",
+                    "type": "string"
+                },
                 "ei_job_data": {
                     "description": "Json for the job data",
                     "type": "object"
             "type": "object",
             "title": "EiTypeObject"
         },
-        "producer_ei_type_registration_info": {
-            "description": "Information for an EI type",
-            "type": "object",
-            "title": "producer_ei_type_registration_info",
-            "required": ["ei_type_identity"],
-            "properties": {
-                "ei_type_identity": {
-                    "description": "EI type identity",
-                    "type": "string"
-                },
-                "ei_job_data_schema": {
-                    "description": "Json schema for the job data",
-                    "type": "object"
-                }
-            }
-        },
         "status_info": {
             "type": "object",
             "title": "status_info",
                 }
             }
         },
-        "Mono«ResponseEntity«object»»": {
-            "type": "object",
-            "title": "Mono«ResponseEntity«object»»"
-        },
         "producer_ei_type_info": {
             "description": "Information for an EI type",
             "type": "object",
             "title": "producer_ei_type_info",
-            "properties": {
-                "ei_producer_ids": {
-                    "description": "Registered producers",
-                    "type": "array",
-                    "items": {"type": "string"}
-                },
-                "ei_job_data_schema": {
-                    "description": "Json schema for the job data",
-                    "type": "object"
-                }
-            }
+            "required": ["ei_job_data_schema"],
+            "properties": {"ei_job_data_schema": {
+                "description": "Json schema for the job data",
+                "type": "object"
+            }}
         },
         "producer_registration_info": {
             "description": "Information for an EI producer",
             ],
             "properties": {
                 "supported_ei_types": {
-                    "description": "Supported EI types",
+                    "description": "Supported EI type IDs",
                     "type": "array",
-                    "items": {"$ref": "#/definitions/producer_ei_type_registration_info"}
+                    "items": {"type": "string"}
                 },
                 "ei_producer_supervision_callback_url": {
                     "description": "callback for producer supervision",
                 }
             }
         },
-        "Void": {
-            "description": "Void/empty",
-            "type": "object",
-            "title": "Void"
-        },
         "EiJobStatusObject": {
             "description": "Status for an EI job",
             "type": "object",
             "description": "Consumer Controller"
         },
         {
-            "name": "Consumer Callbacks",
+            "name": "A1-EI (enrichment information) callbacks",
             "description": "Consumer Simulator Controller"
         },
         {
-            "name": "Enrichment Data Producer API",
-            "description": "Producer Controller"
+            "name": "Data Producer Job Control (example producer)",
+            "description": "Producer Simulator Controller"
         },
         {
-            "name": "Producer Callbacks",
-            "description": "Producer Simulator Controller"
+            "name": "Data Producer Registry API",
+            "description": "Producer Controller"
         },
         {
             "name": "Service status",
             "description": "Status Controller"
         }
     ]
-}
+}
\ No newline at end of file
diff --git a/enrichment-coordinator-service/api/ecs-api.yaml b/enrichment-coordinator-service/api/ecs-api.yaml
new file mode 100644 (file)
index 0000000..d1aa187
--- /dev/null
@@ -0,0 +1,893 @@
+openapi: 3.0.1
+info:
+  title: Enrichment Data service
+  description: This page lists all the rest apis for the service.
+  version: "1.0"
+servers:
+- url: /
+tags:
+- name: A1-EI (enrichment information)
+  description: Consumer Controller
+- name: A1-EI (enrichment information) callbacks
+  description: Consumer Simulator Controller
+- name: Data Producer Job Control (example producer)
+  description: Producer Simulator Controller
+- name: Data Producer Registry API
+  description: Producer Controller
+- name: Service status
+  description: Status Controller
+paths:
+  /producer_simulator/ei_job:
+    post:
+      tags:
+      - Data Producer Job Control (example producer)
+      summary: Callback for EI job creation
+      operationId: jobCreatedCallbackUsingPOST
+      requestBody:
+        description: request
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/producer_ei_job_request'
+        required: true
+      responses:
+        200:
+          description: OK
+          content: {}
+        201:
+          description: Created
+          content: {}
+        401:
+          description: Unauthorized
+          content: {}
+        403:
+          description: Forbidden
+          content: {}
+        404:
+          description: Not Found
+          content: {}
+      deprecated: false
+  /A1-EI/v1/eitypes/{eiTypeId}:
+    get:
+      tags:
+      - A1-EI (enrichment information)
+      summary: Individual EI type
+      operationId: getEiTypeUsingGET
+      parameters:
+      - name: eiTypeId
+        in: path
+        description: eiTypeId
+        required: true
+        schema:
+          type: string
+      responses:
+        200:
+          description: EI type
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/EiTypeObject'
+        401:
+          description: Unauthorized
+          content: {}
+        403:
+          description: Forbidden
+          content: {}
+        404:
+          description: Enrichment Information type is not found
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/ProblemDetails'
+      deprecated: false
+  /consumer_simulator/eijobs/{eiJobId}/status:
+    post:
+      tags:
+      - A1-EI (enrichment information) callbacks
+      summary: Callback for EI job status
+      operationId: jobStatusCallbackUsingPOST
+      parameters:
+      - name: eiJobId
+        in: path
+        description: eiJobId
+        required: true
+        schema:
+          type: string
+      requestBody:
+        description: status
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/EiJobStatusObject'
+        required: true
+      responses:
+        200:
+          description: OK
+          content: {}
+        201:
+          description: Created
+          content: {}
+        401:
+          description: Unauthorized
+          content: {}
+        403:
+          description: Forbidden
+          content: {}
+        404:
+          description: Not Found
+          content: {}
+      deprecated: false
+  /ei-producer/v1/eitypes:
+    get:
+      tags:
+      - Data Producer Registry API
+      summary: EI type identifiers
+      operationId: getEiTypeIdentifiersUsingGET_1
+      responses:
+        200:
+          description: EI type identifiers
+          content:
+            application/json:
+              schema:
+                type: array
+                items:
+                  type: string
+        401:
+          description: Unauthorized
+          content: {}
+        403:
+          description: Forbidden
+          content: {}
+        404:
+          description: Not Found
+          content: {}
+      deprecated: false
+  /A1-EI/v1/eitypes:
+    get:
+      tags:
+      - A1-EI (enrichment information)
+      summary: EI type identifiers
+      operationId: getEiTypeIdentifiersUsingGET
+      responses:
+        200:
+          description: EI type identifiers
+          content:
+            application/json:
+              schema:
+                type: array
+                items:
+                  type: string
+        401:
+          description: Unauthorized
+          content: {}
+        403:
+          description: Forbidden
+          content: {}
+        404:
+          description: Not Found
+          content: {}
+      deprecated: false
+  /ei-producer/v1/eiproducers/{eiProducerId}/status:
+    get:
+      tags:
+      - Data Producer Registry API
+      summary: EI producer status
+      operationId: getEiProducerStatusUsingGET
+      parameters:
+      - name: eiProducerId
+        in: path
+        description: eiProducerId
+        required: true
+        schema:
+          type: string
+      responses:
+        200:
+          description: EI producer status
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/producer_status'
+        401:
+          description: Unauthorized
+          content: {}
+        403:
+          description: Forbidden
+          content: {}
+        404:
+          description: Enrichment Information producer is not found
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/ProblemDetails'
+      deprecated: false
+  /producer_simulator/ei_job/{eiJobId}:
+    delete:
+      tags:
+      - Data Producer Job Control (example producer)
+      summary: Callback for EI job deletion
+      operationId: jobDeletedCallbackUsingDELETE
+      parameters:
+      - name: eiJobId
+        in: path
+        description: eiJobId
+        required: true
+        schema:
+          type: string
+      responses:
+        200:
+          description: OK
+          content: {}
+        204:
+          description: No Content
+          content: {}
+        401:
+          description: Unauthorized
+          content: {}
+        403:
+          description: Forbidden
+          content: {}
+      deprecated: false
+  /ei-producer/v1/eiproducers:
+    get:
+      tags:
+      - Data Producer Registry API
+      summary: EI producer identifiers
+      operationId: getEiProducerIdentifiersUsingGET
+      parameters:
+      - name: ei_type_id
+        in: query
+        description: If given, only the producers for the EI Data type is returned.
+        allowEmptyValue: false
+        schema:
+          type: string
+      responses:
+        200:
+          description: EI producer identifiers
+          content:
+            application/json:
+              schema:
+                type: array
+                items:
+                  type: string
+        401:
+          description: Unauthorized
+          content: {}
+        403:
+          description: Forbidden
+          content: {}
+        404:
+          description: Not Found
+          content: {}
+      deprecated: false
+  /ei-producer/v1/eitypes/{eiTypeId}:
+    get:
+      tags:
+      - Data Producer Registry API
+      summary: Individual EI type
+      operationId: getEiTypeUsingGET_1
+      parameters:
+      - name: eiTypeId
+        in: path
+        description: eiTypeId
+        required: true
+        schema:
+          type: string
+      responses:
+        200:
+          description: EI type
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/producer_ei_type_info'
+        401:
+          description: Unauthorized
+          content: {}
+        403:
+          description: Forbidden
+          content: {}
+        404:
+          description: Enrichment Information type is not found
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/ProblemDetails'
+      deprecated: false
+    put:
+      tags:
+      - Data Producer Registry API
+      summary: Individual EI type
+      operationId: putEiTypeUsingPUT
+      parameters:
+      - name: eiTypeId
+        in: path
+        description: eiTypeId
+        required: true
+        schema:
+          type: string
+      requestBody:
+        description: registrationInfo
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/producer_ei_type_info'
+        required: true
+      responses:
+        200:
+          description: Type updated
+          content: {}
+        201:
+          description: Type created
+          content: {}
+        400:
+          description: Bad request
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/ProblemDetails'
+        401:
+          description: Unauthorized
+          content: {}
+        403:
+          description: Forbidden
+          content: {}
+        404:
+          description: Not Found
+          content: {}
+      deprecated: false
+    delete:
+      tags:
+      - Data Producer Registry API
+      summary: Individual EI type
+      operationId: deleteEiTypeUsingDELETE
+      parameters:
+      - name: eiTypeId
+        in: path
+        description: eiTypeId
+        required: true
+        schema:
+          type: string
+      responses:
+        200:
+          description: Not used
+          content: {}
+        204:
+          description: Producer deleted
+          content: {}
+        401:
+          description: Unauthorized
+          content: {}
+        403:
+          description: Forbidden
+          content: {}
+        404:
+          description: Enrichment Information type is not found
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/ProblemDetails'
+        406:
+          description: The Enrichment Information type has one or several active producers
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/ProblemDetails'
+      deprecated: false
+  /status:
+    get:
+      tags:
+      - Service status
+      summary: Returns status and statistics of this service
+      operationId: getStatusUsingGET
+      responses:
+        200:
+          description: Service is living
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/status_info'
+        401:
+          description: Unauthorized
+          content: {}
+        403:
+          description: Forbidden
+          content: {}
+        404:
+          description: Not Found
+          content: {}
+      deprecated: false
+  /A1-EI/v1/eijobs/{eiJobId}:
+    get:
+      tags:
+      - A1-EI (enrichment information)
+      summary: Individual EI job
+      operationId: getIndividualEiJobUsingGET
+      parameters:
+      - name: eiJobId
+        in: path
+        description: eiJobId
+        required: true
+        schema:
+          type: string
+      responses:
+        200:
+          description: EI job
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/EiJobObject'
+        401:
+          description: Unauthorized
+          content: {}
+        403:
+          description: Forbidden
+          content: {}
+        404:
+          description: Enrichment Information job is not found
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/ProblemDetails'
+      deprecated: false
+    put:
+      tags:
+      - A1-EI (enrichment information)
+      summary: Individual EI job
+      operationId: putIndividualEiJobUsingPUT
+      parameters:
+      - name: eiJobId
+        in: path
+        description: eiJobId
+        required: true
+        schema:
+          type: string
+      requestBody:
+        description: eiJobObject
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/EiJobObject'
+        required: true
+      responses:
+        200:
+          description: Job updated
+          content: {}
+        201:
+          description: Job created
+          content: {}
+        401:
+          description: Unauthorized
+          content: {}
+        403:
+          description: Forbidden
+          content: {}
+        404:
+          description: Enrichment Information type is not found
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/ProblemDetails'
+      deprecated: false
+    delete:
+      tags:
+      - A1-EI (enrichment information)
+      summary: Individual EI job
+      operationId: deleteIndividualEiJobUsingDELETE
+      parameters:
+      - name: eiJobId
+        in: path
+        description: eiJobId
+        required: true
+        schema:
+          type: string
+      responses:
+        200:
+          description: Not used
+          content: {}
+        204:
+          description: Job deleted
+          content: {}
+        401:
+          description: Unauthorized
+          content: {}
+        403:
+          description: Forbidden
+          content: {}
+        404:
+          description: Enrichment Information job is not found
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/ProblemDetails'
+      deprecated: false
+  /ei-producer/v1/eiproducers/{eiProducerId}:
+    get:
+      tags:
+      - Data Producer Registry API
+      summary: Individual EI producer
+      operationId: getEiProducerUsingGET
+      parameters:
+      - name: eiProducerId
+        in: path
+        description: eiProducerId
+        required: true
+        schema:
+          type: string
+      responses:
+        200:
+          description: EI producer
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/producer_registration_info'
+        401:
+          description: Unauthorized
+          content: {}
+        403:
+          description: Forbidden
+          content: {}
+        404:
+          description: Enrichment Information producer is not found
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/ProblemDetails'
+      deprecated: false
+    put:
+      tags:
+      - Data Producer Registry API
+      summary: Individual EI producer
+      operationId: putEiProducerUsingPUT
+      parameters:
+      - name: eiProducerId
+        in: path
+        description: eiProducerId
+        required: true
+        schema:
+          type: string
+      requestBody:
+        description: registrationInfo
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/producer_registration_info'
+        required: true
+      responses:
+        200:
+          description: Producer updated
+          content: {}
+        201:
+          description: Producer created
+          content: {}
+        401:
+          description: Unauthorized
+          content: {}
+        403:
+          description: Forbidden
+          content: {}
+        404:
+          description: Not Found
+          content: {}
+      deprecated: false
+    delete:
+      tags:
+      - Data Producer Registry API
+      summary: Individual EI producer
+      operationId: deleteEiProducerUsingDELETE
+      parameters:
+      - name: eiProducerId
+        in: path
+        description: eiProducerId
+        required: true
+        schema:
+          type: string
+      responses:
+        200:
+          description: Not used
+          content: {}
+        204:
+          description: Producer deleted
+          content: {}
+        401:
+          description: Unauthorized
+          content: {}
+        403:
+          description: Forbidden
+          content: {}
+        404:
+          description: Producer is not found
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/ProblemDetails'
+      deprecated: false
+  /producer_simulator/health_check:
+    get:
+      tags:
+      - Data Producer Job Control (example producer)
+      summary: Producer supervision
+      operationId: producerSupervisionUsingGET
+      responses:
+        200:
+          description: OK
+          content:
+            application/json:
+              schema:
+                type: string
+        401:
+          description: Unauthorized
+          content: {}
+        403:
+          description: Forbidden
+          content: {}
+        404:
+          description: Not Found
+          content: {}
+      deprecated: false
+  /ei-producer/v1/eiproducers/{eiProducerId}/eijobs:
+    get:
+      tags:
+      - Data Producer Registry API
+      summary: EI job definitions
+      description: EI job definitions for one EI producer
+      operationId: getEiProducerJobsUsingGET
+      parameters:
+      - name: eiProducerId
+        in: path
+        description: eiProducerId
+        required: true
+        schema:
+          type: string
+      responses:
+        200:
+          description: EI producer
+          content:
+            application/json:
+              schema:
+                type: array
+                items:
+                  $ref: '#/components/schemas/producer_ei_job_request'
+        401:
+          description: Unauthorized
+          content: {}
+        403:
+          description: Forbidden
+          content: {}
+        404:
+          description: Enrichment Information producer is not found
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/ProblemDetails'
+      deprecated: false
+  /A1-EI/v1/eijobs:
+    get:
+      tags:
+      - A1-EI (enrichment information)
+      summary: EI job identifiers
+      description: query for EI job identifiers
+      operationId: getEiJobIdsUsingGET
+      parameters:
+      - name: eiTypeId
+        in: query
+        description: selects EI jobs of matching EI type
+        allowEmptyValue: false
+        schema:
+          type: string
+      - name: owner
+        in: query
+        description: selects EI jobs for one EI job owner
+        allowEmptyValue: false
+        schema:
+          type: string
+      responses:
+        200:
+          description: EI job identifiers
+          content:
+            application/json:
+              schema:
+                type: array
+                items:
+                  type: string
+        401:
+          description: Unauthorized
+          content: {}
+        403:
+          description: Forbidden
+          content: {}
+        404:
+          description: Enrichment Information type is not found
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/ProblemDetails'
+      deprecated: false
+  /A1-EI/v1/eijobs/{eiJobId}/status:
+    get:
+      tags:
+      - A1-EI (enrichment information)
+      summary: EI job status
+      operationId: getEiJobStatusUsingGET
+      parameters:
+      - name: eiJobId
+        in: path
+        description: eiJobId
+        required: true
+        schema:
+          type: string
+      responses:
+        200:
+          description: EI job status
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/EiJobStatusObject'
+        401:
+          description: Unauthorized
+          content: {}
+        403:
+          description: Forbidden
+          content: {}
+        404:
+          description: Enrichment Information job is not found
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/ProblemDetails'
+      deprecated: false
+components:
+  schemas:
+    producer_ei_job_request:
+      title: producer_ei_job_request
+      required:
+      - ei_job_identity
+      type: object
+      properties:
+        owner:
+          type: string
+          description: The owner of the job
+        ei_job_identity:
+          type: string
+          description: Idenitity of the EI job
+        last_updated:
+          type: string
+          description: The time when the job was last updated or created (ISO-8601)
+        ei_job_data:
+          type: object
+          properties: {}
+          description: Json for the job data
+        target_uri:
+          type: string
+          description: URI for the target of the EI
+        ei_type_identity:
+          type: string
+          description: Type idenitity for the job
+      description: The body of the EI producer callbacks for EI job creation and deletion
+    EiTypeObject:
+      title: EiTypeObject
+      type: object
+      description: Information for an EI type
+    status_info:
+      title: status_info
+      type: object
+      properties:
+        no_of_producers:
+          type: integer
+          description: Number of EI producers
+          format: int32
+        no_of_jobs:
+          type: integer
+          description: Number of EI jobs
+          format: int32
+        no_of_types:
+          type: integer
+          description: Number of EI types
+          format: int32
+        status:
+          type: string
+          description: status text
+    producer_ei_type_info:
+      title: producer_ei_type_info
+      required:
+      - ei_job_data_schema
+      type: object
+      properties:
+        ei_job_data_schema:
+          type: object
+          properties: {}
+          description: Json schema for the job data
+      description: Information for an EI type
+    producer_registration_info:
+      title: producer_registration_info
+      required:
+      - ei_job_callback_url
+      - ei_producer_supervision_callback_url
+      - supported_ei_types
+      type: object
+      properties:
+        supported_ei_types:
+          type: array
+          description: Supported EI type IDs
+          items:
+            type: string
+        ei_producer_supervision_callback_url:
+          type: string
+          description: callback for producer supervision
+        ei_job_callback_url:
+          type: string
+          description: callback for EI job
+      description: Information for an EI producer
+    producer_status:
+      title: producer_status
+      required:
+      - operational_state
+      type: object
+      properties:
+        operational_state:
+          type: string
+          description: |-
+            Operational state, values:
+            ENABLED: TBD
+            DISABLED: TBD.
+          enum:
+          - ENABLED
+          - DISABLED
+      description: Status for an EI Producer
+    ProblemDetails:
+      title: ProblemDetails
+      type: object
+      properties:
+        detail:
+          type: string
+          description: A human-readable explanation specific to this occurrence of
+            the problem.
+          example: EI job type not found
+        status:
+          type: integer
+          description: The HTTP status code generated by the origin server for this
+            occurrence of the problem.
+          format: int32
+          example: 404
+      description: A problem detail to carry details in a HTTP response according
+        to RFC 7807
+    EiJobStatusObject:
+      title: EiJobStatusObject
+      required:
+      - eiJobStatus
+      type: object
+      properties:
+        eiJobStatus:
+          type: string
+          description: |-
+            values:
+            ENABLED: the A1-EI producer is able to deliver EI result for the EI job
+            DISABLED: the A1-EI producer is unable to deliver EI result for the EI job
+          enum:
+          - ENABLED
+          - DISABLED
+      description: Status for an EI job
+    EiJobObject:
+      title: EiJobObject
+      required:
+      - eiTypeId
+      - jobDefinition
+      - jobOwner
+      - jobResultUri
+      type: object
+      properties:
+        eiTypeId:
+          type: string
+          description: EI type Idenitifier of the EI job
+        jobResultUri:
+          type: string
+          description: The target URI of the EI data
+        jobOwner:
+          type: string
+          description: Identity of the owner of the job
+        jobStatusNotificationUri:
+          type: string
+          description: The target of EI job status notifications
+        jobDefinition:
+          type: object
+          properties: {}
+          description: EI type specific job data
+      description: Information for an Enrichment Information Job
index 850dc67..5900d63 100644 (file)
@@ -9,9 +9,11 @@ management:
   endpoints:
     web:
       exposure:
+        # Enabling of springboot actuator features. See springboot documentation.
         include: "loggers,logfile,health,info,metrics,threaddump,heapdump"
 
 logging:
+  # Configuration of logging
   level:
     ROOT: ERROR
     org.springframework: ERROR
@@ -21,6 +23,8 @@ logging:
   file:
     name: /var/log/enrichment-coordinator-service/application.log
 server:
+   # Configuration of the HTTP/REST server. The parameters are defined and handeled by the springboot framework.
+   # See springboot documentation.
    port : 8434
    http-port: 8083
    ssl:
@@ -30,10 +34,16 @@ server:
       key-password: policy_agent
       key-alias: policy_agent
 app:
-  filepath: /opt/app/enrichment-coordinator-service/data/application_configuration.json
   webclient:
+    # Configuration of the trust store used for the HTTP client (outgoing requests)
+    # The file location and the password for the truststore is only relevant if trust-store-used == true
+    # Note that the same keystore as for the server is used.
     trust-store-used: false
     trust-store-password: policy_agent
     trust-store: /opt/app/enrichment-coordinator-service/etc/cert/truststore.jks
+    # Configuration of usage of HTTP Proxy for the southbound accesses.
+    # The HTTP proxy (if configured) will only be used for accessing NearRT RIC:s
+    http.proxy-host:
+    http.proxy-port: 0
   vardata-directory: /var/enrichment-coordinator-service
 
index d34c9a6..afb9abd 100644 (file)
@@ -31,7 +31,7 @@
     </parent>
     <groupId>org.o-ran-sc.nonrtric</groupId>
     <artifactId>enrichment-coordinator-service</artifactId>
-    <version>1.1.0-SNAPSHOT</version>
+    <version>1.1.1-SNAPSHOT</version>
     <licenses>
         <license>
             <name>The Apache Software License, Version 2.0</name>
@@ -56,6 +56,7 @@
         <maven-compiler-plugin.version>3.8.0</maven-compiler-plugin.version>
         <formatter-maven-plugin.version>2.12.2</formatter-maven-plugin.version>
         <spotless-maven-plugin.version>1.24.3</spotless-maven-plugin.version>
+        <swagger-codegen-maven-plugin.version>3.0.11</swagger-codegen-maven-plugin.version>
         <docker-maven-plugin>0.30.0</docker-maven-plugin>
         <version.dmaap>1.1.11</version.dmaap>
         <javax.ws.rs-api.version>2.1.1</javax.ws.rs-api.version>
                     </execution>
                 </executions>
             </plugin>
+            <plugin>
+                <groupId>io.swagger.codegen.v3</groupId>
+                <artifactId>swagger-codegen-maven-plugin</artifactId>
+                <version>${swagger-codegen-maven-plugin.version}</version>
+                <executions>
+                    <execution>
+                        <phase>test</phase>
+                        <goals>
+                            <goal>generate</goal>
+                        </goals>
+                        <configuration>
+                            <inputSpec>${project.basedir}/api/ecs-api.json</inputSpec>
+                            <language>openapi-yaml</language>
+                            <output>${project.basedir}/api</output>
+                            <configOptions>
+                                <outputFile>ecs-api.yaml</outputFile>
+                            </configOptions>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
             <plugin>
                 <groupId>io.fabric8</groupId>
                 <artifactId>docker-maven-plugin</artifactId>
index c5d2bec..f5aca7e 100644 (file)
@@ -26,8 +26,8 @@ import java.lang.invoke.MethodHandles;
 
 import org.apache.catalina.connector.Connector;
 import org.oransc.enrichment.configuration.ApplicationConfig;
+import org.oransc.enrichment.controllers.producer.ProducerCallbacks;
 import org.oransc.enrichment.repository.EiJobs;
-import org.oransc.enrichment.repository.EiProducers;
 import org.oransc.enrichment.repository.EiTypes;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -46,6 +46,10 @@ class BeanFactory {
     private final ApplicationConfig applicationConfig = new ApplicationConfig();
     private final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
 
+    private ProducerCallbacks producerCallbacks;
+    private EiTypes eiTypes;
+    private EiJobs eiJobs;
+
     @Bean
     public ObjectMapper mapper() {
         return new ObjectMapper();
@@ -62,23 +66,36 @@ class BeanFactory {
 
     @Bean
     public EiJobs eiJobs() {
-        EiJobs jobs = new EiJobs(getApplicationConfig());
-        try {
-            jobs.restoreJobsFromDatabase();
-        } catch (Exception e) {
-            logger.error("Could not restore jobs from database: {}", e.getMessage());
+        if (eiJobs == null) {
+            eiJobs = new EiJobs(getApplicationConfig(), producerCallbacks());
+            try {
+                eiJobs.restoreJobsFromDatabase();
+            } catch (Exception e) {
+                logger.error("Could not restore jobs from database: {}", e.getMessage());
+            }
         }
-        return jobs;
+        return eiJobs;
     }
 
     @Bean
     public EiTypes eiTypes() {
-        return new EiTypes();
+        if (this.eiTypes == null) {
+            eiTypes = new EiTypes(getApplicationConfig());
+            try {
+                eiTypes.restoreTypesFromDatabase();
+            } catch (Exception e) {
+                logger.error("Could not restore EI types from database: {}", e.getMessage());
+            }
+        }
+        return eiTypes;
     }
 
     @Bean
-    public EiProducers eiProducers() {
-        return new EiProducers();
+    public ProducerCallbacks producerCallbacks() {
+        if (this.producerCallbacks == null) {
+            producerCallbacks = new ProducerCallbacks(getApplicationConfig());
+        }
+        return this.producerCallbacks;
     }
 
     @Bean
index 76da624..f0f6c4b 100644 (file)
@@ -28,6 +28,7 @@ import io.netty.handler.timeout.WriteTimeoutHandler;
 import java.lang.invoke.MethodHandles;
 import java.util.concurrent.atomic.AtomicInteger;
 
+import org.oransc.enrichment.configuration.WebClientConfig.HttpProxyConfig;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.http.MediaType;
@@ -42,6 +43,7 @@ import org.springframework.web.reactive.function.client.WebClientResponseExcepti
 import reactor.core.publisher.Mono;
 import reactor.netty.http.client.HttpClient;
 import reactor.netty.resources.ConnectionProvider;
+import reactor.netty.tcp.ProxyProvider.Proxy;
 import reactor.netty.tcp.TcpClient;
 
 /**
@@ -54,19 +56,12 @@ public class AsyncRestClient {
     private final String baseUrl;
     private static final AtomicInteger sequenceNumber = new AtomicInteger();
     private final SslContext sslContext;
+    private final HttpProxyConfig httpProxyConfig;
 
-    /**
-     * Note that only http (not https) will work when this constructor is used.
-     * 
-     * @param baseUrl
-     */
-    public AsyncRestClient(String baseUrl) {
-        this(baseUrl, null);
-    }
-
-    public AsyncRestClient(String baseUrl, SslContext sslContext) {
+    public AsyncRestClient(String baseUrl, @Nullable SslContext sslContext, @Nullable HttpProxyConfig httpProxyConfig) {
         this.baseUrl = baseUrl;
         this.sslContext = sslContext;
+        this.httpProxyConfig = httpProxyConfig;
     }
 
     public Mono<ResponseEntity<String>> postForEntity(String uri, @Nullable String body) {
@@ -188,7 +183,7 @@ public class AsyncRestClient {
             logger.debug("{} HTTP error status = '{}', body '{}'", traceTag, exception.getStatusCode(),
                 exception.getResponseBodyAsString());
         } else {
-            logger.debug("{} HTTP error", traceTag, t);
+            logger.debug("{} HTTP error {}", traceTag, t.getMessage());
         }
     }
 
@@ -200,27 +195,31 @@ public class AsyncRestClient {
         }
     }
 
-    private TcpClient createTcpClientSecure(SslContext sslContext) {
-        return TcpClient.create(ConnectionProvider.newConnection()) //
-            .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 10_000) //
-            .secure(c -> c.sslContext(sslContext)) //
-            .doOnConnected(connection -> {
-                connection.addHandlerLast(new ReadTimeoutHandler(30));
-                connection.addHandlerLast(new WriteTimeoutHandler(30));
-            });
+    private boolean isHttpProxyConfigured() {
+        return httpProxyConfig != null && httpProxyConfig.httpProxyPort() > 0
+            && !httpProxyConfig.httpProxyHost().isEmpty();
     }
 
-    private TcpClient createTcpClientInsecure() {
-        return TcpClient.create(ConnectionProvider.newConnection()) //
+    private TcpClient createTcpClient() {
+        TcpClient client = TcpClient.create(ConnectionProvider.newConnection()) //
             .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 10_000) //
             .doOnConnected(connection -> {
                 connection.addHandlerLast(new ReadTimeoutHandler(30));
                 connection.addHandlerLast(new WriteTimeoutHandler(30));
             });
+        if (this.sslContext != null) {
+            client = client.secure(c -> c.sslContext(sslContext));
+        }
+        if (isHttpProxyConfigured()) {
+            client = client.proxy(proxy -> proxy.type(Proxy.HTTP).host(httpProxyConfig.httpProxyHost())
+                .port(httpProxyConfig.httpProxyPort()));
+        }
+        return client;
     }
 
     private WebClient createWebClient(String baseUrl, TcpClient tcpClient) {
         HttpClient httpClient = HttpClient.from(tcpClient);
+
         ReactorClientHttpConnector connector = new ReactorClientHttpConnector(httpClient);
         ExchangeStrategies exchangeStrategies = ExchangeStrategies.builder() //
             .codecs(configurer -> configurer.defaultCodecs().maxInMemorySize(-1)) //
@@ -235,13 +234,8 @@ public class AsyncRestClient {
     private Mono<WebClient> getWebClient() {
         if (this.webClient == null) {
             try {
-                if (this.sslContext != null) {
-                    TcpClient tcpClient = createTcpClientSecure(sslContext);
-                    this.webClient = createWebClient(this.baseUrl, tcpClient);
-                } else {
-                    TcpClient tcpClient = createTcpClientInsecure();
-                    this.webClient = createWebClient(this.baseUrl, tcpClient);
-                }
+                TcpClient tcpClient = createTcpClient();
+                this.webClient = createWebClient(this.baseUrl, tcpClient);
             } catch (Exception e) {
                 logger.error("Could not create WebClient {}", e.getMessage());
                 return Mono.error(e);
index 07f23e9..4865df5 100644 (file)
@@ -42,6 +42,7 @@ import java.util.stream.Collectors;
 import javax.net.ssl.KeyManagerFactory;
 
 import org.oransc.enrichment.configuration.WebClientConfig;
+import org.oransc.enrichment.configuration.WebClientConfig.HttpProxyConfig;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.util.ResourceUtils;
@@ -53,25 +54,38 @@ public class AsyncRestClientFactory {
     private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
 
     private final SslContextFactory sslContextFactory;
+    private final HttpProxyConfig httpProxyConfig;
 
     public AsyncRestClientFactory(WebClientConfig clientConfig) {
         if (clientConfig != null) {
             this.sslContextFactory = new CachingSslContextFactory(clientConfig);
+            this.httpProxyConfig = clientConfig.httpProxyConfig();
         } else {
+            logger.warn("No configuration for web client defined, HTTPS will not work");
             this.sslContextFactory = null;
+            this.httpProxyConfig = null;
         }
     }
 
-    public AsyncRestClient createRestClient(String baseUrl) {
+    public AsyncRestClient createRestClientNoHttpProxy(String baseUrl) {
+        return createRestClient(baseUrl, false);
+    }
+
+    public AsyncRestClient createRestClientUseHttpProxy(String baseUrl) {
+        return createRestClient(baseUrl, true);
+    }
+
+    private AsyncRestClient createRestClient(String baseUrl, boolean useHttpProxy) {
         if (this.sslContextFactory != null) {
             try {
-                return new AsyncRestClient(baseUrl, this.sslContextFactory.createSslContext());
+                return new AsyncRestClient(baseUrl, this.sslContextFactory.createSslContext(),
+                    useHttpProxy ? httpProxyConfig : null);
             } catch (Exception e) {
                 String exceptionString = e.toString();
                 logger.error("Could not init SSL context, reason: {}", exceptionString);
             }
         }
-        return new AsyncRestClient(baseUrl);
+        return new AsyncRestClient(baseUrl, null, httpProxyConfig);
     }
 
     private class SslContextFactory {
@@ -175,5 +189,4 @@ public class AsyncRestClientFactory {
 
         }
     }
-
 }
index 8937464..db4201b 100644 (file)
 
 package org.oransc.enrichment.configuration;
 
-import javax.validation.constraints.NotEmpty;
-
 import lombok.Getter;
 
+import org.oransc.enrichment.configuration.WebClientConfig.HttpProxyConfig;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.boot.context.properties.ConfigurationProperties;
 import org.springframework.boot.context.properties.EnableConfigurationProperties;
@@ -31,10 +30,6 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties
 @EnableConfigurationProperties
 @ConfigurationProperties()
 public class ApplicationConfig {
-    @NotEmpty
-    @Getter
-    @Value("${app.filepath}")
-    private String localConfigurationFilePath;
 
     @Getter
     @Value("${app.vardata-directory}")
@@ -61,16 +56,32 @@ public class ApplicationConfig {
     @Value("${app.webclient.trust-store}")
     private String sslTrustStore = "";
 
+    @Value("${app.webclient.http.proxy-host:\"\"}")
+    private String httpProxyHost = "";
+
+    @Value("${app.webclient.http.proxy-port:0}")
+    private int httpProxyPort = 0;
+
+    private WebClientConfig webClientConfig = null;
+
     public WebClientConfig getWebClientConfig() {
-        return ImmutableWebClientConfig.builder() //
-            .keyStoreType(this.sslKeyStoreType) //
-            .keyStorePassword(this.sslKeyStorePassword) //
-            .keyStore(this.sslKeyStore) //
-            .keyPassword(this.sslKeyPassword) //
-            .isTrustStoreUsed(this.sslTrustStoreUsed) //
-            .trustStore(this.sslTrustStore) //
-            .trustStorePassword(this.sslTrustStorePassword) //
-            .build();
+        if (this.webClientConfig == null) {
+            HttpProxyConfig httpProxyConfig = ImmutableHttpProxyConfig.builder() //
+                .httpProxyHost(this.httpProxyHost) //
+                .httpProxyPort(this.httpProxyPort) //
+                .build();
+            this.webClientConfig = ImmutableWebClientConfig.builder() //
+                .keyStoreType(this.sslKeyStoreType) //
+                .keyStorePassword(this.sslKeyStorePassword) //
+                .keyStore(this.sslKeyStore) //
+                .keyPassword(this.sslKeyPassword) //
+                .isTrustStoreUsed(this.sslTrustStoreUsed) //
+                .trustStore(this.sslTrustStore) //
+                .trustStorePassword(this.sslTrustStorePassword) //
+                .httpProxyConfig(httpProxyConfig) //
+                .build();
+        }
+        return this.webClientConfig;
     }
 
 }
index 61d0f5a..0b68248 100644 (file)
@@ -42,4 +42,13 @@ public interface WebClientConfig {
 
     public String trustStore();
 
+    @Value.Immutable
+    public interface HttpProxyConfig {
+        public String httpProxyHost();
+
+        public int httpProxyPort();
+    }
+
+    public HttpProxyConfig httpProxyConfig();
+
 }
index b28da8d..b2ffd7e 100644 (file)
@@ -25,7 +25,7 @@ import io.swagger.annotations.ApiModel;
 import org.immutables.gson.Gson;
 
 @Gson.TypeAdapters
-@ApiModel(value = "Void", description = "Void/empty")
+@ApiModel(value = "Void", description = "Void/empty ")
 public class VoidResponse {
     private VoidResponse() {
     }
index 9087355..7ccf61d 100644 (file)
@@ -24,20 +24,23 @@ import com.google.gson.Gson;
 import com.google.gson.GsonBuilder;
 
 import java.lang.invoke.MethodHandles;
+import java.util.Collection;
 
 import org.oransc.enrichment.clients.AsyncRestClient;
 import org.oransc.enrichment.clients.AsyncRestClientFactory;
 import org.oransc.enrichment.configuration.ApplicationConfig;
 import org.oransc.enrichment.repository.EiJob;
 import org.oransc.enrichment.repository.EiJobs;
-import org.oransc.enrichment.repository.EiProducer;
+import org.oransc.enrichment.repository.EiProducers;
 import org.oransc.enrichment.repository.EiType;
-import org.oransc.enrichment.repository.EiTypes;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
+import reactor.core.publisher.Flux;
+import reactor.core.publisher.Mono;
+
 /**
  * Callbacks to the EiProducer
  */
@@ -49,55 +52,39 @@ public class ConsumerCallbacks {
     private static Gson gson = new GsonBuilder().create();
 
     private final AsyncRestClient restClient;
-    private final EiTypes eiTypes;
     private final EiJobs eiJobs;
+    private final EiProducers eiProducers;
 
     @Autowired
-    public ConsumerCallbacks(ApplicationConfig config, EiTypes eiTypes, EiJobs eiJobs) {
+    public ConsumerCallbacks(ApplicationConfig config, EiJobs eiJobs, EiProducers eiProducers) {
         AsyncRestClientFactory restClientFactory = new AsyncRestClientFactory(config.getWebClientConfig());
-        this.restClient = restClientFactory.createRestClient("");
-        this.eiTypes = eiTypes;
+        this.restClient = restClientFactory.createRestClientUseHttpProxy("");
         this.eiJobs = eiJobs;
+        this.eiProducers = eiProducers;
     }
 
-    public void notifyConsumersProducerDeleted(EiProducer eiProducer) {
-        for (EiType type : eiProducer.getEiTypes()) {
-            if (this.eiTypes.get(type.getId()) == null) {
-                // The type is removed
-                for (EiJob job : this.eiJobs.getJobsForType(type)) {
-                    if (job.isLastStatusReportedEnabled()) {
-                        noifyJobOwner(job, new ConsumerEiJobStatus(ConsumerEiJobStatus.EiJobStatusValues.DISABLED));
-                        job.setLastReportedStatus(false);
-                    }
-                }
-            }
-        }
-    }
-
-    public void notifyConsumersProducerAdded(EiProducer eiProducer) {
-        for (EiType type : eiProducer.getEiTypes()) {
-            notifyConsumersTypeAdded(type);
-        }
+    public Flux<String> notifyJobStatus(Collection<EiType> eiTypes) {
+        return Flux.fromIterable(eiTypes) //
+            .flatMap(eiType -> Flux.fromIterable(this.eiJobs.getJobsForType(eiType))) //
+            .filter(eiJob -> !eiJob.getJobStatusUrl().isEmpty()) //
+            .filter(eiJob -> this.eiProducers.isJobEnabled(eiJob) != eiJob.isLastStatusReportedEnabled())
+            .flatMap(this::noifyStatusToJobOwner);
     }
 
-    public void notifyConsumersTypeAdded(EiType eiType) {
-        for (EiJob job : this.eiJobs.getJobsForType(eiType)) {
-            if (!job.isLastStatusReportedEnabled()) {
-                noifyJobOwner(job, new ConsumerEiJobStatus(ConsumerEiJobStatus.EiJobStatusValues.ENABLED));
-                job.setLastReportedStatus(true);
-            }
-        }
-    }
+    private Mono<String> noifyStatusToJobOwner(EiJob job) {
+        boolean isJobEnabled = this.eiProducers.isJobEnabled(job);
+        ConsumerEiJobStatus status =
+            isJobEnabled ? new ConsumerEiJobStatus(ConsumerEiJobStatus.EiJobStatusValues.ENABLED)
+                : new ConsumerEiJobStatus(ConsumerEiJobStatus.EiJobStatusValues.DISABLED);
+        String body = gson.toJson(status);
+        return this.restClient.post(job.getJobStatusUrl(), body) //
+            .doOnNext(response -> logger.debug("Consumer notified OK {}", job.getId())) //
+            .doOnNext(response -> job.setLastReportedStatus(isJobEnabled)) //
+            .onErrorResume(throwable -> {
+                logger.warn("Consumer notify failed {} {}", job.getJobStatusUrl(), throwable.toString());
+                return Mono.empty();
+            });
 
-    private void noifyJobOwner(EiJob job, ConsumerEiJobStatus status) {
-        if (!job.getJobStatusUrl().isEmpty()) {
-            String body = gson.toJson(status);
-            this.restClient.post(job.getJobStatusUrl(), body) //
-                .subscribe(notUsed -> logger.debug("Consumer notified OK {}", job.getId()), //
-                    throwable -> logger.warn("Consumer notify failed {} {}", job.getJobStatusUrl(),
-                        throwable.toString()), //
-                    null);
-        }
     }
 
 }
index f45ff73..8267b6a 100644 (file)
@@ -30,10 +30,9 @@ import io.swagger.annotations.ApiParam;
 import io.swagger.annotations.ApiResponse;
 import io.swagger.annotations.ApiResponses;
 
+import java.lang.invoke.MethodHandles;
 import java.util.ArrayList;
-import java.util.Collection;
 import java.util.List;
-import java.util.Vector;
 
 import org.everit.json.schema.Schema;
 import org.everit.json.schema.loader.SchemaLoader;
@@ -45,9 +44,11 @@ import org.oransc.enrichment.controllers.producer.ProducerCallbacks;
 import org.oransc.enrichment.exceptions.ServiceException;
 import org.oransc.enrichment.repository.EiJob;
 import org.oransc.enrichment.repository.EiJobs;
-import org.oransc.enrichment.repository.EiProducer;
+import org.oransc.enrichment.repository.EiProducers;
 import org.oransc.enrichment.repository.EiType;
 import org.oransc.enrichment.repository.EiTypes;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.MediaType;
@@ -68,6 +69,8 @@ import reactor.core.publisher.Mono;
 @RequestMapping(path = ConsumerConsts.API_ROOT, produces = MediaType.APPLICATION_JSON_VALUE)
 public class ConsumerController {
 
+    private final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
+
     @Autowired
     ApplicationConfig applicationConfig;
 
@@ -77,6 +80,9 @@ public class ConsumerController {
     @Autowired
     private EiTypes eiTypes;
 
+    @Autowired
+    private EiProducers eiProducers;
+
     @Autowired
     ProducerCallbacks producerCallbacks;
 
@@ -205,20 +211,11 @@ public class ConsumerController {
         }
     }
 
-    private Collection<EiProducer> getProducers(EiJob eiJob) {
-        try {
-            return this.eiTypes.getType(eiJob.getTypeId()).getProducers();
-        } catch (Exception e) {
-            return new Vector<>();
-        }
-    }
-
     private ConsumerEiJobStatus toEiJobStatus(EiJob job) {
-        if (getProducers(job).isEmpty()) {
-            return new ConsumerEiJobStatus(ConsumerEiJobStatus.EiJobStatusValues.DISABLED);
-        } else {
-            return new ConsumerEiJobStatus(ConsumerEiJobStatus.EiJobStatusValues.ENABLED);
-        }
+        return this.eiProducers.isJobEnabled(job)
+            ? new ConsumerEiJobStatus(ConsumerEiJobStatus.EiJobStatusValues.ENABLED)
+            : new ConsumerEiJobStatus(ConsumerEiJobStatus.EiJobStatusValues.DISABLED);
+
     }
 
     @DeleteMapping(path = "/eijobs/{eiJobId}", produces = MediaType.APPLICATION_JSON_VALUE)
@@ -235,8 +232,7 @@ public class ConsumerController {
         @PathVariable("eiJobId") String eiJobId) {
         try {
             EiJob job = this.eiJobs.getJob(eiJobId);
-            this.eiJobs.remove(job);
-            this.producerCallbacks.notifyProducersJobDeleted(job);
+            this.eiJobs.remove(job, this.eiProducers);
             return new ResponseEntity<>(HttpStatus.NO_CONTENT);
         } catch (Exception e) {
             return ErrorResponse.create(e, HttpStatus.NOT_FOUND);
@@ -263,21 +259,17 @@ public class ConsumerController {
         final boolean isNewJob = this.eiJobs.get(eiJobId) == null;
 
         return validatePutEiJob(eiJobId, eiJobObject) //
-            .flatMap(this::notifyProducersNewJob) //
+            .flatMap(this::startEiJob) //
             .doOnNext(newEiJob -> this.eiJobs.put(newEiJob)) //
             .flatMap(newEiJob -> Mono.just(new ResponseEntity<>(isNewJob ? HttpStatus.CREATED : HttpStatus.OK)))
             .onErrorResume(throwable -> Mono.just(ErrorResponse.create(throwable, HttpStatus.NOT_FOUND)));
     }
 
-    private Mono<EiJob> notifyProducersNewJob(EiJob newEiJob) {
-        return this.producerCallbacks.notifyProducersJobStarted(newEiJob) //
-            .flatMap(noOfAcceptingProducers -> {
-                if (noOfAcceptingProducers.intValue() > 0) {
-                    return Mono.just(newEiJob);
-                } else {
-                    return Mono.error(new ServiceException("Job not accepted by any producers", HttpStatus.CONFLICT));
-                }
-            });
+    private Mono<EiJob> startEiJob(EiJob newEiJob) {
+        return this.producerCallbacks.startEiJob(newEiJob, eiProducers) //
+            .doOnNext(noOfAcceptingProducers -> this.logger.debug(
+                "Started EI job {}, number of activated producers: {}", newEiJob.getId(), noOfAcceptingProducers)) //
+            .flatMap(noOfAcceptingProducers -> Mono.just(newEiJob));
     }
 
     private Mono<EiJob> validatePutEiJob(String eiJobId, ConsumerEiJobInfo eiJobInfo) {
index dc732e1..9b489cd 100644 (file)
@@ -26,7 +26,6 @@ import com.google.gson.GsonBuilder;
 import java.lang.invoke.MethodHandles;
 import java.time.Duration;
 import java.util.Collection;
-import java.util.Vector;
 
 import org.oransc.enrichment.clients.AsyncRestClient;
 import org.oransc.enrichment.clients.AsyncRestClientFactory;
@@ -34,11 +33,9 @@ import org.oransc.enrichment.configuration.ApplicationConfig;
 import org.oransc.enrichment.repository.EiJob;
 import org.oransc.enrichment.repository.EiJobs;
 import org.oransc.enrichment.repository.EiProducer;
-import org.oransc.enrichment.repository.EiTypes;
+import org.oransc.enrichment.repository.EiProducers;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
 
 import reactor.core.publisher.Flux;
 import reactor.core.publisher.Mono;
@@ -47,7 +44,6 @@ import reactor.util.retry.Retry;
 /**
  * Callbacks to the EiProducer
  */
-@Component
 @SuppressWarnings("java:S3457") // No need to call "toString()" method as formatting and string ..
 public class ProducerCallbacks {
 
@@ -55,20 +51,22 @@ public class ProducerCallbacks {
     private static Gson gson = new GsonBuilder().create();
 
     private final AsyncRestClient restClient;
-    private final EiTypes eiTypes;
 
-    @Autowired
-    public ProducerCallbacks(ApplicationConfig config, EiTypes eiTypes) {
+    public ProducerCallbacks(ApplicationConfig config) {
         AsyncRestClientFactory restClientFactory = new AsyncRestClientFactory(config.getWebClientConfig());
-        this.restClient = restClientFactory.createRestClient("");
-        this.eiTypes = eiTypes;
+        this.restClient = restClientFactory.createRestClientNoHttpProxy("");
     }
 
-    public void notifyProducersJobDeleted(EiJob eiJob) {
-        for (EiProducer producer : getProducers(eiJob)) {
+    public Mono<String> healthCheck(EiProducer producer) {
+        return restClient.get(producer.getProducerSupervisionCallbackUrl());
+    }
+
+    public void stopEiJob(EiJob eiJob, EiProducers eiProducers) {
+        for (EiProducer producer : getProducersForJob(eiJob, eiProducers)) {
             String url = producer.getJobCallbackUrl() + "/" + eiJob.getId();
+            producer.setJobDisabled(eiJob);
             restClient.delete(url) //
-                .subscribe(notUsed -> logger.debug("Producer job deleted OK {}", producer.getId()), //
+                .subscribe(response -> logger.debug("Producer job deleted OK {}", producer.getId()), //
                     throwable -> logger.warn("Producer job delete failed {} {}", producer.getId(),
                         throwable.getMessage()),
                     null);
@@ -76,40 +74,35 @@ public class ProducerCallbacks {
     }
 
     /**
-     * Calls all producers for an EiJob activation.
+     * Start a job in all producers that suports the job type
      * 
      * @param eiJob an EI job
      * @return the number of producers that returned OK
      */
-    public Mono<Integer> notifyProducersJobStarted(EiJob eiJob) {
+    public Mono<Integer> startEiJob(EiJob eiJob, EiProducers eiProducers) {
         Retry retrySpec = Retry.fixedDelay(1, Duration.ofSeconds(1));
-        return Flux.fromIterable(getProducers(eiJob)) //
-            .flatMap(eiProducer -> notifyProducerJobStarted(eiProducer, eiJob, retrySpec)) //
+        return Flux.fromIterable(getProducersForJob(eiJob, eiProducers)) //
+            .flatMap(eiProducer -> startEiJob(eiProducer, eiJob, retrySpec)) //
             .collectList() //
             .flatMap(okResponses -> Mono.just(Integer.valueOf(okResponses.size()))); //
     }
 
     /**
-     * Restart all jobs for one producer
+     * Start all jobs for one producer
      * 
      * @param producer
      * @param eiJobs
      */
-    public void restartJobs(EiProducer producer, EiJobs eiJobs) {
+    public Flux<String> startEiJobs(EiProducer producer, EiJobs eiJobs) {
         final int maxNoOfParalellRequests = 10;
         Retry retrySpec = Retry.backoff(3, Duration.ofSeconds(1));
 
-        Flux.fromIterable(producer.getEiTypes()) //
+        return Flux.fromIterable(producer.getEiTypes()) //
             .flatMap(type -> Flux.fromIterable(eiJobs.getJobsForType(type))) //
-            .flatMap(job -> notifyProducerJobStarted(producer, job, retrySpec), maxNoOfParalellRequests) //
-            .onErrorResume(t -> {
-                logger.error("Could not restart EI Job for producer: {}, reason :{}", producer.getId(), t.getMessage());
-                return Flux.empty();
-            }) //
-            .subscribe();
+            .flatMap(job -> startEiJob(producer, job, retrySpec), maxNoOfParalellRequests);
     }
 
-    private Mono<String> notifyProducerJobStarted(EiProducer producer, EiJob eiJob, Retry retrySpec) {
+    public Mono<String> startEiJob(EiProducer producer, EiJob eiJob, Retry retrySpec) {
         ProducerJobInfo request = new ProducerJobInfo(eiJob);
         String body = gson.toJson(request);
 
@@ -117,17 +110,15 @@ public class ProducerCallbacks {
             .retryWhen(retrySpec) //
             .doOnNext(resp -> logger.debug("Job subscription {} started OK {}", eiJob.getId(), producer.getId())) //
             .onErrorResume(throwable -> {
+                producer.setJobDisabled(eiJob);
                 logger.warn("Job subscription failed {}", producer.getId(), throwable.toString());
                 return Mono.empty();
-            });
+            }) //
+            .doOnNext(resp -> producer.setJobEnabled(eiJob));
     }
 
-    private Collection<EiProducer> getProducers(EiJob eiJob) {
-        try {
-            return this.eiTypes.getType(eiJob.getTypeId()).getProducers();
-        } catch (Exception e) {
-            return new Vector<>();
-        }
+    private Collection<EiProducer> getProducersForJob(EiJob eiJob, EiProducers eiProducers) {
+        return eiProducers.getProducersForType(eiJob.getTypeId());
     }
 
 }
index 9722594..7c46117 100644 (file)
@@ -23,7 +23,7 @@ package org.oransc.enrichment.controllers.producer;
 public class ProducerConsts {
 
     public static final String API_ROOT = "/ei-producer/v1";
-    public static final String PRODUCER_API_NAME = "Enrichment Data Producer API";
+    public static final String PRODUCER_API_NAME = "Data Producer Registry API";
 
     private ProducerConsts() {
     }
index e517b3a..7e905da 100644 (file)
@@ -25,26 +25,24 @@ import com.google.gson.GsonBuilder;
 
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
 import io.swagger.annotations.ApiResponse;
 import io.swagger.annotations.ApiResponses;
 
-import java.lang.invoke.MethodHandles;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
 
 import org.oransc.enrichment.controllers.ErrorResponse;
 import org.oransc.enrichment.controllers.VoidResponse;
-import org.oransc.enrichment.controllers.consumer.ConsumerCallbacks;
-import org.oransc.enrichment.controllers.producer.ProducerRegistrationInfo.ProducerEiTypeRegistrationInfo;
+import org.oransc.enrichment.exceptions.ServiceException;
 import org.oransc.enrichment.repository.EiJob;
 import org.oransc.enrichment.repository.EiJobs;
 import org.oransc.enrichment.repository.EiProducer;
 import org.oransc.enrichment.repository.EiProducers;
 import org.oransc.enrichment.repository.EiType;
 import org.oransc.enrichment.repository.EiTypes;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.oransc.enrichment.repository.ImmutableEiProducerRegistrationInfo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.MediaType;
@@ -54,6 +52,7 @@ import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.PutMapping;
 import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
 @SuppressWarnings("squid:S2629") // Invoke method(s) only conditionally
@@ -61,8 +60,6 @@ import org.springframework.web.bind.annotation.RestController;
 @Api(tags = {ProducerConsts.PRODUCER_API_NAME})
 public class ProducerController {
 
-    private final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
-
     private static Gson gson = new GsonBuilder().create();
 
     @Autowired
@@ -74,12 +71,6 @@ public class ProducerController {
     @Autowired
     private EiProducers eiProducers;
 
-    @Autowired
-    ProducerCallbacks producerCallbacks;
-
-    @Autowired
-    ConsumerCallbacks consumerCallbacks;
-
     @GetMapping(path = ProducerConsts.API_ROOT + "/eitypes", produces = MediaType.APPLICATION_JSON_VALUE)
     @ApiOperation(value = "EI type identifiers", notes = "")
     @ApiResponses(
@@ -120,6 +111,54 @@ public class ProducerController {
         }
     }
 
+    @PutMapping(path = ProducerConsts.API_ROOT + "/eitypes/{eiTypeId}", produces = MediaType.APPLICATION_JSON_VALUE)
+    @ApiResponses(
+        value = { //
+            @ApiResponse(code = 200, message = "Type updated", response = VoidResponse.class), //
+            @ApiResponse(code = 201, message = "Type created", response = VoidResponse.class), //
+            @ApiResponse(code = 400, message = "Bad request", response = ErrorResponse.ErrorInfo.class)})
+
+    @ApiOperation(value = "Individual EI type", notes = "")
+    public ResponseEntity<Object> putEiType( //
+        @PathVariable("eiTypeId") String eiTypeId, @RequestBody ProducerEiTypeInfo registrationInfo) {
+
+        EiType previousDefinition = this.eiTypes.get(eiTypeId);
+        if (registrationInfo.jobDataSchema == null) {
+            return ErrorResponse.create("No schema provided", HttpStatus.BAD_REQUEST);
+        }
+        this.eiTypes.put(new EiType(eiTypeId, registrationInfo.jobDataSchema));
+        return new ResponseEntity<>(previousDefinition == null ? HttpStatus.CREATED : HttpStatus.OK);
+    }
+
+    @DeleteMapping(path = ProducerConsts.API_ROOT + "/eitypes/{eiTypeId}", produces = MediaType.APPLICATION_JSON_VALUE)
+    @ApiOperation(value = "Individual EI type", notes = "")
+    @ApiResponses(
+        value = { //
+            @ApiResponse(code = 200, message = "Not used", response = VoidResponse.class),
+            @ApiResponse(code = 204, message = "Producer deleted", response = VoidResponse.class),
+            @ApiResponse(
+                code = 404,
+                message = "Enrichment Information type is not found",
+                response = ErrorResponse.ErrorInfo.class),
+            @ApiResponse(
+                code = 406,
+                message = "The Enrichment Information type has one or several active producers",
+                response = ErrorResponse.ErrorInfo.class)})
+    public ResponseEntity<Object> deleteEiType( //
+        @PathVariable("eiTypeId") String eiTypeId) {
+
+        EiType type = this.eiTypes.get(eiTypeId);
+        if (type == null) {
+            return ErrorResponse.create("EI type not found", HttpStatus.NOT_FOUND);
+        }
+        if (!this.eiProducers.getProducersForType(type).isEmpty()) {
+            String firstProducerId = this.eiProducers.getProducersForType(type).iterator().next().getId();
+            return ErrorResponse.create("The type has active producers: " + firstProducerId, HttpStatus.NOT_ACCEPTABLE);
+        }
+        this.eiTypes.remove(type);
+        return new ResponseEntity<>(HttpStatus.NO_CONTENT);
+    }
+
     @GetMapping(path = ProducerConsts.API_ROOT + "/eiproducers", produces = MediaType.APPLICATION_JSON_VALUE)
     @ApiOperation(value = "EI producer identifiers", notes = "")
     @ApiResponses(
@@ -131,9 +170,15 @@ public class ProducerController {
                 responseContainer = "List"), //
         })
     public ResponseEntity<Object> getEiProducerIdentifiers( //
+        @ApiParam(
+            name = "ei_type_id",
+            required = false,
+            value = "If given, only the producers for the EI Data type is returned.") //
+        @RequestParam(name = "ei_type_id", required = false) String typeId //
     ) {
         List<String> result = new ArrayList<>();
-        for (EiProducer eiProducer : this.eiProducers.getAllProducers()) {
+        for (EiProducer eiProducer : typeId == null ? this.eiProducers.getAllProducers()
+            : this.eiProducers.getProducersForType(typeId)) {
             result.add(eiProducer.getId());
         }
 
@@ -146,7 +191,7 @@ public class ProducerController {
     @ApiOperation(value = "Individual EI producer", notes = "")
     @ApiResponses(
         value = { //
-            @ApiResponse(code = 200, message = "EI jobs", response = ProducerRegistrationInfo.class), //
+            @ApiResponse(code = 200, message = "EI producer", response = ProducerRegistrationInfo.class), //
             @ApiResponse(
                 code = 404,
                 message = "Enrichment Information producer is not found",
@@ -168,7 +213,11 @@ public class ProducerController {
     @ApiOperation(value = "EI job definitions", notes = "EI job definitions for one EI producer")
     @ApiResponses(
         value = { //
-            @ApiResponse(code = 200, message = "EI jobs", response = ProducerJobInfo.class, responseContainer = "List"), //
+            @ApiResponse(
+                code = 200,
+                message = "EI producer",
+                response = ProducerJobInfo.class,
+                responseContainer = "List"), //
             @ApiResponse(
                 code = 404,
                 message = "Enrichment Information producer is not found",
@@ -197,7 +246,7 @@ public class ProducerController {
     @ApiOperation(value = "EI producer status")
     @ApiResponses(
         value = { //
-            @ApiResponse(code = 200, message = "EI jobs", response = ProducerStatusInfo.class), //
+            @ApiResponse(code = 200, message = "EI producer status", response = ProducerStatusInfo.class), //
             @ApiResponse(
                 code = 404,
                 message = "Enrichment Information producer is not found",
@@ -220,46 +269,26 @@ public class ProducerController {
     }
 
     @PutMapping(
-        path = ProducerConsts.API_ROOT + "/eiproducers/{eiProducerId}",
+        path = ProducerConsts.API_ROOT + "/eiproducers/{eiProducerId}", //
         produces = MediaType.APPLICATION_JSON_VALUE)
     @ApiOperation(value = "Individual EI producer", notes = "")
     @ApiResponses(
         value = { //
             @ApiResponse(code = 201, message = "Producer created", response = VoidResponse.class), //
-            @ApiResponse(code = 200, message = "Producer updated", response = VoidResponse.class)}//
+            @ApiResponse(code = 200, message = "Producer updated", response = VoidResponse.class)} //
     )
     public ResponseEntity<Object> putEiProducer( //
         @PathVariable("eiProducerId") String eiProducerId, //
         @RequestBody ProducerRegistrationInfo registrationInfo) {
         try {
             EiProducer previousDefinition = this.eiProducers.get(eiProducerId);
-            if (previousDefinition != null) {
-                for (EiType type : previousDefinition.getEiTypes()) {
-                    type.removeProducer(previousDefinition);
-                }
-            }
-
-            EiProducer producer = registerProducer(eiProducerId, registrationInfo);
-            if (previousDefinition != null) {
-                purgeTypes(previousDefinition.getEiTypes());
-                this.consumerCallbacks.notifyConsumersProducerDeleted(previousDefinition);
-            }
-            this.consumerCallbacks.notifyConsumersProducerAdded(producer);
-
+            this.eiProducers.registerProducer(toEiProducerRegistrationInfo(eiProducerId, registrationInfo));
             return new ResponseEntity<>(previousDefinition == null ? HttpStatus.CREATED : HttpStatus.OK);
         } catch (Exception e) {
             return ErrorResponse.create(e, HttpStatus.NOT_FOUND);
         }
     }
 
-    private void purgeTypes(Collection<EiType> types) {
-        for (EiType type : types) {
-            if (type.getProducerIds().isEmpty()) {
-                this.eiTypes.remove(type);
-            }
-        }
-    }
-
     @DeleteMapping(
         path = ProducerConsts.API_ROOT + "/eiproducers/{eiProducerId}",
         produces = MediaType.APPLICATION_JSON_VALUE)
@@ -272,57 +301,39 @@ public class ProducerController {
     public ResponseEntity<Object> deleteEiProducer(@PathVariable("eiProducerId") String eiProducerId) {
         try {
             final EiProducer producer = this.eiProducers.getProducer(eiProducerId);
-            this.eiProducers.deregisterProducer(producer, this.eiTypes, this.eiJobs);
-            this.consumerCallbacks.notifyConsumersProducerDeleted(producer);
+            this.eiProducers.deregisterProducer(producer);
             return new ResponseEntity<>(HttpStatus.NO_CONTENT);
         } catch (Exception e) {
             return ErrorResponse.create(e, HttpStatus.NOT_FOUND);
         }
     }
 
-    private EiType registerType(ProducerEiTypeRegistrationInfo typeInfo) {
-        EiType type = this.eiTypes.get(typeInfo.eiTypeId);
-        if (type == null) {
-            type = new EiType(typeInfo.eiTypeId, typeInfo.jobDataSchema);
-            this.eiTypes.put(type);
-            this.consumerCallbacks.notifyConsumersTypeAdded(type);
+    private ProducerRegistrationInfo toEiProducerRegistrationInfo(EiProducer p) {
+        Collection<String> types = new ArrayList<>();
+        for (EiType type : p.getEiTypes()) {
+            types.add(type.getId());
         }
-        return type;
-    }
-
-    EiProducer createProducer(Collection<EiType> types, String producerId, ProducerRegistrationInfo registrationInfo) {
-        return new EiProducer(producerId, types, registrationInfo.jobCallbackUrl,
-            registrationInfo.producerSupervisionCallbackUrl);
+        return new ProducerRegistrationInfo(types, p.getJobCallbackUrl(), p.getProducerSupervisionCallbackUrl());
     }
 
-    private EiProducer registerProducer(String producerId, ProducerRegistrationInfo registrationInfo) {
-        ArrayList<EiType> typesForProducer = new ArrayList<>();
-        EiProducer producer = createProducer(typesForProducer, producerId, registrationInfo);
-        for (ProducerEiTypeRegistrationInfo typeInfo : registrationInfo.types) {
-            EiType type = registerType(typeInfo);
-            typesForProducer.add(type);
-            type.addProducer(producer); //
-        }
-        this.eiProducers.put(producer);
-
-        producerCallbacks.restartJobs(producer, this.eiJobs);
-
-        return producer;
+    private ProducerEiTypeInfo toEiTypeInfo(EiType t) {
+        return new ProducerEiTypeInfo(t.getJobDataSchema());
     }
 
-    ProducerRegistrationInfo toEiProducerRegistrationInfo(EiProducer p) {
-        Collection<ProducerEiTypeRegistrationInfo> types = new ArrayList<>();
-        for (EiType type : p.getEiTypes()) {
-            types.add(toEiTypeRegistrationInfo(type));
+    private EiProducers.EiProducerRegistrationInfo toEiProducerRegistrationInfo(String eiProducerId,
+        ProducerRegistrationInfo info) throws ServiceException {
+        Collection<EiType> supportedTypes = new ArrayList<>();
+        for (String typeId : info.supportedTypeIds) {
+            EiType type = this.eiTypes.getType(typeId);
+            supportedTypes.add(type);
         }
-        return new ProducerRegistrationInfo(types, p.getJobCallbackUrl(), p.getProducerSupervisionCallbackUrl());
-    }
 
-    private ProducerEiTypeRegistrationInfo toEiTypeRegistrationInfo(EiType type) {
-        return new ProducerEiTypeRegistrationInfo(type.getJobDataSchema(), type.getId());
+        return ImmutableEiProducerRegistrationInfo.builder() //
+            .id(eiProducerId) //
+            .jobCallbackUrl(info.jobCallbackUrl) //
+            .producerSupervisionCallbackUrl(info.producerSupervisionCallbackUrl) //
+            .supportedTypes(supportedTypes) //
+            .build();
     }
 
-    private ProducerEiTypeInfo toEiTypeInfo(EiType t) {
-        return new ProducerEiTypeInfo(t.getJobDataSchema(), t.getProducerIds());
-    }
 }
index f13f981..d2b89ef 100644 (file)
@@ -26,27 +26,19 @@ import com.google.gson.annotations.SerializedName;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 
-import java.util.Collection;
-
 import org.immutables.gson.Gson;
 
 @Gson.TypeAdapters
 @ApiModel(value = "producer_ei_type_info", description = "Information for an EI type")
 public class ProducerEiTypeInfo {
 
-    @ApiModelProperty(value = "Json schema for the job data")
+    @ApiModelProperty(value = "Json schema for the job data", required = true)
     @SerializedName("ei_job_data_schema")
-    @JsonProperty("ei_job_data_schema")
+    @JsonProperty(value = "ei_job_data_schema", required = true)
     public Object jobDataSchema;
 
-    @ApiModelProperty(value = "Registered producers")
-    @SerializedName("ei_producer_ids")
-    @JsonProperty(value = "ei_producer_ids", required = true)
-    public Collection<String> producerIds;
-
-    public ProducerEiTypeInfo(Object jobDataSchema, Collection<String> producers) {
+    public ProducerEiTypeInfo(Object jobDataSchema) {
         this.jobDataSchema = jobDataSchema;
-        this.producerIds = producers;
     }
 
     public ProducerEiTypeInfo() {
index c02c280..bc3dba2 100644 (file)
@@ -60,16 +60,23 @@ public class ProducerJobInfo {
     @JsonProperty("owner")
     public String owner;
 
-    public ProducerJobInfo(Object jobData, String id, String typeId, String targetUri, String owner) {
+    @ApiModelProperty(value = "The time when the job was last updated or created (ISO-8601)")
+    @SerializedName("last_updated")
+    @JsonProperty("last_updated")
+    public String lastUpdated;
+
+    public ProducerJobInfo(Object jobData, String id, String typeId, String targetUri, String owner,
+        String lastUpdated) {
         this.id = id;
         this.jobData = jobData;
         this.typeId = typeId;
         this.targetUri = targetUri;
         this.owner = owner;
+        this.lastUpdated = lastUpdated;
     }
 
     public ProducerJobInfo(EiJob job) {
-        this(job.getJobData(), job.getId(), job.getTypeId(), job.getTargetUrl(), job.getOwner());
+        this(job.getJobData(), job.getId(), job.getTypeId(), job.getTargetUrl(), job.getOwner(), job.getLastUpdated());
     }
 
     public ProducerJobInfo() {
index 3f78580..94ae4a6 100644 (file)
@@ -57,10 +57,10 @@ public class ProducerRegistrationInfo {
         }
     }
 
-    @ApiModelProperty(value = "Supported EI types", required = true)
+    @ApiModelProperty(value = "Supported EI type IDs", required = true)
     @SerializedName("supported_ei_types")
     @JsonProperty(value = "supported_ei_types", required = true)
-    public Collection<ProducerEiTypeRegistrationInfo> types;
+    public Collection<String> supportedTypeIds;
 
     @ApiModelProperty(value = "callback for EI job", required = true)
     @SerializedName("ei_job_callback_url")
@@ -72,9 +72,9 @@ public class ProducerRegistrationInfo {
     @JsonProperty(value = "ei_producer_supervision_callback_url", required = true)
     public String producerSupervisionCallbackUrl;
 
-    public ProducerRegistrationInfo(Collection<ProducerEiTypeRegistrationInfo> types, String jobCallbackUrl,
+    public ProducerRegistrationInfo(Collection<String> types, String jobCallbackUrl,
         String producerSupervisionCallbackUrl) {
-        this.types = types;
+        this.supportedTypeIds = types;
         this.jobCallbackUrl = jobCallbackUrl;
         this.producerSupervisionCallbackUrl = producerSupervisionCallbackUrl;
     }
index 9825ab7..46602f3 100644 (file)
@@ -21,6 +21,7 @@
 package org.oransc.enrichment.repository;
 
 import java.lang.invoke.MethodHandles;
+import java.time.Instant;
 
 import lombok.Builder;
 import lombok.Getter;
@@ -53,6 +54,10 @@ public class EiJob {
     @Getter
     private final String jobStatusUrl;
 
+    @Getter
+    @Builder.Default
+    private String lastUpdated = Instant.now().toString();
+
     @Getter
     @Builder.Default
     private boolean isLastStatusReportedEnabled = true;
index bff5be2..f5224f2 100644 (file)
@@ -39,6 +39,7 @@ import java.util.ServiceLoader;
 import java.util.Vector;
 
 import org.oransc.enrichment.configuration.ApplicationConfig;
+import org.oransc.enrichment.controllers.producer.ProducerCallbacks;
 import org.oransc.enrichment.exceptions.ServiceException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -57,11 +58,14 @@ public class EiJobs {
     private final ApplicationConfig config;
     private final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
 
-    public EiJobs(ApplicationConfig config) {
+    private final ProducerCallbacks producerCallbacks;
+
+    public EiJobs(ApplicationConfig config, ProducerCallbacks producerCallbacks) {
         this.config = config;
         GsonBuilder gsonBuilder = new GsonBuilder();
         ServiceLoader.load(TypeAdapterFactory.class).forEach(gsonBuilder::registerTypeAdapterFactory);
         this.gson = gsonBuilder.create();
+        this.producerCallbacks = producerCallbacks;
     }
 
     public synchronized void restoreJobsFromDatabase() throws IOException {
@@ -71,13 +75,13 @@ public class EiJobs {
         for (File file : dbDir.listFiles()) {
             String json = Files.readString(file.toPath());
             EiJob job = gson.fromJson(json, EiJob.class);
-            this.put(job, false);
+            this.doPut(job);
         }
-
     }
 
     public synchronized void put(EiJob job) {
-        this.put(job, true);
+        this.doPut(job);
+        storeJobInFile(job);
     }
 
     public synchronized Collection<EiJob> getJobs() {
@@ -108,15 +112,15 @@ public class EiJobs {
         return allEiJobs.get(id);
     }
 
-    public synchronized EiJob remove(String id) {
+    public synchronized EiJob remove(String id, EiProducers eiProducers) {
         EiJob job = allEiJobs.get(id);
         if (job != null) {
-            remove(job);
+            remove(job, eiProducers);
         }
         return job;
     }
 
-    public synchronized void remove(EiJob job) {
+    public synchronized void remove(EiJob job, EiProducers eiProducers) {
         this.allEiJobs.remove(job.getId());
         jobsByType.remove(job.getTypeId(), job.getId());
         jobsByOwner.remove(job.getOwner(), job.getId());
@@ -126,7 +130,7 @@ public class EiJobs {
         } catch (IOException e) {
             logger.warn("Could not remove file: {}", e.getMessage());
         }
-
+        this.producerCallbacks.stopEiJob(job, eiProducers);
     }
 
     public synchronized int size() {
@@ -137,6 +141,10 @@ public class EiJobs {
         this.allEiJobs.clear();
         this.jobsByType.clear();
         jobsByOwner.clear();
+        clearDatabase();
+    }
+
+    private void clearDatabase() {
         try {
             FileSystemUtils.deleteRecursively(Path.of(getDatabaseDirectory()));
             Files.createDirectories(Paths.get(getDatabaseDirectory()));
@@ -145,13 +153,10 @@ public class EiJobs {
         }
     }
 
-    private void put(EiJob job, boolean storePersistently) {
+    private void doPut(EiJob job) {
         allEiJobs.put(job.getId(), job);
         jobsByType.put(job.getTypeId(), job.getId(), job);
         jobsByOwner.put(job.getOwner(), job.getId(), job);
-        if (storePersistently) {
-            storeJobInFile(job);
-        }
     }
 
     private void storeJobInFile(EiJob job) {
@@ -173,7 +178,7 @@ public class EiJobs {
     }
 
     private String getDatabaseDirectory() {
-        return config.getVardataDirectory() + "/database";
+        return config.getVardataDirectory() + "/eijobs";
     }
 
 }
index 63e5d4c..d8b2015 100644 (file)
@@ -21,6 +21,8 @@
 package org.oransc.enrichment.repository;
 
 import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
 
 import lombok.Getter;
 
@@ -37,6 +39,8 @@ public class EiProducer {
     @Getter
     private final String producerSupervisionCallbackUrl;
 
+    private final Set<String> enabledJobs = new HashSet<>();
+
     private int unresponsiveCounter = 0;
 
     public EiProducer(String id, Collection<EiType> eiTypes, String jobCallbackUrl,
@@ -63,4 +67,19 @@ public class EiProducer {
         return this.unresponsiveCounter == 0;
     }
 
+    public synchronized void setJobEnabled(EiJob job) {
+        this.enabledJobs.add(job.getId());
+    }
+
+    public synchronized void setJobDisabled(EiJob job) {
+        this.enabledJobs.remove(job.getId());
+    }
+
+    /**
+     * Is the job enabled for this producer?
+     */
+    public synchronized boolean isJobEnabled(EiJob job) {
+        return this.enabledJobs.contains(job.getId());
+    }
+
 }
index 801e7fc..f0fc49f 100644 (file)
 package org.oransc.enrichment.repository;
 
 import java.lang.invoke.MethodHandles;
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Vector;
 
+import org.immutables.value.Value.Immutable;
+import org.oransc.enrichment.controllers.consumer.ConsumerCallbacks;
+import org.oransc.enrichment.controllers.producer.ProducerCallbacks;
 import org.oransc.enrichment.exceptions.ServiceException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
 
 /**
  * Dynamic representation of all EiProducers.
  */
 @SuppressWarnings("squid:S2629") // Invoke method(s) only conditionally
+@Component
 public class EiProducers {
     private final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
     private final Map<String, EiProducer> allEiProducers = new HashMap<>();
+    private final MultiMap<EiProducer> producersByType = new MultiMap<>();
 
-    public synchronized void put(EiProducer producer) {
+    @Autowired
+    private ProducerCallbacks producerCallbacks;
+
+    @Autowired
+    private ConsumerCallbacks consumerCallbacks;
+
+    @Autowired
+    private EiJobs eiJobs;
+
+    @Immutable
+    public interface EiProducerRegistrationInfo {
+        String id();
+
+        Collection<EiType> supportedTypes();
+
+        String jobCallbackUrl();
+
+        String producerSupervisionCallbackUrl();
+    }
+
+    public EiProducer registerProducer(EiProducerRegistrationInfo producerInfo) {
+        final String producerId = producerInfo.id();
+        EiProducer previousDefinition = this.get(producerId);
+        if (previousDefinition != null) {
+            for (EiType type : previousDefinition.getEiTypes()) {
+                producersByType.remove(type.getId(), producerId);
+            }
+            allEiProducers.remove(producerId);
+        }
+
+        EiProducer producer = createProducer(producerInfo);
         allEiProducers.put(producer.getId(), producer);
+        for (EiType type : producer.getEiTypes()) {
+            producersByType.put(type.getId(), producer.getId(), producer);
+        }
+
+        Collection<EiType> previousTypes =
+            previousDefinition != null ? previousDefinition.getEiTypes() : new ArrayList<>();
+
+        producerCallbacks.startEiJobs(producer, this.eiJobs) //
+            .collectList() //
+            .flatMapMany(list -> consumerCallbacks.notifyJobStatus(producer.getEiTypes())) //
+            .collectList() //
+            .flatMapMany(list -> consumerCallbacks.notifyJobStatus(previousTypes)) //
+            .subscribe();
+
+        return producer;
+    }
+
+    private EiProducer createProducer(EiProducerRegistrationInfo producerInfo) {
+        return new EiProducer(producerInfo.id(), producerInfo.supportedTypes(), producerInfo.jobCallbackUrl(),
+            producerInfo.producerSupervisionCallbackUrl());
     }
 
     public synchronized Collection<EiProducer> getAllProducers() {
@@ -58,33 +116,49 @@ public class EiProducers {
         return allEiProducers.get(id);
     }
 
-    public synchronized void remove(String id) {
-        this.allEiProducers.remove(id);
-    }
-
     public synchronized int size() {
         return allEiProducers.size();
     }
 
     public synchronized void clear() {
         this.allEiProducers.clear();
+        this.producersByType.clear();
     }
 
-    public void deregisterProducer(EiProducer producer, EiTypes eiTypes, EiJobs eiJobs) {
-        this.remove(producer);
+    public void deregisterProducer(EiProducer producer) {
+        allEiProducers.remove(producer.getId());
         for (EiType type : producer.getEiTypes()) {
-            boolean removed = type.removeProducer(producer) != null;
-            if (!removed) {
+            if (producersByType.remove(type.getId(), producer.getId()) == null) {
                 this.logger.error("Bug, no producer found");
             }
-            if (type.getProducerIds().isEmpty()) {
-                eiTypes.remove(type);
-            }
         }
+        this.consumerCallbacks.notifyJobStatus(producer.getEiTypes()) //
+            .subscribe();
+    }
+
+    public synchronized Collection<EiProducer> getProducersForType(EiType type) {
+        return this.producersByType.get(type.getId());
     }
 
-    private synchronized void remove(EiProducer producer) {
-        this.allEiProducers.remove(producer.getId());
+    public synchronized Collection<EiProducer> getProducersForType(String typeId) {
+        return this.producersByType.get(typeId);
+    }
+
+    public synchronized Collection<String> getProducerIdsForType(String typeId) {
+        Collection<String> producerIds = new ArrayList<>();
+        for (EiProducer p : this.getProducersForType(typeId)) {
+            producerIds.add(p.getId());
+        }
+        return producerIds;
+    }
+
+    public synchronized boolean isJobEnabled(EiJob job) {
+        for (EiProducer producer : this.producersByType.get(job.getTypeId())) {
+            if (producer.isJobEnabled(job)) {
+                return true;
+            }
+        }
+        return false;
     }
 
 }
index a354198..5d9057a 100644 (file)
 
 package org.oransc.enrichment.repository;
 
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
 import lombok.Getter;
 
 public class EiType {
@@ -34,26 +29,9 @@ public class EiType {
     @Getter
     private final Object jobDataSchema;
 
-    private final Map<String, EiProducer> producers = new HashMap<>();
-
     public EiType(String id, Object jobDataSchema) {
         this.id = id;
         this.jobDataSchema = jobDataSchema;
     }
 
-    public synchronized Collection<EiProducer> getProducers() {
-        return Collections.unmodifiableCollection(producers.values());
-    }
-
-    public synchronized Collection<String> getProducerIds() {
-        return Collections.unmodifiableCollection(producers.keySet());
-    }
-
-    public synchronized void addProducer(EiProducer producer) {
-        this.producers.put(producer.getId(), producer);
-    }
-
-    public synchronized EiProducer removeProducer(EiProducer producer) {
-        return this.producers.remove(producer.getId());
-    }
 }
index d0bf53a..363a65e 100644 (file)
 
 package org.oransc.enrichment.repository;
 
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+import com.google.gson.TypeAdapterFactory;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.PrintStream;
 import java.lang.invoke.MethodHandles;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.ServiceLoader;
 import java.util.Vector;
 
+import org.oransc.enrichment.configuration.ApplicationConfig;
 import org.oransc.enrichment.exceptions.ServiceException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.util.FileSystemUtils;
 
 /**
  * Dynamic representation of all EI types in the system.
@@ -37,9 +51,30 @@ import org.slf4j.LoggerFactory;
 public class EiTypes {
     private final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
     private final Map<String, EiType> allEiTypes = new HashMap<>();
+    private final ApplicationConfig config;
+    private final Gson gson;
+
+    public EiTypes(ApplicationConfig config) {
+        this.config = config;
+        GsonBuilder gsonBuilder = new GsonBuilder();
+        ServiceLoader.load(TypeAdapterFactory.class).forEach(gsonBuilder::registerTypeAdapterFactory);
+        this.gson = gsonBuilder.create();
+    }
+
+    public synchronized void restoreTypesFromDatabase() throws IOException {
+        Files.createDirectories(Paths.get(getDatabaseDirectory()));
+        File dbDir = new File(getDatabaseDirectory());
+
+        for (File file : dbDir.listFiles()) {
+            String json = Files.readString(file.toPath());
+            EiType type = gson.fromJson(json, EiType.class);
+            allEiTypes.put(type.getId(), type);
+        }
+    }
 
     public synchronized void put(EiType type) {
         allEiTypes.put(type.getId(), type);
+        storeInFile(type);
     }
 
     public synchronized Collection<EiType> getAllEiTypes() {
@@ -49,7 +84,7 @@ public class EiTypes {
     public synchronized EiType getType(String id) throws ServiceException {
         EiType type = allEiTypes.get(id);
         if (type == null) {
-            throw new ServiceException("Could not find EI type: " + id);
+            throw new ServiceException("EI type not found: " + id);
         }
         return type;
     }
@@ -58,12 +93,13 @@ public class EiTypes {
         return allEiTypes.get(id);
     }
 
-    public synchronized void remove(String id) {
-        allEiTypes.remove(id);
-    }
-
     public synchronized void remove(EiType type) {
-        this.remove(type.getId());
+        allEiTypes.remove(type.getId());
+        try {
+            Files.delete(getPath(type));
+        } catch (IOException e) {
+            logger.warn("Could not remove file: {} {}", type.getId(), e.getMessage());
+        }
     }
 
     public synchronized int size() {
@@ -72,5 +108,41 @@ public class EiTypes {
 
     public synchronized void clear() {
         this.allEiTypes.clear();
+        clearDatabase();
+    }
+
+    private void clearDatabase() {
+        try {
+            FileSystemUtils.deleteRecursively(Path.of(getDatabaseDirectory()));
+            Files.createDirectories(Paths.get(getDatabaseDirectory()));
+        } catch (IOException e) {
+            logger.warn("Could not delete database : {}", e.getMessage());
+        }
+    }
+
+    private void storeInFile(EiType type) {
+        try {
+            try (PrintStream out = new PrintStream(new FileOutputStream(getFile(type)))) {
+                out.print(gson.toJson(type));
+            }
+        } catch (Exception e) {
+            logger.warn("Could not save job: {} {}", type.getId(), e.getMessage());
+        }
+    }
+
+    private File getFile(EiType type) {
+        return getPath(type).toFile();
+    }
+
+    private Path getPath(EiType type) {
+        return getPath(type.getId());
+    }
+
+    private Path getPath(String typeId) {
+        return Path.of(getDatabaseDirectory(), typeId);
+    }
+
+    private String getDatabaseDirectory() {
+        return config.getVardataDirectory() + "/eitypes";
     }
 }
index c2b8270..25e559c 100644 (file)
@@ -38,14 +38,16 @@ public class MultiMap<T> {
         this.map.computeIfAbsent(key, k -> new HashMap<>()).put(id, value);
     }
 
-    public void remove(String key, String id) {
+    public T remove(String key, String id) {
         Map<String, T> innerMap = this.map.get(key);
         if (innerMap != null) {
-            innerMap.remove(id);
+            T removedElement = innerMap.remove(id);
             if (innerMap.isEmpty()) {
                 this.map.remove(key);
             }
+            return removedElement;
         }
+        return null;
     }
 
     public Collection<T> get(String key) {
index e242166..c2e4b97 100644 (file)
 
 package org.oransc.enrichment.tasks;
 
-import org.oransc.enrichment.clients.AsyncRestClient;
-import org.oransc.enrichment.clients.AsyncRestClientFactory;
+import java.time.Duration;
+
 import org.oransc.enrichment.configuration.ApplicationConfig;
 import org.oransc.enrichment.controllers.consumer.ConsumerCallbacks;
+import org.oransc.enrichment.controllers.producer.ProducerCallbacks;
+import org.oransc.enrichment.repository.EiJob;
 import org.oransc.enrichment.repository.EiJobs;
 import org.oransc.enrichment.repository.EiProducer;
 import org.oransc.enrichment.repository.EiProducers;
-import org.oransc.enrichment.repository.EiTypes;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -37,6 +38,7 @@ import org.springframework.stereotype.Component;
 
 import reactor.core.publisher.Flux;
 import reactor.core.publisher.Mono;
+import reactor.util.retry.Retry;
 
 /**
  * Regularly checks the availability of the EI Producers
@@ -49,18 +51,15 @@ public class ProducerSupervision {
 
     private final EiProducers eiProducers;
     private final EiJobs eiJobs;
-    private final EiTypes eiTypes;
-    private final AsyncRestClient restClient;
+    private final ProducerCallbacks producerCallbacks;
     private final ConsumerCallbacks consumerCallbacks;
 
     @Autowired
     public ProducerSupervision(ApplicationConfig applicationConfig, EiProducers eiProducers, EiJobs eiJobs,
-        EiTypes eiTypes, ConsumerCallbacks consumerCallbacks) {
-        AsyncRestClientFactory restClientFactory = new AsyncRestClientFactory(applicationConfig.getWebClientConfig());
-        this.restClient = restClientFactory.createRestClient("");
-        this.eiJobs = eiJobs;
+        ProducerCallbacks producerCallbacks, ConsumerCallbacks consumerCallbacks) {
         this.eiProducers = eiProducers;
-        this.eiTypes = eiTypes;
+        this.eiJobs = eiJobs;
+        this.producerCallbacks = producerCallbacks;
         this.consumerCallbacks = consumerCallbacks;
     }
 
@@ -76,21 +75,40 @@ public class ProducerSupervision {
     }
 
     private Mono<EiProducer> checkOneProducer(EiProducer producer) {
-        return restClient.get(producer.getProducerSupervisionCallbackUrl()) //
+        return this.producerCallbacks.healthCheck(producer) //
             .onErrorResume(throwable -> {
                 handleNonRespondingProducer(throwable, producer);
                 return Mono.empty();
             })//
             .doOnNext(response -> handleRespondingProducer(response, producer))
-            .flatMap(response -> Mono.just(producer));
+            .flatMap(response -> checkProducerJobs(producer)) //
+            .flatMap(responses -> Mono.just(producer));
+    }
+
+    private Mono<?> checkProducerJobs(EiProducer producer) {
+        return getEiJobs(producer) //
+            .filter(eiJob -> !producer.isJobEnabled(eiJob)) //
+            .flatMap(eiJob -> startEiJob(producer, eiJob), 1) //
+            .collectList() //
+            .flatMapMany(eiJob -> consumerCallbacks.notifyJobStatus(producer.getEiTypes())) //
+            .collectList();
+    }
+
+    private Mono<String> startEiJob(EiProducer producer, EiJob eiJob) {
+        Retry retrySpec = Retry.fixedDelay(1, Duration.ofSeconds(1));
+        return producerCallbacks.startEiJob(producer, eiJob, retrySpec);
+    }
+
+    private Flux<EiJob> getEiJobs(EiProducer producer) {
+        return Flux.fromIterable(producer.getEiTypes()) //
+            .flatMap(eiType -> Flux.fromIterable(eiJobs.getJobsForType(eiType)));
     }
 
     private void handleNonRespondingProducer(Throwable throwable, EiProducer producer) {
         logger.warn("Unresponsive producer: {} exception: {}", producer.getId(), throwable.getMessage());
         producer.setAliveStatus(false);
         if (producer.isDead()) {
-            this.eiProducers.deregisterProducer(producer, this.eiTypes, this.eiJobs);
-            this.consumerCallbacks.notifyConsumersProducerDeleted(producer);
+            this.eiProducers.deregisterProducer(producer);
         }
     }
 
index c5ee82a..a863c10 100644 (file)
@@ -34,8 +34,7 @@ import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.PrintStream;
 import java.lang.invoke.MethodHandles;
-import java.util.ArrayList;
-import java.util.Collection;
+import java.util.Arrays;
 
 import org.json.JSONObject;
 import org.junit.jupiter.api.AfterEach;
@@ -45,15 +44,19 @@ import org.junit.jupiter.api.extension.ExtendWith;
 import org.oransc.enrichment.clients.AsyncRestClient;
 import org.oransc.enrichment.clients.AsyncRestClientFactory;
 import org.oransc.enrichment.configuration.ApplicationConfig;
+import org.oransc.enrichment.configuration.ImmutableHttpProxyConfig;
 import org.oransc.enrichment.configuration.ImmutableWebClientConfig;
 import org.oransc.enrichment.configuration.WebClientConfig;
+import org.oransc.enrichment.configuration.WebClientConfig.HttpProxyConfig;
 import org.oransc.enrichment.controller.ConsumerSimulatorController;
 import org.oransc.enrichment.controller.ProducerSimulatorController;
 import org.oransc.enrichment.controllers.consumer.ConsumerConsts;
 import org.oransc.enrichment.controllers.consumer.ConsumerEiJobInfo;
 import org.oransc.enrichment.controllers.consumer.ConsumerEiJobStatus;
 import org.oransc.enrichment.controllers.consumer.ConsumerEiTypeInfo;
+import org.oransc.enrichment.controllers.producer.ProducerCallbacks;
 import org.oransc.enrichment.controllers.producer.ProducerConsts;
+import org.oransc.enrichment.controllers.producer.ProducerEiTypeInfo;
 import org.oransc.enrichment.controllers.producer.ProducerJobInfo;
 import org.oransc.enrichment.controllers.producer.ProducerRegistrationInfo;
 import org.oransc.enrichment.controllers.producer.ProducerRegistrationInfo.ProducerEiTypeRegistrationInfo;
@@ -61,6 +64,7 @@ import org.oransc.enrichment.controllers.producer.ProducerStatusInfo;
 import org.oransc.enrichment.exceptions.ServiceException;
 import org.oransc.enrichment.repository.EiJob;
 import org.oransc.enrichment.repository.EiJobs;
+import org.oransc.enrichment.repository.EiProducer;
 import org.oransc.enrichment.repository.EiProducers;
 import org.oransc.enrichment.repository.EiType;
 import org.oransc.enrichment.repository.EiTypes;
@@ -125,6 +129,9 @@ class ApplicationTest {
     @Autowired
     ProducerSupervision producerSupervision;
 
+    @Autowired
+    ProducerCallbacks producerCallbacks;
+
     private static Gson gson = new GsonBuilder().create();
 
     /**
@@ -161,8 +168,12 @@ class ApplicationTest {
         ResponseEntity<String> resp = restClient().getForEntity(url).block();
         assertThat(resp.getStatusCode()).isEqualTo(HttpStatus.OK);
 
-        String indented = (new JSONObject(resp.getBody())).toString(4);
-        try (PrintStream out = new PrintStream(new FileOutputStream("../docs/offeredapis/swagger/ecs-api.json"))) {
+        JSONObject jsonObj = new JSONObject(resp.getBody());
+        jsonObj.remove("host");
+        assertThat(jsonObj.getJSONObject("definitions").remove("Mono«ResponseEntity«object»»")).isNotNull();
+        assertThat(jsonObj.getJSONObject("definitions").remove("Void")).isNotNull();
+        String indented = jsonObj.toString(4);
+        try (PrintStream out = new PrintStream(new FileOutputStream("api/ecs-api.json"))) {
             out.print(indented);
         }
     }
@@ -182,6 +193,19 @@ class ApplicationTest {
         assertThat(rsp).isEqualTo("[]");
     }
 
+    @Test
+    void testPutEiType() throws JsonMappingException, JsonProcessingException, ServiceException {
+        assertThat(putEiType(EI_TYPE_ID)).isEqualTo(HttpStatus.CREATED);
+        assertThat(putEiType(EI_TYPE_ID)).isEqualTo(HttpStatus.OK);
+    }
+
+    @Test
+    void testPutEiType_noSchema() {
+        String url = ProducerConsts.API_ROOT + "/eitypes/" + EI_TYPE_ID;
+        String body = "{}";
+        testErrorCode(restClient().put(url, body), HttpStatus.BAD_REQUEST, "No schema provided");
+    }
+
     @Test
     void testGetEiType() throws Exception {
         putEiProducerWithOneType(EI_PRODUCER_ID, "test");
@@ -191,10 +215,29 @@ class ApplicationTest {
         assertThat(info).isNotNull();
     }
 
+    @Test
+    void testDeleteEiType() throws Exception {
+        putEiType(EI_TYPE_ID);
+        String url = ProducerConsts.API_ROOT + "/eitypes/" + EI_TYPE_ID;
+        restClient().delete(url).block();
+        assertThat(this.eiTypes.size()).isEqualTo(0);
+
+        testErrorCode(restClient().delete(url), HttpStatus.NOT_FOUND, "EI type not found");
+    }
+
+    @Test
+    void testDeleteEiTypeExistingProducer() throws Exception {
+        putEiProducerWithOneType(EI_PRODUCER_ID, EI_TYPE_ID);
+        String url = ProducerConsts.API_ROOT + "/eitypes/" + EI_TYPE_ID;
+        testErrorCode(restClient().delete(url), HttpStatus.NOT_ACCEPTABLE,
+            "The type has active producers: " + EI_PRODUCER_ID);
+        assertThat(this.eiTypes.size()).isEqualTo(1);
+    }
+
     @Test
     void testGetEiTypeNotFound() throws Exception {
         String url = ConsumerConsts.API_ROOT + "/eitypes/junk";
-        testErrorCode(restClient().get(url), HttpStatus.NOT_FOUND, "Could not find EI type: junk");
+        testErrorCode(restClient().get(url), HttpStatus.NOT_FOUND, "EI type not found: junk");
     }
 
     @Test
@@ -299,19 +342,24 @@ class ApplicationTest {
         assertThat(resp.getStatusCode()).isEqualTo(HttpStatus.OK);
         EiJob job = this.eiJobs.getJob("jobId");
         assertThat(job.getOwner()).isEqualTo("owner");
+
+        verifyJobStatus(EI_JOB_ID, "ENABLED");
     }
 
     @Test
     void putEiProducerWithOneType_rejecting() throws JsonMappingException, JsonProcessingException, ServiceException {
         putEiProducerWithOneTypeRejecting("simulateProducerError", EI_TYPE_ID);
-        String url = ConsumerConsts.API_ROOT + "/eijobs/jobId";
+        String url = ConsumerConsts.API_ROOT + "/eijobs/" + EI_JOB_ID;
         String body = gson.toJson(eiJobInfo());
-        testErrorCode(restClient().put(url, body), HttpStatus.CONFLICT, "Job not accepted by any producers");
+        restClient().put(url, body).block();
 
         ProducerSimulatorController.TestResults simulatorResults = this.producerSimulator.getTestResults();
         // There is one retry -> 2 calls
         await().untilAsserted(() -> assertThat(simulatorResults.noOfRejectedCreate).isEqualTo(2));
         assertThat(simulatorResults.noOfRejectedCreate).isEqualTo(2);
+
+        verifyJobStatus(EI_JOB_ID, "DISABLED");
+
     }
 
     @Test
@@ -342,20 +390,6 @@ class ApplicationTest {
         assertThat(resp.getBody()).contains(EI_TYPE_ID_2);
     }
 
-    @Test
-    void testReplacingEiProducerTypes() throws Exception {
-        final String REPLACED_TYPE_ID = "replaced";
-        putEiProducerWithOneType(EI_PRODUCER_ID, REPLACED_TYPE_ID);
-        putEiProducerWithOneType(EI_PRODUCER_ID, EI_TYPE_ID);
-
-        String url = ProducerConsts.API_ROOT + "/eitypes";
-
-        ResponseEntity<String> resp = restClient().getForEntity(url).block();
-        assertThat(resp.getStatusCode()).isEqualTo(HttpStatus.OK);
-        assertThat(resp.getBody()).contains(EI_TYPE_ID);
-        assertThat(resp.getBody()).doesNotContain(REPLACED_TYPE_ID);
-    }
-
     @Test
     void testChangingEiTypeGetRejected() throws Exception {
         putEiProducerWithOneType("producer1", "typeId1");
@@ -370,6 +404,7 @@ class ApplicationTest {
 
     @Test
     void testPutEiProducer() throws Exception {
+        this.putEiType(EI_TYPE_ID);
         String url = ProducerConsts.API_ROOT + "/eiproducers/eiProducerId";
         String body = gson.toJson(producerEiRegistratioInfo(EI_TYPE_ID));
 
@@ -377,8 +412,7 @@ class ApplicationTest {
         assertThat(resp.getStatusCode()).isEqualTo(HttpStatus.CREATED);
 
         assertThat(this.eiTypes.size()).isEqualTo(1);
-        EiType type = this.eiTypes.getType(EI_TYPE_ID);
-        assertThat(type.getProducerIds()).contains("eiProducerId");
+        assertThat(this.eiProducers.getProducersForType(EI_TYPE_ID).size()).isEqualTo(1);
         assertThat(this.eiProducers.size()).isEqualTo(1);
         assertThat(this.eiProducers.get("eiProducerId").getEiTypes().iterator().next().getId()).isEqualTo(EI_TYPE_ID);
 
@@ -404,8 +438,16 @@ class ApplicationTest {
         assertThat(request.id).isEqualTo("jobId");
     }
 
+    @Test
+    void testPutEiProducer_noType() throws Exception {
+        String url = ProducerConsts.API_ROOT + "/eiproducers/eiProducerId";
+        String body = gson.toJson(producerEiRegistratioInfo(EI_TYPE_ID));
+        testErrorCode(restClient().put(url, body), HttpStatus.NOT_FOUND, "EI type not found");
+    }
+
     @Test
     void testPutProducerAndEiJob() throws Exception {
+        this.putEiType(EI_TYPE_ID);
         String url = ProducerConsts.API_ROOT + "/eiproducers/eiProducerId";
         String body = gson.toJson(producerEiRegistratioInfo(EI_TYPE_ID));
         restClient().putForEntity(url, body).block();
@@ -449,19 +491,19 @@ class ApplicationTest {
 
         assertThat(this.eiProducers.size()).isEqualTo(2);
         EiType type = this.eiTypes.getType(EI_TYPE_ID);
-        assertThat(type.getProducerIds()).contains("eiProducerId");
-        assertThat(type.getProducerIds()).contains("eiProducerId2");
+        assertThat(this.eiProducers.getProducerIdsForType(type.getId())).contains("eiProducerId");
+        assertThat(this.eiProducers.getProducerIdsForType(type.getId())).contains("eiProducerId2");
         putEiJob(EI_TYPE_ID, "jobId");
         assertThat(this.eiJobs.size()).isEqualTo(1);
 
         deleteEiProducer("eiProducerId");
         assertThat(this.eiProducers.size()).isEqualTo(1);
-        assertThat(this.eiTypes.getType(EI_TYPE_ID).getProducerIds()).doesNotContain("eiProducerId");
+        assertThat(this.eiProducers.getProducerIdsForType(EI_TYPE_ID)).doesNotContain("eiProducerId");
         verifyJobStatus("jobId", "ENABLED");
 
         deleteEiProducer("eiProducerId2");
         assertThat(this.eiProducers.size()).isZero();
-        assertThat(this.eiTypes.size()).isZero();
+        assertThat(this.eiTypes.size()).isEqualTo(1);
         verifyJobStatus("jobId", "DISABLED");
     }
 
@@ -478,7 +520,7 @@ class ApplicationTest {
         deleteEiProducer("eiProducerId2");
         assertThat(this.eiTypes.size()).isEqualTo(1); // The type remains, one producer left
         deleteEiProducer("eiProducerId");
-        assertThat(this.eiTypes.size()).isZero(); // The type is gone
+        assertThat(this.eiTypes.size()).isEqualTo(1); // The type remains
         assertThat(this.eiJobs.size()).isEqualTo(1); // The job remains
         await().untilAsserted(() -> assertThat(consumerCalls.status.size()).isEqualTo(1));
         assertThat(consumerCalls.status.get(0).state).isEqualTo(ConsumerEiJobStatus.EiJobStatusValues.DISABLED);
@@ -496,7 +538,7 @@ class ApplicationTest {
         putEiProducerWithOneType(EI_PRODUCER_ID, EI_TYPE_ID);
         putEiJob(EI_TYPE_ID, EI_JOB_ID);
 
-        // change the type for the producer, the EI_TYPE_ID is deleted
+        // change the type for the producer, the job shall be disabled
         putEiProducerWithOneType(EI_PRODUCER_ID, "junk");
         verifyJobStatus(EI_JOB_ID, "DISABLED");
         ConsumerSimulatorController.TestResults consumerCalls = this.consumerSimulator.getTestResults();
@@ -514,7 +556,8 @@ class ApplicationTest {
         putEiProducerWithOneType(EI_PRODUCER_ID, EI_TYPE_ID);
         String url = ProducerConsts.API_ROOT + "/eitypes/" + EI_TYPE_ID;
         ResponseEntity<String> resp = restClient().getForEntity(url).block();
-        assertThat(resp.getBody()).contains(EI_PRODUCER_ID);
+        ProducerEiTypeInfo info = gson.fromJson(resp.getBody(), ProducerEiTypeInfo.class);
+        assertThat(info.jobDataSchema).isNotNull();
     }
 
     @Test
@@ -523,17 +566,32 @@ class ApplicationTest {
         String url = ProducerConsts.API_ROOT + "/eiproducers";
         ResponseEntity<String> resp = restClient().getForEntity(url).block();
         assertThat(resp.getBody()).contains(EI_PRODUCER_ID);
+
+        url = ProducerConsts.API_ROOT + "/eiproducers?ei_type_id=" + EI_TYPE_ID;
+        resp = restClient().getForEntity(url).block();
+        assertThat(resp.getBody()).contains(EI_PRODUCER_ID);
+
+        url = ProducerConsts.API_ROOT + "/eiproducers?ei_type_id=junk";
+        resp = restClient().getForEntity(url).block();
+        assertThat(resp.getBody()).isEqualTo("[]");
     }
 
     @Test
     void testProducerSupervision() throws JsonMappingException, JsonProcessingException, ServiceException {
+
+        ConsumerSimulatorController.TestResults consumerResults = this.consumerSimulator.getTestResults();
         putEiProducerWithOneTypeRejecting("simulateProducerError", EI_TYPE_ID);
 
         {
             // Create a job
             putEiProducerWithOneType(EI_PRODUCER_ID, EI_TYPE_ID);
             putEiJob(EI_TYPE_ID, EI_JOB_ID);
+            verifyJobStatus(EI_JOB_ID, "ENABLED");
             deleteEiProducer(EI_PRODUCER_ID);
+            // A Job disabled status notification shall now be received
+            await().untilAsserted(() -> assertThat(consumerResults.status.size()).isEqualTo(1));
+            assertThat(consumerResults.status.get(0).state).isEqualTo(ConsumerEiJobStatus.EiJobStatusValues.DISABLED);
+            verifyJobStatus(EI_JOB_ID, "DISABLED");
         }
 
         assertThat(this.eiProducers.size()).isEqualTo(1);
@@ -543,22 +601,45 @@ class ApplicationTest {
         this.producerSupervision.createTask().blockLast();
         this.producerSupervision.createTask().blockLast();
 
-        // Now we have one producer that is disabled, but the job will be enabled until
-        // the producer/type is removed
+        // Now we have one producer that is disabled
         assertThat(this.eiProducers.size()).isEqualTo(1);
         assertProducerOpState("simulateProducerError", ProducerStatusInfo.OperationalState.DISABLED);
-        verifyJobStatus(EI_JOB_ID, "ENABLED");
 
-        // After 3 failed checks, the producer and the type shall be deregisterred
+        // After 3 failed checks, the producer shall be deregisterred
         this.producerSupervision.createTask().blockLast();
-        assertThat(this.eiProducers.size()).isEqualTo(0);
-        assertThat(this.eiTypes.size()).isEqualTo(0);
+        assertThat(this.eiProducers.size()).isEqualTo(0); // The producer is removed
+        assertThat(this.eiTypes.size()).isEqualTo(1); // The type remains
+
+        // Now we have one disabled job, and no producer.
+        // PUT a producer, then a Job ENABLED status notification shall be received
+        putEiProducerWithOneType(EI_PRODUCER_ID, EI_TYPE_ID);
+        await().untilAsserted(() -> assertThat(consumerResults.status.size()).isEqualTo(2));
+        assertThat(consumerResults.status.get(1).state).isEqualTo(ConsumerEiJobStatus.EiJobStatusValues.ENABLED);
+        verifyJobStatus(EI_JOB_ID, "ENABLED");
+    }
+
+    @Test
+    void testProducerSupervision2() throws JsonMappingException, JsonProcessingException, ServiceException {
+        // Test that supervision enables not enabled jobs and sends a notification when
+        // suceeded
+
+        putEiProducerWithOneType(EI_PRODUCER_ID, EI_TYPE_ID);
+        putEiJob(EI_TYPE_ID, EI_JOB_ID);
+
+        EiProducer producer = this.eiProducers.getProducer(EI_PRODUCER_ID);
+        EiJob job = this.eiJobs.getJob(EI_JOB_ID);
+        // Pretend that the producer did reject the job and the a DISABLED notification
+        // is sent for the job
+        producer.setJobDisabled(job);
+        job.setLastReportedStatus(false);
         verifyJobStatus(EI_JOB_ID, "DISABLED");
 
-        // Job disabled status notification shall be received
+        // Run the supervision and wait for the job to get started in the producer
+        this.producerSupervision.createTask().blockLast();
         ConsumerSimulatorController.TestResults consumerResults = this.consumerSimulator.getTestResults();
         await().untilAsserted(() -> assertThat(consumerResults.status.size()).isEqualTo(1));
-        assertThat(consumerResults.status.get(0).state).isEqualTo(ConsumerEiJobStatus.EiJobStatusValues.DISABLED);
+        assertThat(consumerResults.status.get(0).state).isEqualTo(ConsumerEiJobStatus.EiJobStatusValues.ENABLED);
+        verifyJobStatus(EI_JOB_ID, "ENABLED");
     }
 
     @Test
@@ -580,22 +661,55 @@ class ApplicationTest {
         assertThat(this.eiJobs.size()).isEqualTo(2);
 
         {
+            EiJob savedJob = this.eiJobs.getJob("jobId1");
             // Restore the jobs
-            EiJobs jobs = new EiJobs(this.applicationConfig);
+            EiJobs jobs = new EiJobs(this.applicationConfig, this.producerCallbacks);
             jobs.restoreJobsFromDatabase();
             assertThat(jobs.size()).isEqualTo(2);
-            jobs.remove("jobId1");
-            jobs.remove("jobId2");
+            EiJob restoredJob = jobs.getJob("jobId1");
+            assertThat(restoredJob.getId()).isEqualTo("jobId1");
+            assertThat(restoredJob.getLastUpdated()).isEqualTo(savedJob.getLastUpdated());
+
+            jobs.remove("jobId1", this.eiProducers);
+            jobs.remove("jobId2", this.eiProducers);
         }
         {
             // Restore the jobs, no jobs in database
-            EiJobs jobs = new EiJobs(this.applicationConfig);
+            EiJobs jobs = new EiJobs(this.applicationConfig, this.producerCallbacks);
             jobs.restoreJobsFromDatabase();
             assertThat(jobs.size()).isEqualTo(0);
         }
         logger.warn("Test removing a job when the db file is gone");
-        this.eiJobs.remove("jobId1");
+        this.eiJobs.remove("jobId1", this.eiProducers);
         assertThat(this.eiJobs.size()).isEqualTo(1);
+
+        ProducerSimulatorController.TestResults simulatorResults = this.producerSimulator.getTestResults();
+        await().untilAsserted(() -> assertThat(simulatorResults.jobsStopped.size()).isEqualTo(3));
+    }
+
+    @Test
+    void testEiTypesDatabase() throws Exception {
+        putEiProducerWithOneType(EI_PRODUCER_ID, EI_TYPE_ID);
+
+        assertThat(this.eiTypes.size()).isEqualTo(1);
+
+        {
+            // Restore the types
+            EiTypes types = new EiTypes(this.applicationConfig);
+            types.restoreTypesFromDatabase();
+            assertThat(types.size()).isEqualTo(1);
+
+        }
+        {
+            // Restore the jobs, no jobs in database
+            EiTypes types = new EiTypes(this.applicationConfig);
+            types.clear();
+            types.restoreTypesFromDatabase();
+            assertThat(types.size()).isEqualTo(0);
+        }
+        logger.warn("Test removing a job when the db file is gone");
+        this.eiTypes.remove(this.eiTypes.getType(EI_TYPE_ID));
+        assertThat(this.eiJobs.size()).isEqualTo(0);
     }
 
     private void deleteEiProducer(String eiProducerId) {
@@ -624,18 +738,14 @@ class ApplicationTest {
 
     ProducerRegistrationInfo producerEiRegistratioInfoRejecting(String typeId)
         throws JsonMappingException, JsonProcessingException {
-        Collection<ProducerEiTypeRegistrationInfo> types = new ArrayList<>();
-        types.add(producerEiTypeRegistrationInfo(typeId));
-        return new ProducerRegistrationInfo(types, //
+        return new ProducerRegistrationInfo(Arrays.asList(typeId), //
             baseUrl() + ProducerSimulatorController.JOB_ERROR_URL,
             baseUrl() + ProducerSimulatorController.SUPERVISION_ERROR_URL);
     }
 
     ProducerRegistrationInfo producerEiRegistratioInfo(String typeId)
         throws JsonMappingException, JsonProcessingException {
-        Collection<ProducerEiTypeRegistrationInfo> types = new ArrayList<>();
-        types.add(producerEiTypeRegistrationInfo(typeId));
-        return new ProducerRegistrationInfo(types, //
+        return new ProducerRegistrationInfo(Arrays.asList(typeId), //
             baseUrl() + ProducerSimulatorController.JOB_URL, baseUrl() + ProducerSimulatorController.SUPERVISION_URL);
     }
 
@@ -687,21 +797,34 @@ class ApplicationTest {
         return this.eiJobs.getJob(jobId);
     }
 
+    private HttpStatus putEiType(String eiTypeId)
+        throws JsonMappingException, JsonProcessingException, ServiceException {
+        String url = ProducerConsts.API_ROOT + "/eitypes/" + eiTypeId;
+        String body = gson.toJson(producerEiTypeRegistrationInfo(eiTypeId));
+        ResponseEntity<String> resp = restClient().putForEntity(url, body).block();
+        this.eiTypes.getType(eiTypeId);
+        return resp.getStatusCode();
+
+    }
+
     private EiType putEiProducerWithOneTypeRejecting(String producerId, String eiTypeId)
         throws JsonMappingException, JsonProcessingException, ServiceException {
+        this.putEiType(eiTypeId);
         String url = ProducerConsts.API_ROOT + "/eiproducers/" + producerId;
         String body = gson.toJson(producerEiRegistratioInfoRejecting(eiTypeId));
-
         restClient().putForEntity(url, body).block();
         return this.eiTypes.getType(eiTypeId);
     }
 
     private EiType putEiProducerWithOneType(String producerId, String eiTypeId)
         throws JsonMappingException, JsonProcessingException, ServiceException {
+        this.putEiType(eiTypeId);
+
         String url = ProducerConsts.API_ROOT + "/eiproducers/" + producerId;
         String body = gson.toJson(producerEiRegistratioInfo(eiTypeId));
 
         restClient().putForEntity(url, body).block();
+
         return this.eiTypes.getType(eiTypeId);
     }
 
@@ -711,6 +834,10 @@ class ApplicationTest {
 
     private AsyncRestClient restClient(boolean useTrustValidation) {
         WebClientConfig config = this.applicationConfig.getWebClientConfig();
+        HttpProxyConfig httpProxyConfig = ImmutableHttpProxyConfig.builder() //
+            .httpProxyHost("") //
+            .httpProxyPort(0) //
+            .build();
         config = ImmutableWebClientConfig.builder() //
             .keyStoreType(config.keyStoreType()) //
             .keyStorePassword(config.keyStorePassword()) //
@@ -719,10 +846,10 @@ class ApplicationTest {
             .isTrustStoreUsed(useTrustValidation) //
             .trustStore(config.trustStore()) //
             .trustStorePassword(config.trustStorePassword()) //
-            .build();
+            .httpProxyConfig(httpProxyConfig).build();
 
         AsyncRestClientFactory restClientFactory = new AsyncRestClientFactory(config);
-        return restClientFactory.createRestClient(baseUrl());
+        return restClientFactory.createRestClientNoHttpProxy(baseUrl());
     }
 
     private AsyncRestClient restClient() {
index f879c7b..364203a 100644 (file)
@@ -58,7 +58,7 @@ class AsyncRestClientTest {
         InternalLoggerFactory.setDefaultFactory(JdkLoggerFactory.INSTANCE);
         Loggers.useJdkLoggers();
         mockWebServer = new MockWebServer();
-        clientUnderTest = new AsyncRestClient(mockWebServer.url(BASE_URL).toString());
+        clientUnderTest = new AsyncRestClient(mockWebServer.url(BASE_URL).toString(), null, null);
     }
 
     @AfterAll
index 562f286..e8bb659 100644 (file)
@@ -45,7 +45,7 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RestController;
 
 @RestController("ConsumerSimulatorController")
-@Api(tags = {"Consumer Callbacks"})
+@Api(tags = {"A1-EI (enrichment information) callbacks"})
 public class ConsumerSimulatorController {
 
     private final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
index 2a3688c..726cef7 100644 (file)
@@ -48,7 +48,7 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RestController;
 
 @RestController("ProducerSimulatorController")
-@Api(tags = {"Producer Callbacks"})
+@Api(tags = {"Data Producer Job Control (example producer)"})
 public class ProducerSimulatorController {
 
     private final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
@@ -134,7 +134,7 @@ public class ProducerSimulatorController {
     }
 
     @DeleteMapping(path = JOB_ERROR_URL + "/{eiJobId}", produces = MediaType.APPLICATION_JSON_VALUE)
-    @ApiOperation(value = "Callback for EI job creation, returns error", notes = "", hidden = true)
+    @ApiOperation(value = "Callback for EI job deletion, returns error", notes = "", hidden = true)
     @ApiResponses(
         value = { //
             @ApiResponse(code = 200, message = "OK", response = VoidResponse.class)}//
index 3b56b4f..be0ae3e 160000 (submodule)
--- a/onap/oran
+++ b/onap/oran
@@ -1 +1 @@
-Subproject commit 3b56b4ff40eba05108651d04df4b9a2ef3a4eb1d
+Subproject commit be0ae3e197f5d5032c0766a59050b03e2a4deb99
index 602050b..7daab97 100644 (file)
@@ -6,3 +6,4 @@ target
 .checkstyle
 policy-agent.iml
 config
+/bin/
index d660df9..e73d1de 100644 (file)
@@ -34,7 +34,7 @@ volumes:
 The target paths in the container should not be modified.
 
 Example docker run command for mounting new files (assuming they are located in the current directory):
-docker run -p 8081:8081 -p 8433:8433 --name=policy-agent-container --network=nonrtric-docker-net --volume "$PWD/new_keystore.jks:/opt/app/policy-agent/etc/cert/keystore.jks" --volume "$PWD/new_truststore.jks:/opt/app/policy-agent/etc/cert/truststore.jks" --volume "$PWD/new_application.yaml:/opt/app/policy-agent/config/application.yaml" o-ran-sc/nonrtric-policy-agent:2.2.0-SNAPSHOT
+docker run -p 8081:8081 -p 8433:8433 --name=policy-agent-container --network=nonrtric-docker-net --volume "$PWD/new_keystore.jks:/opt/app/policy-agent/etc/cert/keystore.jks" --volume "$PWD/new_truststore.jks:/opt/app/policy-agent/etc/cert/truststore.jks" --volume "$PWD/new_application.yaml:/opt/app/policy-agent/config/application.yaml" o-ran-sc/nonrtric-policy-agent:2.2.1-SNAPSHOT
 
 
 To Run Policy Agent in Local:
index d18c9f7..92f8d5a 100644 (file)
@@ -31,7 +31,7 @@
     </parent>
     <groupId>org.o-ran-sc.nonrtric</groupId>
     <artifactId>policy-agent</artifactId>
-    <version>2.2.0-SNAPSHOT</version>
+    <version>2.2.1-SNAPSHOT</version>
     <licenses>
         <license>
             <name>The Apache Software License, Version 2.0</name>
diff --git a/pom.xml b/pom.xml
index d871709..b7b64a9 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -25,7 +25,7 @@
 
     <groupId>org.o-ran-sc</groupId>
     <artifactId>nonrtric</artifactId>
-    <version>2.2.0-SNAPSHOT</version>
+    <version>2.2.1-SNAPSHOT</version>
     <packaging>pom</packaging>
 
     <name>nonrtric</name>
index a85f57d..cd2efc9 100644 (file)
@@ -23,10 +23,12 @@ ARG JAR
 
 WORKDIR /opt/app/r-app-catalogue
 RUN mkdir -p /var/log/r-app-catalogue
+RUN mkdir -p /opt/app/r-app-catalogue/etc/cert/
 
-EXPOSE 8081 8433
+EXPOSE 8680 8633
 
 ADD /config/application.yaml /opt/app/r-app-catalogue/config/application.yaml
+ADD /config/r-app-catalogue-keystore.jks /opt/app/r-app-catalogue/etc/cert/keystore.jks
 ADD target/${JAR} /opt/app/r-app-catalogue/r-app-catalogue.jar
 
 
index fadf7d2..1ef0bdc 100644 (file)
@@ -1,4 +1,30 @@
+ # ========================LICENSE_START=================================
+ # Copyright (C) 2021 Nordix Foundation. 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===================================
+
 spring:
   profiles:
     active: prod
-
+server:
+   # Configuration of the HTTP/REST server. The parameters are defined and handled by the springboot framework.
+   # See springboot documentation.
+   port : 8633
+   http-port: 8680
+   ssl:
+      key-store-type: JKS
+      key-store: /opt/app/r-app-catalogue/etc/cert/keystore.jks
+      key-store-password: r-app-catalogue
+      key-password: r-app-catalogue
+      key-alias: server-cert
diff --git a/r-app-catalogue/config/r-app-catalogue-keystore.jks b/r-app-catalogue/config/r-app-catalogue-keystore.jks
new file mode 100644 (file)
index 0000000..192fe17
Binary files /dev/null and b/r-app-catalogue/config/r-app-catalogue-keystore.jks differ
diff --git a/r-app-catalogue/eclipse-formatter.xml b/r-app-catalogue/eclipse-formatter.xml
new file mode 100644 (file)
index 0000000..c8cca2e
--- /dev/null
@@ -0,0 +1,314 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ * ========================LICENSE_START=================================
+ * O-RAN-SC
+ * %%
+ * Copyright (C) 2019 Nordix Foundation
+ * %%
+ * 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===================================
+  -->
+<profiles version="13">
+<profile kind="CodeFormatterProfile" name="java-formatter" version="12">
+<setting id="org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode" value="enabled"/>
+<setting id="org.eclipse.jdt.core.compiler.codegen.targetPlatform" value="1.8"/>
+<setting id="org.eclipse.jdt.core.compiler.compliance" value="1.8"/>
+<setting id="org.eclipse.jdt.core.compiler.problem.assertIdentifier" value="error"/>
+<setting id="org.eclipse.jdt.core.compiler.problem.enumIdentifier" value="error"/>
+<setting id="org.eclipse.jdt.core.compiler.source" value="1.8"/>
+<setting id="org.eclipse.jdt.core.formatter.align_type_members_on_columns" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation" value="48"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_assignment" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_binary_expression" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_if" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression" value="80"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_enum_constants" value="0"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_method_declaration" value="0"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_multiple_fields" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_resources_in_try" value="80"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_imports" value="1"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_package" value="1"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_field" value="0"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration" value="0"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_imports" value="0"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_member_type" value="0"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_method" value="1"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk" value="1"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_package" value="1"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_import_groups" value="1"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations" value="2"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_array_initializer" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block_in_case" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_constant" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_lambda_body" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_method_declaration" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_switch" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_type_declaration" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.format_block_comments" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.format_header" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.format_html" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.format_javadoc_comments" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.format_line_comments" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.format_source_code" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.indent_parameter_description" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.indent_root_tags" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.line_length" value="120"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.compact_else_if" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.continuation_indentation" value="1"/>
+<setting id="org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer" value="1"/>
+<setting id="org.eclipse.jdt.core.formatter.disabling_tag" value="@formatter:off"/>
+<setting id="org.eclipse.jdt.core.formatter.enabling_tag" value="@formatter:on"/>
+<setting id="org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_empty_lines" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_block" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_body" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.indentation.size" value="4"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_label" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_binary_operator" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_ellipsis" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_unary_operator" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_binary_operator" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_ellipsis" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_unary_operator" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.join_lines_in_comments" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.join_wrapped_lines" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.lineSplit" value="120"/>
+<setting id="org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body" value="0"/>
+<setting id="org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve" value="1"/>
+<setting id="org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.tabulation.char" value="space"/>
+<setting id="org.eclipse.jdt.core.formatter.tabulation.size" value="4"/>
+<setting id="org.eclipse.jdt.core.formatter.use_on_off_tags" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.wrap_before_binary_operator" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested" value="true"/>
+</profile>
+</profiles>
index a2e0565..7098221 100644 (file)
@@ -31,7 +31,7 @@
     </parent>\r
     <groupId>org.o-ran-sc.nonrtric</groupId>\r
     <artifactId>r-app-catalogue</artifactId>\r
-    <version>1.1.0-SNAPSHOT</version>\r
+    <version>1.1.1-SNAPSHOT</version>\r
     <licenses>\r
         <license>\r
             <name>The Apache Software License, Version 2.0</name>\r
@@ -45,6 +45,8 @@
         <jackson-databind-nullable.version>0.2.1</jackson-databind-nullable.version>\r
         <openapi-generator-maven-plugin.version>4.3.1</openapi-generator-maven-plugin.version>\r
         <swagger-codegen-maven-plugin.version>3.0.11</swagger-codegen-maven-plugin.version>\r
+        <formatter-maven-plugin.version>2.12.2</formatter-maven-plugin.version>\r
+        <spotless-maven-plugin.version>1.24.3</spotless-maven-plugin.version>\r
         <jacoco-maven-plugin.version>0.8.6</jacoco-maven-plugin.version>\r
         <docker-maven-plugin.version>0.30.0</docker-maven-plugin.version>\r
     </properties>\r
             <artifactId>junit-jupiter-engine</artifactId>\r
             <scope>test</scope>\r
         </dependency>\r
+        <dependency>\r
+            <groupId>org.springframework.boot</groupId>\r
+            <artifactId>spring-boot-starter-test</artifactId>\r
+            <scope>test</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.apache.httpcomponents</groupId>\r
+            <artifactId>httpclient</artifactId>\r
+            <scope>test</scope>\r
+        </dependency>\r
+\r
     </dependencies>\r
 \r
     <build>\r
                             <invokerPackage>org.oransc.rappcatalogue</invokerPackage>\r
                             <configOptions>\r
                                 <delegatePattern>true</delegatePattern>\r
+                                <unhandledException>true</unhandledException>\r
                             </configOptions>\r
                         </configuration>\r
                     </execution>\r
                     </execution>\r
                 </executions>\r
             </plugin>\r
+            <plugin>\r
+                <groupId>net.revelc.code.formatter</groupId>\r
+                <artifactId>formatter-maven-plugin</artifactId>\r
+                <version>${formatter-maven-plugin.version}</version>\r
+                <configuration>\r
+                    <configFile>${project.basedir}/eclipse-formatter.xml</configFile>\r
+                </configuration>\r
+                <!-- https://code.revelc.net/formatter-maven-plugin/ use mvn formatter:format\r
+                    spotless:apply process-sources -->\r
+            </plugin>\r
+            <plugin>\r
+                <groupId>com.diffplug.spotless</groupId>\r
+                <artifactId>spotless-maven-plugin</artifactId>\r
+                <version>${spotless-maven-plugin.version}</version>\r
+                <configuration>\r
+                    <java>\r
+                        <removeUnusedImports />\r
+                        <importOrder>\r
+                            <order>com,java,javax,org</order>\r
+                        </importOrder>\r
+                    </java>\r
+                </configuration>\r
+                <!-- https://github.com/diffplug/spotless/tree/master/plugin-maven use\r
+                    mvn spotless:apply to rewrite source files use mvn spotless:check to validate\r
+                    source files -->\r
+            </plugin>\r
             <plugin>\r
                 <groupId>org.jacoco</groupId>\r
                 <artifactId>jacoco-maven-plugin</artifactId>\r
index 939f7bf..072a5a0 100644 (file)
@@ -35,22 +35,19 @@ import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExcep
 @ControllerAdvice
 public class GeneralRappCatalogueControllerAdvisor extends ResponseEntityExceptionHandler {
     @ExceptionHandler(InvalidServiceException.class)
-    public ResponseEntity<Object> handleInvalidServiceException(
-        InvalidServiceException ex) {
+    public ResponseEntity<Object> handleInvalidServiceException(InvalidServiceException ex) {
 
         return new ResponseEntity<>(getErrorInformation(ex, BAD_REQUEST), BAD_REQUEST);
     }
 
     @ExceptionHandler(ServiceNotFoundException.class)
-    public ResponseEntity<Object> handleServiceNotFoundException(
-        ServiceNotFoundException ex) {
+    public ResponseEntity<Object> handleServiceNotFoundException(ServiceNotFoundException ex) {
 
         return new ResponseEntity<>(getErrorInformation(ex, NOT_FOUND), NOT_FOUND);
     }
 
     @ExceptionHandler(HeaderException.class)
-    public ResponseEntity<Object> handleHeaderException(
-        HeaderException ex) {
+    public ResponseEntity<Object> handleHeaderException(HeaderException ex) {
 
         return new ResponseEntity<>(getErrorInformation(ex, INTERNAL_SERVER_ERROR), INTERNAL_SERVER_ERROR);
     }
index bb3a6dc..4615d69 100644 (file)
-/*-\r
- * ========================LICENSE_START=================================\r
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.\r
- * ======================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- *      http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ========================LICENSE_END===================================\r
- */\r
-\r
-package org.oransc.rappcatalogue.api;\r
-\r
-import java.io.IOException;\r
-import java.sql.Date;\r
-import java.util.ArrayList;\r
-import java.util.List;\r
-import java.util.Optional;\r
-import java.util.concurrent.ConcurrentHashMap;\r
-import javax.servlet.http.HttpServletRequest;\r
-import javax.servlet.http.HttpServletResponse;\r
-import org.oransc.rappcatalogue.exception.HeaderException;\r
-import org.oransc.rappcatalogue.exception.InvalidServiceException;\r
-import org.oransc.rappcatalogue.exception.ServiceNotFoundException;\r
-import org.oransc.rappcatalogue.model.InputService;\r
-import org.oransc.rappcatalogue.model.Service;\r
-import org.springframework.beans.factory.annotation.Autowired;\r
-import org.springframework.http.HttpStatus;\r
-import org.springframework.http.ResponseEntity;\r
-import org.springframework.web.context.request.NativeWebRequest;\r
-\r
-@org.springframework.stereotype.Service\r
-public class ServicesApiDelegateImpl implements ServicesApiDelegate {\r
-\r
-    private static final String LOCATION_HEADER = "Location";\r
-\r
-    @Autowired\r
-    private NativeWebRequest nativeWebRequest;\r
-\r
-    private ConcurrentHashMap<String, Service> registeredServices = new ConcurrentHashMap<>();\r
-\r
-    ServicesApiDelegateImpl(NativeWebRequest nativeWebRequest) {\r
-        this.nativeWebRequest = nativeWebRequest;\r
-    }\r
-\r
-    @Override\r
-    public Optional<NativeWebRequest> getRequest() {\r
-        return Optional.of(nativeWebRequest);\r
-    }\r
-\r
-    @Override\r
-    public ResponseEntity<Service> getIndividualService(String serviceName) {\r
-        Service service = registeredServices.get(serviceName);\r
-        if (service != null) {\r
-            return ResponseEntity.ok(service);\r
-        } else {\r
-            throw new ServiceNotFoundException(serviceName);\r
-        }\r
-    }\r
-\r
-    @Override\r
-    public ResponseEntity<List<Service>> getServices() {\r
-        return ResponseEntity.ok(new ArrayList<>(registeredServices.values()));\r
-    }\r
-\r
-    @Override\r
-    public ResponseEntity<Void> putIndividualService(String serviceName, InputService inputService) {\r
-        if (isServiceValid(inputService)) {\r
-            if (registeredServices.put(serviceName, createService(serviceName, inputService)) == null) {\r
-                try {\r
-                    getRequest().ifPresent(request -> addLocationHeaderToResponse(serviceName, request));\r
-                } catch (Exception e) {\r
-                    registeredServices.remove(serviceName);\r
-                    throw e;\r
-                }\r
-                return new ResponseEntity<>(HttpStatus.CREATED);\r
-            } else {\r
-                return new ResponseEntity<>(HttpStatus.OK);\r
-            }\r
-        } else {\r
-            throw new InvalidServiceException();\r
-        }\r
-    }\r
-\r
-    private void addLocationHeaderToResponse(String serviceName, NativeWebRequest request) {\r
-        try {\r
-            HttpServletRequest nativeRequest = request.getNativeRequest(HttpServletRequest.class);\r
-            HttpServletResponse nativeResponse = request.getNativeResponse(HttpServletResponse.class);\r
-            if (nativeRequest != null && nativeResponse != null) {\r
-                StringBuffer requestURL = nativeRequest.getRequestURL();\r
-                nativeResponse.addHeader(LOCATION_HEADER, requestURL.toString());\r
-                nativeResponse.getWriter().print("");\r
-            } else {\r
-                throw new HeaderException(LOCATION_HEADER, serviceName,\r
-                    new Exception("Native Request or Response missing"));\r
-            }\r
-        } catch (IOException e) {\r
-            throw new HeaderException(LOCATION_HEADER, serviceName, e);\r
-        }\r
-    }\r
-\r
-    @Override\r
-    public ResponseEntity<Void> deleteIndividualService(String serviceName) {\r
-        registeredServices.remove(serviceName);\r
-        return new ResponseEntity<>(HttpStatus.NO_CONTENT);\r
-    }\r
-\r
-    /*\r
-     * java:S2589: Boolean expressions should not be gratuitous.\r
-     * Even though the version property is marked as @NotNull, it might be null coming from the client, hence the null\r
-     * check is needed.\r
-     */\r
-    @SuppressWarnings("java:S2589")\r
-    private boolean isServiceValid(InputService service) {\r
-        String version = service.getVersion();\r
-        return version != null && !version.isBlank();\r
-    }\r
-\r
-    private Service createService(String serviceName, InputService inputService) {\r
-        Service service = new Service();\r
-        service.setName(serviceName);\r
-        service.setDescription(inputService.getDescription());\r
-        service.setDisplayName(inputService.getDisplayName());\r
-        service.setVersion(inputService.getVersion());\r
-        service.setRegistrationDate(getTodaysDate());\r
-        return service;\r
-    }\r
-\r
-    private String getTodaysDate() {\r
-        long millis = System.currentTimeMillis();\r
-        Date date = new Date(millis);\r
-        return date.toString();\r
-    }\r
-}\r
+/*-
+ * ========================LICENSE_START=================================
+ * Copyright (C) 2020 Nordix Foundation. 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===================================
+ */
+
+package org.oransc.rappcatalogue.api;
+
+import java.io.IOException;
+import java.sql.Date;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
+import java.util.concurrent.ConcurrentHashMap;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.oransc.rappcatalogue.exception.HeaderException;
+import org.oransc.rappcatalogue.exception.InvalidServiceException;
+import org.oransc.rappcatalogue.exception.ServiceNotFoundException;
+import org.oransc.rappcatalogue.model.InputService;
+import org.oransc.rappcatalogue.model.Service;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.context.request.NativeWebRequest;
+
+@org.springframework.stereotype.Service
+public class ServicesApiDelegateImpl implements ServicesApiDelegate {
+
+    private static final String LOCATION_HEADER = "Location";
+
+    @Autowired
+    private NativeWebRequest nativeWebRequest;
+
+    private ConcurrentHashMap<String, Service> registeredServices = new ConcurrentHashMap<>();
+
+    ServicesApiDelegateImpl(NativeWebRequest nativeWebRequest) {
+        this.nativeWebRequest = nativeWebRequest;
+    }
+
+    @Override
+    public Optional<NativeWebRequest> getRequest() {
+        return Optional.of(nativeWebRequest);
+    }
+
+    @Override
+    public ResponseEntity<Service> getIndividualService(String serviceName) throws ServiceNotFoundException {
+        Service service = registeredServices.get(serviceName);
+        if (service != null) {
+            return ResponseEntity.ok(service);
+        } else {
+            throw new ServiceNotFoundException(serviceName);
+        }
+    }
+
+    @Override
+    public ResponseEntity<List<Service>> getServices() {
+        return ResponseEntity.ok(new ArrayList<>(registeredServices.values()));
+    }
+
+    @Override
+    public ResponseEntity<Void> putIndividualService(String serviceName, InputService inputService)
+        throws InvalidServiceException, HeaderException {
+        if (isServiceValid(inputService)) {
+            if (registeredServices.put(serviceName, createService(serviceName, inputService)) == null) {
+                try {
+                    Optional<NativeWebRequest> request = getRequest();
+                    if (request.isPresent()) {
+                        addLocationHeaderToResponse(serviceName, request.get());
+                    }
+                } catch (HeaderException e) {
+                    registeredServices.remove(serviceName);
+                    throw e;
+                }
+                return new ResponseEntity<>(HttpStatus.CREATED);
+            } else {
+                return new ResponseEntity<>(HttpStatus.OK);
+            }
+        } else {
+            throw new InvalidServiceException();
+        }
+    }
+
+    private void addLocationHeaderToResponse(String serviceName, NativeWebRequest request) throws HeaderException {
+        try {
+            HttpServletRequest nativeRequest = request.getNativeRequest(HttpServletRequest.class);
+            HttpServletResponse nativeResponse = request.getNativeResponse(HttpServletResponse.class);
+            if (nativeRequest != null && nativeResponse != null) {
+                StringBuffer requestURL = nativeRequest.getRequestURL();
+                nativeResponse.addHeader(LOCATION_HEADER, requestURL.toString());
+                nativeResponse.getWriter().print("");
+            } else {
+                throw new HeaderException(LOCATION_HEADER, serviceName,
+                    new Exception("Native Request or Response missing"));
+            }
+        } catch (IOException e) {
+            throw new HeaderException(LOCATION_HEADER, serviceName, e);
+        }
+    }
+
+    @Override
+    public ResponseEntity<Void> deleteIndividualService(String serviceName) {
+        registeredServices.remove(serviceName);
+        return new ResponseEntity<>(HttpStatus.NO_CONTENT);
+    }
+
+    /*
+     * java:S2589: Boolean expressions should not be gratuitous. Even though the
+     * version property is marked as @NotNull, it might be null coming from the
+     * client, hence the null check is needed.
+     */
+    @SuppressWarnings("java:S2589")
+    private boolean isServiceValid(InputService service) {
+        String version = service.getVersion();
+        return version != null && !version.isBlank();
+    }
+
+    private Service createService(String serviceName, InputService inputService) {
+        Service service = new Service();
+        service.setName(serviceName);
+        service.setDescription(inputService.getDescription());
+        service.setDisplayName(inputService.getDisplayName());
+        service.setVersion(inputService.getVersion());
+        service.setRegistrationDate(getTodaysDate());
+        return service;
+    }
+
+    private String getTodaysDate() {
+        long millis = System.currentTimeMillis();
+        Date date = new Date(millis);
+        return date.toString();
+    }
+}
diff --git a/r-app-catalogue/src/main/java/org/oransc/rappcatalogue/configuration/TomcatConfig.java b/r-app-catalogue/src/main/java/org/oransc/rappcatalogue/configuration/TomcatConfig.java
new file mode 100644 (file)
index 0000000..a04a332
--- /dev/null
@@ -0,0 +1,56 @@
+/*-
+ * ========================LICENSE_START=================================
+ * Copyright (C) 2021 Nordix Foundation. 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===================================
+ */
+
+package org.oransc.rappcatalogue.configuration;
+
+import org.apache.catalina.connector.Connector;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
+import org.springframework.boot.web.servlet.server.ServletWebServerFactory;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+/**
+ * Configure embedded Tomcat
+ */
+
+@Configuration
+public class TomcatConfig {
+
+    @Value("${server.http-port}")
+    private int httpPort = 0;
+
+    // Embedded Tomcat with HTTP and HTTPS support
+    @Bean
+    public ServletWebServerFactory servletContainer() {
+        TomcatServletWebServerFactory tomcat = new TomcatServletWebServerFactory();
+
+        if (httpPort > 0) {
+            tomcat.addAdditionalTomcatConnectors(getHttpConnector(httpPort));
+        }
+        return tomcat;
+    }
+
+    private static Connector getHttpConnector(int httpPort) {
+        Connector connector = new Connector(TomcatServletWebServerFactory.DEFAULT_PROTOCOL);
+        connector.setScheme("http");
+        connector.setPort(httpPort);
+        connector.setSecure(false);
+        return connector;
+    }
+}
index 676ae1c..8f64449 100644 (file)
@@ -18,7 +18,7 @@
 
 package org.oransc.rappcatalogue.exception;
 
-public class HeaderException extends RuntimeException {
+public class HeaderException extends Exception {
 
     private static final long serialVersionUID = -7798178963078284655L;
 
index dce815b..45ec769 100644 (file)
@@ -18,7 +18,7 @@
 
 package org.oransc.rappcatalogue.exception;
 
-public class InvalidServiceException extends RuntimeException {
+public class InvalidServiceException extends Exception {
     private static final long serialVersionUID = 3849219105170316564L;
 
     public InvalidServiceException() {
index 26b4b27..8411cf4 100644 (file)
@@ -18,7 +18,7 @@
 
 package org.oransc.rappcatalogue.exception;
 
-public class ServiceNotFoundException extends RuntimeException {
+public class ServiceNotFoundException extends Exception {
     private static final long serialVersionUID = 6579271315716003988L;
 
     public ServiceNotFoundException(String serviceName) {
diff --git a/r-app-catalogue/src/test/java/org/oransc/rappcatalogue/HttpsRequestTest.java b/r-app-catalogue/src/test/java/org/oransc/rappcatalogue/HttpsRequestTest.java
new file mode 100644 (file)
index 0000000..3cf2c2e
--- /dev/null
@@ -0,0 +1,113 @@
+/*-
+ * ========================LICENSE_START=================================
+ * Copyright (C) 2021 Nordix Foundation. 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===================================
+ */
+
+package org.oransc.rappcatalogue;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThrows;
+import static org.junit.Assert.assertTrue;
+
+import javax.net.ssl.SSLContext;
+
+import org.apache.http.client.HttpClient;
+import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.ssl.SSLContextBuilder;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
+import org.springframework.boot.test.web.client.TestRestTemplate;
+import org.springframework.boot.test.web.client.TestRestTemplate.HttpClientOption;
+import org.springframework.boot.web.client.RestTemplateBuilder;
+import org.springframework.boot.web.server.AbstractConfigurableWebServerFactory;
+import org.springframework.boot.web.server.LocalServerPort;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
+import org.springframework.test.context.TestPropertySource;
+import org.springframework.test.context.junit4.SpringRunner;
+import org.springframework.util.ResourceUtils;
+import org.springframework.web.client.ResourceAccessException;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
+@TestPropertySource(
+    properties = { //
+        "server.ssl.key-store=./config/r-app-catalogue-keystore.jks", //
+        "server.http-port=0"})
+public class HttpsRequestTest {
+
+    @Value("${server.ssl.key-store-password}")
+    private String keyStorePassword; // inject password from config
+
+    @Value("${server.ssl.key-store}")
+    private String keyStore; // inject keyStore from config
+
+    @LocalServerPort
+    private int port;
+
+    @Autowired
+    private AbstractConfigurableWebServerFactory webServerFactory;
+
+    @Test
+    public void testSsl() {
+        assertEquals(this.webServerFactory.getSsl().isEnabled(), true);
+    }
+
+    @Test
+    public void rest_OverPlainHttp_GetsBadRequestRequiresTLS() throws Exception {
+        TestRestTemplate template = new TestRestTemplate();
+        ResponseEntity<String> responseEntity =
+            template.getForEntity("http://localhost:" + port + "/services", String.class);
+        assertEquals(HttpStatus.BAD_REQUEST, responseEntity.getStatusCode());
+        assertTrue(responseEntity.getBody().contains("This combination of host and port requires TLS"));
+    }
+
+    @Test
+    public void rest_WithoutSSLConfiguration_ThrowsSSLExceptionUnableFindValidCertPath() throws Exception {
+        TestRestTemplate template = new TestRestTemplate();
+
+        ResourceAccessException thrown = assertThrows(ResourceAccessException.class, () -> {
+            template.getForEntity("https://localhost:" + port + "/services", String.class);
+        });
+        assertTrue(thrown.getMessage().contains("unable to find valid certification path to requested target"));
+    }
+
+    @Test
+    public void rest_WithTwoWaySSL_AuthenticatesAndGetsExpectedResponse() throws Exception {
+
+        SSLContext sslContext = new SSLContextBuilder().loadKeyMaterial(ResourceUtils.getFile(keyStore),
+            keyStorePassword.toCharArray(), keyStorePassword.toCharArray()).build();
+
+        SSLConnectionSocketFactory socketFactory = new SSLConnectionSocketFactory(sslContext);
+        HttpClient httpClient = HttpClients.custom().setSSLSocketFactory(socketFactory).build();
+        HttpComponentsClientHttpRequestFactory factory = new HttpComponentsClientHttpRequestFactory(httpClient);
+        RestTemplateBuilder rtb =
+            new RestTemplateBuilder().requestFactory(() -> factory).rootUri("https://localhost:" + port);
+
+        TestRestTemplate template = new TestRestTemplate(rtb, null, null, HttpClientOption.SSL);
+
+        ResponseEntity<String> responseEntity = template.getForEntity("/services", String.class);
+        assertEquals(HttpStatus.OK, responseEntity.getStatusCode());
+        assertEquals("[]", responseEntity.getBody());
+    }
+
+}
index f2f30ff..dd10a65 100644 (file)
-package org.oransc.rappcatalogue.api;\r
-\r
-import static org.assertj.core.api.Assertions.assertThat;\r
-import static org.junit.jupiter.api.Assertions.assertThrows;\r
-import static org.mockito.Mockito.mock;\r
-import static org.mockito.Mockito.verify;\r
-import static org.mockito.Mockito.when;\r
-import static org.springframework.http.HttpStatus.CREATED;\r
-import static org.springframework.http.HttpStatus.NO_CONTENT;\r
-import static org.springframework.http.HttpStatus.OK;\r
-\r
-import java.io.IOException;\r
-import java.io.PrintWriter;\r
-import java.sql.Date;\r
-import java.util.Arrays;\r
-import java.util.List;\r
-import javax.servlet.http.HttpServletRequest;\r
-import javax.servlet.http.HttpServletResponse;\r
-import org.junit.jupiter.api.Test;\r
-import org.junit.jupiter.api.extension.ExtendWith;\r
-import org.mockito.Mock;\r
-import org.mockito.junit.jupiter.MockitoExtension;\r
-import org.oransc.rappcatalogue.exception.HeaderException;\r
-import org.oransc.rappcatalogue.exception.InvalidServiceException;\r
-import org.oransc.rappcatalogue.exception.ServiceNotFoundException;\r
-import org.oransc.rappcatalogue.model.InputService;\r
-import org.oransc.rappcatalogue.model.Service;\r
-import org.springframework.http.ResponseEntity;\r
-import org.springframework.web.context.request.NativeWebRequest;\r
-\r
-@ExtendWith(MockitoExtension.class)\r
-class ServicesApiDelegateImplTest {\r
-\r
-    @Mock\r
-    NativeWebRequest webRequestMock;\r
-\r
-    private static final String INVALID_SERVICE_MESSAGE = "Service is missing required property: version";\r
-    private static final String SERVICE_NAME = "Service Name";\r
-    private static final String SERVICE_DESCRIPTION = "description";\r
-    private static final String SERVICE_VERSION = "1.0";\r
-    private static final String SERVICE_DISPLAY_NAME = "Display Name";\r
-\r
-    @Test\r
-    void getAddedService_shouldReturnService() {\r
-        ServicesApiDelegateImpl delegateUnderTest = new ServicesApiDelegateImpl(webRequestMock);\r
-\r
-        InputService service = new InputService();\r
-        service.setDescription(SERVICE_DESCRIPTION);\r
-        service.setVersion(SERVICE_VERSION);\r
-        service.setDisplayName(SERVICE_DISPLAY_NAME);\r
-\r
-        whenPrintResponseShouldWork();\r
-\r
-        delegateUnderTest.putIndividualService(SERVICE_NAME, service);\r
-\r
-        ResponseEntity<Service> response = delegateUnderTest.getIndividualService(SERVICE_NAME);\r
-\r
-        assertThat(response.getStatusCode()).isEqualTo(OK);\r
-        assertThat(response.getBody().getName()).isEqualTo(SERVICE_NAME);\r
-    }\r
-\r
-    @Test\r
-    void getMissingService_shouldThrowException() {\r
-        ServicesApiDelegateImpl delegateUnderTest = new ServicesApiDelegateImpl(null);\r
-\r
-        Exception exception = assertThrows(ServiceNotFoundException.class, () -> {\r
-            delegateUnderTest.getIndividualService(SERVICE_NAME);\r
-        });\r
-\r
-        String expectedMessage = "Service " + SERVICE_NAME + " not found";\r
-        String actualMessage = exception.getMessage();\r
-\r
-        assertThat(actualMessage).isEqualTo(expectedMessage);\r
-    }\r
-\r
-    @Test\r
-    void putNewValidService_shouldBeCreatedAndRegisteredAndUrlToNewServiceAddedToLocationHeaderInResponse() {\r
-        ServicesApiDelegateImpl delegateUnderTest = new ServicesApiDelegateImpl(webRequestMock);\r
-\r
-        InputService service = new InputService();\r
-        service.setDescription(SERVICE_DESCRIPTION);\r
-        service.setVersion(SERVICE_VERSION);\r
-        service.setDisplayName(SERVICE_DISPLAY_NAME);\r
-\r
-        String urlToCreatedService = "URL to created Service";\r
-        HttpServletResponse servletResponseMock = whenPrintResponseShouldWork(urlToCreatedService);\r
-\r
-        ResponseEntity<Void> putResponse = delegateUnderTest.putIndividualService(SERVICE_NAME, service);\r
-\r
-        assertThat(putResponse.getStatusCode()).isEqualTo(CREATED);\r
-        verify(servletResponseMock).addHeader("Location", urlToCreatedService);\r
-\r
-        ResponseEntity<Service> getResponse = delegateUnderTest.getIndividualService(SERVICE_NAME);\r
-\r
-        assertThat(getResponse.getStatusCode()).isEqualTo(OK);\r
-        Service body = getResponse.getBody();\r
-        assertThat(body.getName()).isEqualTo(SERVICE_NAME);\r
-        assertThat(body.getRegistrationDate()).isEqualTo(getTodaysDate());\r
-    }\r
-\r
-    @Test\r
-    void putModifiedService_shouldBeModified() {\r
-        ServicesApiDelegateImpl delegateUnderTest = new ServicesApiDelegateImpl(webRequestMock);\r
-\r
-        InputService service = new InputService();\r
-        service.setDescription(SERVICE_DESCRIPTION);\r
-        service.setVersion(SERVICE_VERSION);\r
-        service.setDisplayName(SERVICE_DISPLAY_NAME);\r
-\r
-        whenPrintResponseShouldWork();\r
-\r
-        delegateUnderTest.putIndividualService(SERVICE_NAME, service);\r
-\r
-        String newDescription = "New description";\r
-        service.setDescription(newDescription);\r
-        ResponseEntity<Void> putResponse = delegateUnderTest.putIndividualService(SERVICE_NAME, service);\r
-\r
-        assertThat(putResponse.getStatusCode()).isEqualTo(OK);\r
-\r
-        ResponseEntity<Service> getResponse = delegateUnderTest.getIndividualService(SERVICE_NAME);\r
-\r
-        assertThat(getResponse.getStatusCode()).isEqualTo(OK);\r
-        assertThat(getResponse.getBody().getDescription()).isEqualTo(newDescription);\r
-    }\r
-\r
-    @Test\r
-    void putServiceWithVersionNull_shouldThrowException() {\r
-        ServicesApiDelegateImpl delegateUnderTest = new ServicesApiDelegateImpl(null);\r
-\r
-        InputService service = new InputService();\r
-        service.setDescription(SERVICE_DESCRIPTION);\r
-        service.setDisplayName(SERVICE_DISPLAY_NAME);\r
-\r
-        Exception exception = assertThrows(InvalidServiceException.class, () -> {\r
-            delegateUnderTest.putIndividualService(SERVICE_NAME, service);\r
-        });\r
-\r
-        assertThat(exception.getMessage()).isEqualTo(INVALID_SERVICE_MESSAGE);\r
-    }\r
-\r
-    @Test\r
-    void putServiceWithBlankVersion_shouldThrowException() {\r
-        ServicesApiDelegateImpl delegateUnderTest = new ServicesApiDelegateImpl(null);\r
-\r
-        InputService service = new InputService();\r
-        service.setVersion("");\r
-        service.setDescription(SERVICE_DESCRIPTION);\r
-        service.setDisplayName(SERVICE_DISPLAY_NAME);\r
-\r
-        Exception exception = assertThrows(InvalidServiceException.class, () -> {\r
-            delegateUnderTest.putIndividualService(SERVICE_NAME, service);\r
-        });\r
-\r
-        assertThat(exception.getMessage()).isEqualTo(INVALID_SERVICE_MESSAGE);\r
-    }\r
-\r
-    @Test\r
-    void putServiceWhenIoExceptionAddingHeader_shouldThrowExceptionAndNoServiceCreated() throws Exception {\r
-        ServicesApiDelegateImpl delegateUnderTest = new ServicesApiDelegateImpl(webRequestMock);\r
-\r
-        whenGetRequestUrlThenReturnUrl();\r
-        HttpServletResponse servletResponseMock = mock(HttpServletResponse.class);\r
-        when(webRequestMock.getNativeResponse(HttpServletResponse.class)).thenReturn(servletResponseMock);\r
-        when(servletResponseMock.getWriter()).thenThrow(new IOException("Error"));\r
-\r
-        InputService service = new InputService();\r
-        service.setVersion("1.0");\r
-        service.setDescription(SERVICE_DESCRIPTION);\r
-        service.setDisplayName(SERVICE_DISPLAY_NAME);\r
-\r
-        Exception exception = assertThrows(HeaderException.class, () -> {\r
-            delegateUnderTest.putIndividualService(SERVICE_NAME, service);\r
-        });\r
-\r
-        assertThat(exception.getMessage())\r
-            .isEqualTo("Unable to set header Location in put response for service " + SERVICE_NAME + ". Cause: Error");\r
-\r
-        ResponseEntity<List<Service>> response = delegateUnderTest.getServices();\r
-        assertThat(response.getBody()).isEmpty();\r
-    }\r
-\r
-    @Test\r
-    void getServices_shouldProvideArrayOfAddedServiceNames() throws Exception {\r
-        ServicesApiDelegateImpl delegateUnderTest = new ServicesApiDelegateImpl(webRequestMock);\r
-\r
-        InputService service1 = new InputService();\r
-        service1.setDescription("description 1");\r
-        service1.setVersion(SERVICE_VERSION);\r
-        service1.setDisplayName("Display Name 1");\r
-\r
-        InputService service2 = new InputService();\r
-        service2.setDescription("description 2");\r
-        service2.setVersion(SERVICE_VERSION);\r
-        service2.setDisplayName("Display Name 2");\r
-\r
-        whenPrintResponseShouldWork();\r
-\r
-        String serviceName1 = "Service Name 1";\r
-        delegateUnderTest.putIndividualService(serviceName1, service1);\r
-        String serviceName2 = "Service Name 2";\r
-        delegateUnderTest.putIndividualService(serviceName2, service2);\r
-\r
-        ResponseEntity<List<Service>> response = delegateUnderTest.getServices();\r
-\r
-        assertThat(response.getStatusCode()).isEqualTo(OK);\r
-        List<Service> services = response.getBody();\r
-        assertThat(services).hasSize(2);\r
-        List<String> expectedServiceNames = Arrays.asList(serviceName1, serviceName2);\r
-        assertThat(expectedServiceNames).contains(services.get(0).getName()) //\r
-            .contains(services.get(1).getName());\r
-    }\r
-\r
-    @Test\r
-    void deleteService_shouldBeOk() {\r
-        ServicesApiDelegateImpl delegateUnderTest = new ServicesApiDelegateImpl(webRequestMock);\r
-\r
-        InputService service = new InputService();\r
-        service.setDescription(SERVICE_DESCRIPTION);\r
-        service.setVersion(SERVICE_VERSION);\r
-        service.setDisplayName(SERVICE_DISPLAY_NAME);\r
-\r
-        whenPrintResponseShouldWork();\r
-\r
-        delegateUnderTest.putIndividualService(SERVICE_NAME, service);\r
-\r
-        ResponseEntity<List<Service>> servicesResponse = delegateUnderTest.getServices();\r
-\r
-        assertThat(servicesResponse.getBody()).hasSize(1);\r
-\r
-        ResponseEntity<Void> deleteResponse = delegateUnderTest.deleteIndividualService(SERVICE_NAME);\r
-\r
-        assertThat(deleteResponse.getStatusCode()).isEqualTo(NO_CONTENT);\r
-\r
-        servicesResponse = delegateUnderTest.getServices();\r
-\r
-        assertThat(servicesResponse.getBody()).isEmpty();\r
-    }\r
-\r
-    private void whenGetRequestUrlThenReturnUrl() {\r
-        whenGetRequestUrlThenReturnUrl("URL");\r
-    }\r
-\r
-    private void whenGetRequestUrlThenReturnUrl(String url) {\r
-        HttpServletRequest servletRequestMock = mock(HttpServletRequest.class);\r
-        when(webRequestMock.getNativeRequest(HttpServletRequest.class)).thenReturn(servletRequestMock);\r
-        when(servletRequestMock.getRequestURL()).thenReturn(new StringBuffer(url));\r
-    }\r
-\r
-    private HttpServletResponse whenPrintResponseShouldWork() {\r
-        return whenPrintResponseShouldWork("URL");\r
-    }\r
-\r
-    private HttpServletResponse whenPrintResponseShouldWork(String url) {\r
-        whenGetRequestUrlThenReturnUrl(url);\r
-        HttpServletResponse servletResponseMock = mock(HttpServletResponse.class);\r
-        when(webRequestMock.getNativeResponse(HttpServletResponse.class)).thenReturn(servletResponseMock);\r
-        PrintWriter printWriterMock = mock(PrintWriter.class);\r
-        try {\r
-            when(servletResponseMock.getWriter()).thenReturn(printWriterMock);\r
-        } catch (IOException e) {\r
-            // Nothing\r
-        }\r
-        return servletResponseMock;\r
-    }\r
-\r
-    private String getTodaysDate() {\r
-        long millis = System.currentTimeMillis();\r
-        Date date = new Date(millis);\r
-        return date.toString();\r
-    }\r
-}\r
+
+package org.oransc.rappcatalogue.api;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+import static org.springframework.http.HttpStatus.CREATED;
+import static org.springframework.http.HttpStatus.NO_CONTENT;
+import static org.springframework.http.HttpStatus.OK;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.sql.Date;
+import java.util.Arrays;
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.mockito.Mock;
+import org.mockito.junit.jupiter.MockitoExtension;
+import org.oransc.rappcatalogue.exception.HeaderException;
+import org.oransc.rappcatalogue.exception.InvalidServiceException;
+import org.oransc.rappcatalogue.exception.ServiceNotFoundException;
+import org.oransc.rappcatalogue.model.InputService;
+import org.oransc.rappcatalogue.model.Service;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.context.request.NativeWebRequest;
+
+@ExtendWith(MockitoExtension.class)
+class ServicesApiDelegateImplTest {
+
+    @Mock
+    NativeWebRequest webRequestMock;
+
+    private static final String INVALID_SERVICE_MESSAGE = "Service is missing required property: version";
+    private static final String SERVICE_NAME = "Service Name";
+    private static final String SERVICE_DESCRIPTION = "description";
+    private static final String SERVICE_VERSION = "1.0";
+    private static final String SERVICE_DISPLAY_NAME = "Display Name";
+
+    @Test
+    void getAddedService_shouldReturnService() throws Exception {
+        ServicesApiDelegateImpl delegateUnderTest = new ServicesApiDelegateImpl(webRequestMock);
+
+        InputService service = new InputService();
+        service.setDescription(SERVICE_DESCRIPTION);
+        service.setVersion(SERVICE_VERSION);
+        service.setDisplayName(SERVICE_DISPLAY_NAME);
+
+        whenPrintResponseShouldWork();
+
+        delegateUnderTest.putIndividualService(SERVICE_NAME, service);
+
+        ResponseEntity<Service> response = delegateUnderTest.getIndividualService(SERVICE_NAME);
+
+        assertThat(response.getStatusCode()).isEqualTo(OK);
+        assertThat(response.getBody().getName()).isEqualTo(SERVICE_NAME);
+    }
+
+    @Test
+    void getMissingService_shouldThrowException() {
+        ServicesApiDelegateImpl delegateUnderTest = new ServicesApiDelegateImpl(null);
+
+        Exception exception = assertThrows(ServiceNotFoundException.class, () -> {
+            delegateUnderTest.getIndividualService(SERVICE_NAME);
+        });
+
+        String expectedMessage = "Service " + SERVICE_NAME + " not found";
+        String actualMessage = exception.getMessage();
+
+        assertThat(actualMessage).isEqualTo(expectedMessage);
+    }
+
+    @Test
+    void putNewValidService_shouldBeCreatedAndRegisteredAndUrlToNewServiceAddedToLocationHeaderInResponse()
+        throws Exception {
+        ServicesApiDelegateImpl delegateUnderTest = new ServicesApiDelegateImpl(webRequestMock);
+
+        InputService service = new InputService();
+        service.setDescription(SERVICE_DESCRIPTION);
+        service.setVersion(SERVICE_VERSION);
+        service.setDisplayName(SERVICE_DISPLAY_NAME);
+
+        String urlToCreatedService = "URL to created Service";
+        HttpServletResponse servletResponseMock = whenPrintResponseShouldWork(urlToCreatedService);
+
+        ResponseEntity<Void> putResponse = delegateUnderTest.putIndividualService(SERVICE_NAME, service);
+
+        assertThat(putResponse.getStatusCode()).isEqualTo(CREATED);
+        verify(servletResponseMock).addHeader("Location", urlToCreatedService);
+
+        ResponseEntity<Service> getResponse = delegateUnderTest.getIndividualService(SERVICE_NAME);
+
+        assertThat(getResponse.getStatusCode()).isEqualTo(OK);
+        Service body = getResponse.getBody();
+        assertThat(body.getName()).isEqualTo(SERVICE_NAME);
+        assertThat(body.getRegistrationDate()).isEqualTo(getTodaysDate());
+    }
+
+    @Test
+    void putModifiedService_shouldBeModified() throws Exception {
+        ServicesApiDelegateImpl delegateUnderTest = new ServicesApiDelegateImpl(webRequestMock);
+
+        InputService service = new InputService();
+        service.setDescription(SERVICE_DESCRIPTION);
+        service.setVersion(SERVICE_VERSION);
+        service.setDisplayName(SERVICE_DISPLAY_NAME);
+
+        whenPrintResponseShouldWork();
+
+        delegateUnderTest.putIndividualService(SERVICE_NAME, service);
+
+        String newDescription = "New description";
+        service.setDescription(newDescription);
+        ResponseEntity<Void> putResponse = delegateUnderTest.putIndividualService(SERVICE_NAME, service);
+
+        assertThat(putResponse.getStatusCode()).isEqualTo(OK);
+
+        ResponseEntity<Service> getResponse = delegateUnderTest.getIndividualService(SERVICE_NAME);
+
+        assertThat(getResponse.getStatusCode()).isEqualTo(OK);
+        assertThat(getResponse.getBody().getDescription()).isEqualTo(newDescription);
+    }
+
+    @Test
+    void putServiceWithVersionNull_shouldThrowException() {
+        ServicesApiDelegateImpl delegateUnderTest = new ServicesApiDelegateImpl(null);
+
+        InputService service = new InputService();
+        service.setDescription(SERVICE_DESCRIPTION);
+        service.setDisplayName(SERVICE_DISPLAY_NAME);
+
+        Exception exception = assertThrows(InvalidServiceException.class, () -> {
+            delegateUnderTest.putIndividualService(SERVICE_NAME, service);
+        });
+
+        assertThat(exception.getMessage()).isEqualTo(INVALID_SERVICE_MESSAGE);
+    }
+
+    @Test
+    void putServiceWithBlankVersion_shouldThrowException() {
+        ServicesApiDelegateImpl delegateUnderTest = new ServicesApiDelegateImpl(null);
+
+        InputService service = new InputService();
+        service.setVersion("");
+        service.setDescription(SERVICE_DESCRIPTION);
+        service.setDisplayName(SERVICE_DISPLAY_NAME);
+
+        Exception exception = assertThrows(InvalidServiceException.class, () -> {
+            delegateUnderTest.putIndividualService(SERVICE_NAME, service);
+        });
+
+        assertThat(exception.getMessage()).isEqualTo(INVALID_SERVICE_MESSAGE);
+    }
+
+    @Test
+    void putServiceWhenIoExceptionAddingHeader_shouldThrowExceptionAndNoServiceCreated() throws Exception {
+        ServicesApiDelegateImpl delegateUnderTest = new ServicesApiDelegateImpl(webRequestMock);
+
+        whenGetRequestUrlThenReturnUrl();
+        HttpServletResponse servletResponseMock = mock(HttpServletResponse.class);
+        when(webRequestMock.getNativeResponse(HttpServletResponse.class)).thenReturn(servletResponseMock);
+        when(servletResponseMock.getWriter()).thenThrow(new IOException("Error"));
+
+        InputService service = new InputService();
+        service.setVersion("1.0");
+        service.setDescription(SERVICE_DESCRIPTION);
+        service.setDisplayName(SERVICE_DISPLAY_NAME);
+
+        Exception exception = assertThrows(HeaderException.class, () -> {
+            delegateUnderTest.putIndividualService(SERVICE_NAME, service);
+        });
+
+        assertThat(exception.getMessage())
+            .isEqualTo("Unable to set header Location in put response for service " + SERVICE_NAME + ". Cause: Error");
+
+        ResponseEntity<List<Service>> response = delegateUnderTest.getServices();
+        assertThat(response.getBody()).isEmpty();
+    }
+
+    @Test
+    void getServices_shouldProvideArrayOfAddedServiceNames() throws Exception {
+        ServicesApiDelegateImpl delegateUnderTest = new ServicesApiDelegateImpl(webRequestMock);
+
+        InputService service1 = new InputService();
+        service1.setDescription("description 1");
+        service1.setVersion(SERVICE_VERSION);
+        service1.setDisplayName("Display Name 1");
+
+        InputService service2 = new InputService();
+        service2.setDescription("description 2");
+        service2.setVersion(SERVICE_VERSION);
+        service2.setDisplayName("Display Name 2");
+
+        whenPrintResponseShouldWork();
+
+        String serviceName1 = "Service Name 1";
+        delegateUnderTest.putIndividualService(serviceName1, service1);
+        String serviceName2 = "Service Name 2";
+        delegateUnderTest.putIndividualService(serviceName2, service2);
+
+        ResponseEntity<List<Service>> response = delegateUnderTest.getServices();
+
+        assertThat(response.getStatusCode()).isEqualTo(OK);
+        List<Service> services = response.getBody();
+        assertThat(services).hasSize(2);
+        List<String> expectedServiceNames = Arrays.asList(serviceName1, serviceName2);
+        assertThat(expectedServiceNames).contains(services.get(0).getName()) //
+            .contains(services.get(1).getName());
+    }
+
+    @Test
+    void deleteService_shouldBeOk() throws Exception {
+        ServicesApiDelegateImpl delegateUnderTest = new ServicesApiDelegateImpl(webRequestMock);
+
+        InputService service = new InputService();
+        service.setDescription(SERVICE_DESCRIPTION);
+        service.setVersion(SERVICE_VERSION);
+        service.setDisplayName(SERVICE_DISPLAY_NAME);
+
+        whenPrintResponseShouldWork();
+
+        delegateUnderTest.putIndividualService(SERVICE_NAME, service);
+
+        ResponseEntity<List<Service>> servicesResponse = delegateUnderTest.getServices();
+
+        assertThat(servicesResponse.getBody()).hasSize(1);
+
+        ResponseEntity<Void> deleteResponse = delegateUnderTest.deleteIndividualService(SERVICE_NAME);
+
+        assertThat(deleteResponse.getStatusCode()).isEqualTo(NO_CONTENT);
+
+        servicesResponse = delegateUnderTest.getServices();
+
+        assertThat(servicesResponse.getBody()).isEmpty();
+    }
+
+    private void whenGetRequestUrlThenReturnUrl() {
+        whenGetRequestUrlThenReturnUrl("URL");
+    }
+
+    private void whenGetRequestUrlThenReturnUrl(String url) {
+        HttpServletRequest servletRequestMock = mock(HttpServletRequest.class);
+        when(webRequestMock.getNativeRequest(HttpServletRequest.class)).thenReturn(servletRequestMock);
+        when(servletRequestMock.getRequestURL()).thenReturn(new StringBuffer(url));
+    }
+
+    private HttpServletResponse whenPrintResponseShouldWork() {
+        return whenPrintResponseShouldWork("URL");
+    }
+
+    private HttpServletResponse whenPrintResponseShouldWork(String url) {
+        whenGetRequestUrlThenReturnUrl(url);
+        HttpServletResponse servletResponseMock = mock(HttpServletResponse.class);
+        when(webRequestMock.getNativeResponse(HttpServletResponse.class)).thenReturn(servletResponseMock);
+        PrintWriter printWriterMock = mock(PrintWriter.class);
+        try {
+            when(servletResponseMock.getWriter()).thenReturn(printWriterMock);
+        } catch (IOException e) {
+            // Nothing
+        }
+        return servletResponseMock;
+    }
+
+    private String getTodaysDate() {
+        long millis = System.currentTimeMillis();
+        Date date = new Date(millis);
+        return date.toString();
+    }
+}
index 6091e4a..6009a54 100644 (file)
@@ -15,3 +15,4 @@ logs
 .pid*
 .result*
 tmp
+NO-CHECKIN
index 144ac36..8ecd60a 100755 (executable)
 
 TC_ONELINE_DESCR="Sanity test, create service and then create,update and delete a policy using http/https and Agent REST/DMAAP with/without SDNC controller"
 
-#App names to include in the test, space separated list
-INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM SDNC"
+#App names to include in the test when running docker, space separated list
+DOCKER_INCLUDED_IMAGES="CBS CONSUL CP CR MR DMAAPMR PA RICSIM SDNC"
 
-#SUPPORTED TEST ENV FILE
-SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN ORAN-CHERRY"
+#App names to include in the test when running kubernetes, space separated list
+KUBE_INCLUDED_IMAGES="CP CR MR PA RICSIM SDNC"
+#Prestarted app (not started by script) to include in the test when running kubernetes, space separated list
+KUBE_PRESTARTED_IMAGES=""
+
+#Supported test environment profiles
+SUPPORTED_PROFILES="ONAP-GUILIN ONAP-HONOLULU  ORAN-CHERRY ORAN-DAWN"
+#Supported run modes
+SUPPORTED_RUNMODES="DOCKER KUBE"
 
 . ../common/testcase_common.sh  $@
 . ../common/agent_api_functions.sh
-. ../common/ricsimulator_api_functions.sh
+. ../common/consul_cbs_functions.sh
+. ../common/control_panel_api_functions.sh
+. ../common/controller_api_functions.sh
 . ../common/cr_api_functions.sh
+. ../common/mr_api_functions.sh
+. ../common/ricsimulator_api_functions.sh
 
-#### TEST BEGIN ####
 
+#### TEST BEGIN ####
 
 generate_uuid
 
@@ -49,8 +60,7 @@ for __httpx in $TESTED_PROTOCOLS ; do
         echo "#####################################################################"
         echo "#####################################################################"
 
-        # Clean container and start all needed containers #
-        clean_containers
+        clean_environment
 
         if [ $__httpx == "HTTPS" ]; then
             use_agent_rest_https
@@ -58,13 +68,13 @@ for __httpx in $TESTED_PROTOCOLS ; do
             use_agent_rest_http
         fi
 
-        start_policy_agent
+        start_policy_agent NORPOXY $SIM_GROUP/$POLICY_AGENT_COMPOSE_DIR/application.yaml
 
         set_agent_trace
 
         # Create service to be able to receive events when rics becomes available
         # Must use rest towards the agent since dmaap is not configured yet
-        api_put_service 201 "ric-registration" 0 "$CR_PATH/ric-registration"
+        api_put_service 201 "ric-registration" 0 "$CR_SERVICE_PATH/ric-registration"
 
         if [ $__httpx == "HTTPS" ]; then
             use_cr_https
@@ -102,9 +112,11 @@ for __httpx in $TESTED_PROTOCOLS ; do
 
         start_cr
 
-        start_control_panel
+        start_control_panel $SIM_GROUP/$CONTROL_PANEL_COMPOSE_DIR/application.properties
 
-        start_consul_cbs
+        if [ $RUNMODE == "DOCKER" ]; then
+            start_consul_cbs
+        fi
 
         if [[ $interface = *"SDNC"* ]]; then
             start_sdnc
@@ -113,7 +125,11 @@ for __httpx in $TESTED_PROTOCOLS ; do
             prepare_consul_config      NOSDNC  ".consul_config.json"
         fi
 
-        consul_config_app                      ".consul_config.json"
+        if [ $RUNMODE == "KUBE" ]; then
+            agent_load_config                       ".consul_config.json"
+        else
+            consul_config_app                      ".consul_config.json"
+        fi
 
         mr_equal requests_submitted 0
 
@@ -123,7 +139,7 @@ for __httpx in $TESTED_PROTOCOLS ; do
 
             sim_put_policy_type 201 ricsim_g3_1 STD_QOS_0_2_0 testdata/STD2/sim_qos.json
 
-            api_equal json:rics 3 60
+            api_equal json:rics 3 300
 
             api_equal json:policy-types 3 120
 
@@ -136,7 +152,7 @@ for __httpx in $TESTED_PROTOCOLS ; do
             cr_api_check_all_sync_events 200 ric-registration ricsim_g1_1 ricsim_g2_1 ricsim_g3_1
 
         else
-            api_equal json:rics 2 60
+            api_equal json:rics 2 300
 
             api_equal json:policy_schemas 2 120
 
@@ -157,7 +173,7 @@ for __httpx in $TESTED_PROTOCOLS ; do
         echo "##### Service registry and supervision #####"
         echo "############################################"
 
-        api_put_service 201 "serv1" 1000 "$CR_PATH/1"
+        api_put_service 201 "serv1" 1000 "$CR_SERVICE_PATH/1"
 
         api_get_service_ids 200 "serv1" "ric-registration"
 
@@ -178,7 +194,7 @@ for __httpx in $TESTED_PROTOCOLS ; do
         echo "############################################"
 
         if [ "$PMS_VERSION" == "V2" ]; then
-            notificationurl=$CR_PATH"/test"
+            notificationurl=$CR_SERVICE_PATH"/test"
         else
             notificationurl=""
         fi
@@ -237,16 +253,16 @@ for __httpx in $TESTED_PROTOCOLS ; do
         fi
 
         if [[ $interface = *"SDNC"* ]]; then
-            sim_contains_str ricsim_g1_1 remote_hosts "a1-controller"
-            sim_contains_str ricsim_g2_1 remote_hosts "a1-controller"
+            sim_contains_str ricsim_g1_1 remote_hosts $SDNC_APP_NAME
+            sim_contains_str ricsim_g2_1 remote_hosts $SDNC_APP_NAME
             if [ "$PMS_VERSION" == "V2" ]; then
-                sim_contains_str ricsim_g3_1 remote_hosts "a1-controller"
+                sim_contains_str ricsim_g3_1 remote_hosts $SDNC_APP_NAME
             fi
         else
-            sim_contains_str ricsim_g1_1 remote_hosts "policy-agent"
-            sim_contains_str ricsim_g2_1 remote_hosts "policy-agent"
+            sim_contains_str ricsim_g1_1 remote_hosts $POLICY_AGENT_APP_NAME
+            sim_contains_str ricsim_g2_1 remote_hosts $POLICY_AGENT_APP_NAME
             if [ "$PMS_VERSION" == "V2" ]; then
-                sim_contains_str ricsim_g3_1 remote_hosts "policy-agent"
+                sim_contains_str ricsim_g3_1 remote_hosts $POLICY_AGENT_APP_NAME
             fi
         fi
 
@@ -268,4 +284,4 @@ done
 
 print_result
 
-auto_clean_containers
+auto_clean_environment
index ca545b2..01ba86f 100755 (executable)
 
 TC_ONELINE_DESCR="Basic use case, register service, create/update policy, delete policy, de-register service using both STD and OSC interface while mixing REST and Dmaap"
 
-#App names to include in the test, space separated list
-INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM"
+#App names to include in the test when running docker, space separated list
+DOCKER_INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM"
 
-#SUPPORTED TEST ENV FILE
-SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN ORAN-CHERRY"
+#App names to include in the test when running kubernetes, space separated list
+KUBE_INCLUDED_IMAGES=" MR CR PA RICSIM CP"
+#Prestarted app (not started by script) to include in the test when running kubernetes, space separated list
+KUBE_PRESTARTED_IMAGES=""
+
+#Supported test environment profiles
+SUPPORTED_PROFILES="ONAP-GUILIN ONAP-HONOLULU  ORAN-CHERRY ORAN-DAWN"
+#Supported run modes
+SUPPORTED_RUNMODES="DOCKER KUBE"
 
 . ../common/testcase_common.sh $@
 . ../common/agent_api_functions.sh
+. ../common/consul_cbs_functions.sh
+. ../common/control_panel_api_functions.sh
+. ../common/controller_api_functions.sh
+. ../common/cr_api_functions.sh
+. ../common/mr_api_functions.sh
 . ../common/ricsimulator_api_functions.sh
 
 #### TEST BEGIN ####
@@ -38,7 +50,7 @@ use_mr_http
 use_agent_rest_http
 
 
-clean_containers
+clean_environment
 
 start_ric_simulators  ricsim_g1 3 OSC_2.1.0
 
@@ -50,19 +62,28 @@ fi
 
 start_mr
 
-start_consul_cbs
+start_cr
 
-prepare_consul_config      NOSDNC  ".consul_config.json"
-consul_config_app                  ".consul_config.json"
+if [ $RUNMODE == "DOCKER" ]; then
+    start_consul_cbs
+fi
 
-start_control_panel
+start_control_panel $SIM_GROUP/$CONTROL_PANEL_COMPOSE_DIR/application.properties
 
-start_policy_agent
+start_policy_agent NORPOXY $SIM_GROUP/$POLICY_AGENT_COMPOSE_DIR/application.yaml
 
 set_agent_debug
 
 use_agent_rest_http
 
+prepare_consul_config      NOSDNC  ".consul_config.json"
+
+if [ $RUNMODE == "KUBE" ]; then
+    agent_load_config                       ".consul_config.json"
+else
+    consul_config_app                      ".consul_config.json"
+fi
+
 api_get_status 200
 
 sim_print ricsim_g1_1 interface
@@ -77,22 +98,22 @@ sim_put_policy_type 201 ricsim_g1_1 1 testdata/OSC/sim_1.json
 
 if [ "$PMS_VERSION" == "V2" ]; then
     sim_put_policy_type 201 ricsim_g3_1 STD_QOS_0_2_0 testdata/STD2/sim_qos.json
-    api_equal json:policy-types 3 60
+    api_equal json:policy-types 3 300
 else
-    api_equal json:policy_types 2 60
+    api_equal json:policy_types 2 300
 fi
 
 # Create policies
 
 if [ "$PMS_VERSION" == "V2" ]; then
-    notificationurl=$CR_PATH"/test"
+    notificationurl=$CR_SERVICE_PATH"/test"
 else
     notificationurl=""
 fi
 
 use_agent_rest_http
 
-api_put_service 201 "service1" 3600 "$CR_PATH/1"
+api_put_service 201 "service1" 3600 "$CR_SERVICE_PATH/1"
 
 api_put_policy 201 "service1" ricsim_g1_1 1 2000 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json 1
 
@@ -137,7 +158,7 @@ fi
 #Update policies
 use_agent_rest_http
 
-api_put_service 200 "service1" 3600 "$CR_PATH/1"
+api_put_service 200 "service1" 3600 "$CR_SERVICE_PATH/1"
 
 api_put_policy 200 "service1" ricsim_g1_1 1 2000 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json 1
 
@@ -228,10 +249,10 @@ fi
 
 # Check remote host access to simulator
 
-sim_contains_str ricsim_g1_1 remote_hosts "policy-agent"
-sim_contains_str ricsim_g2_1 remote_hosts "policy-agent"
+sim_contains_str ricsim_g1_1 remote_hosts $POLICY_AGENT_APP_NAME
+sim_contains_str ricsim_g2_1 remote_hosts $POLICY_AGENT_APP_NAME
 if [ "$PMS_VERSION" == "V2" ]; then
-    sim_contains_str ricsim_g3_1 remote_hosts "policy-agent"
+    sim_contains_str ricsim_g3_1 remote_hosts $POLICY_AGENT_APP_NAME
 fi
 
 # Check policy removal
@@ -260,4 +281,4 @@ store_logs          END
 
 print_result
 
-auto_clean_containers
\ No newline at end of file
+auto_clean_environment
\ No newline at end of file
index 4b2e162..3b9dcd7 100755 (executable)
 
 TC_ONELINE_DESCR="Full agent API walkthrough using agent REST/DMAAP and with/without SDNC A1 Controller"
 
-#App names to include in the test, space separated list
-INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM SDNC"
+#App names to include in the test when running docker, space separated list
+DOCKER_INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM SDNC"
 
+#App names to include in the test when running kubernetes, space separated list
+KUBE_INCLUDED_IMAGES="CP CR MR PA RICSIM SDNC"
+#Prestarted app (not started by script) to include in the test when running kubernetes, space separated list
+KUBE_PRESTARTED_IMAGES=""
 
-#SUPPORTED TEST ENV FILE
-SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN ORAN-CHERRY"
+#Supported test environment profiles
+SUPPORTED_PROFILES="ONAP-GUILIN ONAP-HONOLULU  ORAN-CHERRY ORAN-DAWN"
+#Supported run modes
+SUPPORTED_RUNMODES="DOCKER KUBE"
 
 . ../common/testcase_common.sh  $@
 . ../common/agent_api_functions.sh
-. ../common/ricsimulator_api_functions.sh
+. ../common/consul_cbs_functions.sh
+. ../common/control_panel_api_functions.sh
+. ../common/controller_api_functions.sh
 . ../common/cr_api_functions.sh
+. ../common/mr_api_functions.sh
+. ../common/ricsimulator_api_functions.sh
+
 
 #### TEST BEGIN ####
 
@@ -52,7 +63,7 @@ for __httpx in $TESTED_PROTOCOLS ; do
         echo "#####################################################################"
 
         # Clean container and start all needed containers #
-        clean_containers
+        clean_environment
 
         if [ $__httpx == "HTTPS" ]; then
             use_cr_https
@@ -62,13 +73,13 @@ for __httpx in $TESTED_PROTOCOLS ; do
             use_cr_http
         fi
 
-        start_policy_agent
+        start_policy_agent NORPOXY $SIM_GROUP/$POLICY_AGENT_COMPOSE_DIR/application.yaml
 
-        set_agent_trace
+        set_agent_debug
 
         # Create service to be able to receive events when rics becomes available
         # Must use rest towards the agent since dmaap is not configured yet
-        api_put_service 201 "ric-registration" 0 "$CR_PATH/ric-registration"
+        api_put_service 201 "ric-registration" 0 "$CR_SERVICE_PATH/ric-registration"
 
 
         if [ $__httpx == "HTTPS" ]; then
@@ -105,9 +116,11 @@ for __httpx in $TESTED_PROTOCOLS ; do
 
         start_cr
 
-        start_control_panel
+        start_control_panel $SIM_GROUP/$CONTROL_PANEL_COMPOSE_DIR/application.properties
 
-        start_consul_cbs
+        if [ $RUNMODE == "DOCKER" ]; then
+            start_consul_cbs
+        fi
 
         if [[ $interface = *"SDNC"* ]]; then
             start_sdnc
@@ -116,7 +129,11 @@ for __httpx in $TESTED_PROTOCOLS ; do
             prepare_consul_config      NOSDNC  ".consul_config.json"
         fi
 
-        consul_config_app                      ".consul_config.json"
+        if [ $RUNMODE == "KUBE" ]; then
+            agent_load_config                       ".consul_config.json"
+        else
+            consul_config_app                      ".consul_config.json"
+        fi
 
         sim_put_policy_type 201 ricsim_g1_1 1 testdata/OSC/sim_1.json
         sim_put_policy_type 201 ricsim_g1_1 2 testdata/OSC/sim_2.json
@@ -125,7 +142,7 @@ for __httpx in $TESTED_PROTOCOLS ; do
             sim_put_policy_type 201 ricsim_g3_1 STD_QOS_0_2_0 testdata/STD2/sim_qos.json
             sim_put_policy_type 201 ricsim_g3_1 STD_QOS2_0.1.0 testdata/STD2/sim_qos2.json
 
-            api_equal json:rics 3 60
+            api_equal json:rics 3 300
 
             api_equal json:policy-types 5 120
 
@@ -133,7 +150,7 @@ for __httpx in $TESTED_PROTOCOLS ; do
 
             api_equal json:policy-instances 0
         else
-            api_equal json:rics 2 60
+            api_equal json:rics 2 300
 
             api_equal json:policy_schemas 3 120
 
@@ -163,14 +180,14 @@ for __httpx in $TESTED_PROTOCOLS ; do
 
         api_get_services 404 "service1"
 
-        api_put_service 201 "service1" 1000 "$CR_PATH/1"
+        api_put_service 201 "service1" 1000 "$CR_SERVICE_PATH/1"
 
-        api_put_service 200 "service1" 2000 "$CR_PATH/1"
+        api_put_service 200 "service1" 2000 "$CR_SERVICE_PATH/1"
 
 
-        api_put_service 400 "service2" -1 "$CR_PATH/2"
+        api_put_service 400 "service2" -1 "$CR_SERVICE_PATH/2"
 
-        api_put_service 400 "service2" "wrong" "$CR_PATH/2"
+        api_put_service 400 "service2" "wrong" "$CR_SERVICE_PATH/2"
 
         api_put_service 400 "service2" 100 "/test"
 
@@ -178,20 +195,20 @@ for __httpx in $TESTED_PROTOCOLS ; do
 
         api_put_service 201 "service2" 300 "ftp://localhost:80/test"
 
-        api_get_services 200 "service1" "service1" 2000 "$CR_PATH/1"
+        api_get_services 200 "service1" "service1" 2000 "$CR_SERVICE_PATH/1"
 
         api_get_service_ids 200 "service1" "service2" "ric-registration"
 
 
-        api_put_service 201 "service3" 5000 "$CR_PATH/3"
+        api_put_service 201 "service3" 5000 "$CR_SERVICE_PATH/3"
 
 
         api_get_service_ids 200 "service1" "service2" "service3" "ric-registration"
 
 
-        api_get_services 200 "service1" "service1" 2000 "$CR_PATH/1"
+        api_get_services 200 "service1" "service1" 2000 "$CR_SERVICE_PATH/1"
 
-        api_get_services 200 NOSERVICE "service1" 2000 "$CR_PATH/1" "service2" 300 "ftp://localhost:80/test" "service3" 5000 "$CR_PATH/3"  "ric-registration" 0 "$CR_PATH/ric-registration"
+        api_get_services 200 NOSERVICE "service1" 2000 "$CR_SERVICE_PATH/1" "service2" 300 "ftp://localhost:80/test" "service3" 5000 "$CR_SERVICE_PATH/3"  "ric-registration" 0 "$CR_SERVICE_PATH/ric-registration"
 
         api_get_services 200
 
@@ -220,7 +237,7 @@ for __httpx in $TESTED_PROTOCOLS ; do
         api_get_service_ids 200 "service2" "service3" "ric-registration"
 
 
-        api_put_service 201 "service1" 50 "$CR_PATH/1"
+        api_put_service 201 "service1" 50 "$CR_SERVICE_PATH/1"
 
         api_get_service_ids 200 "service1" "service2" "service3"  "ric-registration"
 
@@ -355,10 +372,10 @@ for __httpx in $TESTED_PROTOCOLS ; do
 
 
 
-        api_put_service 201 "service10" 3600 "$CR_PATH/1"
+        api_put_service 201 "service10" 3600 "$CR_SERVICE_PATH/1"
 
         if [ "$PMS_VERSION" == "V2" ]; then
-            notificationurl=$CR_PATH"/test"
+            notificationurl=$CR_SERVICE_PATH"/test"
         else
             notificationurl=""
         fi
@@ -529,16 +546,16 @@ for __httpx in $TESTED_PROTOCOLS ; do
         fi
 
         if [[ $interface = *"SDNC"* ]]; then
-            sim_contains_str ricsim_g1_1 remote_hosts "a1-controller"
-            sim_contains_str ricsim_g2_1 remote_hosts "a1-controller"
+            sim_contains_str ricsim_g1_1 remote_hosts $SDNC_APP_NAME
+            sim_contains_str ricsim_g2_1 remote_hosts $SDNC_APP_NAME
             if [ "$PMS_VERSION" == "V2" ]; then
-                sim_contains_str ricsim_g3_1 remote_hosts "a1-controller"
+                sim_contains_str ricsim_g3_1 remote_hosts $SDNC_APP_NAME
             fi
         else
-            sim_contains_str ricsim_g1_1 remote_hosts "policy-agent"
-            sim_contains_str ricsim_g2_1 remote_hosts "policy-agent"
+            sim_contains_str ricsim_g1_1 remote_hosts $POLICY_AGENT_APP_NAME
+            sim_contains_str ricsim_g2_1 remote_hosts $POLICY_AGENT_APP_NAME
             if [ "$PMS_VERSION" == "V2" ]; then
-                sim_contains_str ricsim_g3_1 remote_hosts "policy-agent"
+                sim_contains_str ricsim_g3_1 remote_hosts $POLICY_AGENT_APP_NAME
             fi
         fi
 
@@ -560,4 +577,4 @@ done
 
 print_result
 
-auto_clean_containers
+auto_clean_environment
index 0406c40..81aa95c 100755 (executable)
 
 TC_ONELINE_DESCR="Testing of service registration timeouts and keepalive"
 
-#App names to include in the test, space separated list
-INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM"
+#App names to include in the test when running docker, space separated list
+DOCKER_INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM"
 
-#SUPPORTED TEST ENV FILE
-SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN ORAN-CHERRY"
+#App names to include in the test when running kubernetes, space separated list
+KUBE_INCLUDED_IMAGES="CP CR MR PA RICSIM"
+#Prestarted app (not started by script) to include in the test when running kubernetes, space separated list
+KUBE_PRESTARTED_IMAGES=""
+
+#Supported test environment profiles
+SUPPORTED_PROFILES="ONAP-GUILIN ONAP-HONOLULU  ORAN-CHERRY ORAN-DAWN"
+#Supported run modes
+SUPPORTED_RUNMODES="DOCKER KUBE"
 
 . ../common/testcase_common.sh  $@
 . ../common/agent_api_functions.sh
-. ../common/ricsimulator_api_functions.sh
+. ../common/consul_cbs_functions.sh
+. ../common/control_panel_api_functions.sh
 . ../common/cr_api_functions.sh
+. ../common/mr_api_functions.sh
+. ../common/ricsimulator_api_functions.sh
 
 generate_uuid
 
@@ -41,7 +51,7 @@ use_agent_rest_http
 
 #### TEST BEGIN ####
 
-clean_containers
+clean_environment
 
 start_ric_simulators ricsim_g1 1  OSC_2.1.0
 start_ric_simulators ricsim_g2 1  STD_1.1.3
@@ -53,14 +63,21 @@ start_mr
 
 start_cr
 
-start_consul_cbs
+if [ $RUNMODE == "DOCKER" ]; then
+    start_consul_cbs
+fi
 
-prepare_consul_config      NOSDNC  ".consul_config.json"
-consul_config_app                  ".consul_config.json"
+start_control_panel $SIM_GROUP/$CONTROL_PANEL_COMPOSE_DIR/application.properties
 
-start_control_panel
+start_policy_agent NORPOXY $SIM_GROUP/$POLICY_AGENT_COMPOSE_DIR/application.yaml
 
-start_policy_agent
+prepare_consul_config      NOSDNC  ".consul_config.json"
+
+if [ $RUNMODE == "KUBE" ]; then
+    agent_load_config                       ".consul_config.json"
+else
+    consul_config_app                      ".consul_config.json"
+fi
 
 set_agent_debug
 
@@ -76,60 +93,60 @@ if [ "$PMS_VERSION" == "V2" ]; then
     sim_print ricsim_g3_1 interface
 fi
 
-api_put_service 201 "service1" 15 "$CR_PATH/service1"
+api_put_service 201 "service1" 15 "$CR_SERVICE_PATH/service1"
 
-api_get_services 200 "service1" "service1" 15 "$CR_PATH/service1"
+api_get_services 200 "service1" "service1" 15 "$CR_SERVICE_PATH/service1"
 
-api_put_service 201 "service2" 120 "$CR_PATH/service2"
+api_put_service 201 "service2" 120 "$CR_SERVICE_PATH/service2"
 
-api_get_services 200 "service2" "service2" 120 "$CR_PATH/service2"
+api_get_services 200 "service2" "service2" 120 "$CR_SERVICE_PATH/service2"
 
-api_put_service 200 "service1" 50 "$CR_PATH/service1"
-api_put_service 200 "service2" 180 "$CR_PATH/service2"
+api_put_service 200 "service1" 50 "$CR_SERVICE_PATH/service1"
+api_put_service 200 "service2" 180 "$CR_SERVICE_PATH/service2"
 
-api_get_services 200 "service1" "service1" 50 "$CR_PATH/service1"
-api_get_services 200 "service2" "service2" 180 "$CR_PATH/service2"
+api_get_services 200 "service1" "service1" 50 "$CR_SERVICE_PATH/service1"
+api_get_services 200 "service2" "service2" 180 "$CR_SERVICE_PATH/service2"
 
 api_get_service_ids 200 "service1" "service2"
 
 sleep_wait 30 "Waiting for keep alive timeout"
 
-api_get_services 200 "service1" "service1" 50 "$CR_PATH/service1"
-api_get_services 200 "service2" "service2" 180 "$CR_PATH/service2"
+api_get_services 200 "service1" "service1" 50 "$CR_SERVICE_PATH/service1"
+api_get_services 200 "service2" "service2" 180 "$CR_SERVICE_PATH/service2"
 
 sleep_wait 100 "Waiting for keep alive timeout"
 
 api_get_services 404 "service1"
-api_get_services 200 "service2" "service2" 180 "$CR_PATH/service2"
+api_get_services 200 "service2" "service2" 180 "$CR_SERVICE_PATH/service2"
 
 api_delete_services 204 "service2"
 
 api_get_services 404 "service1"
 api_get_services 404 "service2"
 
-api_put_service 201 "service3" 60 "$CR_PATH/service3"
+api_put_service 201 "service3" 60 "$CR_SERVICE_PATH/service3"
 
-api_get_services 200 "service3" "service3" 60 "$CR_PATH/service3"
+api_get_services 200 "service3" "service3" 60 "$CR_SERVICE_PATH/service3"
 
 sleep_wait 30 "Waiting for keep alive timeout"
 
-api_put_service 200 "service3" 60 "$CR_PATH/service3"
+api_put_service 200 "service3" 60 "$CR_SERVICE_PATH/service3"
 
 sleep_wait 100 "Waiting for keep alive timeout"
 
 api_get_services 404 "service3"
 
-api_put_service 201 "service4" 120 "$CR_PATH/service4"
+api_put_service 201 "service4" 120 "$CR_SERVICE_PATH/service4"
 
 sleep_wait 60 "Waiting for keep alive timeout"
 
-api_get_services 200 "service4" "service4" 120 "$CR_PATH/service4"
+api_get_services 200 "service4" "service4" 120 "$CR_SERVICE_PATH/service4"
 
 api_put_services_keepalive 200 "service4"
 
 sleep_wait 90 "Waiting for keep alive timeout"
 
-api_get_services 200 "service4" "service4" 120 "$CR_PATH/service4"
+api_get_services 200 "service4" "service4" 120 "$CR_SERVICE_PATH/service4"
 
 api_delete_services 204 "service4"
 
@@ -152,7 +169,7 @@ api_put_services_keepalive 404 "service3"
 api_put_services_keepalive 404 "service4"
 
 # Policy delete after timeout
-api_put_service 201 "service10" 600 "$CR_PATH/service10"
+api_put_service 201 "service10" 600 "$CR_SERVICE_PATH/service10"
 
 sim_put_policy_type 201 ricsim_g1_1 1 testdata/OSC/sim_1.json
 
@@ -160,7 +177,7 @@ if [ "$PMS_VERSION" == "V2" ]; then
 
     sim_put_policy_type 201 ricsim_g3_1 STD_QOS2_0.1.0 testdata/STD2/sim_qos2.json
 
-    api_equal json:rics 3 60
+    api_equal json:rics 3 300
 
     #api_equal json:policy_schemas 2 120
 
@@ -168,7 +185,7 @@ if [ "$PMS_VERSION" == "V2" ]; then
 
     api_equal json:policies 0
 else
-    api_equal json:rics 2 60
+    api_equal json:rics 2 300
 
     api_equal json:policy_schemas 2 120
 
@@ -178,7 +195,7 @@ else
 fi
 
 if [ "$PMS_VERSION" == "V2" ]; then
-    notificationurl=$CR_PATH"/test"
+    notificationurl=$CR_SERVICE_PATH"/test"
 else
     notificationurl=""
 fi
@@ -232,7 +249,7 @@ if [ "$PMS_VERSION" == "V2" ]; then
     sim_equal ricsim_g3_1 num_instances 1
 fi
 
-api_put_service 200 "service10" 10 "$CR_PATH/service10"
+api_put_service 200 "service10" 10 "$CR_SERVICE_PATH/service10"
 
 #Wait for service expiry
 api_equal json:policies 0 120
@@ -256,4 +273,4 @@ store_logs          END
 
 print_result
 
-auto_clean_containers
\ No newline at end of file
+auto_clean_environment
\ No newline at end of file
index 4672cb2..d312caa 100755 (executable)
 
 TC_ONELINE_DESCR="ECS full intefaces walkthrough"
 
-#App names to include in the test, space separated list
-INCLUDED_IMAGES="ECS PRODSTUB CR RICSIM CP"
+#App names to include in the test when running docker, space separated list
+DOCKER_INCLUDED_IMAGES="ECS PRODSTUB CR RICSIM CP"
 
-#SUPPORTED TEST ENV FILE
-SUPPORTED_PROFILES="ONAP-MASTER ORAN-CHERRY"
+#App names to include in the test when running kubernetes, space separated list
+KUBE_INCLUDED_IMAGES=" PRODSTUB CR ECS RICSIM CP "
+#Prestarted app (not started by script) to include in the test when running kubernetes, space separated list
+KUBE_PRESTARTED_IMAGES=" "
+
+#Supported test environment profiles
+SUPPORTED_PROFILES="ONAP-HONOLULU  ORAN-CHERRY ORAN-DAWN"
+#Supported run modes
+SUPPORTED_RUNMODES="DOCKER KUBE"
 
 . ../common/testcase_common.sh  $@
 . ../common/ecs_api_functions.sh
 . ../common/prodstub_api_functions.sh
 . ../common/cr_api_functions.sh
+. ../common/control_panel_api_functions.sh
+. ../common/controller_api_functions.sh
+. ../common/ricsimulator_api_functions.sh
 
 #### TEST BEGIN ####
 
 FLAT_A1_EI="1"
 
-clean_containers
+clean_environment
 
 use_ecs_rest_https
 
@@ -45,13 +55,17 @@ use_simulator_https
 
 use_cr_https
 
-start_ecs
+start_ecs $SIM_GROUP/$ECS_COMPOSE_DIR/application.yaml
+
+if [ $RUNMODE == "KUBE" ]; then
+    ecs_api_admin_reset
+fi
 
 start_prod_stub
 
 set_ecs_trace
 
-start_control_panel
+start_control_panel $SIM_GROUP/$CONTROL_PANEL_COMPOSE_DIR/application.properties
 
 if [ "$PMS_VERSION" == "V2" ]; then
     start_ric_simulators ricsim_g3 4  STD_2.0.0
@@ -59,19 +73,19 @@ fi
 
 start_cr
 
-CB_JOB="$PROD_STUB_HTTPX://$PROD_STUB_APP_NAME:$PROD_STUB_PORT/callbacks/job"
-CB_SV="$PROD_STUB_HTTPX://$PROD_STUB_APP_NAME:$PROD_STUB_PORT/callbacks/supervision"
+CB_JOB="$PROD_STUB_SERVICE_PATH$PROD_STUB_JOB_CALLBACK"
+CB_SV="$PROD_STUB_SERVICE_PATH$PROD_STUB_SUPERVISION_CALLBACK"
 TARGET1="$RIC_SIM_HTTPX://ricsim_g3_1:$RIC_SIM_PORT/datadelivery"
 TARGET2="$RIC_SIM_HTTPX://ricsim_g3_2:$RIC_SIM_PORT/datadelivery"
 TARGET3="$RIC_SIM_HTTPX://ricsim_g3_3:$RIC_SIM_PORT/datadelivery"
 TARGET8="$RIC_SIM_HTTPX://ricsim_g3_4:$RIC_SIM_PORT/datadelivery"
 TARGET10="$RIC_SIM_HTTPX://ricsim_g3_4:$RIC_SIM_PORT/datadelivery"
 
-STATUS1="$CR_HTTPX://$CR_APP_NAME:$CR_PORT/callbacks/job1-status"
-STATUS2="$CR_HTTPX://$CR_APP_NAME:$CR_PORT/callbacks/job2-status"
-STATUS3="$CR_HTTPX://$CR_APP_NAME:$CR_PORT/callbacks/job3-status"
-STATUS8="$CR_HTTPX://$CR_APP_NAME:$CR_PORT/callbacks/job8-status"
-STATUS10="$CR_HTTPX://$CR_APP_NAME:$CR_PORT/callbacks/job10-status"
+STATUS1="$CR_SERVICE_PATH/job1-status"
+STATUS2="$CR_SERVICE_PATH/job2-status"
+STATUS3="$CR_SERVICE_PATH/job3-status"
+STATUS8="$CR_SERVICE_PATH/job8-status"
+STATUS10="$CR_SERVICE_PATH/job10-status"
 
 ### Setup prodstub sim to accept calls for producers, types and jobs
 ## prod-a type1
@@ -138,11 +152,19 @@ ecs_api_a1_get_type_ids 200 EMPTY
 ecs_api_a1_get_type 404 test-type
 
 ecs_api_edp_get_type_ids 200 EMPTY
-ecs_api_edp_get_type 404 test-type
-
-ecs_api_edp_get_producer_ids 200 EMPTY
-ecs_api_edp_get_producer 404 test-prod
+if [ $ECS_VERSION == "V1-1" ]; then
+    ecs_api_edp_get_type 404 test-type
+else
+    ecs_api_edp_get_type_2 404 test-type
+fi
 
+if [ $ECS_VERSION == "V1-1" ]; then
+    ecs_api_edp_get_producer_ids 200 EMPTY
+    ecs_api_edp_get_producer 404 test-prod
+else
+    ecs_api_edp_get_producer_ids_2 200 NOTYPE EMPTY
+    ecs_api_edp_get_producer_2 404 test-prod
+fi
 ecs_api_edp_get_producer_status 404 test-prod
 
 ecs_api_edp_delete_producer 404 test-prod
@@ -171,12 +193,39 @@ fi
 
 ecs_api_edp_get_producer_jobs 404 test-prod
 
+if [ $ECS_VERSION == "V1-2" ]; then
+    ecs_api_edp_get_type_2 404 test-type
+    ecs_api_edp_delete_type_2 404 test-type
+fi
 
 ### Setup of producer/job and testing apis ###
 
 ## Setup prod-a
-ecs_api_edp_put_producer 201 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json
-ecs_api_edp_put_producer 200 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json
+if [ $ECS_VERSION == "V1-1" ]; then
+    ecs_api_edp_put_producer 201 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json
+    ecs_api_edp_put_producer 200 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json
+else
+    #V1-2
+    ecs_api_edp_get_type_ids 200 EMPTY
+    ecs_api_edp_get_type_2 404 type1
+    ecs_api_edp_put_producer_2 404 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1
+
+    # Create type, delete and create again
+    ecs_api_edp_put_type_2 201 type1 testdata/ecs/ei-type-1.json
+    ecs_api_edp_get_type_2 200 type1
+    ecs_api_edp_get_type_ids 200 type1
+    ecs_api_edp_delete_type_2 204 type1
+    ecs_api_edp_get_type_2 404 type1
+    ecs_api_edp_get_type_ids 200 EMPTY
+    ecs_api_edp_put_type_2 201 type1 testdata/ecs/ei-type-1.json
+    ecs_api_edp_get_type_ids 200 type1
+    ecs_api_edp_get_type_2 200 type1 testdata/ecs/ei-type-1.json
+
+    ecs_api_edp_put_producer_2 201 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1
+    ecs_api_edp_put_producer_2 200 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1
+
+    ecs_api_edp_delete_type_2 406 type1
+fi
 
 
 ecs_api_a1_get_type_ids 200 type1
@@ -187,11 +236,25 @@ else
 fi
 
 ecs_api_edp_get_type_ids 200 type1
-ecs_api_edp_get_type 200 type1 testdata/ecs/ei-type-1.json prod-a
+if [ $ECS_VERSION == "V1-1" ]; then
+    ecs_api_edp_get_type 200 type1 testdata/ecs/ei-type-1.json prod-a
+else
+    ecs_api_edp_get_type_2 200 type1 testdata/ecs/ei-type-1.json
+fi
 
-ecs_api_edp_get_producer_ids 200 prod-a
+if [ $ECS_VERSION == "V1-1" ]; then
+    ecs_api_edp_get_producer_ids 200 prod-a
+else
+    ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-a
+    ecs_api_edp_get_producer_ids_2 200 type1 prod-a
+    ecs_api_edp_get_producer_ids_2 200 type2 EMPTY
+fi
 
-ecs_api_edp_get_producer 200 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json
+if [ $ECS_VERSION == "V1-1" ]; then
+    ecs_api_edp_get_producer 200 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json
+else
+    ecs_api_edp_get_producer_2 200 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1
+fi
 
 ecs_api_edp_get_producer_status 200 prod-a ENABLED
 
@@ -275,7 +338,13 @@ prodstub_equal create/prod-a/job2 1
 ecs_api_edp_get_producer_jobs 200 prod-a job1 type1 $TARGET1 ricsim_g3_1 testdata/ecs/job-template.json job2 type1 $TARGET2 ricsim_g3_2 testdata/ecs/job-template.json
 
 ## Setup prod-b
-ecs_api_edp_put_producer 201 prod-b $CB_JOB/prod-b $CB_SV/prod-b type2 testdata/ecs/ei-type-2.json
+if [ $ECS_VERSION == "V1-1" ]; then
+    ecs_api_edp_put_producer 201 prod-b $CB_JOB/prod-b $CB_SV/prod-b type2 testdata/ecs/ei-type-2.json
+else
+    ecs_api_edp_put_type_2 201 type2 testdata/ecs/ei-type-2.json
+    ecs_api_edp_put_producer_2 201 prod-b $CB_JOB/prod-b $CB_SV/prod-b type2
+fi
+
 
 ecs_api_a1_get_type_ids 200 type1 type2
 if [  -z "$FLAT_A1_EI" ]; then
@@ -287,14 +356,27 @@ else
 fi
 
 ecs_api_edp_get_type_ids 200 type1 type2
-ecs_api_edp_get_type 200 type1 testdata/ecs/ei-type-1.json prod-a
-ecs_api_edp_get_type 200 type2 testdata/ecs/ei-type-2.json prod-b
-
-ecs_api_edp_get_producer_ids 200 prod-a prod-b
+if [ $ECS_VERSION == "V1-1" ]; then
+    ecs_api_edp_get_type 200 type1 testdata/ecs/ei-type-1.json prod-a
+    ecs_api_edp_get_type 200 type2 testdata/ecs/ei-type-2.json prod-b
+else
+    ecs_api_edp_get_type_2 200 type1 testdata/ecs/ei-type-1.json
+    ecs_api_edp_get_type_2 200 type2 testdata/ecs/ei-type-2.json
+fi
 
-ecs_api_edp_get_producer 200 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json
-ecs_api_edp_get_producer 200 prod-b $CB_JOB/prod-b $CB_SV/prod-b type2 testdata/ecs/ei-type-2.json
+if [ $ECS_VERSION == "V1-1" ]; then
+    ecs_api_edp_get_producer_ids 200 prod-a prod-b
+else
+    ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-a prod-b
+fi
 
+if [ $ECS_VERSION == "V1-1" ]; then
+    ecs_api_edp_get_producer 200 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json
+    ecs_api_edp_get_producer 200 prod-b $CB_JOB/prod-b $CB_SV/prod-b type2 testdata/ecs/ei-type-2.json
+else
+    ecs_api_edp_get_producer_2 200 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1
+    ecs_api_edp_get_producer_2 200 prod-b $CB_JOB/prod-b $CB_SV/prod-b type2
+fi
 
 ecs_api_edp_get_producer_status 200 prod-b ENABLED
 
@@ -332,14 +414,27 @@ ecs_api_edp_get_producer_jobs 200 prod-b job3 type2 $TARGET3 ricsim_g3_3 testdat
 
 
 ## Setup prod-c (no types)
-ecs_api_edp_put_producer 201 prod-c $CB_JOB/prod-c $CB_SV/prod-c NOTYPE
-
+if [ $ECS_VERSION == "V1-1" ]; then
+    ecs_api_edp_put_producer 201 prod-c $CB_JOB/prod-c $CB_SV/prod-c NOTYPE
+else
+    ecs_api_edp_put_producer_2 201 prod-c $CB_JOB/prod-c $CB_SV/prod-c NOTYPE
+fi
 
-ecs_api_edp_get_producer_ids 200 prod-a prod-b prod-c
+if [ $ECS_VERSION == "V1-1" ]; then
+    ecs_api_edp_get_producer_ids 200 prod-a prod-b prod-c
+else
+    ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-a prod-b prod-c
+fi
 
-ecs_api_edp_get_producer 200 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json
-ecs_api_edp_get_producer 200 prod-b $CB_JOB/prod-b $CB_SV/prod-b type2 testdata/ecs/ei-type-2.json
-ecs_api_edp_get_producer 200 prod-c $CB_JOB/prod-c $CB_SV/prod-c EMPTY
+if [ $ECS_VERSION == "V1-1" ]; then
+    ecs_api_edp_get_producer 200 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json
+    ecs_api_edp_get_producer 200 prod-b $CB_JOB/prod-b $CB_SV/prod-b type2 testdata/ecs/ei-type-2.json
+    ecs_api_edp_get_producer 200 prod-c $CB_JOB/prod-c $CB_SV/prod-c EMPTY
+else
+    ecs_api_edp_get_producer_2 200 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1
+    ecs_api_edp_get_producer_2 200 prod-b $CB_JOB/prod-b $CB_SV/prod-b type2
+    ecs_api_edp_get_producer_2 200 prod-c $CB_JOB/prod-c $CB_SV/prod-c EMPTY
+fi
 
 ecs_api_edp_get_producer_status 200 prod-c ENABLED
 
@@ -348,7 +443,11 @@ ecs_api_edp_get_producer_status 200 prod-c ENABLED
 
 # Delete job then producer
 ecs_api_a1_get_job_ids 200 NOTYPE NOWNER job1 job2 job3
-ecs_api_edp_get_producer_ids 200 prod-a prod-b prod-c
+if [ $ECS_VERSION == "V1-1" ]; then
+    ecs_api_edp_get_producer_ids 200 prod-a prod-b prod-c
+else
+    ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-a prod-b prod-c
+fi
 
 if [  -z "$FLAT_A1_EI" ]; then
     ecs_api_a1_delete_job 204 type2 job3
@@ -357,25 +456,42 @@ else
 fi
 
 ecs_api_a1_get_job_ids 200 NOTYPE NOWNER job1 job2
-ecs_api_edp_get_producer_ids 200 prod-a prod-b prod-c
+if [ $ECS_VERSION == "V1-1" ]; then
+    ecs_api_edp_get_producer_ids 200 prod-a prod-b prod-c
+else
+    ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-a prod-b prod-c
+fi
 
 ecs_api_edp_delete_producer 204 prod-b
 
 ecs_api_edp_get_producer_status 404 prod-b
 
 ecs_api_a1_get_job_ids 200 NOTYPE NOWNER job1 job2
-ecs_api_edp_get_producer_ids 200 prod-a prod-c
+if [ $ECS_VERSION == "V1-1" ]; then
+    ecs_api_edp_get_producer_ids 200 prod-a prod-c
+else
+    ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-a prod-c
+fi
 
 prodstub_equal delete/prod-b/job3 1
 
 if [  -z "$FLAT_A1_EI" ]; then
     ecs_api_a1_put_job 404 type2 job3 $TARGET3 ricsim_g3_3 testdata/ecs/job-template.json
 else
-    ecs_api_a1_put_job 404 job3 type2 $TARGET3 ricsim_g3_3 $STATUS3 testdata/ecs/job-template.json
+    if [ $ECS_VERSION == "V1-1" ]; then
+        ecs_api_a1_put_job 404 job3 type2 $TARGET3 ricsim_g3_3 $STATUS3 testdata/ecs/job-template.json
+    else
+        ecs_api_a1_put_job 201 job3 type2 $TARGET3 ricsim_g3_3 $STATUS3 testdata/ecs/job-template.json
+        ecs_api_a1_get_job_status 200 job3 DISABLED
+    fi
 fi
 
 # Put producer then job
-ecs_api_edp_put_producer 201 prod-b $CB_JOB/prod-b $CB_SV/prod-b type2 testdata/ecs/ei-type-2.json
+if [ $ECS_VERSION == "V1-1" ]; then
+    ecs_api_edp_put_producer 201 prod-b $CB_JOB/prod-b $CB_SV/prod-b type2 testdata/ecs/ei-type-2.json
+else
+    ecs_api_edp_put_producer_2 201 prod-b $CB_JOB/prod-b $CB_SV/prod-b type2
+fi
 
 ecs_api_edp_get_producer_status 200 prod-b ENABLED
 
@@ -383,16 +499,28 @@ if [  -z "$FLAT_A1_EI" ]; then
     ecs_api_a1_put_job 201 type2 job3 $TARGET3 ricsim_g3_3 testdata/ecs/job-template2.json
     ecs_api_a1_get_job_status 200 type2 job3 ENABLED
 else
-    ecs_api_a1_put_job 201 job3 type2 $TARGET3 ricsim_g3_3 $STATUS3 testdata/ecs/job-template2.json
+    if [ $ECS_VERSION == "V1-1" ]; then
+        ecs_api_a1_put_job 201 job3 type2 $TARGET3 ricsim_g3_3 $STATUS3 testdata/ecs/job-template2.json
+    else
+        ecs_api_a1_put_job 200 job3 type2 $TARGET3 ricsim_g3_3 $STATUS3 testdata/ecs/job-template2.json
+    fi
     ecs_api_a1_get_job_status 200 job3 ENABLED
 fi
 
 prodstub_check_jobdata 200 prod-b job3 type2 $TARGET3 ricsim_g3_3 testdata/ecs/job-template2.json
 
 ecs_api_a1_get_job_ids 200 NOTYPE NOWNER job1 job2 job3
-ecs_api_edp_get_producer_ids 200 prod-a prod-b prod-c
+if [ $ECS_VERSION == "V1-1" ]; then
+    ecs_api_edp_get_producer_ids 200 prod-a prod-b prod-c
+else
+    ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-a prod-b prod-c
+fi
 
-prodstub_equal create/prod-b/job3 2
+if [ $ECS_VERSION == "V1-1" ]; then
+    prodstub_equal create/prod-b/job3 2
+else
+    prodstub_equal create/prod-b/job3 3
+fi
 prodstub_equal delete/prod-b/job3 1
 
 # Delete only the producer
@@ -401,7 +529,11 @@ ecs_api_edp_delete_producer 204 prod-b
 ecs_api_edp_get_producer_status 404 prod-b
 
 ecs_api_a1_get_job_ids 200 NOTYPE NOWNER job1 job2 job3
-ecs_api_edp_get_producer_ids 200 prod-a prod-c
+if [ $ECS_VERSION == "V1-1" ]; then
+    ecs_api_edp_get_producer_ids 200 prod-a prod-c
+else
+    ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-a prod-c
+fi
 
 if [  -z "$FLAT_A1_EI" ]; then
     ecs_api_a1_get_job_status 200 type2 job3 DISABLED
@@ -414,7 +546,11 @@ cr_equal received_callbacks?id=job3-status 1
 cr_api_check_all_ecs_events 200 job3-status DISABLED
 
 # Re-create the producer
-ecs_api_edp_put_producer 201 prod-b $CB_JOB/prod-b $CB_SV/prod-b type2 testdata/ecs/ei-type-2.json
+if [ $ECS_VERSION == "V1-1" ]; then
+    ecs_api_edp_put_producer 201 prod-b $CB_JOB/prod-b $CB_SV/prod-b type2 testdata/ecs/ei-type-2.json
+else
+    ecs_api_edp_put_producer_2 201 prod-b $CB_JOB/prod-b $CB_SV/prod-b type2
+fi
 
 ecs_api_edp_get_producer_status 200 prod-b ENABLED
 
@@ -432,7 +568,12 @@ prodstub_check_jobdata 200 prod-b job3 type2 $TARGET3 ricsim_g3_3 testdata/ecs/j
 
 
 ## Setup prod-d
-ecs_api_edp_put_producer 201 prod-d $CB_JOB/prod-d $CB_SV/prod-d type4 testdata/ecs/ei-type-1.json
+if [ $ECS_VERSION == "V1-1" ]; then
+    ecs_api_edp_put_producer 201 prod-d $CB_JOB/prod-d $CB_SV/prod-d type4 testdata/ecs/ei-type-4.json
+else
+    ecs_api_edp_put_type_2 201 type4 testdata/ecs/ei-type-1.json
+    ecs_api_edp_put_producer_2 201 prod-d $CB_JOB/prod-d $CB_SV/prod-d type4
+fi
 
 ecs_api_a1_get_job_ids 200 type4 NOWNER EMPTY
 
@@ -456,7 +597,11 @@ else
 fi
 
 # Re-PUT the producer with zero types
-ecs_api_edp_put_producer 200 prod-d $CB_JOB/prod-d $CB_SV/prod-d NOTYPE
+if [ $ECS_VERSION == "V1-1" ]; then
+    ecs_api_edp_put_producer 200 prod-d $CB_JOB/prod-d $CB_SV/prod-d NOTYPE
+else
+    ecs_api_edp_put_producer_2 200 prod-d $CB_JOB/prod-d $CB_SV/prod-d NOTYPE
+fi
 
 if [  -z "$FLAT_A1_EI" ]; then
     ecs_api_a1_get_job_ids 404 type4 NOWNER
@@ -479,7 +624,12 @@ prodstub_equal create/prod-d/job8 1
 prodstub_equal delete/prod-d/job8 0
 
 ## Re-setup prod-d
-ecs_api_edp_put_producer 200 prod-d $CB_JOB/prod-d $CB_SV/prod-d type4 testdata/ecs/ei-type-1.json
+if [ $ECS_VERSION == "V1-1" ]; then
+    ecs_api_edp_put_producer 200 prod-d $CB_JOB/prod-d $CB_SV/prod-d type4 testdata/ecs/ei-type-4.json
+else
+    ecs_api_edp_put_type_2 200 type4 testdata/ecs/ei-type-4.json
+    ecs_api_edp_put_producer_2 200 prod-d $CB_JOB/prod-d $CB_SV/prod-d type4
+fi
 
 if [  -z "$FLAT_A1_EI" ]; then
     ecs_api_a1_get_job_ids 404 type4 NOWNER
@@ -508,7 +658,12 @@ prodstub_equal delete/prod-d/job8 0
 
 
 ## Setup prod-e
-ecs_api_edp_put_producer 201 prod-e $CB_JOB/prod-e $CB_SV/prod-e type6 testdata/ecs/ei-type-6.json
+if [ $ECS_VERSION == "V1-1" ]; then
+    ecs_api_edp_put_producer 201 prod-e $CB_JOB/prod-e $CB_SV/prod-e type6 testdata/ecs/ei-type-6.json
+else
+    ecs_api_edp_put_type_2 201 type6 testdata/ecs/ei-type-6.json
+    ecs_api_edp_put_producer_2 201 prod-e $CB_JOB/prod-e $CB_SV/prod-e type6
+fi
 
 ecs_api_a1_get_job_ids 200 type6 NOWNER EMPTY
 
@@ -532,7 +687,12 @@ else
 fi
 
 ## Setup prod-f
-ecs_api_edp_put_producer 201 prod-f $CB_JOB/prod-f $CB_SV/prod-f type6 testdata/ecs/ei-type-6.json
+if [ $ECS_VERSION == "V1-1" ]; then
+    ecs_api_edp_put_producer 201 prod-f $CB_JOB/prod-f $CB_SV/prod-f type6 testdata/ecs/ei-type-6.json
+else
+    ecs_api_edp_put_type_2 200 type6 testdata/ecs/ei-type-6.json
+    ecs_api_edp_put_producer_2 201 prod-f $CB_JOB/prod-f $CB_SV/prod-f type6
+fi
 
 ecs_api_a1_get_job_ids 200 type6 NOWNER job10
 
@@ -551,7 +711,11 @@ fi
 
 ## Status updates prod-a and jobs
 
-ecs_api_edp_get_producer_ids 200 prod-a prod-b prod-c prod-d prod-e prod-f
+if [ $ECS_VERSION == "V1-1" ]; then
+    ecs_api_edp_get_producer_ids 200 prod-a prod-b prod-c prod-d prod-e prod-f
+else
+    ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-a prod-b prod-c prod-d prod-e prod-f
+fi
 
 ecs_api_edp_get_producer_status 200 prod-a ENABLED
 ecs_api_edp_get_producer_status 200 prod-b ENABLED
@@ -566,7 +730,11 @@ prodstub_arm_producer 200 prod-a 400
 # Wait for producer prod-a to go disabled
 ecs_api_edp_get_producer_status 200 prod-a DISABLED 360
 
-ecs_api_edp_get_producer_ids 200 prod-a prod-b prod-c prod-d  prod-e prod-f
+if [ $ECS_VERSION == "V1-1" ]; then
+    ecs_api_edp_get_producer_ids 200 prod-a prod-b prod-c prod-d  prod-e prod-f
+else
+    ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-a prod-b prod-c prod-d  prod-e prod-f
+fi
 
 ecs_api_edp_get_producer_status 200 prod-a DISABLED
 ecs_api_edp_get_producer_status 200 prod-b ENABLED
@@ -596,7 +764,11 @@ prodstub_arm_producer 200 prod-a 200
 # Wait for producer prod-a to go enabled
 ecs_api_edp_get_producer_status 200 prod-a ENABLED 360
 
-ecs_api_edp_get_producer_ids 200 prod-a prod-b prod-c prod-d prod-e prod-f
+if [ $ECS_VERSION == "V1-1" ]; then
+    ecs_api_edp_get_producer_ids 200 prod-a prod-b prod-c prod-d prod-e prod-f
+else
+    ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-a prod-b prod-c prod-d prod-e prod-f
+fi
 
 ecs_api_edp_get_producer_status 200 prod-a ENABLED
 ecs_api_edp_get_producer_status 200 prod-b ENABLED
@@ -625,7 +797,11 @@ prodstub_arm_producer 200 prod-a 400
 # Wait for producer prod-a to go disabled
 ecs_api_edp_get_producer_status 200 prod-a DISABLED 360
 
-ecs_api_edp_get_producer_ids 200 prod-a prod-b prod-c prod-d prod-e prod-f
+if [ $ECS_VERSION == "V1-1" ]; then
+    ecs_api_edp_get_producer_ids 200 prod-a prod-b prod-c prod-d prod-e prod-f
+else
+    ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-a prod-b prod-c prod-d prod-e prod-f
+fi
 
 ecs_api_edp_get_producer_status 200 prod-a DISABLED
 ecs_api_edp_get_producer_status 200 prod-b ENABLED
@@ -651,7 +827,12 @@ fi
 # Wait for producer prod-a to be removed
 ecs_equal json:ei-producer/v1/eiproducers 5 1000
 
-ecs_api_edp_get_producer_ids 200 prod-b prod-c prod-d prod-e prod-f
+if [ $ECS_VERSION == "V1-1" ]; then
+    ecs_api_edp_get_producer_ids 200 prod-b prod-c prod-d prod-e prod-f
+else
+    ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-b prod-c prod-d prod-e prod-f
+fi
+
 
 ecs_api_edp_get_producer_status 404 prod-a
 ecs_api_edp_get_producer_status 200 prod-b ENABLED
@@ -687,7 +868,11 @@ prodstub_arm_producer 200 prod-e 400
 
 ecs_api_edp_get_producer_status 200 prod-e DISABLED 1000
 
-ecs_api_edp_get_producer_ids 200 prod-b prod-c prod-d prod-e prod-f
+if [ $ECS_VERSION == "V1-1" ]; then
+    ecs_api_edp_get_producer_ids 200 prod-b prod-c prod-d prod-e prod-f
+else
+    ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-b prod-c prod-d prod-e prod-f
+fi
 
 ecs_api_edp_get_producer_status 404 prod-a
 ecs_api_edp_get_producer_status 200 prod-b ENABLED
@@ -725,11 +910,15 @@ prodstub_arm_job_create 200 prod-e job10 200
 
 ecs_api_edp_get_producer_status 200 prod-e ENABLED 360
 
-ecs_api_edp_get_producer_ids 200 prod-b prod-c prod-d prod-e prod-f
+if [ $ECS_VERSION == "V1-1" ]; then
+    ecs_api_edp_get_producer_ids 200 prod-b prod-c prod-d prod-e prod-f
+else
+    ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-b prod-c prod-d prod-e prod-f
+fi
+
+#Wait for job to be updated
+sleep_wait 120
 
-#Job 10 should be updated when the producer goes enabled
-deviation "Job 10 should be updated when the producer prod-e goes enabled"
-prodstub_check_jobdata 200 prod-e job10 type6 $TARGET10 ricsim_g3_4 testdata/ecs/job-template2.json
 prodstub_check_jobdata 200 prod-f job10 type6 $TARGET10 ricsim_g3_4 testdata/ecs/job-template2.json
 
 prodstub_arm_producer 200 prod-f 400
@@ -738,7 +927,11 @@ ecs_api_edp_get_producer_status 200 prod-f DISABLED 360
 
 ecs_equal json:ei-producer/v1/eiproducers 4 1000
 
-ecs_api_edp_get_producer_ids 200 prod-b prod-c prod-d prod-e
+if [ $ECS_VERSION == "V1-1" ]; then
+    ecs_api_edp_get_producer_ids 200 prod-b prod-c prod-d prod-e
+else
+    ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-b prod-c prod-d prod-e
+fi
 
 ecs_api_edp_get_producer_status 404 prod-a
 ecs_api_edp_get_producer_status 200 prod-b ENABLED
@@ -771,4 +964,4 @@ store_logs END
 
 print_result
 
-auto_clean_containers
+auto_clean_environment
index daeb3c7..905d4f8 100755 (executable)
 
 TC_ONELINE_DESCR="Sample tests of the SDNC A1 controller restconf API using http/https (no agent)"
 
-#App names to include in the test, space separated list
-INCLUDED_IMAGES="RICSIM SDNC"
-
-#SUPPORTED TEST ENV FILE
-SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN ORAN-CHERRY"
+#App names to include in the test when running docker, space separated list
+DOCKER_INCLUDED_IMAGES="RICSIM SDNC"
+#App names to include in the test when running kubernetes, space separated list
+KUBE_INCLUDED_IMAGES=" RICSIM SDNC "
+#Prestarted app (not started by script) to include in the test when running kubernetes, space separated list
+KUBE_PRESTARTED_IMAGES=" "
+
+#Supported test environment profiles
+SUPPORTED_PROFILES="ONAP-GUILIN ONAP-HONOLULU  ORAN-CHERRY ORAN-DAWN"
+#Supported run modes
+SUPPORTED_RUNMODES="DOCKER KUBE"
 
 . ../common/testcase_common.sh  $@
 . ../common/controller_api_functions.sh
@@ -32,11 +38,6 @@ SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN ORAN-CHERRY"
 
 #### TEST BEGIN ####
 
-FLAVOUR="ORAN"
-if [[ $SDNC_A1_CONTROLLER_IMAGE == *"onap"* ]]; then
-    FLAVOUR="ONAP"
-fi
-
 generate_uuid
 
 #Test agent and simulator protocol versions (others are http only)
@@ -54,7 +55,7 @@ for __nb_httpx in $NB_TESTED_PROTOCOLS ; do
 
 
         # Clean container and start all needed containers #
-        clean_containers
+        clean_environment
 
         start_ric_simulators ricsim_g1 1  OSC_2.1.0
         start_ric_simulators ricsim_g2 1  STD_1.1.3
@@ -141,4 +142,4 @@ done
 
 print_result
 
-auto_clean_containers
\ No newline at end of file
+auto_clean_environment
\ No newline at end of file
index caec939..90ea3b5 100755 (executable)
 
 TC_ONELINE_DESCR="ECS Create 10000 jobs and restart, test job persisency"
 
-#App names to include in the test, space separated list
-INCLUDED_IMAGES="ECS PRODSTUB CR CP"
+#App names to include in the test when running docker, space separated list
+DOCKER_INCLUDED_IMAGES="ECS PRODSTUB CR CP"
 
-#SUPPORTED TEST ENV FILE
-SUPPORTED_PROFILES="ONAP-MASTER ORAN-CHERRY"
+#App names to include in the test when running kubernetes, space separated list
+KUBE_INCLUDED_IMAGES="ECS PRODSTUB CP CR"
+#Prestarted app (not started by script) to include in the test when running kubernetes, space separated list
+KUBE_PRESTARTED_IMAGES=""
+
+#Supported test environment profiles
+SUPPORTED_PROFILES="ONAP-HONOLULU  ORAN-CHERRY ORAN-DAWN"
+#Supported run modes
+SUPPORTED_RUNMODES="DOCKER KUBE"
 
 . ../common/testcase_common.sh  $@
 . ../common/ecs_api_functions.sh
 . ../common/prodstub_api_functions.sh
+. ../common/control_panel_api_functions.sh
+. ../common/controller_api_functions.sh
+. ../common/cr_api_functions.sh
 
 #### TEST BEGIN ####
 
 FLAT_A1_EI="1"
 
-clean_containers
+clean_environment
 
 use_ecs_rest_http
 
 use_prod_stub_http
 
-start_ecs
+start_ecs $SIM_GROUP/$ECS_COMPOSE_DIR/application.yaml
 
 start_prod_stub
 
 set_ecs_trace
 
-start_control_panel
+start_control_panel $SIM_GROUP/$CONTROL_PANEL_COMPOSE_DIR/application.properties
 
 start_cr
 
-CB_JOB="http://$PROD_STUB_APP_NAME:$PROD_STUB_PORT/callbacks/job"
-CB_SV="http://$PROD_STUB_APP_NAME:$PROD_STUB_PORT/callbacks/supervision"
+CB_JOB="$PROD_STUB_SERVICE_PATH$PROD_STUB_JOB_CALLBACK"
+CB_SV="$PROD_STUB_SERVICE_PATH$PROD_STUB_SUPERVISION_CALLBACK"
 TARGET="http://localhost:80/target"  # Dummy target
 
 NUM_JOBS=10000
@@ -96,13 +106,32 @@ do
     fi
 done
 
-ecs_api_edp_put_producer 201 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json
+if [ $ECS_VERSION == "V1-1" ]; then
+
+    ecs_api_edp_put_producer 201 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json
+
+    ecs_api_edp_put_producer 201 prod-b $CB_JOB/prod-b $CB_SV/prod-b type1 testdata/ecs/ei-type-1.json type2 testdata/ecs/ei-type-2.json
 
-ecs_api_edp_put_producer 201 prod-b $CB_JOB/prod-b $CB_SV/prod-b type1 testdata/ecs/ei-type-1.json type2 testdata/ecs/ei-type-2.json
+    ecs_api_edp_put_producer 201 prod-c $CB_JOB/prod-c $CB_SV/prod-c type1 testdata/ecs/ei-type-1.json type2 testdata/ecs/ei-type-2.json type3 testdata/ecs/ei-type-3.json
 
-ecs_api_edp_put_producer 201 prod-c $CB_JOB/prod-c $CB_SV/prod-c type1 testdata/ecs/ei-type-1.json type2 testdata/ecs/ei-type-2.json type3 testdata/ecs/ei-type-3.json
+    ecs_api_edp_put_producer 201 prod-d $CB_JOB/prod-d $CB_SV/prod-d type4 testdata/ecs/ei-type-4.json type5 testdata/ecs/ei-type-5.json
+
+else
 
-ecs_api_edp_put_producer 201 prod-d $CB_JOB/prod-d $CB_SV/prod-d type4 testdata/ecs/ei-type-4.json type5 testdata/ecs/ei-type-5.json
+    ecs_api_edp_put_type_2 201 type1 testdata/ecs/ei-type-1.json
+    ecs_api_edp_put_type_2 201 type2 testdata/ecs/ei-type-2.json
+    ecs_api_edp_put_type_2 201 type3 testdata/ecs/ei-type-3.json
+    ecs_api_edp_put_type_2 201 type4 testdata/ecs/ei-type-4.json
+    ecs_api_edp_put_type_2 201 type5 testdata/ecs/ei-type-5.json
+
+    ecs_api_edp_put_producer_2 201 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1
+
+    ecs_api_edp_put_producer_2 201 prod-b $CB_JOB/prod-b $CB_SV/prod-b type1 type2
+
+    ecs_api_edp_put_producer_2 201 prod-c $CB_JOB/prod-c $CB_SV/prod-c type1 type2 type3
+
+    ecs_api_edp_put_producer_2 201 prod-d $CB_JOB/prod-d $CB_SV/prod-d type4 type5
+fi
 
 ecs_equal json:ei-producer/v1/eiproducers 4
 
@@ -114,43 +143,43 @@ ecs_api_edp_get_producer_status 200 prod-d ENABLED
 for ((i=1; i<=$NUM_JOBS; i++))
 do
     if [ $(($i%5)) -eq 0 ]; then
-        ecs_api_a1_put_job 201 job$i type1 $TARGET ric1 $CR_PATH/job_status_ric1 testdata/ecs/job-template.json
+        ecs_api_a1_put_job 201 job$i type1 $TARGET ric1 $CR_SERVICE_PATH/job_status_ric1 testdata/ecs/job-template.json
         if [  -z "$FLAT_A1_EI" ]; then
             ecs_api_a1_get_job_status 200 type1 job$i ENABLED
         else
-            ecs_api_a1_get_job_status 200 job$i ENABLED
+            ecs_api_a1_get_job_status 200 job$i ENABLED 120
         fi
     fi
     if [ $(($i%5)) -eq 1 ]; then
-        ecs_api_a1_put_job 201 job$i type2 $TARGET ric1 $CR_PATH/job_status_ric1 testdata/ecs/job-template.json
+        ecs_api_a1_put_job 201 job$i type2 $TARGET ric1 $CR_SERVICE_PATH/job_status_ric1 testdata/ecs/job-template.json
         if [  -z "$FLAT_A1_EI" ]; then
             ecs_api_a1_get_job_status 200 type2 job$i ENABLED
         else
-            ecs_api_a1_get_job_status 200 job$i ENABLED
+            ecs_api_a1_get_job_status 200 job$i ENABLED 120
         fi
     fi
     if [ $(($i%5)) -eq 2 ]; then
-        ecs_api_a1_put_job 201 job$i type3 $TARGET ric1 $CR_PATH/job_status_ric1 testdata/ecs/job-template.json
+        ecs_api_a1_put_job 201 job$i type3 $TARGET ric1 $CR_SERVICE_PATH/job_status_ric1 testdata/ecs/job-template.json
         if [  -z "$FLAT_A1_EI" ]; then
             ecs_api_a1_get_job_status 200 type3 job$i ENABLED
         else
-            ecs_api_a1_get_job_status 200 job$i ENABLED
+            ecs_api_a1_get_job_status 200 job$i ENABLED 120
         fi
     fi
     if [ $(($i%5)) -eq 3 ]; then
-        ecs_api_a1_put_job 201 job$i type4 $TARGET ric1 $CR_PATH/job_status_ric1 testdata/ecs/job-template.json
+        ecs_api_a1_put_job 201 job$i type4 $TARGET ric1 $CR_SERVICE_PATH/job_status_ric1 testdata/ecs/job-template.json
         if [  -z "$FLAT_A1_EI" ]; then
             ecs_api_a1_get_job_status 200 type4 job$i ENABLED
         else
-            ecs_api_a1_get_job_status 200 job$i ENABLED
+            ecs_api_a1_get_job_status 200 job$i ENABLED 120
         fi
     fi
     if [ $(($i%5)) -eq 4 ]; then
-        ecs_api_a1_put_job 201 job$i type5 $TARGET ric1 $CR_PATH/job_status_ric1 testdata/ecs/job-template.json
+        ecs_api_a1_put_job 201 job$i type5 $TARGET ric1 $CR_SERVICE_PATH/job_status_ric1 testdata/ecs/job-template.json
         if [  -z "$FLAT_A1_EI" ]; then
             ecs_api_a1_get_job_status 200 type5 job$i ENABLED
         else
-            ecs_api_a1_get_job_status 200 job$i ENABLED
+            ecs_api_a1_get_job_status 200 job$i ENABLED 120
         fi
     fi
 done
@@ -206,47 +235,59 @@ do
         if [  -z "$FLAT_A1_EI" ]; then
             ecs_api_a1_get_job_status 200 type1 job$i DISABLED
         else
-            ecs_api_a1_get_job_status 200 job$i DISABLED
+            ecs_api_a1_get_job_status 200 job$i DISABLED 120
         fi
     fi
     if [ $(($i%5)) -eq 1 ]; then
         if [  -z "$FLAT_A1_EI" ]; then
             ecs_api_a1_get_job_status 200 type2 job$i DISABLED
         else
-            ecs_api_a1_get_job_status 200 job$i DISABLED
+            ecs_api_a1_get_job_status 200 job$i DISABLED 120
         fi
     fi
     if [ $(($i%5)) -eq 2 ]; then
         if [  -z "$FLAT_A1_EI" ]; then
             ecs_api_a1_get_job_status 200 type3 job$i DISABLED
         else
-            ecs_api_a1_get_job_status 200 job$i DISABLED
+            ecs_api_a1_get_job_status 200 job$i DISABLED 120
         fi
     fi
     if [ $(($i%5)) -eq 3 ]; then
         if [  -z "$FLAT_A1_EI" ]; then
             ecs_api_a1_get_job_status 200 type4 job$i DISABLED
         else
-            ecs_api_a1_get_job_status 200 job$i DISABLED
+            ecs_api_a1_get_job_status 200 job$i DISABLED 120
         fi
     fi
     if [ $(($i%5)) -eq 4 ]; then
         if [  -z "$FLAT_A1_EI" ]; then
             ecs_api_a1_get_job_status 200 type5 job$i DISABLED
         else
-            ecs_api_a1_get_job_status 200 job$i DISABLED
+            ecs_api_a1_get_job_status 200 job$i DISABLED 120
         fi
     fi
 done
 
+if [ $ECS_VERSION == "V1-1" ]; then
+
+    ecs_api_edp_put_producer 201 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json
+
+    ecs_api_edp_put_producer 201 prod-b $CB_JOB/prod-b $CB_SV/prod-b type1 testdata/ecs/ei-type-1.json type2 testdata/ecs/ei-type-2.json
+
+    ecs_api_edp_put_producer 201 prod-c $CB_JOB/prod-c $CB_SV/prod-c type1 testdata/ecs/ei-type-1.json type2 testdata/ecs/ei-type-2.json type3 testdata/ecs/ei-type-3.json
 
-ecs_api_edp_put_producer 201 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json
+    ecs_api_edp_put_producer 201 prod-d $CB_JOB/prod-d $CB_SV/prod-d type4 testdata/ecs/ei-type-4.json type5 testdata/ecs/ei-type-5.json
 
-ecs_api_edp_put_producer 201 prod-b $CB_JOB/prod-b $CB_SV/prod-b type1 testdata/ecs/ei-type-1.json type2 testdata/ecs/ei-type-2.json
+else
+    ecs_api_edp_put_producer_2 201 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1
+
+    ecs_api_edp_put_producer_2 201 prod-b $CB_JOB/prod-b $CB_SV/prod-b type1 type2
 
-ecs_api_edp_put_producer 201 prod-c $CB_JOB/prod-c $CB_SV/prod-c type1 testdata/ecs/ei-type-1.json type2 testdata/ecs/ei-type-2.json type3 testdata/ecs/ei-type-3.json
+    ecs_api_edp_put_producer_2 201 prod-c $CB_JOB/prod-c $CB_SV/prod-c type1 type2 type3
 
-ecs_api_edp_put_producer 201 prod-d $CB_JOB/prod-d $CB_SV/prod-d type4 testdata/ecs/ei-type-4.json type5 testdata/ecs/ei-type-5.json
+    ecs_api_edp_put_producer_2 201 prod-d $CB_JOB/prod-d $CB_SV/prod-d type4 type5
+
+fi
 
 ecs_equal json:ei-producer/v1/eiproducers 4
 
@@ -261,35 +302,35 @@ do
         if [  -z "$FLAT_A1_EI" ]; then
             ecs_api_a1_get_job_status 200 type1 job$i ENABLED
         else
-            ecs_api_a1_get_job_status 200 job$i ENABLED
+            ecs_api_a1_get_job_status 200 job$i ENABLED 120
         fi
     fi
     if [ $(($i%5)) -eq 1 ]; then
         if [  -z "$FLAT_A1_EI" ]; then
             ecs_api_a1_get_job_status 200 type2 job$i ENABLED
         else
-            ecs_api_a1_get_job_status 200 job$i ENABLED
+            ecs_api_a1_get_job_status 200 job$i ENABLED 120
         fi
     fi
     if [ $(($i%5)) -eq 2 ]; then
         if [  -z "$FLAT_A1_EI" ]; then
             ecs_api_a1_get_job_status 200 type3 job$i ENABLED
         else
-            ecs_api_a1_get_job_status 200 job$i ENABLED
+            ecs_api_a1_get_job_status 200 job$i ENABLED 120
         fi
     fi
     if [ $(($i%5)) -eq 3 ]; then
         if [  -z "$FLAT_A1_EI" ]; then
             ecs_api_a1_get_job_status 200 type4 job$i ENABLED
         else
-            ecs_api_a1_get_job_status 200 job$i ENABLED
+            ecs_api_a1_get_job_status 200 job$i ENABLED 120
         fi
     fi
     if [ $(($i%5)) -eq 4 ]; then
         if [  -z "$FLAT_A1_EI" ]; then
             ecs_api_a1_get_job_status 200 type5 job$i ENABLED
         else
-            ecs_api_a1_get_job_status 200 job$i ENABLED
+            ecs_api_a1_get_job_status 200 job$i ENABLED 120
         fi
     fi
 done
@@ -381,4 +422,4 @@ store_logs END
 
 print_result
 
-auto_clean_containers
+auto_clean_environment
index 3973282..723368e 100755 (executable)
 
 TC_ONELINE_DESCR="Resync 10000 policies using OSC and STD interface"
 
-#App names to include in the test, space separated list
-INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM SDNC"
+#App names to include in the test when running docker, space separated list
+DOCKER_INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM SDNC"
 
-#SUPPORTED TEST ENV FILE
-SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN ORAN-CHERRY"
+#App names to include in the test when running kubernetes, space separated list
+KUBE_INCLUDED_IMAGES="CP CR MR PA RICSIM SDNC"
+#Prestarted app (not started by script) to include in the test when running kubernetes, space separated list
+KUBE_PRESTARTED_IMAGES=""
+
+#Supported test environment profiles
+SUPPORTED_PROFILES="ONAP-GUILIN ONAP-HONOLULU  ORAN-CHERRY ORAN-DAWN"
+#Supported run modes
+SUPPORTED_RUNMODES="DOCKER KUBE"
 
 . ../common/testcase_common.sh  $@
 . ../common/agent_api_functions.sh
+. ../common/consul_cbs_functions.sh
+. ../common/control_panel_api_functions.sh
+. ../common/controller_api_functions.sh
+. ../common/cr_api_functions.sh
+. ../common/mr_api_functions.sh
 . ../common/ricsimulator_api_functions.sh
 
 #### TEST BEGIN ####
@@ -37,6 +49,7 @@ generate_uuid
 TESTED_VARIANTS="REST   DMAAP   REST+SDNC   DMAAP+SDNC DMAAP_BATCH DMAAP_BATCH+SDNC"
 #Test agent and simulator protocol versions (others are http only)
 TESTED_PROTOCOLS="HTTP HTTPS"
+
 for __httpx in $TESTED_PROTOCOLS ; do
     for interface in $TESTED_VARIANTS ; do
 
@@ -73,7 +86,7 @@ for __httpx in $TESTED_PROTOCOLS ; do
         fi
 
         # Clean container and start all needed containers #
-        clean_containers
+        clean_environment
 
         start_ric_simulators ricsim_g1 4 OSC_2.1.0
 
@@ -87,7 +100,15 @@ for __httpx in $TESTED_PROTOCOLS ; do
 
         start_cr
 
-        start_consul_cbs
+        if [ $RUNMODE == "DOCKER" ]; then
+            start_consul_cbs
+        fi
+
+        start_control_panel $SIM_GROUP/$CONTROL_PANEL_COMPOSE_DIR/application.properties
+
+        start_policy_agent NORPOXY $SIM_GROUP/$POLICY_AGENT_COMPOSE_DIR/application.yaml
+
+        set_agent_debug
 
         if [[ $interface = *"SDNC"* ]]; then
             start_sdnc
@@ -96,13 +117,11 @@ for __httpx in $TESTED_PROTOCOLS ; do
             prepare_consul_config      NOSDNC  ".consul_config.json"
         fi
 
-        consul_config_app                  ".consul_config.json"
-
-        start_control_panel
-
-        start_policy_agent
-
-        set_agent_debug
+        if [ $RUNMODE == "KUBE" ]; then
+            agent_load_config                       ".consul_config.json"
+        else
+            consul_config_app                      ".consul_config.json"
+        fi
 
         api_get_status 200
 
@@ -122,13 +141,13 @@ for __httpx in $TESTED_PROTOCOLS ; do
             api_equal json:policy_types 2 120  #Wait for the agent to refresh types from the simulator
         fi
 
-        api_put_service 201 "serv1" 3600 "$CR_PATH/1"
+        api_put_service 201 "serv1" 3600 "$CR_SERVICE_PATH/1"
 
         START_ID=2000
         NUM_POLICIES=10000  # Must be at least 100
 
         if [ "$PMS_VERSION" == "V2" ]; then
-            notificationurl=$CR_PATH"/test"
+            notificationurl=$CR_SERVICE_PATH"/test"
         else
             notificationurl=""
         fi
@@ -201,4 +220,4 @@ done
 
 print_result
 
-auto_clean_containers
\ No newline at end of file
+auto_clean_environment
\ No newline at end of file
index eec4542..dd79b33 100755 (executable)
 
 TC_ONELINE_DESCR="Resync of RIC via changes in the consul config or pushed config"
 
-#App names to include in the test, space separated list
-INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM"
+#App names to include in the test when running docker, space separated list
+DOCKER_INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM"
 
-#SUPPORTED TEST ENV FILE
-SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN ORAN-CHERRY"
+#Supported test environment profiles
+SUPPORTED_PROFILES="ONAP-GUILIN ONAP-HONOLULU  ORAN-CHERRY ORAN-DAWN"
+#Supported run modes
+SUPPORTED_RUNMODES="DOCKER"
 
 . ../common/testcase_common.sh  $@
 . ../common/agent_api_functions.sh
 . ../common/ricsimulator_api_functions.sh
 . ../common/cr_api_functions.sh
+. ../common/mr_api_functions.sh
+. ../common/control_panel_api_functions.sh
+. ../common/controller_api_functions.sh
 
 #### TEST BEGIN ####
 
@@ -43,7 +48,7 @@ for consul_conf in $TESTED_VARIANTS ; do
     generate_uuid
 
     # Clean container and start all needed containers #
-    clean_containers
+    clean_environment
 
     start_policy_agent
 
@@ -51,7 +56,7 @@ for consul_conf in $TESTED_VARIANTS ; do
 
     # Create service to be able to receive events when rics becomes available
     # Must use rest towards the agent since dmaap is not configured yet
-    api_put_service 201 "ric-registration" 0 "$CR_PATH/ric-registration"
+    api_put_service 201 "ric-registration" 0 "$CR_SERVICE_PATH/ric-registration"
 
     # Start one RIC of each type
     start_ric_simulators ricsim_g1 1  OSC_2.1.0
@@ -80,13 +85,13 @@ for consul_conf in $TESTED_VARIANTS ; do
     fi
 
     if [ "$PMS_VERSION" == "V2" ]; then
-        api_equal json:rics 3 120
+        api_equal json:rics 3 300
 
         cr_equal received_callbacks 3 120
 
         cr_api_check_all_sync_events 200 ric-registration ricsim_g1_1 ricsim_g2_1 ricsim_g3_1
     else
-        api_equal json:rics 2 120
+        api_equal json:rics 2 300
     fi
 
     # Add an STD RIC and check
@@ -148,4 +153,4 @@ done
 
 print_result
 
-auto_clean_containers
+auto_clean_environment
index 0605944..d30b314 100755 (executable)
 
 TC_ONELINE_DESCR="Change supported policy types and reconfigure rics"
 
-#App names to include in the test, space separated list
-INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM SDNC"
+#App names to include in the test when running docker, space separated list
+DOCKER_INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM SDNC"
 
-#SUPPORTED TEST ENV FILE
-SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN ORAN-CHERRY"
+#App names to include in the test when running kubernetes, space separated list
+KUBE_INCLUDED_IMAGES="CP CR MR PA RICSIM SDNC"
+#Prestarted app (not started by script) to include in the test when running kubernetes, space separated list
+KUBE_PRESTARTED_IMAGES=""
+
+#Supported test environment profiles
+SUPPORTED_PROFILES="ONAP-GUILIN ONAP-HONOLULU  ORAN-CHERRY ORAN-DAWN"
+#Supported run modes
+SUPPORTED_RUNMODES="DOCKER KUBE"
 
 . ../common/testcase_common.sh  $@
 . ../common/agent_api_functions.sh
+. ../common/consul_cbs_functions.sh
 . ../common/ricsimulator_api_functions.sh
 . ../common/cr_api_functions.sh
+. ../common/mr_api_functions.sh
+. ../common/control_panel_api_functions.sh
+. ../common/controller_api_functions.sh
 
 #### TEST BEGIN ####
 
@@ -52,7 +63,7 @@ for interface in $TESTED_VARIANTS ; do
 
 
     # Clean container and start all needed containers #
-    clean_containers
+    clean_environment
 
     #Start simulators and prepare two configs
 
@@ -62,7 +73,9 @@ for interface in $TESTED_VARIANTS ; do
 
     start_mr
 
-    start_consul_cbs
+    if [ $RUNMODE == "DOCKER" ]; then
+        start_consul_cbs
+    fi
 
     # Create first config
     if [[ $interface = *"SDNC"* ]]; then
@@ -81,7 +94,7 @@ for interface in $TESTED_VARIANTS ; do
         prepare_consul_config      NOSDNC  ".consul_config_all.json"
     fi
 
-    start_policy_agent
+    start_policy_agent NORPOXY $SIM_GROUP/$POLICY_AGENT_COMPOSE_DIR/application.yaml
 
     set_agent_trace
 
@@ -89,10 +102,14 @@ for interface in $TESTED_VARIANTS ; do
 
     # Create service to be able to receive events when rics becomes available
     # Must use rest towards the agent since dmaap is not configured yet
-    api_put_service 201 "ric-registration" 0 "$CR_PATH/ric-registration"
+    api_put_service 201 "ric-registration" 0 "$CR_SERVICE_PATH/ric-registration"
 
     #Load first config
-    consul_config_app                  ".consul_config_initial.json"
+    if [ $RUNMODE == "KUBE" ]; then
+        agent_load_config                      ".consul_config_initial.json"
+    else
+        consul_config_app                      ".consul_config_initial.json"
+    fi
 
     for ((i=1; i<=${NUM_RICS}; i++))
     do
@@ -100,7 +117,7 @@ for interface in $TESTED_VARIANTS ; do
     done
 
     # All sims running but 2 are not configured in consul
-    api_equal json:rics 8 120
+    api_equal json:rics 8 300
 
     if [ "$PMS_VERSION" == "V2" ]; then
         cr_equal received_callbacks?id=ric-registration 8 120
@@ -187,7 +204,11 @@ for interface in $TESTED_VARIANTS ; do
     fi
 
     #Load config with all rics
-    consul_config_app                  ".consul_config_all.json"
+    if [ $RUNMODE == "KUBE" ]; then
+        agent_load_config                       ".consul_config_all.json"
+    else
+        consul_config_app                       ".consul_config_all.json"
+    fi
 
     api_equal json:rics 10 120
 
@@ -250,10 +271,10 @@ for interface in $TESTED_VARIANTS ; do
         api_equal json:policy_types 5
     fi
 
-    api_put_service 201 "serv1" 3600 "$CR_PATH/serv1"
+    api_put_service 201 "serv1" 3600 "$CR_SERVICE_PATH/serv1"
 
     if [ "$PMS_VERSION" == "V2" ]; then
-        notificationurl=$CR_PATH"/test"
+        notificationurl=$CR_SERVICE_PATH"/test"
     else
         notificationurl=""
     fi
@@ -261,7 +282,11 @@ for interface in $TESTED_VARIANTS ; do
     sleep_wait 120
 
     # Load config with reduced number of rics
-    consul_config_app                  ".consul_config_initial.json"
+    if [ $RUNMODE == "KUBE" ]; then
+        agent_load_config                      ".consul_config_initial.json"
+    else
+        consul_config_app                      ".consul_config_initial.json"
+    fi
 
     api_equal json:rics 8 120
 
@@ -312,7 +337,11 @@ for interface in $TESTED_VARIANTS ; do
     api_get_policy_types 404 ricsim_g1_9
 
     # Load config with all rics
-    consul_config_app                  ".consul_config_all.json"
+    if [ $RUNMODE == "KUBE" ]; then
+        agent_load_config                      ".consul_config_all.json"
+    else
+        consul_config_app                      ".consul_config_all.json"
+    fi
 
     api_equal json:rics 10 120
 
@@ -442,4 +471,4 @@ done
 
 print_result
 
-auto_clean_containers
\ No newline at end of file
+auto_clean_environment
\ No newline at end of file
index c90940c..0be6be8 100755 (executable)
 
 TC_ONELINE_DESCR="Create 10000 policies in sequence using http/https and Agent REST/DMAAP with/without SDNC controller"
 
-#App names to include in the test, space separated list
-INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM SDNC"
+#App names to include in the test when running docker, space separated list
+DOCKER_INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM SDNC"
 
-#SUPPORTED TEST ENV FILE
-SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN ORAN-CHERRY"
+#App names to include in the test when running kubernetes, space separated list
+KUBE_INCLUDED_IMAGES="CP CR MR PA RICSIM SDNC"
+#Prestarted app (not started by script) to include in the test when running kubernetes, space separated list
+KUBE_PRESTARTED_IMAGES=""
+
+#Supported test environment profiles
+SUPPORTED_PROFILES="ONAP-GUILIN ONAP-HONOLULU  ORAN-CHERRY ORAN-DAWN"
+#Supported run modes
+SUPPORTED_RUNMODES="DOCKER KUBE"
 
 . ../common/testcase_common.sh  $@
 . ../common/agent_api_functions.sh
 . ../common/ricsimulator_api_functions.sh
 . ../common/cr_api_functions.sh
+. ../common/mr_api_functions.sh
+. ../common/control_panel_api_functions.sh
+. ../common/controller_api_functions.sh
 
 #### TEST BEGIN ####
 
@@ -69,7 +79,7 @@ for __httpx in $TESTED_PROTOCOLS ; do
         # Policy instance start id
         START_ID=1
 
-        clean_containers
+        clean_environment
 
         start_ric_simulators ricsim_g1 1 OSC_2.1.0
         start_ric_simulators ricsim_g2 1 STD_1.1.3
@@ -81,6 +91,14 @@ for __httpx in $TESTED_PROTOCOLS ; do
 
         start_cr
 
+        start_control_panel $SIM_GROUP/$CONTROL_PANEL_COMPOSE_DIR/application.properties
+
+        start_policy_agent NORPOXY $SIM_GROUP/$POLICY_AGENT_COMPOSE_DIR/application.yaml
+
+        set_agent_debug
+
+        mr_equal requests_submitted 0
+
         if [[ $interface == "SDNC" ]]; then
             start_sdnc
             prepare_consul_config      SDNC    ".consul_config.json"
@@ -88,17 +106,15 @@ for __httpx in $TESTED_PROTOCOLS ; do
             prepare_consul_config      NOSDNC  ".consul_config.json"
         fi
 
-        start_consul_cbs
-
-        consul_config_app                      ".consul_config.json"
-
-        start_control_panel
-
-        start_policy_agent
-
-        set_agent_debug
+        if [ $RUNMODE == "DOCKER" ]; then
+            start_consul_cbs
+        fi
 
-        mr_equal requests_submitted 0
+        if [ $RUNMODE == "KUBE" ]; then
+            agent_load_config                       ".consul_config.json"
+        else
+            consul_config_app                      ".consul_config.json"
+        fi
 
 
         api_get_status 200
@@ -114,15 +130,15 @@ for __httpx in $TESTED_PROTOCOLS ; do
         if [ "$PMS_VERSION" == "V2" ]; then
             sim_put_policy_type 201 ricsim_g3_1 STD_QOS2_0.1.0 testdata/STD2/sim_qos2.json
 
-            api_equal json:policy-types 3 120  #Wait for the agent to refresh types from the simulators
+            api_equal json:policy-types 3 300  #Wait for the agent to refresh types from the simulators
         else
-            api_equal json:policy_types 2 120  #Wait for the agent to refresh types from the simulators
+            api_equal json:policy_types 2 300  #Wait for the agent to refresh types from the simulators
         fi
 
-        api_put_service 201 "serv1" 3600 "$CR_PATH/1"
+        api_put_service 201 "serv1" 3600 "$CR_SERVICE_PATH/1"
 
         if [ "$PMS_VERSION" == "V2" ]; then
-            notificationurl=$CR_PATH"/test"
+            notificationurl=$CR_SERVICE_PATH"/test"
         else
             notificationurl=""
         fi
@@ -215,16 +231,16 @@ for __httpx in $TESTED_PROTOCOLS ; do
         fi
 
         if [ $interface == "SDNC" ]; then
-            sim_contains_str ricsim_g1_1 remote_hosts "a1-controller"
-            sim_contains_str ricsim_g2_1 remote_hosts "a1-controller"
+            sim_contains_str ricsim_g1_1 remote_hosts $SDNC_APP_NAME
+            sim_contains_str ricsim_g2_1 remote_hosts $SDNC_APP_NAME
             if [ "$PMS_VERSION" == "V2" ]; then
-                sim_contains_str ricsim_g3_1 remote_hosts "a1-controller"
+                sim_contains_str ricsim_g3_1 remote_hosts $SDNC_APP_NAME
             fi
         else
-            sim_contains_str ricsim_g1_1 remote_hosts "policy-agent"
-            sim_contains_str ricsim_g2_1 remote_hosts "policy-agent"
+            sim_contains_str ricsim_g1_1 remote_hosts $POLICY_AGENT_APP_NAME
+            sim_contains_str ricsim_g2_1 remote_hosts $POLICY_AGENT_APP_NAME
             if [ "$PMS_VERSION" == "V2" ]; then
-                sim_contains_str ricsim_g3_1 remote_hosts "policy-agent"
+                sim_contains_str ricsim_g3_1 remote_hosts $POLICY_AGENT_APP_NAME
             fi
         fi
 
@@ -241,4 +257,4 @@ done
 
 print_result
 
-auto_clean_containers
\ No newline at end of file
+auto_clean_environment
\ No newline at end of file
index 7ac759c..a92106e 100755 (executable)
 
 TC_ONELINE_DESCR="Repeatedly create and delete policies in each RICs for 24h (or configured number of days). Via agent REST/DMAAP/DMAAP_BATCH and SDNC using http or https"
 
-#App names to include in the test, space separated list
-INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM SDNC"
+#App names to include in the test when running docker, space separated list
+DOCKER_INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM SDNC"
 
-#SUPPORTED TEST ENV FILE
-SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN ORAN-CHERRY"
+#App names to include in the test when running kubernetes, space separated list
+KUBE_INCLUDED_IMAGES="CP CR MR PA RICSIM SDNC"
+#Prestarted app (not started by script) to include in the test when running kubernetes, space separated list
+KUBE_PRESTARTED_IMAGES=""
+
+#Supported test environment profiles
+SUPPORTED_PROFILES="ONAP-GUILIN ONAP-HONOLULU  ORAN-CHERRY ORAN-DAWN"
+#Supported run modes
+SUPPORTED_RUNMODES="DOCKER KUBE"
 
 . ../common/testcase_common.sh  $@
 . ../common/agent_api_functions.sh
 . ../common/ricsimulator_api_functions.sh
 . ../common/cr_api_functions.sh
+. ../common/mr_api_functions.sh
+. ../common/control_panel_api_functions.sh
+. ../common/controller_api_functions.sh
 
 #### TEST BEGIN ####
 
@@ -48,7 +58,7 @@ NUM_INSTANCES=5
 
 DAYS=3
 
-clean_containers
+clean_environment
 
 # use HTTP or HTTPS for all apis
 HTTPX=HTTPS
@@ -77,16 +87,23 @@ start_mr
 
 start_cr
 
-start_consul_cbs
+start_control_panel $SIM_GROUP/$CONTROL_PANEL_COMPOSE_DIR/application.properties
 
-prepare_consul_config      SDNC  ".consul_config.json"
-consul_config_app                  ".consul_config.json"
+start_policy_agent NORPOXY $SIM_GROUP/$POLICY_AGENT_COMPOSE_DIR/application.yaml
 
-start_sdnc
+if [ $RUNMODE == "DOCKER" ]; then
+   start_consul_cbs
+fi
 
-start_control_panel
+prepare_consul_config      SDNC  ".consul_config.json"
 
-start_policy_agent
+if [ $RUNMODE == "KUBE" ]; then
+   agent_load_config                       ".consul_config.json"
+else
+   consul_config_app                      ".consul_config.json"
+fi
+
+start_sdnc
 
 
 api_get_status 200
@@ -147,9 +164,9 @@ fi
 
 echo "Wait for the agent to refresh types from the simulator"
 if [ "$PMS_VERSION" == "V2" ]; then
-   api_equal json:policy-types 3 120
+   api_equal json:policy-types 3 300
 else
-   api_equal json:policy_types 2 120
+   api_equal json:policy_types 2 300
 fi
 
 echo "Check the number of types in the agent for each ric is 1"
@@ -164,7 +181,7 @@ do
 done
 
 echo "Register a service"
-api_put_service 201 "serv1" 0 "$CR_PATH/1"
+api_put_service 201 "serv1" 0 "$CR_SERVICE_PATH/1"
 
 TEST_DURATION=$((24*3600*$DAYS))
 TEST_START=$SECONDS
@@ -174,7 +191,7 @@ AGENT_INTERFACES="REST REST_PARALLEL DMAAP DMAAP-BATCH"
 MR_MESSAGES=0
 
 if [ "$PMS_VERSION" == "V2" ]; then
-      notificationurl=$CR_PATH"/test"
+      notificationurl=$CR_SERVICE_PATH"/test"
 else
       notificationurl=""
 fi
@@ -380,11 +397,11 @@ while [ $(($SECONDS-$TEST_START)) -lt $TEST_DURATION ]; do
 
       for ((i=1; i<=$NUM_RICS; i++))
       do
-         sim_contains_str ricsim_g1_$i remote_hosts "a1-controller"
-         sim_contains_str ricsim_g2_$i remote_hosts "a1-controller"
+         sim_contains_str ricsim_g1_$i remote_hosts $SDNC_APP_NAME
+         sim_contains_str ricsim_g2_$i remote_hosts $SDNC_APP_NAME
 
          if [ "$PMS_VERSION" == "V2" ]; then
-            sim_contains_str ricsim_g3_$i remote_hosts "a1-controller"
+            sim_contains_str ricsim_g3_$i remote_hosts $SDNC_APP_NAME
          fi
       done
 
@@ -401,4 +418,4 @@ store_logs          END
 
 print_result
 
-auto_clean_containers
\ No newline at end of file
+auto_clean_environment
\ No newline at end of file
index 3b65b10..82e50f1 100755 (executable)
 
 TC_ONELINE_DESCR="Create/delete policies in parallel over a number of rics using a number of child process"
 
-#App names to include in the test, space separated list
-INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM SDNC"
+#App names to include in the test when running docker, space separated list
+DOCKER_INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM SDNC"
 
-#SUPPORTED TEST ENV FILE
-SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN ORAN-CHERRY"
+#App names to include in the test when running kubernetes, space separated list
+KUBE_INCLUDED_IMAGES="CP CR MR PA RICSIM SDNC"
+#Prestarted app (not started by script) to include in the test when running kubernetes, space separated list
+KUBE_PRESTARTED_IMAGES=""
+
+#Supported test environment profiles
+SUPPORTED_PROFILES="ONAP-GUILIN ONAP-HONOLULU  ORAN-CHERRY ORAN-DAWN"
+#Supported run modes
+SUPPORTED_RUNMODES="DOCKER KUBE"
 
 . ../common/testcase_common.sh  $@
 . ../common/agent_api_functions.sh
 . ../common/ricsimulator_api_functions.sh
+. ../common/mr_api_functions.sh
+. ../common/control_panel_api_functions.sh
+. ../common/controller_api_functions.sh
 
 #### TEST BEGIN ####
 
@@ -46,7 +56,7 @@ NUM_POLICIES_PER_RIC=500
 generate_uuid
 
 if [ "$PMS_VERSION" == "V2" ]; then
-    notificationurl=$CR_PATH"/test"
+    notificationurl=$CR_SERVICE_PATH"/test"
 else
     notificationurl=""
 fi
@@ -79,11 +89,19 @@ for __httpx in $TESTED_PROTOCOLS ; do
         fi
 
         # Clean container and start all needed containers #
-        clean_containers
+        clean_environment
 
         start_ric_simulators ricsim_g1 $NUM_RICS OSC_2.1.0
 
-        start_consul_cbs
+        start_control_panel $SIM_GROUP/$CONTROL_PANEL_COMPOSE_DIR/application.properties
+
+        start_policy_agent NORPOXY $SIM_GROUP/$POLICY_AGENT_COMPOSE_DIR/application.yaml
+
+        set_agent_debug
+
+        if [ $RUNMODE == "DOCKER" ]; then
+            start_consul_cbs
+        fi
 
         if [[ $interface = *"SDNC"* ]]; then
             start_sdnc
@@ -92,18 +110,16 @@ for __httpx in $TESTED_PROTOCOLS ; do
             prepare_consul_config      NOSDNC  ".consul_config.json"
         fi
 
-        consul_config_app                  ".consul_config.json"
+        if [ $RUNMODE == "KUBE" ]; then
+            agent_load_config                       ".consul_config.json"
+        else
+            consul_config_app                      ".consul_config.json"
+        fi
 
         start_mr # Not used, but removes error messages from the agent log
 
         start_cr
 
-        start_control_panel
-
-        start_policy_agent
-
-        set_agent_debug
-
         api_get_status 200
 
         for ((i=1; i<=$NUM_RICS; i++))
@@ -118,12 +134,12 @@ for __httpx in $TESTED_PROTOCOLS ; do
         done
 
         if [ "$PMS_VERSION" == "V2" ]; then
-            api_equal json:policy-types 1 120  #Wait for the agent to refresh types from the simulator
+            api_equal json:policy-types 1 300  #Wait for the agent to refresh types from the simulator
         else
-            api_equal json:policy_types 1 120  #Wait for the agent to refresh types from the simulator
+            api_equal json:policy_types 1 300  #Wait for the agent to refresh types from the simulator
         fi
 
-        api_put_service 201 "serv1" 600 "$CR_PATH/1"
+        api_put_service 201 "serv1" 600 "$CR_SERVICE_PATH/1"
 
         echo "Check the number of types in the agent for each ric is 1"
         for ((i=1; i<=$NUM_RICS; i++))
@@ -167,9 +183,9 @@ for __httpx in $TESTED_PROTOCOLS ; do
         for ((i=1; i<=$NUM_RICS; i++))
         do
             if [ $interface == "REST+SDNC" ]; then
-                sim_contains_str ricsim_g1_$i remote_hosts "a1-controller"
+                sim_contains_str ricsim_g1_$i remote_hosts $SDNC_APP_NAME
             else
-                sim_contains_str ricsim_g1_$i remote_hosts "policy-agent"
+                sim_contains_str ricsim_g1_$i remote_hosts $POLICY_AGENT_APP_NAME
             fi
         done
 
@@ -189,4 +205,4 @@ done
 
 print_result
 
-auto_clean_containers
\ No newline at end of file
+auto_clean_environment
\ No newline at end of file
index 356301e..b3e4d29 100755 (executable)
 
 TC_ONELINE_DESCR="Preparation for test of the Control Panel and the Health Check app - populating a number of ric simulators with types and instances"
 
-#App names to include in the test, space separated list
-INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM"
+#App names to include in the test when running docker, space separated list
+DOCKER_INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM"
 
-#SUPPORTED TEST ENV FILE
-SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN ORAN-CHERRY"
+#App names to include in the test when running kubernetes, space separated list
+KUBE_INCLUDED_IMAGES="CP CR MR PA RICSIM"
+#Prestarted app (not started by script) to include in the test when running kubernetes, space separated list
+KUBE_PRESTARTED_IMAGES=""
+
+#Supported test environment profiles
+SUPPORTED_PROFILES="ONAP-GUILIN ONAP-HONOLULU  ORAN-CHERRY ORAN-DAWN"
+#Supported run modes
+SUPPORTED_RUNMODES="DOCKER KUBE"
 
 . ../common/testcase_common.sh $@
 . ../common/agent_api_functions.sh
 . ../common/ricsimulator_api_functions.sh
+. ../common/mr_api_functions.sh
+. ../common/control_panel_api_functions.sh
+. ../common/controller_api_functions.sh
 
 #### TEST BEGIN ####
 
-clean_containers
+clean_environment
 
 OSC_NUM_RICS=6
 STD_NUM_RICS=5
@@ -46,16 +56,23 @@ fi
 
 start_mr #Just to prevent errors in the agent log...
 
-start_control_panel
+start_control_panel $SIM_GROUP/$CONTROL_PANEL_COMPOSE_DIR/application.properties
 
-start_consul_cbs
+start_policy_agent NORPOXY $SIM_GROUP/$POLICY_AGENT_COMPOSE_DIR/application.yaml
 
-prepare_consul_config      NOSDNC  ".consul_config.json"
-consul_config_app                  ".consul_config.json"
+use_agent_rest_http
 
-start_policy_agent
+if [ $RUNMODE == "DOCKER" ]; then
+    start_consul_cbs
+fi
 
-use_agent_rest_http
+prepare_consul_config      NOSDNC  ".consul_config.json"
+
+if [ $RUNMODE == "KUBE" ]; then
+    agent_load_config                       ".consul_config.json"
+else
+    consul_config_app                      ".consul_config.json"
+fi
 
 api_get_status 200
 
@@ -91,7 +108,7 @@ done
 
 #Check the number of schemas and the individual schemas in OSC
 if [ "$PMS_VERSION" == "V2" ]; then
-    api_equal json:policy-types 4 120
+    api_equal json:policy-types 4 300
 
     for ((i=1; i<=$OSC_NUM_RICS; i++))
     do
@@ -106,7 +123,7 @@ if [ "$PMS_VERSION" == "V2" ]; then
         api_get_policy_type 200 20008 testdata/OSC/tsa-agent-modified.json
     done
 else
-    api_equal json:policy_types 4 120
+    api_equal json:policy_types 4 300
 
     for ((i=1; i<=$OSC_NUM_RICS; i++))
     do
@@ -150,10 +167,10 @@ fi
 # Create policies
 use_agent_rest_http
 
-api_put_service 201 "Emergency-response-app" 0 "$CR_PATH/1"
+api_put_service 201 "Emergency-response-app" 0 "$CR_SERVICE_PATH/1"
 
 if [ "$PMS_VERSION" == "V2" ]; then
-    notificationurl=$CR_PATH"/test"
+    notificationurl=$CR_SERVICE_PATH"/test"
 else
     notificationurl=""
 fi
diff --git a/test/auto-test/FTC_HELM-RECEPIE.sh b/test/auto-test/FTC_HELM-RECEPIE.sh
new file mode 100755 (executable)
index 0000000..a9f5e5e
--- /dev/null
@@ -0,0 +1,302 @@
+#!/usr/bin/env bash
+
+#  ============LICENSE_START===============================================
+#  Copyright (C) 2020 Nordix Foundation. 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=================================================
+#
+
+TC_ONELINE_DESCR="Sanity test of Non-RT RIC Helm recepie - all components"
+
+#App names to include in the test when running docker, space separated list
+DOCKER_INCLUDED_IMAGES="" # Not used -  KUBE only test script
+
+#App names to include in the test when running kubernetes, space separated list
+KUBE_INCLUDED_IMAGES=" MR CR  PRODSTUB"
+#Prestarted app (not started by script) to include in the test when running kubernetes, space separated list
+KUBE_PRESTARTED_IMAGES=" PA RICSIM CP ECS RC SDNC"
+
+#Supported test environment profiles
+SUPPORTED_PROFILES="ORAN-CHERRY ORAN-DAWN"
+#Supported run modes
+SUPPORTED_RUNMODES="KUBE"
+
+. ../common/testcase_common.sh $@
+. ../common/agent_api_functions.sh
+. ../common/ricsimulator_api_functions.sh
+. ../common/ecs_api_functions.sh
+. ../common/prodstub_api_functions.sh
+. ../common/cr_api_functions.sh
+. ../common/rapp_catalogue_api_functions.sh
+. ../common/mr_api_functions.sh
+. ../common/control_panel_api_functions.sh
+. ../common/controller_api_functions.sh
+
+#### TEST BEGIN ####
+
+use_mr_http       #MR only supports http?
+use_cr_https
+use_agent_rest_https
+use_sdnc_https
+use_simulator_https
+use_ecs_rest_https
+use_prod_stub_https
+use_rapp_catalogue_http
+
+echo -e "$RED CHECK WHY RC HTTPS DOES NOT WORK $ERED"
+
+use_control_panel_https
+
+if [ "$PMS_VERSION" == "V1" ]; then
+   echo "PMS VERSION 2 (V2) is required"
+   exit 1
+fi
+
+clean_environment
+
+STD_NUM_RICS=2
+OSC_NUM_RICS=2
+
+start_ric_simulators a1-sim-osc $STD_NUM_RICS OSC_2.1.0
+echo " RIC MAPPING a1-sim-osc-0 : ric1"
+echo " RIC MAPPING a1-sim-osc-1 : ric2"
+
+start_ric_simulators a1-sim-std $STD_NUM_RICS STD_1.1.3
+echo " RIC MAPPING a1-sim-std-0 : ric3"
+echo " RIC MAPPING a1-sim-std-1 : ric4"
+
+start_ric_simulators a1-sim-std2 $STD_NUM_RICS STD_2.0.0
+echo " RIC MAPPING a1-sim-std2-0 : ric5"
+echo " RIC MAPPING a1-sim-std2-1 : ric6"
+
+start_mr
+
+start_control_panel
+
+start_sdnc
+
+start_policy_agent
+
+start_cr
+
+start_prod_stub
+
+start_ecs
+
+set_ecs_trace
+
+start_rapp_catalogue
+
+set_agent_trace
+
+#### Test RAPP Catalogue ####
+
+rapp_cat_api_get_services 200 EMPTY
+
+rapp_cat_api_put_service 201 "Emergency-response-app" v1 "Emergency-response-app" "Emergency-response-app"
+
+rapp_cat_api_get_services 200 "Emergency-response-app" v1 "Emergency-response-app" "Emergency-response-app"
+
+#Check the number of services
+rc_equal json:services 1
+
+api_get_status 200
+
+#### Test Policy Management Service ####
+
+# Print the A1 version for STD 1.1.X
+for ((i=0; i<$STD_NUM_RICS; i++))
+do
+    sim_print "a1-sim-std-"$i interface
+done
+
+# Print the A1 version for STD 2.0.X
+for ((i=0; i<$STD_NUM_RICS; i++))
+do
+   sim_print "a1-sim-std2-"$i interface
+done
+
+# Print the A1 version for OSC 2.1.X
+for ((i=0; i<$OSC_NUM_RICS; i++))
+do
+    sim_print "a1-sim-osc-"$i interface
+done
+
+
+# Load the polictypes in STD 2
+for ((i=0; i<$STD_NUM_RICS; i++))
+do
+   sim_put_policy_type 201 "a1-sim-std2-"$i STD_QOS_0_2_0 testdata/STD2/sim_qos.json
+   sim_put_policy_type 201 "a1-sim-std2-"$i STD_QOS2_0.1.0 testdata/STD2/sim_qos2.json
+done
+
+# Load the polictypes in OSC
+for ((i=0; i<$OSC_NUM_RICS; i++))
+do
+    sim_put_policy_type 201 "a1-sim-osc-"$i 1 testdata/OSC/sim_1.json
+    sim_put_policy_type 201 "a1-sim-osc-"$i 2 testdata/OSC/sim_2.json
+done
+
+# Check that all rics are synced in
+api_equal json:rics 6 300
+
+#Check the number of schemas and the individual schemas
+api_equal json:policy-types 5 300
+
+for ((i=0; i<$STD_NUM_RICS; i++))
+do
+    ricid=$((3+$i))
+    api_equal json:policy-types?ric_id=ric$ricid 1 120
+done
+
+for ((i=0; i<$STD_NUM_RICS; i++))
+do
+   ricid=$((5+$i))
+   api_equal json:policy-types?ric_id=ric$ricid 2 120
+done
+
+for ((i=0; i<$OSC_NUM_RICS; i++))
+do
+    ricid=$((1+$i))
+    api_equal json:policy-types?ric_id=ric$ricid 2 120
+done
+
+#Check the schemas in STD 2
+for ((i=0; i<$OSC_NUM_RICS; i++))
+do
+   ricid=$((5+$i))
+   api_get_policy_type 200 STD_QOS_0_2_0 testdata/STD2/qos-agent-modified.json
+   api_get_policy_type 200 STD_QOS2_0.1.0 testdata/STD2/qos2-agent-modified.json
+done
+
+# Check the schemas in OSC
+for ((i=0; i<$OSC_NUM_RICS; i++))
+do
+    api_get_policy_type 200 1 testdata/OSC/1-agent-modified.json
+    api_get_policy_type 200 2 testdata/OSC/2-agent-modified.json
+done
+
+api_put_service 201 "Emergency-response-app" 0 "$CR_SERVICE_PATH/ER-app"
+
+# Create policies in STD
+for ((i=0; i<$STD_NUM_RICS; i++))
+do
+    ricid=$((3+$i))
+    generate_uuid
+    api_put_policy 201 "Emergency-response-app" ric$ricid NOTYPE $((1100+$i)) NOTRANSIENT $CR_SERVICE_PATH/"std2" testdata/STD/pi1_template.json 1
+    generate_uuid
+    api_put_policy 201 "Emergency-response-app" ric$ricid NOTYPE $((1200+$i)) NOTRANSIENT $CR_SERVICE_PATH/"std2" testdata/STD/pi1_template.json 1
+done
+
+#Create policies in STD 2
+for ((i=0; i<$STD_NUM_RICS; i++))
+do
+   ricid=$((5+$i))
+   generate_uuid
+   api_put_policy 201 "Emergency-response-app" ric$ricid STD_QOS_0_2_0 $((2100+$i)) NOTRANSIENT $CR_SERVICE_PATH/"std2" testdata/STD2/pi_qos_template.json 1
+   generate_uuid
+   api_put_policy 201 "Emergency-response-app" ric$ricid STD_QOS2_0.1.0 $((2200+$i)) NOTRANSIENT $CR_SERVICE_PATH/"std2" testdata/STD2/pi_qos2_template.json 1
+done
+
+# Create policies in OSC
+for ((i=0; i<$OSC_NUM_RICS; i++))
+do
+    ricid=$((1+$i))
+    generate_uuid
+    api_put_policy 201 "Emergency-response-app" ric$ricid 1 $((3100+$i)) NOTRANSIENT $CR_SERVICE_PATH/"osc" testdata/OSC/pi1_template.json 1
+    generate_uuid
+    api_put_policy 201 "Emergency-response-app" ric$ricid 2 $((3200+$i)) NOTRANSIENT $CR_SERVICE_PATH/"osc" testdata/OSC/pi2_template.json 1
+done
+
+
+# Check the number of policies in STD and STD2
+for ((i=0; i<$STD_NUM_RICS; i++))
+do
+    sim_equal "a1-sim-std-"$i num_instances 2
+    sim_equal "a1-sim-std2-"$i num_instances 2
+done
+
+# Check the number of policies in OSC
+for ((i=0; i<$STD_NUM_RICS; i++))
+do
+    sim_equal "a1-sim-osc-"$i num_instances 2
+done
+
+echo "ADD EVENT/STATUS CHECK"
+echo "ADD MR CHECK"
+
+FLAT_A1_EI="1"
+
+ecs_api_admin_reset
+
+CB_JOB="$PROD_STUB_SERVICE_PATH$PROD_STUB_JOB_CALLBACK"
+CB_SV="$PROD_STUB_SERVICE_PATH$PROD_STUB_SUPERVISION_CALLBACK"
+TARGET1="$RIC_SIM_HTTPX://a1-sim-std2-0.a1-sim:$RIC_SIM_PORT/datadelivery"
+TARGET2="$RIC_SIM_HTTPX://a1-sim-std2-1.a1-sim:$RIC_SIM_PORT/datadelivery"
+
+STATUS1="$CR_SERVICE_PATH/job1-status"
+STATUS2="$CR_SERVICE_PATH/job2-status"
+
+prodstub_arm_producer 200 prod-a
+prodstub_arm_type 200 prod-a type1
+prodstub_arm_job_create 200 prod-a job1
+prodstub_arm_job_create 200 prod-a job2
+
+
+### ecs status
+ecs_api_service_status 200
+
+## Setup prod-a
+ecs_api_edp_put_producer 201 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json
+
+ecs_api_edp_get_producer 200 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json
+
+ecs_api_edp_get_producer_status 200 prod-a ENABLED
+
+
+## Create a job for prod-a
+## job1 - prod-a
+if [  -z "$FLAT_A1_EI" ]; then
+    ecs_api_a1_put_job 201 type1 job1 $TARGET1 ricsim_g3_1 testdata/ecs/job-template.json
+else
+    ecs_api_a1_put_job 201 job1 type1 $TARGET1 ricsim_g3_1 $STATUS1 testdata/ecs/job-template.json
+fi
+
+# Check the job data in the producer
+prodstub_check_jobdata 200 prod-a job1 type1 $TARGET1 ricsim_g3_1 testdata/ecs/job-template.json
+
+
+## Create a second job for prod-a
+## job2 - prod-a
+if [  -z "$FLAT_A1_EI" ]; then
+    ecs_api_a1_put_job 201 type1 job2 $TARGET2 ricsim_g3_2 testdata/ecs/job-template.json
+else
+    ecs_api_a1_put_job 201 job2 type1 $TARGET2 ricsim_g3_2 $STATUS2 testdata/ecs/job-template.json
+fi
+
+# Check the job data in the producer
+prodstub_check_jobdata 200 prod-a job2 type1 $TARGET2 ricsim_g3_2 testdata/ecs/job-template.json
+
+
+echo "ADD EVENT/STATUS CHECK"
+
+check_policy_agent_logs
+check_ecs_logs
+check_sdnc_logs
+
+#### TEST COMPLETE ####
+
+store_logs          END
+
+print_result
index c43ad3e..0b70495 100755 (executable)
 
 TC_ONELINE_DESCR="Preparation demo setup  - populating a number of ric simulators with types and instances"
 
-#App names to include in the test, space separated list
-INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM SDNC"
+#App names to include in the test when running docker, space separated list
+DOCKER_INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM SDNC"
 
-#SUPPORTED TEST ENV FILE
-SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN ORAN-CHERRY"
+#App names to include in the test when running kubernetes, space separated list
+KUBE_INCLUDED_IMAGES="CP CR MR PA RICSIM SDNC"
+#Prestarted app (not started by script) to include in the test when running kubernetes, space separated list
+KUBE_PRESTARTED_IMAGES=""
+
+#Supported test environment profiles
+SUPPORTED_PROFILES="ONAP-GUILIN ONAP-HONOLULU  ORAN-CHERRY ORAN-DAWN"
+#Supported run modes
+SUPPORTED_RUNMODES="DOCKER KUBE"
 
 . ../common/testcase_common.sh $@
 . ../common/agent_api_functions.sh
 . ../common/ricsimulator_api_functions.sh
+. ../common/mr_api_functions.sh
+. ../common/control_panel_api_functions.sh
+. ../common/controller_api_functions.sh
+. ../common/cr_api_functions.sh
+. ../common/consul_cbs_functions.sh
 
 #### TEST BEGIN ####
 
@@ -40,12 +52,12 @@ use_sdnc_https
 use_simulator_https
 
 if [ "$PMS_VERSION" == "V2" ]; then
-    notificationurl=$CR_PATH"/test"
+    notificationurl=$CR_SERVICE_PATH"/test"
 else
     notificationurl=""
 fi
 
-clean_containers
+clean_environment
 
 OSC_NUM_RICS=6
 STD_NUM_RICS=5
@@ -60,18 +72,25 @@ fi
 
 start_mr #Just to prevent errors in the agent log...
 
-start_control_panel
+start_control_panel $SIM_GROUP/$CONTROL_PANEL_COMPOSE_DIR/application.properties
 
 start_sdnc
 
-start_consul_cbs
+start_policy_agent NORPOXY $SIM_GROUP/$POLICY_AGENT_COMPOSE_DIR/application.yaml
 
-prepare_consul_config      SDNC  ".consul_config.json"
-consul_config_app                  ".consul_config.json"
+set_agent_trace
 
-start_policy_agent
+if [ $RUNMODE == "DOCKER" ]; then
+    start_consul_cbs
+fi
 
-set_agent_trace
+prepare_consul_config      SDNC  ".consul_config.json"
+
+if [ $RUNMODE == "KUBE" ]; then
+    agent_load_config                       ".consul_config.json"
+else
+    consul_config_app                      ".consul_config.json"
+fi
 
 api_get_status 200
 
@@ -108,7 +127,7 @@ done
 #Check the number of schemas and the individual schemas in OSC
 if [ "$PMS_VERSION" == "V2" ]; then
 
-    api_equal json:policy-types 3 120
+    api_equal json:policy-types 3 300
 
     for ((i=1; i<=$OSC_NUM_RICS; i++))
     do
@@ -122,7 +141,7 @@ if [ "$PMS_VERSION" == "V2" ]; then
         api_get_policy_type 200 20008 demo-testdata/OSC/tsa-agent-modified.json
     done
 else
-    api_equal json:policy_types 3 120
+    api_equal json:policy_types 3 300
 
     for ((i=1; i<=$OSC_NUM_RICS; i++))
     do
@@ -176,7 +195,7 @@ fi
 # Create policies
 use_agent_rest_http
 
-api_put_service 201 "Emergency-response-app" 0 "$CR_PATH/1"
+api_put_service 201 "Emergency-response-app" 0 "$CR_SERVICE_PATH/1"
 
 # Create policies in OSC
 for ((i=1; i<=$OSC_NUM_RICS; i++))
index 2915b02..324d892 100755 (executable)
 
 TC_ONELINE_DESCR="Preparation demo setup  - policy management and enrichment information"
 
-#App names to include in the test, space separated list
-INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM SDNC ECS PRODSTUB RC"
+#App names to include in the test when running docker, space separated list
+DOCKER_INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM SDNC ECS PRODSTUB RC HTTPPROXY"
 
-#SUPPORTED TEST ENV FILE
-SUPPORTED_PROFILES="ONAP-MASTER ORAN-CHERRY"
+#App names to include in the test when running kubernetes, space separated list
+KUBE_INCLUDED_IMAGES=" MR CR PA RC PRODSTUB RICSIM CP ECS SDNC HTTPPROXY"
+#Prestarted app (not started by script) to include in the test when running kubernetes, space separated list
+KUBE_PRESTARTED_IMAGES=""
+
+#Supported test environment profiles
+SUPPORTED_PROFILES="ONAP-HONOLULU  ORAN-CHERRY ORAN-DAWN"
+#Supported run modes
+SUPPORTED_RUNMODES="DOCKER KUBE"
 
 . ../common/testcase_common.sh $@
 . ../common/agent_api_functions.sh
@@ -32,6 +39,11 @@ SUPPORTED_PROFILES="ONAP-MASTER ORAN-CHERRY"
 . ../common/prodstub_api_functions.sh
 . ../common/cr_api_functions.sh
 . ../common/rapp_catalogue_api_functions.sh
+. ../common/mr_api_functions.sh
+. ../common/control_panel_api_functions.sh
+. ../common/controller_api_functions.sh
+. ../common/consul_cbs_functions.sh
+. ../common/http_proxy_api_functions.sh
 
 #### TEST BEGIN ####
 
@@ -47,13 +59,13 @@ use_prod_stub_https
 use_rapp_catalogue_http # https not yet supported
 
 if [ "$PMS_VERSION" == "V2" ]; then
-    notificationurl=$CR_PATH"/test"
+    notificationurl=$CR_SERVICE_PATH"/test"
 else
    echo "PMS VERSION 2 (V2) is required"
    exit 1
 fi
 
-clean_containers
+clean_environment
 
 STD_NUM_RICS=2
 
@@ -61,24 +73,29 @@ start_ric_simulators $RIC_SIM_PREFIX"_g3" $STD_NUM_RICS STD_2.0.0
 
 start_mr #Just to prevent errors in the agent log...
 
-start_control_panel
+start_control_panel $SIM_GROUP/$CONTROL_PANEL_COMPOSE_DIR/application.properties
 
 start_sdnc
 
-start_consul_cbs
+start_policy_agent PROXY $SIM_GROUP/$POLICY_AGENT_COMPOSE_DIR/application.yaml
 
-prepare_consul_config      SDNC  ".consul_config.json"
-consul_config_app                  ".consul_config.json"
+if [ $RUNMODE == "DOCKER" ]; then
+    start_consul_cbs
+fi
 
-start_policy_agent
+prepare_consul_config      SDNC  ".consul_config.json"
 
-start_rapp_catalogue
+if [ $RUNMODE == "KUBE" ]; then
+    agent_load_config                       ".consul_config.json"
+else
+    consul_config_app                      ".consul_config.json"
+fi
 
 start_cr
 
 start_prod_stub
 
-start_ecs
+start_ecs $SIM_GROUP/$ECS_COMPOSE_DIR/application.yaml
 
 start_rapp_catalogue
 
@@ -86,7 +103,6 @@ set_agent_trace
 
 set_ecs_trace
 
-
 rapp_cat_api_get_services 200 EMPTY
 
 rapp_cat_api_put_service 201 "Emergency-response-app" v1 "Emergency-response-app" "Emergency-response-app"
@@ -123,9 +139,9 @@ do
 done
 
 #Check the number of types
-api_equal json:policy-types 2 120
+api_equal json:policy-types 2 300
 
-api_put_service 201 "Emergency-response-app" 0 "$CR_PATH/1"
+api_put_service 201 "Emergency-response-app" 0 "$CR_SERVICE_PATH/1"
 
 # Create policies in STD
 for ((i=1; i<=$STD_NUM_RICS; i++))
@@ -143,33 +159,48 @@ do
     sim_equal $RIC_SIM_PREFIX"_g3_"$i num_instances 2
 done
 
-
+# Print calling hosts STD 2.X
+for ((i=1; i<=$STD_NUM_RICS; i++))
+do
+    sim_print $RIC_SIM_PREFIX"_g3_"$i remote_hosts
+done
 
 FLAT_A1_EI="1"
 
-CB_JOB="$PROD_STUB_HTTPX://$PROD_STUB_APP_NAME:$PROD_STUB_PORT/callbacks/job"
-CB_SV="$PROD_STUB_HTTPX://$PROD_STUB_APP_NAME:$PROD_STUB_PORT/callbacks/supervision"
-TARGET1="$RIC_SIM_HTTPX://ricsim_g3_1:$RIC_SIM_PORT/datadelivery"
-TARGET2="$RIC_SIM_HTTPX://ricsim_g3_2:$RIC_SIM_PORT/datadelivery"
+CB_JOB="$PROD_STUB_SERVICE_PATH$PROD_STUB_JOB_CALLBACK"
+CB_SV="$PROD_STUB_SERVICE_PATH$PROD_STUB_SUPERVISION_CALLBACK"
+RIC_G1_1=$RIC_SIM_PREFIX"_g3_1"
+RIC_G1_2=$RIC_SIM_PREFIX"_g3_2"
+if [ $RUNMODE == "KUBE" ]; then
+    RIC_G1_1=$(get_kube_sim_host $RIC_G1_1)
+    RIC_G1_2=$(get_kube_sim_host $RIC_G1_2)
+fi
+TARGET1="$RIC_SIM_HTTPX://$RIC_G1_1:$RIC_SIM_PORT/datadelivery"
+TARGET2="$RIC_SIM_HTTPX://$RIC_G1_1:$RIC_SIM_PORT/datadelivery"
 
-STATUS1="$CR_HTTPX://$CR_APP_NAME:$CR_PORT/callbacks/job1-status"
-STATUS2="$CR_HTTPX://$CR_APP_NAME:$CR_PORT/callbacks/job2-status"
+STATUS1="$CR_SERVICE_PATH/callbacks/job1-status"
+STATUS2="$CR_SERVICE_PATH/callbacks/job2-status"
 
 prodstub_arm_producer 200 prod-a
 prodstub_arm_type 200 prod-a type1
 prodstub_arm_job_create 200 prod-a job1
 prodstub_arm_job_create 200 prod-a job2
 
-
 ### ecs status
 ecs_api_service_status 200
 
+## Setup prod-a
+if [ $ECS_VERSION == "V1-1" ]; then
+    ecs_api_edp_put_producer 201 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json
 
+    ecs_api_edp_get_producer 200 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json
+else
+    ecs_api_edp_put_type_2 201 type1 testdata/ecs/ei-type-1.json
 
-## Setup prod-a
-ecs_api_edp_put_producer 201 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json
+    ecs_api_edp_put_producer_2 201 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1
 
-ecs_api_edp_get_producer 200 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json
+    ecs_api_edp_get_producer_2 200 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1
+fi
 
 ecs_api_edp_get_producer_status 200 prod-a ENABLED
 
@@ -197,9 +228,6 @@ fi
 # Check the job data in the producer
 prodstub_check_jobdata 200 prod-a job2 type1 $TARGET2 ricsim_g3_2 testdata/ecs/job-template.json
 
-
-
-
 check_policy_agent_logs
 check_ecs_logs
 check_sdnc_logs
index 82ff47b..005ee0a 100644 (file)
@@ -15,7 +15,7 @@ The test scripts uses configuration from a single file, found in `../common/test
 ## How to run
 A test script, for example FTC1, is executed from the cmd line using the script filename and one or more parameters:
 
- ./FTC1.sh remote --env-file ../common/test_env-oran-cherry
+ ./FTC1.sh remote --env-file ../common/test_env-oran-cherry.sh
 
 See the README.md in  `../common/` for all details about available parameters and their meaning.
 
diff --git a/test/common/.gitignore b/test/common/.gitignore
new file mode 100644 (file)
index 0000000..bc68808
--- /dev/null
@@ -0,0 +1 @@
+NO-CHECKIN
index 21475c0..b4754cd 100644 (file)
@@ -68,18 +68,22 @@ The script can be started with these arguments
 
 | arg list |
 |--|
-| `local|remote|remote-remove [auto-clean] [--stop-at-error] [--ricsim-prefix <prefix> ] [ --env-file <environment-filename> ]  [--use-local-image <app-nam> [<app-name>]*]` |
+| `remote|remote-remove --env-file <environment-filename> [release] [auto-clean] [--stop-at-error] [--ricsim-prefix <prefix> ] [--use-local-image <app-nam>+]  [--use-snapshot-image <app-nam>+] [--use-staging-image <app-nam>+] [--use-release-image <app-nam>+]` |
 
 | parameter | description |
 |-|-|
-| `local` | only locally built images (in local docker respository) will be used for the Non-RT RIC components. CBS, Consul, DB will still use remote nexus images |
-| `remote` | only remote images from nexus will be used. Images pulled if not present in local docker repository |
-| `remote-remove` | same as remote but all images are removed first so that fresh images are pulled when running |
-| `auto-clean` | all containers will be automatically stopped and removed when the test case is complete. Requires the function 'auto_clean_containers' to be included last in the applicable auto-test script |
-| `--stop-at-error` | intended for debugging and make the script stop at first 'FAIL' and save all logs with a prefix 'STOP_AT_ERROR' |
-| `--ricsim-prefix <prefix>` | use another prefix for the ric simulator container name than the standard 'ricsim'. Note that the testscript has to read and use the env var `$RIC_SIM_PREFIX` instead of a hardcoded name of the ric(s). |
-| `--env-file` | point to a file with environment variables (the previous default, test_env.sh, replaced with one env file for each branch in test/common) |
-| `--use-local-image <app-nam> [<app-name>]*` | only applicable when running as 'remote' or 'remote-remove'. Mainly for debugging when a locally built image shall be used together with other remote images from nexus.Accepts a space separated list of PA, CP, RICSIM, SDNC, RC for Policy Agent, Control Panel, A1-controller, Ric simulator, RAPP Catalogue |
+| `remote` | Use images from remote repositories. Can be overridden for individual images using the '--use_xxx' flags |
+| `remote-remove` | Same as 'remote' but will also try to pull fresh images from remote repositories |
+| `--env-file` | The script will use the supplied file to read environment variables from |
+| `release` | If this flag is given the script will use release version of the images |
+| `auto-clean` | If the function 'auto_clean_containers' is present in the end of the test script then all containers will be stopped and removed. If 'auto-clean' is not given then the function has no effect |
+| `--stop-at-error` | The script will stop when the first failed test or configuration |
+| `--ricsim-prefix <prefix>` | The a1 simulator will use the supplied string as container prefix instead of 'ricsim'. Note that the testscript has to read and use the env var `$RIC_SIM_PREFIX` instead of a hardcoded name of the ric(s). |
+| `--use-local-image` | The script will use local images for the supplied apps, space separated list of app short names |
+| `--use-snapshot-image` | The script will use images from the nexus snapshot repo for the supplied apps, space separated list of app short names |
+| `--use-staging-image` | The script will use images from the nexus staging repo for the supplied apps, space separated list of app short names |
+| `--use-release-image` | The script will use images from the nexus release repo for the supplied apps, space separated list of app short names |
+| `help` | Print this info along with the test script description and the list of app short names supported |
 
 
 ## Function: print_result ##
index fbd9fc4..1cd430e 100644 (file)
 #  ============LICENSE_END=================================================
 #
 
-# This is a script that contains specific test functions for Policy Agent API
+# This is a script that contains management and test functions for Policy Agent
 
-### API functiond towards the Policy Agent
 
-. ../common/api_curl.sh
+## Access to Policy agent
+# Host name may be changed if app started by kube
+# Direct access from script
+PA_HTTPX="http"
+PA_HOST_NAME=$LOCALHOST_NAME
+PA_PATH=$PA_HTTPX"://"$PA_HOST_NAME":"$POLICY_AGENT_EXTERNAL_PORT
+
+# PA_ADAPTER used for switch between REST and DMAAP
+PA_ADAPTER_TYPE="REST"
+PA_ADAPTER=$PA_PATH
+
+# Make curl retries towards the agent for http response codes set in this env var, space separated list of codes
+AGENT_RETRY_CODES=""
+
+###########################
+### Policy Agents functions
+###########################
+
+# All calls to the agent will be directed to the agent REST interface from now on
+# args: -
+# (Function for test scripts)
+use_agent_rest_http() {
+       echo -e $BOLD"Agent protocol setting"$EBOLD
+       echo -e " Using $BOLD http $EBOLD and $BOLD REST $EBOLD towards the agent"
+       PA_HTTPX="http"
+       PA_PATH=$PA_HTTPX"://"$PA_HOST_NAME":"$POLICY_AGENT_EXTERNAL_PORT
+
+       PA_ADAPTER_TYPE="REST"
+       PA_ADAPTER=$PA_PATH
+       echo ""
+}
+
+# All calls to the agent will be directed to the agent REST interface from now on
+# args: -
+# (Function for test scripts)
+use_agent_rest_https() {
+       echo -e $BOLD"Agent protocol setting"$EBOLD
+       echo -e " Using $BOLD https $EBOLD and $BOLD REST $EBOLD towards the agent"
+       PA_HTTPX="https"
+       PA_PATH=$PA_HTTPX"://"$PA_HOST_NAME":"$POLICY_AGENT_EXTERNAL_SECURE_PORT
+
+       PA_ADAPTER_TYPE="REST"
+       PA_ADAPTER=$PA_PATH
+       echo ""
+}
+
+# All calls to the agent will be directed to the agent dmaap interface over http from now on
+# args: -
+# (Function for test scripts)
+use_agent_dmaap_http() {
+       echo -e $BOLD"Agent dmaap protocol setting"$EBOLD
+       echo -e " Using $BOLD http $EBOLD and $BOLD DMAAP $EBOLD towards the agent"
+       PA_ADAPTER_TYPE="MR-HTTP"
+       echo ""
+}
+
+# All calls to the agent will be directed to the agent dmaap interface over https from now on
+# args: -
+# (Function for test scripts)
+use_agent_dmaap_https() {
+       echo -e $BOLD"Agent dmaap protocol setting"$EBOLD
+       echo -e " Using $BOLD https $EBOLD and $BOLD DMAAP $EBOLD towards the agent"
+       echo -e $YELLOW" Setting http instead of https - MR only uses http"$EYELLOW
+       PA_ADAPTER_TYPE="MR-HTTPS"
+       echo ""
+}
+
+# Start the policy agent
+# args: (kube only) PROXY|NOPROXY <config-file> [ <data-file>]
+# (Function for test scripts)
+start_policy_agent() {
+       echo -e $BOLD"Starting $POLICY_AGENT_DISPLAY_NAME"$EBOLD
+
+       if [ $RUNMODE == "KUBE" ]; then
+
+               # Check if app shall be fully managed by the test script
+               __check_included_image "PA"
+               retcode_i=$?
+
+               # Check if app shall only be used by the testscipt
+               __check_prestarted_image "PA"
+               retcode_p=$?
+
+               if [ $retcode_i -ne 0 ] && [ $retcode_p -ne 0 ]; then
+                       echo -e $RED"The $POLICY_AGENT_APP_NAME app is not included as managed nor prestarted in this test script"$ERED
+                       echo -e $RED"The $POLICY_AGENT_APP_NAME will not be started"$ERED
+                       exit
+               fi
+               if [ $retcode_i -eq 0 ] && [ $retcode_p -eq 0 ]; then
+                       echo -e $RED"The $POLICY_AGENT_APP_NAME app is included both as managed and prestarted in this test script"$ERED
+                       echo -e $RED"The $POLICY_AGENT_APP_NAME will not be started"$ERED
+                       exit
+               fi
+
+               if [ $retcode_p -eq 0 ]; then
+                       echo -e " Using existing $POLICY_AGENT_APP_NAME deployment and service"
+                       echo " Setting $POLICY_AGENT_APP_NAME replicas=1"
+                       __kube_scale deployment $POLICY_AGENT_APP_NAME $KUBE_NONRTRIC_NAMESPACE 1
+               fi
+
+               if [ $retcode_i -eq 0 ]; then
+
+                       echo -e " Creating $POLICY_AGENT_APP_NAME app and expose service"
+
+                       #Check if nonrtric namespace exists, if not create it
+                       __kube_create_namespace $KUBE_NONRTRIC_NAMESPACE
+
+                       #Export all vars needed for service and deployment
+                       export POLICY_AGENT_APP_NAME
+                       export KUBE_NONRTRIC_NAMESPACE
+                       export POLICY_AGENT_IMAGE
+                       export POLICY_AGENT_INTERNAL_PORT
+                       export POLICY_AGENT_INTERNAL_SECURE_PORT
+                       export POLICY_AGENT_EXTERNAL_PORT
+                       export POLICY_AGENT_EXTERNAL_SECURE_PORT
+                       export POLICY_AGENT_CONFIG_MOUNT_PATH
+                       export POLICY_AGENT_DATA_MOUNT_PATH
+                       export POLICY_AGENT_CONFIG_CONFIGMAP_NAME=$POLICY_AGENT_APP_NAME"-config"
+                       export POLICY_AGENT_DATA_CONFIGMAP_NAME=$POLICY_AGENT_APP_NAME"-data"
+                       export POLICY_AGENT_PKG_NAME
+                       if [ $1 == "PROXY" ]; then
+                               AGENT_HTTP_PROXY_CONFIG_PORT=$HTTP_PROXY_CONFIG_PORT  #Set if proxy is started
+                               AGENT_HTTP_PROXY_CONFIG_HOST_NAME=$HTTP_PROXY_CONFIG_HOST_NAME #Set if proxy is started
+                       else
+                               AGENT_HTTP_PROXY_CONFIG_PORT=0
+                               AGENT_HTTP_PROXY_CONFIG_HOST_NAME=""
+                       fi
+                       export AGENT_HTTP_PROXY_CONFIG_PORT
+                       export AGENT_HTTP_PROXY_CONFIG_HOST_NAME
+
+
+                       # Create config map for config
+                       configfile=$PWD/tmp/$POLICY_AGENT_CONFIG_FILE
+                       cp $2 $configfile
+                       output_yaml=$PWD/tmp/pa_cfc.yaml
+                       __kube_create_configmap $POLICY_AGENT_CONFIG_CONFIGMAP_NAME $KUBE_NONRTRIC_NAMESPACE autotest PA $configfile $output_yaml
+
+                       # Create config map for data
+                       data_json=$PWD/tmp/$POLICY_AGENT_DATA_FILE
+                       if [ $# -lt 3 ]; then
+                               #create empty dummy file
+                               echo "{}" > $data_json
+                       else
+                               cp $3 $data_json
+                       fi
+                       output_yaml=$PWD/tmp/pa_cfd.yaml
+                       __kube_create_configmap $POLICY_AGENT_DATA_CONFIGMAP_NAME $KUBE_NONRTRIC_NAMESPACE autotest PA $data_json $output_yaml
+
+                       # Create service
+                       input_yaml=$SIM_GROUP"/"$POLICY_AGENT_COMPOSE_DIR"/"svc.yaml
+                       output_yaml=$PWD/tmp/pa_svc.yaml
+                       __kube_create_instance service $POLICY_AGENT_APP_NAME $input_yaml $output_yaml
+
+                       # Create app
+                       input_yaml=$SIM_GROUP"/"$POLICY_AGENT_COMPOSE_DIR"/"app.yaml
+                       output_yaml=$PWD/tmp/pa_app.yaml
+                       __kube_create_instance app $POLICY_AGENT_APP_NAME $input_yaml $output_yaml
+
+               fi
+
+               echo " Retrieving host and ports for service..."
+               PA_HOST_NAME=$(__kube_get_service_host $POLICY_AGENT_APP_NAME $KUBE_NONRTRIC_NAMESPACE)
+               POLICY_AGENT_EXTERNAL_PORT=$(__kube_get_service_port $POLICY_AGENT_APP_NAME $KUBE_NONRTRIC_NAMESPACE "http")
+               POLICY_AGENT_EXTERNAL_SECURE_PORT=$(__kube_get_service_port $POLICY_AGENT_APP_NAME $KUBE_NONRTRIC_NAMESPACE "https")
+
+               echo " Host IP, http port, https port: $PA_HOST_NAME $POLICY_AGENT_EXTERNAL_PORT $POLICY_AGENT_EXTERNAL_SECURE_PORT"
+
+               if [ $PA_HTTPX == "http" ]; then
+                       PA_PATH=$PA_HTTPX"://"$PA_HOST_NAME":"$POLICY_AGENT_EXTERNAL_PORT
+               else
+                       PA_PATH=$PA_HTTPX"://"$PA_HOST_NAME":"$POLICY_AGENT_EXTERNAL_SECURE_PORT
+               fi
+               __check_service_start $POLICY_AGENT_APP_NAME $PA_PATH$POLICY_AGENT_ALIVE_URL
+
+               if [ $PA_ADAPTER_TYPE == "REST" ]; then
+                       PA_ADAPTER=$PA_PATH
+               fi
+       else
+               __check_included_image 'PA'
+               if [ $? -eq 1 ]; then
+                       echo -e $RED"The Policy Agent app is not included in this test script"$ERED
+                       echo -e $RED"The Policy Agent will not be started"$ERED
+                       exit
+               fi
+
+               #Export all vars needed for docker-compose
+               export POLICY_AGENT_APP_NAME
+               export POLICY_AGENT_APP_NAME_ALIAS
+               export POLICY_AGENT_INTERNAL_PORT
+               export POLICY_AGENT_EXTERNAL_PORT
+               export POLICY_AGENT_INTERNAL_SECURE_PORT
+               export POLICY_AGENT_EXTERNAL_SECURE_PORT
+               export CONSUL_HOST
+               export CONSUL_INTERNAL_PORT
+               export CONFIG_BINDING_SERVICE
+               export POLICY_AGENT_CONFIG_KEY
+               export DOCKER_SIM_NWNAME
+               export POLICY_AGENT_HOST_MNT_DIR
+               export POLICY_AGENT_CONFIG_MOUNT_PATH
+               export POLICY_AGENT_CONFIG_FILE
+               export POLICY_AGENT_PKG_NAME
+
+               if [ $1 == "PROXY" ]; then
+                       AGENT_HTTP_PROXY_CONFIG_PORT=$HTTP_PROXY_CONFIG_PORT  #Set if proxy is started
+                       AGENT_HTTP_PROXY_CONFIG_HOST_NAME=$HTTP_PROXY_CONFIG_HOST_NAME #Set if proxy is started
+               else
+                       AGENT_HTTP_PROXY_CONFIG_PORT=0
+                       AGENT_HTTP_PROXY_CONFIG_HOST_NAME=""
+               fi
+               export AGENT_HTTP_PROXY_CONFIG_PORT
+               export AGENT_HTTP_PROXY_CONFIG_HOST_NAME
+
+               dest_file=$SIM_GROUP/$POLICY_AGENT_COMPOSE_DIR/$POLICY_AGENT_HOST_MNT_DIR/application.yaml
+
+               envsubst < $2 > $dest_file
+
+               __start_container $POLICY_AGENT_COMPOSE_DIR NODOCKERARGS 1 $POLICY_AGENT_APP_NAME
+
+               __check_service_start $POLICY_AGENT_APP_NAME $PA_PATH$POLICY_AGENT_ALIVE_URL
+       fi
+       echo ""
+       return 0
+}
+
+agent_load_config() {
+       echo -e $BOLD"Agent - load config from "$EBOLD$1
+       data_json=$PWD/tmp/$POLICY_AGENT_DATA_FILE
+       cp $1 $data_json
+       output_yaml=$PWD/tmp/pa_cfd.yaml
+       __kube_create_configmap $POLICY_AGENT_APP_NAME"-data" $KUBE_NONRTRIC_NAMESPACE autotest PA $data_json $output_yaml
+}
+
+
+# Turn on debug level tracing in the agent
+# args: -
+# (Function for test scripts)
+set_agent_debug() {
+       echo -e $BOLD"Setting agent debug logging"$EBOLD
+       curlString="$PA_PATH$POLICY_AGENT_ACTUATOR -X POST  -H Content-Type:application/json -d {\"configuredLevel\":\"debug\"}"
+       result=$(__do_curl "$curlString")
+       if [ $? -ne 0 ]; then
+               __print_err "could not set debug mode" $@
+               ((RES_CONF_FAIL++))
+               return 1
+       fi
+       echo ""
+       return 0
+}
+
+# Turn on trace level tracing in the agent
+# args: -
+# (Function for test scripts)
+set_agent_trace() {
+       echo -e $BOLD"Setting agent trace logging"$EBOLD
+       curlString="$PA_PATH$POLICY_AGENT_ACTUATOR -X POST  -H Content-Type:application/json -d {\"configuredLevel\":\"trace\"}"
+       result=$(__do_curl "$curlString")
+       if [ $? -ne 0 ]; then
+               __print_err "could not set trace mode" $@
+               ((RES_CONF_FAIL++))
+               return 1
+       fi
+       echo ""
+       return 0
+}
+
+# Perform curl retries when making direct call to the agent for the specified http response codes
+# Speace separated list of http response codes
+# args: [<response-code>]*
+use_agent_retries() {
+       echo -e $BOLD"Do curl retries to the agent REST inteface for these response codes:$@"$EBOLD
+       AGENT_RETRY_CODES=$@
+       echo ""
+       return
+}
 
 #########################################################
 #### Test case functions A1 Policy management service
@@ -36,9 +308,9 @@ api_equal() {
        if [ $# -eq 2 ] || [ $# -eq 3 ]; then
                if [[ $1 == "json:"* ]]; then
                        if [ "$PMS_VERSION" == "V2" ]; then
-                               __var_test "Policy Agent" $LOCALHOST$POLICY_AGENT_EXTERNAL_PORT"/v2/" $1 "=" $2 $3
+                               __var_test "Policy Agent" $PA_PATH$PMS_API_PREFIX"/v2/" $1 "=" $2 $3
                        else
-                               __var_test "Policy Agent" $LOCALHOST$POLICY_AGENT_EXTERNAL_PORT"/" $1 "=" $2 $3
+                               __var_test "Policy Agent" $PA_PATH"/" $1 "=" $2 $3
                        fi
                        return 0
                fi
@@ -546,7 +818,8 @@ api_put_policy_parallel() {
        count=$1; shift;
        pids=$1; shift;
 
-       if [ $ADAPTER != $RESTBASE ] && [ $ADAPTER != $RESTBASE_SECURE ]; then
+       #if [ $PA_ADAPTER != $RESTBASE ] && [ $PA_ADAPTER != $RESTBASE_SECURE ]; then
+       if [ $__ADAPTER_TYPE != "REST" ]; then
                echo " Info - api_put_policy_parallel uses only the agent REST interface - create over dmaap in parallel is not supported"
                echo " Info - will execute over agent REST"
        fi
@@ -570,7 +843,7 @@ api_put_policy_parallel() {
                fi
        fi
 
-       urlbase=${ADAPTER}${query}
+       urlbase=${PA_ADAPTER}${query}
 
        for ((i=1; i<=$pids; i++))
        do
@@ -746,7 +1019,8 @@ api_delete_policy_parallel() {
        count=$1; shift;
        pids=$1; shift;
 
-       if [ $ADAPTER != $RESTBASE ] && [ $ADAPTER != $RESTBASE_SECURE ]; then
+       #if [ $PA_ADAPTER != $RESTBASE ] && [ $PA_ADAPTER != $RESTBASE_SECURE ]; then
+       if [ $__ADAPTER_TYPE != "REST" ]; then
                echo " Info - api_delete_policy_parallel uses only the agent REST interface - create over dmaap in parallel is not supported"
                echo " Info - will execute over agent REST"
        fi
@@ -757,7 +1031,7 @@ api_delete_policy_parallel() {
                query="/policy"
        fi
 
-       urlbase=${ADAPTER}${query}
+       urlbase=${PA_ADAPTER}${query}
 
        for ((i=1; i<=$pids; i++))
        do
index c7e5c90..1ea47dd 100644 (file)
 
 # Generic function to query the agent/ECS via the REST or DMAAP interface.
 # Used by all other agent/ECS api test functions
-# If operation prefix is '_BATCH' the the send and get response is split in two sequences,
+# If operation sufffix is '_BATCH' the the send and get response is split in two sequences,
 # one for sending the requests and one for receiving the response
 # but only when using the DMAAP interface
-# REST or DMAAP is controlled of the base url of $ADAPTER
-# arg: (PA|ECS|CR|RC GET|PUT|POST|DELETE|GET_BATCH|PUT_BATCH|POST_BATCH|DELETE_BATCH <url> [<file>]) | (PA|ECS RESPONSE <correlation-id>)
+# REST or DMAAP is controlled of the base url of $XX_ADAPTER
+# arg: (PA|ECS|CR|RC GET|PUT|POST|DELETE|GET_BATCH|PUT_BATCH|POST_BATCH|DELETE_BATCH <url>|<correlation-id> [<file>]) | (PA|ECS RESPONSE <correlation-id>)
 # (Not for test scripts)
 __do_curl_to_api() {
        TIMESTAMP=$(date "+%Y-%m-%d %H:%M:%S")
     echo " (${BASH_LINENO[0]}) - ${TIMESTAMP}: ${FUNCNAME[0]}" $@ >> $HTTPLOG
        paramError=0
-
+       input_url=$3
     if [ $# -gt 0 ]; then
         if [ $1 == "PA" ]; then
-            __ADAPTER=$ADAPTER
-            __RESTBASE=$RESTBASE
-            __RESTBASE_SECURE=$RESTBASE_SECURE
+                       __ADAPTER=$PA_ADAPTER
+                       __ADAPTER_TYPE=$PA_ADAPTER_TYPE
             __RETRY_CODES=$AGENT_RETRY_CODES
+                       if [ $PMS_VERSION != "V1" ]; then
+                               input_url=$PMS_API_PREFIX$3
+                       fi
         elif [ $1 == "ECS" ]; then
-            __ADAPTER=$ECS_ADAPTER
-            __RESTBASE=$ECS_RESTBASE
-            __RESTBASE_SECURE=$ECS_RESTBASE_SECURE
+                       __ADAPTER=$ECS_ADAPTER
+                       __ADAPTER_TYPE=$ECS_ADAPTER_TYPE
             __RETRY_CODES=$ECS_RETRY_CODES
                elif [ $1 == "CR" ]; then
-                   __ADAPTER=$CR_ADAPTER
-            __RESTBASE=$CR_RESTBASE
-            __RESTBASE_SECURE=$CR_RESTBASE_SECURE
+                       __ADAPTER=$CR_ADAPTER
+                       __ADAPTER_TYPE=$CR_ADAPTER_TYPE
             __RETRY_CODES=""
                elif [ $1 == "RC" ]; then
-                   __ADAPTER=$RC_ADAPTER
-            __RESTBASE=$RC_RESTBASE
-            __RESTBASE_SECURE=$RC_RESTBASE_SECURE
+                       __ADAPTER=$RC_ADAPTER
+                       __ADAPTER_TYPE=$RC_ADAPTER_TYPE
             __RETRY_CODES=""
         else
             paramError=1
         fi
+               if [ $__ADAPTER_TYPE == "MR-HTTP" ]; then
+                       __ADAPTER=$MR_ADAPTER_HTTP
+               fi
+               if [ $__ADAPTER_TYPE == "MR-HTTPS" ]; then
+                       __ADAPTER=$MR_ADAPTER_HTTPS
+               fi
     fi
     if [ $# -lt 3 ] || [ $# -gt 4 ]; then
                paramError=1
@@ -98,7 +103,8 @@ __do_curl_to_api() {
                        if [ $# -ne 3 ]; then
                                paramError=1
                        fi
-                       if [ $__ADAPTER == $__RESTBASE ] || [ $__ADAPTER == $__RESTBASE_SECURE ]; then
+                       #if [ $__ADAPTER == $__RESTBASE ] || [ $__ADAPTER == $__RESTBASE_SECURE ]; then
+                       if [ $__ADAPTER_TYPE == "REST" ]; then
                                paramError=1
                        fi
                else
@@ -115,8 +121,9 @@ __do_curl_to_api() {
         return 1
     fi
 
-    if [ $__ADAPTER == $__RESTBASE ] || [ $__ADAPTER == $__RESTBASE_SECURE ]; then
-        url=" "${__ADAPTER}${3}
+    #if [ $__ADAPTER == $__RESTBASE ] || [ $__ADAPTER == $__RESTBASE_SECURE ]; then
+       if [ $__ADAPTER_TYPE == "REST" ]; then
+        url=" "${__ADAPTER}${input_url}
         oper=" -X "$oper
         curlString="curl -k "${oper}${timeout}${httpcode}${accept}${content}${url}${file}
         echo " CMD: "$curlString >> $HTTPLOG
@@ -156,7 +163,7 @@ __do_curl_to_api() {
         return 0
     else
                if [ $oper != "RESPONSE" ]; then
-                       requestUrl=$3
+                       requestUrl=$input_url
                        if [ $2 == "PUT" ] && [ $# -eq 4 ]; then
                                payload="$(cat $4 | tr -d '\n' | tr -d ' ' )"
                                echo "payload: "$payload >> $HTTPLOG
@@ -165,7 +172,7 @@ __do_curl_to_api() {
                                echo " FILE: $(cat $4)" >> $HTTPLOG
                        fi
                        #urlencode the request url since it will be carried by send-request url
-                       requestUrl=$(python3 -c "from __future__ import print_function; import urllib.parse, sys; print(urllib.parse.quote(sys.argv[1]))"  "$3")
+                       requestUrl=$(python3 -c "from __future__ import print_function; import urllib.parse, sys; print(urllib.parse.quote(sys.argv[1]))"  "$input_url")
                        url=" "${__ADAPTER}"/send-request?url="${requestUrl}"&operation="${oper}
                        curlString="curl -k -X POST${timeout}${httpcode}${content}${url}${file}"
                        echo " CMD: "$curlString >> $HTTPLOG
diff --git a/test/common/clean_kube.sh b/test/common/clean_kube.sh
new file mode 100755 (executable)
index 0000000..ea17eee
--- /dev/null
@@ -0,0 +1,91 @@
+#!/bin/bash
+
+#  ============LICENSE_START===============================================
+#  Copyright (C) 2021 Nordix Foundation. 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=================================================
+
+# Script to clean all resources from kubernetes having the label 'autotest', i.e started by autotest
+
+BOLD="\033[1m"
+EBOLD="\033[0m"
+RED="\033[31m\033[1m"
+ERED="\033[0m"
+GREEN="\033[32m\033[1m"
+EGREEN="\033[0m"
+YELLOW="\033[33m\033[1m"
+EYELLOW="\033[0m"
+SAMELINE="\033[0K\r"
+
+__kube_delete_all_resources() {
+       echo "Deleting all from namespace: "$1
+       namespace=$1
+       resources="deployments replicaset statefulset services pods configmaps pvc"
+       deleted_resourcetypes=""
+       for restype in $resources; do
+               result=$(kubectl get $restype -n $namespace -o jsonpath='{.items[?(@.metadata.labels.autotest)].metadata.name}')
+               if [ $? -eq 0 ] && [ ! -z "$result" ]; then
+                       deleted_resourcetypes=$deleted_resourcetypes" "$restype
+                       for resid in $result; do
+                               if [ $restype == "replicaset" ] || [ $restype == "statefulset" ]; then
+                                       kubectl scale  $restype $resid -n $namespace --replicas=0 1> /dev/null 2> /dev/null
+                                       T_START=$SECONDS
+                                       count=1
+                                       while [ $count -ne 0 ]; do
+                                               count=$(kubectl get $restype $resid  -n $namespace -o jsonpath='{.status.replicas}' 2> /dev/null)
+                                               echo -ne "  Scaling $restype $resid from namespace $namespace with label autotest to 0,count=$count....$(($SECONDS-$T_START)) seconds"$SAMELINE
+                                               if [ $? -eq 0 ] && [ ! -z "$count" ]; then
+                                                       sleep 0.5
+                                               else
+                                                       count=0
+                                               fi
+                                       done
+                                       echo -e "  Scaled $restype $resid from namespace $namespace with label $labelname=$labelid to 0,count=$count....$(($SECONDS-$T_START)) seconds$GREEN OK $EGREEN"
+                               fi
+                               echo -ne "  Deleting $restype $resid from namespace $namespace with label autotest "$SAMELINE
+                               kubectl delete $restype $resid -n $namespace 1> /dev/null 2> /dev/null
+                               if [ $? -eq 0 ]; then
+                                       echo -e "  Deleted $restype $resid from namespace $namespace with label autotest $GREEN OK $EGREEN"
+                               else
+                                       echo -e "  Deleted $restype $resid from namespace $namespace with label autotest $GREEN Does not exist - OK $EGREEN"
+                               fi
+                               #fi
+                       done
+               fi
+       done
+       if [ ! -z "$deleted_resourcetypes" ]; then
+               for restype in $deleted_resources; do
+                       echo -ne "  Waiting for $restype in namespace $namespace with label autotest to be deleted..."$SAMELINE
+                       T_START=$SECONDS
+                       result="dummy"
+                       while [ ! -z "$result" ]; do
+                               sleep 0.5
+                               result=$(kubectl get $restype -n $namespace -o jsonpath='{.items[?(@.metadata.labels.autotest)].metadata.name}')
+                               echo -ne "  Waiting for $restype in namespace $namespace with label autotest to be deleted...$(($SECONDS-$T_START)) seconds "$SAMELINE
+                               if [ -z "$result" ]; then
+                                       echo -e " Waiting for $restype in namespace $namespace with label autotest to be deleted...$(($SECONDS-$T_START)) seconds $GREEN OK $EGREEN"
+                               elif [ $(($SECONDS-$T_START)) -gt 300 ]; then
+                                       echo -e " Waiting for $restype in namespace $namespace with label autotest to be deleted...$(($SECONDS-$T_START)) seconds $RED Failed $ERED"
+                                       result=""
+                               fi
+                       done
+               done
+       fi
+}
+echo "Will remove all kube resources marked with label 'autotest'"
+__kube_delete_all_resources nonrtric
+__kube_delete_all_resources nonrtric-ft
+__kube_delete_all_resources onap
+
+echo "Done"
\ No newline at end of file
diff --git a/test/common/consul_cbs_functions.sh b/test/common/consul_cbs_functions.sh
new file mode 100644 (file)
index 0000000..a3c08fa
--- /dev/null
@@ -0,0 +1,219 @@
+#!/bin/bash
+
+#  ============LICENSE_START===============================================
+#  Copyright (C) 2020 Nordix Foundation. 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=================================================
+#
+
+# This is a script that contains container/service management functions and test functions for Consul/CBS
+
+CONSUL_PATH="http://$LOCALHOST:$CONSUL_EXTERNAL_PORT"
+
+####################
+### Consul functions
+####################
+
+# Function to load config from a file into consul for the Policy Agent
+# arg: <json-config-file>
+# (Function for test scripts)
+consul_config_app() {
+
+       echo -e $BOLD"Configuring Consul"$EBOLD
+
+       if [ $# -ne 1 ]; then
+               ((RES_CONF_FAIL++))
+       __print_err "need one arg,  <json-config-file>" $@
+               exit 1
+       fi
+
+       echo " Loading config for "$POLICY_AGENT_APP_NAME" from "$1
+
+       curlString="$LOCALHOST_HTTP:${CONSUL_EXTERNAL_PORT}/v1/kv/${POLICY_AGENT_CONFIG_KEY}?dc=dc1 -X PUT -H Accept:application/json -H Content-Type:application/json -H X-Requested-With:XMLHttpRequest --data-binary @"$1
+       result=$(__do_curl "$curlString")
+       if [ $? -ne 0 ]; then
+               echo -e $RED" FAIL - json config could not be loaded to consul" $ERED
+               ((RES_CONF_FAIL++))
+               return 1
+       fi
+       body="$(__do_curl $LOCALHOST_HTTP:$CBS_EXTERNAL_PORT/service_component_all/$POLICY_AGENT_CONFIG_KEY)"
+       echo $body > "./tmp/.output"$1
+
+       if [ $? -ne 0 ]; then
+               echo -e $RED" FAIL - json config could not be loaded from consul/cbs, contents cannot be checked." $ERED
+               ((RES_CONF_FAIL++))
+               return 1
+       else
+               targetJson=$(< $1)
+               targetJson="{\"config\":"$targetJson"}"
+               echo "TARGET JSON: $targetJson" >> $HTTPLOG
+               res=$(python3 ../common/compare_json.py "$targetJson" "$body")
+               if [ $res -ne 0 ]; then
+                       echo -e $RED" FAIL - policy json config read from consul/cbs is not equal to the intended json config...." $ERED
+                       ((RES_CONF_FAIL++))
+                       return 1
+               else
+                       echo -e $GREEN" Config loaded ok to consul"$EGREEN
+               fi
+       fi
+
+       echo ""
+
+}
+
+# Function to perpare the consul configuration according to the current simulator configuration
+# args: SDNC|NOSDNC <output-file>
+# (Function for test scripts)
+prepare_consul_config() {
+       echo -e $BOLD"Prepare Consul config"$EBOLD
+
+       echo " Writing consul config for "$POLICY_AGENT_APP_NAME" to file: "$2
+
+       if [ $# != 2 ];  then
+               ((RES_CONF_FAIL++))
+       __print_err "need two args,  SDNC|NOSDNC <output-file>" $@
+               exit 1
+       fi
+
+       if [ $1 == "SDNC" ]; then
+               echo -e " Config$BOLD including SDNC$EBOLD configuration"
+       elif [ $1 == "NOSDNC" ];  then
+               echo -e " Config$BOLD excluding SDNC$EBOLD configuration"
+       else
+               ((RES_CONF_FAIL++))
+       __print_err "need two args,  SDNC|NOSDNC <output-file>" $@
+               exit 1
+       fi
+
+       config_json="\n            {"
+       if [ $1 == "SDNC" ]; then
+               config_json=$config_json"\n   \"controller\": ["
+               config_json=$config_json"\n                     {"
+               config_json=$config_json"\n                       \"name\": \"$SDNC_APP_NAME\","
+               config_json=$config_json"\n                       \"baseUrl\": \"$SDNC_SERVICE_PATH\","
+               config_json=$config_json"\n                       \"userName\": \"$SDNC_USER\","
+               config_json=$config_json"\n                       \"password\": \"$SDNC_PWD\""
+               config_json=$config_json"\n                     }"
+               config_json=$config_json"\n   ],"
+       fi
+
+       config_json=$config_json"\n   \"streams_publishes\": {"
+       config_json=$config_json"\n                            \"dmaap_publisher\": {"
+       config_json=$config_json"\n                              \"type\": \"message-router\","
+       config_json=$config_json"\n                              \"dmaap_info\": {"
+       config_json=$config_json"\n                                \"topic_url\": \"$MR_SERVICE_PATH$MR_WRITE_URL\""
+       config_json=$config_json"\n                              }"
+       config_json=$config_json"\n                            }"
+       config_json=$config_json"\n   },"
+       config_json=$config_json"\n   \"streams_subscribes\": {"
+       config_json=$config_json"\n                             \"dmaap_subscriber\": {"
+       config_json=$config_json"\n                               \"type\": \"message-router\","
+       config_json=$config_json"\n                               \"dmaap_info\": {"
+       config_json=$config_json"\n                                   \"topic_url\": \"$MR_SERVICE_PATH$MR_READ_URL\""
+       config_json=$config_json"\n                                 }"
+       config_json=$config_json"\n                               }"
+       config_json=$config_json"\n   },"
+
+       config_json=$config_json"\n   \"ric\": ["
+
+       if [ $RUNMODE == "KUBE" ]; then
+               result=$(kubectl get pods -n $KUBE_NONRTRIC_NAMESPACE -o jsonpath='{.items[?(@.metadata.labels.autotest=="RICSIM")].metadata.name}')
+               rics=""
+               ric_cntr=0
+               if [ $? -eq 0 ] && [ ! -z "$result" ]; then
+                       for im in $result; do
+                               if [[ $im != *"-0" ]]; then
+                                       ric_subdomain=$(kubectl get pod $im -n $KUBE_NONRTRIC_NAMESPACE -o jsonpath='{.spec.subdomain}')
+                                       rics=$rics" "$im"."$ric_subdomain".nonrtric"
+                                       let ric_cntr=ric_cntr+1
+                               fi
+                       done
+               fi
+               if [ $ric_cntr -eq 0 ]; then
+                       echo $YELLOW"Warning: No rics found for the configuration"$EYELLOW
+               fi
+       else
+               rics=$(docker ps | grep $RIC_SIM_PREFIX | awk '{print $NF}')
+
+               if [ $? -ne 0 ] || [ -z "$rics" ]; then
+                       echo -e $RED" FAIL - the names of the running RIC Simulator cannot be retrieved." $ERED
+                       ((RES_CONF_FAIL++))
+                       return 1
+               fi
+       fi
+       cntr=0
+       for ric in $rics; do
+               if [ $cntr -gt 0 ]; then
+                       config_json=$config_json"\n          ,"
+               fi
+               config_json=$config_json"\n          {"
+               if [ $RUNMODE == "KUBE" ]; then
+                       ric_id=${ric%.*.*} #extract pod id from full hosthame
+                       ric_id=$(echo "$ric_id" | tr '-' '_')
+               else
+                       ric_id=$ric
+               fi
+               config_json=$config_json"\n            \"name\": \"$ric_id\","
+               config_json=$config_json"\n            \"baseUrl\": \"$RIC_SIM_HTTPX://$ric:$RIC_SIM_PORT\","
+               if [ $1 == "SDNC" ]; then
+                       config_json=$config_json"\n            \"controller\": \"$SDNC_APP_NAME\","
+               fi
+               config_json=$config_json"\n            \"managedElementIds\": ["
+               config_json=$config_json"\n              \"me1_$ric_id\","
+               config_json=$config_json"\n              \"me2_$ric_id\""
+               config_json=$config_json"\n            ]"
+               config_json=$config_json"\n          }"
+               let cntr=cntr+1
+       done
+
+       config_json=$config_json"\n           ]"
+       config_json=$config_json"\n}"
+
+       if [ $RUNMODE == "KUBE" ]; then
+               config_json="{\"config\":"$config_json"}"
+       fi
+
+       printf "$config_json">$2
+
+       echo ""
+}
+
+# Start Consul and CBS
+# args: -
+# (Function for test scripts)
+start_consul_cbs() {
+
+       echo -e $BOLD"Starting $CONSUL_DISPLAY_NAME and $CBS_DISPLAY_NAME"$EBOLD
+       __check_included_image 'CONSUL'
+       if [ $? -eq 1 ]; then
+               echo -e $RED"The Consul image has not been checked for this test run due to arg to the test script"$ERED
+               echo -e $RED"Consul will not be started"$ERED
+               exit
+       fi
+       export CONSUL_APP_NAME
+       export CONSUL_INTERNAL_PORT
+       export CONSUL_EXTERNAL_PORT
+       export CBS_APP_NAME
+       export CBS_INTERNAL_PORT
+       export CBS_EXTERNAL_PORT
+       export CONSUL_HOST
+
+       __start_container $CONSUL_CBS_COMPOSE_DIR NODOCKERARGS 2 $CONSUL_APP_NAME $CBS_APP_NAME
+
+       __check_service_start $CONSUL_APP_NAME "http://"$LOCALHOST_NAME":"$CONSUL_EXTERNAL_PORT$CONSUL_ALIVE_URL
+       __check_service_start $CBS_APP_NAME "http://"$LOCALHOST_NAME":"$CBS_EXTERNAL_PORT$CBS_ALIVE_URL
+
+       echo ""
+}
+
diff --git a/test/common/control_panel_api_functions.sh b/test/common/control_panel_api_functions.sh
new file mode 100644 (file)
index 0000000..9f179a1
--- /dev/null
@@ -0,0 +1,172 @@
+#!/bin/bash
+
+#  ============LICENSE_START===============================================
+#  Copyright (C) 2020 Nordix Foundation. 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=================================================
+#
+
+# This is a script that contains container/service management function
+# and test functions for Control Panel
+
+## Access to control panel
+# Host name may be changed if app started by kube
+# Direct access from script
+CP_HTTPX="http"
+CP_HOST_NAME=$LOCALHOST_NAME
+CP_PATH=$CP_HTTPX"://"$CP_HOST_NAME":"$CONTROL_PANEL_EXTERNAL_PORT
+
+###########################
+### Control Panel functions
+###########################
+
+# Set http as the protocol to use for all communication to the Control Panel
+# args: -
+# (Function for test scripts)
+use_control_panel_http() {
+       echo -e $BOLD"Control Panel, CP, protocol setting"$EBOLD
+       echo -e " Using $BOLD http $EBOLD towards CP"
+       CP_HTTPX="http"
+       CP_PATH=$CP_HTTPX"://"$CP_HOST_NAME":"$CONTROL_PANEL_EXTERNAL_PORT
+       echo ""
+}
+
+# Set https as the protocol to use for all communication to the Control Panel
+# args: -
+# (Function for test scripts)
+use_control_panel_https() {
+       echo -e $BOLD"Control Panel, CP, protocol setting"$EBOLD
+       echo -e " Using $BOLD https $EBOLD towards CP"
+       CP_HTTPX="https"
+       CP_PATH=$CP_HTTPX"://"$CP_HOST_NAME":"$CONTROL_PANEL_EXTERNAL_SECURE_PORT
+       echo ""
+}
+
+# Start the Control Panel container
+# args: -
+# (Function for test scripts)
+start_control_panel() {
+
+       echo -e $BOLD"Starting $CONTROL_PANEL_DISPLAY_NAME"$EBOLD
+
+       if [ $RUNMODE == "KUBE" ]; then
+
+               # Check if app shall be fully managed by the test script
+               __check_included_image "CP"
+               retcode_i=$?
+
+               # Check if app shall only be used by the testscipt
+               __check_prestarted_image "CP"
+               retcode_p=$?
+
+               if [ $retcode_i -ne 0 ] && [ $retcode_p -ne 0 ]; then
+                       echo -e $RED"The $CONTROL_PANEL_APP_NAME app is not included as managed nor prestarted in this test script"$ERED
+                       echo -e $RED"The $CONTROL_PANEL_APP_NAME will not be started"$ERED
+                       exit
+               fi
+               if [ $retcode_i -eq 0 ] && [ $retcode_p -eq 0 ]; then
+                       echo -e $RED"The $CONTROL_PANEL_APP_NAME app is included both as managed and prestarted in this test script"$ERED
+                       echo -e $RED"The $CONTROL_PANEL_APP_NAME will not be started"$ERED
+                       exit
+               fi
+
+               # Check if app shall be used - not managed - by the test script
+               __check_prestarted_image "CP"
+               if [ $? -eq 0 ]; then
+                       echo -e " Using existing $CONTROL_PANEL_APP_NAME deployment and service"
+                       echo " Setting CP replicas=1"
+                       __kube_scale deployment $CONTROL_PANEL_APP_NAME $KUBE_NONRTRIC_NAMESPACE 1
+               fi
+
+               if [ $retcode_i -eq 0 ]; then
+
+                       echo -e " Creating $CP_APP_NAME app and expose service"
+
+                       #Export all vars needed for service and deployment
+                       export CONTROL_PANEL_APP_NAME
+                       export KUBE_NONRTRIC_NAMESPACE
+                       export CONTROL_PANEL_IMAGE
+                       export CONTROL_PANEL_INTERNAL_PORT
+                       export CONTROL_PANEL_INTERNAL_SECURE_PORT
+                       export CONTROL_PANEL_EXTERNAL_PORT
+                       export CONTROL_PANEL_EXTERNAL_SECURE_PORT
+                       export CONTROL_PANEL_CONFIG_MOUNT_PATH
+                       export CONTROL_PANEL_CONFIG_FILE
+                       export CP_CONFIG_CONFIGMAP_NAME=$CONTROL_PANEL_APP_NAME"-config"
+
+                       export POLICY_AGENT_EXTERNAL_SECURE_PORT
+                       export ECS_EXTERNAL_SECURE_PORT
+                       export POLICY_AGENT_DOMAIN_NAME=$POLICY_AGENT_APP_NAME.$KUBE_NONRTRIC_NAMESPACE
+                       export ECS_DOMAIN_NAME=$ECS_APP_NAME.$KUBE_NONRTRIC_NAMESPACE
+
+                       #Check if nonrtric namespace exists, if not create it
+                       __kube_create_namespace $KUBE_NONRTRIC_NAMESPACE
+
+                       # Create config map for config
+                       datafile=$PWD/tmp/$CONTROL_PANEL_CONFIG_FILE
+                       #Add config to properties file
+                       envsubst < $1 > $datafile
+                       output_yaml=$PWD/tmp/cp_cfc.yaml
+                       __kube_create_configmap $CP_CONFIG_CONFIGMAP_NAME $KUBE_NONRTRIC_NAMESPACE autotest CP $datafile $output_yaml
+
+                       # Create service
+                       input_yaml=$SIM_GROUP"/"$CONTROL_PANEL_COMPOSE_DIR"/"svc.yaml
+                       output_yaml=$PWD/tmp/cp_svc.yaml
+                       __kube_create_instance service $CONTROL_PANEL_APP_NAME $input_yaml $output_yaml
+
+                       # Create app
+                       input_yaml=$SIM_GROUP"/"$CONTROL_PANEL_COMPOSE_DIR"/"app.yaml
+                       output_yaml=$PWD/tmp/cp_app.yaml
+                       __kube_create_instance app $CONTROL_PANEL_APP_NAME $input_yaml $output_yaml
+
+               fi
+
+               echo " Retrieving host and ports for service..."
+               CP_HOST_NAME=$(__kube_get_service_host $CONTROL_PANEL_APP_NAME $KUBE_NONRTRIC_NAMESPACE)
+
+               CONTROL_PANEL_EXTERNAL_PORT=$(__kube_get_service_port $CONTROL_PANEL_APP_NAME $KUBE_NONRTRIC_NAMESPACE "http")
+               CONTROL_PANEL_EXTERNAL_SECURE_PORT=$(__kube_get_service_port $CONTROL_PANEL_APP_NAME $KUBE_NONRTRIC_NAMESPACE "https")
+
+               echo " Host IP, http port, https port: $CP_HOST_NAME $CONTROL_PANEL_EXTERNAL_PORT $CONTROL_PANEL_EXTERNAL_SECURE_PORT"
+               if [ $CP_HTTPX == "http" ]; then
+                       CP_PATH=$CP_HTTPX"://"$CP_HOST_NAME":"$CONTROL_PANEL_EXTERNAL_PORT
+               else
+                       CP_PATH=$CP_HTTPX"://"$CP_HOST_NAME":"$CONTROL_PANEL_EXTERNAL_SECURE_PORT
+               fi
+
+               __check_service_start $CONTROL_PANEL_APP_NAME $CP_PATH$CONTROL_PANEL_ALIVE_URL
+       else
+               # Check if docker app shall be fully managed by the test script
+               __check_included_image 'CP'
+               if [ $? -eq 1 ]; then
+                       echo -e $RED"The Control Panel app is not included in this test script"$ERED
+                       echo -e $RED"The Control Panel will not be started"$ERED
+                       exit
+               fi
+
+               # Export needed vars for docker compose
+        export CONTROL_PANEL_APP_NAME
+        export CONTROL_PANEL_INTERNAL_PORT
+        export CONTROL_PANEL_EXTERNAL_PORT
+        export CONTROL_PANEL_INTERNAL_SECURE_PORT
+        export CONTROL_PANEL_EXTERNAL_SECURE_PORT
+        export DOCKER_SIM_NWNAME
+
+               __start_container $CONTROL_PANEL_COMPOSE_DIR NODOCKERARGS 1 $CONTROL_PANEL_APP_NAME
+
+               __check_service_start $CONTROL_PANEL_APP_NAME $CP_PATH$CONTROL_PANEL_ALIVE_URL
+       fi
+       echo ""
+}
+
index 4d568d7..9e60175 100644 (file)
 #  ============LICENSE_END=================================================
 #
 
-# This is a script that contains specific test functions for A1 Controller API
+# This is a script that contains container/service management functions and test functions for A1 Controller API
+
+SDNC_HTTPX="http"
+SDNC_HOST_NAME=$LOCALHOST_NAME
+SDNC_PATH=$SDNC_HTTPX"://"$SDNC_HOST_NAME":"$SDNC_EXTERNAL_PORT
+SDNC_API_PATH=$SDNC_HTTPX"://"$SDNC_USER":"$SDNC_PWD"@"$SDNC_HOST_NAME":"$SDNC_EXTERNAL_PORT$SDNC_API_URL
+#Docker/Kube internal path
+if [ $RUNMODE == "KUBE" ]; then
+       SDNC_SERVICE_PATH=$SDNC_HTTPX"://"$SDNC_APP_NAME":"$SDNC_EXTERNAL_PORT
+    #presume correct
+       SDNC_SERVICE_PATH=$SDNC_HTTPX"://"$SDNC_APP_NAME"."$KUBE_NONRTRIC_NAMESPACE":"$SDNC_EXTERNAL_PORT
+       #test
+       #SDNC_SERVICE_PATH=$SDNC_HTTPX"://"$SDNC_APP_NAME"."$KUBE_NONRTRIC_NAMESPACE":"$SDNC_EXTERNAL_PORT
+else
+       SDNC_SERVICE_PATH=$SDNC_HTTPX"://"$SDNC_APP_NAME":"$SDNC_INTERNAL_PORT
+fi
+
+use_sdnc_http() {
+       echo -e $BOLD"SDNC NB protocol setting"$EBOLD
+       echo -e " Using $BOLD http $EBOLD towards SDNC"
+       SDNC_HTTPX="http"
+       SDNC_PATH=$SDNC_HTTPX"://"$SDNC_HOST_NAME":"$SDNC_EXTERNAL_PORT
+       SDNC_API_PATH=$SDNC_HTTPX"://"$SDNC_USER":"$SDNC_PWD"@"$SDNC_HOST_NAME":"$SDNC_EXTERNAL_PORT$SDNC_API_URL
+       if [ $RUNMODE == "KUBE" ]; then
+               #presume correct
+               SDNC_SERVICE_PATH=$SDNC_HTTPX"://"$SDNC_APP_NAME"."$KUBE_NONRTRIC_NAMESPACE":"$SDNC_EXTERNAL_PORT
+               #test
+               #SDNC_SERVICE_PATH=$SDNC_HTTPX"://"$SDNC_APP_NAME":"$SDNC_EXTERNAL_PORT
+       else
+               SDNC_SERVICE_PATH=$SDNC_HTTPX"://"$SDNC_APP_NAME":"$SDNC_INTERNAL_PORT
+       fi
+       echo ""
+}
+
+use_sdnc_https() {
+       echo -e $BOLD"SDNC NB protocol setting"$EBOLD
+       echo -e " Using $BOLD https $EBOLD towards SDNC"
+       SDNC_HTTPX="https"
+       SDNC_PATH=$SDNC_HTTPX"://"$SDNC_HOST_NAME":"$SDNC_EXTERNAL_SECURE_PORT
+       SDNC_API_PATH=$SDNC_HTTPX"://"$SDNC_USER":"$SDNC_PWD"@"$SDNC_HOST_NAME":"$SDNC_EXTERNAL_SECURE_PORT$SDNC_API_URL
+       if [ $RUNMODE == "KUBE" ]; then
+               #presume correct
+               SDNC_SERVICE_PATH=$SDNC_HTTPX"://"$SDNC_APP_NAME"."$KUBE_NONRTRIC_NAMESPACE":"$SDNC_EXTERNAL_SECURE_PORT
+               #test
+               #SDNC_SERVICE_PATH=$SDNC_HTTPX"://"$SDNC_APP_NAME":"$SDNC_EXTERNAL_SECURE_PORT
+       else
+               SDNC_SERVICE_PATH=$SDNC_HTTPX"://"$SDNC_APP_NAME":"$SDNC_INTERNAL_SECURE_PORT
+       fi
+       echo ""
+}
+
+##################
+### SDNC functions
+##################
+
+# Start the SDNC A1 Controller
+# args: -
+# (Function for test scripts)
+start_sdnc() {
+
+       echo -e $BOLD"Starting $SDNC_DISPLAY_NAME"$EBOLD
+
+       if [ $RUNMODE == "KUBE" ]; then
+
+               # Check if app shall be fully managed by the test script
+               __check_included_image "SDNC"
+               retcode_i=$?
+
+               # Check if app shall only be used by the testscipt
+               __check_prestarted_image "SDNC"
+               retcode_p=$?
+
+               if [ $retcode_i -ne 0 ] && [ $retcode_p -ne 0 ]; then
+                       echo -e $RED"The $SDNC_APP_NAME app is not included as managed nor prestarted in this test script"$ERED
+                       echo -e $RED"The $SDNC_APP_NAME will not be started"$ERED
+                       exit
+               fi
+               if [ $retcode_i -eq 0 ] && [ $retcode_p -eq 0 ]; then
+                       echo -e $RED"The $SDNC_APP_NAME app is included both as managed and prestarted in this test script"$ERED
+                       echo -e $RED"The $SDNC_APP_NAME will not be started"$ERED
+                       exit
+               fi
+
+
+               if [ $retcode_p -eq 0 ]; then
+                       echo -e " Using existing $SDNC_APP_NAME deployment and service"
+                       echo " Setting SDNC replicas=1"
+                       __kube_scale deployment $SDNC_APP_NAME $KUBE_NONRTRIC_NAMESPACE 1
+               fi
+
+                               # Check if app shall be fully managed by the test script
+               if [ $retcode_i -eq 0 ]; then
+
+                       echo -e " Creating $SDNC_APP_NAME app and expose service"
+
+                       #Check if nonrtric namespace exists, if not create it
+                       __kube_create_namespace $KUBE_NONRTRIC_NAMESPACE
+
+                       export KUBE_NONRTRIC_NAMESPACE
+                       export SDNC_APP_NAME
+                       export SDNC_A1_CONTROLLER_IMAGE
+                       export SDNC_INTERNAL_PORT
+                       export SDNC_EXTERNAL_PORT
+                       export SDNC_INTERNAL_SECURE_PORT
+                       export SDNC_EXTERNAL_SECURE_PORT
+                       export SDNC_A1_TRUSTSTORE_PASSWORD
+                       export SDNC_DB_APP_NAME
+                       export SDNC_DB_IMAGE
+
+                       # Create service
+                       input_yaml=$SIM_GROUP"/"$SDNC_COMPOSE_DIR"/"svc.yaml
+                       output_yaml=$PWD/tmp/sdnc_svc.yaml
+                       __kube_create_instance service $SDNC_APP_NAME $input_yaml $output_yaml
+
+                       # Create app
+                       input_yaml=$SIM_GROUP"/"$SDNC_COMPOSE_DIR"/"app.yaml
+                       output_yaml=$PWD/tmp/sdnc_app.yaml
+                       __kube_create_instance app $SDNC_APP_NAME $input_yaml $output_yaml
+
+               fi
+
+        echo " Retrieving host and ports for service..."
+               SDNC_HOST_NAME=$(__kube_get_service_host $SDNC_APP_NAME $KUBE_NONRTRIC_NAMESPACE)
+               SDNC_EXTERNAL_PORT=$(__kube_get_service_port $SDNC_APP_NAME $KUBE_NONRTRIC_NAMESPACE "http")
+               SDNC_EXTERNAL_SECURE_PORT=$(__kube_get_service_port $SDNC_APP_NAME $KUBE_NONRTRIC_NAMESPACE "https")
+
+               echo " Host IP, http port, https port: $SDNC_HOST_NAME $SDNC_EXTERNAL_PORT $SDNC_EXTERNAL_SECURE_PORT"
+
+        if [ $SDNC_HTTPX == "http" ]; then
+                       SDNC_PATH=$SDNC_HTTPX"://"$SDNC_HOST_NAME":"$SDNC_EXTERNAL_PORT
+                       SDNC_API_PATH=$SDNC_HTTPX"://"$SDNC_USER":"$SDNC_PWD"@"$SDNC_HOST_NAME":"$SDNC_EXTERNAL_PORT$SDNC_API_URL
+            #presume correct
+                       SDNC_SERVICE_PATH=$SDNC_HTTPX"://"$SDNC_APP_NAME"."$KUBE_NONRTRIC_NAMESPACE":"$SDNC_EXTERNAL_PORT
+                       #test
+                       #SDNC_SERVICE_PATH=$SDNC_HTTPX"://"$SDNC_APP_NAME":"$SDNC_EXTERNAL_PORT
+               else
+                       SDNC_PATH=$SDNC_HTTPX"://"$SDNC_HOST_NAME":"$SDNC_EXTERNAL_SECURE_PORT
+                       SDNC_API_PATH=$SDNC_HTTPX"://"$SDNC_USER":"$SDNC_PWD"@"$SDNC_HOST_NAME":"$SDNC_EXTERNAL_SECURE_PORT$SDNC_API_URL
+            #presume correct
+                       SDNC_SERVICE_PATH=$SDNC_HTTPX"://"$SDNC_APP_NAME"."$KUBE_NONRTRIC_NAMESPACE":"$SDNC_EXTERNAL_SECURE_PORT
+                       #test
+                       #SDNC_SERVICE_PATH=$SDNC_HTTPX"://"$SDNC_APP_NAME":"$SDNC_EXTERNAL_SECURE_PORT
+               fi
+
+               __check_service_start $SDNC_APP_NAME $SDNC_PATH$SDNC_ALIVE_URL
+       else
+
+               __check_included_image 'SDNC'
+               if [ $? -eq 1 ]; then
+                       echo -e $RED"The SDNC A1 Controller app is not included in this test script"$ERED
+                       echo -e $RED"The Policy Agent will not be started"$ERED
+                       exit
+               fi
+
+               export SDNC_DB_APP_NAME
+        export SDNC_APP_NAME
+        export SDNC_INTERNAL_PORT
+        export SDNC_EXTERNAL_PORT
+        export SDNC_INTERNAL_SECURE_PORT
+        export SDNC_EXTERNAL_SECURE_PORT
+        export SDNC_A1_TRUSTSTORE_PASSWORD
+        export DOCKER_SIM_NWNAME
+
+               __start_container $SDNC_COMPOSE_DIR NODOCKERARGS 1 $SDNC_APP_NAME
+
+               __check_service_start $SDNC_APP_NAME $SDNC_PATH$SDNC_ALIVE_URL
+       fi
+    echo ""
+    return 0
+}
+
+
 
 # Generic function to query the RICs via the A1-controller API.
 # args: <operation> <url> [<body>]
@@ -44,7 +215,7 @@ __do_curl_to_controller() {
        payload="./tmp/.sdnc.payload.json"
     echo "$json" > $payload
     echo "  FILE ($payload) : $json"  >> $HTTPLOG
-    curlString="curl -skw %{http_code} -X POST $SDNC_HTTPX://$SDNC_USER:$SDNC_PWD@localhost:$SDNC_LOCAL_PORT$SDNC_API_URL$1 -H accept:application/json -H Content-Type:application/json --data-binary @$payload"
+    curlString="curl -skw %{http_code} -X POST $SDNC_API_PATH$1 -H accept:application/json -H Content-Type:application/json --data-binary @$payload"
     echo "  CMD: "$curlString >> $HTTPLOG
     res=$($curlString)
     retcode=$?
@@ -77,12 +248,16 @@ __do_curl_to_controller() {
 controller_api_get_A1_policy_ids() {
        __log_test_start $@
 
+       ric_id=$3
+       if [ $RUNMODE == "KUBE" ]; then
+               ric_id=$(get_kube_sim_host $3)
+       fi
     paramError=1
     if [ $# -gt 3 ] && [ $2 == "OSC" ]; then
-        url="$RIC_SIM_HTTPX://$3:$RIC_SIM_PORT/a1-p/policytypes/$4/policies"
+        url="$RIC_SIM_HTTPX://$ric_id:$RIC_SIM_PORT/a1-p/policytypes/$4/policies"
                paramError=0
     elif [ $# -gt 2 ] && [ $2 == "STD" ]; then
-        url="$RIC_SIM_HTTPX://$3:$RIC_SIM_PORT/A1-P/v1/policies"
+        url="$RIC_SIM_HTTPX://$ric_id:$RIC_SIM_PORT/A1-P/v1/policies"
         paramError=0
        fi
 
@@ -139,9 +314,13 @@ controller_api_get_A1_policy_ids() {
 controller_api_get_A1_policy_type() {
        __log_test_start $@
 
+       ric_id=$3
+       if [ $RUNMODE == "KUBE" ]; then
+               ric_id=$(get_kube_sim_host $3)
+       fi
     paramError=1
     if [ $# -gt 3 ] && [ $2 == "OSC" ]; then
-        url="$RIC_SIM_HTTPX://$3:$RIC_SIM_PORT/a1-p/policytypes/$4"
+        url="$RIC_SIM_HTTPX://$ric_id:$RIC_SIM_PORT/a1-p/policytypes/$4"
                paramError=0
        fi
 
@@ -189,12 +368,16 @@ controller_api_get_A1_policy_type() {
 controller_api_delete_A1_policy() {
        __log_test_start $@
 
+       ric_id=$3
+       if [ $RUNMODE == "KUBE" ]; then
+               ric_id=$(get_kube_sim_host $3)
+       fi
     paramError=1
     if [ $# -eq 5 ] && [ $2 == "OSC" ]; then
-        url="$RIC_SIM_HTTPX://$3:$RIC_SIM_PORT/a1-p/policytypes/$4/policies/$UUID$5"
+        url="$RIC_SIM_HTTPX://$ric_id:$RIC_SIM_PORT/a1-p/policytypes/$4/policies/$UUID$5"
                paramError=0
     elif [ $# -eq 4 ] && [ $2 == "STD" ]; then
-        url="$RIC_SIM_HTTPX://$3:$RIC_SIM_PORT/A1-P/v1/policies/$UUID$4"
+        url="$RIC_SIM_HTTPX://$ric_id:$RIC_SIM_PORT/A1-P/v1/policies/$UUID$4"
         paramError=0
        fi
 
@@ -227,14 +410,18 @@ controller_api_delete_A1_policy() {
 controller_api_put_A1_policy() {
        __log_test_start $@
 
+       ric_id=$3
+       if [ $RUNMODE == "KUBE" ]; then
+               ric_id=$(get_kube_sim_host $3)
+       fi
     paramError=1
     if [ $# -eq 6 ] && [ $2 == "OSC" ]; then
-        url="$RIC_SIM_HTTPX://$3:$RIC_SIM_PORT/a1-p/policytypes/$4/policies/$UUID$5"
+        url="$RIC_SIM_HTTPX://$ric_id:$RIC_SIM_PORT/a1-p/policytypes/$4/policies/$UUID$5"
         body=$(sed 's/XXX/'${5}'/g' $6)
 
                paramError=0
     elif [ $# -eq 5 ] && [ $2 == "STD" ]; then
-        url="$RIC_SIM_HTTPX://$3:$RIC_SIM_PORT/A1-P/v1/policies/$UUID$4"
+        url="$RIC_SIM_HTTPX://$ric_id:$RIC_SIM_PORT/A1-P/v1/policies/$UUID$4"
         body=$(sed 's/XXX/'${4}'/g' $5)
         paramError=0
        fi
@@ -269,10 +456,14 @@ controller_api_put_A1_policy() {
 controller_api_get_A1_policy_status() {
        __log_test_start $@
 
+       ric_id=$3
+       if [ $RUNMODE == "KUBE" ]; then
+               ric_id=$(get_kube_sim_host $3)
+       fi
     targetJson=""
     paramError=1
     if [ $# -ge 5 ] && [ $2 == "OSC" ]; then
-        url="$RIC_SIM_HTTPX://$3:$RIC_SIM_PORT/a1-p/policytypes/$4/policies/$UUID$5/status"
+        url="$RIC_SIM_HTTPX://$ric_id:$RIC_SIM_PORT/a1-p/policytypes/$4/policies/$UUID$5/status"
         if [ $# -gt 5 ]; then
             targetJson="{\"instance_status\":\"$6\""
             targetJson=$targetJson",\"has_been_deleted\":\"$7\""
@@ -280,7 +471,7 @@ controller_api_get_A1_policy_status() {
         fi
                paramError=0
     elif [ $# -ge 4 ] && [ $2 == "STD" ]; then
-        url="$RIC_SIM_HTTPX://$3:$RIC_SIM_PORT/A1-P/v1/policies/$UUID$4/status"
+        url="$RIC_SIM_HTTPX://$ric_id:$RIC_SIM_PORT/A1-P/v1/policies/$UUID$4/status"
         if [ $# -gt 4 ]; then
             targetJson="{\"enforceStatus\":\"$5\""
             if [ $# -eq 6 ]; then
index e2b9491..bf490fc 100644 (file)
 #  ============LICENSE_END=================================================
 #
 
-. ../common/api_curl.sh
-
-### Admin API functions for the Callback Reciver
-
-
-# Excute a curl cmd towards a Callback Reciver admin interface and check the response code.
-# args: <expected-response-code> <curl-cmd-string>
-__execute_curl_to_cr() {
-       echo ${FUNCNAME[1]} "line: "${BASH_LINENO[1]} >> $HTTPLOG
-       echo " CMD: $2" >> $HTTPLOG
-       res="$($2)"
-       echo " RESP: $res" >> $HTTPLOG
-       retcode=$?
-    if [ $retcode -ne 0 ]; then
-               ((RES_CONF_FAIL++))
-               echo " RETCODE: "$retcode
-        echo -e $RED" FAIL - fatal error when executing curl."$ERED
-        return 1
-    fi
-    status=${res:${#res}-3}
-    if [ $status -eq $1 ]; then
-        echo -e $GREEN" OK"$EGREEN
-        return 0
-    fi
-    echo -e $RED" FAIL - expected http response: "$1" but got http response: "$status $ERED
-       ((RES_CONF_FAIL++))
-    return 1
+# This is a script that contains container/service managemnt functions test functions for the Callback Reciver
+
+## Access to Callback Receiver
+# Host name may be changed if app started by kube
+# Direct access from script
+CR_HTTPX="http"
+CR_HOST_NAME=$LOCALHOST_NAME
+CR_PATH=$CR_HTTPX"://"$CR_HOST_NAME":"$CR_EXTERNAL_PORT
+#Docker/Kube internal path
+if [ $RUNMODE == "KUBE" ]; then
+       CR_SERVICE_PATH=$CR_HTTPX"://"$CR_APP_NAME"."$KUBE_SIM_NAMESPACE":"$CR_EXTERNAL_PORT$CR_APP_CALLBACK
+else
+       CR_SERVICE_PATH=$CR_HTTPX"://"$CR_APP_NAME":"$CR_INTERNAL_PORT$CR_APP_CALLBACK
+fi
+# CR_ADAPTER used for switching between REST and DMAAP (only REST supported currently)
+CR_ADAPTER_TYPE="REST"
+CR_ADAPTER=$CR_PATH
+
+################
+### CR functions
+################
+
+# Set http as the protocol to use for all communication to the Callback Receiver
+# args: -
+# (Function for test scripts)
+use_cr_http() {
+       echo -e $BOLD"CR protocol setting"$EBOLD
+       echo -e " Using $BOLD http $EBOLD towards CR"
+
+       CR_HTTPX="http"
+       CR_PATH=$CR_HTTPX"://"$CR_HOST_NAME":"$CR_EXTERNAL_PORT
+
+       #Docker/Kube internal path
+       if [ $RUNMODE == "KUBE" ]; then
+               CR_SERVICE_PATH=$CR_HTTPX"://"$CR_APP_NAME"."$KUBE_SIM_NAMESPACE":"$CR_EXTERNAL_PORT$CR_APP_CALLBACK
+       else
+               CR_SERVICE_PATH=$CR_HTTPX"://"$CR_APP_NAME":"$CR_INTERNAL_PORT$CR_APP_CALLBACK
+       fi
+       CR_ADAPTER_TYPE="REST"
+       CR_ADAPTER=$CR_PATH
+       echo ""
+}
+
+# Set https as the protocol to use for all communication to the Callback Receiver
+# args: -
+# (Function for test scripts)
+use_cr_https() {
+       echo -e $BOLD"CR protocol setting"$EBOLD
+       echo -e " Using $BOLD https $EBOLD towards CR"
+
+       CR_HTTPX="https"
+       CR_PATH=$CR_HTTPX"://"$CR_HOST_NAME":"$CR_EXTERNAL_SECURE_PORT
+
+       if [ $RUNMODE == "KUBE" ]; then
+               CR_SERVICE_PATH=$CR_HTTPX"://"$CR_APP_NAME"."$KUBE_SIM_NAMESPACE":"$CR_EXTERNAL_SECURE_PORT$CR_APP_CALLBACK
+       else
+               CR_SERVICE_PATH=$CR_HTTPX"://"$CR_APP_NAME":"$CR_INTERNAL_SECURE_PORT$CR_APP_CALLBACK
+       fi
+
+       CR_ADAPTER_TYPE="REST"
+       CR_ADAPTER=$CR_PATH
+       echo ""
+}
+
+# Start the Callback reciver in the simulator group
+# args: -
+# (Function for test scripts)
+start_cr() {
+
+       echo -e $BOLD"Starting $CR_DISPLAY_NAME"$EBOLD
+
+       if [ $RUNMODE == "KUBE" ]; then
+
+               # Check if app shall be fully managed by the test script
+               __check_included_image "CR"
+               retcode_i=$?
+
+               # Check if app shall only be used by the testscipt
+               __check_prestarted_image "CR"
+               retcode_p=$?
+
+               if [ $retcode_i -ne 0 ] && [ $retcode_p -ne 0 ]; then
+                       echo -e $RED"The $CR_APP_NAME app is not included as managed nor prestarted in this test script"$ERED
+                       echo -e $RED"The $CR_APP_NAME will not be started"$ERED
+                       exit
+               fi
+               if [ $retcode_i -eq 0 ] && [ $retcode_p -eq 0 ]; then
+                       echo -e $RED"The $CR_APP_NAME app is included both as managed and prestarted in this test script"$ERED
+                       echo -e $RED"The $CR_APP_NAME will not be started"$ERED
+                       exit
+               fi
+
+               # Check if app shall be used - not managed - by the test script
+               if [ $retcode_p -eq 0 ]; then
+                       echo -e " Using existing $CR_APP_NAME deployment and service"
+                       echo " Setting CR replicas=1"
+                       __kube_scale deployment $CR_APP_NAME $KUBE_SIM_NAMESPACE 1
+               fi
+
+               if [ $retcode_i -eq 0 ]; then
+                       echo -e " Creating $CR_APP_NAME deployment and service"
+                       export CR_APP_NAME
+                       export KUBE_SIM_NAMESPACE
+                       export CR_IMAGE
+                       export CR_INTERNAL_PORT
+                       export CR_INTERNAL_SECURE_PORT
+                       export CR_EXTERNAL_PORT
+                       export CR_EXTERNAL_SECURE_PORT
+
+                       __kube_create_namespace $KUBE_SIM_NAMESPACE
+
+                       # Create service
+                       input_yaml=$SIM_GROUP"/"$CR_COMPOSE_DIR"/"svc.yaml
+                       output_yaml=$PWD/tmp/cr_svc.yaml
+                       __kube_create_instance service $CR_APP_NAME $input_yaml $output_yaml
+
+                       # Create app
+                       input_yaml=$SIM_GROUP"/"$CR_COMPOSE_DIR"/"app.yaml
+                       output_yaml=$PWD/tmp/cr_app.yaml
+                       __kube_create_instance app $CR_APP_NAME $input_yaml $output_yaml
+
+               fi
+
+               echo " Retrieving host and ports for service..."
+               CR_HOST_NAME=$(__kube_get_service_host $CR_APP_NAME $KUBE_SIM_NAMESPACE)
+
+               CR_EXTERNAL_PORT=$(__kube_get_service_port $CR_APP_NAME $KUBE_SIM_NAMESPACE "http")
+               CR_EXTERNAL_SECURE_PORT=$(__kube_get_service_port $CR_APP_NAME $KUBE_SIM_NAMESPACE "https")
+
+               echo " Host IP, http port, https port: $CR_HOST_NAME $CR_EXTERNAL_PORT $CR_EXTERNAL_SECURE_PORT"
+               if [ $CR_HTTPX == "http" ]; then
+                       CR_PATH=$CR_HTTPX"://"$CR_HOST_NAME":"$CR_EXTERNAL_PORT
+                       CR_SERVICE_PATH=$CR_HTTPX"://"$CR_APP_NAME"."$KUBE_SIM_NAMESPACE":"$CR_EXTERNAL_PORT$CR_APP_CALLBACK
+               else
+                       CR_PATH=$CR_HTTPX"://"$CR_HOST_NAME":"$CR_EXTERNAL_SECURE_PORT
+                       CR_SERVICE_PATH=$CR_HTTPX"://"$CR_APP_NAME"."$KUBE_SIM_NAMESPACE":"$CR_EXTERNAL_SECURE_PORT$CR_APP_CALLBACK
+               fi
+               if [ $CR_ADAPTER_TYPE == "REST" ]; then
+                       CR_ADAPTER=$CR_PATH
+               fi
+
+               __check_service_start $CR_APP_NAME $CR_PATH$CR_ALIVE_URL
+
+               echo -ne " Service $CR_APP_NAME - reset  "$SAMELINE
+               result=$(__do_curl $CR_APP_NAME $CR_PATH/reset)
+               if [ $? -ne 0 ]; then
+                       echo -e " Service $CR_APP_NAME - reset  $RED Failed $ERED - will continue"
+               else
+                       echo -e " Service $CR_APP_NAME - reset  $GREEN OK $EGREEN"
+               fi
+       else
+               # Check if docker app shall be fully managed by the test script
+               __check_included_image 'CR'
+               if [ $? -eq 1 ]; then
+                       echo -e $RED"The Callback Receiver app is not included in this test script"$ERED
+                       echo -e $RED"The Callback Receiver will not be started"$ERED
+                       exit
+               fi
+
+               export CR_APP_NAME
+               export CR_INTERNAL_PORT
+               export CR_EXTERNAL_PORT
+               export CR_INTERNAL_SECURE_PORT
+               export CR_EXTERNAL_SECURE_PORT
+               export DOCKER_SIM_NWNAME
+
+               __start_container $CR_COMPOSE_DIR NODOCKERARGS 1 $CR_APP_NAME
+
+        __check_service_start $CR_APP_NAME $CR_PATH$CR_ALIVE_URL
+       fi
+       echo ""
 }
 
+
 # Tests if a variable value in the CR is equal to a target value and and optional timeout.
 # Arg: <variable-name> <target-value> - This test set pass or fail depending on if the variable is
 # equal to the target or not.
@@ -55,7 +200,7 @@ __execute_curl_to_cr() {
 # (Function for test scripts)
 cr_equal() {
        if [ $# -eq 2 ] || [ $# -eq 3 ]; then
-               __var_test "CR" "$LOCALHOST$CR_EXTERNAL_PORT/counter/" $1 "=" $2 $3
+               __var_test "CR" "$CR_PATH/counter/" $1 "=" $2 $3
        else
                __print_err "Wrong args to cr_equal, needs two or three args: <sim-param> <target-value> [ timeout ]" $@
        fi
index 6c43173..ba451e6 100644 (file)
 #  ============LICENSE_END=================================================
 #
 
-# This is a script that contains specific test functions for ECS NB/SB API
+# This is a script that contains container/service management functions and test functions for ECS
+
+## Access to ECS
+# Host name may be changed if app started by kube
+# Direct access
+ECS_HTTPX="http"
+ECS_HOST_NAME=$LOCALHOST_NAME
+ECS_PATH=$ECS_HTTPX"://"$ECS_HOST_NAME":"$ECS_EXTERNAL_PORT
+
+# ECS_ADAPTER used for switch between REST and DMAAP (only REST supported currently)
+ECS_ADAPTER_TYPE="REST"
+ECS_ADAPTER=$ECS_PATH
+
+# Make curl retries towards ECS for http response codes set in this env var, space separated list of codes
+ECS_RETRY_CODES=""
+
+###########################
+### ECS functions
+###########################
+
+# All calls to ECS will be directed to the ECS REST interface from now on
+# args: -
+# (Function for test scripts)
+use_ecs_rest_http() {
+       echo -e $BOLD"ECS protocol setting"$EBOLD
+       echo -e " Using $BOLD http $EBOLD and $BOLD REST $EBOLD towards ECS"
+       ECS_HTTPX="http"
+       ECS_PATH=$ECS_HTTPX"://"$ECS_HOST_NAME":"$ECS_EXTERNAL_PORT
+
+       ECS_ADAPTER_TYPE="REST"
+       ECS_ADAPTER=$ECS_PATH
+       echo ""
+}
+
+# All calls to ECS will be directed to the ECS REST interface from now on
+# args: -
+# (Function for test scripts)
+use_ecs_rest_https() {
+       echo -e $BOLD"ECS protocol setting"$EBOLD
+       echo -e " Using $BOLD https $EBOLD and $BOLD REST $EBOLD towards ECS"
+       ECS_HTTPX="https"
+       ECS_PATH=$ECS_HTTPX"://"$ECS_HOST_NAME":"$ECS_EXTERNAL_SECURE_PORT
+
+       ECS_ADAPTER_TYPE="REST"
+       ECS_ADAPTER=$ECS_PATH
+       echo ""
+}
+
+# All calls to ECS will be directed to the ECS dmaap interface over http from now on
+# args: -
+# (Function for test scripts)
+use_ecs_dmaap_http() {
+       echo -e $BOLD"ECS dmaap protocol setting"$EBOLD
+       echo -e $RED" - NOT SUPPORTED - "$ERED
+       echo -e " Using $BOLD http $EBOLD and $BOLD DMAAP $EBOLD towards ECS"
+       ECS_ADAPTER_TYPE="MR-HTTP"
+       echo ""
+}
+
+# All calls to ECS will be directed to the ECS dmaap interface over https from now on
+# args: -
+# (Function for test scripts)
+use_ecs_dmaap_https() {
+       echo -e $BOLD"RICSIM protocol setting"$EBOLD
+       echo -e $RED" - NOT SUPPORTED - "$ERED
+       echo -e " Using $BOLD https $EBOLD and $BOLD REST $EBOLD towards ECS"
+       ECS_ADAPTER_TYPE="MR-HTTPS"
+       echo ""
+}
+
+# Start the ECS
+# args: -
+# (Function for test scripts)
+start_ecs() {
+
+       echo -e $BOLD"Starting $ECS_DISPLAY_NAME"$EBOLD
+
+       if [ $RUNMODE == "KUBE" ]; then
+
+               # Check if app shall be fully managed by the test script
+               __check_included_image "ECS"
+               retcode_i=$?
+
+               # Check if app shall only be used by the testscipt
+               __check_prestarted_image "ECS"
+               retcode_p=$?
+
+               if [ $retcode_i -ne 0 ] && [ $retcode_p -ne 0 ]; then
+                       echo -e $RED"The $ECS_APP_NAME app is not included as managed nor prestarted in this test script"$ERED
+                       echo -e $RED"The $ECS_APP_NAME will not be started"$ERED
+                       exit
+               fi
+               if [ $retcode_i -eq 0 ] && [ $retcode_p -eq 0 ]; then
+                       echo -e $RED"The $ECS_APP_NAME app is included both as managed and prestarted in this test script"$ERED
+                       echo -e $RED"The $ECS_APP_NAME will not be started"$ERED
+                       exit
+               fi
+
+
+               if [ $retcode_p -eq 0 ]; then
+                       echo -e " Using existing $ECS_APP_NAME deployment and service"
+                       echo " Setting ECS replicas=1"
+                       __kube_scale deployment $ECS_APP_NAME $KUBE_NONRTRIC_NAMESPACE 1
+               fi
+
+               # Check if app shall be fully managed by the test script
+               if [ $retcode_i -eq 0 ]; then
+                       echo -e " Creating $ECS_APP_NAME app and expose service"
+
+                       #Check if nonrtric namespace exists, if not create it
+                       __kube_create_namespace $KUBE_NONRTRIC_NAMESPACE
+
+                       export ECS_APP_NAME
+                       export KUBE_NONRTRIC_NAMESPACE
+                       export ECS_IMAGE
+                       export ECS_INTERNAL_PORT
+                       export ECS_INTERNAL_SECURE_PORT
+                       export ECS_EXTERNAL_PORT
+                       export ECS_EXTERNAL_SECURE_PORT
+                       export ECS_CONFIG_MOUNT_PATH
+                       export ECS_CONFIG_CONFIGMAP_NAME=$ECS_APP_NAME"-config"
+                       export ECS_DATA_CONFIGMAP_NAME=$ECS_APP_NAME"-data"
+                       export ECS_CONTAINER_MNT_DIR
+
+                       # Create config map for config
+                       datafile=$PWD/tmp/$ECS_CONFIG_FILE
+                       cp $1 $datafile
+                       output_yaml=$PWD/tmp/ecs_cfc.yaml
+                       __kube_create_configmap $ECS_CONFIG_CONFIGMAP_NAME $KUBE_NONRTRIC_NAMESPACE autotest ECS $datafile $output_yaml
+
+                       # Create pvc
+                       input_yaml=$SIM_GROUP"/"$ECS_COMPOSE_DIR"/"pvc.yaml
+                       output_yaml=$PWD/tmp/ecs_pvc.yaml
+                       __kube_create_instance pvc $ECS_APP_NAME $input_yaml $output_yaml
+
+                       # Create service
+                       input_yaml=$SIM_GROUP"/"$ECS_COMPOSE_DIR"/"svc.yaml
+                       output_yaml=$PWD/tmp/ecs_svc.yaml
+                       __kube_create_instance service $ECS_APP_NAME $input_yaml $output_yaml
+
+                       # Create app
+                       input_yaml=$SIM_GROUP"/"$ECS_COMPOSE_DIR"/"app.yaml
+                       output_yaml=$PWD/tmp/ecs_app.yaml
+                       __kube_create_instance app $ECS_APP_NAME $input_yaml $output_yaml
+               fi
+
+               echo " Retrieving host and ports for service..."
+               ECS_HOST_NAME=$(__kube_get_service_host $ECS_APP_NAME $KUBE_NONRTRIC_NAMESPACE)
+               ECS_EXTERNAL_PORT=$(__kube_get_service_port $ECS_APP_NAME $KUBE_NONRTRIC_NAMESPACE "http")
+               ECS_EXTERNAL_SECURE_PORT=$(__kube_get_service_port $ECS_APP_NAME $KUBE_NONRTRIC_NAMESPACE "https")
+
+               echo " Host IP, http port, https port: $ECS_HOST_NAME $ECS_EXTERNAL_PORT $ECS_EXTERNAL_SECURE_PORT"
+
+               if [ $ECS_HTTPX == "http" ]; then
+                       ECS_PATH=$ECS_HTTPX"://"$ECS_HOST_NAME":"$ECS_EXTERNAL_PORT
+               else
+                       ECS_PATH=$ECS_HTTPX"://"$ECS_HOST_NAME":"$ECS_EXTERNAL_SECURE_PORT
+               fi
+
+               __check_service_start $ECS_APP_NAME $ECS_PATH$ECS_ALIVE_URL
+
+               if [ $ECS_ADAPTER_TYPE == "REST" ]; then
+                       ECS_ADAPTER=$ECS_PATH
+               fi
+       else
+               __check_included_image 'ECS'
+               if [ $? -eq 1 ]; then
+                       echo -e $RED"The ECS app is not included in this test script"$ERED
+                       echo -e $RED"ECS will not be started"$ERED
+                       exit 1
+               fi
+
+               curdir=$PWD
+               cd $SIM_GROUP
+               cd ecs
+               cd $ECS_HOST_MNT_DIR
+               cd ..
+               if [ -d db ]; then
+                       if [ "$(ls -A $DIR)" ]; then
+                               echo -e $BOLD" Cleaning files in mounted dir: $PWD/db"$EBOLD
+                               rm -rf db/*  &> /dev/null
+                               if [ $? -ne 0 ]; then
+                                       echo -e $RED" Cannot remove database files in: $PWD"$ERED
+                                       exit 1
+                               fi
+                       fi
+               else
+                       echo " No files in mounted dir or dir does not exists"
+               fi
+               cd $curdir
+
+               export ECS_APP_NAME
+               export ECS_APP_NAME_ALIAS
+               export ECS_HOST_MNT_DIR
+               export ECS_CONTAINER_MNT_DIR
+               export ECS_INTERNAL_PORT
+               export ECS_EXTERNAL_PORT
+               export ECS_INTERNAL_SECURE_PORT
+               export ECS_EXTERNAL_SECURE_PORT
+               export DOCKER_SIM_NWNAME
+
+               __start_container $ECS_COMPOSE_DIR NODOCKERARGS 1 $ECS_APP_NAME
+
+               __check_service_start $ECS_APP_NAME $ECS_PATH$ECS_ALIVE_URL
+       fi
+       echo ""
+       return 0
+}
+
+# Restart ECS
+# args: -
+# (Function for test scripts)
+restart_ecs() {
+       echo -e $BOLD"Re-starting ECS"$EBOLD
+       docker restart $ECS_APP_NAME &> ./tmp/.dockererr
+       if [ $? -ne 0 ]; then
+               __print_err "Could not restart $ECS_APP_NAME" $@
+               cat ./tmp/.dockererr
+               ((RES_CONF_FAIL++))
+               return 1
+       fi
+
+       __check_service_start $ECS_APP_NAME $ECS_PATH$ECS_ALIVE_URL
+       echo ""
+       return 0
+}
+
+# Turn on debug level tracing in ECS
+# args: -
+# (Function for test scripts)
+set_ecs_debug() {
+       echo -e $BOLD"Setting ecs debug logging"$EBOLD
+       curlString="$ECS_PATH$ECS_ACTUATOR -X POST  -H Content-Type:application/json -d {\"configuredLevel\":\"debug\"}"
+       result=$(__do_curl "$curlString")
+       if [ $? -ne 0 ]; then
+               __print_err "Could not set debug mode" $@
+               ((RES_CONF_FAIL++))
+               return 1
+       fi
+       echo ""
+       return 0
+}
+
+# Turn on trace level tracing in ECS
+# args: -
+# (Function for test scripts)
+set_ecs_trace() {
+       echo -e $BOLD"Setting ecs trace logging"$EBOLD
+       curlString="$ECS_PATH/actuator/loggers/org.oransc.enrichment -X POST  -H Content-Type:application/json -d {\"configuredLevel\":\"trace\"}"
+       result=$(__do_curl "$curlString")
+       if [ $? -ne 0 ]; then
+               __print_err "Could not set trace mode" $@
+               ((RES_CONF_FAIL++))
+               return 1
+       fi
+       echo ""
+       return 0
+}
+
+# Perform curl retries when making direct call to ECS for the specified http response codes
+# Speace separated list of http response codes
+# args: [<response-code>]*
+use_agent_retries() {
+       echo -e $BOLD"Do curl retries to the ECS REST inteface for these response codes:$@"$EBOLD
+       ECS_AGENT_RETRY_CODES=$@
+       echo ""
+       return 0
+}
 
-. ../common/api_curl.sh
 
 # Tests if a variable value in the ECS is equal to a target value and and optional timeout.
 # Arg: <variable-name> <target-value> - This test set pass or fail depending on if the variable is
 # (Function for test scripts)
 ecs_equal() {
        if [ $# -eq 2 ] || [ $# -eq 3 ]; then
-               __var_test ECS "$LOCALHOST$ECS_EXTERNAL_PORT/" $1 "=" $2 $3
+               __var_test ECS "$ECS_PATH/" $1 "=" $2 $3
        else
                __print_err "Wrong args to ecs_equal, needs two or three args: <sim-param> <target-value> [ timeout ]" $@
        fi
@@ -207,7 +473,7 @@ ecs_api_a1_get_type_ids() {
 
 # API Test function: GET â€‹/A1-EI​/v1​/eitypes​/{eiTypeId}​/eijobs​/{eiJobId}​/status
 # args: <response-code> <type-id> <job-id> [<status>]
-# args (flat uri structure): <response-code> <job-id> [<status>]
+# args (flat uri structure): <response-code> <job-id> [<status> [<timeout>]]
 # (Function for test scripts)
 ecs_api_a1_get_job_status() {
        __log_test_start $@
@@ -240,31 +506,60 @@ ecs_api_a1_get_job_status() {
                fi
        else
                echo -e $YELLOW"USING NOT CONFIRMED INTERFACE - FLAT URI STRUCTURE"$EYELLOW
-               if [ $# -ne 2 ] && [ $# -ne 3 ]; then
-                       __print_err "<response-code> <job-id> [<status>]" $@
+               if [ $# -lt 2 ] && [ $# -gt 4 ]; then
+                       __print_err "<response-code> <job-id> [<status> [<timeout>]]" $@
                        return 1
                fi
 
                query="/A1-EI/v1/eijobs/$2/status"
 
-               res="$(__do_curl_to_api ECS GET $query)"
-               status=${res:${#res}-3}
+               start=$SECONDS
+               for (( ; ; )); do
+                       res="$(__do_curl_to_api ECS GET $query)"
+                       status=${res:${#res}-3}
 
-               if [ $status -ne $1 ]; then
-                       __log_test_fail_status_code $1 $status
-                       return 1
-               fi
-               if [ $# -eq 3 ]; then
-                       body=${res:0:${#res}-3}
-                       targetJson="{\"eiJobStatus\": \"$3\"}"
-                       echo " TARGET JSON: $targetJson" >> $HTTPLOG
-                       res=$(python3 ../common/compare_json.py "$targetJson" "$body")
+                       if [ $# -eq 4 ]; then
+                               duration=$((SECONDS-start))
+                               echo -ne " Response=${status} after ${duration} seconds, waiting for ${3} ${SAMELINE}"
+                               if [ $duration -gt $4 ]; then
+                                       echo ""
+                                       duration=-1  #Last iteration
+                               fi
+                       else
+                               duration=-1 #single test, no wait
+                       fi
 
-                       if [ $res -ne 0 ]; then
-                               __log_test_fail_body
-                               return 1
+                       if [ $status -ne $1 ]; then
+                               if [ $duration -eq -1 ]; then
+                                       __log_test_fail_status_code $1 $status
+                                       return 1
+                               fi
                        fi
-               fi
+                       if [ $# -ge 3 ] && [ $status -eq $1 ]; then
+                               body=${res:0:${#res}-3}
+                               targetJson="{\"eiJobStatus\": \"$3\"}"
+                               echo " TARGET JSON: $targetJson" >> $HTTPLOG
+                               res=$(python3 ../common/compare_json.py "$targetJson" "$body")
+
+                               if [ $res -ne 0 ]; then
+                                       if [ $duration -eq -1 ]; then
+                                               __log_test_fail_body
+                                               return 1
+                                       fi
+                               else
+                                       duration=-1  #Goto pass
+                               fi
+                       fi
+                       if [ $duration -eq -1 ]; then
+                               if [ $# -eq 4 ]; then
+                                       echo ""
+                               fi
+                               __log_test_pass
+                               return 0
+                       else
+                               sleep 1
+                       fi
+               done
        fi
 
        __log_test_pass
@@ -552,7 +847,7 @@ ecs_api_edp_get_producer_status() {
 
 
 # API Test function: GET /ei-producer/v1/eiproducers
-# args: <response-code> [ EMPTY | <producer-id>+]
+# args (v1_1): <response-code> [ EMPTY | <producer-id>+]
 # (Function for test scripts)
 ecs_api_edp_get_producer_ids() {
        __log_test_start $@
@@ -598,8 +893,58 @@ ecs_api_edp_get_producer_ids() {
        return 0
 }
 
+# API Test function: GET /ei-producer/v1/eiproducers
+# args (v1_2): <response-code> [ ( NOTYPE | <type-id> ) [ EMPTY | <producer-id>+] ]
+# (Function for test scripts)
+ecs_api_edp_get_producer_ids_2() {
+       __log_test_start $@
+
+    if [ $# -lt 1 ]; then
+               __print_err "<response-code> [ ( NOTYPE | <type-id> ) [ EMPTY | <producer-id>+] ]" $@
+               return 1
+       fi
+
+       query="/ei-producer/v1/eiproducers"
+       if [ $# -gt 1 ] && [ $2 != "NOTYPE" ]; then
+               query=$query"?ei_type_id=$2"
+       fi
+    res="$(__do_curl_to_api ECS GET $query)"
+    status=${res:${#res}-3}
+
+       if [ $status -ne $1 ]; then
+               __log_test_fail_status_code $1 $status
+               return 1
+       fi
+
+       if [ $# -gt 2 ]; then
+               body=${res:0:${#res}-3}
+               targetJson="["
+
+               for pid in ${@:3} ; do
+                       if [ "$targetJson" != "[" ]; then
+                               targetJson=$targetJson","
+                       fi
+                       if [ $pid != "EMPTY" ]; then
+                               targetJson=$targetJson"\"$pid\""
+                       fi
+               done
+
+               targetJson=$targetJson"]"
+               echo " TARGET JSON: $targetJson" >> $HTTPLOG
+               res=$(python3 ../common/compare_json.py "$targetJson" "$body")
+
+               if [ $res -ne 0 ]; then
+                       __log_test_fail_body
+                       return 1
+               fi
+       fi
+
+       __log_test_pass
+       return 0
+}
+
 # API Test function: GET /ei-producer/v1/eitypes/{eiTypeId}
-# args: <response-code> <type-id> [<job-schema-file> (EMPTY | [<producer-id>]+)]
+# args: (v1_1) <response-code> <type-id> [<job-schema-file> (EMPTY | [<producer-id>]+)]
 # (Function for test scripts)
 ecs_api_edp_get_type() {
        __log_test_start $@
@@ -657,8 +1002,115 @@ ecs_api_edp_get_type() {
        return 0
 }
 
+# API Test function: GET /ei-producer/v1/eitypes/{eiTypeId}
+# args: (v1_2) <response-code> <type-id> [<job-schema-file> ]
+# (Function for test scripts)
+ecs_api_edp_get_type_2() {
+       __log_test_start $@
+
+       paramError=1
+       if [ $# -eq 2 ]; then
+               paramError=0
+       fi
+       if [ $# -eq 3 ]; then
+               paramError=0
+       fi
+    if [ $paramError -ne 0 ]; then
+               __print_err "<response-code> <type-id> [<job-schema-file> ]" $@
+               return 1
+       fi
+
+       query="/ei-producer/v1/eitypes/$2"
+    res="$(__do_curl_to_api ECS GET $query)"
+    status=${res:${#res}-3}
+
+       if [ $status -ne $1 ]; then
+               __log_test_fail_status_code $1 $status
+               return 1
+       fi
+       if [ $# -eq 3 ]; then
+               body=${res:0:${#res}-3}
+
+               if [ -f $3 ]; then
+                       schema=$(cat $3)
+               else
+                       __log_test_fail_general "Job template file "$3", does not exist"
+                       return 1
+               fi
+
+               targetJson="{\"ei_job_data_schema\":$schema}"
+
+               echo " TARGET JSON: $targetJson" >> $HTTPLOG
+               res=$(python3 ../common/compare_json.py "$targetJson" "$body")
+
+               if [ $res -ne 0 ]; then
+                       __log_test_fail_body
+                       return 1
+               fi
+       fi
+       __log_test_pass
+       return 0
+}
+
+# API Test function: PUT /ei-producer/v1/eitypes/{eiTypeId}
+# args: (v1_2) <response-code> <type-id> <job-schema-file>
+# (Function for test scripts)
+ecs_api_edp_put_type_2() {
+       __log_test_start $@
+
+    if [ $# -ne 3 ]; then
+               __print_err "<response-code> <type-id> <job-schema-file>" $@
+               return 1
+       fi
+
+       if [ ! -f $3 ]; then
+               __log_test_fail_general "Job schema file "$3", does not exist"
+               return 1
+       fi
+       schema=$(cat $3)
+       input_json="{\"ei_job_data_schema\":$schema}"
+       file="./tmp/put_type.json"
+       echo $input_json > $file
+
+       query="/ei-producer/v1/eitypes/$2"
+    res="$(__do_curl_to_api ECS PUT $query $file)"
+    status=${res:${#res}-3}
+
+       if [ $status -ne $1 ]; then
+               __log_test_fail_status_code $1 $status
+               return 1
+       fi
+
+       __log_test_pass
+       return 0
+}
+
+# API Test function: DELETE /ei-producer/v1/eitypes/{eiTypeId}
+# args: (v1_2) <response-code> <type-id>
+# (Function for test scripts)
+ecs_api_edp_delete_type_2() {
+       __log_test_start $@
+
+    if [ $# -ne 2 ]; then
+               __print_err "<response-code> <type-id>" $@
+               return 1
+       fi
+
+       query="/ei-producer/v1/eitypes/$2"
+    res="$(__do_curl_to_api ECS DELETE $query)"
+    status=${res:${#res}-3}
+
+       if [ $status -ne $1 ]; then
+               __log_test_fail_status_code $1 $status
+               return 1
+       fi
+
+       __log_test_pass
+       return 0
+}
+
 # API Test function: GET /ei-producer/v1/eiproducers/{eiProducerId}
-# args: <response-code> <producer-id> [<job-callback> <supervision-callback> (EMPTY | [<type-id> <schema-file>]+) ]
+# args: (v1_1) <response-code> <producer-id> [<job-callback> <supervision-callback> (EMPTY | [<type-id> <schema-file>]+) ]
 # (Function for test scripts)
 ecs_api_edp_get_producer() {
        __log_test_start $@
@@ -726,6 +1178,67 @@ ecs_api_edp_get_producer() {
        return 0
 }
 
+# API Test function: GET /ei-producer/v1/eiproducers/{eiProducerId}
+# args (v1_2): <response-code> <producer-id> [<job-callback> <supervision-callback> (EMPTY | <type-id>+) ]
+# (Function for test scripts)
+ecs_api_edp_get_producer_2() {
+       __log_test_start $@
+
+       #Possible arg count: 2, 5, 6, 7, 8 etc
+       paramError=1
+       if [ $# -eq 2 ]; then
+               paramError=0
+       fi
+       if [ $# -eq 5 ] && [ "$5" == "EMPTY" ]; then
+               paramError=0
+       fi
+       if [ $# -ge 5 ]; then
+               paramError=0
+       fi
+
+    if [ $paramError -ne 0 ]; then
+               __print_err "<response-code> <producer-id> [<job-callback> <supervision-callback> (EMPTY | <type-id>+) ]" $@
+               return 1
+       fi
+
+       query="/ei-producer/v1/eiproducers/$2"
+    res="$(__do_curl_to_api ECS GET $query)"
+    status=${res:${#res}-3}
+
+       if [ $status -ne $1 ]; then
+               __log_test_fail_status_code $1 $status
+               return 1
+       fi
+
+       if [ $# -gt 2 ]; then
+               body=${res:0:${#res}-3}
+               targetJson="["
+               if [ $# -gt 4 ] && [ "$5" != "EMPTY" ]; then
+                       arr=(${@:5})
+                       for ((i=0; i<$(($#-4)); i=i+1)); do
+                               if [ "$targetJson" != "[" ]; then
+                                       targetJson=$targetJson","
+                               fi
+                               targetJson=$targetJson"\"${arr[$i]}\""
+                       done
+               fi
+               targetJson=$targetJson"]"
+               if [ $# -gt 4 ]; then
+                       targetJson="{\"supported_ei_types\":$targetJson,\"ei_job_callback_url\": \"$3\",\"ei_producer_supervision_callback_url\": \"$4\"}"
+               fi
+               echo " TARGET JSON: $targetJson" >> $HTTPLOG
+               res=$(python3 ../common/compare_json.py "$targetJson" "$body")
+
+               if [ $res -ne 0 ]; then
+                       __log_test_fail_body
+                       return 1
+               fi
+       fi
+
+       __log_test_pass
+       return 0
+}
+
 # API Test function: DELETE /ei-producer/v1/eiproducers/{eiProducerId}
 # args: <response-code> <producer-id>
 # (Function for test scripts)
@@ -751,7 +1264,7 @@ ecs_api_edp_delete_producer() {
 }
 
 # API Test function: PUT /ei-producer/v1/eiproducers/{eiProducerId}
-# args: <response-code> <producer-id> <job-callback> <supervision-callback> NOTYPE|[<type-id> <schema-file>]+
+# args: (v1_1) <response-code> <producer-id> <job-callback> <supervision-callback> NOTYPE|[<type-id> <schema-file>]+
 # (Function for test scripts)
 ecs_api_edp_put_producer() {
        __log_test_start $@
@@ -805,6 +1318,55 @@ ecs_api_edp_put_producer() {
        return 0
 }
 
+# API Test function: PUT /ei-producer/v1/eiproducers/{eiProducerId}
+# args: (v1_2) <response-code> <producer-id> <job-callback> <supervision-callback> NOTYPE|[<type-id>+]
+# (Function for test scripts)
+ecs_api_edp_put_producer_2() {
+       __log_test_start $@
+
+       #Valid number of parametrer 5,6,8,10,
+       paramError=1
+       if  [ $# -eq 5 ] && [ "$5" == "NOTYPE" ]; then
+               paramError=0
+       elif [ $# -ge 5 ]; then
+               paramError=0
+       fi
+       if [ $paramError -ne 0 ]; then
+               __print_err "<response-code> <producer-id> <job-callback> <supervision-callback> NOTYPE|[<type-id>+]" $@
+               return 1
+       fi
+
+       inputJson="["
+       if [ $# -gt 4 ] && [ "$5" != "NOTYPE" ]; then
+               arr=(${@:5})
+               for ((i=0; i<$(($#-4)); i=i+1)); do
+                       if [ "$inputJson" != "[" ]; then
+                               inputJson=$inputJson","
+                       fi
+                       inputJson=$inputJson"\""${arr[$i]}"\""
+               done
+       fi
+       inputJson="\"supported_ei_types\":"$inputJson"]"
+
+       inputJson=$inputJson",\"ei_job_callback_url\": \"$3\",\"ei_producer_supervision_callback_url\": \"$4\""
+
+       inputJson="{"$inputJson"}"
+
+       file="./tmp/.p.json"
+       echo "$inputJson" > $file
+       query="/ei-producer/v1/eiproducers/$2"
+    res="$(__do_curl_to_api ECS PUT $query $file)"
+    status=${res:${#res}-3}
+
+       if [ $status -ne $1 ]; then
+               __log_test_fail_status_code $1 $status
+               return 1
+       fi
+
+       __log_test_pass
+       return 0
+}
+
 # API Test function: GET /ei-producer/v1/eiproducers/{eiProducerId}/eijobs
 # args: <response-code> <producer-id> (EMPTY | [<job-id> <type-id> <target-url> <job-owner> <template-job-file>]+)
 # (Function for test scripts)
@@ -891,6 +1453,58 @@ ecs_api_service_status() {
                __log_test_fail_status_code $1 $status
                return 1
        fi
+       __log_test_pass
+       return 0
+}
+
+
+##########################################
+####          Reset jobs              ####
+##########################################
+# Function prefix: ecs_api_admin
+
+# Admin to remove all jobs
+# args:
+# (Function for test scripts)
+
+ecs_api_admin_reset() {
+       __log_test_start $@
+
+       if [  -z "$FLAT_A1_EI" ]; then
+               query="/A1-EI/v1/eitypes/$2/eijobs"
+       else
+               query="/A1-EI/v1/eijobs"
+       fi
+    res="$(__do_curl_to_api ECS GET $query)"
+    status=${res:${#res}-3}
+
+       if [ $status -ne 200 ]; then
+               __log_test_fail_status_code $1 $status
+               return 1
+       fi
+
+       #Remove brackets and response code
+       body=${res:1:${#res}-4}
+       list=$(echo ${body//,/ })
+       list=$(echo ${list//[/})
+       list=$(echo ${list//]/})
+       list=$(echo ${list//\"/})
+       list=$list" "
+       for job in $list; do
+               if [  -z "$FLAT_A1_EI" ]; then
+                       echo "Not supported for non-flat EI api"
+               else
+                       query="/A1-EI/v1/eijobs/$job"
+                       res="$(__do_curl_to_api ECS DELETE $query)"
+                       status=${res:${#res}-3}
+                       if [ $status -ne 204 ]; then
+                               __log_test_fail_status_code $1 $status
+                               return 1
+                       fi
+                       echo " Deleted job: "$job
+               fi
+       done
+
        __log_test_pass
        return 0
 }
\ No newline at end of file
diff --git a/test/common/http_proxy_api_functions.sh b/test/common/http_proxy_api_functions.sh
new file mode 100644 (file)
index 0000000..68df929
--- /dev/null
@@ -0,0 +1,129 @@
+#!/bin/bash
+
+#  ============LICENSE_START===============================================
+#  Copyright (C) 2020 Nordix Foundation. 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=================================================
+#
+
+# This is a script that contains container/service managemnt functions for Http Proxy
+
+## Access to Http Proxy Receiver
+# Host name may be changed if app started by kube
+# Direct access from script
+HTTP_PROXY_HTTPX="http"
+HTTP_PROXY_HOST_NAME=$LOCALHOST_NAME
+HTTP_PROXY_PATH=$HTTP_PROXY_HTTPX"://"$HTTP_PROXY_HOST_NAME":"$HTTP_PROXY_WEB_EXTERNAL_PORT
+
+#########################
+### Http Proxy functions
+#########################
+
+# Start the Http Proxy in the simulator group
+# args: -
+# (Function for test scripts)
+start_http_proxy() {
+
+       echo -e $BOLD"Starting $HTTP_PROXY_DISPLAY_NAME"$EBOLD
+
+       if [ $RUNMODE == "KUBE" ]; then
+
+               # Check if app shall be fully managed by the test script
+               __check_included_image "HTTPPROXY"
+               retcode_i=$?
+
+               # Check if app shall only be used by the testscipt
+               __check_prestarted_image "HTTPPROXY"
+               retcode_p=$?
+
+               if [ $retcode_i -ne 0 ] && [ $retcode_p -ne 0 ]; then
+                       echo -e $RED"The $HTTP_PROXY_APP_NAME app is not included as managed nor prestarted in this test script"$ERED
+                       echo -e $RED"The $HTTP_PROXY_APP_NAME will not be started"$ERED
+                       exit
+               fi
+               if [ $retcode_i -eq 0 ] && [ $retcode_p -eq 0 ]; then
+                       echo -e $RED"The $HTTP_PROXY_APP_NAME app is included both as managed and prestarted in this test script"$ERED
+                       echo -e $RED"The $HTTP_PROXY_APP_NAME will not be started"$ERED
+                       exit
+               fi
+
+               # Check if app shall be used - not managed - by the test script
+               if [ $retcode_p -eq 0 ]; then
+                       echo -e " Using existing $HTTP_PROXY_APP_NAME deployment and service"
+                       echo " Setting HTTPPROXY replicas=1"
+                       __kube_scale deployment $HTTP_PROXY_APP_NAME $KUBE_SIM_NAMESPACE 1
+               fi
+
+               if [ $retcode_i -eq 0 ]; then
+                       echo -e " Creating $HTTP_PROXY_APP_NAME deployment and service"
+                       export HTTP_PROXY_APP_NAME
+                       export HTTP_PROXY_WEB_EXTERNAL_PORT
+                       export HTTP_PROXY_WEB_INTERNAL_PORT
+                       export HTTP_PROXY_EXTERNAL_PORT
+                       export HTTP_PROXY_INTERNAL_PORT
+                       export KUBE_SIM_NAMESPACE
+                       export HTTP_PROXY_IMAGE
+
+                       __kube_create_namespace $KUBE_SIM_NAMESPACE
+
+                       # Create service
+                       input_yaml=$SIM_GROUP"/"$HTTP_PROXY_COMPOSE_DIR"/"svc.yaml
+                       output_yaml=$PWD/tmp/proxy_svc.yaml
+                       __kube_create_instance service $HTTP_PROXY_APP_NAME $input_yaml $output_yaml
+
+                       # Create app
+                       input_yaml=$SIM_GROUP"/"$HTTP_PROXY_COMPOSE_DIR"/"app.yaml
+                       output_yaml=$PWD/tmp/proxy_app.yaml
+                       __kube_create_instance app $HTTP_PROXY_APP_NAME $input_yaml $output_yaml
+
+               fi
+
+               echo " Retrieving host and ports for service..."
+               HTTP_PROXY_HOST_NAME=$(__kube_get_service_host $HTTP_PROXY_APP_NAME $KUBE_SIM_NAMESPACE)
+               HTTP_PROXY_WEB_EXTERNAL_PORT=$(__kube_get_service_port $HTTP_PROXY_APP_NAME $KUBE_SIM_NAMESPACE "web")
+               HTTP_PROXY_EXTERNAL_PORT=$(__kube_get_service_port $HTTP_PROXY_APP_NAME $KUBE_SIM_NAMESPACE "http")
+
+               HTTP_PROXY_PATH=$HTTP_PROXY_HTTPX"://"$HTTP_PROXY_HOST_NAME":"$HTTP_PROXY_WEB_EXTERNAL_PORT
+               HTTP_PROXY_CONFIG_PORT=$HTTP_PROXY_EXTERNAL_PORT
+               HTTP_PROXY_CONFIG_HOST_NAME=$HTTP_PROXY_APP_NAME"."$KUBE_SIM_NAMESPACE
+
+               echo " Host IP, http port: $HTTP_PROXY_HOST_NAME $HTTP_PROXY_WEB_EXTERNAL_PORT"
+
+               __check_service_start $HTTP_PROXY_APP_NAME $HTTP_PROXY_PATH$HTTP_PROXY_ALIVE_URL
+
+       else
+               # Check if docker app shall be fully managed by the test script
+               __check_included_image 'HTTPPROXY'
+               if [ $? -eq 1 ]; then
+                       echo -e $RED"The Http Proxy app is not included in this test script"$ERED
+                       echo -e $RED"The Http Proxy will not be started"$ERED
+                       exit
+               fi
+
+               export HTTP_PROXY_APP_NAME
+               export HTTP_PROXY_WEB_EXTERNAL_PORT
+               export HTTP_PROXY_WEB_INTERNAL_PORT
+               export DOCKER_SIM_NWNAME
+
+               __start_container $HTTP_PROXY_COMPOSE_DIR NODOCKERARGS 1 $HTTP_PROXY_APP_NAME
+
+        __check_service_start $HTTP_PROXY_APP_NAME $HTTP_PROXY_PATH$HTTP_PROXY_ALIVE_URL
+
+               HTTP_PROXY_CONFIG_PORT=$HTTP_PROXY_INTERNAL_PORT
+               HTTP_PROXY_CONFIG_HOST_NAME=$HTTP_PROXY_APP_NAME
+
+       fi
+       echo ""
+}
+
diff --git a/test/common/mr_api_functions.sh b/test/common/mr_api_functions.sh
new file mode 100644 (file)
index 0000000..54809b7
--- /dev/null
@@ -0,0 +1,511 @@
+#!/bin/bash
+
+#  ============LICENSE_START===============================================
+#  Copyright (C) 2020 Nordix Foundation. 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=================================================
+#
+
+# This is a script that contains container/service management function
+# and test functions for Message Router - mr stub
+
+## Access to Message Router
+# Host name may be changed if app started by kube
+# Direct access from script
+MR_HTTPX="http"
+MR_STUB_HOST_NAME=$LOCALHOST_NAME
+MR_DMAAP_HOST_NAME=$LOCALHOST_NAME
+MR_STUB_PATH=$MR_HTTPX"://"$MR_STUB_HOST_NAME":"$MR_STUB_LOCALHOST_PORT
+MR_DMAAP_PATH=$MR_HTTPX"://"$MR_DMAAP_HOST_NAME":"$MR_DMAAP_LOCALHOST_PORT
+#Docker/Kube internal path
+if [ $RUNMODE == "KUBE" ]; then
+       MR_SERVICE_PATH=$MR_HTTPX"://"$MR_STUB_APP_NAME"."$KUBE_ONAP_NAMESPACE":"$MR_EXTERNAL_PORT
+       __check_included_image "DMAAPMR"
+       if [ $? -eq 0 ]; then
+               MR_SERVICE_PATH=$MR_HTTPX"://"$MR_DMAAP_APP_NAME"."$KUBE_ONAP_NAMESPACE":"$MR_EXTERNAL_PORT
+       fi
+       __check_prestarted_image "DMAAPMR"
+       if [ $? -eq 0 ]; then
+               MR_SERVICE_PATH=$MR_HTTPX"://"$MR_DMAAP_APP_NAME"."$KUBE_ONAP_NAMESPACE":"$MR_EXTERNAL_PORT
+       fi
+else
+       MR_SERVICE_PATH=$MR_HTTPX"://"$MR_STUB_APP_NAME":"$MR_INTERNAL_PORT
+       __check_included_image "DMAAPMR"
+       if [ $? -eq 0 ]; then
+               MR_SERVICE_PATH=$MR_HTTPX"://"$MR_DMAAP_APP_NAME":"$MR_INTERNAL_PORT
+       fi
+fi
+MR_ADAPTER_HTTP="http://"$MR_STUB_HOST_NAME":"$MR_STUB_LOCALHOST_PORT
+MR_ADAPTER_HTTPS="https://"$MR_STUB_HOST_NAME":"$MR_STUB_LOCALHOST_SECURE_PORT
+
+
+#####################
+### MR stub functions
+#####################
+
+use_mr_http() {
+       echo -e $BOLD"MR protocol setting"$EBOLD
+       echo -e " Using $BOLD http $EBOLD towards MR"
+       MR_HTTPX="http"
+       MR_STUB_PATH=$MR_HTTPX"://"$MR_STUB_HOST_NAME":"$MR_STUB_LOCALHOST_PORT
+       MR_DMAAP_PATH=$MR_HTTPX"://"$MR_DMAAP_HOST_NAME":"$MR_DMAAP_LOCALHOST_PORT
+       #Docker/Kube internal path
+       if [ $RUNMODE == "KUBE" ]; then
+               MR_SERVICE_PATH=$MR_HTTPX"://"$MR_STUB_APP_NAME"."$KUBE_ONAP_NAMESPACE":"$MR_EXTERNAL_PORT
+               __check_included_image "DMAAPMR"
+               if [ $? -eq 0 ]; then
+                       MR_SERVICE_PATH=$MR_HTTPX"://"$MR_DMAAP_APP_NAME"."$KUBE_ONAP_NAMESPACE":"$MR_EXTERNAL_PORT
+               fi
+               __check_prestarted_image "DMAAPMR"
+               if [ $? -eq 0 ]; then
+                       MR_SERVICE_PATH=$MR_HTTPX"://"$MR_DMAAP_APP_NAME"."$KUBE_ONAP_NAMESPACE":"$MR_EXTERNAL_PORT
+               fi
+       else
+               MR_SERVICE_PATH=$MR_HTTPX"://"$MR_STUB_APP_NAME":"$MR_INTERNAL_PORT
+               __check_included_image "DMAAPMR"
+               if [ $? -eq 0 ]; then
+                       MR_SERVICE_PATH=$MR_HTTPX"://"$MR_DMAAP_APP_NAME":"$MR_INTERNAL_PORT
+               fi
+       fi
+       echo ""
+}
+
+use_mr_https() {
+       echo -e $BOLD"MR protocol setting"$EBOLD
+       echo -e " Using $BOLD https $EBOLD towards MR"
+       MR_HTTPX="https"
+       MR_STUB_PATH=$MR_HTTPX"://"$MR_STUB_HOST_NAME":"$MR_STUB_LOCALHOST_SECURE_PORT
+       MR_DMAAP_PATH=$MR_HTTPX"://"$MR_DMAAP_HOST_NAME":"$MR_DMAAP_LOCALHOST_SECURE_PORT
+       #Docker/Kube internal path
+       if [ $RUNMODE == "KUBE" ]; then
+               MR_SERVICE_PATH=$MR_HTTPX"://"$MR_STUB_APP_NAME"."$KUBE_ONAP_NAMESPACE":"$MR_EXTERNAL_SECURE_PORT
+               __check_included_image "DMAAPMR"
+               if [ $? -eq 0 ]; then
+                       MR_SERVICE_PATH=$MR_HTTPX"://"$MR_DMAAP_APP_NAME"."$KUBE_ONAP_NAMESPACE":"$MR_EXTERNAL_SECURE_PORT
+               fi
+               __check_prestarted_image "DMAAPMR"
+               if [ $? -eq 0 ]; then
+                       MR_SERVICE_PATH=$MR_HTTPX"://"$MR_DMAAP_APP_NAME"."$KUBE_ONAP_NAMESPACE":"$MR_EXTERNAL_SECURE_PORT
+               fi
+       else
+               MR_SERVICE_PATH=$MR_HTTPX"://"$MR_STUB_APP_NAME":"$MR_INTERNAL_SECURE_PORT
+               __check_included_image "DMAAPMR"
+               if [ $? -eq 0 ]; then
+                       MR_SERVICE_PATH=$MR_HTTPX"://"$MR_DMAAP_APP_NAME":"$MR_INTERNAL_SECURE_PORT
+               fi
+       fi
+       echo ""
+}
+
+# Create a dmaap mr topic
+# args: <topic name> <topic-description>
+__create_topic() {
+       echo -ne " Creating read topic: $1"$SAMELINE
+
+       json_topic="{\"topicName\":\"$1\",\"partitionCount\":\"2\", \"replicationCount\":\"3\", \"transactionEnabled\":\"false\",\"topicDescription\":\"$2\"}"
+       echo $json_topic > ./tmp/$1.json
+
+       curlString="$MR_DMAAP_PATH/topics/create -X POST  -H Content-Type:application/json -d@./tmp/$1.json"
+       topic_retries=5
+       while [ $topic_retries -gt 0 ]; do
+               let topic_retries=topic_retries-1
+               result=$(__do_curl "$curlString")
+               if [ $? -eq 0 ]; then
+                       topic_retries=0
+                       echo -e " Creating read topic: $1 $GREEN OK $EGREEN"
+               fi
+               if [ $? -ne 0 ]; then
+                       if [ $topic_retries -eq 0 ]; then
+                               echo -e " Creating read topic: $1 $RED Failed $ERED"
+                               ((RES_CONF_FAIL++))
+                               return 1
+                       else
+                               sleep 1
+                       fi
+               fi
+       done
+       return 0
+}
+
+# Do a pipeclean of a topic - to overcome dmaap mr bug...
+# args: <topic> <post-url> <read-url>
+__dmaap_pipeclean() {
+       pipeclean_retries=50
+       echo -ne " Doing dmaap-mr pipe cleaning on topic: $1"$SAMELINE
+       while [ $pipeclean_retries -gt 0 ]; do
+               echo "{\"pipeclean-$1\":$pipeclean_retries}" > ./tmp/pipeclean.json
+               let pipeclean_retries=pipeclean_retries-1
+               curlString="$MR_DMAAP_PATH$2 -X POST  -H Content-Type:application/json -d@./tmp/pipeclean.json"
+               result=$(__do_curl "$curlString")
+               if [ $? -ne 0 ]; then
+                       sleep 1
+               else
+                       curlString="$MR_DMAAP_PATH$3"
+                       result=$(__do_curl "$curlString")
+                       if [ $? -eq 0 ]; then
+                               if [ $result != "[]" ]; then
+                                       echo -e " Doing dmaap-mr pipe cleaning on topic: $1 $GREEN OK $EGREEN"
+                                       return 0
+
+                               else
+                                       sleep 1
+                               fi
+                       fi
+               fi
+       done
+       echo -e "Doing dmaap-mr pipe cleaning on topic: $1 $RED Failed $ERED"
+       return 1
+}
+
+# Start the Message Router stub interface in the simulator group
+# args: -
+# (Function for test scripts)
+start_mr() {
+
+       echo -e $BOLD"Starting $MR_DMAAP_DISPLAY_NAME and/or $MR_STUB_DISPLAY_NAME"$EBOLD
+
+       if [ $RUNMODE == "KUBE" ]; then
+
+        # Table of possible combinations of included mr and included/prestarted dmaap-mr
+               # mr can never be prestarted
+               # mr can be used stand alone
+               # if dmaapmr is included/prestarted, then mr is needed as well as frontend
+
+        # Inverted logic - 0 mean true, 1 means false
+               # mr prestarted      0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
+               # mr included        0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1
+               # dmaap prestarted   0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1
+               # dmaap included     0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1
+               # ==================================================
+               # OK                 1 1 1 1 1 0 1 1 1 0 1 1 1 0 1 1
+
+               __check_prestarted_image 'MR'
+               retcode_prestarted_mr=$?
+               __check_included_image 'MR'
+               retcode_included_mr=$?
+
+               __check_prestarted_image 'DMAAPMR'
+               retcode_prestarted_dmaapmr=$?
+               __check_included_image 'DMAAPMR'
+               retcode_included_dmaapmr=$?
+
+               paramerror=1
+
+               if [ $retcode_prestarted_mr -ne 0 ] && [ $retcode_included_mr -eq 0 ]; then
+                       if [ $retcode_prestarted_dmaapmr -ne 0 ] && [ $retcode_included_dmaapmr -eq 0 ]; then
+                               paramerror=0
+                       fi
+               fi
+
+               if [ $retcode_prestarted_mr -ne 0 ] && [ $retcode_included_mr -eq 0 ]; then
+                       if [ $retcode_prestarted_dmaapmr -eq 0 ] && [ $retcode_included_dmaapmr -ne 0 ]; then
+                               paramerror=0
+                       fi
+               fi
+
+               if [ $retcode_prestarted_mr -ne 0 ] && [ $retcode_included_mr -eq 0 ]; then
+                       if [ $retcode_prestarted_dmaapmr -ne 0 ] && [ $retcode_included_dmaapmr -ne 0 ]; then
+                               paramerror=0
+                       fi
+               fi
+
+               if [ $paramerror -ne 0 ]; then
+                               echo -e $RED"The Message Router apps 'MR' and/or 'DMAAPMR' are not included in this test script"$ERED
+                               echo -e $RED"The Message Router will not be started"$ERED
+                               echo -e $RED"Both MR and DAAMPMR  - or - only MR - need to be included and/or prestarted"
+                               exit
+               fi
+
+               if [ $retcode_prestarted_dmaapmr -eq 0 ]; then
+                       echo -e " Using existing $MR_DMAAP_APP_NAME deployment and service"
+                       __kube_scale deployment $MR_DMAAP_APP_NAME $KUBE_ONAP_NAMESPACE 1
+               fi
+
+               if [ $retcode_included_dmaapmr -eq 0 ]; then
+                       #export MR_DMAAP_APP_NAME
+                       export MR_DMAAP_KUBE_APP_NAME=message-router
+                       MR_DMAAP_APP_NAME=$MR_DMAAP_KUBE_APP_NAME
+                       export KUBE_ONAP_NAMESPACE
+                       export MR_EXTERNAL_PORT
+                       export MR_INTERNAL_PORT
+                       export MR_EXTERNAL_SECURE_PORT
+                       export MR_INTERNAL_SECURE_PORT
+                       export ONAP_DMAAPMR_IMAGE
+
+                       export MR_KAFKA_BWDS_NAME=akfak-bwds
+                       export KUBE_ONAP_NAMESPACE
+
+                       export MR_ZOOKEEPER_APP_NAME
+                       export ONAP_ZOOKEEPER_IMAGE
+
+                       #Check if onap namespace exists, if not create it
+                       __kube_create_namespace $KUBE_ONAP_NAMESPACE
+
+                       # TODO - Fix domain name substitution in the prop file
+                       # Create config maps - dmaapmr app
+                       configfile=$PWD/tmp/MsgRtrApi.properties
+                       cp $SIM_GROUP"/"$MR_DMAAP_COMPOSE_DIR"/"mnt/mr/KUBE-MsgRtrApi.properties $configfile
+                       output_yaml=$PWD/tmp/dmaapmr_msgrtrapi_cfc.yaml
+                       __kube_create_configmap dmaapmr-msgrtrapi.properties $KUBE_ONAP_NAMESPACE autotest DMAAPMR $configfile $output_yaml
+
+                       configfile=$PWD/tmp/logback.xml
+                       cp $SIM_GROUP"/"$MR_DMAAP_COMPOSE_DIR"/"mnt/mr/logback.xml $configfile
+                       output_yaml=$PWD/tmp/dmaapmr_logback_cfc.yaml
+                       __kube_create_configmap dmaapmr-logback.xml $KUBE_ONAP_NAMESPACE autotest DMAAPMR $configfile $output_yaml
+
+                       configfile=$PWD/tmp/cadi.properties
+                       cp $SIM_GROUP"/"$MR_DMAAP_COMPOSE_DIR"/"mnt/mr/cadi.properties $configfile
+                       output_yaml=$PWD/tmp/dmaapmr_cadi_cfc.yaml
+                       __kube_create_configmap dmaapmr-cadi.properties $KUBE_ONAP_NAMESPACE autotest DMAAPMR $configfile $output_yaml
+
+                       # Create config maps - kafka app
+                       configfile=$PWD/tmp/zk_client_jaas.conf
+                       cp $SIM_GROUP"/"$MR_DMAAP_COMPOSE_DIR"/"mnt/kafka/zk_client_jaas.conf $configfile
+                       output_yaml=$PWD/tmp/dmaapmr_zk_client_cfc.yaml
+                       __kube_create_configmap dmaapmr-zk-client-jaas.conf $KUBE_ONAP_NAMESPACE autotest DMAAPMR $configfile $output_yaml
+
+                       # Create config maps - zookeeper app
+                       configfile=$PWD/tmp/zk_server_jaas.conf
+                       cp $SIM_GROUP"/"$MR_DMAAP_COMPOSE_DIR"/"mnt/zk/zk_server_jaas.conf $configfile
+                       output_yaml=$PWD/tmp/dmaapmr_zk_server_cfc.yaml
+                       __kube_create_configmap dmaapmr-zk-server-jaas.conf $KUBE_ONAP_NAMESPACE autotest DMAAPMR $configfile $output_yaml
+
+                       # Create service
+                       input_yaml=$SIM_GROUP"/"$MR_DMAAP_COMPOSE_DIR"/"svc.yaml
+                       output_yaml=$PWD/tmp/dmaapmr_svc.yaml
+                       __kube_create_instance service $MR_DMAAP_APP_NAME $input_yaml $output_yaml
+
+                       # Create app
+                       input_yaml=$SIM_GROUP"/"$MR_DMAAP_COMPOSE_DIR"/"app.yaml
+                       output_yaml=$PWD/tmp/dmaapmr_app.yaml
+                       __kube_create_instance app $MR_DMAAP_APP_NAME $input_yaml $output_yaml
+
+
+                       echo " Retrieving host and ports for service..."
+                       MR_DMAAP_HOST_NAME=$(__kube_get_service_host $MR_DMAAP_APP_NAME $KUBE_ONAP_NAMESPACE)
+
+                       MR_EXT_PORT=$(__kube_get_service_port $MR_DMAAP_APP_NAME $KUBE_ONAP_NAMESPACE "http")
+                       MR_EXT_SECURE_PORT=$(__kube_get_service_port $MR_DMAAP_APP_NAME $KUBE_ONAP_NAMESPACE "https")
+
+                       echo " Host IP, http port, https port: $MR_DMAAP_APP_NAME $MR_EXT_PORT $MR_EXT_SECURE_PORT"
+                       MR_SERVICE_PATH=""
+                       if [ $MR_HTTPX == "http" ]; then
+                               MR_DMAAP_PATH=$MR_HTTPX"://"$MR_DMAAP_HOST_NAME":"$MR_EXT_PORT
+                               MR_SERVICE_PATH=$MR_HTTPX"://"$MR_DMAAP_APP_NAME"."$KUBE_ONAP_NAMESPACE":"$MR_EXT_PORT
+                       else
+                               MR_DMAAP_PATH=$MR_HTTPX"://"$MR_DMAAP_HOST_NAME":"$MR_EXT_SECURE_PORT
+                               MR_SERVICE_PATH=$MR_HTTPX"://"$MR_DMAAP_APP_NAME"."$KUBE_ONAP_NAMESPACE":"$MR_EXT_SECURE_PORT
+                       fi
+
+                               __check_service_start $MR_DMAAP_APP_NAME $MR_DMAAP_PATH$MR_DMAAP_ALIVE_URL
+
+               fi
+
+               if [ $retcode_included_mr -eq 0 ]; then
+                       #exporting needed var for deployment
+                       export MR_STUB_APP_NAME
+                       export KUBE_ONAP_NAMESPACE
+                       export MRSTUB_IMAGE
+                       export MR_INTERNAL_PORT
+                       export MR_INTERNAL_SECURE_PORT
+                       export MR_EXTERNAL_PORT
+                       export MR_EXTERNAL_SECURE_PORT
+
+                       if [ $retcode_prestarted_dmaapmr -eq 0 ] || [ $retcode_included_dmaapmr -eq 0 ]; then  # Set topics for dmaap
+                               export TOPIC_READ="http://$MR_DMAAP_APP_NAME.$KUBE_ONAP_NAMESPACE:$MR_INTERNAL_PORT/events/$MR_READ_TOPIC"
+                               export TOPIC_WRITE="http://$MR_DMAAP_APP_NAME.$KUBE_ONAP_NAMESPACE:$MR_INTERNAL_PORT/events/$MR_WRITE_TOPIC/users/mr-stub?timeout=15000&limit=100"
+                       else
+                               export TOPIC_READ=""
+                               export TOPIC_WRITE=""
+                       fi
+
+                       #Check if onap namespace exists, if not create it
+                       __kube_create_namespace $KUBE_ONAP_NAMESPACE
+
+                       # Create service
+                       input_yaml=$SIM_GROUP"/"$MR_STUB_COMPOSE_DIR"/"svc.yaml
+                       output_yaml=$PWD/tmp/mr_svc.yaml
+                       __kube_create_instance service $MR_STUB_APP_NAME $input_yaml $output_yaml
+
+                       # Create app
+                       input_yaml=$SIM_GROUP"/"$MR_STUB_COMPOSE_DIR"/"app.yaml
+                       output_yaml=$PWD/tmp/mr_app.yaml
+                       __kube_create_instance app $MR_STUB_APP_NAME $input_yaml $output_yaml
+
+
+               fi
+
+
+               echo " Retrieving host and ports for service..."
+               MR_STUB_HOST_NAME=$(__kube_get_service_host $MR_STUB_APP_NAME $KUBE_ONAP_NAMESPACE)
+
+               MR_EXT_PORT=$(__kube_get_service_port $MR_STUB_APP_NAME $KUBE_ONAP_NAMESPACE "http")
+               MR_EXT_SECURE_PORT=$(__kube_get_service_port $MR_STUB_APP_NAME $KUBE_ONAP_NAMESPACE "https")
+
+               echo " Host IP, http port, https port: $MR_STUB_APP_NAME $MR_EXT_PORT $MR_EXT_SECURE_PORT"
+               if [ $MR_HTTPX == "http" ]; then
+                       MR_STUB_PATH=$MR_HTTPX"://"$MR_STUB_HOST_NAME":"$MR_EXT_PORT
+                       if [ -z "$MR_SERVICE_PATH" ]; then
+                               MR_SERVICE_PATH=$MR_HTTPX"://"$MR_STUB_APP_NAME"."$KUBE_ONAP_NAMESPACE":"$MR_EXT_PORT
+                       fi
+               else
+                       MR_STUB_PATH=$MR_HTTPX"://"$MR_STUB_HOST_NAME":"$MR_EXT_SECURE_PORT
+                       if [ -z "$MR_SERVICE_PATH" ]; then
+                               MR_SERVICE_PATH=$MR_HTTPX"://"$MR_STUB_APP_NAME"."$KUBE_ONAP_NAMESPACE":"$MR_EXT_SECURE_PORT
+                       fi
+               fi
+               MR_ADAPTER_HTTP="http://"$MR_STUB_HOST_NAME":"$MR_EXT_PORT
+               MR_ADAPTER_HTTPS="https://"$MR_STUB_HOST_NAME":"$MR_EXT_SECURE_PORT
+
+               __check_service_start $MR_STUB_APP_NAME $MR_STUB_PATH$MR_STUB_ALIVE_URL
+
+               echo -ne " Service $MR_STUB_APP_NAME - reset  "$SAMELINE
+               result=$(__do_curl $MR_STUB_APP_NAME $MR_STUB_PATH/reset)
+               if [ $? -ne 0 ]; then
+                       echo -e " Service $MR_STUB_APP_NAME - reset  $RED Failed $ERED - will continue"
+               else
+                       echo -e " Service $MR_STUB_APP_NAME - reset  $GREEN OK $EGREEN"
+               fi
+
+
+       else
+
+               __check_included_image 'DMAAPMR'
+               retcode_dmaapmr=$?
+               __check_included_image 'MR'
+               retcode_mr=$?
+
+               if [ $retcode_dmaapmr -ne 0 ] && [ $retcode_mr -ne 0 ]; then
+                               echo -e $RED"The Message Router apps 'MR' and/or 'DMAAPMR' are not included in this test script"$ERED
+                               echo -e $RED"The Message Router will not be started"$ERED
+                               echo -e $RED"Both MR and DAAMPMR  - or - only MR - need to be included"
+                               exit
+               fi
+
+               if [ $retcode_dmaapmr -eq 0 ] && [ $retcode_mr -ne 0 ]; then
+                               echo -e $RED"The Message Router apps 'MR' and/or 'DMAAPMR' are not included in this test script"$ERED
+                               echo -e $RED"The Message Router will not be started"$ERED
+                               echo -e $RED"Both MR and DAAMPMR  - or - only MR - need to be included"
+                               exit
+               fi
+
+               export TOPIC_READ=""
+        export TOPIC_WRITE=""
+               if [ $retcode_dmaapmr -eq 0 ]; then  # Set topics for dmaap
+                       export TOPIC_READ="http://$MR_DMAAP_APP_NAME:$MR_INTERNAL_PORT/events/$MR_READ_TOPIC"
+                       export TOPIC_WRITE="http://$MR_DMAAP_APP_NAME:$MR_INTERNAL_PORT/events/$MR_WRITE_TOPIC/users/mr-stub?timeout=15000&limit=100"
+               fi
+
+               export DOCKER_SIM_NWNAME
+               export ONAP_ZOOKEEPER_IMAGE
+               export MR_ZOOKEEPER_APP_NAME
+               export ONAP_KAFKA_IMAGE
+               export MR_KAFKA_APP_NAME
+               export ONAP_DMAAPMR_IMAGE
+               export MR_DMAAP_APP_NAME
+               export MR_DMAAP_LOCALHOST_PORT
+               export MR_INTERNAL_PORT
+               export MR_DMAAP_LOCALHOST_SECURE_PORT
+               export MR_INTERNAL_SECURE_PORT
+
+               if [ $retcode_dmaapmr -eq 0 ]; then
+                       __start_container $MR_DMAAP_COMPOSE_DIR NODOCKERARGS 1 $MR_DMAAP_APP_NAME
+
+                       __check_service_start $MR_DMAAP_APP_NAME $MR_DMAAP_PATH$MR_DMAAP_ALIVE_URL
+
+
+                       __create_topic $MR_READ_TOPIC "Topic for reading policy messages"
+
+                       __create_topic $MR_WRITE_TOPIC "Topic for writing policy messages"
+
+                       __dmaap_pipeclean $MR_READ_TOPIC "/events/A1-POLICY-AGENT-READ" "/events/A1-POLICY-AGENT-READ/users/policy-agent?timeout=1000&limit=100"
+
+                       __dmaap_pipeclean $MR_WRITE_TOPIC "/events/A1-POLICY-AGENT-WRITE" "/events/A1-POLICY-AGENT-WRITE/users/mr-stub?timeout=1000&limit=100"
+
+                       echo " Current topics:"
+                       curlString="$MR_DMAAP_PATH/topics"
+                       result=$(__do_curl "$curlString")
+                       echo $result | indent2
+               fi
+
+               export DOCKER_SIM_NWNAME
+               export MR_STUB_APP_NAME
+               export MRSTUB_IMAGE
+               export MR_INTERNAL_PORT
+               export MR_INTERNAL_SECURE_PORT
+               export MR_STUB_LOCALHOST_PORT
+               export MR_STUB_LOCALHOST_SECURE_PORT
+               export MR_STUB_CERT_MOUNT_DIR
+
+               if [ $retcode_mr -eq 0 ]; then
+                       __start_container $MR_STUB_COMPOSE_DIR NODOCKERARGS 1 $MR_STUB_APP_NAME
+
+                       __check_service_start $MR_STUB_APP_NAME $MR_STUB_PATH$MR_STUB_ALIVE_URL
+               fi
+
+       fi
+       echo ""
+       return 0
+}
+
+### Generic test cases for varaible checking
+
+# Tests if a variable value in the MR stub is equal to a target value and and optional timeout.
+# Arg: <variable-name> <target-value> - This test set pass or fail depending on if the variable is
+# equal to the target or not.
+# Arg: <variable-name> <target-value> <timeout-in-sec>  - This test waits up to the timeout seconds
+# before setting pass or fail depending on if the variable value becomes equal to the target
+# value or not.
+# (Function for test scripts)
+mr_equal() {
+       if [ $# -eq 2 ] || [ $# -eq 3 ]; then
+               __var_test "MR" $MR_STUB_PATH/counter/ $1 "=" $2 $3
+       else
+               ((RES_CONF_FAIL++))
+               __print_err "Wrong args to mr_equal, needs two or three args: <sim-param> <target-value> [ timeout ]" $@
+       fi
+}
+
+# Tests if a variable value in the MR stub is greater than a target value and and optional timeout.
+# Arg: <variable-name> <target-value> - This test set pass or fail depending on if the variable is
+# greater than the target or not.
+# Arg: <variable-name> <target-value> <timeout-in-sec>  - This test waits up to the timeout seconds
+# before setting pass or fail depending on if the variable value becomes greater than the target
+# value or not.
+# (Function for test scripts)
+mr_greater() {
+       if [ $# -eq 2 ] || [ $# -eq 3 ]; then
+               __var_test "MR" $MR_STUB_PATH/counter/ $1 ">" $2 $3
+       else
+               ((RES_CONF_FAIL++))
+               __print_err "Wrong args to mr_greater, needs two or three args: <sim-param> <target-value> [ timeout ]" $@
+       fi
+}
+
+# Read a variable value from MR sim and send to stdout. Arg: <variable-name>
+mr_read() {
+       echo "$(__do_curl $MR_STUB_PATH/counter/$1)"
+}
+
+# Print a variable value from the MR stub.
+# arg: <variable-name>
+# (Function for test scripts)
+mr_print() {
+       if [ $# != 1 ]; then
+               ((RES_CONF_FAIL++))
+       __print_err "need one arg, <mr-param>" $@
+               exit 1
+       fi
+       echo -e $BOLD"INFO(${BASH_LINENO[0]}): mrstub, $1 = $(__do_curl $MR_STUB_PATH/counter/$1)"$EBOLD
+}
\ No newline at end of file
index a27f3b4..4dfe06b 100644 (file)
 #  ============LICENSE_END=================================================
 #
 
+# This is a script that contains container/service management functions and test functions for Producer stub
+
+## Access to Prod stub sim
+# Direct access
+PROD_STUB_HTTPX="http"
+PROD_STUB_HOST_NAME=$LOCALHOST_NAME
+PROD_STUB_PATH=$PROD_STUB_HTTPX"://"$PROD_STUB_HOST_NAME":"$PROD_STUB_EXTERNAL_PORT
+
+#Docker/Kube internal path
+if [ $RUNMODE == "KUBE" ]; then
+       PROD_STUB_SERVICE_PATH=$PROD_STUB_HTTPX"://"$PROD_STUB_APP_NAME"."$KUBE_SIM_NAMESPACE":"$PROD_STUB_EXTERNAL_PORT
+else
+       PROD_STUB_SERVICE_PATH=$PROD_STUB_HTTPX"://"$PROD_STUB_APP_NAME":"$PROD_STUB_INTERNAL_PORT
+fi
+
+# Set http as the protocol to use for all communication to the Producer stub
+# args: -
+# (Function for test scripts)
+use_prod_stub_http() {
+       echo -e $BOLD"Producer stub protocol setting"$EBOLD
+       echo -e " Using $BOLD http $EBOLD towards Producer stub"
+
+       PROD_STUB_HTTPX="http"
+    PROD_STUB_PATH=$PROD_STUB_HTTPX"://"$PROD_STUB_HOST_NAME":"$PROD_STUB_EXTERNAL_PORT
+
+       if [ $RUNMODE == "KUBE" ]; then
+               PROD_STUB_SERVICE_PATH=$PROD_STUB_HTTPX"://"$PROD_STUB_APP_NAME"."$KUBE_SIM_NAMESPACE":"$PROD_STUB_EXTERNAL_PORT
+       else
+               PROD_STUB_SERVICE_PATH=$PROD_STUB_HTTPX"://"$PROD_STUB_APP_NAME":"$PROD_STUB_INTERNAL_PORT
+       fi
+
+       echo ""
+}
+
+# Set https as the protocol to use for all communication to the Producer stub
+# args: -
+# (Function for test scripts)
+use_prod_stub_https() {
+       echo -e $BOLD"Producer stub protocol setting"$EBOLD
+       echo -e " Using $BOLD https $EBOLD towards Producer stub"
+
+       PROD_STUB_HTTPX="https"
+    PROD_STUB_PATH=$PROD_STUB_HTTPX"://"$PROD_STUB_HOST_NAME":"$PROD_STUB_EXTERNAL_SECURE_PORT
+
+       if [ $RUNMODE == "KUBE" ]; then
+               PROD_STUB_SERVICE_PATH=$PROD_STUB_HTTPX"://"$PROD_STUB_APP_NAME"."$KUBE_SIM_NAMESPACE":"$PROD_STUB_EXTERNAL_SECURE_PORT
+       else
+               PROD_STUB_SERVICE_PATH=$PROD_STUB_HTTPX"://"$PROD_STUB_APP_NAME":"$PROD_STUB_INTERNAL_SECURE_PORT
+       fi
+       echo ""
+}
 
 ### Admin API functions producer stub
 
+###########################
+### Producer stub functions
+###########################
+
+# Start the Producer stub in the simulator group
+# args: -
+# (Function for test scripts)
+start_prod_stub() {
+
+       echo -e $BOLD"Starting $PROD_STUB_DISPLAY_NAME"$EBOLD
+
+       if [ $RUNMODE == "KUBE" ]; then
+
+               # Check if app shall be fully managed by the test script
+               __check_included_image "PRODSTUB"
+               retcode_i=$?
+
+               # Check if app shall only be used by the testscipt
+               __check_prestarted_image "PRODSTUB"
+               retcode_p=$?
+
+               if [ $retcode_i -ne 0 ] && [ $retcode_p -ne 0 ]; then
+                       echo -e $RED"The $ECS_APP_NAME app is not included as managed nor prestarted in this test script"$ERED
+                       echo -e $RED"The $ECS_APP_NAME will not be started"$ERED
+                       exit
+               fi
+               if [ $retcode_i -eq 0 ] && [ $retcode_p -eq 0 ]; then
+                       echo -e $RED"The $ECS_APP_NAME app is included both as managed and prestarted in this test script"$ERED
+                       echo -e $RED"The $ECS_APP_NAME will not be started"$ERED
+                       exit
+               fi
+
+               if [ $retcode_p -eq 0 ]; then
+                       echo -e " Using existing $PROD_STUB_APP_NAME deployment and service"
+                       echo " Setting RC replicas=1"
+                       __kube_scale deployment $PROD_STUB_APP_NAME $KUBE_SIM_NAMESPACE 1
+               fi
+
+               if [ $retcode_i -eq 0 ]; then
+                       echo -e " Creating $PROD_STUB_APP_NAME deployment and service"
+                       export PROD_STUB_APP_NAME
+                       export KUBE_SIM_NAMESPACE
+                       export PROD_STUB_IMAGE
+                       export PROD_STUB_INTERNAL_PORT
+                       export PROD_STUB_INTERNAL_SECURE_PORT
+                       export PROD_STUB_EXTERNAL_PORT
+                       export PROD_STUB_EXTERNAL_SECURE_PORT
+
+            __kube_create_namespace $KUBE_SIM_NAMESPACE
+
+                       # Create service
+                       input_yaml=$SIM_GROUP"/"$PROD_STUB_COMPOSE_DIR"/"svc.yaml
+                       output_yaml=$PWD/tmp/prodstub_svc.yaml
+                       __kube_create_instance service $PROD_STUB_APP_NAME $input_yaml $output_yaml
+
+                       # Create app
+                       input_yaml=$SIM_GROUP"/"$PROD_STUB_COMPOSE_DIR"/"app.yaml
+                       output_yaml=$PWD/tmp/prodstub_app.yaml
+                       __kube_create_instance app $PROD_STUB_APP_NAME $input_yaml $output_yaml
+               fi
+
+               PROD_STUB_HOST_NAME=$(__kube_get_service_host $PROD_STUB_APP_NAME $KUBE_SIM_NAMESPACE)
+
+               PROD_STUB_EXTERNAL_PORT=$(__kube_get_service_port $PROD_STUB_APP_NAME $KUBE_SIM_NAMESPACE "http")
+               PROD_STUB_EXTERNAL_SECURE_PORT=$(__kube_get_service_port $PROD_STUB_APP_NAME $KUBE_SIM_NAMESPACE "https")
+
+               echo " Host IP, http port, https port: $PROD_STUB_HOST_NAME $PROD_STUB_EXTERNAL_PORT $PROD_STUB_EXTERNAL_SECURE_PORT"
+               if [ $PROD_STUB_HTTPX == "http" ]; then
+            PROD_STUB_PATH=$PROD_STUB_HTTPX"://"$PROD_STUB_HOST_NAME":"$PROD_STUB_EXTERNAL_PORT
+                       PROD_STUB_SERVICE_PATH=$PROD_STUB_HTTPX"://"$PROD_STUB_APP_NAME"."$KUBE_SIM_NAMESPACE":"$PROD_STUB_EXTERNAL_PORT
+               else
+            PROD_STUB_PATH=$PROD_STUB_HTTPX"://"$PROD_STUB_HOST_NAME":"$PROD_STUB_EXTERNAL_SECURE_PORT
+                       PROD_STUB_SERVICE_PATH=$PROD_STUB_HTTPX"://"$PROD_STUB_APP_NAME"."$KUBE_SIM_NAMESPACE":"$PROD_STUB_EXTERNAL_SECURE_PORT
+               fi
+
+               __check_service_start $PROD_STUB_APP_NAME $PROD_STUB_PATH$PROD_STUB_ALIVE_URL
+
+               echo -ne " Service $PROD_STUB_APP_NAME - reset  "$SAMELINE
+               result=$(__do_curl $PROD_STUB_PATH/reset)
+               if [ $? -ne 0 ]; then
+                       echo -e " Service $PROD_STUB_APP_NAME - reset  $RED Failed $ERED - will continue"
+               else
+                       echo -e " Service $PROD_STUB_APP_NAME - reset  $GREEN OK $EGREEN"
+               fi
+       else
+
+               # Check if docker app shall be fully managed by the test script
+               __check_included_image 'PRODSTUB'
+               if [ $? -eq 1 ]; then
+                       echo -e $RED"The Producer stub app is not included as managed in this test script"$ERED
+                       echo -e $RED"The Producer stub will not be started"$ERED
+                       exit
+               fi
+
+        export PROD_STUB_APP_NAME
+        export PROD_STUB_APP_NAME_ALIAS
+        export PROD_STUB_INTERNAL_PORT
+        export PROD_STUB_EXTERNAL_PORT
+        export PROD_STUB_INTERNAL_SECURE_PORT
+        export PROD_STUB_EXTERNAL_SECURE_PORT
+        export DOCKER_SIM_NWNAME
+
+               __start_container $PROD_STUB_COMPOSE_DIR NODOCKERARGS 1 $PROD_STUB_APP_NAME
+
+        __check_service_start $PROD_STUB_APP_NAME $PROD_STUB_PATH$PROD_STUB_ALIVE_URL
+       fi
+    echo ""
+    return 0
+}
 
 # Excute a curl cmd towards the prodstub simulator and check the response code.
 # args: TEST|CONF <expected-response-code> <curl-cmd-string> [<json-file-to-compare-output>]
@@ -75,7 +235,7 @@ prodstub_arm_producer() {
                return 1
        fi
 
-    curlString="curl -X PUT -skw %{http_code} $PROD_STUB_LOCALHOST/arm/supervision/"$2
+    curlString="curl -X PUT -skw %{http_code} $PROD_STUB_PATH/arm/supervision/"$2
        if [ $# -eq 3 ]; then
                curlString=$curlString"?response="$3
        fi
@@ -94,7 +254,7 @@ prodstub_arm_job_create() {
                return 1
        fi
 
-    curlString="curl -X PUT -skw %{http_code} $PROD_STUB_LOCALHOST/arm/create/$2/$3"
+    curlString="curl -X PUT -skw %{http_code} $PROD_STUB_PATH/arm/create/$2/$3"
        if [ $# -eq 4 ]; then
                curlString=$curlString"?response="$4
        fi
@@ -113,7 +273,7 @@ prodstub_arm_job_delete() {
                return 1
        fi
 
-    curlString="curl -X PUT -skw %{http_code} $PROD_STUB_LOCALHOST/arm/delete/$2/$3"
+    curlString="curl -X PUT -skw %{http_code} $PROD_STUB_PATH/arm/delete/$2/$3"
        if [ $# -eq 4 ]; then
                curlString=$curlString"?response="$4
        fi
@@ -132,7 +292,7 @@ prodstub_arm_type() {
                return 1
        fi
 
-    curlString="curl -X PUT -skw %{http_code} $PROD_STUB_LOCALHOST/arm/type/$2/$3"
+    curlString="curl -X PUT -skw %{http_code} $PROD_STUB_PATH/arm/type/$2/$3"
 
     __execute_curl_to_prodstub CONF $1 "$curlString"
     return $?
@@ -148,7 +308,7 @@ prodstub_disarm_type() {
                return 1
        fi
 
-    curlString="curl -X DELETE -skw %{http_code} $PROD_STUB_LOCALHOST/arm/type/$2/$3"
+    curlString="curl -X DELETE -skw %{http_code} $PROD_STUB_PATH/arm/type/$2/$3"
 
     __execute_curl_to_prodstub CONF $1 "$curlString"
     return $?
@@ -174,7 +334,7 @@ prodstub_check_jobdata() {
     file="./tmp/.p.json"
        echo "$targetJson" > $file
 
-    curlString="curl -X GET -skw %{http_code} $PROD_STUB_LOCALHOST/jobdata/$2/$3"
+    curlString="curl -X GET -skw %{http_code} $PROD_STUB_PATH/jobdata/$2/$3"
 
     __execute_curl_to_prodstub TEST $1 "$curlString" $file
     return $?
@@ -189,7 +349,7 @@ prodstub_delete_jobdata() {
                __print_err "<response-code> <producer-id> <job-id> " $@
                return 1
        fi
-    curlString="curl -X DELETE -skw %{http_code} $PROD_STUB_LOCALHOST/jobdata/$2/$3"
+    curlString="curl -X DELETE -skw %{http_code} $PROD_STUB_PATH/jobdata/$2/$3"
 
     __execute_curl_to_prodstub CONF $1 "$curlString"
     return $?
@@ -204,7 +364,7 @@ prodstub_delete_jobdata() {
 # (Function for test scripts)
 prodstub_equal() {
        if [ $# -eq 2 ] || [ $# -eq 3 ]; then
-               __var_test "PRODSTUB" "$LOCALHOST$PROD_STUB_EXTERNAL_PORT/counter/" $1 "=" $2 $3
+               __var_test "PRODSTUB" "$PROD_STUB_PATH/counter/" $1 "=" $2 $3
        else
                __print_err "Wrong args to prodstub_equal, needs two or three args: <sim-param> <target-value> [ timeout ]" $@
        fi
index dce28f3..777b9d3 100644 (file)
 #  ============LICENSE_END=================================================
 #
 
-# This is a script that contains specific test functions for RAPP Catalogue API
+# This is a script that contains container/service managemnt functions test functions for RAPP Catalogue API
 
-. ../common/api_curl.sh
+## Access to RAPP Catalogue
+# Host name may be changed if app started by kube
+# Direct access from script
+RC_HTTPX="http"
+RC_HOST_NAME=$LOCALHOST_NAME
+RC_PATH=$RC_HTTPX"://"$RC_HOST_NAME":"$RAPP_CAT_EXTERNAL_PORT
+# RC_ADAPTER used for switch between REST and DMAAP (only REST supported currently)
+RC_ADAPTER_TYPE="REST"
+RC_ADAPTER=$RC_PATH
+
+
+###########################
+### RAPP Catalogue
+###########################
+
+# Set http as the protocol to use for all communication to the RAPP Catalogue
+# args: -
+# (Function for test scripts)
+use_rapp_catalogue_http() {
+       echo -e $BOLD"RAPP Catalogue protocol setting"$EBOLD
+       echo -e " Using $BOLD http $EBOLD towards the RAPP Catalogue"
+       RC_HTTPX="http"
+       RC_PATH=$RC_HTTPX"://"$RC_HOST_NAME":"$RAPP_CAT_EXTERNAL_PORT
+       RC_ADAPTER_TYPE="REST"
+       RC_ADAPTER=$RC_PATH
+       echo ""
+}
+
+# Set https as the protocol to use for all communication to the RAPP Catalogue
+# args: -
+# (Function for test scripts)
+use_rapp_catalogue_https() {
+       echo -e $BOLD"RAPP Catalogue protocol setting"$EBOLD
+       echo -e " Using $BOLD https $EBOLD towards the RAPP Catalogue"
+       RC_HTTPX="https"
+       RC_PATH=$RC_HTTPX"://"$RC_HOST_NAME":"$RAPP_CAT_EXTERNAL_SECURE_PORT
+       RC_ADAPTER_TYPE="REST"
+       RC_ADAPTER=$RC_PATH
+       echo ""
+}
+
+# Start the RAPP Catalogue container
+# args: -
+# (Function for test scripts)
+start_rapp_catalogue() {
+
+       echo -e $BOLD"Starting $RAPP_CAT_DISPLAY_NAME"$EBOLD
+
+       if [ $RUNMODE == "KUBE" ]; then
+
+               # Check if app shall be fully managed by the test script
+               __check_included_image "RC"
+               retcode_i=$?
+
+               # Check if app shall only be used by the testscipt
+               __check_prestarted_image "RC"
+               retcode_p=$?
+
+               if [ $retcode_i -ne 0 ] && [ $retcode_p -ne 0 ]; then
+                       echo -e $RED"The $RAPP_CAT_APP_NAME app is not included as managed nor prestarted in this test script"$ERED
+                       echo -e $RED"The $RAPP_CAT_APP_NAME will not be started"$ERED
+                       exit
+               fi
+               if [ $retcode_i -eq 0 ] && [ $retcode_p -eq 0 ]; then
+                       echo -e $RED"The $RAPP_CAT_APP_NAME app is included both as managed and prestarted in this test script"$ERED
+                       echo -e $RED"The $RAPP_CAT_APP_NAME will not be started"$ERED
+                       exit
+               fi
+
+               if [ $retcode_p -eq 0 ]; then
+                       echo -e " Using existing $RAPP_CAT_APP_NAME deployment and service"
+                       echo " Setting $RAPP_CAT_APP_NAME replicas=1"
+                       __kube_scale deployment $RAPP_CAT_APP_NAME $KUBE_NONRTRIC_NAMESPACE 1
+               fi
+
+               if [ $retcode_i -eq 0 ]; then
+
+                       echo -e " Creating $RAPP_CAT_APP_NAME app and expose service"
+
+                       #Check if nonrtric namespace exists, if not create it
+                       __kube_create_namespace $KUBE_NONRTRIC_NAMESPACE
+
+                       export RAPP_CAT_APP_NAME
+                       export KUBE_NONRTRIC_NAMESPACE
+                       export RAPP_CAT_IMAGE
+                       export RAPP_CAT_INTERNAL_PORT
+                       export RAPP_CAT_INTERNAL_SECURE_PORT
+                       export RAPP_CAT_EXTERNAL_PORT
+                       export RAPP_CAT_EXTERNAL_SECURE_PORT
+
+                       #Create service
+                       input_yaml=$SIM_GROUP"/"$RAPP_CAT_COMPOSE_DIR"/"svc.yaml
+                       output_yaml=$PWD/tmp/rac_svc.yaml
+                       __kube_create_instance service $RAPP_CAT_APP_NAME $input_yaml $output_yaml
+
+                       #Create app
+                       input_yaml=$SIM_GROUP"/"$RAPP_CAT_COMPOSE_DIR"/"app.yaml
+                       output_yaml=$PWD/tmp/rac_app.yaml
+                       __kube_create_instance app $RAPP_CAT_APP_NAME $input_yaml $output_yaml
+               fi
+
+               echo " Retrieving host and ports for service..."
+               RC_HOST_NAME=$(__kube_get_service_host $RAPP_CAT_APP_NAME $KUBE_NONRTRIC_NAMESPACE)
+
+               RAPP_CAT_EXTERNAL_PORT=$(__kube_get_service_port $RAPP_CAT_APP_NAME $KUBE_NONRTRIC_NAMESPACE "http")
+               RAPP_CAT_EXTERNAL_SECURE_PORT=$(__kube_get_service_port $RAPP_CAT_APP_NAME $KUBE_NONRTRIC_NAMESPACE "https")
+
+               echo " Host IP, http port, https port: $RC_HOST_NAME $RAPP_CAT_EXTERNAL_PORT $RAPP_CAT_EXTERNAL_SECURE_PORT"
+               if [ $RC_HTTPX == "http" ]; then
+                       RC_PATH=$RC_HTTPX"://"$RC_HOST_NAME":"$RAPP_CAT_EXTERNAL_PORT
+               else
+                       RC_PATH=$RC_HTTPX"://"$RC_HOST_NAME":"$RAPP_CAT_EXTERNAL_SECURE_PORT
+               fi
+
+               __check_service_start $RAPP_CAT_APP_NAME $RC_PATH$RAPP_CAT_ALIVE_URL
+
+               # Update the curl adapter if set to rest, no change if type dmaap
+               if [ $RC_ADAPTER_TYPE == "REST" ]; then
+                       RC_ADAPTER=$RC_PATH
+               fi
+       else
+               __check_included_image 'RC'
+               if [ $? -eq 1 ]; then
+                       echo -e $RED"The RAPP Catalogue app is not included as managed in this test script"$ERED
+                       echo -e $RED"The RAPP Catalogue will not be started"$ERED
+                       exit
+               fi
+
+               export RAPP_CAT_APP_NAME
+        export RAPP_CAT_INTERNAL_PORT
+        export RAPP_CAT_EXTERNAL_PORT
+        export RAPP_CAT_INTERNAL_SECURE_PORT
+        export RAPP_CAT_EXTERNAL_SECURE_PORT
+        export DOCKER_SIM_NWNAME
+
+               __start_container $RAPP_CAT_COMPOSE_DIR NODOCKERARGS 1 $RAPP_CAT_APP_NAME
+
+               __check_service_start $RAPP_CAT_APP_NAME $RC_PATH$RAPP_CAT_ALIVE_URL
+       fi
+       echo ""
+}
 
 # Tests if a variable value in the RAPP Catalogue is equal to a target value and and optional timeout.
 # Arg: <variable-name> <target-value> - This test set pass or fail depending on if the variable is
 # (Function for test scripts)
 rc_equal() {
        if [ $# -eq 2 ] || [ $# -eq 3 ]; then
-               __var_test RC "$LOCALHOST$RC_EXTERNAL_PORT/" $1 "=" $2 $3
+               #__var_test RC "$LOCALHOST_HTTP:$RC_EXTERNAL_PORT/" $1 "=" $2 $3
+               __var_test RC "$RC_PATH/" $1 "=" $2 $3
        else
                __print_err "Wrong args to ecs_equal, needs two or three args: <sim-param> <target-value> [ timeout ]" $@
        fi
index 2a68aa0..bb057ce 100644 (file)
 #  ============LICENSE_END=================================================
 #
 
+# This is a script that contains container/service management functions and test functions for RICSIM A1 simulators
+
+RIC_SIM_HTTPX="http"
+RIC_SIM_HOST=$RIC_SIM_HTTPX"://"$LOCALHOST_NAME
+RIC_SIM_PORT=$RIC_SIM_INTERNAL_PORT
+
+
+#Vars for A1 interface version and container count
+G1_A1_VERSION=""
+G2_A1_VERSION=""
+G3_A1_VERSION=""
+G4_A1_VERSION=""
+G5_A1_VERSION=""
+G1_COUNT=0
+G2_COUNT=0
+G3_COUNT=0
+G4_COUNT=0
+G5_COUNT=0
+
+
+###########################
+### RIC Simulator functions
+###########################
+
+use_simulator_http() {
+       echo -e $BOLD"RICSIM protocol setting"$EBOLD
+       echo -e " Using $BOLD http $EBOLD towards the simulators"
+       RIC_SIM_HTTPX="http"
+       RIC_SIM_HOST=$RIC_SIM_HTTPX"://"$LOCALHOST_NAME
+       RIC_SIM_PORT=$RIC_SIM_INTERNAL_PORT
+       echo ""
+}
+
+use_simulator_https() {
+       echo -e $BOLD"RICSIM protocol setting"$EBOLD
+       echo -e " Using $BOLD https $EBOLD towards the simulators"
+       RIC_SIM_HTTPX="https"
+       RIC_SIM_HOST=$RIC_SIM_HTTPX"://"$LOCALHOST_NAME
+       RIC_SIM_PORT=$RIC_SIM_INTERNAL_SECURE_PORT
+       echo ""
+}
+
+# Start one group (ricsim_g1, ricsim_g2 .. ricsim_g5) with a number of RIC Simulators using a given A interface
+# 'ricsim' may be set on command line to other prefix
+# args:  ricsim_g1|ricsim_g2|ricsim_g3|ricsim_g4|ricsim_g5 <count> <interface-id>
+# (Function for test scripts)
+start_ric_simulators() {
+
+       echo -e $BOLD"Starting $RIC_SIM_DISPLAY_NAME"$EBOLD
+
+       if [ $RUNMODE == "KUBE" ]; then
+
+               # Check if app shall be fully managed by the test script
+               __check_included_image "RICSIM"
+               retcode_i=$?
+
+               # Check if app shall only be used by the testscipt
+               __check_prestarted_image "RICSIM"
+               retcode_p=$?
+
+               if [ $retcode_i -ne 0 ] && [ $retcode_p -ne 0 ]; then
+                       echo -e $RED"The $1 app is not included as managed nor prestarted in this test script"$ERED
+                       echo -e $RED"The $1 will not be started"$ERED
+                       exit
+               fi
+               if [ $retcode_i -eq 0 ] && [ $retcode_p -eq 0 ]; then
+                       echo -e $RED"The $1 stub app is included both as managed and prestarted in this test script"$ERED
+                       echo -e $RED"The $1 will not be started"$ERED
+                       exit
+               fi
+
+               if [ $retcode_p -eq 0 ]; then
+                       echo -e " Using existing $1 statefulset and service"
+                       echo " Using existing simulator deployment and service for statefulset $1"
+                       echo " Setting $1 replicas=$2"
+                       __kube_scale statefulset $1 $KUBE_NONRTRIC_NAMESPACE $2
+                       echo ""
+                       return
+               fi
+       fi
+
+       RIC1=$RIC_SIM_PREFIX"_g1"
+       RIC2=$RIC_SIM_PREFIX"_g2"
+       RIC3=$RIC_SIM_PREFIX"_g3"
+       RIC4=$RIC_SIM_PREFIX"_g4"
+       RIC5=$RIC_SIM_PREFIX"_g5"
+
+       if [ $# != 3 ]; then
+               ((RES_CONF_FAIL++))
+               __print_err "need three args,  $RIC1|$RIC2|$RIC3|$RIC4|$RIC5 <count> <interface-id>" $@
+               exit 1
+       fi
+
+       echo " $2 simulators using basename: $1 on interface: $3"
+       #Set env var for simulator count and A1 interface vesion for the given group
+       if [ $1 == "$RIC1" ]; then
+               G1_COUNT=$2
+               G1_A1_VERSION=$3
+       elif [ $1 == "$RIC2" ]; then
+               G2_COUNT=$2
+               G2_A1_VERSION=$3
+       elif [ $1 == "$RIC3" ]; then
+               G3_COUNT=$2
+               G3_A1_VERSION=$3
+       elif [ $1 == "$RIC4" ]; then
+               G4_COUNT=$2
+               G4_A1_VERSION=$3
+       elif [ $1 == "$RIC5" ]; then
+               G5_COUNT=$2
+               G5_A1_VERSION=$3
+       else
+               ((RES_CONF_FAIL++))
+               __print_err "need three args, $RIC1|$RIC2|$RIC3|$RIC4|$RIC5 <count> <interface-id>" $@
+               exit 1
+       fi
+
+       if [ $RUNMODE == "KUBE" ]; then
+
+               if [ $retcode_i -eq 0 ]; then
+
+                       #export needed env var for statefulset
+                       export RIC_SIM_SET_NAME=$(echo "$1" | tr '_' '-')  #kube does not accept underscore in names
+                       export KUBE_NONRTRIC_NAMESPACE
+                       export RIC_SIM_IMAGE
+                       #Adding 1 more instance, instance 0 is never used. This is done to keep test scripts compatible
+                       # with docker that starts instance index on 1.....
+                       export RIC_SIM_COUNT=$(($2+1))
+                       export A1_VERSION=$3
+                       export RIC_SIM_INTERNAL_PORT
+                       export RIC_SIM_INTERNAL_SECURE_PORT
+
+                       echo -e " Creating $POLICY_AGENT_APP_NAME app and expose service"
+
+                       #Check if nonrtric namespace exists, if not create it
+                       __kube_create_namespace $KUBE_NONRTRIC_NAMESPACE
+
+                       # Create service
+                       input_yaml=$SIM_GROUP"/"$RIC_SIM_COMPOSE_DIR"/"svc.yaml
+                       output_yaml=$PWD/tmp/ric_${1}_svc.yaml
+                       __kube_create_instance service $RIC_SIM_SET_NAME $input_yaml $output_yaml
+
+                       # Create app
+                       input_yaml=$SIM_GROUP"/"$RIC_SIM_COMPOSE_DIR"/"app.yaml
+                       output_yaml=$PWD/tmp/pa_${1}_app.yaml
+                       __kube_create_instance app $RIC_SIM_SET_NAME $input_yaml $output_yaml
+
+                       #Using only instance from index 1 to keep compatability with docker
+                       for (( count=1; count<${RIC_SIM_COUNT}; count++ )); do
+                               host=$(__find_sim_host $RIC_SIM_SET_NAME"-"$count)
+                               __check_service_start $RIC_SIM_SET_NAME"-"$count $host"/"
+                       done
+               fi
+       else
+
+               __check_included_image 'RICSIM'
+               if [ $? -eq 1 ]; then
+                       echo -e $RED"The Near-RT RIC Simulator app is not included as managed in this test script"$ERED
+                       echo -e $RED"Near-RT RIC Simulator will not be started"$ERED
+                       exit 1
+               fi
+
+               # Create .env file to compose project, all ric container will get this prefix
+               echo "COMPOSE_PROJECT_NAME="$RIC_SIM_PREFIX > $SIM_GROUP/$RIC_SIM_COMPOSE_DIR/.env
+
+               export G1_A1_VERSION
+               export G2_A1_VERSION
+               export G3_A1_VERSION
+               export G4_A1_VERSION
+               export G5_A1_VERSION
+               export RIC_SIM_INTERNAL_PORT
+               export RIC_SIM_INTERNAL_SECURE_PORT
+               export RIC_SIM_CERT_MOUNT_DIR
+               export DOCKER_SIM_NWNAME
+
+               docker_args="--scale g1=$G1_COUNT --scale g2=$G2_COUNT --scale g3=$G3_COUNT --scale g4=$G4_COUNT --scale g5=$G5_COUNT"
+               app_data=""
+               cntr=1
+               while [ $cntr -le $2 ]; do
+                       app=$1"_"$cntr
+                       app_data="$app_data $app"
+                       let cntr=cntr+1
+               done
+
+               __start_container $RIC_SIM_COMPOSE_DIR "$docker_args" $2 $app_data
+
+               cntr=1
+               while [ $cntr -le $2 ]; do
+                       app=$1"_"$cntr
+                       localport=0
+
+                       while [ $localport -eq 0 ]; do
+                               echo -ne " Waiting for container ${app} to publish its ports...${SAMELINE}"
+                               localport=$(__find_sim_port $app)
+                               sleep 0.5
+                               echo -ne " Waiting for container ${app} to publish its ports...retrying....${SAMELINE}"
+                       done
+                       echo -e " Waiting for container ${app} to publish its ports...retrying....$GREEN OK $EGREEN"
+                       __check_service_start $app $RIC_SIM_HOST":"$localport$RIC_SIM_ALIVE_URL
+                       let cntr=cntr+1
+               done
+       fi
+       echo ""
+       return 0
+}
 
-### Admin API functions for the RIC simulator
 
 
 # Excute a curl cmd towards a ricsimulator and check the response code.
@@ -55,8 +258,8 @@ __execute_curl_to_sim() {
 sim_equal() {
 
        if [ $# -eq 3 ] || [ $# -eq 4 ]; then
-               port=$(__find_sim_port $1)
-               __var_test $1 "$RIC_SIM_LOCALHOST$port/counter/" $2 "=" $3 $4
+               host=$(__find_sim_host $1)
+               __var_test $1 "$host/counter/" $2 "=" $3 $4
                return 0
        else
                __print_err "needs three or four args: <ric-id> <sim-param> <target-value> [ timeout ]"
@@ -73,8 +276,8 @@ sim_print() {
        __print_err "need two args, <ric-id> <sim-param>" $@
                exit 1
        fi
-       port=$(__find_sim_port $1)
-       echo -e $BOLD"INFO(${BASH_LINENO[0]}): $1, $2 = $(__do_curl $RIC_SIM_LOCALHOST$port/counter/$2)"$EBOLD
+       host=$(__find_sim_host $1)
+       echo -e $BOLD"INFO(${BASH_LINENO[0]}): $1, $2 = $(__do_curl $host/counter/$2)"$EBOLD
 }
 
 # Tests if a variable value in the RIC simulator contains the target string and and optional timeout
@@ -87,8 +290,8 @@ sim_print() {
 sim_contains_str() {
 
        if [ $# -eq 3 ] || [ $# -eq 4 ]; then
-               port=$(__find_sim_port $1)
-               __var_test $1 "$RIC_SIM_LOCALHOST$port/counter/" $2 "contain_str" $3 $4
+               host=$(__find_sim_host $1)
+               __var_test $1 "$host/counter/" $2 "contain_str" $3 $4
                return 0
        else
                __print_err "needs three or four args: <ric-id> <sim-param> <target-value> [ timeout ]"
@@ -105,8 +308,8 @@ sim_put_policy_type() {
                __print_err "<response-code> <ric-id> <policy-type-id> <policy-type-file>" $@
                return 1
        fi
-       res=$(__find_sim_port $2)
-    curlString="curl -X PUT -skw %{http_code} $RIC_SIM_LOCALHOST"$res"/policytype?id="$3" -H Content-Type:application/json --data-binary @"$4
+       host=$(__find_sim_host $2)
+    curlString="curl -X PUT -skw %{http_code} "$host"/policytype?id="$3" -H Content-Type:application/json --data-binary @"$4
        __execute_curl_to_sim $1 "$curlString"
        return $?
 }
@@ -120,8 +323,8 @@ sim_delete_policy_type() {
                __print_err "<response-code> <ric-id> <policy_type_id>" $@
                return 1
        fi
-       res=$(__find_sim_port $2)
-    curlString="curl -X DELETE -skw %{http_code} $RIC_SIM_LOCALHOST"$res"/policytype?id="$3
+       host=$(__find_sim_host $2)
+    curlString="curl -X DELETE -skw %{http_code} "$host"/policytype?id="$3
     __execute_curl_to_sim $1 "$curlString"
        return $?
 }
@@ -135,8 +338,8 @@ sim_post_delete_instances() {
                __print_err "<response-code> <ric-id>" $@
                return 1
        fi
-       res=$(__find_sim_port $2)
-    curlString="curl -X POST -skw %{http_code} $RIC_SIM_LOCALHOST"$res"/deleteinstances"
+       host=$(__find_sim_host $2)
+    curlString="curl -X POST -skw %{http_code} "$host"/deleteinstances"
     __execute_curl_to_sim $1 "$curlString"
        return $?
 }
@@ -150,8 +353,8 @@ sim_post_delete_all() {
                __print_err "<response-code> <numericic-id>" $@
                return 1
        fi
-       res=$(__find_sim_port $2)
-    curlString="curl -X POST -skw %{http_code} $RIC_SIM_LOCALHOST"$res"/deleteall"
+       host=$(__find_sim_host $2)
+    curlString="curl -X POST -skw %{http_code} "$host"/deleteall"
     __execute_curl_to_sim $1 "$curlString"
        return $?
 }
@@ -165,8 +368,8 @@ sim_post_forcedresponse() {
                __print_err "<response-code> <ric-id> <forced_response_code>" $@
                return 1
        fi
-       res=$(__find_sim_port $2)
-    curlString="curl -X POST -skw %{http_code} $RIC_SIM_LOCALHOST"$res"/forceresponse"
+       host=$(__find_sim_host $2)
+    curlString="curl -X POST -skw %{http_code} "$host"/forceresponse"
        if [ $# -eq 3 ]; then
                curlString=$curlString"?code="$3
        fi
@@ -183,8 +386,8 @@ sim_post_forcedelay() {
                __print_err "<response-code> <ric-id> [<delay-in-seconds>]" $@
                return 1
        fi
-       res=$(__find_sim_port $2)
-    curlString="curl -X POST -skw %{http_code} $RIC_SIM_LOCALHOST$res/forcedelay"
+       host=$(__find_sim_host $2)
+    curlString="curl -X POST -skw %{http_code} $host/forcedelay"
        if [ $# -eq 3 ]; then
                curlString=$curlString"?delay="$3
        fi
index 1dc2b36..e0e732c 100644 (file)
@@ -7,7 +7,7 @@
 #  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
+#    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,
 #
 #Profile for ONAP guilin release
 TEST_ENV_PROFILE="ONAP-GUILIN"
+FLAVOUR="ONAP"
+
+########################################
+## Nexus repo settings
+########################################
+
+# Nexus repos for developed images
 NEXUS_PROXY_REPO="nexus3.onap.org:10001/"
+NEXUS_RELEASE_REPO="nexus3.onap.org:10002/"
+NEXUS_SNAPSHOT_REPO="nexus3.onap.org:10003/"
+NEXUS_STAGING_REPO=$NEXUS_SNAPSHOT_REPO  #staging repo not used in ONAP, using snapshot
 
-# Set up the image and tags for the test. Do not add the image tag to the image names.
+# Nexus repos for images used by test (not developed by the project)
+NEXUS_RELEASE_REPO_ORAN="nexus3.o-ran-sc.org:10002/" # Only for released ORAN images
+NEXUS_RELEASE_REPO_ONAP=$NEXUS_RELEASE_REPO
 
-# NOTE: A env var for each container is created by the test script.
-# This var will point to the local or remote var depending on how
-# the test script is started. The name format is <container-name>_IMAGE, ie with 'LOCAL' or 'REMOTE'.
+########################################
+# Set up of image and tags for the test.
+########################################
 
-# Tag for guilin branch
-# Remote Policy Agent image and tag
-POLICY_AGENT_REMOTE_IMAGE="nexus3.onap.org:10003/onap/ccsdk-oran-a1policymanagementservice"
-POLICY_AGENT_REMOTE_IMAGE_TAG="1.0.2-SNAPSHOT"
+# NOTE: One environment variable containing the image name and tag is create by the test script
+# for each image from the env variables below.
+# The variable is created by removing the suffix "_BASE" from the base image variable name.
+# Example: POLICY_AGENT_IMAGE_BASE -> POLICY_AGENT_IMAGE
+# This var will point to the local or remote image depending on cmd line arguments.
+# In addition, the repo and the image tag version are selected from the list of image tags based on the cmd line argurment.
+# For images built by the script, only tag #1 shall be specified
+# For project images, only tag #1, #2, #3 and #4 shall be specified
+# For ORAN images (non project), only tag #5 shall be specified
+# For ONAP images (non project), only tag #6 shall be specified
+# For all other images, only tag #7 shall be specified
+# 1 XXX_LOCAL: local images: <image-name>:<local-tag>
+# 2 XXX_REMOTE_SNAPSHOT: snapshot images: <snapshot-nexus-repo><image-name>:<snapshot-tag>
+# 3 XXX_REMOTE: staging images: <staging-nexus-repo><image-name>:<staging-tag>
+# 4 XXX_REMOTE_RELEASE: release images: <release-nexus-repo><image-name>:<release-tag>
+# 5 XXX_REMOTE_RELEASE_ORAN: ORAN release images: <oran-release-nexus-repo><image-name>:<release-tag>
+# 6 XXX_REMOTE_RELEASE_ONAP: ONAP release images: <onap-release-nexus-repo><image-name>:<release-tag>
+# 7 XXX_PROXY: other images, not produced by the project: <proxy-nexus-repo><mage-name>:<proxy-tag>
 
 
-# Control Panel remote image and tag
-CONTROL_PANEL_REMOTE_IMAGE="nexus3.o-ran-sc.org:10004/o-ran-sc/nonrtric-controlpanel"
-CONTROL_PANEL_REMOTE_IMAGE_TAG="2.0.0"
+# Policy Agent image and tags
+POLICY_AGENT_IMAGE_BASE="onap/ccsdk-oran-a1policymanagementservice"
+POLICY_AGENT_IMAGE_TAG_LOCAL="1.0.2-SNAPSHOT"
+POLICY_AGENT_IMAGE_TAG_REMOTE_SNAPSHOT="1.0.2-SNAPSHOT"
+POLICY_AGENT_IMAGE_TAG_REMOTE="1.0.2-SNAPSHOT" #Will use snapshot repo
+POLICY_AGENT_IMAGE_TAG_REMOTE_RELEASE="1.0.1"
+
 
 # Tag for guilin branch
 # SDNC A1 Controller remote image and tag
-SDNC_A1_CONTROLLER_REMOTE_IMAGE="nexus3.onap.org:10003/onap/sdnc-image"
-SDNC_A1_CONTROLLER_REMOTE_IMAGE_TAG="2.0.2-STAGING-latest"
+SDNC_A1_CONTROLLER_IMAGE_BASE="onap/sdnc-image"
+SDNC_A1_CONTROLLER_IMAGE_TAG_REMOTE_SNAPSHOT="2.0.5-STAGING-latest"
+SDNC_A1_CONTROLLER_IMAGE_TAG_REMOTE="2.0.5-STAGING-latest"
+SDNC_A1_CONTROLLER_IMAGE_TAG_REMOTE_RELEASE="2.0.4"   #Will use snapshot repo
 
 
 #SDNC DB remote image and tag
-SDNC_DB_REMOTE_IMAGE=$NEXUS_PROXY_REPO"mysql/mysql-server"
-SDNC_DB_REMOTE_IMAGE_TAG="5.6"
-#No local image for DB, remote image always used
+#The DB is part of SDNC so handled in the same way as SDNC
+SDNC_DB_IMAGE_BASE="mysql/mysql-server"
+SDNC_DB_IMAGE_TAG_REMOTE_PROXY="5.6"
+
 
+# Control Panel image and tag - uses bronze release
+CONTROL_PANEL_IMAGE_BASE="o-ran-sc/nonrtric-controlpanel"
+CONTROL_PANEL_IMAGE_TAG_REMOTE_RELEASE_ORAN="2.0.0"
 
-# Near RT RIC Simulator remote image and tag
-RIC_SIM_REMOTE_IMAGE="nexus3.o-ran-sc.org:10004/o-ran-sc/a1-simulator"
-RIC_SIM_REMOTE_IMAGE_TAG="2.0.0"
+
+# Near RT RIC Simulator image and tags - uses bronze release
+RIC_SIM_IMAGE_BASE="o-ran-sc/a1-simulator"
+RIC_SIM_IMAGE_TAG_REMOTE_RELEASE_ORAN="2.0.0"
 
 
 #Consul remote image and tag
-CONSUL_REMOTE_IMAGE=$NEXUS_PROXY_REPO"consul"
-CONSUL_REMOTE_IMAGE_TAG="1.7.2"
+CONSUL_IMAGE_BASE="consul"
+CONSUL_IMAGE_TAG_REMOTE_PROXY="1.7.2"
 #No local image for Consul, remote image always used
 
 
 #CBS remote image and tag
-CBS_REMOTE_IMAGE="nexus3.onap.org:10001/onap/org.onap.dcaegen2.platform.configbinding.app-app"
-CBS_REMOTE_IMAGE_TAG="2.3.0"
+CBS_IMAGE_BASE="onap/org.onap.dcaegen2.platform.configbinding.app-app"
+CBS_IMAGE_TAG_REMOTE_RELEASE_ONAP="2.3.0"
 #No local image for CBS, remote image always used
 
 
 #MR stub image and tag
-MRSTUB_LOCAL_IMAGE="mrstub"
-MRSTUB_LOCAL_IMAGE_TAG="latest"
+MRSTUB_IMAGE_BASE="mrstub"
+MRSTUB_IMAGE_TAG_LOCAL="latest"
 #No remote image for MR stub, local image always used
 
+
 #Callback receiver image and tag
-CR_LOCAL_IMAGE="callback-receiver"
-CR_LOCAL_IMAGE_TAG="latest"
+CR_IMAGE_BASE="callback-receiver"
+CR_IMAGE_TAG_LOCAL="latest"
 #No remote image for CR, local image always used
 
-# Common env var for auto-test. Vars used by docker-compose need to be exported
-export DOCKER_SIM_NWNAME="nonrtric-docker-net"                  # Name of docker private network
-
-export POLICY_AGENT_EXTERNAL_PORT=8081                          # Policy Agent container external port (host -> container)
-export POLICY_AGENT_INTERNAL_PORT=8081                          # Policy Agent container internal port (container -> container)
-export POLICY_AGENT_EXTERNAL_SECURE_PORT=8433                   # Policy Agent container external secure port (host -> container)
-export POLICY_AGENT_INTERNAL_SECURE_PORT=8433                   # Policy Agent container internal secure port (container -> container)
-export POLICY_AGENT_APIS="V1"                                   # Supported northbound api versions
-
-export POLICY_AGENT_APP_NAME="policy-agent"                     # Name for Policy Agent container
-POLICY_AGENT_LOGPATH="/var/log/policy-agent/application.log"    # Path the application log in the Policy Agent container
-export POLICY_AGENT_APP_NAME_ALIAS="policy-agent-container"     # Alias name, name used by the control panel
-
-export MR_EXTERNAL_PORT=3905                                    # MR stub container external port (host -> container)
-export MR_INTERNAL_PORT=3905                                    # MR stub container internal port (container -> container)
-export MR_EXTERNAL_SECURE_PORT=3906                             # MR stub container external secure port (host -> container)
-export MR_INTERNAL_SECURE_PORT=3906                             # MR stub container internal secure port (container -> container)
-export MR_APP_NAME="message-router"                             # Name for the MR
-export MR_READ_URL="/events/A1-POLICY-AGENT-READ/users/policy-agent?timeout=15000&limit=100" # Path to read messages from MR
-export MR_WRITE_URL="/events/A1-POLICY-AGENT-WRITE"             # Path write messages to MR
-
-export CR_EXTERNAL_PORT=8090                                    # Callback receiver container external port (host -> container)
-export CR_INTERNAL_PORT=8090                                    # Callback receiver container internal port (container -> container)
-export CR_EXTERNAL_SECURE_PORT=8091                             # Callback receiver container external secure port (host -> container)
-export CR_INTERNAL_SECURE_PORT=8091                             # Callback receiver container internal secure port (container -> container)
-export CR_APP_NAME="callback-receiver"                          # Name for the Callback receiver
-
-export CONSUL_HOST="consul-server"                              # Host name of consul
-export CONSUL_EXTERNAL_PORT=8500                                # Consul container external port (host -> container)
-export CONSUL_INTERNAL_PORT=8500                                # Consul container internal port (container -> container)
-export CONSUL_APP_NAME="polman-consul"                          # Name for consul container
-
-export CBS_APP_NAME="polman-cbs"                                # Name for CBS container
-export CBS_EXTERNAL_PORT=10000                                  # CBS container external port (host -> container)
-export CBS_INTERNAL_PORT=10000                                  # CBS container internal port (container -> container)
-export CONFIG_BINDING_SERVICE="config-binding-service"          # Host name of CBS
-
-export RIC_SIM_BASE="g"                                         # Base name of the RIC Simulator container, shall be the group code
-                                                                # Note, a prefix is added to each container name by the .env file in the 'ric' dir
-RIC_SIM_PREFIX="ricsim"                                         # Prefix added to ric container name, added in the .env file in the 'ric' dir
-                                                                # This prefix can be changed from the command line
-export RIC_SIM_INTERNAL_PORT=8085                               # RIC Simulator container internal port (container -> container).
-                                                                # (external ports allocated by docker)
-export RIC_SIM_INTERNAL_SECURE_PORT=8185                        # RIC Simulator container internal secure port (container -> container).
-                                                                # (external ports allocated by docker)
-
-export SDNC_APP_NAME="a1-controller"                            # Name of the SNDC A1 Controller container
-export SDNC_EXTERNAL_PORT=8282                                  # SNDC A1 Controller container external port (host -> container)
-export SDNC_INTERNAL_PORT=8181                                  # SNDC A1 Controller container internal port (container -> container)
-export SDNC_EXTERNAL_SECURE_PORT=8443                           # SNDC A1 Controller container external securee port (host -> container)
-export SDNC_INTERNAL_SECURE_PORT=8443                           # SNDC A1 Controller container internal secure port (container -> container)
-export SDNC_DB_APP_NAME="sdnc-db"                               # Name of the SDNC DB container
-export SDNC_A1_TRUSTSTORE_PASSWORD="a1adapter"                  # SDNC truststore password
-SDNC_USER="admin"                                               # SDNC username
-SDNC_PWD="Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U"          # SNDC PWD
-SDNC_API_URL="/restconf/operations/A1-ADAPTER-API:"             # Base url path for SNDC API
-SDNC_ALIVE_URL="/apidoc/explorer/"                              # Base url path for SNDC API docs (for alive check)
-SDNC_KARAF_LOG="/opt/opendaylight/data/log/karaf.log"           # Path to karaf log
-
-
-export CONTROL_PANEL_APP_NAME="control-panel"                   # Name of the Control Panel container
-export CONTROL_PANEL_EXTERNAL_PORT=8080                         # Control Panel container external port (host -> container)
-export CONTROL_PANEL_INTERNAL_PORT=8080                         # Control Panel container external port (host -> container)
-CONTROL_PANEL_LOGPATH="/logs/nonrtric-controlpanel.log"         # Path the application log in the Control Panel container
-
-UUID=""                                                         # UUID used as prefix to the policy id to simulate a real UUID
-                                                                # Testscript need to set the UUID to use other this empty prefix is used
-
-RESTBASE="http://localhost:"$POLICY_AGENT_EXTERNAL_PORT         # Base url to the Agent NB REST interface
-RESTBASE_SECURE="https://localhost:"$POLICY_AGENT_EXTERNAL_SECURE_PORT # Base url to the secure Agent NB REST interface
-DMAAPBASE="http://localhost:"$MR_EXTERNAL_PORT                  # Base url to the Dmaap adapter, http
-DMAAPBASE_SECURE="https://localhost:"$MR_EXTERNAL_SECURE_PORT   # Base url to the Dmaap adapter, https
-ADAPTER=$RESTBASE                                               # Adapter holds the address the agent R-APP interface (REST OR DMAAP)
-                                                                # The values of this var is swiched between the two base url when needed
+#Http proxy remote image and tag
+HTTP_PROXY_IMAGE_BASE="mitmproxy/mitmproxy"
+HTTP_PROXY_IMAGE_TAG_REMOTE_PROXY="6.0.2"
+#No local image for SSDNC DB, remote image always used
+
+
+#ONAP Zookeeper remote image and tag
+ONAP_ZOOKEEPER_IMAGE_BASE="onap/dmaap/zookeeper"
+ONAP_ZOOKEEPER_IMAGE_TAG_REMOTE_RELEASE_ONAP="6.0.3"
+#No local image for ONAP Zookeeper, remote image always used
+
+#ONAP Kafka remote image and tag
+ONAP_KAFKA_IMAGE_BASE="onap/dmaap/kafka111"
+ONAP_KAFKA_IMAGE_TAG_REMOTE_RELEASE_ONAP="1.0.4"
+#No local image for ONAP Kafka, remote image always used
+
+#ONAP DMAAP-MR remote image and tag
+ONAP_DMAAPMR_IMAGE_BASE="onap/dmaap/dmaap-mr"
+ONAP_DMAAPMR_IMAGE_TAG_REMOTE_RELEASE_ONAP="1.1.18"
+#No local image for ONAP DMAAP-MR, remote image always used
+
+# List of app short names produced by the project
+PROJECT_IMAGES_APP_NAMES="PA SDNC"
+
+# List of app short names which images pulled from ORAN
+ORAN_IMAGES_APP_NAMES="CP RICSIM"
+
+# List of app short names which images pulled from ONAP
+ONAP_IMAGES_APP_NAMES=""   # Not used
+
+########################################
+# Detailed settings per app
+########################################
+
+
+DOCKER_SIM_NWNAME="nonrtric-docker-net"                  # Name of docker private network
+
+KUBE_NONRTRIC_NAMESPACE="nonrtric"                       # Namespace for all nonrtric components
+KUBE_SIM_NAMESPACE="nonrtric-ft"                         # Namespace for simulators (except MR and RICSIM)
+KUBE_ONAP_NAMESPACE="onap"                               # Namespace for onap (only message router)
+
+POLICY_AGENT_EXTERNAL_PORT=8081                          # Policy Agent container external port (host -> container)
+POLICY_AGENT_INTERNAL_PORT=8081                          # Policy Agent container internal port (container -> container)
+POLICY_AGENT_EXTERNAL_SECURE_PORT=8433                   # Policy Agent container external secure port (host -> container)
+POLICY_AGENT_INTERNAL_SECURE_PORT=8433                   # Policy Agent container internal secure port (container -> container)
+POLICY_AGENT_APIS="V1"                                   # Supported northbound api versions
+PMS_VERSION="V1"                                         # Tested version of northbound API
+PMS_API_PREFIX=""                                        # api url prefix, only for V2
+
+POLICY_AGENT_APP_NAME="policymanagementservice"          # Name for Policy Agent container
+POLICY_AGENT_DISPLAY_NAME="Policy Management Service"
+POLICY_AGENT_HOST_MNT_DIR="./mnt"                        # Mounted dir, relative to compose file, on the host
+POLICY_AGENT_LOGPATH="/var/log/policy-agent/application.log" # Path the application log in the Policy Agent container
+POLICY_AGENT_APP_NAME_ALIAS="policy-agent-container"     # Alias name, name used by the control panel
+POLICY_AGENT_CONFIG_KEY="policy-agent"                   # Key for consul config
+POLICY_AGENT_PKG_NAME="org.onap.ccsdk.oran.a1policymanagementservice"  # Java base package name
+POLICY_AGENT_ACTUATOR="/actuator/loggers/$POLICY_AGENT_PKG_NAME" # Url for trace/debug
+POLICY_AGENT_ALIVE_URL="/status"                         # Base path for alive check
+POLICY_AGENT_COMPOSE_DIR="policy_agent"                  # Dir in simulator_group for docker-compose
+POLICY_AGENT_CONFIG_MOUNT_PATH="/opt/app/policy-agent/config" # Path in container for config file
+POLICY_AGENT_DATA_MOUNT_PATH="/opt/app/policy-agent/data" # Path in container for data file
+POLICY_AGENT_CONFIG_FILE="application.yaml"              # Container config file name
+POLICY_AGENT_DATA_FILE="application_configuration.json"  # Container data file name
+
+MR_DMAAP_APP_NAME="dmaap-mr"                             # Name for the Dmaap MR
+MR_STUB_APP_NAME="mr-stub"                               # Name of the MR stub
+MR_DMAAP_DISPLAY_NAME="DMAAP Message Router"
+MR_STUB_DISPLAY_NAME="Message Router stub"
+MR_STUB_CERT_MOUNT_DIR="./cert"
+MR_EXTERNAL_PORT=3904                                    # MR dmaap/stub container external port
+MR_INTERNAL_PORT=3904                                    # MR dmaap/stub container internal port
+MR_EXTERNAL_SECURE_PORT=3905                             # MR dmaap/stub container external secure port
+MR_INTERNAL_SECURE_PORT=3905                             # MR dmaap/stub container internal secure port
+MR_DMAAP_LOCALHOST_PORT=3904                             # MR stub container external port (host -> container)
+MR_STUB_LOCALHOST_PORT=3908                              # MR stub container external port (host -> container)
+MR_DMAAP_LOCALHOST_SECURE_PORT=3905                      # MR stub container internal port (container -> container)
+MR_STUB_LOCALHOST_SECURE_PORT=3909                       # MR stub container external secure port (host -> container)
+MR_READ_URL="/events/A1-POLICY-AGENT-READ/users/policy-agent?timeout=15000&limit=100" # Path to read messages from MR
+MR_WRITE_URL="/events/A1-POLICY-AGENT-WRITE"             # Path write messages to MR
+MR_READ_TOPIC="A1-POLICY-AGENT-READ"                     # Read topic
+MR_WRITE_TOPIC="A1-POLICY-AGENT-WRITE"                   # Write topic
+MR_STUB_ALIVE_URL="/"                                    # Base path for mr stub alive check
+MR_DMAAP_ALIVE_URL="/topics"                             # Base path for dmaap-mr alive check
+MR_DMAAP_COMPOSE_DIR="dmaapmr"                           # Dir in simulator_group for dmaap mr for - docker-compose
+MR_STUB_COMPOSE_DIR="mrstub"                             # Dir in simulator_group for mr stub for - docker-compose
+MR_KAFKA_APP_NAME="kafka"                                # Kafka app name
+MR_ZOOKEEPER_APP_NAME="zookeeper"                        # Zookeeper app name
+
+
+CR_APP_NAME="callback-receiver"                          # Name for the Callback receiver
+CR_DISPLAY_NAME="Callback Reciever"
+CR_EXTERNAL_PORT=8090                                    # Callback receiver container external port (host -> container)
+CR_INTERNAL_PORT=8090                                    # Callback receiver container internal port (container -> container)
+CR_EXTERNAL_SECURE_PORT=8091                             # Callback receiver container external secure port (host -> container)
+CR_INTERNAL_SECURE_PORT=8091                             # Callback receiver container internal secure port (container -> container)
+CR_APP_CALLBACK="/callbacks"                             # Url for callbacks
+CR_ALIVE_URL="/"                                         # Base path for alive check
+CR_COMPOSE_DIR="cr"                                      # Dir in simulator_group for docker-compose
+
+CONSUL_HOST="consul-server"                              # Host name of consul
+CONSUL_DISPLAY_NAME="Consul"
+CONSUL_EXTERNAL_PORT=8500                                # Consul container external port (host -> container)
+CONSUL_INTERNAL_PORT=8500                                # Consul container internal port (container -> container)
+CONSUL_APP_NAME="polman-consul"                          # Name for consul container
+CONSUL_ALIVE_URL="/ui/dc1/kv"                            # Base path for alive check
+CONSUL_CBS_COMPOSE_DIR="consul_cbs"                      # Dir in simulator group for docker compose
+
+CBS_APP_NAME="polman-cbs"                                # Name for CBS container
+CBS_DISPLAY_NAME="Config Binding Service"
+CBS_EXTERNAL_PORT=10000                                  # CBS container external port (host -> container)
+CBS_INTERNAL_PORT=10000                                  # CBS container internal port (container -> container)
+CONFIG_BINDING_SERVICE="config-binding-service"          # Host name of CBS
+CBS_ALIVE_URL="/healthcheck"                             # Base path for alive check
+
+RIC_SIM_DISPLAY_NAME="Near-RT RIC A1 Simulator"
+RIC_SIM_BASE="g"                                         # Base name of the RIC Simulator container, shall be the group code
+                                                         # Note, a prefix is added to each container name by the .env file in the 'ric' dir
+RIC_SIM_PREFIX="ricsim"                                  # Prefix added to ric container name, added in the .env file in the 'ric' dir
+                                                         # This prefix can be changed from the command line
+RIC_SIM_INTERNAL_PORT=8085                               # RIC Simulator container internal port (container -> container).
+                                                         # (external ports allocated by docker)
+RIC_SIM_INTERNAL_SECURE_PORT=8185                        # RIC Simulator container internal secure port (container -> container).
+                                                         # (external ports allocated by docker)
+RIC_SIM_CERT_MOUNT_DIR="./cert"
+RIC_SIM_COMPOSE_DIR="ric"                                # Dir in simulator group for docker compose
+RIC_SIM_ALIVE_URL="/"
+
+SDNC_APP_NAME="a1controller"                             # Name of the SNDC A1 Controller container
+SDNC_DISPLAY_NAME="SDNC A1 Controller"
+SDNC_EXTERNAL_PORT=8282                                  # SNDC A1 Controller container external port (host -> container)
+SDNC_INTERNAL_PORT=8181                                  # SNDC A1 Controller container internal port (container -> container)
+SDNC_EXTERNAL_SECURE_PORT=8443                           # SNDC A1 Controller container external securee port (host -> container)
+SDNC_INTERNAL_SECURE_PORT=8443                           # SNDC A1 Controller container internal secure port (container -> container)
+SDNC_DB_APP_NAME="sdncdb"                                # Name of the SDNC DB container
+SDNC_A1_TRUSTSTORE_PASSWORD="a1adapter"                  # SDNC truststore password
+SDNC_USER="admin"                                        # SDNC username
+SDNC_PWD="Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U"   # SNDC PWD
+SDNC_API_URL="/restconf/operations/A1-ADAPTER-API:"      # Base url path for SNDC API
+SDNC_ALIVE_URL="/apidoc/explorer/"                       # Base url path for SNDC API docs (for alive check)
+SDNC_COMPOSE_DIR="sdnc"                                  # Dir in simulator_group for docker-compose
+SDNC_KARAF_LOG="/opt/opendaylight/data/log/karaf.log"    # Path to karaf log
+
+
+CONTROL_PANEL_APP_NAME="controlpanel"                    # Name of the Control Panel container
+CONTROL_PANEL_DISPLAY_NAME="Non-RT RIC Control Panel"
+CONTROL_PANEL_EXTERNAL_PORT=8080                         # Control Panel container external port (host -> container)
+CONTROL_PANEL_INTERNAL_PORT=8080                         # Control Panel container internal port (container -> container)
+CONTROL_PANEL_EXTERNAL_SECURE_PORT=8880                  # Control Panel container external port (host -> container)
+CONTROL_PANEL_INTERNAL_SECURE_PORT=8082                  # Control Panel container internal port (container -> container)
+CONTROL_PANEL_LOGPATH="/logs/nonrtric-controlpanel.log"  # Path the application log in the Control Panel container
+CONTROL_PANEL_ALIVE_URL="/"                              # Base path for alive check
+CONTROL_PANEL_COMPOSE_DIR="control_panel"                # Dir in simulator_group for docker-compose
+CONTROL_PANEL_CONFIG_MOUNT_PATH=/maven                   # Container internal path for config
+CONTROL_PANEL_CONFIG_FILE=application.properties         # Config file name
+
+HTTP_PROXY_APP_NAME="httpproxy"                          # Name of the Http Proxy container
+HTTP_PROXY_DISPLAY_NAME="Http Proxy"
+HTTP_PROXY_EXTERNAL_PORT=8780                            # Http Proxy container external port (host -> container)
+HTTP_PROXY_INTERNAL_PORT=8080                            # Http Proxy container internal port (container -> container)
+HTTP_PROXY_WEB_EXTERNAL_PORT=8781                        # Http Proxy container external port (host -> container)
+HTTP_PROXY_WEB_INTERNAL_PORT=8081                        # Http Proxy container internal port (container -> container)
+HTTP_PROXY_CONFIG_PORT=0                                 # Port number for proxy config, will be set if proxy is started
+HTTP_PROXY_CONFIG_HOST_NAME=""                           # Proxy host, will be set if proxy is started
+HTTP_PROXY_ALIVE_URL="/"                                 # Base path for alive check
+HTTP_PROXY_COMPOSE_DIR="httpproxy"                       # Dir in simulator_group for docker-compose
+
+########################################
+# Setting for common curl-base function
+########################################
+
+
+UUID=""                                                  # UUID used as prefix to the policy id to simulate a real UUID
+                                                         # Testscript need to set the UUID to use other this empty prefix is used
+
diff --git a/test/common/test_env-onap-honolulu.sh b/test/common/test_env-onap-honolulu.sh
new file mode 100644 (file)
index 0000000..f3c5b51
--- /dev/null
@@ -0,0 +1,341 @@
+#!/bin/bash
+
+#  ============LICENSE_START===============================================
+#  Copyright (C) 2020 Nordix Foundation. 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=================================================
+#
+#Profile for ONAP honolulu release
+TEST_ENV_PROFILE="ONAP-HONOLULU"
+FLAVOUR="ONAP"
+
+########################################
+## Nexus repo settings
+########################################
+
+# Nexus repos for developed images
+NEXUS_PROXY_REPO="nexus3.onap.org:10001/"
+NEXUS_RELEASE_REPO="nexus3.onap.org:10002/"
+NEXUS_SNAPSHOT_REPO="nexus3.onap.org:10003/"
+NEXUS_STAGING_REPO=$NEXUS_SNAPSHOT_REPO  #staging repo not used in ONAP, using snapshot
+
+# Nexus repos for images used by test (not developed by the project)
+NEXUS_RELEASE_REPO_ORAN="nexus3.o-ran-sc.org:10002/" # Only for released ORAN images
+NEXUS_RELEASE_REPO_ONAP=$NEXUS_RELEASE_REPO
+
+########################################
+# Set up of image and tags for the test.
+########################################
+
+# NOTE: One environment variable containing the image name and tag is create by the test script
+# for each image from the env variables below.
+# The variable is created by removing the suffix "_BASE" from the base image variable name.
+# Example: POLICY_AGENT_IMAGE_BASE -> POLICY_AGENT_IMAGE
+# This var will point to the local or remote image depending on cmd line arguments.
+# In addition, the repo and the image tag version are selected from the list of image tags based on the cmd line argurment.
+# For images built by the script, only tag #1 shall be specified
+# For project images, only tag #1, #2, #3 and #4 shall be specified
+# For ORAN images (non project), only tag #5 shall be specified
+# For ONAP images (non project), only tag #6 shall be specified
+# For all other images, only tag #7 shall be specified
+# 1 XXX_LOCAL: local images: <image-name>:<local-tag>
+# 2 XXX_REMOTE_SNAPSHOT: snapshot images: <snapshot-nexus-repo><image-name>:<snapshot-tag>
+# 3 XXX_REMOTE: staging images: <staging-nexus-repo><image-name>:<staging-tag>
+# 4 XXX_REMOTE_RELEASE: release images: <release-nexus-repo><image-name>:<release-tag>
+# 5 XXX_REMOTE_RELEASE_ORAN: ORAN release images: <oran-release-nexus-repo><image-name>:<release-tag>
+# 6 XXX_REMOTE_RELEASE_ONAP: ONAP release images: <onap-release-nexus-repo><image-name>:<release-tag>
+# 7 XXX_PROXY: other images, not produced by the project: <proxy-nexus-repo><mage-name>:<proxy-tag>
+
+# Policy Agent image and tags
+POLICY_AGENT_IMAGE_BASE="onap/ccsdk-oran-a1policymanagementservice"
+POLICY_AGENT_IMAGE_TAG_LOCAL="1.1.1-SNAPSHOT"
+POLICY_AGENT_IMAGE_TAG_REMOTE_SNAPSHOT="1.1.1-SNAPSHOT"
+POLICY_AGENT_IMAGE_TAG_REMOTE="1.1.1-STAGING-latest" #Will use snapshot repo
+POLICY_AGENT_IMAGE_TAG_REMOTE_RELEASE="1.1.1"
+
+
+# SDNC A1 Controller remote image and tag
+SDNC_A1_CONTROLLER_IMAGE_BASE="onap/sdnc-image"
+SDNC_A1_CONTROLLER_IMAGE_TAG_LOCAL="2.1.1-SNAPSHOT" ###CHECK THIS
+SDNC_A1_CONTROLLER_IMAGE_TAG_REMOTE_SNAPSHOT="2.1.1-STAGING-latest"
+SDNC_A1_CONTROLLER_IMAGE_TAG_REMOTE="2.1.1-STAGING-latest"  #Will use snapshot repo
+SDNC_A1_CONTROLLER_IMAGE_TAG_REMOTE_RELEASE="2.1.1"
+
+#SDNC DB remote image and tag
+#The DB is part of SDNC so handled in the same way as SDNC
+SDNC_DB_IMAGE_BASE="mysql/mysql-server"
+SDNC_DB_IMAGE_TAG_REMOTE_PROXY="5.6"
+
+
+# ECS image and tag - uses cherry release
+ECS_IMAGE_BASE="o-ran-sc/nonrtric-enrichment-coordinator-service"
+ECS_IMAGE_TAG_REMOTE_RELEASE_ORAN="1.0.0"
+
+
+# Control Panel image and tag - uses cherry release
+CONTROL_PANEL_IMAGE_BASE="o-ran-sc/nonrtric-controlpanel"
+CONTROL_PANEL_IMAGE_TAG_REMOTE_RELEASE_ORAN="2.1.0"
+
+
+# RAPP Catalogue image and tags - uses cherry release
+RAPP_CAT_IMAGE_BASE="o-ran-sc/nonrtric-r-app-catalogue"
+RAPP_CAT_IMAGE_TAG_REMOTE_RELEASE_ORAN="1.0.0"
+
+
+# Near RT RIC Simulator image and tags - uses cherry release
+RIC_SIM_IMAGE_BASE="o-ran-sc/a1-simulator"
+RIC_SIM_IMAGE_TAG_REMOTE_RELEASE_ORAN="2.1.0"
+
+
+#Consul remote image and tag
+CONSUL_IMAGE_BASE="consul"
+CONSUL_IMAGE_TAG_REMOTE_PROXY="1.7.2"
+#No local image for Consul, remote image always used
+
+
+#CBS remote image and tag
+CBS_IMAGE_BASE="onap/org.onap.dcaegen2.platform.configbinding.app-app"
+CBS_IMAGE_TAG_REMOTE_RELEASE_ONAP="2.3.0"
+#No local image for CBS, remote image always used
+
+
+#MR stub image and tag
+MRSTUB_IMAGE_BASE="mrstub"
+MRSTUB_IMAGE_TAG_LOCAL="latest"
+#No remote image for MR stub, local image always used
+
+
+#Callback receiver image and tag
+CR_IMAGE_BASE="callback-receiver"
+CR_IMAGE_TAG_LOCAL="latest"
+#No remote image for CR, local image always used
+
+
+#Producer stub image and tag
+PROD_STUB_IMAGE_BASE="producer-stub"
+PROD_STUB_IMAGE_TAG_LOCAL="latest"
+#No remote image for producer stub, local image always used
+
+
+#Http proxy remote image and tag
+HTTP_PROXY_IMAGE_BASE="mitmproxy/mitmproxy"
+HTTP_PROXY_IMAGE_TAG_REMOTE_PROXY="6.0.2"
+#No local image for SSDNC DB, remote image always used
+
+#ONAP Zookeeper remote image and tag
+ONAP_ZOOKEEPER_IMAGE_BASE="onap/dmaap/zookeeper"
+ONAP_ZOOKEEPER_IMAGE_TAG_REMOTE_RELEASE_ONAP="6.0.3"
+#No local image for ONAP Zookeeper, remote image always used
+
+#ONAP Kafka remote image and tag
+ONAP_KAFKA_IMAGE_BASE="onap/dmaap/kafka111"
+ONAP_KAFKA_IMAGE_TAG_REMOTE_RELEASE_ONAP="1.0.4"
+#No local image for ONAP Kafka, remote image always used
+
+#ONAP DMAAP-MR remote image and tag
+ONAP_DMAAPMR_IMAGE_BASE="onap/dmaap/dmaap-mr"
+ONAP_DMAAPMR_IMAGE_TAG_REMOTE_RELEASE_ONAP="1.1.18"
+#No local image for ONAP DMAAP-MR, remote image always used
+
+
+# List of app short names produced by the project
+PROJECT_IMAGES_APP_NAMES="PA SDNC"
+
+# List of app short names which images pulled from ORAN
+ORAN_IMAGES_APP_NAMES="CP ECS RICSIM RC"
+
+# List of app short names which images pulled from ONAP
+ONAP_IMAGES_APP_NAMES=""   # Not used
+
+
+########################################
+# Detailed settings per app
+########################################
+
+
+DOCKER_SIM_NWNAME="nonrtric-docker-net"                  # Name of docker private network
+
+KUBE_NONRTRIC_NAMESPACE="nonrtric"                       # Namespace for all nonrtric components
+KUBE_SIM_NAMESPACE="nonrtric-ft"                         # Namespace for simulators (except MR and RICSIM)
+KUBE_ONAP_NAMESPACE="onap"                               # Namespace for onap (only message router)
+
+POLICY_AGENT_EXTERNAL_PORT=8081                          # Policy Agent container external port (host -> container)
+POLICY_AGENT_INTERNAL_PORT=8081                          # Policy Agent container internal port (container -> container)
+POLICY_AGENT_EXTERNAL_SECURE_PORT=8433                   # Policy Agent container external secure port (host -> container)
+POLICY_AGENT_INTERNAL_SECURE_PORT=8433                   # Policy Agent container internal secure port (container -> container)
+POLICY_AGENT_APIS="V1 V2"                                # Supported northbound api versions
+PMS_VERSION="V2"                                         # Tested version of northbound API
+PMS_API_PREFIX="/a1-policy"                               # api url prefix, only for V2. Shall contain leading "/"
+
+POLICY_AGENT_APP_NAME="policymanagementservice"          # Name for Policy Agent container
+POLICY_AGENT_DISPLAY_NAME="Policy Management Service"
+POLICY_AGENT_HOST_MNT_DIR="./mnt"                        # Mounted dir, relative to compose file, on the host
+POLICY_AGENT_LOGPATH="/var/log/policy-agent/application.log" # Path the application log in the Policy Agent container
+POLICY_AGENT_APP_NAME_ALIAS="policy-agent-container"     # Alias name, name used by the control panel
+POLICY_AGENT_CONFIG_KEY="policy-agent"                   # Key for consul config
+POLICY_AGENT_PKG_NAME="org.onap.ccsdk.oran.a1policymanagementservice"  # Java base package name
+POLICY_AGENT_ACTUATOR="/actuator/loggers/$POLICY_AGENT_PKG_NAME" # Url for trace/debug
+POLICY_AGENT_ALIVE_URL="$PMS_API_PREFIX/v2/status"       # Base path for alive check
+POLICY_AGENT_COMPOSE_DIR="policy_agent"                  # Dir in simulator_group for docker-compose
+POLICY_AGENT_CONFIG_MOUNT_PATH="/opt/app/policy-agent/config" # Path in container for config file
+POLICY_AGENT_DATA_MOUNT_PATH="/opt/app/policy-agent/data" # Path in container for data file
+POLICY_AGENT_CONFIG_FILE="application.yaml"              # Container config file name
+POLICY_AGENT_DATA_FILE="application_configuration.json"  # Container data file name
+
+ECS_APP_NAME="enrichmentservice"                         # Name for ECS container
+ECS_DISPLAY_NAME="Enrichment Coordinator Service"        # Display name for ECS container
+ECS_EXTERNAL_PORT=8083                                   # ECS container external port (host -> container)
+ECS_INTERNAL_PORT=8083                                   # ECS container internal port (container -> container)
+ECS_EXTERNAL_SECURE_PORT=8434                            # ECS container external secure port (host -> container)
+ECS_INTERNAL_SECURE_PORT=8434                            # ECS container internal secure port (container -> container)
+
+ECS_LOGPATH="/var/log/enrichment-coordinator-service/application.log" # Path the application log in the ECS container
+ECS_APP_NAME_ALIAS="enrichment-service-container"        # Alias name, name used by the control panel
+ECS_HOST_MNT_DIR="./mnt/db"                              # Mounted dir, relative to compose file, on the host
+ECS_CONTAINER_MNT_DIR="/var/enrichment-coordinator-service" # Mounted dir in the container
+ECS_ACTUATOR="/actuator/loggers/org.oransc.enrichment"   # Url for trace/debug
+ECS_CERT_MOUNT_DIR="./cert"
+ECS_ALIVE_URL="/status"                                  # Base path for alive check
+ECS_COMPOSE_DIR="ecs"                                    # Dir in simulator_group for docker-compose
+ECS_CONFIG_MOUNT_PATH=/opt/app/enrichment-coordinator-service/config # Internal container path for configuration
+ECS_CONFIG_FILE=application.yaml                         # Config file name
+ECS_VERSION="V1-1"                                       # Version where the types are added in the producer registration
+
+MR_DMAAP_APP_NAME="dmaap-mr"                             # Name for the Dmaap MR
+MR_STUB_APP_NAME="mr-stub"                               # Name of the MR stub
+MR_DMAAP_DISPLAY_NAME="DMAAP Message Router"
+MR_STUB_DISPLAY_NAME="Message Router stub"
+MR_STUB_CERT_MOUNT_DIR="./cert"
+MR_EXTERNAL_PORT=3904                                    # MR dmaap/stub container external port
+MR_INTERNAL_PORT=3904                                    # MR dmaap/stub container internal port
+MR_EXTERNAL_SECURE_PORT=3905                             # MR dmaap/stub container external secure port
+MR_INTERNAL_SECURE_PORT=3905                             # MR dmaap/stub container internal secure port
+MR_DMAAP_LOCALHOST_PORT=3904                             # MR stub container external port (host -> container)
+MR_STUB_LOCALHOST_PORT=3908                              # MR stub container external port (host -> container)
+MR_DMAAP_LOCALHOST_SECURE_PORT=3905                      # MR stub container internal port (container -> container)
+MR_STUB_LOCALHOST_SECURE_PORT=3909                       # MR stub container external secure port (host -> container)
+MR_READ_URL="/events/A1-POLICY-AGENT-READ/users/policy-agent?timeout=15000&limit=100" # Path to read messages from MR
+MR_WRITE_URL="/events/A1-POLICY-AGENT-WRITE"             # Path write messages to MR
+MR_READ_TOPIC="A1-POLICY-AGENT-READ"                     # Read topic
+MR_WRITE_TOPIC="A1-POLICY-AGENT-WRITE"                   # Write topic
+MR_STUB_ALIVE_URL="/"                                    # Base path for mr stub alive check
+MR_DMAAP_ALIVE_URL="/topics"                             # Base path for dmaap-mr alive check
+MR_DMAAP_COMPOSE_DIR="dmaapmr"                           # Dir in simulator_group for dmaap mr for - docker-compose
+MR_STUB_COMPOSE_DIR="mrstub"                             # Dir in simulator_group for mr stub for - docker-compose
+MR_KAFKA_APP_NAME="kafka"                                # Kafka app name
+MR_ZOOKEEPER_APP_NAME="zookeeper"                        # Zookeeper app name
+
+CR_APP_NAME="callback-receiver"                          # Name for the Callback receiver
+CR_DISPLAY_NAME="Callback Reciever"
+CR_EXTERNAL_PORT=8090                                    # Callback receiver container external port (host -> container)
+CR_INTERNAL_PORT=8090                                    # Callback receiver container internal port (container -> container)
+CR_EXTERNAL_SECURE_PORT=8091                             # Callback receiver container external secure port (host -> container)
+CR_INTERNAL_SECURE_PORT=8091                             # Callback receiver container internal secure port (container -> container)
+CR_APP_NAME="callback-receiver"                          # Name for the Callback receiver
+CR_APP_CALLBACK="/callbacks"                             # Url for callbacks
+CR_ALIVE_URL="/"                                         # Base path for alive check
+CR_COMPOSE_DIR="cr"                                      # Dir in simulator_group for docker-compose
+
+PROD_STUB_APP_NAME="producer-stub"                       # Name for the Producer stub
+PROD_STUB_DISPLAY_NAME="Producer Stub"
+PROD_STUB_EXTERNAL_PORT=8092                             # Producer stub container external port (host -> container)
+PROD_STUB_INTERNAL_PORT=8092                             # Producer stub container internal port (container -> container)
+PROD_STUB_EXTERNAL_SECURE_PORT=8093                      # Producer stub container external secure port (host -> container)
+PROD_STUB_INTERNAL_SECURE_PORT=8093                      # Producer stub container internal secure port (container -> container)
+PROD_STUB_JOB_CALLBACK="/callbacks/job"                  # Callback path for job create/update/delete
+PROD_STUB_SUPERVISION_CALLBACK="/callbacks/supervision"  # Callback path for producre supervision
+PROD_STUB_ALIVE_URL="/"                                  # Base path for alive check
+PROD_STUB_COMPOSE_DIR="prodstub"                         # Dir in simulator_group for docker-compose
+
+CONSUL_HOST="consul-server"                              # Host name of consul
+CONSUL_DISPLAY_NAME="Consul"
+CONSUL_EXTERNAL_PORT=8500                                # Consul container external port (host -> container)
+CONSUL_INTERNAL_PORT=8500                                # Consul container internal port (container -> container)
+CONSUL_APP_NAME="polman-consul"                          # Name for consul container
+CONSUL_ALIVE_URL="/ui/dc1/kv"                            # Base path for alive check
+CONSUL_CBS_COMPOSE_DIR="consul_cbs"                      # Dir in simulator group for docker compose
+
+CBS_APP_NAME="polman-cbs"                                # Name for CBS container
+CBS_DISPLAY_NAME="Config Binding Service"
+CBS_EXTERNAL_PORT=10000                                  # CBS container external port (host -> container)
+CBS_INTERNAL_PORT=10000                                  # CBS container internal port (container -> container)
+CONFIG_BINDING_SERVICE="config-binding-service"          # Host name of CBS
+CBS_ALIVE_URL="/healthcheck"                             # Base path for alive check
+
+RIC_SIM_DISPLAY_NAME="Near-RT RIC A1 Simulator"
+RIC_SIM_BASE="g"                                         # Base name of the RIC Simulator container, shall be the group code
+                                                         # Note, a prefix is added to each container name by the .env file in the 'ric' dir
+RIC_SIM_PREFIX="ricsim"                                  # Prefix added to ric container name, added in the .env file in the 'ric' dir
+                                                         # This prefix can be changed from the command line
+RIC_SIM_INTERNAL_PORT=8085                               # RIC Simulator container internal port (container -> container).
+                                                         # (external ports allocated by docker)
+RIC_SIM_INTERNAL_SECURE_PORT=8185                        # RIC Simulator container internal secure port (container -> container).
+                                                         # (external ports allocated by docker)
+RIC_SIM_CERT_MOUNT_DIR="./cert"
+RIC_SIM_COMPOSE_DIR="ric"                                # Dir in simulator group for docker compose
+RIC_SIM_ALIVE_URL="/"
+
+SDNC_APP_NAME="a1controller"                             # Name of the SNDC A1 Controller container
+SDNC_DISPLAY_NAME="SDNC A1 Controller"
+SDNC_EXTERNAL_PORT=8282                                  # SNDC A1 Controller container external port (host -> container)
+SDNC_INTERNAL_PORT=8181                                  # SNDC A1 Controller container internal port (container -> container)
+SDNC_EXTERNAL_SECURE_PORT=8443                           # SNDC A1 Controller container external securee port (host -> container)
+SDNC_INTERNAL_SECURE_PORT=8443                           # SNDC A1 Controller container internal secure port (container -> container)
+SDNC_DB_APP_NAME="sdncdb"                                # Name of the SDNC DB container
+SDNC_A1_TRUSTSTORE_PASSWORD="a1adapter"                  # SDNC truststore password
+SDNC_USER="admin"                                        # SDNC username
+SDNC_PWD="Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U"   # SNDC PWD
+SDNC_API_URL="/restconf/operations/A1-ADAPTER-API:"      # Base url path for SNDC API
+SDNC_ALIVE_URL="/apidoc/explorer/"                       # Base url path for SNDC API docs (for alive check)
+SDNC_COMPOSE_DIR="sdnc"
+SDNC_KARAF_LOG="/opt/opendaylight/data/log/karaf.log"    # Path to karaf log
+
+RAPP_CAT_APP_NAME="rappcatalogueservice"                 # Name for the RAPP Catalogue
+RAPP_CAT_DISPLAY_NAME="RAPP Catalogue Service"
+RAPP_CAT_EXTERNAL_PORT=8680                              # RAPP Catalogue container external port (host -> container)
+RAPP_CAT_INTERNAL_PORT=8080                              # RAPP Catalogue container internal port (container -> container)
+RAPP_CAT_EXTERNAL_SECURE_PORT=8633                       # RAPP Catalogue container external secure port (host -> container)
+RAPP_CAT_INTERNAL_SECURE_PORT=8433                       # RAPP Catalogue container internal secure port (container -> container)
+RAPP_CAT_ALIVE_URL="/services"                           # Base path for alive check
+RAPP_CAT_COMPOSE_DIR="rapp_catalogue"                    # Dir in simulator_group for docker-compose
+
+CONTROL_PANEL_APP_NAME="controlpanel"                    # Name of the Control Panel container
+CONTROL_PANEL_DISPLAY_NAME="Non-RT RIC Control Panel"
+CONTROL_PANEL_EXTERNAL_PORT=8080                         # Control Panel container external port (host -> container)
+CONTROL_PANEL_INTERNAL_PORT=8080                         # Control Panel container internal port (container -> container)
+CONTROL_PANEL_EXTERNAL_SECURE_PORT=8880                  # Control Panel container external port (host -> container)
+CONTROL_PANEL_INTERNAL_SECURE_PORT=8082                  # Control Panel container intternal port (container -> container)
+CONTROL_PANEL_LOGPATH="/logs/nonrtric-controlpanel.log"  # Path the application log in the Control Panel container
+CONTROL_PANEL_ALIVE_URL="/"                              # Base path for alive check
+CONTROL_PANEL_COMPOSE_DIR="control_panel"                # Dir in simulator_group for docker-compose
+CONTROL_PANEL_CONFIG_MOUNT_PATH=/maven                   # Container internal path for config
+CONTROL_PANEL_CONFIG_FILE=application.properties         # Config file name
+
+HTTP_PROXY_APP_NAME="httpproxy"                          # Name of the Http Proxy container
+HTTP_PROXY_DISPLAY_NAME="Http Proxy"
+HTTP_PROXY_EXTERNAL_PORT=8780                            # Http Proxy container external port (host -> container)
+HTTP_PROXY_INTERNAL_PORT=8080                            # Http Proxy container internal port (container -> container)
+HTTP_PROXY_WEB_EXTERNAL_PORT=8781                        # Http Proxy container external port (host -> container)
+HTTP_PROXY_WEB_INTERNAL_PORT=8081                        # Http Proxy container internal port (container -> container)
+HTTP_PROXY_CONFIG_PORT=0                                 # Port number for proxy config, will be set if proxy is started
+HTTP_PROXY_CONFIG_HOST_NAME=""                           # Proxy host, will be set if proxy is started
+HTTP_PROXY_ALIVE_URL="/"                                 # Base path for alive check
+HTTP_PROXY_COMPOSE_DIR="httpproxy"                       # Dir in simulator_group for docker-compose
+
+########################################
+# Setting for common curl-base function
+########################################
+
+UUID=""                                                  # UUID used as prefix to the policy id to simulate a real UUID
+                                                         # Testscript need to set the UUID to use other this empty prefix is used
diff --git a/test/common/test_env-onap-master.sh b/test/common/test_env-onap-master.sh
deleted file mode 100644 (file)
index 29647bd..0000000
+++ /dev/null
@@ -1,201 +0,0 @@
-#!/bin/bash
-
-#  ============LICENSE_START===============================================
-#  Copyright (C) 2020 Nordix Foundation. 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=================================================
-#
-#Profile for ONAP master
-TEST_ENV_PROFILE="ONAP-MASTER"
-NEXUS_PROXY_REPO="nexus3.onap.org:10001/"
-
-# Set up the image and tags for the test. Do not add the image tag to the image names.
-
-# NOTE: A env var for each container is created by the test script.
-# This var will point to the local or remote var depending on how
-# the test script is started. The name format is <container-name>_IMAGE, ie with 'LOCAL' or 'REMOTE'.
-
-# Local Policy Agent image and tag
-POLICY_AGENT_LOCAL_IMAGE="onap/ccsdk-oran-a1policymanagementservice"
-POLICY_AGENT_LOCAL_IMAGE_TAG="1.1.0-SNAPSHOT"
-# Remote Policy Agent image and tag
-POLICY_AGENT_REMOTE_IMAGE="nexus3.onap.org:10003/onap/ccsdk-oran-a1policymanagementservice"
-POLICY_AGENT_REMOTE_IMAGE_TAG="1.1.0-SNAPSHOT"
-
-# Local ECS image and tag
-ECS_LOCAL_IMAGE="o-ran-sc/nonrtric-enrichment-coordinator-service"
-ECS_LOCAL_IMAGE_TAG="1.0.0-SNAPSHOT"
-# Remote ECS image and tag
-ECS_REMOTE_IMAGE="nexus3.o-ran-sc.org:10003/o-ran-sc/nonrtric-enrichment-coordinator-service"
-ECS_REMOTE_IMAGE_TAG="1.0.0-SNAPSHOT"
-
-# Control Panel local image and tag
-CONTROL_PANEL_LOCAL_IMAGE="o-ran-sc/nonrtric-controlpanel"
-CONTROL_PANEL_LOCAL_IMAGE_TAG="2.0.0-SNAPSHOT"
-# Control Panel remote image and tag
-CONTROL_PANEL_REMOTE_IMAGE="nexus3.o-ran-sc.org:10004/o-ran-sc/nonrtric-controlpanel"
-CONTROL_PANEL_REMOTE_IMAGE_TAG="2.0.0"
-
-
-# SDNC A1 Controller remote image and tag
-SDNC_A1_CONTROLLER_REMOTE_IMAGE="nexus3.onap.org:10003/onap/sdnc-image"
-SDNC_A1_CONTROLLER_REMOTE_IMAGE_TAG="2.1.0-STAGING-latest"
-
-
-#SDNC DB remote image and tag
-SDNC_DB_REMOTE_IMAGE=$NEXUS_PROXY_REPO"mysql/mysql-server"
-SDNC_DB_REMOTE_IMAGE_TAG="5.6"
-#No local image for DB, remote image always used
-
-# Near RT RIC Simulator local image and tag
-RIC_SIM_LOCAL_IMAGE="o-ran-sc/a1-simulator"
-RIC_SIM_LOCAL_IMAGE_TAG="latest"
-# Near RT RIC Simulator remote image and tag
-RIC_SIM_REMOTE_IMAGE="nexus3.o-ran-sc.org:10004/o-ran-sc/a1-simulator"
-RIC_SIM_REMOTE_IMAGE_TAG="2.1.0"
-
-
-#Consul remote image and tag
-CONSUL_REMOTE_IMAGE=$NEXUS_PROXY_REPO"consul"
-CONSUL_REMOTE_IMAGE_TAG="1.7.2"
-#No local image for Consul, remote image always used
-
-
-#CBS remote image and tag
-CBS_REMOTE_IMAGE="nexus3.onap.org:10001/onap/org.onap.dcaegen2.platform.configbinding.app-app"
-CBS_REMOTE_IMAGE_TAG="2.3.0"
-#No local image for CBS, remote image always used
-
-
-#MR stub image and tag
-MRSTUB_LOCAL_IMAGE="mrstub"
-MRSTUB_LOCAL_IMAGE_TAG="latest"
-#No remote image for MR stub, local image always used
-
-#Callback receiver image and tag
-CR_LOCAL_IMAGE="callback-receiver"
-CR_LOCAL_IMAGE_TAG="latest"
-#No remote image for CR, local image always used
-
-#Producer stub image and tag
-PROD_STUB_LOCAL_IMAGE="producer-stub"
-PROD_STUB_LOCAL_IMAGE_TAG="latest"
-#No remote image for producer stub, local image always used
-
-# Common env var for auto-test. Vars used by docker-compose need to be exported
-export DOCKER_SIM_NWNAME="nonrtric-docker-net"                  # Name of docker private network
-
-export POLICY_AGENT_EXTERNAL_PORT=8081                          # Policy Agent container external port (host -> container)
-export POLICY_AGENT_INTERNAL_PORT=8081                          # Policy Agent container internal port (container -> container)
-export POLICY_AGENT_EXTERNAL_SECURE_PORT=8433                   # Policy Agent container external secure port (host -> container)
-export POLICY_AGENT_INTERNAL_SECURE_PORT=8433                   # Policy Agent container internal secure port (container -> container)
-export POLICY_AGENT_APIS="V1 V2"                                # Supported northbound api versions
-export PMS_VERSION="V2"                                         # Tested version of northbound API
-
-export POLICY_AGENT_APP_NAME="policy-agent"                     # Name for Policy Agent container
-POLICY_AGENT_LOGPATH="/var/log/policy-agent/application.log"    # Path the application log in the Policy Agent container
-export POLICY_AGENT_APP_NAME_ALIAS="policy-agent-container"     # Alias name, name used by the control panel
-
-export ECS_EXTERNAL_PORT=8083                                   # ECS container external port (host -> container)
-export ECS_INTERNAL_PORT=8083                                   # ECS container internal port (container -> container)
-export ECS_EXTERNAL_SECURE_PORT=8434                            # ECS container external secure port (host -> container)
-export ECS_INTERNAL_SECURE_PORT=8434                            # ECS container internal secure port (container -> container)
-
-export ECS_APP_NAME="ecs"                                       # Name for ECS container
-ECS_LOGPATH="/var/log/enrichment-coordinator-service/application.log" # Path the application log in the ECS container
-export ECS_APP_NAME_ALIAS="enrichment-service-container"        # Alias name, name used by the control panel
-export ECS_HOST_MNT_DIR="./mnt"                                 # Mounted dir, relative to compose file, on the host
-export ECS_CONTAINER_MNT_DIR="/var/enrichment-coordinator-service" # Mounted dir in the container
-
-export MR_EXTERNAL_PORT=3905                                    # MR stub container external port (host -> container)
-export MR_INTERNAL_PORT=3905                                    # MR stub container internal port (container -> container)
-export MR_EXTERNAL_SECURE_PORT=3906                             # MR stub container external secure port (host -> container)
-export MR_INTERNAL_SECURE_PORT=3906                             # MR stub container internal secure port (container -> container)
-export MR_APP_NAME="message-router"                             # Name for the MR
-export MR_READ_URL="/events/A1-POLICY-AGENT-READ/users/policy-agent?timeout=15000&limit=100" # Path to read messages from MR
-export MR_WRITE_URL="/events/A1-POLICY-AGENT-WRITE"             # Path write messages to MR
-
-export CR_EXTERNAL_PORT=8090                                    # Callback receiver container external port (host -> container)
-export CR_INTERNAL_PORT=8090                                    # Callback receiver container internal port (container -> container)
-export CR_EXTERNAL_SECURE_PORT=8091                             # Callback receiver container external secure port (host -> container)
-export CR_INTERNAL_SECURE_PORT=8091                             # Callback receiver container internal secure port (container -> container)
-export CR_APP_NAME="callback-receiver"                          # Name for the Callback receiver
-export CR_APP_CALLBACK="/callbacks"                             # Url for callbacks
-
-export PROD_STUB_EXTERNAL_PORT=8092                             # Producer stub container external port (host -> container)
-export PROD_STUB_INTERNAL_PORT=8092                             # Producer stub container internal port (container -> container)
-export PROD_STUB_EXTERNAL_SECURE_PORT=8093                      # Producer stub container external secure port (host -> container)
-export PROD_STUB_INTERNAL_SECURE_PORT=8093                      # Producer stub container internal secure port (container -> container)
-export PROD_STUB_APP_NAME="producer-stub"                       # Name for the Producer stub
-
-export CONSUL_HOST="consul-server"                              # Host name of consul
-export CONSUL_EXTERNAL_PORT=8500                                # Consul container external port (host -> container)
-export CONSUL_INTERNAL_PORT=8500                                # Consul container internal port (container -> container)
-export CONSUL_APP_NAME="polman-consul"                          # Name for consul container
-
-export CBS_APP_NAME="polman-cbs"                                # Name for CBS container
-export CBS_EXTERNAL_PORT=10000                                  # CBS container external port (host -> container)
-export CBS_INTERNAL_PORT=10000                                  # CBS container internal port (container -> container)
-export CONFIG_BINDING_SERVICE="config-binding-service"          # Host name of CBS
-
-export RIC_SIM_BASE="g"                                         # Base name of the RIC Simulator container, shall be the group code
-                                                                # Note, a prefix is added to each container name by the .env file in the 'ric' dir
-RIC_SIM_PREFIX="ricsim"                                         # Prefix added to ric container name, added in the .env file in the 'ric' dir
-                                                                # This prefix can be changed from the command line
-export RIC_SIM_INTERNAL_PORT=8085                               # RIC Simulator container internal port (container -> container).
-                                                                # (external ports allocated by docker)
-export RIC_SIM_INTERNAL_SECURE_PORT=8185                        # RIC Simulator container internal secure port (container -> container).
-                                                                # (external ports allocated by docker)
-
-export SDNC_APP_NAME="a1-controller"                            # Name of the SNDC A1 Controller container
-export SDNC_EXTERNAL_PORT=8282                                  # SNDC A1 Controller container external port (host -> container)
-export SDNC_INTERNAL_PORT=8181                                  # SNDC A1 Controller container internal port (container -> container)
-export SDNC_EXTERNAL_SECURE_PORT=8443                           # SNDC A1 Controller container external securee port (host -> container)
-export SDNC_INTERNAL_SECURE_PORT=8443                           # SNDC A1 Controller container internal secure port (container -> container)
-export SDNC_DB_APP_NAME="sdnc-db"                               # Name of the SDNC DB container
-export SDNC_A1_TRUSTSTORE_PASSWORD="a1adapter"                  # SDNC truststore password
-SDNC_USER="admin"                                               # SDNC username
-SDNC_PWD="Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U"          # SNDC PWD
-SDNC_API_URL="/restconf/operations/A1-ADAPTER-API:"             # Base url path for SNDC API
-SDNC_ALIVE_URL="/apidoc/explorer/"                              # Base url path for SNDC API docs (for alive check)
-SDNC_KARAF_LOG="/opt/opendaylight/data/log/karaf.log"           # Path to karaf log
-
-
-export CONTROL_PANEL_APP_NAME="control-panel"                   # Name of the Control Panel container
-export CONTROL_PANEL_EXTERNAL_PORT=8080                         # Control Panel container external port (host -> container)
-export CONTROL_PANEL_INTERNAL_PORT=8080                         # Control Panel container external port (host -> container)
-CONTROL_PANEL_LOGPATH="/logs/nonrtric-controlpanel.log"         # Path the application log in the Control Panel container
-
-UUID=""                                                         # UUID used as prefix to the policy id to simulate a real UUID
-                                                                # Testscript need to set the UUID to use other this empty prefix is used
-
-RESTBASE="http://localhost:"$POLICY_AGENT_EXTERNAL_PORT         # Base url to the Agent NB REST interface
-RESTBASE_SECURE="https://localhost:"$POLICY_AGENT_EXTERNAL_SECURE_PORT # Base url to the secure Agent NB REST interface
-DMAAPBASE="http://localhost:"$MR_EXTERNAL_PORT                  # Base url to the Dmaap adapter, http
-DMAAPBASE_SECURE="https://localhost:"$MR_EXTERNAL_SECURE_PORT   # Base url to the Dmaap adapter, https
-ADAPTER=$RESTBASE                                               # Adapter holds the address the agent R-APP interface (REST OR DMAAP)
-                                                                # The values of this var is swiched between the two base url when needed
-                                                                # The values of this var is swiched between the four base url when needed
-
-ECS_RESTBASE="http://localhost:"$ECS_EXTERNAL_PORT              # Base url to the ECS NB REST interface
-ECS_RESTBASE_SECURE="https://localhost:"$ECS_EXTERNAL_SECURE_PORT # Base url to the secure ECS NB REST interface
-ECS_DMAAPBASE="http://localhost:"$MR_EXTERNAL_PORT              # Base url to the Dmaap adapter, http
-ECS_DMAAPBASE_SECURE="https://localhost:"$MR_EXTERNAL_SECURE_PORT   # Base url to the Dmaap adapter, https
-ECS_ADAPTER=$ECS_RESTBASE                                       # Adapter holds the address the ECS R-APP interface (REST OR DMAAP)
-                                                                # The values of this var is swiched between the four base url when needed
-
-CR_RESTBASE="http://localhost:"$CR_EXTERNAL_PORT                # Base url to the Callback receiver REST interface
-CR_RESTBASE_SECURE="https://localhost:"$CR_EXTERNAL_SECURE_PORT # Base url to the secure Callback receiver REST interface
-CR_ADAPTER=$CR_RESTBASE                                         # Adapter holds the address the CR admin interface (REST only)
-                                                                # The values of this var is swiched between the two base url when needed
\ No newline at end of file
index 4650768..bc20aba 100755 (executable)
 #
 #Profile for ORAN Cherry
 TEST_ENV_PROFILE="ORAN-CHERRY"
-NEXUS_PROXY_REPO="nexus3.onap.org:10001/"
+FLAVOUR="ORAN"
+
+########################################
+## Nexus repo settings
+########################################
+
+# Nexus repos for developed images
+NEXUS_PROXY_REPO="nexus3.o-ran-sc.org:10001/"
+NEXUS_RELEASE_REPO="nexus3.o-ran-sc.org:10002/"
+NEXUS_SNAPSHOT_REPO="nexus3.o-ran-sc.org:10003/"
+NEXUS_STAGING_REPO="nexus3.o-ran-sc.org:10004/"
+
+# Nexus repos for images used by test (not developed by the project)
+NEXUS_RELEASE_REPO_ONAP="nexus3.onap.org:10002/"  # Only for released ONAP images
+NEXUS_RELEASE_REPO_ORAN=$NEXUS_RELEASE_REPO
+
+########################################
+# Set up of image and tags for the test.
+########################################
+
+# NOTE: One environment variable containing the image name and tag is create by the test script
+# for each image from the env variables below.
+# The variable is created by removing the suffix "_BASE" from the base image variable name.
+# Example: POLICY_AGENT_IMAGE_BASE -> POLICY_AGENT_IMAGE
+# This var will point to the local or remote image depending on cmd line arguments.
+# In addition, the repo and the image tag version are selected from the list of image tags based on the cmd line argurment.
+# For images built by the script, only tag #1 shall be specified
+# For project images, only tag #1, #2, #3 and #4 shall be specified
+# For ORAN images (non project), only tag #5 shall be specified
+# For ONAP images (non project), only tag #6 shall be specified
+# For all other images, only tag #7 shall be specified
+# 1 XXX_LOCAL: local images: <image-name>:<local-tag>
+# 2 XXX_REMOTE_SNAPSHOT: snapshot images: <snapshot-nexus-repo><image-name>:<snapshot-tag>
+# 3 XXX_REMOTE: staging images: <staging-nexus-repo><image-name>:<staging-tag>
+# 4 XXX_REMOTE_RELEASE: release images: <release-nexus-repo><image-name>:<release-tag>
+# 5 XXX_REMOTE_RELEASE_ORAN: ORAN release images: <oran-release-nexus-repo><image-name>:<release-tag>
+# 6 XXX_REMOTE_RELEASE_ONAP: ONAP release images: <onap-release-nexus-repo><image-name>:<release-tag>
+# 7 XXX_PROXY: other images, not produced by the project: <proxy-nexus-repo><mage-name>:<proxy-tag>
+
+
+# Policy Agent base image and tags
+POLICY_AGENT_IMAGE_BASE="o-ran-sc/nonrtric-policy-agent"
+POLICY_AGENT_IMAGE_TAG_LOCAL="2.1.0-SNAPSHOT"
+POLICY_AGENT_IMAGE_TAG_REMOTE_SNAPSHOT="2.1.0-SNAPSHOT"
+POLICY_AGENT_IMAGE_TAG_REMOTE="2.1.0"
+POLICY_AGENT_IMAGE_TAG_REMOTE_RELEASE="2.1.0"
+
+# ECS image and tags
+ECS_IMAGE_BASE="o-ran-sc/nonrtric-enrichment-coordinator-service"
+ECS_IMAGE_TAG_LOCAL="1.0.0-SNAPSHOT"
+ECS_IMAGE_TAG_REMOTE_SNAPSHOT="1.0.0-SNAPSHOT"
+ECS_IMAGE_TAG_REMOTE="1.0.0"
+ECS_IMAGE_TAG_REMOTE_RELEASE="1.0.0"
+
+
+# Control Panel image and tags
+CONTROL_PANEL_IMAGE_BASE="o-ran-sc/nonrtric-controlpanel"
+CONTROL_PANEL_IMAGE_TAG_LOCAL="2.1.0-SNAPSHOT"
+CONTROL_PANEL_IMAGE_TAG_REMOTE_SNAPSHOT="2.1.0-SNAPSHOT"
+CONTROL_PANEL_IMAGE_TAG_REMOTE="2.1.0"
+CONTROL_PANEL_IMAGE_TAG_REMOTE_RELEASE="2.1.0"
+
+
+# SDNC A1 Controller image and tags
+SDNC_A1_CONTROLLER_IMAGE_BASE="o-ran-sc/nonrtric-a1-controller"
+SDNC_A1_CONTROLLER_IMAGE_TAG_LOCAL="2.0.1-SNAPSHOT"
+SDNC_A1_CONTROLLER_IMAGE_TAG_REMOTE_SNAPSHOT="2.0.1-SNAPSHOT"
+SDNC_A1_CONTROLLER_IMAGE_TAG_REMOTE="2.0.1"
+SDNC_A1_CONTROLLER_IMAGE_TAG_REMOTE_RELEASE="2.0.1"
 
-# Set up the image and tags for the test. Do not add the image tag to the image names.
 
-# NOTE: A env var for each container is created by the test script.
-# This var will point to the local or remote var depending on how
-# the test script is started. The name format is <container-name>_IMAGE, ie with 'LOCAL' or 'REMOTE'.
-
-# Local Policy Agent image and tag
-POLICY_AGENT_LOCAL_IMAGE="o-ran-sc/nonrtric-policy-agent"
-POLICY_AGENT_LOCAL_IMAGE_TAG="2.1.0-SNAPSHOT"
-# Remote Policy Agent image and tag
-POLICY_AGENT_REMOTE_IMAGE="nexus3.o-ran-sc.org:10004/o-ran-sc/nonrtric-policy-agent"
-POLICY_AGENT_REMOTE_IMAGE_TAG="2.1.0"
-
-# Local ECS image and tag
-ECS_LOCAL_IMAGE="o-ran-sc/nonrtric-enrichment-coordinator-service"
-ECS_LOCAL_IMAGE_TAG="1.0.0-SNAPSHOT"
-# Remote ECS image and tag
-ECS_REMOTE_IMAGE="nexus3.o-ran-sc.org:10004/o-ran-sc/nonrtric-enrichment-coordinator-service"
-ECS_REMOTE_IMAGE_TAG="1.0.0"
-
-# Control Panel local image and tag
-CONTROL_PANEL_LOCAL_IMAGE="o-ran-sc/nonrtric-controlpanel"
-CONTROL_PANEL_LOCAL_IMAGE_TAG="2.0.0-SNAPSHOT"
-# Control Panel remote image and tag
-CONTROL_PANEL_REMOTE_IMAGE="nexus3.o-ran-sc.org:10004/o-ran-sc/nonrtric-controlpanel"
-CONTROL_PANEL_REMOTE_IMAGE_TAG="2.0.0"
-
-
-# SDNC A1 Controller local image and tag
-SDNC_A1_CONTROLLER_LOCAL_IMAGE="o-ran-sc/nonrtric-a1-controller"
-SDNC_A1_CONTROLLER_LOCAL_IMAGE_TAG="2.1.0-SNAPSHOT"
-# SDNC A1 Controller remote image and tag
-SDNC_A1_CONTROLLER_REMOTE_IMAGE="nexus3.o-ran-sc.org:10004/o-ran-sc/nonrtric-a1-controller"
-SDNC_A1_CONTROLLER_REMOTE_IMAGE_TAG="2.1.0"
-
-
-# RAPP Catalogue local image and tag
-RAPP_CAT_LOCAL_IMAGE="o-ran-sc/nonrtric-r-app-catalogue"
-RAPP_CAT_LOCAL_IMAGE_TAG="1.0.0-SNAPSHOT"
-# RAPP Catalogue remote image and tag
-RAPP_CAT_REMOTE_IMAGE="nexus3.o-ran-sc.org:10004/o-ran-sc/nonrtric-r-app-catalogue"
-RAPP_CAT_REMOTE_IMAGE_TAG="1.0.0"
+#SDNC DB remote image and tag
+SDNC_DB_IMAGE_BASE="mysql/mysql-server"
+SDNC_DB_IMAGE_TAG_REMOTE_PROXY="5.6"
+#No local image for SSDNC DB, remote image always used
 
 
-#SDNC DB remote image and tag
-SDNC_DB_REMOTE_IMAGE=$NEXUS_PROXY_REPO"mysql/mysql-server"
-SDNC_DB_REMOTE_IMAGE_TAG="5.6"
-#No local image for DB, remote image always used
+# RAPP Catalogue image and tags
+RAPP_CAT_IMAGE_BASE="o-ran-sc/nonrtric-r-app-catalogue"
+RAPP_CAT_IMAGE_TAG_LOCAL="1.0.0-SNAPSHOT"
+RAPP_CAT_IMAGE_TAG_REMOTE_SNAPSHOT="1.0.0-SNAPSHOT"
+RAPP_CAT_IMAGE_TAG_REMOTE="1.0.0"
+RAPP_CAT_IMAGE_TAG_REMOTE_RELEASE="1.0.0"
 
 
-# Near RT RIC Simulator local image and tag
-RIC_SIM_LOCAL_IMAGE="o-ran-sc/a1-simulator"
-RIC_SIM_LOCAL_IMAGE_TAG="latest"
-# Near RT RIC Simulator remote image and tag
-RIC_SIM_REMOTE_IMAGE="nexus3.o-ran-sc.org:10004/o-ran-sc/a1-simulator"
-RIC_SIM_REMOTE_IMAGE_TAG="2.1.0"
+# Near RT RIC Simulator image and tags
+RIC_SIM_IMAGE_BASE="o-ran-sc/a1-simulator"
+RIC_SIM_IMAGE_TAG_LOCAL="latest"
+RIC_SIM_IMAGE_TAG_REMOTE_SNAPSHOT="2.1.0-SNAPSHOT"
+RIC_SIM_IMAGE_TAG_REMOTE="2.1.0"
+RIC_SIM_IMAGE_TAG_REMOTE_RELEASE="2.1.0"
 
 
 #Consul remote image and tag
-CONSUL_REMOTE_IMAGE=$NEXUS_PROXY_REPO"consul"
-CONSUL_REMOTE_IMAGE_TAG="1.7.2"
+CONSUL_IMAGE_BASE="consul"
+CONSUL_IMAGE_TAG_REMOTE_PROXY="1.7.2"
 #No local image for Consul, remote image always used
 
 
 #CBS remote image and tag
-CBS_REMOTE_IMAGE="nexus3.onap.org:10001/onap/org.onap.dcaegen2.platform.configbinding.app-app"
-CBS_REMOTE_IMAGE_TAG="2.3.0"
+CBS_IMAGE_BASE="onap/org.onap.dcaegen2.platform.configbinding.app-app"
+CBS_IMAGE_TAG_REMOTE_RELEASE_ONAP="2.3.0"
 #No local image for CBS, remote image always used
 
 
 #MR stub image and tag
-MRSTUB_LOCAL_IMAGE="mrstub"
-MRSTUB_LOCAL_IMAGE_TAG="latest"
+MRSTUB_IMAGE_BASE="mrstub"
+MRSTUB_IMAGE_TAG_LOCAL="latest"
 #No remote image for MR stub, local image always used
 
+
 #Callback receiver image and tag
-CR_LOCAL_IMAGE="callback-receiver"
-CR_LOCAL_IMAGE_TAG="latest"
+CR_IMAGE_BASE="callback-receiver"
+CR_IMAGE_TAG_LOCAL="latest"
 #No remote image for CR, local image always used
 
+
 #Producer stub image and tag
-PROD_STUB_LOCAL_IMAGE="producer-stub"
-PROD_STUB_LOCAL_IMAGE_TAG="latest"
+PROD_STUB_IMAGE_BASE="producer-stub"
+PROD_STUB_IMAGE_TAG_LOCAL="latest"
 #No remote image for producer stub, local image always used
 
-# Common env var for auto-test. Vars used by docker-compose need to be exported
-export DOCKER_SIM_NWNAME="nonrtric-docker-net"                  # Name of docker private network
-
-export POLICY_AGENT_EXTERNAL_PORT=8081                          # Policy Agent container external port (host -> container)
-export POLICY_AGENT_INTERNAL_PORT=8081                          # Policy Agent container internal port (container -> container)
-export POLICY_AGENT_EXTERNAL_SECURE_PORT=8433                   # Policy Agent container external secure port (host -> container)
-export POLICY_AGENT_INTERNAL_SECURE_PORT=8433                   # Policy Agent container internal secure port (container -> container)
-export POLICY_AGENT_APIS="V1 V2"                                # Supported northbound api versions
-export PMS_VERSION="V2"                                         # Tested version of northbound API
-
-export POLICY_AGENT_APP_NAME="policy-agent"                     # Name for Policy Agent container
-POLICY_AGENT_LOGPATH="/var/log/policy-agent/application.log"    # Path the application log in the Policy Agent container
-export POLICY_AGENT_APP_NAME_ALIAS="policy-agent-container"     # Alias name, name used by the control panel
-
-export ECS_EXTERNAL_PORT=8083                                   # ECS container external port (host -> container)
-export ECS_INTERNAL_PORT=8083                                   # ECS container internal port (container -> container)
-export ECS_EXTERNAL_SECURE_PORT=8434                            # ECS container external secure port (host -> container)
-export ECS_INTERNAL_SECURE_PORT=8434                            # ECS container internal secure port (container -> container)
+#Http proxy remote image and tag
+HTTP_PROXY_IMAGE_BASE="mitmproxy/mitmproxy"
+HTTP_PROXY_IMAGE_TAG_REMOTE_PROXY="6.0.2"
+#No local image for Http proxy, remote image always used
+
+#ONAP Zookeeper remote image and tag
+ONAP_ZOOKEEPER_IMAGE_BASE="onap/dmaap/zookeeper"
+ONAP_ZOOKEEPER_IMAGE_TAG_REMOTE_RELEASE_ONAP="6.0.3"
+#No local image for ONAP Zookeeper, remote image always used
+
+#ONAP Kafka remote image and tag
+ONAP_KAFKA_IMAGE_BASE="onap/dmaap/kafka111"
+ONAP_KAFKA_IMAGE_TAG_REMOTE_RELEASE_ONAP="1.0.4"
+#No local image for ONAP Kafka, remote image always used
+
+#ONAP DMAAP-MR remote image and tag
+ONAP_DMAAPMR_IMAGE_BASE="onap/dmaap/dmaap-mr"
+ONAP_DMAAPMR_IMAGE_TAG_REMOTE_RELEASE_ONAP="1.1.18"
+#No local image for ONAP DMAAP-MR, remote image always used
+
+# List of app short names produced by the project
+PROJECT_IMAGES_APP_NAMES="PA ECS CP SDNC RC RICSIM"
+
+# List of app short names which images pulled from ORAN
+ORAN_IMAGES_APP_NAMES=""  # Not used
+
+# List of app short names which images pulled from ONAP
+ONAP_IMAGES_APP_NAMES="CBS DMAAPMR"
+
+
+########################################
+# Detailed settings per app
+########################################
+
+DOCKER_SIM_NWNAME="nonrtric-docker-net"                  # Name of docker private network
+
+KUBE_NONRTRIC_NAMESPACE="nonrtric"                       # Namespace for all nonrtric components
+KUBE_SIM_NAMESPACE="nonrtric-ft"                         # Namespace for simulators (except MR and RICSIM)
+KUBE_ONAP_NAMESPACE="onap"                               # Namespace for onap (only message router)
+
+POLICY_AGENT_EXTERNAL_PORT=8081                          # Policy Agent container external port (host -> container)
+POLICY_AGENT_INTERNAL_PORT=8081                          # Policy Agent container internal port (container -> container)
+POLICY_AGENT_EXTERNAL_SECURE_PORT=8433                   # Policy Agent container external secure port (host -> container)
+POLICY_AGENT_INTERNAL_SECURE_PORT=8433                   # Policy Agent container internal secure port (container -> container)
+POLICY_AGENT_APIS="V1 V2"                                # Supported northbound api versions
+PMS_VERSION="V2"                                         # Tested version of northbound API
+PMS_API_PREFIX=""                                        # api url prefix, only for V2
+
+POLICY_AGENT_APP_NAME="policymanagementservice"          # Name for Policy Agent container
+POLICY_AGENT_DISPLAY_NAME="Policy Management Service"
+POLICY_AGENT_HOST_MNT_DIR="./mnt"                        # Mounted dir, relative to compose file, on the host
+POLICY_AGENT_LOGPATH="/var/log/policy-agent/application.log" # Path the application log in the Policy Agent container
+POLICY_AGENT_APP_NAME_ALIAS="policy-agent-container"     # Alias name, name used by the control panel
+POLICY_AGENT_CONFIG_KEY="policy-agent"                   # Key for consul config
+POLICY_AGENT_PKG_NAME="org.oransc.policyagent"           # Java base package name
+POLICY_AGENT_ACTUATOR="/actuator/loggers/$POLICY_AGENT_PKG_NAME" # Url for trace/debug
+POLICY_AGENT_ALIVE_URL=$PMS_API_PREFIX"/v2/status"       # Base path for alive check
+POLICY_AGENT_COMPOSE_DIR="policy_agent"                  # Dir in simulator_group for docker-compose
+POLICY_AGENT_CONFIG_MOUNT_PATH="/opt/app/policy-agent/config" # Path in container for config file
+POLICY_AGENT_DATA_MOUNT_PATH="/opt/app/policy-agent/data" # Path in container for data file
+POLICY_AGENT_CONFIG_FILE="application.yaml"              # Container config file name
+POLICY_AGENT_DATA_FILE="application_configuration.json"  # Container data file name
+
+ECS_APP_NAME="enrichmentservice"                         # Name for ECS container
+ECS_DISPLAY_NAME="Enrichment Coordinator Service"        # Display name for ECS container
+ECS_EXTERNAL_PORT=8083                                   # ECS container external port (host -> container)
+ECS_INTERNAL_PORT=8083                                   # ECS container internal port (container -> container)
+ECS_EXTERNAL_SECURE_PORT=8434                            # ECS container external secure port (host -> container)
+ECS_INTERNAL_SECURE_PORT=8434                            # ECS container internal secure port (container -> container)
 
-export ECS_APP_NAME="ecs"                                       # Name for ECS container
 ECS_LOGPATH="/var/log/enrichment-coordinator-service/application.log" # Path the application log in the ECS container
-export ECS_APP_NAME_ALIAS="enrichment-service-container"        # Alias name, name used by the control panel
-export ECS_HOST_MNT_DIR="./mnt"                                 # Mounted dir, relative to compose file, on the host
-export ECS_CONTAINER_MNT_DIR="/var/enrichment-coordinator-service" # Mounted dir in the container
-
-export MR_EXTERNAL_PORT=3905                                    # MR stub container external port (host -> container)
-export MR_INTERNAL_PORT=3905                                    # MR stub container internal port (container -> container)
-export MR_EXTERNAL_SECURE_PORT=3906                             # MR stub container external secure port (host -> container)
-export MR_INTERNAL_SECURE_PORT=3906                             # MR stub container internal secure port (container -> container)
-export MR_APP_NAME="message-router"                             # Name for the MR
-export MR_READ_URL="/events/A1-POLICY-AGENT-READ/users/policy-agent?timeout=15000&limit=100" # Path to read messages from MR
-export MR_WRITE_URL="/events/A1-POLICY-AGENT-WRITE"             # Path write messages to MR
-
-export CR_EXTERNAL_PORT=8090                                    # Callback receiver container external port (host -> container)
-export CR_INTERNAL_PORT=8090                                    # Callback receiver container internal port (container -> container)
-export CR_EXTERNAL_SECURE_PORT=8091                             # Callback receiver container external secure port (host -> container)
-export CR_INTERNAL_SECURE_PORT=8091                             # Callback receiver container internal secure port (container -> container)
-export CR_APP_NAME="callback-receiver"                          # Name for the Callback receiver
-export CR_APP_CALLBACK="/callbacks"                             # Url for callbacks
-
-export PROD_STUB_EXTERNAL_PORT=8092                             # Producer stub container external port (host -> container)
-export PROD_STUB_INTERNAL_PORT=8092                             # Producer stub container internal port (container -> container)
-export PROD_STUB_EXTERNAL_SECURE_PORT=8093                      # Producer stub container external secure port (host -> container)
-export PROD_STUB_INTERNAL_SECURE_PORT=8093                      # Producer stub container internal secure port (container -> container)
-export PROD_STUB_APP_NAME="producer-stub"                       # Name for the Producer stub
-
-export CONSUL_HOST="consul-server"                              # Host name of consul
-export CONSUL_EXTERNAL_PORT=8500                                # Consul container external port (host -> container)
-export CONSUL_INTERNAL_PORT=8500                                # Consul container internal port (container -> container)
-export CONSUL_APP_NAME="polman-consul"                          # Name for consul container
-
-export CBS_APP_NAME="polman-cbs"                                # Name for CBS container
-export CBS_EXTERNAL_PORT=10000                                  # CBS container external port (host -> container)
-export CBS_INTERNAL_PORT=10000                                  # CBS container internal port (container -> container)
-export CONFIG_BINDING_SERVICE="config-binding-service"          # Host name of CBS
-
-export RIC_SIM_BASE="g"                                         # Base name of the RIC Simulator container, shall be the group code
-                                                                # Note, a prefix is added to each container name by the .env file in the 'ric' dir
-RIC_SIM_PREFIX="ricsim"                                         # Prefix added to ric container name, added in the .env file in the 'ric' dir
-                                                                # This prefix can be changed from the command line
-export RIC_SIM_INTERNAL_PORT=8085                               # RIC Simulator container internal port (container -> container).
-                                                                # (external ports allocated by docker)
-export RIC_SIM_INTERNAL_SECURE_PORT=8185                        # RIC Simulator container internal secure port (container -> container).
-                                                                # (external ports allocated by docker)
-
-export SDNC_APP_NAME="a1-controller"                            # Name of the SNDC A1 Controller container
-export SDNC_EXTERNAL_PORT=8282                                  # SNDC A1 Controller container external port (host -> container)
-export SDNC_INTERNAL_PORT=8181                                  # SNDC A1 Controller container internal port (container -> container)
-export SDNC_EXTERNAL_SECURE_PORT=8443                           # SNDC A1 Controller container external securee port (host -> container)
-export SDNC_INTERNAL_SECURE_PORT=8443                           # SNDC A1 Controller container internal secure port (container -> container)
-export SDNC_DB_APP_NAME="sdnc-db"                               # Name of the SDNC DB container
-export SDNC_A1_TRUSTSTORE_PASSWORD=""                           # SDNC truststore password
-SDNC_USER="admin"                                               # SDNC username
-SDNC_PWD="Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U"          # SNDC PWD
-SDNC_API_URL="/restconf/operations/A1-ADAPTER-API:"             # Base url path for SNDC API
-SDNC_ALIVE_URL="/apidoc/explorer/"                              # Base url path for SNDC API docs (for alive check)
-SDNC_KARAF_LOG="/opt/opendaylight/data/log/karaf.log"           # Path to karaf log
-
-export RAPP_CAT_EXTERNAL_PORT=8680                             # RAPP Catalogue container external port (host -> container)
-export RAPP_CAT_INTERNAL_PORT=8080                             # RAPP Catalogue container internal port (container -> container)
-export RAPP_CAT_EXTERNAL_SECURE_PORT=8633                      # RAPP Catalogue container external secure port (host -> container)
-export RAPP_CAT_INTERNAL_SECURE_PORT=8433                      # RAPP Catalogue container internal secure port (container -> container)
-export RAPP_CAT_APP_NAME="rapp-catalogue"                      # Name for the RAPP Catalogue
-
-
-export CONTROL_PANEL_APP_NAME="control-panel"                   # Name of the Control Panel container
-export CONTROL_PANEL_EXTERNAL_PORT=8080                         # Control Panel container external port (host -> container)
-export CONTROL_PANEL_INTERNAL_PORT=8080                         # Control Panel container external port (host -> container)
-CONTROL_PANEL_LOGPATH="/logs/nonrtric-controlpanel.log"         # Path the application log in the Control Panel container
-
-UUID=""                                                         # UUID used as prefix to the policy id to simulate a real UUID
-                                                                # Testscript need to set the UUID otherwise this empty prefix is used
-
-RESTBASE="http://localhost:"$POLICY_AGENT_EXTERNAL_PORT         # Base url to the Agent NB REST interface
-RESTBASE_SECURE="https://localhost:"$POLICY_AGENT_EXTERNAL_SECURE_PORT # Base url to the secure Agent NB REST interface
-DMAAPBASE="http://localhost:"$MR_EXTERNAL_PORT                  # Base url to the Dmaap adapter, http
-DMAAPBASE_SECURE="https://localhost:"$MR_EXTERNAL_SECURE_PORT   # Base url to the Dmaap adapter, https
-ADAPTER=$RESTBASE                                               # Adapter holds the address the agent R-APP interface (REST OR DMAAP)
-                                                                # The values of this var is swiched between the four base url when needed
-
-ECS_RESTBASE="http://localhost:"$ECS_EXTERNAL_PORT              # Base url to the ECS NB REST interface
-ECS_RESTBASE_SECURE="https://localhost:"$ECS_EXTERNAL_SECURE_PORT # Base url to the secure ECS NB REST interface
-ECS_DMAAPBASE="http://localhost:"$MR_EXTERNAL_PORT              # Base url to the Dmaap adapter, http
-ECS_DMAAPBASE_SECURE="https://localhost:"$MR_EXTERNAL_SECURE_PORT   # Base url to the Dmaap adapter, https
-ECS_ADAPTER=$ECS_RESTBASE                                       # Adapter holds the address the ECS R-APP interface (REST OR DMAAP)
-                                                                # The values of this var is swiched between the four base url when needed
-
-CR_RESTBASE="http://localhost:"$CR_EXTERNAL_PORT                # Base url to the Callback receiver REST interface
-CR_RESTBASE_SECURE="https://localhost:"$CR_EXTERNAL_SECURE_PORT # Base url to the secure Callback receiver REST interface
-CR_ADAPTER=$CR_RESTBASE                                         # Adapter holds the address the CR admin interface (REST only)
-                                                                # The values of this var is swiched between the two base url when needed
-
-RC_RESTBASE="http://localhost:"$RAPP_CAT_EXTERNAL_PORT          # Base url to the RAPP Catalogue REST interface
-RC_RESTBASE_SECURE="https://localhost:"$RAPP_CAT_EXTERNAL_SECURE_PORT # Base url to the secure RAPP Catalogue REST interface
-RC_ADAPTER=$RC_RESTBASE                                         # Adapter holds the address the RAPP Catalogue interface
\ No newline at end of file
+ECS_APP_NAME_ALIAS="enrichment-service-container"        # Alias name, name used by the control panel
+ECS_HOST_MNT_DIR="./mnt/db"                              # Mounted dir, relative to compose file, on the host
+ECS_CONTAINER_MNT_DIR="/var/enrichment-coordinator-service" # Mounted dir in the container
+ECS_ACTUATOR="/actuator/loggers/org.oransc.enrichment"   # Url for trace/debug
+ECS_CERT_MOUNT_DIR="./cert"
+ECS_ALIVE_URL="/status"                                  # Base path for alive check
+ECS_COMPOSE_DIR="ecs"                                    # Dir in simulator_group for docker-compose
+ECS_CONFIG_MOUNT_PATH=/opt/app/enrichment-coordinator-service/config # Internal container path for configuration
+ECS_CONFIG_FILE=application.yaml                         # Config file name
+ECS_VERSION="V1-1"                                       # Version where the types are added in the producer registration
+
+MR_DMAAP_APP_NAME="dmaap-mr"                             # Name for the Dmaap MR
+MR_STUB_APP_NAME="mr-stub"                               # Name of the MR stub
+MR_DMAAP_DISPLAY_NAME="DMAAP Message Router"
+MR_STUB_DISPLAY_NAME="Message Router stub"
+MR_STUB_CERT_MOUNT_DIR="./cert"
+MR_EXTERNAL_PORT=3904                                    # MR dmaap/stub container external port
+MR_INTERNAL_PORT=3904                                    # MR dmaap/stub container internal port
+MR_EXTERNAL_SECURE_PORT=3905                             # MR dmaap/stub container external secure port
+MR_INTERNAL_SECURE_PORT=3905                             # MR dmaap/stub container internal secure port
+MR_DMAAP_LOCALHOST_PORT=3904                             # MR stub container external port (host -> container)
+MR_STUB_LOCALHOST_PORT=3908                              # MR stub container external port (host -> container)
+MR_DMAAP_LOCALHOST_SECURE_PORT=3905                      # MR stub container internal port (container -> container)
+MR_STUB_LOCALHOST_SECURE_PORT=3909                       # MR stub container external secure port (host -> container)
+MR_READ_URL="/events/A1-POLICY-AGENT-READ/users/policy-agent?timeout=15000&limit=100" # Path to read messages from MR
+MR_WRITE_URL="/events/A1-POLICY-AGENT-WRITE"             # Path write messages to MR
+MR_READ_TOPIC="A1-POLICY-AGENT-READ"                     # Read topic
+MR_WRITE_TOPIC="A1-POLICY-AGENT-WRITE"                   # Write topic
+MR_STUB_ALIVE_URL="/"                                    # Base path for mr stub alive check
+MR_DMAAP_ALIVE_URL="/topics"                             # Base path for dmaap-mr alive check
+MR_DMAAP_COMPOSE_DIR="dmaapmr"                           # Dir in simulator_group for dmaap mr for - docker-compose
+MR_STUB_COMPOSE_DIR="mrstub"                             # Dir in simulator_group for mr stub for - docker-compose
+MR_KAFKA_APP_NAME="kafka"                                # Kafka app name
+MR_ZOOKEEPER_APP_NAME="zookeeper"                        # Zookeeper app name
+
+
+CR_APP_NAME="callback-receiver"                          # Name for the Callback receiver
+CR_DISPLAY_NAME="Callback Reciever"
+CR_EXTERNAL_PORT=8090                                    # Callback receiver container external port (host -> container)
+CR_INTERNAL_PORT=8090                                    # Callback receiver container internal port (container -> container)
+CR_EXTERNAL_SECURE_PORT=8091                             # Callback receiver container external secure port (host -> container)
+CR_INTERNAL_SECURE_PORT=8091                             # Callback receiver container internal secure port (container -> container)
+CR_APP_CALLBACK="/callbacks"                             # Url for callbacks
+CR_ALIVE_URL="/"                                         # Base path for alive check
+CR_COMPOSE_DIR="cr"                                      # Dir in simulator_group for docker-compose
+
+PROD_STUB_APP_NAME="producer-stub"                       # Name for the Producer stub
+PROD_STUB_DISPLAY_NAME="Producer Stub"
+PROD_STUB_EXTERNAL_PORT=8092                             # Producer stub container external port (host -> container)
+PROD_STUB_INTERNAL_PORT=8092                             # Producer stub container internal port (container -> container)
+PROD_STUB_EXTERNAL_SECURE_PORT=8093                      # Producer stub container external secure port (host -> container)
+PROD_STUB_INTERNAL_SECURE_PORT=8093                      # Producer stub container internal secure port (container -> container)
+PROD_STUB_JOB_CALLBACK="/callbacks/job"                  # Callback path for job create/update/delete
+PROD_STUB_SUPERVISION_CALLBACK="/callbacks/supervision"  # Callback path for producre supervision
+PROD_STUB_ALIVE_URL="/"                                  # Base path for alive check
+PROD_STUB_COMPOSE_DIR="prodstub"                         # Dir in simulator_group for docker-compose
+
+CONSUL_HOST="consul-server"                              # Host name of consul
+CONSUL_DISPLAY_NAME="Consul"
+CONSUL_EXTERNAL_PORT=8500                                # Consul container external port (host -> container)
+CONSUL_INTERNAL_PORT=8500                                # Consul container internal port (container -> container)
+CONSUL_APP_NAME="polman-consul"                          # Name for consul container
+CONSUL_ALIVE_URL="/ui/dc1/kv"                            # Base path for alive check
+CONSUL_CBS_COMPOSE_DIR="consul_cbs"                      # Dir in simulator group for docker compose
+
+CBS_APP_NAME="polman-cbs"                                # Name for CBS container
+CBS_DISPLAY_NAME="Config Binding Service"
+CBS_EXTERNAL_PORT=10000                                  # CBS container external port (host -> container)
+CBS_INTERNAL_PORT=10000                                  # CBS container internal port (container -> container)
+CONFIG_BINDING_SERVICE="config-binding-service"          # Host name of CBS
+CBS_ALIVE_URL="/healthcheck"                             # Base path for alive check
+
+RIC_SIM_DISPLAY_NAME="Near-RT RIC A1 Simulator"
+RIC_SIM_BASE="g"                                         # Base name of the RIC Simulator container, shall be the group code
+                                                         # Note, a prefix is added to each container name by the .env file in the 'ric' dir
+RIC_SIM_PREFIX="ricsim"                                  # Prefix added to ric container name, added in the .env file in the 'ric' dir
+                                                         # This prefix can be changed from the command line
+RIC_SIM_INTERNAL_PORT=8085                               # RIC Simulator container internal port (container -> container).
+                                                         # (external ports allocated by docker)
+RIC_SIM_INTERNAL_SECURE_PORT=8185                        # RIC Simulator container internal secure port (container -> container).
+                                                         # (external ports allocated by docker)
+RIC_SIM_CERT_MOUNT_DIR="./cert"
+
+RIC_SIM_COMPOSE_DIR="ric"                                # Dir in simulator group for docker compose
+RIC_SIM_ALIVE_URL="/"                                    # Base path for alive check
+
+SDNC_APP_NAME="a1controller"                             # Name of the SNDC A1 Controller container
+SDNC_DISPLAY_NAME="SDNC A1 Controller"
+SDNC_EXTERNAL_PORT=8282                                  # SNDC A1 Controller container external port (host -> container)
+SDNC_INTERNAL_PORT=8181                                  # SNDC A1 Controller container internal port (container -> container)
+SDNC_EXTERNAL_SECURE_PORT=8443                           # SNDC A1 Controller container external securee port (host -> container)
+SDNC_INTERNAL_SECURE_PORT=8443                           # SNDC A1 Controller container internal secure port (container -> container)
+SDNC_DB_APP_NAME="sdncdb"                                # Name of the SDNC DB container
+SDNC_A1_TRUSTSTORE_PASSWORD=""                           # SDNC truststore password
+SDNC_USER="admin"                                        # SDNC username
+SDNC_PWD="Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U"   # SNDC PWD
+SDNC_API_URL="/restconf/operations/A1-ADAPTER-API:"      # Base url path for SNDC API
+SDNC_ALIVE_URL="/apidoc/explorer/"                       # Base url path for SNDC API docs (for alive check)
+SDNC_COMPOSE_DIR="sdnc"                                  # Dir in simulator_group for docker-compose
+SDNC_KARAF_LOG="/opt/opendaylight/data/log/karaf.log"    # Path to karaf log
+
+RAPP_CAT_APP_NAME="rappcatalogueservice"                 # Name for the RAPP Catalogue
+RAPP_CAT_DISPLAY_NAME="RAPP Catalogue Service"
+RAPP_CAT_EXTERNAL_PORT=8680                              # RAPP Catalogue container external port (host -> container)
+RAPP_CAT_INTERNAL_PORT=8080                              # RAPP Catalogue container internal port (container -> container)
+RAPP_CAT_EXTERNAL_SECURE_PORT=8633                       # RAPP Catalogue container external secure port (host -> container)
+RAPP_CAT_INTERNAL_SECURE_PORT=8433                       # RAPP Catalogue container internal secure port (container -> container)
+RAPP_CAT_ALIVE_URL="/services"                           # Base path for alive check
+RAPP_CAT_COMPOSE_DIR="rapp_catalogue"                    # Dir in simulator_group for docker-compose
+
+CONTROL_PANEL_APP_NAME="controlpanel"                    # Name of the Control Panel container
+CONTROL_PANEL_DISPLAY_NAME="Non-RT RIC Control Panel"
+CONTROL_PANEL_EXTERNAL_PORT=8080                         # Control Panel container external port (host -> container)
+CONTROL_PANEL_INTERNAL_PORT=8080                         # Control Panel container internal port (container -> container)
+CONTROL_PANEL_EXTERNAL_SECURE_PORT=8880                  # Control Panel container external port (host -> container)
+CONTROL_PANEL_INTERNAL_SECURE_PORT=8082                  # Control Panel container internal port (container -> container)
+CONTROL_PANEL_LOGPATH="/logs/nonrtric-controlpanel.log"  # Path the application log in the Control Panel container
+CONTROL_PANEL_ALIVE_URL="/"                              # Base path for alive check
+CONTROL_PANEL_COMPOSE_DIR="control_panel"                # Dir in simulator_group for docker-compose
+CONTROL_PANEL_CONFIG_MOUNT_PATH=/maven                   # Container internal path for config
+CONTROL_PANEL_CONFIG_FILE=application.properties         # Config file name
+
+HTTP_PROXY_APP_NAME="httpproxy"                          # Name of the Http Proxy container
+HTTP_PROXY_DISPLAY_NAME="Http Proxy"
+HTTP_PROXY_EXTERNAL_PORT=8780                            # Http Proxy container external port (host -> container)
+HTTP_PROXY_INTERNAL_PORT=8080                            # Http Proxy container internal port (container -> container)
+HTTP_PROXY_WEB_EXTERNAL_PORT=8781                        # Http Proxy container external port (host -> container)
+HTTP_PROXY_WEB_INTERNAL_PORT=8081                        # Http Proxy container internal port (container -> container)
+HTTP_PROXY_CONFIG_PORT=0                                 # Port number for proxy config, will be set if proxy is started
+HTTP_PROXY_CONFIG_HOST_NAME=""                           # Proxy host, will be set if proxy is started
+HTTP_PROXY_ALIVE_URL="/"                                 # Base path for alive check
+HTTP_PROXY_COMPOSE_DIR="httpproxy"                       # Dir in simulator_group for docker-compose
+
+########################################
+# Setting for common curl-base function
+########################################
+
+UUID=""                                                   # UUID used as prefix to the policy id to simulate a real UUID
+                                                          # Testscript need to set the UUID otherwise this empty prefix is used
diff --git a/test/common/test_env-oran-dawn.sh b/test/common/test_env-oran-dawn.sh
new file mode 100755 (executable)
index 0000000..8943ffd
--- /dev/null
@@ -0,0 +1,359 @@
+#!/bin/bash
+
+#  ============LICENSE_START===============================================
+#  Copyright (C) 2020 Nordix Foundation. 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=================================================
+#
+#Profile for ORAN Cherry
+TEST_ENV_PROFILE="ORAN-DAWN"
+FLAVOUR="ORAN"
+
+########################################
+## Nexus repo settings
+########################################
+
+# Nexus repos for developed images
+NEXUS_PROXY_REPO="nexus3.o-ran-sc.org:10001/"
+NEXUS_RELEASE_REPO="nexus3.o-ran-sc.org:10002/"
+NEXUS_SNAPSHOT_REPO="nexus3.o-ran-sc.org:10003/"
+NEXUS_STAGING_REPO="nexus3.o-ran-sc.org:10004/"
+
+# Nexus repos for images used by test (not developed by the project)
+NEXUS_RELEASE_REPO_ONAP="nexus3.onap.org:10002/"  # Only for released ONAP images
+NEXUS_RELEASE_REPO_ORAN=$NEXUS_RELEASE_REPO
+
+########################################
+# Set up of image and tags for the test.
+########################################
+
+# NOTE: One environment variable containing the image name and tag is create by the test script
+# for each image from the env variables below.
+# The variable is created by removing the suffix "_BASE" from the base image variable name.
+# Example: POLICY_AGENT_IMAGE_BASE -> POLICY_AGENT_IMAGE
+# This var will point to the local or remote image depending on cmd line arguments.
+# In addition, the repo and the image tag version are selected from the list of image tags based on the cmd line argurment.
+# For images built by the script, only tag #1 shall be specified
+# For project images, only tag #1, #2, #3 and #4 shall be specified
+# For ORAN images (non project), only tag #5 shall be specified
+# For ONAP images (non project), only tag #6 shall be specified
+# For all other images, only tag #7 shall be specified
+# 1 XXX_LOCAL: local images: <image-name>:<local-tag>
+# 2 XXX_REMOTE_SNAPSHOT: snapshot images: <snapshot-nexus-repo><image-name>:<snapshot-tag>
+# 3 XXX_REMOTE: staging images: <staging-nexus-repo><image-name>:<staging-tag>
+# 4 XXX_REMOTE_RELEASE: release images: <release-nexus-repo><image-name>:<release-tag>
+# 5 XXX_REMOTE_RELEASE_ORAN: ORAN release images: <oran-release-nexus-repo><image-name>:<release-tag>
+# 6 XXX_REMOTE_RELEASE_ONAP: ONAP release images: <onap-release-nexus-repo><image-name>:<release-tag>
+# 7 XXX_PROXY: other images, not produced by the project: <proxy-nexus-repo><mage-name>:<proxy-tag>
+
+
+# Policy Agent base image and tags
+POLICY_AGENT_IMAGE_BASE="o-ran-sc/nonrtric-policy-agent"
+POLICY_AGENT_IMAGE_TAG_LOCAL="2.2.0-SNAPSHOT"
+POLICY_AGENT_IMAGE_TAG_REMOTE_SNAPSHOT="2.2.0-SNAPSHOT"
+POLICY_AGENT_IMAGE_TAG_REMOTE="2.2.0"
+POLICY_AGENT_IMAGE_TAG_REMOTE_RELEASE="2.2.0"
+
+# ECS image and tags
+ECS_IMAGE_BASE="o-ran-sc/nonrtric-enrichment-coordinator-service"
+ECS_IMAGE_TAG_LOCAL="1.1.0-SNAPSHOT"
+ECS_IMAGE_TAG_REMOTE_SNAPSHOT="1.1.0-SNAPSHOT"
+ECS_IMAGE_TAG_REMOTE="1.1.0"
+ECS_IMAGE_TAG_REMOTE_RELEASE="1.1.0"
+
+
+# Control Panel image and tags
+CONTROL_PANEL_IMAGE_BASE="o-ran-sc/nonrtric-controlpanel"
+CONTROL_PANEL_IMAGE_TAG_LOCAL="2.2.0-SNAPSHOT"
+CONTROL_PANEL_IMAGE_TAG_REMOTE_SNAPSHOT="2.2.0-SNAPSHOT"
+CONTROL_PANEL_IMAGE_TAG_REMOTE="2.2.0"
+CONTROL_PANEL_IMAGE_TAG_REMOTE_RELEASE="2.2.0"
+
+
+# SDNC A1 Controller image and tags - still using cherry version, no new version for dawn
+SDNC_A1_CONTROLLER_IMAGE_BASE="o-ran-sc/nonrtric-a1-controller"
+SDNC_A1_CONTROLLER_IMAGE_TAG_LOCAL="2.0.1-SNAPSHOT"
+SDNC_A1_CONTROLLER_IMAGE_TAG_REMOTE_SNAPSHOT="2.0.1-SNAPSHOT"
+SDNC_A1_CONTROLLER_IMAGE_TAG_REMOTE="2.0.1"
+SDNC_A1_CONTROLLER_IMAGE_TAG_REMOTE_RELEASE="2.0.1"
+
+# SDNC A1 Controller image and tags - intended versions for dawn - not yet present
+# SDNC_A1_CONTROLLER_IMAGE_BASE="o-ran-sc/nonrtric-a1-controller"
+# SDNC_A1_CONTROLLER_IMAGE_TAG_LOCAL="2.1.0-SNAPSHOT"
+# SDNC_A1_CONTROLLER_IMAGE_TAG_REMOTE_SNAPSHOT="2.1.0-SNAPSHOT"
+# SDNC_A1_CONTROLLER_IMAGE_TAG_REMOTE="2.1.0"
+# SDNC_A1_CONTROLLER_IMAGE_TAG_REMOTE_RELEASE="2.1.0"
+
+
+#SDNC DB remote image and tag
+SDNC_DB_IMAGE_BASE="mysql/mysql-server"
+SDNC_DB_IMAGE_TAG_REMOTE_PROXY="5.6"
+#No local image for SSDNC DB, remote image always used
+
+
+# RAPP Catalogue image and tags
+RAPP_CAT_IMAGE_BASE="o-ran-sc/nonrtric-r-app-catalogue"
+RAPP_CAT_IMAGE_TAG_LOCAL="1.1.0-SNAPSHOT"
+RAPP_CAT_IMAGE_TAG_REMOTE_SNAPSHOT="1.1.0-SNAPSHOT"
+RAPP_CAT_IMAGE_TAG_REMOTE="1.1.0"
+RAPP_CAT_IMAGE_TAG_REMOTE_RELEASE="1.1.0"
+
+
+# Near RT RIC Simulator image and tags - same version as cherry
+RIC_SIM_IMAGE_BASE="o-ran-sc/a1-simulator"
+RIC_SIM_IMAGE_TAG_LOCAL="latest"
+RIC_SIM_IMAGE_TAG_REMOTE_SNAPSHOT="2.1.0-SNAPSHOT"
+RIC_SIM_IMAGE_TAG_REMOTE="2.1.0"
+RIC_SIM_IMAGE_TAG_REMOTE_RELEASE="2.1.0"
+
+
+#Consul remote image and tag
+CONSUL_IMAGE_BASE="consul"
+CONSUL_IMAGE_TAG_REMOTE_PROXY="1.7.2"
+#No local image for Consul, remote image always used
+
+
+#CBS remote image and tag
+CBS_IMAGE_BASE="onap/org.onap.dcaegen2.platform.configbinding.app-app"
+CBS_IMAGE_TAG_REMOTE_RELEASE_ONAP="2.3.0"
+#No local image for CBS, remote image always used
+
+
+#MR stub image and tag
+MRSTUB_IMAGE_BASE="mrstub"
+MRSTUB_IMAGE_TAG_LOCAL="latest"
+#No remote image for MR stub, local image always used
+
+
+#Callback receiver image and tag
+CR_IMAGE_BASE="callback-receiver"
+CR_IMAGE_TAG_LOCAL="latest"
+#No remote image for CR, local image always used
+
+
+#Producer stub image and tag
+PROD_STUB_IMAGE_BASE="producer-stub"
+PROD_STUB_IMAGE_TAG_LOCAL="latest"
+#No remote image for producer stub, local image always used
+
+#Http proxy remote image and tag
+HTTP_PROXY_IMAGE_BASE="mitmproxy/mitmproxy"
+HTTP_PROXY_IMAGE_TAG_REMOTE_PROXY="6.0.2"
+#No local image for SSDNC DB, remote image always used
+
+#ONAP Zookeeper remote image and tag
+ONAP_ZOOKEEPER_IMAGE_BASE="onap/dmaap/zookeeper"
+ONAP_ZOOKEEPER_IMAGE_TAG_REMOTE_RELEASE_ONAP="6.0.3"
+#No local image for ONAP Zookeeper, remote image always used
+
+#ONAP Kafka remote image and tag
+ONAP_KAFKA_IMAGE_BASE="onap/dmaap/kafka111"
+ONAP_KAFKA_IMAGE_TAG_REMOTE_RELEASE_ONAP="1.0.4"
+#No local image for ONAP Kafka, remote image always used
+
+#ONAP DMAAP-MR remote image and tag
+ONAP_DMAAPMR_IMAGE_BASE="onap/dmaap/dmaap-mr"
+ONAP_DMAAPMR_IMAGE_TAG_REMOTE_RELEASE_ONAP="1.1.18"
+#No local image for ONAP DMAAP-MR, remote image always used
+
+# List of app short names produced by the project
+PROJECT_IMAGES_APP_NAMES="PA ECS CP SDNC RC RICSIM"
+
+# List of app short names which images pulled from ORAN
+ORAN_IMAGES_APP_NAMES=""  # Not used
+
+# List of app short names which images pulled from ONAP
+ONAP_IMAGES_APP_NAMES="CBS DMAAPMR"
+
+
+########################################
+# Detailed settings per app
+########################################
+
+DOCKER_SIM_NWNAME="nonrtric-docker-net"                  # Name of docker private network
+
+KUBE_NONRTRIC_NAMESPACE="nonrtric"                       # Namespace for all nonrtric components
+KUBE_SIM_NAMESPACE="nonrtric-ft"                         # Namespace for simulators (except MR and RICSIM)
+KUBE_ONAP_NAMESPACE="onap"                               # Namespace for onap (only message router)
+
+POLICY_AGENT_EXTERNAL_PORT=8081                          # Policy Agent container external port (host -> container)
+POLICY_AGENT_INTERNAL_PORT=8081                          # Policy Agent container internal port (container -> container)
+POLICY_AGENT_EXTERNAL_SECURE_PORT=8433                   # Policy Agent container external secure port (host -> container)
+POLICY_AGENT_INTERNAL_SECURE_PORT=8433                   # Policy Agent container internal secure port (container -> container)
+POLICY_AGENT_APIS="V1 V2"                                # Supported northbound api versions
+PMS_VERSION="V2"                                         # Tested version of northbound API
+PMS_API_PREFIX=""                                        # api url prefix, only for V2
+
+POLICY_AGENT_APP_NAME="policymanagementservice"          # Name for Policy Agent container
+POLICY_AGENT_DISPLAY_NAME="Policy Management Service"
+POLICY_AGENT_HOST_MNT_DIR="./mnt"                        # Mounted dir, relative to compose file, on the host
+POLICY_AGENT_LOGPATH="/var/log/policy-agent/application.log" # Path the application log in the Policy Agent container
+POLICY_AGENT_APP_NAME_ALIAS="policy-agent-container"     # Alias name, name used by the control panel
+POLICY_AGENT_CONFIG_KEY="policy-agent"                   # Key for consul config
+POLICY_AGENT_PKG_NAME="org.oransc.policyagent"           # Java base package name
+POLICY_AGENT_ACTUATOR="/actuator/loggers/$POLICY_AGENT_PKG_NAME" # Url for trace/debug
+POLICY_AGENT_ALIVE_URL=$PMS_API_PREFIX"/v2/status"       # Base path for alive check
+POLICY_AGENT_COMPOSE_DIR="policy_agent"                  # Dir in simulator_group for docker-compose
+POLICY_AGENT_CONFIG_MOUNT_PATH="/opt/app/policy-agent/config" # Path in container for config file
+POLICY_AGENT_DATA_MOUNT_PATH="/opt/app/policy-agent/data" # Path in container for data file
+POLICY_AGENT_CONFIG_FILE="application.yaml"              # Container config file name
+POLICY_AGENT_DATA_FILE="application_configuration.json"  # Container data file name
+
+ECS_APP_NAME="enrichmentservice"                         # Name for ECS container
+ECS_DISPLAY_NAME="Enrichment Coordinator Service"        # Display name for ECS container
+ECS_EXTERNAL_PORT=8083                                   # ECS container external port (host -> container)
+ECS_INTERNAL_PORT=8083                                   # ECS container internal port (container -> container)
+ECS_EXTERNAL_SECURE_PORT=8434                            # ECS container external secure port (host -> container)
+ECS_INTERNAL_SECURE_PORT=8434                            # ECS container internal secure port (container -> container)
+
+ECS_LOGPATH="/var/log/enrichment-coordinator-service/application.log" # Path the application log in the ECS container
+ECS_APP_NAME_ALIAS="enrichment-service-container"        # Alias name, name used by the control panel
+ECS_HOST_MNT_DIR="./mnt/db"                              # Mounted dir, relative to compose file, on the host
+ECS_CONTAINER_MNT_DIR="/var/enrichment-coordinator-service" # Mounted dir in the container
+ECS_ACTUATOR="/actuator/loggers/org.oransc.enrichment"   # Url for trace/debug
+ECS_CERT_MOUNT_DIR="./cert"
+ECS_ALIVE_URL="/status"                                  # Base path for alive check
+ECS_COMPOSE_DIR="ecs"                                    # Dir in simulator_group for docker-compose
+ECS_CONFIG_MOUNT_PATH=/opt/app/enrichment-coordinator-service/config # Internal container path for configuration
+ECS_CONFIG_FILE=application.yaml                         # Config file name
+ECS_VERSION="V1-2"                                       # Version where the types are decoupled from the producer registration
+
+MR_DMAAP_APP_NAME="dmaap-mr"                             # Name for the Dmaap MR
+MR_STUB_APP_NAME="mr-stub"                               # Name of the MR stub
+MR_DMAAP_DISPLAY_NAME="DMAAP Message Router"
+MR_STUB_DISPLAY_NAME="Message Router stub"
+MR_STUB_CERT_MOUNT_DIR="./cert"
+MR_EXTERNAL_PORT=3904                                    # MR dmaap/stub container external port
+MR_INTERNAL_PORT=3904                                    # MR dmaap/stub container internal port
+MR_EXTERNAL_SECURE_PORT=3905                             # MR dmaap/stub container external secure port
+MR_INTERNAL_SECURE_PORT=3905                             # MR dmaap/stub container internal secure port
+MR_DMAAP_LOCALHOST_PORT=3904                             # MR stub container external port (host -> container)
+MR_STUB_LOCALHOST_PORT=3908                              # MR stub container external port (host -> container)
+MR_DMAAP_LOCALHOST_SECURE_PORT=3905                      # MR stub container internal port (container -> container)
+MR_STUB_LOCALHOST_SECURE_PORT=3909                       # MR stub container external secure port (host -> container)
+MR_READ_URL="/events/A1-POLICY-AGENT-READ/users/policy-agent?timeout=15000&limit=100" # Path to read messages from MR
+MR_WRITE_URL="/events/A1-POLICY-AGENT-WRITE"             # Path write messages to MR
+MR_READ_TOPIC="A1-POLICY-AGENT-READ"                     # Read topic
+MR_WRITE_TOPIC="A1-POLICY-AGENT-WRITE"                   # Write topic
+MR_STUB_ALIVE_URL="/"                                    # Base path for mr stub alive check
+MR_DMAAP_ALIVE_URL="/topics"                             # Base path for dmaap-mr alive check
+MR_DMAAP_COMPOSE_DIR="dmaapmr"                           # Dir in simulator_group for dmaap mr for - docker-compose
+MR_STUB_COMPOSE_DIR="mrstub"                             # Dir in simulator_group for mr stub for - docker-compose
+MR_KAFKA_APP_NAME="kafka"                                # Kafka app name
+MR_ZOOKEEPER_APP_NAME="zookeeper"                        # Zookeeper app name
+
+
+CR_APP_NAME="callback-receiver"                          # Name for the Callback receiver
+CR_DISPLAY_NAME="RAPP Catalogue"
+CR_EXTERNAL_PORT=8090                                    # Callback receiver container external port (host -> container)
+CR_INTERNAL_PORT=8090                                    # Callback receiver container internal port (container -> container)
+CR_EXTERNAL_SECURE_PORT=8091                             # Callback receiver container external secure port (host -> container)
+CR_INTERNAL_SECURE_PORT=8091                             # Callback receiver container internal secure port (container -> container)
+CR_APP_CALLBACK="/callbacks"                             # Url for callbacks
+CR_ALIVE_URL="/"                                         # Base path for alive check
+CR_COMPOSE_DIR="cr"                                      # Dir in simulator_group for docker-compose
+
+PROD_STUB_APP_NAME="producer-stub"                       # Name for the Producer stub
+PROD_STUB_DISPLAY_NAME="Producer Stub"
+PROD_STUB_EXTERNAL_PORT=8092                             # Producer stub container external port (host -> container)
+PROD_STUB_INTERNAL_PORT=8092                             # Producer stub container internal port (container -> container)
+PROD_STUB_EXTERNAL_SECURE_PORT=8093                      # Producer stub container external secure port (host -> container)
+PROD_STUB_INTERNAL_SECURE_PORT=8093                      # Producer stub container internal secure port (container -> container)
+PROD_STUB_JOB_CALLBACK="/callbacks/job"                  # Callback path for job create/update/delete
+PROD_STUB_SUPERVISION_CALLBACK="/callbacks/supervision"  # Callback path for producre supervision
+PROD_STUB_ALIVE_URL="/"                                  # Base path for alive check
+PROD_STUB_COMPOSE_DIR="prodstub"                         # Dir in simulator_group for docker-compose
+
+CONSUL_HOST="consul-server"                              # Host name of consul
+CONSUL_DISPLAY_NAME="Consul"
+CONSUL_EXTERNAL_PORT=8500                                # Consul container external port (host -> container)
+CONSUL_INTERNAL_PORT=8500                                # Consul container internal port (container -> container)
+CONSUL_APP_NAME="polman-consul"                          # Name for consul container
+CONSUL_ALIVE_URL="/ui/dc1/kv"                            # Base path for alive check
+CONSUL_CBS_COMPOSE_DIR="consul_cbs"                      # Dir in simulator group for docker compose
+
+CBS_APP_NAME="polman-cbs"                                # Name for CBS container
+CBS_DISPLAY_NAME="Config Binding Service"
+CBS_EXTERNAL_PORT=10000                                  # CBS container external port (host -> container)
+CBS_INTERNAL_PORT=10000                                  # CBS container internal port (container -> container)
+CONFIG_BINDING_SERVICE="config-binding-service"          # Host name of CBS
+CBS_ALIVE_URL="/healthcheck"                             # Base path for alive check
+
+RIC_SIM_DISPLAY_NAME="Near-RT RIC A1 Simulator"
+RIC_SIM_BASE="g"                                         # Base name of the RIC Simulator container, shall be the group code
+                                                         # Note, a prefix is added to each container name by the .env file in the 'ric' dir
+RIC_SIM_PREFIX="ricsim"                                  # Prefix added to ric container name, added in the .env file in the 'ric' dir
+                                                         # This prefix can be changed from the command line
+RIC_SIM_INTERNAL_PORT=8085                               # RIC Simulator container internal port (container -> container).
+                                                         # (external ports allocated by docker)
+RIC_SIM_INTERNAL_SECURE_PORT=8185                        # RIC Simulator container internal secure port (container -> container).
+                                                         # (external ports allocated by docker)
+RIC_SIM_CERT_MOUNT_DIR="./cert"
+
+RIC_SIM_COMPOSE_DIR="ric"                                # Dir in simulator group for docker compose
+RIC_SIM_ALIVE_URL="/"                                    # Base path for alive check
+
+SDNC_APP_NAME="a1controller"                             # Name of the SNDC A1 Controller container
+SDNC_DISPLAY_NAME="SDNC A1 Controller"
+SDNC_EXTERNAL_PORT=8282                                  # SNDC A1 Controller container external port (host -> container)
+SDNC_INTERNAL_PORT=8181                                  # SNDC A1 Controller container internal port (container -> container)
+SDNC_EXTERNAL_SECURE_PORT=8443                           # SNDC A1 Controller container external securee port (host -> container)
+SDNC_INTERNAL_SECURE_PORT=8443                           # SNDC A1 Controller container internal secure port (container -> container)
+SDNC_DB_APP_NAME="sdncdb"                                # Name of the SDNC DB container
+SDNC_A1_TRUSTSTORE_PASSWORD=""                           # SDNC truststore password
+SDNC_USER="admin"                                        # SDNC username
+SDNC_PWD="Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U"   # SNDC PWD
+SDNC_API_URL="/restconf/operations/A1-ADAPTER-API:"      # Base url path for SNDC API
+SDNC_ALIVE_URL="/apidoc/explorer/"                       # Base url path for SNDC API docs (for alive check)
+SDNC_COMPOSE_DIR="sdnc"                                  # Dir in simulator_group for docker-compose
+SDNC_KARAF_LOG="/opt/opendaylight/data/log/karaf.log"    # Path to karaf log
+
+RAPP_CAT_APP_NAME="rappcatalogueservice"                 # Name for the RAPP Catalogue
+RAPP_CAT_DISPLAY_NAME="RAPP Catalogue"
+RAPP_CAT_EXTERNAL_PORT=8680                              # RAPP Catalogue container external port (host -> container)
+RAPP_CAT_INTERNAL_PORT=8080                              # RAPP Catalogue container internal port (container -> container)
+RAPP_CAT_EXTERNAL_SECURE_PORT=8633                       # RAPP Catalogue container external secure port (host -> container)
+RAPP_CAT_INTERNAL_SECURE_PORT=8433                       # RAPP Catalogue container internal secure port (container -> container)
+RAPP_CAT_ALIVE_URL="/services"                           # Base path for alive check
+RAPP_CAT_COMPOSE_DIR="rapp_catalogue"                    # Dir in simulator_group for docker-compose
+
+CONTROL_PANEL_APP_NAME="controlpanel"                    # Name of the Control Panel container
+CONTROL_PANEL_DISPLAY_NAME="Control Panel"
+CONTROL_PANEL_EXTERNAL_PORT=8080                         # Control Panel container external port (host -> container)
+CONTROL_PANEL_INTERNAL_PORT=8080                         # Control Panel container internal port (container -> container)
+CONTROL_PANEL_EXTERNAL_SECURE_PORT=8880                  # Control Panel container external port (host -> container)
+CONTROL_PANEL_INTERNAL_SECURE_PORT=8082                  # Control Panel container internal port (container -> container)
+CONTROL_PANEL_LOGPATH="/logs/nonrtric-controlpanel.log"  # Path the application log in the Control Panel container
+CONTROL_PANEL_ALIVE_URL="/"                              # Base path for alive check
+CONTROL_PANEL_COMPOSE_DIR="control_panel"                # Dir in simulator_group for docker-compose
+CONTROL_PANEL_CONFIG_MOUNT_PATH=/maven                   # Container internal path for config
+CONTROL_PANEL_CONFIG_FILE=application.properties         # Config file name
+
+HTTP_PROXY_APP_NAME="httpproxy"                          # Name of the Http Proxy container
+HTTP_PROXY_DISPLAY_NAME="Http Proxy"
+HTTP_PROXY_EXTERNAL_PORT=8780                            # Http Proxy container external port (host -> container)
+HTTP_PROXY_INTERNAL_PORT=8080                            # Http Proxy container internal port (container -> container)
+HTTP_PROXY_WEB_EXTERNAL_PORT=8781                        # Http Proxy container external port (host -> container)
+HTTP_PROXY_WEB_INTERNAL_PORT=8081                        # Http Proxy container internal port (container -> container)
+HTTP_PROXY_CONFIG_PORT=0                                 # Port number for proxy config, will be set if proxy is started
+HTTP_PROXY_CONFIG_HOST_NAME=""                           # Proxy host, will be set if proxy is started
+HTTP_PROXY_ALIVE_URL="/"                                 # Base path for alive check
+HTTP_PROXY_COMPOSE_DIR="httpproxy"                       # Dir in simulator_group for docker-compose
+
+########################################
+# Setting for common curl-base function
+########################################
+
+UUID=""                                                   # UUID used as prefix to the policy id to simulate a real UUID
+                                                          # Testscript need to set the UUID otherwise this empty prefix is used
diff --git a/test/common/test_env.sh b/test/common/test_env.sh
deleted file mode 100644 (file)
index a8e618f..0000000
+++ /dev/null
@@ -1,189 +0,0 @@
-#!/bin/bash
-
-#  ============LICENSE_START===============================================
-#  Copyright (C) 2020 Nordix Foundation. 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=================================================
-#
-
-# Set up the image and tags for the test. Do not add the image tag to the image names.
-
-# NOTE: A env var for each container is created by the test script.
-# This var will point to the local or remote var depending on how
-# the test script is started. The name format is <container-name>_IMAGE, ie with 'LOCAL' or 'REMOTE'.
-
-# Local Policy Agent image and tag
-POLICY_AGENT_LOCAL_IMAGE="o-ran-sc/nonrtric-policy-agent"
-POLICY_AGENT_LOCAL_IMAGE_TAG="2.2.0-SNAPSHOT"
-# Remote Policy Agent image and tag
-POLICY_AGENT_REMOTE_IMAGE="nexus3.o-ran-sc.org:10004/o-ran-sc/nonrtric-policy-agent"
-POLICY_AGENT_REMOTE_IMAGE_TAG="2.2.0"
-
-# Local ECS image and tag
-ECS_LOCAL_IMAGE="o-ran-sc/nonrtric-enrichment-coordinator-service"
-ECS_LOCAL_IMAGE_TAG="1.1.0-SNAPSHOT"
-# Remote ECS image and tag
-ECS_REMOTE_IMAGE="nexus3.o-ran-sc.org:10003/o-ran-sc/nonrtric-enrichment-coordinator-service"
-ECS_REMOTE_IMAGE_TAG="1.1.0-SNAPSHOT"
-
-# Control Panel local image and tag
-CONTROL_PANEL_LOCAL_IMAGE="o-ran-sc/nonrtric-controlpanel"
-CONTROL_PANEL_LOCAL_IMAGE_TAG="2.2.0-SNAPSHOT"
-# Control Panel remote image and tag
-CONTROL_PANEL_REMOTE_IMAGE="nexus3.o-ran-sc.org:10004/o-ran-sc/nonrtric-controlpanel"
-CONTROL_PANEL_REMOTE_IMAGE_TAG="2.2.0"
-
-
-# SDNC A1 Controller local image and tag
-SDNC_A1_CONTROLLER_LOCAL_IMAGE="o-ran-sc/nonrtric-a1-controller"
-SDNC_A1_CONTROLLER_LOCAL_IMAGE_TAG="2.1.0-SNAPSHOT"
-# SDNC A1 Controller remote image and tag
-SDNC_A1_CONTROLLER_REMOTE_IMAGE="nexus3.o-ran-sc.org:10004/o-ran-sc/nonrtric-a1-controller"
-SDNC_A1_CONTROLLER_REMOTE_IMAGE_TAG="2.1.0"
-
-
-#SDNC DB remote image and tag
-SDNC_DB_REMOTE_IMAGE="mysql/mysql-server"
-SDNC_DB_REMOTE_IMAGE_TAG="5.6"
-#No local image for DB, remote image always used
-
-
-# Near RT RIC Simulator local image and tag
-RIC_SIM_LOCAL_IMAGE="nexus3.o-ran-sc.org:10004/o-ran-sc/a1-simulator"
-RIC_SIM_LOCAL_IMAGE_TAG="latest"
-# Near RT RIC Simulator remote image and tag
-RIC_SIM_REMOTE_IMAGE="nexus3.o-ran-sc.org:10004/o-ran-sc/a1-simulator"
-RIC_SIM_REMOTE_IMAGE_TAG="2.0.0"
-
-
-#Consul remote image and tag
-CONSUL_REMOTE_IMAGE="consul"
-CONSUL_REMOTE_IMAGE_TAG="1.7.2"
-#No local image for Consul, remote image always used
-
-
-#CBS remote image and tag
-CBS_REMOTE_IMAGE="nexus3.onap.org:10001/onap/org.onap.dcaegen2.platform.configbinding.app-app"
-CBS_REMOTE_IMAGE_TAG="2.3.0"
-#No local image for CBS, remote image always used
-
-
-#MR stub image and tag
-MRSTUB_LOCAL_IMAGE="mrstub"
-MRSTUB_LOCAL_IMAGE_TAG="latest"
-#No remote image for MR stub, local image always used
-
-#Callback receiver image and tag
-CR_LOCAL_IMAGE="callback-receiver"
-CR_LOCAL_IMAGE_TAG="latest"
-#No remote image for CR, local image always used
-
-#Producer stub image and tag
-PROD_STUB_LOCAL_IMAGE="producer-stub"
-PROD_STUB_LOCAL_IMAGE_TAG="latest"
-#No remote image for producer stub, local image always used
-
-# Common env var for auto-test. Vars used by docker-compose need to be exported
-export DOCKER_SIM_NWNAME="nonrtric-docker-net"                  # Name of docker private network
-
-export POLICY_AGENT_EXTERNAL_PORT=8081                          # Policy Agent container external port (host -> container)
-export POLICY_AGENT_INTERNAL_PORT=8081                          # Policy Agent container internal port (container -> container)
-export POLICY_AGENT_EXTERNAL_SECURE_PORT=8433                   # Policy Agent container external secure port (host -> container)
-export POLICY_AGENT_INTERNAL_SECURE_PORT=8433                   # Policy Agent container internal secure port (container -> container)
-
-export POLICY_AGENT_APP_NAME="policy-agent"                     # Name for Policy Agent container
-POLICY_AGENT_LOGPATH="/var/log/policy-agent/application.log"    # Path the application log in the Policy Agent container
-export POLICY_AGENT_APP_NAME_ALIAS="policy-agent-container"     # Alias name, name used by the control panel
-
-export ECS_EXTERNAL_PORT=8083                                   # ECS container external port (host -> container)
-export ECS_INTERNAL_PORT=8083                                   # ECS container internal port (container -> container)
-export ECS_EXTERNAL_SECURE_PORT=8434                            # ECS container external secure port (host -> container)
-export ECS_INTERNAL_SECURE_PORT=8434                            # ECS container internal secure port (container -> container)
-
-export ECS_APP_NAME="ecs"                                       # Name for ECS container
-ECS_LOGPATH="/var/log/enrichment-coordinator-service/application.log" # Path the application log in the ECS container
-export ECS_APP_NAME_ALIAS="enrichment-service-container"        # Alias name, name used by the control panel
-
-export MR_EXTERNAL_PORT=3905                                    # MR stub container external port (host -> container)
-export MR_INTERNAL_PORT=3905                                    # MR stub container internal port (container -> container)
-export MR_EXTERNAL_SECURE_PORT=3906                             # MR stub container external secure port (host -> container)
-export MR_INTERNAL_SECURE_PORT=3906                             # MR stub container internal secure port (container -> container)
-export MR_APP_NAME="message-router"                             # Name for the MR
-export MR_READ_URL="/events/A1-POLICY-AGENT-READ/users/policy-agent?timeout=15000&limit=100" # Path to read messages from MR
-export MR_WRITE_URL="/events/A1-POLICY-AGENT-WRITE"             # Path write messages to MR
-
-export CR_EXTERNAL_PORT=8090                                    # Callback receiver container external port (host -> container)
-export CR_INTERNAL_PORT=8090                                    # Callback receiver container internal port (container -> container)
-export CR_EXTERNAL_SECURE_PORT=8091                             # Callback receiver container external secure port (host -> container)
-export CR_INTERNAL_SECURE_PORT=8091                             # Callback receiver container internal secure port (container -> container)
-export CR_APP_NAME="callback-receiver"                          # Name for the Callback receiver
-
-export PROD_STUB_EXTERNAL_PORT=8092                             # Producer stub container external port (host -> container)
-export PROD_STUB_INTERNAL_PORT=8092                             # Producer stub container internal port (container -> container)
-export PROD_STUB_EXTERNAL_SECURE_PORT=8093                      # Producer stub container external secure port (host -> container)
-export PROD_STUB_INTERNAL_SECURE_PORT=8093                      # Producer stub container internal secure port (container -> container)
-export PROD_STUB_APP_NAME="producer-stub"                       # Name for the Producer stub
-
-export CONSUL_HOST="consul-server"                              # Host name of consul
-export CONSUL_EXTERNAL_PORT=8500                                # Consul container external port (host -> container)
-export CONSUL_INTERNAL_PORT=8500                                # Consul container internal port (container -> container)
-export CONSUL_APP_NAME="polman-consul"                          # Name for consul container
-
-export CBS_APP_NAME="polman-cbs"                                # Name for CBS container
-export CBS_EXTERNAL_PORT=10000                                  # CBS container external port (host -> container)
-export CBS_INTERNAL_PORT=10000                                  # CBS container internal port (container -> container)
-export CONFIG_BINDING_SERVICE="config-binding-service"          # Host name of CBS
-
-export RIC_SIM_BASE="g"                                         # Base name of the RIC Simulator container, shall be the group code
-                                                                # Note, a prefix is added to each container name by the .env file in the 'ric' dir
-RIC_SIM_PREFIX="ricsim"                                         # Prefix added to ric container name, added in the .env file in the 'ric' dir
-                                                                # This prefix can be changed from the command line
-export RIC_SIM_INTERNAL_PORT=8085                               # RIC Simulator container internal port (container -> container).
-                                                                # (external ports allocated by docker)
-export RIC_SIM_INTERNAL_SECURE_PORT=8185                        # RIC Simulator container internal secure port (container -> container).
-                                                                # (external ports allocated by docker)
-
-export SDNC_APP_NAME="a1-controller"                            # Name of the SNDC A1 Controller container
-export SDNC_EXTERNAL_PORT=8282                                  # SNDC A1 Controller container external port (host -> container)
-export SDNC_INTERNAL_PORT=8181                                  # SNDC A1 Controller container internal port (container -> container)
-export SDNC_EXTERNAL_SECURE_PORT=8443                           # SNDC A1 Controller container external securee port (host -> container)
-export SDNC_INTERNAL_SECURE_PORT=8443                           # SNDC A1 Controller container internal secure port (container -> container)
-export SDNC_DB_APP_NAME="sdnc-db"                               # Name of the SDNC DB container
-export SDNC_A1_TRUSTSTORE_PASSWORD=""                           # SDNC truststore password
-SDNC_USER="admin"                                               # SDNC username
-SDNC_PWD="Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U"          # SNDC PWD
-SDNC_API_URL="/restconf/operations/A1-ADAPTER-API:"             # Base url path for SNDC API
-SDNC_ALIVE_URL="/apidoc/explorer/"                              # Base url path for SNDC API docs (for alive check)
-SDNC_KARAF_LOG="/opt/opendaylight/data/log/karaf.log"           # Path to karaf log
-
-export CONTROL_PANEL_APP_NAME="control-panel"                   # Name of the Control Panel container
-export CONTROL_PANEL_EXTERNAL_PORT=8080                         # Control Panel container external port (host -> container)
-export CONTROL_PANEL_INTERNAL_PORT=8080                         # Control Panel container external port (host -> container)
-CONTROL_PANEL_LOGPATH="/logs/nonrtric-controlpanel.log"         # Path the application log in the Control Panel container
-
-UUID=""                                                         # UUID used as prefix to the policy id to simulate a real UUID
-                                                                # Testscript need to set the UUID otherwise this empty prefix is used
-
-RESTBASE="http://localhost:"$POLICY_AGENT_EXTERNAL_PORT         # Base url to the Agent NB REST interface
-RESTBASE_SECURE="https://localhost:"$POLICY_AGENT_EXTERNAL_SECURE_PORT # Base url to the secure Agent NB REST interface
-DMAAPBASE="http://localhost:"$MR_EXTERNAL_PORT                  # Base url to the Dmaap adapter, http
-DMAAPBASE_SECURE="https://localhost:"$MR_EXTERNAL_SECURE_PORT   # Base url to the Dmaap adapter, https
-ADAPTER=$RESTBASE                                               # Adapter holds the address the agent R-APP interface (REST OR DMAAP)
-                                                                # The values of this var is swiched between the four base url when needed
-ECS_RESTBASE="http://localhost:"$ECS_EXTERNAL_PORT              # Base url to the ECS NB REST interface
-ECS_RESTBASE_SECURE="https://localhost:"$ECS_EXTERNAL_SECURE_PORT # Base url to the secure ECS NB REST interface
-ECS_DMAAPBASE="http://localhost:"$MR_EXTERNAL_PORT              # Base url to the Dmaap adapter, http
-ECS_DMAAPBASE_SECURE="https://localhost:"$MR_EXTERNAL_SECURE_PORT   # Base url to the Dmaap adapter, https
-ECS_ADAPTER=$ECS_RESTBASE                                       # Adapter holds the address the ECS R-APP interface (REST OR DMAAP)
-                                                                # The values of this var is swiched between the four base url when needed
index f2783f3..aee3af5 100755 (executable)
 #  ============LICENSE_END=================================================
 #
 
-# This is a script that contains all the functions needed for auto test
-# Arg: local|remote|remote-remove [auto-clean] [--stop-at-error] [--ricsim-prefix <prefix> ] [ --env-file <environment-filename> ] [--use-local-image <app-nam> [<app-name>]*]
+# This is a script that contains all the common functions needed for auto test.
+# Specific test function are defined in scripts  XXXX_functions.sh
 
+. ../common/api_curl.sh
+
+# List of short names for all supported apps, including simulators etc
+APP_SHORT_NAMES="PA RICSIM SDNC CP ECS RC CBS CONSUL RC MR DMAAPMR CR PRODSTUB"
+
+__print_args() {
+       echo "Args: remote|remote-remove docker|kube --env-file <environment-filename> [release] [auto-clean] [--stop-at-error] "
+       echo "      [--ricsim-prefix <prefix> ] [--use-local-image <app-nam>+]  [--use-snapshot-image <app-nam>+]"
+       echo "      [--use-staging-image <app-nam>+] [--use-release-image <app-nam>+]"
+}
+
+if [ $# -eq 1 ] && [ "$1" == "help" ]; then
+
+       if [ ! -z "$TC_ONELINE_DESCR" ]; then
+               echo "Test script description:"
+               echo $TC_ONELINE_DESCR
+               echo ""
+       fi
+       __print_args
+       echo ""
+       echo "remote                -  Use images from remote repositories. Can be overridden for individual images using the '--use_xxx' flags"
+       echo "remote-remove         -  Same as 'remote' but will also try to pull fresh images from remote repositories"
+       echo "docker                -  Test executed in docker environment"
+       echo "kube                  -  Test executed in kubernetes environment - requires an already started kubernetes environment"
+       echo "--env-file            -  The script will use the supplied file to read environment variables from"
+       echo "release               -  If this flag is given the script will use release version of the images"
+       echo "auto-clean            -  If the function 'auto_clean_containers' is present in the end of the test script then all containers will be stopped and removed. If 'auto-clean' is not given then the function has no effect."
+    echo "--stop-at-error       -  The script will stop when the first failed test or configuration"
+       echo "--ricsim-prefix       -  The a1 simulator will use the supplied string as container prefix instead of 'ricsim'"
+       echo "--use-local-image     -  The script will use local images for the supplied apps, space separated list of app short names"
+       echo "--use-snapshot-image  -  The script will use images from the nexus snapshot repo for the supplied apps, space separated list of app short names"
+       echo "--use-staging-image   -  The script will use images from the nexus staging repo for the supplied apps, space separated list of app short names"
+       echo "--use-release-image   -  The script will use images from the nexus release repo for the supplied apps, space separated list of app short names"
+       echo ""
+       echo "List of app short names supported: "$APP_SHORT_NAMES
+       exit 0
+fi
 
 # Create a test case id, ATC (Auto Test Case), from the name of the test case script.
 # FTC1.sh -> ATC == FTC1
@@ -40,23 +77,6 @@ YELLOW="\033[33m\033[1m"
 EYELLOW="\033[0m"
 SAMELINE="\033[0K\r"
 
-tmp=$(which python3)
-if [ $? -ne 0 ] || [ -z tmp ]; then
-       echo -e $RED"python3 is required to run the test environment, pls install"$ERED
-       exit 1
-fi
-tmp=$(which docker)
-if [ $? -ne 0 ] || [ -z tmp ]; then
-       echo -e $RED"docker is required to run the test environment, pls install"$ERED
-       exit 1
-fi
-
-tmp=$(which docker-compose)
-if [ $? -ne 0 ] || [ -z tmp ]; then
-       echo -e $RED"docker-compose is required to run the test environment, pls install"$ERED
-       exit 1
-fi
-
 # Just resetting any previous echo formatting...
 echo -ne $EBOLD
 
@@ -65,30 +85,37 @@ TEST_ENV_VAR_FILE=""
 
 echo "Test case started as: ${BASH_SOURCE[$i+1]} "$@
 
-#Localhost constant
-LOCALHOST="http://localhost:"
-
-# Make curl retries towards ECS for http response codes set in this env var, space separated list of codes
-ECS_RETRY_CODES=""
-
-# Make curl retries towards the agent for http response codes set in this env var, space separated list of codes
-AGENT_RETRY_CODES=""
-
-# Var to contol if the agent runs in a container (normal = 0) or as application on the local machine ( = 1)
-AGENT_STAND_ALONE=0
+#Localhost constants
+LOCALHOST_NAME="localhost"
+LOCALHOST_HTTP="http://localhost"
+LOCALHOST_HTTPS="https://localhost"
 
 # Var to hold 'auto' in case containers shall be stopped when test case ends
 AUTO_CLEAN=""
 
-# Var to hold the app names to use local image for when running 'remote' or 'remote-remove'
+# Var to hold the app names to use local images for
 USE_LOCAL_IMAGES=""
 
-# List of available apps to override with local image
-AVAILABLE_LOCAL_IMAGES_OVERRIDE="PA ECS CP SDNC RICSIM RC"
+# Var to hold the app names to use remote snapshot images for
+USE_SNAPSHOT_IMAGES=""
+
+# Var to hold the app names to use remote staging images for
+USE_STAGING_IMAGES=""
+
+# Var to hold the app names to use remote release images for
+USE_RELEASE_IMAGES=""
+
+# List of available apps to override with local or remote staging/snapshot/release image
+AVAILABLE_IMAGES_OVERRIDE="PA ECS CP SDNC RICSIM RC"
 
 # Use this var (STOP_AT_ERROR=1 in the test script) for debugging/trouble shooting to take all logs and exit at first FAIL test case
 STOP_AT_ERROR=0
 
+# The default value "DEV" indicate that development image tags (SNAPSHOT) and nexus repos (nexus port 10002) are used.
+# The value "RELEASE" indicate that relase image tag and nexus repos (nexus port) are used
+# Applies only to images defined in the test-env files with image names and tags defined as XXXX_RELEASE
+IMAGE_CATEGORY="DEV"
+
 # Function to indent cmd output with one space
 indent1() { sed 's/^/ /'; }
 
@@ -124,7 +151,6 @@ fi
 HTTPLOG=$PWD"/.httplog_"$ATC".txt"
 echo "" > $HTTPLOG
 
-
 # Create a log dir for the test case
 mkdir -p $TESTLOGS/$ATC
 
@@ -159,7 +185,6 @@ RES_DEVIATION=0
 DEVIATION_FILE=".tmp_deviations"
 rm $DEVIATION_FILE &> /dev/null
 
-
 # Trap "command not found" and make the script fail
 trap_fnc() {
 
@@ -265,19 +290,49 @@ echo "-----------------------------------      Test case setup      ------------
 
 START_ARG=$1
 paramerror=0
+paramerror_str=""
 if [ $# -lt 1 ]; then
        paramerror=1
 fi
 if [ $paramerror -eq 0 ]; then
-       if [ "$1" != "remote" ] && [ "$1" != "remote-remove" ] && [ "$1" != "local" ]; then
+       if [ "$1" != "remote" ] && [ "$1" != "remote-remove" ]; then
+               paramerror=1
+               if [ -z "$paramerror_str" ]; then
+                       paramerror_str="First arg shall be 'remote' or 'remote-remove'"
+               fi
+       else
+               shift;
+       fi
+fi
+if [ $paramerror -eq 0 ]; then
+       if [ "$1" != "docker" ] && [ "$1" != "kube" ]; then
                paramerror=1
+               if [ -z "$paramerror_str" ]; then
+                       paramerror_str="Second arg shall be 'docker' or 'kube'"
+               fi
        else
+               if [ $1 == "docker" ]; then
+                       RUNMODE="DOCKER"
+                       echo "Setting RUNMODE=DOCKER"
+               fi
+               if [ $1 == "kube" ]; then
+                       RUNMODE="KUBE"
+                       echo "Setting RUNMODE=KUBE"
+               fi
                shift;
        fi
 fi
 foundparm=0
 while [ $paramerror -eq 0 ] && [ $foundparm -eq 0 ]; do
        foundparm=1
+       if [ $paramerror -eq 0 ]; then
+               if [ "$1" == "release" ]; then
+                       IMAGE_CATEGORY="RELEASE"
+                       echo "Option set - Release image tags used for applicable images "
+                       shift;
+                       foundparm=0
+               fi
+       fi
        if [ $paramerror -eq 0 ]; then
                if [ "$1" == "auto-clean" ]; then
                        AUTO_CLEAN="auto"
@@ -297,9 +352,12 @@ while [ $paramerror -eq 0 ] && [ $foundparm -eq 0 ]; do
        if [ $paramerror -eq 0 ]; then
                if [ "$1" == "--ricsim-prefix" ]; then
                        shift;
-                       RIC_SIM_PREFIX=$1
+                       TMP_RIC_SIM_PREFIX=$1  #RIC_SIM_PREFIX need to be updated after sourcing of the env file
                        if [ -z "$1" ]; then
                                paramerror=1
+                               if [ -z "$paramerror_str" ]; then
+                                       paramerror_str="No prefix found for flag: '--ricsim-prefix'"
+                               fi
                        else
                                echo "Option set - Overriding RIC_SIM_PREFIX with: "$1
                                shift;
@@ -313,6 +371,9 @@ while [ $paramerror -eq 0 ] && [ $foundparm -eq 0 ]; do
                        TEST_ENV_VAR_FILE=$1
                        if [ -z "$1" ]; then
                                paramerror=1
+                               if [ -z "$paramerror_str" ]; then
+                                       paramerror_str="No env file found for flag: '--env-file'"
+                               fi
                        else
                                echo "Option set - Reading test env from: "$1
                                shift;
@@ -326,16 +387,97 @@ while [ $paramerror -eq 0 ] && [ $foundparm -eq 0 ]; do
                        shift
                        while [ $# -gt 0 ] && [[ "$1" != "--"* ]]; do
                                USE_LOCAL_IMAGES=$USE_LOCAL_IMAGES" "$1
-                               if [[ "$AVAILABLE_LOCAL_IMAGES_OVERRIDE" != *"$1"* ]]; then
+                               if [[ "$AVAILABLE_IMAGES_OVERRIDE" != *"$1"* ]]; then
                                        paramerror=1
+                                       if [ -z "$paramerror_str" ]; then
+                                               paramerror_str="App name $1 is not available for local override for flag: '--use-local-image'"
+                                       fi
                                fi
                                shift;
                        done
                        foundparm=0
                        if [ -z "$USE_LOCAL_IMAGES" ]; then
                                paramerror=1
+                               if [ -z "$paramerror_str" ]; then
+                                       paramerror_str="No app name found for flag: '--use-local-image'"
+                               fi
+                       else
+                               echo "Option set - Overriding with local images for app(s):"$USE_LOCAL_IMAGES
+                       fi
+               fi
+       fi
+       if [ $paramerror -eq 0 ]; then
+               if [ "$1" == "--use-snapshot-image" ]; then
+                       USE_SNAPSHOT_IMAGES=""
+                       shift
+                       while [ $# -gt 0 ] && [[ "$1" != "--"* ]]; do
+                               USE_SNAPSHOT_IMAGES=$USE_SNAPSHOT_IMAGES" "$1
+                               if [[ "$AVAILABLE_IMAGES_OVERRIDE" != *"$1"* ]]; then
+                                       paramerror=1
+                                       if [ -z "$paramerror_str" ]; then
+                                               paramerror_str="App name $1 is not available for snapshot override for flag: '--use-snapshot-image'"
+                                       fi
+                               fi
+                               shift;
+                       done
+                       foundparm=0
+                       if [ -z "$USE_SNAPSHOT_IMAGES" ]; then
+                               paramerror=1
+                               if [ -z "$paramerror_str" ]; then
+                                       paramerror_str="No app name found for flag: '--use-snapshot-image'"
+                               fi
+                       else
+                               echo "Option set - Overriding with snapshot images for app(s):"$USE_SNAPSHOT_IMAGES
+                       fi
+               fi
+       fi
+       if [ $paramerror -eq 0 ]; then
+               if [ "$1" == "--use-staging-image" ]; then
+                       USE_STAGING_IMAGES=""
+                       shift
+                       while [ $# -gt 0 ] && [[ "$1" != "--"* ]]; do
+                               USE_STAGING_IMAGES=$USE_STAGING_IMAGES" "$1
+                               if [[ "$AVAILABLE_IMAGES_OVERRIDE" != *"$1"* ]]; then
+                                       paramerror=1
+                                       if [ -z "$paramerror_str" ]; then
+                                               paramerror_str="App name $1 is not available for staging override for flag: '--use-staging-image'"
+                                       fi
+                               fi
+                               shift;
+                       done
+                       foundparm=0
+                       if [ -z "$USE_STAGING_IMAGES" ]; then
+                               paramerror=1
+                               if [ -z "$paramerror_str" ]; then
+                                       paramerror_str="No app name found for flag: '--use-staging-image'"
+                               fi
+                       else
+                               echo "Option set - Overriding with staging images for app(s):"$USE_STAGING_IMAGES
+                       fi
+               fi
+       fi
+       if [ $paramerror -eq 0 ]; then
+               if [ "$1" == "--use-release-image" ]; then
+                       USE_RELEASE_IMAGES=""
+                       shift
+                       while [ $# -gt 0 ] && [[ "$1" != "--"* ]]; do
+                               USE_RELEASE_IMAGES=$USE_RELEASE_IMAGES" "$1
+                               if [[ "$AVAILABLE_IMAGES_OVERRIDE" != *"$1"* ]]; then
+                                       paramerror=1
+                                       if [ -z "$paramerror_str" ]; then
+                                               paramerror_str="App name $1 is not available for release override for flag: '--use-release-image'"
+                                       fi
+                               fi
+                               shift;
+                       done
+                       foundparm=0
+                       if [ -z "$USE_RELEASE_IMAGES" ]; then
+                               paramerror=1
+                               if [ -z "$paramerror_str" ]; then
+                                       paramerror_str="No app name found for flag: '--use-release-image'"
+                               fi
                        else
-                               echo "Option set - Override remote images for app(s):"$USE_LOCAL_IMAGES
+                               echo "Option set - Overriding with release images for app(s):"$USE_RELEASE_IMAGES
                        fi
                fi
        fi
@@ -345,10 +487,14 @@ echo ""
 #Still params left?
 if [ $paramerror -eq 0 ] && [ $# -gt 0 ]; then
        paramerror=1
+       if [ -z "$paramerror_str" ]; then
+               paramerror_str="Unknown parameter(s): "$@
+       fi
 fi
 
 if [ $paramerror -eq 1 ]; then
-       echo -e $RED"Expected arg: local|remote|remote-remove [auto-clean] [--stop-at-error] [--ricsim-prefix <prefix> ] [ --env-file <environment-filename> ] [--use-local-image <app-nam> [<app-name>]*]"$ERED
+       echo -e $RED"Incorrect arg list: "$paramerror_str$ERED
+       __print_args
        exit 1
 fi
 
@@ -358,12 +504,18 @@ if [ -f "$TEST_ENV_VAR_FILE" ]; then
        . $TEST_ENV_VAR_FILE
 
        if [ -z "$TEST_ENV_PROFILE" ] || [ -z "$SUPPORTED_PROFILES" ]; then
-               echo -e $YELLOW"This test case may no work with selected test env file. TEST_ENV_PROFILE is missing in test_env file or SUPPORTED_PROFILES is missing in test case file"$EYELLOW
+               echo -e $YELLOW"This test case may not work with selected test env file. TEST_ENV_PROFILE is missing in test_env file or SUPPORTED_PROFILES is missing in test case file"$EYELLOW
        else
-               if [[ "$SUPPORTED_PROFILES" == *"$TEST_ENV_PROFILE"* ]]; then
-                       echo -e $GREEN"Test case support the selected test env file"$EGREEN
-               else
+               found_profile=0
+               for prof in $SUPPORTED_PROFILES; do
+                       if [ "$TEST_ENV_PROFILE" == "$prof" ]; then
+                               echo -e $GREEN"Test case supports the selected test env file"$EGREEN
+                               found_profile=1
+                       fi
+               done
+               if [ $found_profile -ne 1 ]; then
                        echo -e $RED"Test case does not support the selected test env file"$ERED
+                       echo "Profile: "$TEST_ENV_PROFILE"     Supported profiles: "$SUPPORTED_PROFILES
                        echo -e $RED"Exiting...."$ERED
                        exit 1
                fi
@@ -376,45 +528,56 @@ else
        exit 1
 fi
 
-#Vars for A1 interface version and container count
-G1_A1_VERSION=""
-G2_A1_VERSION=""
-G3_A1_VERSION=""
-G4_A1_VERSION=""
-G5_A1_VERSION=""
-G1_COUNT=0
-G2_COUNT=0
-G3_COUNT=0
-G4_COUNT=0
-G5_COUNT=0
-
-# Vars to switch between http and https. Extra curl flag needed for https
-export RIC_SIM_HTTPX="http"
-export RIC_SIM_LOCALHOST=$RIC_SIM_HTTPX"://localhost:"
-export RIC_SIM_PORT=$RIC_SIM_INTERNAL_PORT
-export RIC_SIM_CERT_MOUNT_DIR="./cert"
-
-export MR_HTTPX="http"
-export MR_PORT=$MR_INTERNAL_PORT
-export MR_LOCAL_PORT=$MR_EXTERNAL_PORT #When agent is running outside the docker net
-
-export CR_HTTPX="http"
-export CR_PORT=$CR_INTERNAL_PORT
-export CR_LOCAL_PORT=$CR_EXTERNAL_PORT #When CR is running outside the docker net
-export CR_PATH="$CR_HTTPX://$CR_APP_NAME:$CR_PORT$CR_APP_CALLBACK"
-
-export PROD_STUB_HTTPX="http"
-export PROD_STUB_PORT=$PROD_STUB_INTERNAL_PORT
-export PROD_STUB_LOCAL_PORT=$PROD_STUB_EXTERNAL_PORT #When Prodstub is running outside the docker net
-export PROD_STUB_LOCALHOST=$PROD_STUB_HTTPX"://localhost:"$PROD_STUB_LOCAL_PORT
-
-export SDNC_HTTPX="http"
-export SDNC_PORT=$SDNC_INTERNAL_PORT
-export SDNC_LOCAL_PORT=$SDNC_EXTERNAL_PORT #When agent is running outside the docker net
-
-export RAPP_CAT_HTTPX="http"
-export RAPP_CAT_PORT=$RAPP_CAT_INTERNAL_PORT
-export RAPP_CAT_LOCAL_PORT=$RAPP_CAT_EXTERNAL_PORT #When Rapp catalogue is running outside the docker net
+#This var need be preserved from the command line option, if set, when env var is sourced.
+if [ ! -z "$TMP_RIC_SIM_PREFIX" ]; then
+       RIC_SIM_PREFIX=$TMP_RIC_SIM_PREFIX
+fi
+
+if [ -z "$PROJECT_IMAGES_APP_NAMES" ]; then
+       echo -e $RED"Var PROJECT_IMAGES_APP_NAMES must be defined in: "$TEST_ENV_VAR_FILE $ERED
+       exit 1
+fi
+
+if [[ $SUPPORTED_RUNMODES != *"$RUNMODE"* ]]; then
+       echo -e $RED"This test script does not support RUNMODE $RUNMODE"$ERED
+       echo "Supported RUNMODEs: "$SUPPORTED_RUNMODES
+       exit 1
+fi
+
+# Choose list of included apps depending on run-mode
+if [ $RUNMODE == "KUBE" ]; then
+       INCLUDED_IMAGES=$KUBE_INCLUDED_IMAGES
+else
+       INCLUDED_IMAGES=$DOCKER_INCLUDED_IMAGES
+fi
+
+# Check needed installed sw
+tmp=$(which python3)
+if [ $? -ne 0 ] || [ -z tmp ]; then
+       echo -e $RED"python3 is required to run the test environment, pls install"$ERED
+       exit 1
+fi
+tmp=$(which docker)
+if [ $? -ne 0 ] || [ -z tmp ]; then
+       echo -e $RED"docker is required to run the test environment, pls install"$ERED
+       exit 1
+fi
+
+tmp=$(which docker-compose)
+if [ $? -ne 0 ] || [ -z tmp ]; then
+       if [ $RUNMODE == "DOCKER" ]; then
+               echo -e $RED"docker-compose is required to run the test environment, pls install"$ERED
+               exit 1
+       fi
+fi
+
+tmp=$(which kubectl)
+if [ $? -ne 0 ] || [ -z tmp ]; then
+       if [ $RUNMODE == "KUBE" ]; then
+               echo -e $RED"kubectl is required to run the test environment in kubernetes mode, pls install"$ERED
+               exit 1
+       fi
+fi
 
 echo -e $BOLD"Checking configured image setting for this test case"$EBOLD
 
@@ -422,13 +585,13 @@ echo -e $BOLD"Checking configured image setting for this test case"$EBOLD
 IMAGE_ERR=0
 #Create a file with image info for later printing as a table
 image_list_file="./tmp/.image-list"
-echo -e " Container\tImage\ttag" > $image_list_file
+echo -e " Container\tImage\ttag\ttag-switch" > $image_list_file
 
 # Check if image env var is set and if so export the env var with image to use (used by docker compose files)
-# arg: <image name> <script start-arg> <target-variable-name> <image-variable-name> <image-tag-variable-name> <app-short-name>
-__check_image_var() {
+# arg: <image name> <target-variable-name> <image-variable-name> <image-tag-variable-name> <tag-suffix> <app-short-name>
+__check_and_create_image_var() {
        if [ $# -ne 6 ]; then
-               echo "Expected arg: <image name> <script start-arg> <target-variable-name> <image-variable-name> <image-tag-variable-name> <app-short-name>"
+               echo "Expected arg: <image name> <target-variable-name> <image-variable-name> <image-tag-variable-name> <tag-suffix> <app-short-name>"
                ((IMAGE_ERR++))
                return
        fi
@@ -440,35 +603,75 @@ __check_image_var() {
        fi
        tmp=${1}"\t"
        #Create var from the input var names
-       image="${!4}"
-       tag="${!5}"
+       image="${!3}"
+       tmptag=$4"_"$5
+       tag="${!tmptag}"
 
        if [ -z $image ]; then
-               echo -e $RED"\$"$4" not set in $TEST_ENV_VAR_FILE"$ERED
-               ((IMAGE_ERR++))
+               echo -e $RED"\$"$3" not set in $TEST_ENV_VAR_FILE"$ERED
+               ((IMAGE_ERR++))
                echo ""
                tmp=$tmp"<no-image>\t"
        else
+               #Add repo depending on image type
+               if [ "$5" == "REMOTE_RELEASE" ]; then
+                       image=$NEXUS_RELEASE_REPO$image
+               fi
+               if [ "$5" == "REMOTE" ]; then
+                       image=$NEXUS_STAGING_REPO$image
+               fi
+               if [ "$5" == "REMOTE_SNAPSHOT" ]; then
+                       image=$NEXUS_SNAPSHOT_REPO$image
+               fi
+               if [ "$5" == "REMOTE_PROXY" ]; then
+                       image=$NEXUS_PROXY_REPO$image
+               fi
+               if [ "$5" == "REMOTE_RELEASE_ONAP" ]; then
+                       image=$NEXUS_RELEASE_REPO_ONAP$image
+               fi
+               if [ "$5" == "REMOTE_RELEASE_ORAN" ]; then
+                       image=$NEXUS_RELEASE_REPO_ORAN$image
+               fi
+               #No nexus repo added for local images, tag: LOCAL
                tmp=$tmp$image"\t"
        fi
        if [ -z $tag ]; then
-               echo -e $RED"\$"$5" not set in $TEST_ENV_VAR_FILE"$ERED
-               ((IMAGE_ERR++))
+               echo -e $RED"\$"$tmptag" not set in $TEST_ENV_VAR_FILE"$ERED
+               ((IMAGE_ERR++))
                echo ""
                tmp=$tmp"<no-tag>\t"
        else
                tmp=$tmp$tag
        fi
+       tmp=$tmp"\t"$5
        echo -e "$tmp" >> $image_list_file
        #Export the env var
-       export "${3}"=$image":"$tag
+       export "${2}"=$image":"$tag
+}
 
-       #echo " Configured image for ${1} (script start arg=${2}): "$image":"$tag
+# Check if app uses image included in this test run
+# Returns 0 if image is included, 1 if not
+__check_included_image() {
+       for im in $INCLUDED_IMAGES; do
+               if [ "$1" == "$im" ]; then
+                       return 0
+               fi
+       done
+       return 1
 }
 
+# Check if app is included in the prestarted set of apps
+# Returns 0 if image is included, 1 if not
+__check_prestarted_image() {
+       for im in $KUBE_PRESTARTED_IMAGES; do
+               if [ "$1" == "$im" ]; then
+                       return 0
+               fi
+       done
+       return 1
+}
 
-#Check if app local image shall override remote image
-# Possible IDs for local image override: PA, CP, SDNC, RICSIM, ECS
+# Check if an app shall use a local image, based on the cmd parameters
 __check_image_local_override() {
        for im in $USE_LOCAL_IMAGES; do
                if [ "$1" == "$im" ]; then
@@ -478,115 +681,189 @@ __check_image_local_override() {
        return 0
 }
 
-# Check if app uses image included in this test run
-# Returns 0 if image is included, 1 if not
-# Possible IDs for image inclusion: CBS, CONSUL, CP, CR, ECS, MR, PA, PRODSTUB, RICSIM, SDNC
-__check_included_image() {
-       for im in $INCLUDED_IMAGES; do
+# Check if app uses image override
+# Returns the image/tag suffix LOCAL for local image or REMOTE/REMOTE_RELEASE/REMOTE_SNAPSHOT for staging/release/snapshot image
+__check_image_override() {
+
+       for im in $ORAN_IMAGES_APP_NAMES; do
                if [ "$1" == "$im" ]; then
+                       echo "REMOTE_RELEASE_ORAN"
                        return 0
                fi
        done
-       return 1
-}
-
-# Check that image env setting are available
-echo ""
 
-if [ $START_ARG == "local" ]; then
-
-       #Local agent image
-       __check_image_var " Policy Agent" $START_ARG "POLICY_AGENT_IMAGE" "POLICY_AGENT_LOCAL_IMAGE" "POLICY_AGENT_LOCAL_IMAGE_TAG" PA
+       for im in $ONAP_IMAGES_APP_NAMES; do
+               if [ "$1" == "$im" ]; then
+                       echo "REMOTE_RELEASE_ONAP"
+                       return 0
+               fi
+       done
 
-       #Local Control Panel image
-       __check_image_var " Control Panel" $START_ARG "CONTROL_PANEL_IMAGE" "CONTROL_PANEL_LOCAL_IMAGE" "CONTROL_PANEL_LOCAL_IMAGE_TAG" CP
+       found=0
+       for im in $PROJECT_IMAGES_APP_NAMES; do
+               if [ "$1" == "$im" ]; then
+                       found=1
+               fi
+       done
 
-       #Local SNDC image
-       __check_image_var " SDNC A1 Controller" $START_ARG "SDNC_A1_CONTROLLER_IMAGE" "SDNC_A1_CONTROLLER_LOCAL_IMAGE" "SDNC_A1_CONTROLLER_LOCAL_IMAGE_TAG" SDNC
+       if [ $found -eq 0 ]; then
+               echo "REMOTE_PROXY"
+               return 0
+       fi
 
-       #Local ric sim image
-       __check_image_var " RIC Simulator" $START_ARG "RIC_SIM_IMAGE" "RIC_SIM_LOCAL_IMAGE" "RIC_SIM_LOCAL_IMAGE_TAG" RICSIM
+       suffix=""
+       if [ $IMAGE_CATEGORY == "RELEASE" ]; then
+               suffix="REMOTE_RELEASE"
+       fi
+       if [ $IMAGE_CATEGORY == "DEV" ]; then
+               suffix="REMOTE"
+       fi
+       CTR=0
+       for im in $USE_STAGING_IMAGES; do
+               if [ "$1" == "$im" ]; then
+                       suffix="REMOTE"
+                       ((CTR++))
+               fi
+       done
+       for im in $USE_RELEASE_IMAGES; do
+               if [ "$1" == "$im" ]; then
+                       suffix="REMOTE_RELEASE"
+                       ((CTR++))
+               fi
+       done
+       for im in $USE_SNAPSHOT_IMAGES; do
+               if [ "$1" == "$im" ]; then
+                       suffix="REMOTE_SNAPSHOT"
+                       ((CTR++))
+               fi
+       done
+       for im in $USE_LOCAL_IMAGES; do
+               if [ "$1" == "$im" ]; then
+                       suffix="LOCAL"
+                       ((CTR++))
+               fi
+       done
+       echo $suffix
+       if [ $CTR -gt 1 ]; then
+               exit 1
+       fi
+       return 0
+}
 
-elif [ $START_ARG == "remote" ] || [ $START_ARG == "remote-remove" ]; then
+# Check that image env setting are available
+echo ""
 
-       __check_image_local_override 'PA'
+#Agent image
+__check_included_image 'PA'
        if [ $? -eq 0 ]; then
-               #Remote agent image
-               __check_image_var " Policy Agent" $START_ARG "POLICY_AGENT_IMAGE" "POLICY_AGENT_REMOTE_IMAGE" "POLICY_AGENT_REMOTE_IMAGE_TAG" PA
-       else
-               #Local agent image
-               __check_image_var " Policy Agent" $START_ARG "POLICY_AGENT_IMAGE" "POLICY_AGENT_LOCAL_IMAGE" "POLICY_AGENT_LOCAL_IMAGE_TAG" PA
+       IMAGE_SUFFIX=$(__check_image_override 'PA')
+       if [ $? -ne 0 ]; then
+               echo -e $RED"Image setting from cmd line not consistent for PA."$ERED
+               ((IMAGE_ERR++))
        fi
+       __check_and_create_image_var " Policy Agent" "POLICY_AGENT_IMAGE" "POLICY_AGENT_IMAGE_BASE" "POLICY_AGENT_IMAGE_TAG" $IMAGE_SUFFIX PA
+fi
 
-       __check_image_local_override 'CP'
-       if [ $? -eq 0 ]; then
-               #Remote Control Panel image
-               __check_image_var " Control Panel" $START_ARG "CONTROL_PANEL_IMAGE" "CONTROL_PANEL_REMOTE_IMAGE" "CONTROL_PANEL_REMOTE_IMAGE_TAG" CP
-       else
-               #Local Control Panel image
-               __check_image_var " Control Panel" $START_ARG "CONTROL_PANEL_IMAGE" "CONTROL_PANEL_LOCAL_IMAGE" "CONTROL_PANEL_LOCAL_IMAGE_TAG" CP
+#Remote Control Panel image
+__check_included_image 'CP'
+if [ $? -eq 0 ]; then
+       IMAGE_SUFFIX=$(__check_image_override 'CP')
+       if [ $? -ne 0 ]; then
+               echo -e $RED"Image setting from cmd line not consistent for CP."$ERED
+               ((IMAGE_ERR++))
        fi
+       __check_and_create_image_var " Control Panel" "CONTROL_PANEL_IMAGE" "CONTROL_PANEL_IMAGE_BASE" "CONTROL_PANEL_IMAGE_TAG" $IMAGE_SUFFIX CP
+fi
 
-       __check_image_local_override 'SDNC'
-       if [ $? -eq 0 ]; then
-               #Remote SDNC image
-               __check_image_var " SDNC A1 Controller" $START_ARG "SDNC_A1_CONTROLLER_IMAGE" "SDNC_A1_CONTROLLER_REMOTE_IMAGE" "SDNC_A1_CONTROLLER_REMOTE_IMAGE_TAG" SDNC
-       else
-               #Local SNDC image
-               __check_image_var " SDNC A1 Controller" $START_ARG "SDNC_A1_CONTROLLER_IMAGE" "SDNC_A1_CONTROLLER_LOCAL_IMAGE" "SDNC_A1_CONTROLLER_LOCAL_IMAGE_TAG" SDNC
+#Remote SDNC image
+__check_included_image 'SDNC'
+if [ $? -eq 0 ]; then
+       IMAGE_SUFFIX=$(__check_image_override 'SDNC')
+       if [ $? -ne 0 ]; then
+               echo -e $RED"Image setting from cmd line not consistent for SDNC."$ERED
+               ((IMAGE_ERR++))
        fi
+       __check_and_create_image_var " SDNC A1 Controller" "SDNC_A1_CONTROLLER_IMAGE" "SDNC_A1_CONTROLLER_IMAGE_BASE" "SDNC_A1_CONTROLLER_IMAGE_TAG" $IMAGE_SUFFIX SDNC
+fi
 
-       __check_image_local_override 'RICSIM'
-       if [ $? -eq 0 ]; then
-               #Remote ric sim image
-               __check_image_var " RIC Simulator" $START_ARG "RIC_SIM_IMAGE" "RIC_SIM_REMOTE_IMAGE" "RIC_SIM_REMOTE_IMAGE_TAG" RICSIM
-       else
-               #Local ric sim image
-               __check_image_var " RIC Simulator" $START_ARG "RIC_SIM_IMAGE" "RIC_SIM_LOCAL_IMAGE" "RIC_SIM_LOCAL_IMAGE_TAG" RICSIM
+#Remote ric sim image
+__check_included_image 'RICSIM'
+if [ $? -eq 0 ]; then
+       IMAGE_SUFFIX=$(__check_image_override 'RICSIM')
+       if [ $? -ne 0 ]; then
+               echo -e $RED"Image setting from cmd line not consistent for RICSIM."$ERED
+               ((IMAGE_ERR++))
        fi
+       __check_and_create_image_var " RIC Simulator" "RIC_SIM_IMAGE" "RIC_SIM_IMAGE_BASE" "RIC_SIM_IMAGE_TAG" $IMAGE_SUFFIX RICSIM
+fi
 
-       __check_image_local_override 'ECS'
-       if [ $? -eq 0 ]; then
-               #Remote ecs image
-               __check_image_var " ECS" $START_ARG "ECS_IMAGE" "ECS_REMOTE_IMAGE" "ECS_REMOTE_IMAGE_TAG" ECS
-       else
-               #Local ecs image
-               __check_image_var " ECS" $START_ARG "ECS_IMAGE" "ECS_LOCAL_IMAGE" "ECS_LOCAL_IMAGE_TAG" ECS
+#Remote ecs image
+__check_included_image 'ECS'
+if [ $? -eq 0 ]; then
+       IMAGE_SUFFIX=$(__check_image_override 'ECS')
+       if [ $? -ne 0 ]; then
+               echo -e $RED"Image setting from cmd line not consistent for ECS."$EREDs
+               ((IMAGE_ERR++))
        fi
+       __check_and_create_image_var " ECS" "ECS_IMAGE" "ECS_IMAGE_BASE" "ECS_IMAGE_TAG" $IMAGE_SUFFIX ECS
+fi
 
-               __check_image_local_override 'RC'
-       if [ $? -eq 0 ]; then
-               #Remote ecs image
-               __check_image_var " RC" $START_ARG "RAPP_CAT_IMAGE" "RAPP_CAT_REMOTE_IMAGE" "RAPP_CAT_REMOTE_IMAGE_TAG" RC
-       else
-               #Local ecs image
-               __check_image_var " RC" $START_ARG "RAPP_CAT_IMAGE" "RAPP_CAT_LOCAL_IMAGE" "RAPP_CAT_LOCAL_IMAGE_TAG" RC
+#Remote rc image
+__check_included_image 'RC'
+if [ $? -eq 0 ]; then
+       IMAGE_SUFFIX=$(__check_image_override 'RC')
+       if [ $? -ne 0 ]; then
+               echo -e $RED"Image setting from cmd line not consistent for RC."$ERED
+               ((IMAGE_ERR++))
        fi
-
-else
-       #Should never get here....
-       echo "Unknow args: "$@
-       exit 1
+       __check_and_create_image_var " RC" "RAPP_CAT_IMAGE" "RAPP_CAT_IMAGE_BASE" "RAPP_CAT_IMAGE_TAG" $IMAGE_SUFFIX RC
 fi
 
-
 # These images are not built as part of this project official images, just check that env vars are set correctly
-__check_image_var " Message Router" $START_ARG "MRSTUB_IMAGE" "MRSTUB_LOCAL_IMAGE" "MRSTUB_LOCAL_IMAGE_TAG" MR
-__check_image_var " Callback Receiver" $START_ARG "CR_IMAGE" "CR_LOCAL_IMAGE" "CR_LOCAL_IMAGE_TAG" CR
-__check_image_var " Producer stub" $START_ARG "PROD_STUB_IMAGE" "PROD_STUB_LOCAL_IMAGE" "PROD_STUB_LOCAL_IMAGE_TAG" PRODSTUB
-__check_image_var " Consul" $START_ARG "CONSUL_IMAGE" "CONSUL_REMOTE_IMAGE" "CONSUL_REMOTE_IMAGE_TAG" CONSUL
-__check_image_var " CBS" $START_ARG "CBS_IMAGE" "CBS_REMOTE_IMAGE" "CBS_REMOTE_IMAGE_TAG" CBS
-__check_image_var " SDNC DB" $START_ARG "SDNC_DB_IMAGE" "SDNC_DB_REMOTE_IMAGE" "SDNC_DB_REMOTE_IMAGE_TAG" SDNC #Uses sdnc app name
-
-#Errors in image setting - exit
-if [ $IMAGE_ERR -ne 0 ]; then
-       exit 1
+__check_included_image 'MR'
+if [ $? -eq 0 ]; then
+       __check_and_create_image_var " Message Router stub"    "MRSTUB_IMAGE"    "MRSTUB_IMAGE_BASE"    "MRSTUB_IMAGE_TAG"    LOCAL               MR
 fi
-
-#Print a tables of the image settings
-echo -e $BOLD"Images configured for start arg: "$START $EBOLD
-column -t -s $'\t' $image_list_file
-
+__check_included_image 'DMAAPMR'
+if [ $? -eq 0 ]; then
+       __check_and_create_image_var " DMAAP Message Router"    "ONAP_DMAAPMR_IMAGE"   "ONAP_DMAAPMR_IMAGE_BASE"    "ONAP_DMAAPMR_IMAGE_TAG"    REMOTE_RELEASE_ONAP               DMAAPMR
+       __check_and_create_image_var " ZooKeeper"   "ONAP_ZOOKEEPER_IMAGE" "ONAP_ZOOKEEPER_IMAGE_BASE"  "ONAP_ZOOKEEPER_IMAGE_TAG"  REMOTE_RELEASE_ONAP               DMAAPMR
+       __check_and_create_image_var " Kafka"       "ONAP_KAFKA_IMAGE"     "ONAP_KAFKA_IMAGE_BASE"      "ONAP_KAFKA_IMAGE_TAG"      REMOTE_RELEASE_ONAP               DMAAPMR
+fi
+__check_included_image 'CR'
+if [ $? -eq 0 ]; then
+       __check_and_create_image_var " Callback Receiver" "CR_IMAGE"        "CR_IMAGE_BASE"        "CR_IMAGE_TAG"        LOCAL               CR
+fi
+__check_included_image 'PRODSTUB'
+if [ $? -eq 0 ]; then
+       __check_and_create_image_var " Producer stub"     "PROD_STUB_IMAGE" "PROD_STUB_IMAGE_BASE" "PROD_STUB_IMAGE_TAG" LOCAL               PRODSTUB
+fi
+__check_included_image 'CONSUL'
+if [ $? -eq 0 ]; then
+       __check_and_create_image_var " Consul"            "CONSUL_IMAGE"    "CONSUL_IMAGE_BASE"    "CONSUL_IMAGE_TAG"    REMOTE_PROXY        CONSUL
+fi
+__check_included_image 'CBS'
+if [ $? -eq 0 ]; then
+       __check_and_create_image_var " CBS"               "CBS_IMAGE"       "CBS_IMAGE_BASE"       "CBS_IMAGE_TAG"       REMOTE_RELEASE_ONAP CBS
+fi
+__check_included_image 'SDNC'
+if [ $? -eq 0 ]; then
+       __check_and_create_image_var " SDNC DB"           "SDNC_DB_IMAGE"   "SDNC_DB_IMAGE_BASE"   "SDNC_DB_IMAGE_TAG"   REMOTE_PROXY        SDNC #Uses sdnc app name
+fi
+__check_included_image 'HTTPPROXY'
+if [ $? -eq 0 ]; then
+       __check_and_create_image_var " Http Proxy"        "HTTP_PROXY_IMAGE" "HTTP_PROXY_IMAGE_BASE" "HTTP_PROXY_IMAGE_TAG" REMOTE_PROXY HTTPPROXY
+fi
+
+#Errors in image setting - exit
+if [ $IMAGE_ERR -ne 0 ]; then
+       exit 1
+fi
+
+#Print a tables of the image settings
+echo -e $BOLD"Images configured for start arg: "$START $EBOLD
+column -t -s $'\t' $image_list_file
+
 echo ""
 
 
@@ -631,60 +908,56 @@ __check_and_pull_image() {
                fi
        elif [ $1 == "remote" ] || [ $1 == "remote-remove" ]; then
                if [ $1 == "remote-remove" ]; then
-                       echo -ne "  Attempt to stop and remove container(s), if running - ${SAMELINE}"
-                       tmp="$(docker ps -aq --filter name=${3})"
-                       if [ $? -eq 0 ] && [ ! -z "$tmp" ]; then
-                               docker stop $tmp &> ./tmp/.dockererr
-                               if [ $? -ne 0 ]; then
-                                       ((IMAGE_ERR++))
-                                       echo ""
-                                       echo -e $RED"  Container(s) could not be stopped - try manual stopping the container(s)"$ERED
-                                       cat ./tmp/.dockererr
-                                       return 1
-                               fi
-                       fi
-                       echo -ne "  Attempt to stop and remove container(s), if running - "$GREEN"stopped"$EGREEN"${SAMELINE}"
-                       tmp="$(docker ps -aq --filter name=${3})" &> /dev/null
-                       if [ $? -eq 0 ] && [ ! -z "$tmp" ]; then
-                               docker rm $tmp &> ./tmp/.dockererr
-                               if [ $? -ne 0 ]; then
-                                       ((IMAGE_ERR++))
-                                       echo ""
-                                       echo -e $RED"  Container(s) could not be removed - try manual removal of the container(s)"$ERED
-                                       cat ./tmp/.dockererr
-                                       return 1
+                       if [ $RUNMODE == "DOCKER" ]; then
+                               echo -ne "  Attempt to stop and remove container(s), if running - ${SAMELINE}"
+                               tmp="$(docker ps -aq --filter name=${3})"
+                               if [ $? -eq 0 ] && [ ! -z "$tmp" ]; then
+                                       docker stop $tmp &> ./tmp/.dockererr
+                                       if [ $? -ne 0 ]; then
+                                               ((IMAGE_ERR++))
+                                               echo ""
+                                               echo -e $RED"  Container(s) could not be stopped - try manual stopping the container(s)"$ERED
+                                               cat ./tmp/.dockererr
+                                               return 1
+                                       fi
                                fi
-                       fi
-                       echo -e "  Attempt to stop and remove container(s), if running - "$GREEN"stopped removed"$EGREEN
-                       echo -ne "  Removing image - ${SAMELINE}"
-                       tmp="$(docker images -q ${4})" &> /dev/null
-                       if [ $? -eq 0 ] && [ ! -z "$tmp" ]; then
-                               docker rmi --force $4 &> ./tmp/.dockererr
-                               if [ $? -ne 0 ]; then
-                                       ((IMAGE_ERR++))
-                                       echo ""
-                                       echo -e $RED"  Image could not be removed - try manual removal of the image"$ERED
-                                       cat ./tmp/.dockererr
-                                       return 1
+                               echo -ne "  Attempt to stop and remove container(s), if running - "$GREEN"stopped"$EGREEN"${SAMELINE}"
+                               tmp="$(docker ps -aq --filter name=${3})" &> /dev/null
+                               if [ $? -eq 0 ] && [ ! -z "$tmp" ]; then
+                                       docker rm $tmp &> ./tmp/.dockererr
+                                       if [ $? -ne 0 ]; then
+                                               ((IMAGE_ERR++))
+                                               echo ""
+                                               echo -e $RED"  Container(s) could not be removed - try manual removal of the container(s)"$ERED
+                                               cat ./tmp/.dockererr
+                                               return 1
+                                       fi
                                fi
-                               echo -e "  Removing image - "$GREEN"removed"$EGREEN
+                               echo -e "  Attempt to stop and remove container(s), if running - "$GREEN"stopped removed"$EGREEN
+                               tmp_im=""
                        else
-                               echo -e "  Removing image - "$GREEN"image not in repository"$EGREEN
+                               tmp_im=""
                        fi
-                       tmp_im=""
                fi
                if [ -z "$tmp_im" ]; then
                        echo -ne "  Pulling image${SAMELINE}"
-                       docker pull $4  &> ./tmp/.dockererr
-                       tmp_im=$(docker images ${4} | grep -v REPOSITORY)
-                       if [ -z "$tmp_im" ]; then
+                       out=$(docker pull $4)
+                       if [ $? -ne 0 ]; then
                                echo ""
                                echo -e "  Pulling image -$RED could not be pulled"$ERED
                                ((IMAGE_ERR++))
-                               cat ./tmp/.dockererr
+                               echo $out > ./tmp/.dockererr
+                               echo $out
                                return 1
                        fi
-                       echo -e "  Pulling image -$GREEN Pulled $EGREEN"
+                       echo $out > ./tmp/.dockererr
+                       if [[ $out == *"up to date"* ]]; then
+                               echo -e "  Pulling image -$GREEN Image is up to date $EGREEN"
+                       elif [[ $out == *"Downloaded newer image"* ]]; then
+                               echo -e "  Pulling image -$GREEN Newer image pulled $EGREEN"
+                       else
+                               echo -e "  Pulling image -$GREEN Pulled $EGREEN"
+                       fi
                else
                        echo -e "  Pulling image -$GREEN OK $EGREEN(exists in local repository)"
                fi
@@ -783,12 +1056,32 @@ else
        echo -e $YELLOW" Excluding SDNC image and related DB image from image check/pull"$EYELLOW
 fi
 
+__check_included_image 'HTTPPROXY'
+if [ $? -eq 0 ]; then
+       app="HTTPPROXY";                __check_and_pull_image $START_ARG "$app" $HTTP_PROXY_APP_NAME $HTTP_PROXY_IMAGE
+else
+       echo -e $YELLOW" Excluding Http Proxy image from image check/pull"$EYELLOW
+fi
+
+__check_included_image 'DMAAPMR'
+if [ $? -eq 0 ]; then
+       app="DMAAP Message Router";      __check_and_pull_image $START_ARG "$app" $MR_DMAAP_APP_NAME $ONAP_DMAAPMR_IMAGE
+       app="ZooKeeper";                 __check_and_pull_image $START_ARG "$app" $MR_ZOOKEEPER_APP_NAME $ONAP_ZOOKEEPER_IMAGE
+       app="Kafka";                     __check_and_pull_image $START_ARG "$app" $MR_KAFKA_APP_NAME $ONAP_KAFKA_IMAGE
+else
+       echo -e $YELLOW" Excluding DMAAP MR image and images (zookeeper, kafka) from image check/pull"$EYELLOW
+fi
+
 #Errors in image setting - exit
 if [ $IMAGE_ERR -ne 0 ]; then
        echo ""
        echo "#################################################################################################"
        echo -e $RED"One or more images could not be pulled or containers using the images could not be stopped/removed"$ERED
        echo -e $RED"Or local image, overriding remote image, does not exist"$ERED
+       if [ $IMAGE_CATEGORY == "DEV" ]; then
+               echo -e $RED"Note that SNAPSHOT images may be purged from nexus after a certain period."$ERED
+               echo -e $RED"In that case, switch to use a released image instead."$ERED
+       fi
        echo "#################################################################################################"
        echo ""
        exit 1
@@ -803,8 +1096,8 @@ __check_included_image 'MR'
 if [ $? -eq 0 ]; then
        cd $curdir
        cd ../mrstub
-       echo " Building mrstub image: $MRSTUB_LOCAL_IMAGE:$MRSTUB_LOCAL_IMAGE_TAG"
-       docker build  --build-arg NEXUS_PROXY_REPO=$NEXUS_PROXY_REPO -t $MRSTUB_LOCAL_IMAGE . &> .dockererr
+       echo " Building mrstub image: $MRSTUB_IMAGE"
+       docker build  --build-arg NEXUS_PROXY_REPO=$NEXUS_PROXY_REPO -t $MRSTUB_IMAGE . &> .dockererr
        if [ $? -eq 0 ]; then
                echo -e  $GREEN" Build Ok"$EGREEN
        else
@@ -822,8 +1115,8 @@ fi
 __check_included_image 'CR'
 if [ $? -eq 0 ]; then
        cd ../cr
-       echo " Building Callback Receiver image: $CR_LOCAL_IMAGE:$CR_IMAGE_TAG"
-       docker build  --build-arg NEXUS_PROXY_REPO=$NEXUS_PROXY_REPO -t $CR_LOCAL_IMAGE . &> .dockererr
+       echo " Building Callback Receiver image: $CR_IMAGE"
+       docker build  --build-arg NEXUS_PROXY_REPO=$NEXUS_PROXY_REPO -t $CR_IMAGE . &> .dockererr
        if [ $? -eq 0 ]; then
                echo -e  $GREEN" Build Ok"$EGREEN
        else
@@ -841,8 +1134,8 @@ fi
 __check_included_image 'PRODSTUB'
 if [ $? -eq 0 ]; then
        cd ../prodstub
-       echo " Building Producer stub image: $PROD_STUB_LOCAL_IMAGE:$PROD_STUB_LOCAL_IMAGE_TAG"
-       docker build  --build-arg NEXUS_PROXY_REPO=$NEXUS_PROXY_REPO -t $PROD_STUB_LOCAL_IMAGE . &> .dockererr
+       echo " Building Producer stub image: $PROD_STUB_IMAGE"
+       docker build  --build-arg NEXUS_PROXY_REPO=$NEXUS_PROXY_REPO -t $PROD_STUB_IMAGE . &> .dockererr
        if [ $? -eq 0 ]; then
                echo -e  $GREEN" Build Ok"$EGREEN
        else
@@ -865,10 +1158,12 @@ echo -e $BOLD"Local docker registry images used in the this test script"$EBOLD
 docker_tmp_file=./tmp/.docker-images-table
 format_string="{{.Repository}}\\t{{.Tag}}\\t{{.CreatedSince}}\\t{{.Size}}\\t{{.CreatedAt}}"
 echo -e " Application\tRepository\tTag\tCreated since\tSize\tCreated at" > $docker_tmp_file
+
 __check_included_image 'PA'
 if [ $? -eq 0 ]; then
        echo -e " Policy Agent\t$(docker images --format $format_string $POLICY_AGENT_IMAGE)" >>   $docker_tmp_file
 fi
+
 __check_included_image 'ECS'
 if [ $? -eq 0 ]; then
        echo -e " ECS\t$(docker images --format $format_string $ECS_IMAGE)" >>   $docker_tmp_file
@@ -887,7 +1182,13 @@ if [ $? -eq 0 ]; then
 fi
 __check_included_image 'MR'
 if [ $? -eq 0 ]; then
-       echo -e " Message Router\t$(docker images --format $format_string $MRSTUB_IMAGE)" >>   $docker_tmp_file
+       echo -e " Message Router stub\t$(docker images --format $format_string $MRSTUB_IMAGE)" >>   $docker_tmp_file
+fi
+__check_included_image 'DMAAPMR'
+if [ $? -eq 0 ]; then
+       echo -e " DMAAP Message Router\t$(docker images --format $format_string $ONAP_DMAAPMR_IMAGE)" >>   $docker_tmp_file
+       echo -e " ZooKeeper\t$(docker images --format $format_string $ONAP_ZOOKEEPER_IMAGE)" >>   $docker_tmp_file
+       echo -e " Kafka\t$(docker images --format $format_string $ONAP_KAFKA_IMAGE)" >>   $docker_tmp_file
 fi
 __check_included_image 'CR'
 if [ $? -eq 0 ]; then
@@ -895,7 +1196,7 @@ if [ $? -eq 0 ]; then
 fi
 __check_included_image 'PRODSTUB'
 if [ $? -eq 0 ]; then
-       echo -e " Produccer stub\t$(docker images --format $format_string $PROD_STUB_IMAGE)" >>   $docker_tmp_file
+       echo -e " Producer stub\t$(docker images --format $format_string $PROD_STUB_IMAGE)" >>   $docker_tmp_file
 fi
 __check_included_image 'CONSUL'
 if [ $? -eq 0 ]; then
@@ -910,6 +1211,10 @@ if [ $? -eq 0 ]; then
        echo -e " SDNC A1 Controller\t$(docker images --format $format_string $SDNC_A1_CONTROLLER_IMAGE)" >>   $docker_tmp_file
        echo -e " SDNC DB\t$(docker images --format $format_string $SDNC_DB_IMAGE)" >>   $docker_tmp_file
 fi
+__check_included_image 'HTTPPROXY'
+if [ $? -eq 0 ]; then
+       echo -e " Http Proxy\t$(docker images --format $format_string $HTTP_PROXY_IMAGE)" >>   $docker_tmp_file
+fi
 
 column -t -s $'\t' $docker_tmp_file
 
@@ -965,7 +1270,7 @@ print_result() {
                echo -e "\033[31m\033[1m\__ \ (__|   /| ||  _/ | |   | _/ _ \ | || |_| |_| |   / _| \033[0m"
                echo -e "\033[31m\033[1m|___/\___|_|_\___|_|   |_|   |_/_/ \_\___|____\___/|_|_\___|\033[0m"
        elif [ $RES_CONF_FAIL -ne 0 ]; then
-               echo -e "\033[1mOne or more configure regest has failed. Check the script log....\033[0m"
+               echo -e "\033[1mOne or more configurations has failed. Check the script log....\033[0m"
                echo -e "\033[31m\033[1m ___  ___ ___ ___ ___ _____   ___ _   ___ _   _   _ ___ ___ \033[0m"
                echo -e "\033[31m\033[1m/ __|/ __| _ \_ _| _ \_   _| | __/_\ |_ _| | | | | | _ \ __|\033[0m"
                echo -e "\033[31m\033[1m\__ \ (__|   /| ||  _/ | |   | _/ _ \ | || |_| |_| |   / _| \033[0m"
@@ -1113,8 +1418,8 @@ __check_app_name() {
 
 # Stop and remove all containers
 # args: -
-# (Function for test scripts)
-clean_containers() {
+# (Not for test scripts)
+__clean_containers() {
 
        echo -e $BOLD"Stopping and removing all running containers, by container name"$EBOLD
 
@@ -1122,14 +1427,18 @@ clean_containers() {
                                          "ECS                    " $(__check_app_name $ECS_APP_NAME)\
                                          "RAPP Catalogue         " $(__check_app_name $RAPP_CAT_APP_NAME)\
                                          "Non-RT RIC Simulator(s)" $(__check_app_name $RIC_SIM_PREFIX)\
-                                         "Message Router         " $(__check_app_name $MR_APP_NAME)\
+                                         "Message Router stub    " $(__check_app_name $MR_STUB_APP_NAME)\
+                                         "DMAAP Message Router   " $(__check_app_name $MR_DMAAP_APP_NAME)\
+                                         "Zookeeper              " $(__check_app_name $MR_ZOOKEEPER_APP_NAME)\
+                                         "Kafka                  " $(__check_app_name $MR_KAFKA_APP_NAME)\
                                          "Callback Receiver      " $(__check_app_name $CR_APP_NAME)\
                                          "Producer stub          " $(__check_app_name $PROD_STUB_APP_NAME)\
                                          "Control Panel          " $(__check_app_name $CONTROL_PANEL_APP_NAME)\
                                          "SDNC A1 Controller     " $(__check_app_name $SDNC_APP_NAME)\
                                          "SDNC DB                " $(__check_app_name $SDNC_DB_APP_NAME)\
                                          "CBS                    " $(__check_app_name $CBS_APP_NAME)\
-                                         "Consul                 " $(__check_app_name $CONSUL_APP_NAME))
+                                         "Consul                 " $(__check_app_name $CONSUL_APP_NAME)\
+                                         "Http Proxy             " $(__check_app_name $HTTP_PROXY_APP_NAME))
 
        nw=0 # Calc max width of container name, to make a nice table
        for (( i=1; i<${#CONTAINTER_NAMES[@]} ; i+=2 )) ; do
@@ -1190,14 +1499,647 @@ clean_containers() {
        fi
 }
 
-# Function stop and remove all container in the end of the test script, if the arg 'auto-clean' is given at test script start
+###################################
+### Functions for kube management
+###################################
+
+# Scale a kube resource to a specific count
+# args: <resource-type> <resource-name> <namespace> <target-count>
+# (Not for test scripts)
+__kube_scale() {
+       echo -ne "  Setting $1 $2 replicas=$4 in namespace $3"$SAMELINE
+       kubectl scale  $1 $2  -n $3 --replicas=$4 1> /dev/null 2> ./tmp/kubeerr
+       if [ $? -ne 0 ]; then
+               echo -e "  Setting $1 $2 replicas=$4 in namespace $3 $RED Failed $ERED"
+               ((RES_CONF_FAIL++))
+               echo "  Message: $(<./tmp/kubeerr)"
+               return 1
+       else
+               echo -e "  Setting $1 $2 replicas=$4 in namespace $3 $GREEN OK $EGREEN"
+       fi
+
+       TSTART=$SECONDS
+
+       for i in {1..500}; do
+               count=$(kubectl get $1/$2  -n $3 -o jsonpath='{.status.replicas}' 2> /dev/null)
+               retcode=$?
+               if [ -z "$count" ]; then
+                       #No value is sometimes returned for some reason, in case the resource has replica 0
+                       count=0
+               fi
+               if [ $retcode -ne 0 ]; then
+                       echo -e "$RED  Cannot fetch current replica count for $1 $2 in namespace $3 $ERED"
+                       ((RES_CONF_FAIL++))
+                       return 1
+               fi
+               #echo ""
+               if [ $count -ne $4 ]; then
+                       echo -ne "  Waiting for $1 $2 replicas=$4 in namespace $3. Replicas=$count after $(($SECONDS-$TSTART)) seconds $SAMELINE"
+                       sleep $i
+               else
+                       echo -e "  Waiting for $1 $2 replicas=$4 in namespace $3. Replicas=$count after $(($SECONDS-$TSTART)) seconds"
+                       echo -e "  Replicas=$4 after $(($SECONDS-$TSTART)) seconds $GREEN OK $EGREEN"
+                       echo ""
+                       return 0
+               fi
+       done
+       echo ""
+       echo -e "$RED  Replica count did not reach target replicas=$4. Failed with replicas=$count $ERED"
+       ((RES_CONF_FAIL++))
+       return 0
+}
+
+# Scale all kube resource sets to 0 in a namespace for resources having a certain lable and label-id
+# This function does not wait for the resource to reach 0
+# args: <namespace> <label-name> <label-id>
+# (Not for test scripts)
+__kube_scale_all_resources() {
+       namespace=$1
+       labelname=$2
+       labelid=$3
+       resources="deployment replicaset statefulset"
+       for restype in $resources; do
+               result=$(kubectl get $restype -n $namespace -o jsonpath='{.items[?(@.metadata.labels.'$labelname'=="'$labelid'")].metadata.name}')
+               if [ $? -eq 0 ] && [ ! -z "$result" ]; then
+                       deleted_resourcetypes=$deleted_resourcetypes" "$restype
+                       for resid in $result; do
+                               echo -ne "  Ordered caling $restype $resid from namespace $namespace with label $labelname=$labelid to 0"$SAMELINE
+                               kubectl scale  $restype $resid  -n $namespace --replicas=0 1> /dev/null 2> ./tmp/kubeerr
+                               echo -e "  Ordered scaling $restype $resid from namespace $namespace with label $labelname=$labelid to 0 $GREEN OK $EGREEN"
+                       done
+               fi
+       done
+}
+
+# Scale all kube resource sets to 0 in a namespace for resources having a certain lable and label-id
+# This function do wait for the resource to reach 0
+# args: <namespace> <label-name> <label-id>
+# (Not for test scripts)
+__kube_scale_and_wait_all_resources() {
+       namespace=$1
+       labelname=$2
+       labelid=$3
+       resources="deployment replicaset statefulset"
+       scaled_all=1
+       while [ $scaled_all -ne 0 ]; do
+               scaled_all=0
+               for restype in $resources; do
+                       result=$(kubectl get $restype -n $namespace -o jsonpath='{.items[?(@.metadata.labels.'$labelname'=="'$labelid'")].metadata.name}')
+                       if [ $? -eq 0 ] && [ ! -z "$result" ]; then
+                               for resid in $result; do
+                                       echo -e "  Ordered scaling $restype $resid from namespace $namespace with label $labelname=$labelid to 0"
+                                       kubectl scale  $restype $resid  -n $namespace --replicas=0 1> /dev/null 2> ./tmp/kubeerr
+                                       count=1
+                                       T_START=$SECONDS
+                                       while [ $count -ne 0 ]; do
+                                               count=$(kubectl get $restype $resid  -n $namespace -o jsonpath='{.status.replicas}' 2> /dev/null)
+                                               echo -ne "  Scaling $restype $resid from namespace $namespace with label $labelname=$labelid to 0,count=$count"$SAMELINE
+                                               if [ $? -eq 0 ] && [ ! -z "$count" ]; then
+                                                       sleep 0.5
+                                               else
+                                                       count=0
+                                               fi
+                                               duration=$(($SECONDS-$T_START))
+                                               if [ $duration -gt 100 ]; then
+                                                       #Forcring count 0, to avoid hanging for failed scaling
+                                                       scaled_all=1
+                                                       count=0
+                                               fi
+                                       done
+                                       echo -e "  Scaled $restype $resid from namespace $namespace with label $labelname=$labelid to 0,count=$count $GREEN OK $EGREEN"
+                               done
+                       fi
+               done
+       done
+}
+
+# Remove all kube resources in a namespace for resources having a certain label and label-id
+# This function wait until the resources are gone. Scaling to 0 must have been ordered previously
+# args: <namespace> <label-name> <label-id>
+# (Not for test scripts)
+__kube_delete_all_resources() {
+       namespace=$1
+       labelname=$2
+       labelid=$3
+       resources="deployments replicaset statefulset services pods configmaps pvc"
+       deleted_resourcetypes=""
+       for restype in $resources; do
+               result=$(kubectl get $restype -n $namespace -o jsonpath='{.items[?(@.metadata.labels.'$labelname'=="'$labelid'")].metadata.name}')
+               if [ $? -eq 0 ] && [ ! -z "$result" ]; then
+                       deleted_resourcetypes=$deleted_resourcetypes" "$restype
+                       for resid in $result; do
+                               if [ $restype == "replicaset" ] || [ $restype == "statefulset" ]; then
+                                       count=1
+                                       while [ $count -ne 0 ]; do
+                                               count=$(kubectl get $restype $resid  -n $namespace -o jsonpath='{.status.replicas}' 2> /dev/null)
+                                               echo -ne "  Scaling $restype $resid from namespace $namespace with label $labelname=$labelid to 0,count=$count"$SAMELINE
+                                               if [ $? -eq 0 ] && [ ! -z "$count" ]; then
+                                                       sleep 0.5
+                                               else
+                                                       count=0
+                                               fi
+                                       done
+                                       echo -e "  Scaled $restype $resid from namespace $namespace with label $labelname=$labelid to 0,count=$count $GREEN OK $EGREEN"
+                               fi
+                               echo -ne "  Deleting $restype $resid from namespace $namespace with label $labelname=$labelid "$SAMELINE
+                               kubectl delete $restype $resid -n $namespace 1> /dev/null 2> ./tmp/kubeerr
+                               if [ $? -eq 0 ]; then
+                                       echo -e "  Deleted $restype $resid from namespace $namespace with label $labelname=$labelid $GREEN OK $EGREEN"
+                               else
+                                       echo -e "  Deleted $restype $resid from namespace $namespace with label $labelname=$labelid $GREEN Does not exist - OK $EGREEN"
+                               fi
+                               #fi
+                       done
+               fi
+       done
+       if [ ! -z "$deleted_resourcetypes" ]; then
+               for restype in $deleted_resources; do
+                       echo -ne "  Waiting for $restype in namespace $namespace with label $labelname=$labelid to be deleted..."$SAMELINE
+                       T_START=$SECONDS
+                       result="dummy"
+                       while [ ! -z "$result" ]; do
+                               sleep 0.5
+                               result=$(kubectl get $restype -n $namespace -o jsonpath='{.items[?(@.metadata.labels.'$labelname'=="'$labelid'")].metadata.name}')
+                               echo -ne "  Waiting for $restype in namespace $namespace with label $labelname=$labelid to be deleted...$(($SECONDS-$T_START)) seconds "$SAMELINE
+                               if [ -z "$result" ]; then
+                                       echo -e " Waiting for $restype in namespace $namespace with label $labelname=$labelid to be deleted...$(($SECONDS-$T_START)) seconds $GREEN OK $EGREEN"
+                               elif [ $(($SECONDS-$T_START)) -gt 300 ]; then
+                                       echo -e " Waiting for $restype in namespace $namespace with label $labelname=$labelid to be deleted...$(($SECONDS-$T_START)) seconds $RED Failed $ERED"
+                                       result=""
+                               fi
+                       done
+               done
+       fi
+}
+
+# Creates a namespace if it does not exists
+# args: <namespace>
+# (Not for test scripts)
+__kube_create_namespace() {
+
+       #Check if test namespace exists, if not create it
+       kubectl get namespace $1 1> /dev/null 2> ./tmp/kubeerr
+       if [ $? -ne 0 ]; then
+               echo -ne " Creating namespace "$1 $SAMELINE
+               kubectl create namespace $1 1> /dev/null 2> ./tmp/kubeerr
+               if [ $? -ne 0 ]; then
+                       echo -e " Creating namespace $1 $RED$BOLD FAILED $EBOLD$ERED"
+                       ((RES_CONF_FAIL++))
+                       echo "  Message: $(<./tmp/kubeerr)"
+                       return 1
+               else
+                       echo -e " Creating namespace $1 $GREEN$BOLD OK $EBOLD$EGREEN"
+               fi
+       else
+               echo -e " Creating namespace $1 $GREEN$BOLD Already exists, OK $EBOLD$EGREEN"
+       fi
+       return 0
+}
+
+# Find the host ip of an app (using the service resource)
+# args: <app-name> <namespace>
+# (Not for test scripts)
+__kube_get_service_host() {
+       if [ $# -ne 2 ]; then
+               ((RES_CONF_FAIL++))
+       __print_err "need 2 args, <app-name> <namespace>" $@
+               exit 1
+       fi
+       for timeout in {1..60}; do
+               host=$(kubectl get svc $1  -n $2 -o jsonpath='{.spec.clusterIP}')
+               if [ $? -eq 0 ]; then
+                       if [ ! -z "$host" ]; then
+                               echo $host
+                               return 0
+                       fi
+               fi
+               sleep 0.5
+       done
+       ((RES_CONF_FAIL++))
+       echo "host-not-found-fatal-error"
+       return 1
+}
+
+# Translate ric name to kube host name
+# args: <ric-name>
+# For test scripts
+get_kube_sim_host() {
+       name=$(echo "$1" | tr '_' '-')  #kube does not accept underscore in names
+       #example gnb_1_2 -> gnb-1-2
+       set_name=$(echo $name | rev | cut -d- -f2- | rev) # Cut index part of ric name to get the name of statefulset
+       # example gnb-g1-2 -> gnb-g1 where gnb-g1-2 is the ric name and gnb-g1 is the set name
+       echo $name"."$set_name"."$KUBE_NONRTRIC_NAMESPACE
+
+}
+
+# Find the named port to an app (using the service resource)
+# args: <app-name> <namespace> <port-name>
+# (Not for test scripts)
+__kube_get_service_port() {
+       if [ $# -ne 3 ]; then
+               ((RES_CONF_FAIL++))
+       __print_err "need 3 args, <app-name> <namespace> <port-name>" $@
+               exit 1
+       fi
+
+       for timeout in {1..60}; do
+               port=$(kubectl get svc $1  -n $2 -o jsonpath='{...ports[?(@.name=="'$3'")].port}')
+               if [ $? -eq 0 ]; then
+                       if [ ! -z "$port" ]; then
+                               echo $port
+                               return 0
+                       fi
+               fi
+               sleep 0.5
+       done
+       ((RES_CONF_FAIL++))
+       echo "0"
+       return 1
+}
+
+# Create a kube resource from a yaml template
+# args: <resource-type> <resource-name> <template-yaml> <output-yaml>
+# (Not for test scripts)
+__kube_create_instance() {
+       echo -ne " Creating $1 $2"$SAMELINE
+       envsubst < $3 > $4
+       kubectl apply -f $4 1> /dev/null 2> ./tmp/kubeerr
+       if [ $? -ne 0 ]; then
+               ((RES_CONF_FAIL++))
+               echo -e " Creating $1 $2 $RED Failed $ERED"
+               echo "  Message: $(<./tmp/kubeerr)"
+               return 1
+       else
+               echo -e " Creating $1 $2 $GREEN OK $EGREEN"
+       fi
+}
+
+# Function to create a configmap in kubernetes
+# args: <configmap-name> <namespace> <labelname> <labelid> <path-to-data-file> <path-to-output-yaml>
+# (Not for test scripts)
+__kube_create_configmap() {
+       echo -ne " Creating configmap $1 "$SAMELINE
+       envsubst < $5 > $5"_tmp"
+       cp $5"_tmp" $5  #Need to copy back to orig file name since create configmap neeed the original file name
+       kubectl create configmap $1  -n $2 --from-file=$5 --dry-run=client -o yaml > $6
+       if [ $? -ne 0 ]; then
+               echo -e " Creating configmap $1 $RED Failed $ERED"
+               ((RES_CONF_FAIL++))
+               return 1
+       fi
+
+       kubectl apply -f $6 1> /dev/null 2> ./tmp/kubeerr
+       if [ $? -ne 0 ]; then
+               echo -e " Creating configmap $1 $RED Apply failed $ERED"
+               echo "  Message: $(<./tmp/kubeerr)"
+               ((RES_CONF_FAIL++))
+               return 1
+       fi
+       kubectl label configmap $1 -n $2 $3"="$4 --overwrite 1> /dev/null 2> ./tmp/kubeerr
+       if [ $? -ne 0 ]; then
+               echo -e " Creating configmap $1 $RED Labeling failed $ERED"
+               echo "  Message: $(<./tmp/kubeerr)"
+               ((RES_CONF_FAIL++))
+               return 1
+       fi
+       # Log the resulting map
+       kubectl get configmap $1 -n $2 -o yaml > $6
+
+       echo -e " Creating configmap $1 $GREEN OK $EGREEN"
+       return 0
+}
+
+# This function scales or deletes all resources for app selected by the testcase.
+# args: -
+# (Not for test scripts)
+__clean_kube() {
+       echo -e $BOLD"Initialize kube services//pods/statefulsets/replicaset to initial state"$EBOLD
+
+       # Scale prestarted or managed apps
+       __check_prestarted_image 'RICSIM'
+       if [ $? -eq 0 ]; then
+               echo -e " Scaling all kube resources for app $BOLD RICSIM $EBOLD to 0"
+               __kube_scale_and_wait_all_resources $KUBE_NONRTRIC_NAMESPACE app nonrtric-a1simulator
+       else
+               echo -e " Scaling all kube resources for app $BOLD RICSIM $EBOLD to 0"
+               __kube_scale_all_resources $KUBE_NONRTRIC_NAMESPACE autotest RICSIM
+       fi
+
+       __check_prestarted_image 'PA'
+       if [ $? -eq 0 ]; then
+               echo -e " Scaling all kube resources for app $BOLD PA $EBOLD to 0"
+               __kube_scale_and_wait_all_resources $KUBE_NONRTRIC_NAMESPACE app nonrtric-policymanagementservice
+       else
+           echo -e " Scaling all kube resources for app $BOLD PA $EBOLD to 0"
+               __kube_scale_all_resources $KUBE_NONRTRIC_NAMESPACE autotest PA
+       fi
+
+       __check_prestarted_image 'ECS'
+       if [ $? -eq 0 ]; then
+               echo -e " Scaling all kube resources for app $BOLD ECS $EBOLD to 0"
+               __kube_scale_and_wait_all_resources $KUBE_NONRTRIC_NAMESPACE app nonrtric-enrichmentservice
+       else
+               echo -e " Scaling all kube resources for app $BOLD ECS $EBOLD to 0"
+               __kube_scale_all_resources $KUBE_NONRTRIC_NAMESPACE autotest ECS
+       fi
+
+       __check_prestarted_image 'RC'
+       if [ $? -eq 0 ]; then
+               echo -e " Scaling all kube resources for app $BOLD RC $EBOLD to 0"
+               __kube_scale_and_wait_all_resources $KUBE_NONRTRIC_NAMESPACE app nonrtric-rappcatalogueservice
+       else
+               echo -e " Scaling all kube resources for app $BOLD RC $EBOLD to 0"
+               __kube_scale_all_resources $KUBE_NONRTRIC_NAMESPACE autotest RC
+       fi
+
+       __check_prestarted_image 'CP'
+       if [ $? -eq 0 ]; then
+               echo -e " CP replicas kept as is"
+       else
+               echo -e " Scaling all kube resources for app $BOLD CP $EBOLD to 0"
+               __kube_scale_all_resources $KUBE_NONRTRIC_NAMESPACE autotest CP
+       fi
+
+       __check_prestarted_image 'SDNC'
+       if [ $? -eq 0 ]; then
+               echo -e " SDNC replicas kept as is"
+       else
+               echo -e " Scaling all kube resources for app $BOLD SDNC $EBOLD to 0"
+               __kube_scale_all_resources $KUBE_NONRTRIC_NAMESPACE autotest SDNC
+       fi
+
+       __check_prestarted_image 'MR'
+       if [ $? -eq 0 ]; then
+               echo -e " MR replicas kept as is"
+       else
+               echo -e " Scaling all kube resources for app $BOLD MR $EBOLD to 0"
+               __kube_scale_all_resources $KUBE_ONAP_NAMESPACE autotest MR
+       fi
+
+       __check_prestarted_image 'DMAAPMR'
+       if [ $? -eq 0 ]; then
+               echo -e " DMAAP replicas kept as is"
+       else
+               echo -e " Scaling all kube resources for app $BOLD DMAAPMR $EBOLD to 0"
+               __kube_scale_all_resources $KUBE_ONAP_NAMESPACE autotest DMAAPMR
+       fi
+
+       echo -e " Scaling all kube resources for app $BOLD CR $EBOLD to 0"
+       __kube_scale_all_resources $KUBE_SIM_NAMESPACE autotest CR
+
+       echo -e " Scaling all kube resources for app $BOLD PRODSTUB $EBOLD to 0"
+       __kube_scale_all_resources $KUBE_SIM_NAMESPACE autotest PRODSTUB
+
+       echo -e " Scaling all kube resources for app $BOLD HTTPPROXY $EBOLD to 0"
+       __kube_scale_all_resources $KUBE_SIM_NAMESPACE autotest HTTPPROXY
+
+
+       ## Clean all managed apps
+
+       __check_prestarted_image 'RICSIM'
+       if [ $? -eq 1 ]; then
+               echo -e " Deleting all kube resources for app $BOLD RICSIM $EBOLD"
+               __kube_delete_all_resources $KUBE_NONRTRIC_NAMESPACE autotest RICSIM
+       fi
+
+       __check_prestarted_image 'PA'
+       if [ $? -eq 1 ]; then
+           echo -e " Deleting all kube resources for app $BOLD PA $EBOLD"
+               __kube_delete_all_resources $KUBE_NONRTRIC_NAMESPACE autotest PA
+       fi
+
+       __check_prestarted_image 'ECS'
+       if [ $? -eq 1 ]; then
+               echo -e " Deleting all kube resources for app $BOLD ECS $EBOLD"
+               __kube_delete_all_resources $KUBE_NONRTRIC_NAMESPACE autotest ECS
+       fi
+
+       __check_prestarted_image 'RC'
+       if [ $? -eq 1 ]; then
+               echo -e " Deleting all kube resources for app $BOLD RC $EBOLD"
+               __kube_delete_all_resources $KUBE_NONRTRIC_NAMESPACE autotest RC
+       fi
+
+       __check_prestarted_image 'CP'
+       if [ $? -eq 1 ]; then
+               echo -e " Deleting all kube resources for app $BOLD CP $EBOLD"
+               __kube_delete_all_resources $KUBE_NONRTRIC_NAMESPACE autotest CP
+       fi
+
+       __check_prestarted_image 'SDNC'
+       if [ $? -eq 1 ]; then
+               echo -e " Deleting all kube resources for app $BOLD SDNC $EBOLD"
+               __kube_delete_all_resources $KUBE_NONRTRIC_NAMESPACE autotest SDNC
+       fi
+
+       __check_prestarted_image 'MR'
+       if [ $? -eq 1 ]; then
+               echo -e " Deleting all kube resources for app $BOLD MR $EBOLD"
+               __kube_delete_all_resources $KUBE_ONAP_NAMESPACE autotest MR
+       fi
+
+       __check_prestarted_image 'DMAAPMR'
+       if [ $? -eq 1 ]; then
+               echo -e " Deleting all kube resources for app $BOLD DMAAPMR $EBOLD"
+               __kube_delete_all_resources $KUBE_ONAP_NAMESPACE autotest DMAAPMR
+       fi
+
+       echo -e " Deleting all kube resources for app $BOLD CR $EBOLD"
+       __kube_delete_all_resources $KUBE_SIM_NAMESPACE autotest CR
+
+       echo -e " Deleting all kube resources for app $BOLD PRODSTUB $EBOLD"
+       __kube_delete_all_resources $KUBE_SIM_NAMESPACE autotest PRODSTUB
+
+       echo -e " Deleting all kube resources for app $BOLD HTTPPROXY $EBOLD"
+       __kube_delete_all_resources $KUBE_SIM_NAMESPACE autotest HTTPPROXY
+
+       echo ""
+}
+
+# # This function scales or deletes all resources for app selected by the testcase.
+# # args: -
+# # (Not for test scripts)
+# __clean_kube() {
+#      echo -e $BOLD"Initialize kube services//pods/statefulsets/replicaset to initial state"$EBOLD
+
+#      # Clean prestarted apps
+#      __check_prestarted_image 'RICSIM'
+#      if [ $? -eq 0 ]; then
+#              echo -e " Scaling all kube resources for app $BOLD RICSIM $EBOLD to 0"
+#              __kube_scale_and_wait_all_resources $KUBE_NONRTRIC_NAMESPACE app nonrtric-a1simulator
+#      fi
+
+#      __check_prestarted_image 'PA'
+#      if [ $? -eq 0 ]; then
+#              echo -e " Scaling all kube resources for app $BOLD PA $EBOLD to 0"
+#              __kube_scale_and_wait_all_resources $KUBE_NONRTRIC_NAMESPACE app nonrtric-policymanagementservice
+#      fi
+
+#      __check_prestarted_image 'ECS'
+#      if [ $? -eq 0 ]; then
+#              echo -e " Scaling all kube resources for app $BOLD ECS $EBOLD to 0"
+#              __kube_scale_and_wait_all_resources $KUBE_NONRTRIC_NAMESPACE app nonrtric-enrichmentservice
+#      fi
+
+#      __check_prestarted_image 'RC'
+#      if [ $? -eq 0 ]; then
+#              echo -e " Scaling all kube resources for app $BOLD RC $EBOLD to 0"
+#              __kube_scale_and_wait_all_resources $KUBE_NONRTRIC_NAMESPACE app nonrtric-rappcatalogueservice
+#      fi
+
+#      __check_prestarted_image 'CP'
+#      if [ $? -eq 0 ]; then
+#              echo -e " CP replicas kept as is"
+#      fi
+
+#      __check_prestarted_image 'SDNC'
+#      if [ $? -eq 0 ]; then
+#              echo -e " SDNC replicas kept as is"
+#      fi
+
+#      __check_prestarted_image 'MR'
+#      if [ $? -eq 0 ]; then
+#              echo -e " MR replicas kept as is"
+#      fi
+
+
+#      # Clean included apps - apps fully managed by the script
+
+#      ## Scale all to zero
+#      __check_included_image 'RICSIM'
+#      if [ $? -eq 0 ]; then
+#              echo -e " Scaling all kube resources for app $BOLD RICSIM $EBOLD to 0"
+#              __kube_scale_all_resources $KUBE_NONRTRIC_NAMESPACE autotest RICSIM
+#      fi
+
+#      __check_included_image 'PA'
+#      if [ $? -eq 0 ]; then
+#          echo -e " Scaling all kube resources for app $BOLD PA $EBOLD to 0"
+#              __kube_scale_all_resources $KUBE_NONRTRIC_NAMESPACE autotest PA
+#      fi
+
+#      __check_included_image 'ECS'
+#      if [ $? -eq 0 ]; then
+#              echo -e " Scaling all kube resources for app $BOLD ECS $EBOLD to 0"
+#              __kube_scale_all_resources $KUBE_NONRTRIC_NAMESPACE autotest ECS
+#      fi
+
+#      __check_included_image 'RC'
+#      if [ $? -eq 0 ]; then
+#              echo -e " Scaling all kube resources for app $BOLD RC $EBOLD to 0"
+#              __kube_scale_all_resources $KUBE_NONRTRIC_NAMESPACE autotest RC
+#      fi
+
+#      __check_included_image 'CP'
+#      if [ $? -eq 0 ]; then
+#              echo -e " Scaling all kube resources for app $BOLD CP $EBOLD to 0"
+#              __kube_scale_all_resources $KUBE_NONRTRIC_NAMESPACE autotest CP
+#      fi
+
+#      __check_included_image 'SDNC'
+#      if [ $? -eq 0 ]; then
+#              echo -e " Scaling all kube resources for app $BOLD SDNC $EBOLD to 0"
+#              __kube_scale_all_resources $KUBE_NONRTRIC_NAMESPACE autotest SDNC
+#      fi
+
+#      __check_included_image 'CR'
+#      if [ $? -eq 0 ]; then
+#              echo -e " Scaling all kube resources for app $BOLD CR $EBOLD to 0"
+#              __kube_scale_all_resources $KUBE_SIM_NAMESPACE autotest CR
+#      fi
+
+#      __check_included_image 'MR'
+#      if [ $? -eq 0 ]; then
+#              echo -e " Scaling all kube resources for app $BOLD MR $EBOLD to 0"
+#              __kube_scale_all_resources $KUBE_ONAP_NAMESPACE autotest MR
+#      fi
+
+#      __check_included_image 'PRODSTUB'
+#      if [ $? -eq 0 ]; then
+#              echo -e " Scaling all kube resources for app $BOLD PRODSTUB $EBOLD to 0"
+#              __kube_scale_all_resources $KUBE_SIM_NAMESPACE autotest PRODSTUB
+#      fi
+
+
+#      ## Remove all resources
+
+#      __check_included_image 'RICSIM'
+#      if [ $? -eq 0 ]; then
+#              echo -e " Deleting all kube resources for app $BOLD RICSIM $EBOLD"
+#              __kube_delete_all_resources $KUBE_NONRTRIC_NAMESPACE autotest RICSIM
+#      fi
+
+#      __check_included_image 'PA'
+#      if [ $? -eq 0 ]; then
+#          echo -e " Deleting all kube resources for app $BOLD PA $EBOLD"
+#              __kube_delete_all_resources $KUBE_NONRTRIC_NAMESPACE autotest PA
+#      fi
+
+#      __check_included_image 'ECS'
+#      if [ $? -eq 0 ]; then
+#              echo -e " Deleting all kube resources for app $BOLD ECS $EBOLD"
+#              __kube_delete_all_resources $KUBE_NONRTRIC_NAMESPACE autotest ECS
+#      fi
+
+#      __check_included_image 'RC'
+#      if [ $? -eq 0 ]; then
+#              echo -e " Deleting all kube resources for app $BOLD RC $EBOLD"
+#              __kube_delete_all_resources $KUBE_NONRTRIC_NAMESPACE autotest RC
+#      fi
+
+#      __check_included_image 'CP'
+#      if [ $? -eq 0 ]; then
+#              echo -e " Deleting all kube resources for app $BOLD CP $EBOLD"
+#              __kube_delete_all_resources $KUBE_NONRTRIC_NAMESPACE autotest CP
+#      fi
+
+#      __check_included_image 'SDNC'
+#      if [ $? -eq 0 ]; then
+#              echo -e " Deleting all kube resources for app $BOLD SDNC $EBOLD"
+#              __kube_delete_all_resources $KUBE_NONRTRIC_NAMESPACE autotest SDNC
+#      fi
+
+#      __check_included_image 'CR'
+#      if [ $? -eq 0 ]; then
+#              echo -e " Deleting all kube resources for app $BOLD CR $EBOLD"
+#              __kube_delete_all_resources $KUBE_SIM_NAMESPACE autotest CR
+#      fi
+
+#      __check_included_image 'MR'
+#      if [ $? -eq 0 ]; then
+#              echo -e " Deleting all kube resources for app $BOLD MR $EBOLD"
+#              __kube_delete_all_resources $KUBE_ONAP_NAMESPACE autotest MR
+#      fi
+
+#      __check_included_image 'PRODSTUB'
+#      if [ $? -eq 0 ]; then
+#              echo -e " Deleting all kube resources for app $BOLD PRODSTUB $EBOLD"
+#              __kube_delete_all_resources $KUBE_SIM_NAMESPACE autotest PRODSTUB
+#      fi
+
+#      echo ""
+# }
+
+# Function stop and remove all containers (docker) and services/deployments etc(kube)
+# args: -
+# Function for test script
+clean_environment() {
+       if [ $RUNMODE == "KUBE" ]; then
+               __clean_kube
+       else
+               __clean_containers
+       fi
+
+}
+
+# Function stop and remove all containers (docker) and services/deployments etc(kube) in the end of the test script, if the arg 'auto-clean' is given at test script start
 # args: -
 # (Function for test scripts)
-auto_clean_containers() {
+auto_clean_environment() {
        echo
        if [ "$AUTO_CLEAN" == "auto" ]; then
-               echo -e $BOLD"Initiating automatic cleaning of started containers"$EBOLD
-               clean_containers
+               echo -e $BOLD"Initiating automatic cleaning of environment"$EBOLD
+               clean_environment
        fi
 }
 
@@ -1235,7 +2177,7 @@ __print_err() {
 }
 
 
-# Helper function to get a the port of a specific ric simulatpor
+# Helper function to get a the port of a specific ric simulator
 # args: <ric-id>
 # (Not for test scripts)
 __find_sim_port() {
@@ -1249,123 +2191,64 @@ __find_sim_port() {
     fi
 }
 
-# Function to create the docker network for the test
-# Not to be called from the test script itself.
-__create_docker_network() {
-       tmp=$(docker network ls --format={{.Name}} --filter name=$DOCKER_SIM_NWNAME)
-       if [ $? -ne 0 ]; then
-               echo -e $RED" Could not check if docker network $DOCKER_SIM_NWNAME exists"$ERED
-               return 1
-       fi
-       if [ "$tmp" != $DOCKER_SIM_NWNAME ]; then
-               echo -e " Creating docker network:$BOLD $DOCKER_SIM_NWNAME $EBOLD"
-               docker network create $DOCKER_SIM_NWNAME | indent2
-               if [ $? -ne 0 ]; then
-                       echo -e $RED" Could not create docker network $DOCKER_SIM_NWNAME"$ERED
-                       return 1
+# Helper function to get a the port and host name of a specific ric simulator
+# args: <ric-id>
+# (Not for test scripts)
+__find_sim_host() {
+       if [ $RUNMODE == "KUBE" ]; then
+               ricname=$(echo "$1" | tr '_' '-')
+               for timeout in {1..60}; do
+                       host=$(kubectl get pod $ricname  -n $KUBE_NONRTRIC_NAMESPACE -o jsonpath='{.status.podIP}' 2> /dev/null)
+                       if [ ! -z "$host" ]; then
+                               echo $RIC_SIM_HTTPX"://"$host":"$RIC_SIM_PORT
+                               return 0
+                       fi
+                       sleep 0.5
+               done
+               echo "host-not-found-fatal-error"
+       else
+               name=$1" " #Space appended to prevent matching 10 if 1 is desired....
+               cmdstr="docker inspect --format='{{(index (index .NetworkSettings.Ports \"$RIC_SIM_PORT/tcp\") 0).HostPort}}' ${name}"
+               res=$(eval $cmdstr)
+               if [[ "$res" =~ ^[0-9]+$ ]]; then
+                       echo $RIC_SIM_HOST:$res
+                       return 0
                else
-                       echo -e "$GREEN  Done$EGREEN"
+                       echo "0"
                fi
-       else
-               echo -e " Docker network $DOCKER_SIM_NWNAME already exists$GREEN OK $EGREEN"
        fi
+       return 1
 }
 
-# Check if container is started by calling url on localhost using a port, expects response code 2XX
-# args: <container-name> <port> <url> https|https
+# Function to create the docker network for the test
 # Not to be called from the test script itself.
-__check_container_start() {
-       paramError=0
-       if [ $# -ne 4 ]; then
-               paramError=1
-       elif [ $4 != "http" ] && [ $4 != "https" ]; then
-               paramError=1
-       fi
-       if [ $paramError -ne 0 ]; then
-               ((RES_CONF_FAIL++))
-               __print_err "need 3 args, <container-name> <port> <url> https|https" $@
+__create_docker_network() {
+       tmp=$(docker network ls --format={{.Name}} --filter name=$DOCKER_SIM_NWNAME)
+       if [ $? -ne 0 ]; then
+               echo -e $RED" Could not check if docker network $DOCKER_SIM_NWNAME exists"$ERED
                return 1
        fi
-       echo -ne " Container $BOLD$1$EBOLD starting${SAMELINE}"
-       appname=$1
-       localport=$2
-       url=$3
-       if [[ $appname != "STANDALONE_"* ]]     ; then
-               app_started=0
-               for i in {1..10}; do
-                       if [ "$(docker inspect --format '{{ .State.Running }}' $appname)" == "true" ]; then
-                                       echo -e " Container $BOLD$1$EBOLD$GREEN running$EGREEN on$BOLD image $(docker inspect --format '{{ .Config.Image }}' ${appname}) $EBOLD"
-                                       app_started=1
-                                       break
-                               else
-                                       sleep $i
-                       fi
-               done
-               if [ $app_started -eq 0 ]; then
-                       ((RES_CONF_FAIL++))
-                       echo ""
-                       echo -e $RED" Container $BOLD${appname}$EBOLD could not be started"$ERED
-                       echo -e $RED" Stopping script..."$ERED
-                       exit 1
-               fi
-               if [ $localport -eq 0 ]; then
-                       while [ $localport -eq 0 ]; do
-                               echo -ne " Waiting for container ${appname} to publish its ports...${SAMELINE}"
-                               localport=$(__find_sim_port $appname)
-                               sleep 1
-                               echo -ne " Waiting for container ${appname} to publish its ports...retrying....${SAMELINE}"
-                       done
-                       echo -ne " Waiting for container ${appname} to publish its ports...retrying....$GREEN OK $EGREEN"
-                       echo ""
-               fi
-       fi
-
-       pa_st=false
-       echo -ne " Waiting for container ${appname} service status...${SAMELINE}"
-       TSTART=$SECONDS
-       for i in {1..50}; do
-               if [ $4 == "https" ]; then
-                       result="$(__do_curl "-k https://localhost:"${localport}${url})"
+       if [ "$tmp" != $DOCKER_SIM_NWNAME ]; then
+               echo -e " Creating docker network:$BOLD $DOCKER_SIM_NWNAME $EBOLD"
+               docker network create $DOCKER_SIM_NWNAME | indent2
+               if [ $? -ne 0 ]; then
+                       echo -e $RED" Could not create docker network $DOCKER_SIM_NWNAME"$ERED
+                       return 1
                else
-                       result="$(__do_curl $LOCALHOST${localport}${url})"
+                       echo -e "$GREEN  Done$EGREEN"
                fi
-               if [ $? -eq 0 ]; then
-                       if [ ${#result} -gt 15 ]; then
-                               #If response is too long, truncate
-                               result="...response text too long, omitted"
-                       fi
-                       echo -ne " Waiting for container $BOLD${appname}$EBOLD service status, result: $result${SAMELINE}"
-                       echo -ne " Container $BOLD${appname}$EBOLD$GREEN is alive$EGREEN, responds to service status:$GREEN $result $EGREEN after $(($SECONDS-$TSTART)) seconds"
-                       pa_st=true
-                       break
-               else
-                       TS_TMP=$SECONDS
-                       while [ $(($TS_TMP+$i)) -gt $SECONDS ]; do
-                               echo -ne " Waiting for container ${appname} service status...$(($SECONDS-$TSTART)) seconds, retrying in $(($TS_TMP+$i-$SECONDS)) seconds   ${SAMELINE}"
-                               sleep 1
-                       done
-               fi
-       done
-
-       if [ "$pa_st" = "false"  ]; then
-               ((RES_CONF_FAIL++))
-               echo -e $RED" Container ${appname} did not respond to service status in $(($SECONDS-$TSTART)) seconds"$ERED
-               return 0
+       else
+               echo -e " Docker network $DOCKER_SIM_NWNAME already exists$GREEN OK $EGREEN"
        fi
-
-       echo ""
-       return 0
 }
 
-
-# Function to start a container and wait until it responds on the given port and url.
-#args: <docker-compose-dir> NODOCKERARGS|<docker-compose-arg> <app-name> <port-number> <alive-url> [<app-name> <port-number> <alive-url>]*
+# Function to start container with docker-compose and wait until all are in state running.
+#args: <docker-compose-dir> <docker-compose-arg>|NODOCKERARGS <count> <app-name>+
+# (Not for test scripts)
 __start_container() {
-
-       variableArgCount=$(($#-2))
-       if [ $# -lt 6 ] && [ [ $(($variableArgCount%4)) -ne 0 ]; then
+       if [ $# -lt 4 ]; then
                ((RES_CONF_FAIL++))
-       __print_err "need 6 or more args,  <docker-compose-dir> NODOCKERARGS|<docker-compose-arg> <app-name> <port-number> <alive-url> http|https [<app-name> <port-number> <alive-url> http|https ]*" $@
+       __print_err "need 4 or more args, <docker-compose-dir> <docker-compose-arg>|NODOCKERARGS <count> <app-name>+" $@
                exit 1
        fi
 
@@ -1373,9 +2256,15 @@ __start_container() {
 
        curdir=$PWD
        cd $SIM_GROUP
+       compose_dir=$1
        cd $1
+       shift
+       compose_args=$1
+       shift
+       appcount=$1
+       shift
 
-       if [ "$2" == "NODOCKERARGS" ]; then
+       if [ "$compose_args" == "NODOCKERARGS" ]; then
                docker-compose up -d &> .dockererr
                if [ $? -ne 0 ]; then
                        echo -e $RED"Problem to launch container(s) with docker-compose"$ERED
@@ -1383,10 +2272,8 @@ __start_container() {
                        echo -e $RED"Stopping script...."$ERED
                        exit 1
                fi
-       elif [ "$2" == "STANDALONE" ]; then
-               echo "Skipping docker-compose"
        else
-               docker-compose up -d $2 &> .dockererr
+               docker-compose up -d $compose_args &> .dockererr
                if [ $? -ne 0 ]; then
                        echo -e $RED"Problem to launch container(s) with docker-compose"$ERED
                        cat .dockererr
@@ -1394,792 +2281,97 @@ __start_container() {
                        exit 1
                fi
        fi
-       app_prefix=""
-       if [ "$2" == "STANDALONE" ]; then
-               app_prefix="STANDALONE_"
-       fi
-       shift; shift;
-       cntr=0
-       while [ $cntr -lt $variableArgCount ]; do
-               app=$app_prefix$1; shift;
-               port=$1; shift;
-               url=$1; shift;
-               httpx=$1; shift;
-               let cntr=cntr+4
-
-               __check_container_start "$app" "$port" "$url" $httpx
-       done
 
        cd $curdir
-       echo ""
+
+       appindex=0
+       while [ $appindex -lt $appcount ]; do
+               appname=$1
+               shift
+               app_started=0
+               for i in {1..10}; do
+                       if [ "$(docker inspect --format '{{ .State.Running }}' $appname)" == "true" ]; then
+                                       echo -e " Container $BOLD${appname}$EBOLD$GREEN running$EGREEN on$BOLD image $(docker inspect --format '{{ .Config.Image }}' ${appname}) $EBOLD"
+                                       app_started=1
+                                       break
+                               else
+                                       sleep $i
+                       fi
+               done
+               if [ $app_started -eq 0 ]; then
+                       ((RES_CONF_FAIL++))
+                       echo ""
+                       echo -e $RED" Container $BOLD${appname}$EBOLD could not be started"$ERED
+                       echo -e $RED" Stopping script..."$ERED
+                       exit 1
+               fi
+               let appindex=appindex+1
+       done
        return 0
 }
 
 # Generate a UUID to use as prefix for policy ids
 generate_uuid() {
        UUID=$(python3 -c 'import sys,uuid; sys.stdout.write(uuid.uuid4().hex)')
-       #Reduce length to make space for serial id, us 'a' as marker where the serial id is added
+       #Reduce length to make space for serial id, uses 'a' as marker where the serial id is added
        UUID=${UUID:0:${#UUID}-4}"a"
 }
 
-####################
-### Consul functions
-####################
-
-# Function to load config from a file into consul for the Policy Agent
-# arg: <json-config-file>
-# (Function for test scripts)
-consul_config_app() {
-
-       echo -e $BOLD"Configuring Consul"$EBOLD
 
-       if [ $# -ne 1 ]; then
-               ((RES_CONF_FAIL++))
-       __print_err "need one arg,  <json-config-file>" $@
-               exit 1
-       fi
-
-       echo " Loading config for "$POLICY_AGENT_APP_NAME" from "$1
-
-       curlString="$LOCALHOST${CONSUL_EXTERNAL_PORT}/v1/kv/${POLICY_AGENT_APP_NAME}?dc=dc1 -X PUT -H Accept:application/json -H Content-Type:application/json -H X-Requested-With:XMLHttpRequest --data-binary @"$1
-       result=$(__do_curl "$curlString")
-       if [ $? -ne 0 ]; then
-               echo -e $RED" FAIL - json config could not be loaded to consul" $ERED
-               ((RES_CONF_FAIL++))
-               return 1
-       fi
-       body="$(__do_curl $LOCALHOST$CBS_EXTERNAL_PORT/service_component_all/$POLICY_AGENT_APP_NAME)"
-       echo $body > "./tmp/.output"$1
-
-       if [ $? -ne 0 ]; then
-               echo -e $RED" FAIL - json config could not be loaded from consul/cbs, contents cannot be checked." $ERED
-               ((RES_CONF_FAIL++))
-               return 1
-       else
-               targetJson=$(< $1)
-               targetJson="{\"config\":"$targetJson"}"
-               echo "TARGET JSON: $targetJson" >> $HTTPLOG
-               res=$(python3 ../common/compare_json.py "$targetJson" "$body")
-               if [ $res -ne 0 ]; then
-                       echo -e $RED" FAIL - policy json config read from consul/cbs is not equal to the intended json config...." $ERED
-                       ((RES_CONF_FAIL++))
-                       return 1
-               else
-                       echo -e $GREEN" Config loaded ok to consul"$EGREEN
-               fi
-       fi
-
-       echo ""
-
-}
-
-# Function to perpare the consul configuration according to the current simulator configuration
-# args: SDNC|NOSDNC <output-file>
-# (Function for test scripts)
-prepare_consul_config() {
-       echo -e $BOLD"Prepare Consul config"$EBOLD
-
-       echo " Writing consul config for "$POLICY_AGENT_APP_NAME" to file: "$2
-
-       if [ $# != 2 ];  then
-               ((RES_CONF_FAIL++))
-       __print_err "need two args,  SDNC|NOSDNC <output-file>" $@
-               exit 1
-       fi
-
-       if [ $1 == "SDNC" ]; then
-               echo -e " Config$BOLD including SDNC$EBOLD configuration"
-       elif [ $1 == "NOSDNC" ];  then
-               echo -e " Config$BOLD excluding SDNC$EBOLD configuration"
-       else
-               ((RES_CONF_FAIL++))
-       __print_err "need two args,  SDNC|NOSDNC <output-file>" $@
-               exit 1
-       fi
-
-       config_json="\n            {"
-       if [ $1 == "SDNC" ]; then
-               config_json=$config_json"\n   \"controller\": ["
-               config_json=$config_json"\n                     {"
-               config_json=$config_json"\n                       \"name\": \"$SDNC_APP_NAME\","
-               if [ $AGENT_STAND_ALONE -eq 0 ]; then
-                       config_json=$config_json"\n                       \"baseUrl\": \"$SDNC_HTTPX://$SDNC_APP_NAME:$SDNC_PORT\","
-               else
-                       config_json=$config_json"\n                       \"baseUrl\": \"$SDNC_HTTPX://localhost:$SDNC_LOCAL_PORT\","
-               fi
-               config_json=$config_json"\n                       \"userName\": \"$SDNC_USER\","
-               config_json=$config_json"\n                       \"password\": \"$SDNC_PWD\""
-               config_json=$config_json"\n                     }"
-               config_json=$config_json"\n   ],"
-       fi
-
-       config_json=$config_json"\n   \"streams_publishes\": {"
-       config_json=$config_json"\n                            \"dmaap_publisher\": {"
-       config_json=$config_json"\n                              \"type\": \"$MR_APP_NAME\","
-       config_json=$config_json"\n                              \"dmaap_info\": {"
-       if [ $AGENT_STAND_ALONE -eq 0 ]; then
-               config_json=$config_json"\n                                \"topic_url\": \"$MR_HTTPX://$MR_APP_NAME:$MR_PORT$MR_WRITE_URL\""
-       else
-               config_json=$config_json"\n                                \"topic_url\": \"$MR_HTTPX://localhost:$MR_LOCAL_PORT$MR_WRITE_URL\""
-       fi
-       config_json=$config_json"\n                              }"
-       config_json=$config_json"\n                            }"
-       config_json=$config_json"\n   },"
-       config_json=$config_json"\n   \"streams_subscribes\": {"
-       config_json=$config_json"\n                             \"dmaap_subscriber\": {"
-       config_json=$config_json"\n                               \"type\": \"$MR_APP_NAME\","
-       config_json=$config_json"\n                               \"dmaap_info\": {"
-       if [ $AGENT_STAND_ALONE -eq 0 ]; then
-               config_json=$config_json"\n                                   \"topic_url\": \"$MR_HTTPX://$MR_APP_NAME:$MR_PORT$MR_READ_URL\""
-       else
-               config_json=$config_json"\n                                   \"topic_url\": \"$MR_HTTPX://localhost:$MR_LOCAL_PORT$MR_READ_URL\""
-       fi
-       config_json=$config_json"\n                                 }"
-       config_json=$config_json"\n                               }"
-       config_json=$config_json"\n   },"
-
-       config_json=$config_json"\n   \"ric\": ["
-
-       rics=$(docker ps | grep $RIC_SIM_PREFIX | awk '{print $NF}')
+# Function to check if container/service is responding to http/https
+# args: <container-name>|<service-name> url
+# (Not for test scripts)
+__check_service_start() {
 
-       if [ $? -ne 0 ] || [ -z "$rics" ]; then
-               echo -e $RED" FAIL - the names of the running RIC Simulator cannot be retrieved." $ERED
+       if [ $# -ne 2 ]; then
                ((RES_CONF_FAIL++))
+               __print_err "need 2 args, <container-name>|<service-name> url" $@
                return 1
        fi
 
-       cntr=0
-       for ric in $rics; do
-               if [ $cntr -gt 0 ]; then
-                       config_json=$config_json"\n          ,"
-               fi
-               config_json=$config_json"\n          {"
-               config_json=$config_json"\n            \"name\": \"$ric\","
-               if [ $AGENT_STAND_ALONE -eq 0 ]; then
-                       config_json=$config_json"\n            \"baseUrl\": \"$RIC_SIM_HTTPX://$ric:$RIC_SIM_PORT\","
-               else
-                       config_json=$config_json"\n            \"baseUrl\": \"$RIC_SIM_HTTPX://localhost:$(__find_sim_port $ric)\","
-               fi
-               if [ $1 == "SDNC" ]; then
-                       config_json=$config_json"\n            \"controller\": \"$SDNC_APP_NAME\","
-               fi
-               config_json=$config_json"\n            \"managedElementIds\": ["
-               config_json=$config_json"\n              \"me1_$ric\","
-               config_json=$config_json"\n              \"me2_$ric\""
-               config_json=$config_json"\n            ]"
-               config_json=$config_json"\n          }"
-               let cntr=cntr+1
-       done
-
-       config_json=$config_json"\n           ]"
-       config_json=$config_json"\n}"
-
-
-       printf "$config_json">$2
-
-       echo ""
-}
-
-
-# Start Consul and CBS
-# args: -
-# (Function for test scripts)
-start_consul_cbs() {
-
-       echo -e $BOLD"Starting Consul and CBS"$EBOLD
-       __check_included_image 'CONSUL'
-       if [ $? -eq 1 ]; then
-               echo -e $RED"The Consul image has not been checked for this test run due to arg to the test script"$ERED
-               echo -e $RED"Consul will not be started"$ERED
-               exit
-       fi
-       __start_container consul_cbs NODOCKERARGS  "$CONSUL_APP_NAME" "$CONSUL_EXTERNAL_PORT" "/ui/dc1/kv" "http" \
-                                                    "$CBS_APP_NAME" "$CBS_EXTERNAL_PORT" "/healthcheck" "http"
-}
-
-###########################
-### RIC Simulator functions
-###########################
-
-use_simulator_http() {
-       echo -e $BOLD"RICSIM protocol setting"$EBOLD
-       echo -e " Using $BOLD http $EBOLD towards the simulators"
-       export RIC_SIM_HTTPX="http"
-       export RIC_SIM_LOCALHOST=$RIC_SIM_HTTPX"://localhost:"
-       export RIC_SIM_PORT=$RIC_SIM_INTERNAL_PORT
-       echo ""
-}
-
-use_simulator_https() {
-       echo -e $BOLD"RICSIM protocol setting"$EBOLD
-       echo -e " Using $BOLD https $EBOLD towards the simulators"
-       export RIC_SIM_HTTPX="https"
-       export RIC_SIM_LOCALHOST=$RIC_SIM_HTTPX"://localhost:"
-       export RIC_SIM_PORT=$RIC_SIM_INTERNAL_SECURE_PORT
-       echo ""
-}
-
-# Start one group (ricsim_g1, ricsim_g2 .. ricsim_g5) with a number of RIC Simulators using a given A interface
-# 'ricsim' may be set on command line to other prefix
-# args:  ricsim_g1|ricsim_g2|ricsim_g3|ricsim_g4|ricsim_g5 <count> <interface-id>
-# (Function for test scripts)
-start_ric_simulators() {
-
-       echo -e $BOLD"Starting RIC Simulators"$EBOLD
-
-       __check_included_image 'RICSIM'
-       if [ $? -eq 1 ]; then
-               echo -e $RED"The Near-RT RIC Simulator image has not been checked for this test run due to arg to the test script"$ERED
-               echo -e $RED"The Near-RT RIC Simulartor(s) will not be started"$ERED
-               exit
-       fi
-
-       RIC1=$RIC_SIM_PREFIX"_g1"
-       RIC2=$RIC_SIM_PREFIX"_g2"
-       RIC3=$RIC_SIM_PREFIX"_g3"
-       RIC4=$RIC_SIM_PREFIX"_g4"
-       RIC5=$RIC_SIM_PREFIX"_g5"
-
-       if [ $# != 3 ]; then
-               ((RES_CONF_FAIL++))
-       __print_err "need three args,  $RIC1|$RIC2|$RIC3|$RIC4|$RIC5 <count> <interface-id>" $@
-               exit 1
-       fi
-       echo " $2 simulators using basename: $1 on interface: $3"
-       #Set env var for simulator count and A1 interface vesion for the given group
-       if [ $1 == "$RIC1" ]; then
-               G1_COUNT=$2
-               G1_A1_VERSION=$3
-       elif [ $1 == "$RIC2" ]; then
-               G2_COUNT=$2
-               G2_A1_VERSION=$3
-       elif [ $1 == "$RIC3" ]; then
-               G3_COUNT=$2
-               G3_A1_VERSION=$3
-       elif [ $1 == "$RIC4" ]; then
-               G4_COUNT=$2
-               G4_A1_VERSION=$3
-       elif [ $1 == "$RIC5" ]; then
-               G5_COUNT=$2
-               G5_A1_VERSION=$3
-       else
-               ((RES_CONF_FAIL++))
-       __print_err "need three args, $RIC1|$RIC2|$RIC3|$RIC4|$RIC5 <count> <interface-id>" $@
-               exit 1
-       fi
-
-       # Create .env file to compose project, all ric container will get this prefix
-       echo "COMPOSE_PROJECT_NAME="$RIC_SIM_PREFIX > $SIM_GROUP/ric/.env
-
-       export G1_A1_VERSION
-       export G2_A1_VERSION
-       export G3_A1_VERSION
-       export G4_A1_VERSION
-       export G5_A1_VERSION
-
-       docker_args="--scale g1=$G1_COUNT --scale g2=$G2_COUNT --scale g3=$G3_COUNT --scale g4=$G4_COUNT --scale g5=$G5_COUNT"
-       app_data=""
-       cntr=1
-       while [ $cntr -le $2 ]; do
-               app=$1"_"$cntr
-               port=0
-               app_data="$app_data $app $port / "$RIC_SIM_HTTPX
-               let cntr=cntr+1
-       done
-       __start_container ric "$docker_args" $app_data
-
-}
-
-###########################
-### Control Panel functions
-###########################
-
-# Start the Control Panel container
-# args: -
-# (Function for test scripts)
-start_control_panel() {
-
-       echo -e $BOLD"Starting Control Panel"$EBOLD
-       __check_included_image 'CP'
-       if [ $? -eq 1 ]; then
-               echo -e $RED"The Control Panel image has not been checked for this test run due to arg to the test script"$ERED
-               echo -e $RED"The Control Panel will not be started"$ERED
-               exit
-       fi
-       __start_container control_panel NODOCKERARGS $CONTROL_PANEL_APP_NAME $CONTROL_PANEL_EXTERNAL_PORT "/" "http"
-
-}
-
-###########################
-### RAPP Catalogue
-###########################
-
-# Start the RAPP Catalogue container
-# args: -
-# (Function for test scripts)
-start_rapp_catalogue() {
-
-       echo -e $BOLD"Starting RAPP Catalogue"$EBOLD
-
-       __check_included_image 'RC'
-       if [ $? -eq 1 ]; then
-               echo -e $RED"The RAPP Catalogue image has not been checked for this test run due to arg to the test script"$ERED
-               echo -e $RED"The RAPP Catalogue will not be started"$ERED
-               exit
-       fi
-       __start_container rapp_catalogue NODOCKERARGS $RAPP_CAT_APP_NAME $RAPP_CAT_EXTERNAL_PORT "/services" "http"
-}
-
-use_rapp_catalogue_http() {
-       echo -e $BOLD"RAPP Catalogue protocol setting"$EBOLD
-       echo -e " Using $BOLD http $EBOLD towards the RAPP Catalogue"
-       export RAPP_CAT_HTTPX="http"
-       export RAPP_CAT_PORT=$RAPP_CAT_INTERNAL_PORT
-       export RAPP_CAT_LOCAL_PORT=$RAPP_CAT_EXTERNAL_PORT
-       echo ""
-}
-
-use_rapp_catalogue_https() {
-       echo -e $BOLD"RAPP Catalogue protocol setting"$EBOLD
-       echo -e " Using $BOLD https $EBOLD towards the RAPP Catalogue"
-       export RAPP_CAT_HTTPX="https"
-       export RAPP_CAT_PORT=$RAPP_CAT_INTERNAL_PORT
-       export RAPP_CAT_LOCAL_PORT=$RAPP_CAT_EXTERNAL_PORT
-       echo ""
-}
-
-##################
-### SDNC functions
-##################
-
-# Start the SDNC A1 Controller
-# args: -
-# (Function for test scripts)
-start_sdnc() {
-
-       echo -e $BOLD"Starting SDNC A1 Controller"$EBOLD
-
-       __check_included_image 'SDNC'
-       if [ $? -eq 1 ]; then
-               echo -e $RED"The image for SDNC and the related DB has not been checked for this test run due to arg to the test script"$ERED
-               echo -e $RED"SDNC will not be started"$ERED
-               exit
-       fi
-
-       __start_container sdnc NODOCKERARGS $SDNC_APP_NAME $SDNC_EXTERNAL_PORT $SDNC_ALIVE_URL "http"
-
-}
-
-use_sdnc_http() {
-       echo -e $BOLD"SDNC protocol setting"$EBOLD
-       echo -e " Using $BOLD http $EBOLD towards SDNC"
-       export SDNC_HTTPX="http"
-       export SDNC_PORT=$SDNC_INTERNAL_PORT
-       export SDNC_LOCAL_PORT=$SDNC_EXTERNAL_PORT
-       echo ""
-}
-
-use_sdnc_https() {
-       echo -e $BOLD"SDNC protocol setting"$EBOLD
-       echo -e " Using $BOLD https $EBOLD towards SDNC"
-       export SDNC_HTTPX="https"
-       export SDNC_PORT=$SDNC_INTERNAL_SECURE_PORT
-       export SDNC_LOCAL_PORT=$SDNC_EXTERNAL_SECURE_PORT
-       echo ""
-}
-
-#####################
-### MR stub functions
-#####################
-
-# Start the Message Router stub interface in the simulator group
-# args: -
-# (Function for test scripts)
-start_mr() {
-
-       echo -e $BOLD"Starting Message Router 'mrstub'"$EBOLD
-       __check_included_image 'MR'
-       if [ $? -eq 1 ]; then
-               echo -e $RED"The Message Router image has not been checked for this test run due to arg to the test script"$ERED
-               echo -e $RED"The Message Router will not be started"$ERED
-               exit
-       fi
-       export MR_CERT_MOUNT_DIR="./cert"
-       __start_container mr NODOCKERARGS $MR_APP_NAME $MR_EXTERNAL_PORT "/" "http"
-}
-
-use_mr_http() {
-       echo -e $BOLD"MR protocol setting"$EBOLD
-       echo -e " Using $BOLD http $EBOLD towards MR"
-       export MR_HTTPX="http"
-       export MR_PORT=$MR_INTERNAL_PORT
-       export MR_LOCAL_PORT=$MR_EXTERNAL_PORT
-       echo ""
-}
-
-use_mr_https() {
-       echo -e $BOLD"MR protocol setting"$EBOLD
-       echo -e " Using $BOLD https $EBOLD towards MR"
-       export MR_HTTPX="https"
-       export MR_PORT=$MR_INTERNAL_SECURE_PORT
-       export MR_LOCAL_PORT=$MR_EXTERNAL_SECURE_PORT
-       echo ""
-}
-
-
-################
-### CR functions
-################
-
-# Start the Callback reciver in the simulator group
-# args: -
-# (Function for test scripts)
-start_cr() {
-
-       echo -e $BOLD"Starting Callback Receiver"$EBOLD
-       __check_included_image 'CR'
-       if [ $? -eq 1 ]; then
-               echo -e $RED"The Callback Receiver image has not been checked for this test run due to arg to the test script"$ERED
-               echo -e $RED"The Callback Receiver will not be started"$ERED
-               exit
-       fi
-       __start_container cr NODOCKERARGS $CR_APP_NAME $CR_EXTERNAL_PORT "/" "http"
-
-}
-
-use_cr_http() {
-       echo -e $BOLD"CR protocol setting"$EBOLD
-       echo -e " Using $BOLD http $EBOLD towards CR"
-       export CR_HTTPX="http"
-       export CR_PORT=$CR_INTERNAL_PORT
-       export CR_LOCAL_PORT=$CR_EXTERNAL_PORT
-       export CR_PATH="$CR_HTTPX://$CR_APP_NAME:$CR_PORT$CR_APP_CALLBACK"
-       echo ""
-}
-
-use_cr_https() {
-       echo -e $BOLD"CR protocol setting"$EBOLD
-       echo -e " Using $BOLD https $EBOLD towards CR"
-       export CR_HTTPX="https"
-       export CR_PORT=$CR_INTERNAL_SECURE_PORT
-       export CR_LOCAL_PORT=$CR_EXTERNAL_SECURE_PORT
-       export CR_PATH="$CR_HTTPX://$CR_APP_NAME:$CR_PORT$CR_APP_CALLBACK"
-       echo ""
-}
-
-###########################
-### Producer stub functions
-###########################
-
-# Start the Producer stub in the simulator group
-# args: -
-# (Function for test scripts)
-start_prod_stub() {
-
-       echo -e $BOLD"Starting Producer stub"$EBOLD
-       __check_included_image 'PRODSTUB'
-       if [ $? -eq 1 ]; then
-               echo -e $RED"The Producer stub image has not been checked for this test run due to arg to the test script"$ERED
-               echo -e $RED"The Producer stub will not be started"$ERED
-               exit
-       fi
-       __start_container prodstub NODOCKERARGS $PROD_STUB_APP_NAME $PROD_STUB_EXTERNAL_PORT "/" "http"
-
-}
-
-use_prod_stub_http() {
-       echo -e $BOLD"Producer stub protocol setting"$EBOLD
-       echo -e " Using $BOLD http $EBOLD towards Producer stub"
-       export PROD_STUB_HTTPX="http"
-       export PROD_STUB_PORT=$PROD_STUB_INTERNAL_PORT
-       export PROD_STUB_LOCAL_PORT=$PROD_STUB_EXTERNAL_PORT
-       export PROD_STUB_LOCALHOST=$PROD_STUB_HTTPX"://localhost:"$PROD_STUB_LOCAL_PORT
-       echo ""
-}
-
-use_prod_stub_https() {
-       echo -e $BOLD"Producer stub protocol setting"$EBOLD
-       echo -e " Using $BOLD https $EBOLD towards Producer stub"
-       export PROD_STUB_HTTPX="https"
-       export PROD_STUB_PORT=$PROD_STUB_INTERNAL_SECURE_PORT
-       export PROD_STUB_LOCAL_PORT=$PROD_STUB_EXTERNAL_SECURE_PORT
-       export PROD_STUB_LOCALHOST=$PROD_STUB_HTTPX"://localhost:"$PROD_STUB_LOCAL_PORT
-       echo ""
-}
-
-###########################
-### Policy Agents functions
-###########################
-
-# Use an agent on the local machine instead of container
-use_agent_stand_alone() {
-       AGENT_STAND_ALONE=1
-}
-
-# Start the policy agent
-# args: -
-# (Function for test scripts)
-start_policy_agent() {
-
-       echo -e $BOLD"Starting Policy Agent"$EBOLD
-
-       if [ $AGENT_STAND_ALONE -eq 0 ]; then
-               __check_included_image 'PA'
-               if [ $? -eq 1 ]; then
-                       echo -e $RED"The Policy Agent image has not been checked for this test run due to arg to the test script"$ERED
-                       echo -e $RED"The Policy Agent will not be started"$ERED
-                       exit
-               fi
-               __start_container policy_agent NODOCKERARGS $POLICY_AGENT_APP_NAME $POLICY_AGENT_EXTERNAL_PORT "/status" "http"
+       if [ $RUNMODE == "KUBE" ]; then
+               ENTITY="service/set/deployment"
        else
-               echo -e $RED"The consul config produced by this test script (filename '<fullpath-to-autotest-dir>.output<file-name>"$ERED
-               echo -e $RED"where the file name is the file in the consul_config_app command in this script) must be pointed out by the agent "$ERED
-               echo -e $RED"application.yaml"$ERED
-               echo -e $RED"The application jar may need to be built before continuing"$ERED
-               echo -e $RED"The agent shall now be running on port $POLICY_AGENT_EXTERNAL_PORT for http"$ERED
-
-               read -p "<press any key to continue>"
-               __start_container policy_agent "STANDALONE" $POLICY_AGENT_APP_NAME $POLICY_AGENT_EXTERNAL_PORT "/status" "http"
-       fi
-
-}
-
-# All calls to the agent will be directed to the agent REST interface from now on
-# args: -
-# (Function for test scripts)
-use_agent_rest_http() {
-       echo -e $BOLD"Agent protocol setting"$EBOLD
-       echo -e " Using $BOLD http $EBOLD and $BOLD REST $EBOLD towards the agent"
-       export ADAPTER=$RESTBASE
-       echo ""
-}
-
-# All calls to the agent will be directed to the agent REST interface from now on
-# args: -
-# (Function for test scripts)
-use_agent_rest_https() {
-       echo -e $BOLD"Agent protocol setting"$EBOLD
-       echo -e " Using $BOLD https $EBOLD and $BOLD REST $EBOLD towards the agent"
-       export ADAPTER=$RESTBASE_SECURE
-       echo ""
-       return 0
-}
-
-# All calls to the agent will be directed to the agent dmaap interface over http from now on
-# args: -
-# (Function for test scripts)
-use_agent_dmaap_http() {
-       echo -e $BOLD"Agent dmaap protocol setting"$EBOLD
-       echo -e " Using $BOLD http $EBOLD and $BOLD DMAAP $EBOLD towards the agent"
-       export ADAPTER=$DMAAPBASE
-       echo ""
-       return 0
-}
-
-# All calls to the agent will be directed to the agent dmaap interface over https from now on
-# args: -
-# (Function for test scripts)
-use_agent_dmaap_https() {
-       echo -e $BOLD"Agent dmaap protocol setting"$EBOLD
-       echo -e " Using $BOLD https $EBOLD and $BOLD DMAAP $EBOLD towards the agent"
-       export ADAPTER=$DMAAPBASE_SECURE
-       echo ""
-       return 0
-}
-
-# Turn on debug level tracing in the agent
-# args: -
-# (Function for test scripts)
-set_agent_debug() {
-       echo -e $BOLD"Setting agent debug logging"$EBOLD
-       actuator="/actuator/loggers/org.oransc.policyagent"
-       if [[ $POLICY_AGENT_IMAGE = *"onap"* ]]; then
-               actuator="/actuator/loggers/org.onap.ccsdk.oran.a1policymanagementservice"
-       fi
-       curlString="$LOCALHOST$POLICY_AGENT_EXTERNAL_PORT$actuator -X POST  -H Content-Type:application/json -d {\"configuredLevel\":\"debug\"}"
-       result=$(__do_curl "$curlString")
-       if [ $? -ne 0 ]; then
-               __print_err "could not set debug mode" $@
-               ((RES_CONF_FAIL++))
-               return 1
-       fi
-       echo ""
-       return 0
-}
-
-# Turn on trace level tracing in the agent
-# args: -
-# (Function for test scripts)
-set_agent_trace() {
-       echo -e $BOLD"Setting agent trace logging"$EBOLD
-       actuator="/actuator/loggers/org.oransc.policyagent"
-       if [[ $POLICY_AGENT_IMAGE = *"onap"* ]]; then
-               actuator="/actuator/loggers/org.onap.ccsdk.oran.a1policymanagementservice"
-       fi
-       curlString="$LOCALHOST$POLICY_AGENT_EXTERNAL_PORT$actuator -X POST  -H Content-Type:application/json -d {\"configuredLevel\":\"trace\"}"
-       result=$(__do_curl "$curlString")
-       if [ $? -ne 0 ]; then
-               __print_err "could not set trace mode" $@
-               ((RES_CONF_FAIL++))
-               return 1
+               ENTITY="container"
        fi
-       echo ""
-       return 0
-}
-
-# Perform curl retries when making direct call to the agent for the specified http response codes
-# Speace separated list of http response codes
-# args: [<response-code>]*
-use_agent_retries() {
-       echo -e $BOLD"Do curl retries to the agent REST inteface for these response codes:$@"$EBOLD
-       AGENT_RETRY_CODES=$@
-       echo ""
-       return
-}
-
-###########################
-### ECS functions
-###########################
-
-# Start the ECS
-# args: -
-# (Function for test scripts)
-start_ecs() {
+       appname=$1
+       url=$2
+       echo -ne " Container $BOLD${appname}$EBOLD starting${SAMELINE}"
 
-       echo -e $BOLD"Starting ECS"$EBOLD
 
-       curdir=$PWD
-       cd $SIM_GROUP
-       cd ecs
-       cd $ECS_HOST_MNT_DIR
-       if [ -d database ]; then
-               if [ "$(ls -A $DIR)" ]; then
-                       echo -e $BOLD" Cleaning files in mounted dir: $PWD/database"$EBOLD
-                       rm -rf database/*  &> /dev/null
-                       if [ $? -ne 0 ]; then
-                               echo -e $RED" Cannot remove database files in: $PWD"$ERED
-                               exit 1
+       pa_st=false
+       echo -ne " Waiting for ${ENTITY} ${appname} service status...${SAMELINE}"
+       TSTART=$SECONDS
+       for i in {1..50}; do
+               result="$(__do_curl $url)"
+               if [ $? -eq 0 ]; then
+                       if [ ${#result} -gt 15 ]; then
+                               #If response is too long, truncate
+                               result="...response text too long, omitted"
                        fi
-               fi
-       else
-               echo " No files in mounted dir or dir does not exists"
-       fi
-       cd $curdir
-
-       __check_included_image 'ECS'
-       if [ $? -eq 1 ]; then
-               echo -e $RED"The ECS image has not been checked for this test run due to arg to the test script"$ERED
-               echo -e $RED"ECS will not be started"$ERED
-               exit
-       fi
-       export ECS_CERT_MOUNT_DIR="./cert"
-       __start_container ecs NODOCKERARGS $ECS_APP_NAME $ECS_EXTERNAL_PORT "/status" "http"
-}
-
-# Restart ECS
-# args: -
-# (Function for test scripts)
-restart_ecs() {
-       echo -e $BOLD"Re-starting ECS"$EBOLD
-       docker restart $ECS_APP_NAME &> ./tmp/.dockererr
-       if [ $? -ne 0 ]; then
-               __print_err "Could restart $ECS_APP_NAME" $@
-               cat ./tmp/.dockererr
-               ((RES_CONF_FAIL++))
-               return 1
-       fi
-
-       __check_container_start $ECS_APP_NAME $ECS_EXTERNAL_PORT "/status" "http"
-       echo ""
-       return 0
-}
-
-# All calls to ECS will be directed to the ECS REST interface from now on
-# args: -
-# (Function for test scripts)
-use_ecs_rest_http() {
-       echo -e $BOLD"ECS protocol setting"$EBOLD
-       echo -e " Using $BOLD http $EBOLD and $BOLD REST $EBOLD towards ECS"
-       export ECS_ADAPTER=$ECS_RESTBASE
-       echo ""
-}
-
-# All calls to ECS will be directed to the ECS REST interface from now on
-# args: -
-# (Function for test scripts)
-use_ecs_rest_https() {
-       echo -e $BOLD"ECS protocol setting"$EBOLD
-       echo -e " Using $BOLD https $EBOLD and $BOLD REST $EBOLD towards ECS"
-       export ECS_ADAPTER=$ECS_RESTBASE_SECURE
-       echo ""
-       return 0
-}
-
-# All calls to ECS will be directed to the ECS dmaap interface over http from now on
-# args: -
-# (Function for test scripts)
-use_ecs_dmaap_http() {
-       echo -e $BOLD"ECS dmaap protocol setting"$EBOLD
-       echo -e $RED" - NOT SUPPORTED - "$ERED
-       echo -e " Using $BOLD http $EBOLD and $BOLD DMAAP $EBOLD towards ECS"
-       export ECS_ADAPTER=$ECS_DMAAPBASE
-       echo ""
-       return 0
-}
-
-# All calls to ECS will be directed to the ECS dmaap interface over https from now on
-# args: -
-# (Function for test scripts)
-use_ecs_dmaap_https() {
-       echo -e $BOLD"RICSIM protocol setting"$EBOLD
-       echo -e $RED" - NOT SUPPORTED - "$ERED
-       echo -e " Using $BOLD https $EBOLD and $BOLD REST $EBOLD towards ECS"
-       export ECS_ADAPTER=$ECS_DMAAPBASE_SECURE
-       echo ""
-       return 0
-}
+                       echo -ne " Waiting for {ENTITY} $BOLD${appname}$EBOLD service status on ${3}, result: $result${SAMELINE}"
+                       echo -ne " The ${ENTITY} $BOLD${appname}$EBOLD$GREEN is alive$EGREEN, responds to service status:$GREEN $result $EGREEN on ${url} after $(($SECONDS-$TSTART)) seconds"
+                       pa_st=true
+                       break
+               else
+                       TS_TMP=$SECONDS
+                       while [ $(($TS_TMP+$i)) -gt $SECONDS ]; do
+                               echo -ne " Waiting for ${ENTITY} ${appname} service status on ${url}...$(($SECONDS-$TSTART)) seconds, retrying in $(($TS_TMP+$i-$SECONDS)) seconds   ${SAMELINE}"
+                               sleep 1
+                       done
+               fi
+       done
 
-# Turn on debug level tracing in ECS
-# args: -
-# (Function for test scripts)
-set_ecs_debug() {
-       echo -e $BOLD"Setting ecs debug logging"$EBOLD
-       curlString="$LOCALHOST$ECS_EXTERNAL_PORT/actuator/loggers/org.oransc.enrichment -X POST  -H Content-Type:application/json -d {\"configuredLevel\":\"debug\"}"
-       result=$(__do_curl "$curlString")
-       if [ $? -ne 0 ]; then
-               __print_err "Could not set debug mode" $@
+       if [ "$pa_st" = "false"  ]; then
                ((RES_CONF_FAIL++))
+               echo -e $RED" The ${ENTITY} ${appname} did not respond to service status on ${url} in $(($SECONDS-$TSTART)) seconds"$ERED
                return 1
        fi
-       echo ""
-       return 0
-}
 
-# Turn on trace level tracing in ECS
-# args: -
-# (Function for test scripts)
-set_ecs_trace() {
-       echo -e $BOLD"Setting ecs trace logging"$EBOLD
-       curlString="$LOCALHOST$ECS_EXTERNAL_PORT/actuator/loggers/org.oransc.enrichment -X POST  -H Content-Type:application/json -d {\"configuredLevel\":\"trace\"}"
-       result=$(__do_curl "$curlString")
-       if [ $? -ne 0 ]; then
-               __print_err "Could not set trace mode" $@
-               ((RES_CONF_FAIL++))
-               return 1
-       fi
        echo ""
        return 0
 }
 
-# Perform curl retries when making direct call to ECS for the specified http response codes
-# Speace separated list of http response codes
-# args: [<response-code>]*
-use_agent_retries() {
-       echo -e $BOLD"Do curl retries to the ECS REST inteface for these response codes:$@"$EBOLD
-       ECS_AGENT_RETRY_CODES=$@
-       echo ""
-       return
-}
 
 #################
 ### Log functions
@@ -2206,6 +2398,7 @@ check_sdnc_logs() {
 }
 
 __check_container_logs() {
+
        dispname=$1
        appname=$2
        logpath=$3
@@ -2214,6 +2407,11 @@ __check_container_logs() {
 
        echo -e $BOLD"Checking $dispname container $appname log ($logpath) for WARNINGs and ERRORs"$EBOLD
 
+       if [ $RUNMODE == "KUBE" ]; then
+               echo -e $YELLOW" Internal log for $dispname not checked in kube"$EYELLOW
+               return
+       fi
+
        #tmp=$(docker ps | grep $appname)
        tmp=$(docker ps -q --filter name=$appname) #get the container id
        if [ -z "$tmp" ]; then  #Only check logs for running Policy Agent apps
@@ -2257,63 +2455,83 @@ store_logs() {
 
        docker stats --no-stream > $TESTLOGS/$ATC/$1_docker_stats.log 2>&1
 
-       __check_included_image 'CONSUL'
-       if [ $? -eq 0 ]; then
-               docker logs $CONSUL_APP_NAME > $TESTLOGS/$ATC/$1_consul.log 2>&1
-       fi
+       docker ps -a  > $TESTLOGS/$ATC/$1_docker_ps.log 2>&1
 
-       __check_included_image 'CBS'
-       if [ $? -eq 0 ]; then
-               docker logs $CBS_APP_NAME > $TESTLOGS/$ATC/$1_cbs.log 2>&1
-               body="$(__do_curl $LOCALHOST$CBS_EXTERNAL_PORT/service_component_all/$POLICY_AGENT_APP_NAME)"
-               echo "$body" > $TESTLOGS/$ATC/$1_consul_config.json 2>&1
-       fi
+       cp .httplog_${ATC}.txt $TESTLOGS/$ATC/$1_httplog_${ATC}.txt 2>&1
 
-       __check_included_image 'PA'
-       if [ $? -eq 0 ]; then
-               docker logs $POLICY_AGENT_APP_NAME > $TESTLOGS/$ATC/$1_policy-agent.log 2>&1
-       fi
+       if [ $RUNMODE == "DOCKER" ]; then
+               __check_included_image 'CONSUL'
+               if [ $? -eq 0 ]; then
+                       docker logs $CONSUL_APP_NAME > $TESTLOGS/$ATC/$1_consul.log 2>&1
+               fi
 
-       __check_included_image 'ECS'
-       if [ $? -eq 0 ]; then
-               docker logs $ECS_APP_NAME > $TESTLOGS/$ATC/$1_ecs.log 2>&1
-       fi
+               __check_included_image 'CBS'
+               if [ $? -eq 0 ]; then
+                       docker logs $CBS_APP_NAME > $TESTLOGS/$ATC/$1_cbs.log 2>&1
+                       body="$(__do_curl $LOCALHOST_HTTP:$CBS_EXTERNAL_PORT/service_component_all/$POLICY_AGENT_APP_NAME)"
+                       echo "$body" > $TESTLOGS/$ATC/$1_consul_config.json 2>&1
+               fi
 
-       __check_included_image 'CP'
-       if [ $? -eq 0 ]; then
-               docker logs $CONTROL_PANEL_APP_NAME > $TESTLOGS/$ATC/$1_control-panel.log 2>&1
-       fi
+               __check_included_image 'PA'
+               if [ $? -eq 0 ]; then
+                       docker logs $POLICY_AGENT_APP_NAME > $TESTLOGS/$ATC/$1_policy-agent.log 2>&1
+               fi
 
-       __check_included_image 'MR'
-       if [ $? -eq 0 ]; then
-               docker logs $MR_APP_NAME > $TESTLOGS/$ATC/$1_mr.log 2>&1
-       fi
+               __check_included_image 'ECS'
+               if [ $? -eq 0 ]; then
+                       docker logs $ECS_APP_NAME > $TESTLOGS/$ATC/$1_ecs.log 2>&1
+               fi
 
-       __check_included_image 'CR'
-       if [ $? -eq 0 ]; then
-               docker logs $CR_APP_NAME > $TESTLOGS/$ATC/$1_cr.log 2>&1
-       fi
+               __check_included_image 'CP'
+               if [ $? -eq 0 ]; then
+                       docker logs $CONTROL_PANEL_APP_NAME > $TESTLOGS/$ATC/$1_control-panel.log 2>&1
+               fi
 
-       cp .httplog_${ATC}.txt $TESTLOGS/$ATC/$1_httplog_${ATC}.txt 2>&1
+               __check_included_image 'MR'
+               if [ $? -eq 0 ]; then
+                       docker logs $MR_STUB_APP_NAME > $TESTLOGS/$ATC/$1_mr_stub.log 2>&1
+               fi
 
-       __check_included_image 'SDNC'
-       if [ $? -eq 0 ]; then
-               docker exec -t $SDNC_APP_NAME cat $SDNC_KARAF_LOG> $TESTLOGS/$ATC/$1_SDNC_karaf.log 2>&1
-       fi
+               __check_included_image 'DMAAPSMR'
+               if [ $? -eq 0 ]; then
+                       docker logs $MR_DMAAP_APP_NAME > $TESTLOGS/$ATC/$1_mr.log 2>&1
+                       docker logs $MR_KAFKA_APP_NAME > $TESTLOGS/$ATC/$1_mr_kafka.log 2>&1
+                       docker logs $MR_ZOOKEEPER_APP_NAME > $TESTLOGS/$ATC/$1_mr_zookeeper.log 2>&1
 
-       __check_included_image 'RICSIM'
-       if [ $? -eq 0 ]; then
-               rics=$(docker ps -f "name=$RIC_SIM_PREFIX" --format "{{.Names}}")
-               for ric in $rics; do
-                       docker logs $ric > $TESTLOGS/$ATC/$1_$ric.log 2>&1
-               done
-       fi
+               fi
 
-       __check_included_image 'PRODSTUB'
-       if [ $? -eq 0 ]; then
-               docker logs $PROD_STUB_APP_NAME > $TESTLOGS/$ATC/$1_prodstub.log 2>&1
-       fi
+               __check_included_image 'CR'
+               if [ $? -eq 0 ]; then
+                       docker logs $CR_APP_NAME > $TESTLOGS/$ATC/$1_cr.log 2>&1
+               fi
+
+               __check_included_image 'SDNC'
+               if [ $? -eq 0 ]; then
+                       docker exec -t $SDNC_APP_NAME cat $SDNC_KARAF_LOG> $TESTLOGS/$ATC/$1_SDNC_karaf.log 2>&1
+               fi
+
+               __check_included_image 'RICSIM'
+               if [ $? -eq 0 ]; then
+                       rics=$(docker ps -f "name=$RIC_SIM_PREFIX" --format "{{.Names}}")
+                       for ric in $rics; do
+                               docker logs $ric > $TESTLOGS/$ATC/$1_$ric.log 2>&1
+                       done
+               fi
 
+               __check_included_image 'PRODSTUB'
+               if [ $? -eq 0 ]; then
+                       docker logs $PROD_STUB_APP_NAME > $TESTLOGS/$ATC/$1_prodstub.log 2>&1
+               fi
+       fi
+       if [ $RUNMODE == "KUBE" ]; then
+               namespaces=$(kubectl  get namespaces -o jsonpath='{.items[?(@.metadata.name)].metadata.name}')
+               for nsid in $namespaces; do
+                       pods=$(kubectl get pods -n $nsid -o jsonpath='{.items[?(@.metadata.labels.autotest)].metadata.name}')
+                       for podid in $pods; do
+                               kubectl logs -n $nsid $podid > $TESTLOGS/$ATC/$1_${podid}.log
+                       done
+               done
+       fi
        echo ""
 }
 
@@ -2476,55 +2694,3 @@ __var_test() {
                exit 1
        fi
 }
-
-
-### Generic test cases for varaible checking
-
-# Tests if a variable value in the MR stub is equal to a target value and and optional timeout.
-# Arg: <variable-name> <target-value> - This test set pass or fail depending on if the variable is
-# equal to the target or not.
-# Arg: <variable-name> <target-value> <timeout-in-sec>  - This test waits up to the timeout seconds
-# before setting pass or fail depending on if the variable value becomes equal to the target
-# value or not.
-# (Function for test scripts)
-mr_equal() {
-       if [ $# -eq 2 ] || [ $# -eq 3 ]; then
-               __var_test "MR" "$LOCALHOST$MR_EXTERNAL_PORT/counter/" $1 "=" $2 $3
-       else
-               ((RES_CONF_FAIL++))
-               __print_err "Wrong args to mr_equal, needs two or three args: <sim-param> <target-value> [ timeout ]" $@
-       fi
-}
-
-# Tests if a variable value in the MR stub is greater than a target value and and optional timeout.
-# Arg: <variable-name> <target-value> - This test set pass or fail depending on if the variable is
-# greater than the target or not.
-# Arg: <variable-name> <target-value> <timeout-in-sec>  - This test waits up to the timeout seconds
-# before setting pass or fail depending on if the variable value becomes greater than the target
-# value or not.
-# (Function for test scripts)
-mr_greater() {
-       if [ $# -eq 2 ] || [ $# -eq 3 ]; then
-               __var_test "MR" "$LOCALHOST$MR_EXTERNAL_PORT/counter/" $1 ">" $2 $3
-       else
-               ((RES_CONF_FAIL++))
-               __print_err "Wrong args to mr_greater, needs two or three args: <sim-param> <target-value> [ timeout ]" $@
-       fi
-}
-
-# Read a variable value from MR sim and send to stdout. Arg: <variable-name>
-mr_read() {
-       echo "$(__do_curl $LOCALHOST$MR_EXTERNAL_PORT/counter/$1)"
-}
-
-# Print a variable value from the MR stub.
-# arg: <variable-name>
-# (Function for test scripts)
-mr_print() {
-       if [ $# != 1 ]; then
-               ((RES_CONF_FAIL++))
-       __print_err "need one arg, <mr-param>" $@
-               exit 1
-       fi
-       echo -e $BOLD"INFO(${BASH_LINENO[0]}): mrstub, $1 = $(__do_curl $LOCALHOST$MR_EXTERNAL_PORT/counter/$1)"$EBOLD
-}
index 75b23f1..db13fc0 100644 (file)
@@ -24,8 +24,10 @@ import json
 from flask import Flask
 from flask import Response
 import traceback
-from threading import RLock
+from threading import RLock, Thread
 import logging
+import os
+import requests
 
 # Disable all logging of GET on reading counters
 class AjaxFilter(logging.Filter):
@@ -61,6 +63,89 @@ MIME_JSON="application/json"
 CAUGHT_EXCEPTION="Caught exception: "
 SERVER_ERROR="Server error :"
 
+topic_write=""
+topic_read=""
+
+uploader_thread=None
+downloader_thread=None
+
+# Function to download messages from dmaap
+def dmaap_uploader():
+    global msg_requests
+    global cntr_msg_requests_fetched
+
+    print("Starting uploader")
+
+    headers = {'Content-type': 'application/json', 'Accept': '*/*'}
+    #url="http://"+topic_host+"/events/"+topic_read
+    url=topic_read
+
+    while True:
+        while (len(msg_requests)>0):
+            msg=msg_requests[0]
+            if msg is not None:
+                try:
+                    print("Sending to dmaap : "+ url)
+                    print("Sending to dmaap : "+ msg)
+                    resp=requests.post(url, data=msg, headers=headers, timeout=10)
+                    if (resp.status_code<199 & resp.status_code > 299):
+                        print("Failed, response code: " + str(resp.status_code))
+                        sleep(1)
+                    else:
+                        print("Dmaap response code: " + str(resp.status_code))
+                        print("Dmaap response text: " + str(resp.text))
+                        with lock:
+                            msg_requests.pop(0)
+                            cntr_msg_requests_fetched += 1
+                except Exception as e:
+                    print("Failed, exception: "+ str(e))
+                    sleep(1)
+        sleep(0.01)
+
+
+# Function to download messages from dmaap
+def dmaap_downloader():
+    global msg_responses
+    global cntr_msg_responses_submitted
+
+    print("Starting uploader")
+
+    while True:
+
+        try :
+            #url="http://"+topic_host+"/events/"+topic_write+"/users/mr-stub?timeout=15000&limit=100"
+            url=topic_write
+            headers = {'Accept': 'application/json'}
+            print("Reading from dmaap: " + url)
+            resp=requests.get(url, headers=headers)
+            if (resp.status_code<199 & resp.status_code > 299):
+                print("Failed, response code: " + resp.status_code)
+                sleep(1)
+            else:
+                print("Recieved data from dmaap mr")
+                try:
+                    data=resp.json()
+                    print("Recieved data (raw): " + str(resp.text))
+                    if isinstance(data, list):
+                        for item in data:
+                            item=json.loads(item)
+                            corrid=str(item["correlationId"])
+                            status=str(item["status"])
+                            msg=str(item["message"])
+                            item_str=msg+status[0:3]
+                            with lock:
+                                msg_responses[corrid]=item_str
+                                cntr_msg_responses_submitted += 1
+                    else:
+                        print("Data from dmaap is not json array: " + str(resp.text))
+                        sleep(1)
+                except Exception as e:
+                    print("Corrupt data from dmaap mr -  dropping " + str(data))
+                    print("CAUGHT_EXCEPTION" + str(e) + " "+traceback.format_exc())
+                    sleep(1)
+        except Exception as e:
+            sleep(1)
+
 #I'm alive function
 @app.route('/',
     methods=['GET'])
@@ -134,19 +219,19 @@ def receiveresponse():
     with lock:
         print("APP_READ_URL lock")
         try:
-            id=request.args.get('correlationid')
-            if (id is None):
+            cid=request.args.get('correlationid')
+            if (cid is None):
                 print(APP_READ_URL+" parameter 'correclationid' missing")
                 return Response('Parameter correlationid missing in json', status=500, mimetype=MIME_TEXT)
 
-            if (id in msg_responses):
-                answer=msg_responses[id]
-                del msg_responses[id]
-                print(APP_READ_URL+" response (correlationid="+id+"): " + answer)
+            if (cid in msg_responses):
+                answer=msg_responses[cid]
+                del msg_responses[cid]
+                print(APP_READ_URL+" response (correlationid="+cid+"): " + answer)
                 cntr_msg_responses_fetched += 1
                 return Response(answer, status=200, mimetype=MIME_JSON)
 
-            print(APP_READ_URL+" - no messages (correlationid="+id+"): ")
+            print(APP_READ_URL+" - no messages (correlationid="+cid+"): ")
             return Response('', status=204, mimetype=MIME_JSON)
         except Exception as e:
             print(APP_READ_URL+"-"+CAUGHT_EXCEPTION+" "+str(e) + " "+traceback.format_exc())
@@ -163,6 +248,9 @@ def events_read():
     global msg_requests
     global cntr_msg_requests_fetched
 
+    if topic_write or topic_read:
+        return Response('Url not available when running as mrstub frontend', status=404, mimetype=MIME_TEXT)
+
     limit=request.args.get('limit')
     if (limit is None):
         limit=4096
@@ -180,10 +268,10 @@ def events_read():
     else:
         timeout=min(int(timeout),60000)
 
-    startTime=int(round(time.time() * 1000))
-    currentTime=int(round(time.time() * 1000))
+    start_time=int(round(time.time() * 1000))
+    current_time=int(round(time.time() * 1000))
 
-    while(currentTime<startTime+int(timeout)):
+    while(current_time<start_time+int(timeout)):
         with lock:
             if(len(msg_requests)>0):
                 try:
@@ -202,9 +290,9 @@ def events_read():
                     print(AGENT_READ_URL+"-"+CAUGHT_EXCEPTION+" "+str(e) + " "+traceback.format_exc())
                     return Response(SERVER_ERROR+" "+str(e), status=500, mimetype=MIME_TEXT)
         sleep(0.025) # sleep 25 milliseconds
-        currentTime=int(round(time.time() * 1000))
+        current_time=int(round(time.time() * 1000))
 
-    print("timeout: "+str(timeout)+", startTime: "+str(startTime)+", currentTime: "+str(currentTime))
+    print("timeout: "+str(timeout)+", start_time: "+str(start_time)+", current_time: "+str(current_time))
     return Response("[]", status=200, mimetype=MIME_JSON)
 
 # Write messages stream. URI according to agent configuration.
@@ -215,6 +303,10 @@ def events_read():
 def events_write():
     global msg_responses
     global cntr_msg_responses_submitted
+
+    if topic_write or topic_read:
+        return Response('Url not available when running as mrstub frontend', status=404, mimetype=MIME_TEXT)
+
     with lock:
         print("AGENT_WRITE_URL lock")
         try:
@@ -227,8 +319,8 @@ def events_write():
                 answer=answer_list
 
             for item in answer:
-                id=item['correlationId']
-                if (id is None):
+                cid=item['correlationId']
+                if (cid is None):
                     print(AGENT_WRITE_URL+" parameter 'correlatonid' missing")
                     return Response('Parameter <correlationid> missing in json', status=400, mimetype=MIME_TEXT)
                 msg=item['message']
@@ -243,9 +335,9 @@ def events_write():
                     msg_str=json.dumps(msg)+status[0:3]
                 else:
                     msg_str=msg+status[0:3]
-                msg_responses[id]=msg_str
+                msg_responses[cid]=msg_str
                 cntr_msg_responses_submitted += 1
-                print(AGENT_WRITE_URL+ " msg+status (correlationid="+id+") :" + str(msg_str))
+                print(AGENT_WRITE_URL+ " msg+status (correlationid="+cid+") :" + str(msg_str))
         except Exception as e:
             print(AGENT_WRITE_URL+"-"+CAUGHT_EXCEPTION+" "+str(e) + " "+traceback.format_exc())
             return Response('{"message": "' + SERVER_ERROR + ' ' + str(e) + '","status":"500"}', status=200, mimetype=MIME_JSON)
@@ -306,5 +398,27 @@ def reset():
     msg_responses={}
     return Response('OK', status=200, mimetype=MIME_TEXT)
 
+# Get env vars, if present
+if os.getenv("TOPIC_READ") is not None:
+
+    print("Env variables:")
+    print("TOPIC_READ:"+os.environ['TOPIC_READ'])
+    print("TOPIC_WRITE:"+os.environ['TOPIC_WRITE'])
+
+    topic_read=os.environ['TOPIC_READ']
+    topic_write=os.environ['TOPIC_WRITE']
+
+
+    if topic_read and downloader_thread is None:
+        downloader_thread=Thread(target=dmaap_downloader)
+        downloader_thread.start()
+
+    if topic_write and uploader_thread is None:
+        uploader_thread=Thread(target=dmaap_uploader)
+        uploader_thread.start()
+
+else:
+    print("No env variables - OK")
+
 if __name__ == "__main__":
     app.run(port=HOST_PORT, host=HOST_IP)
\ No newline at end of file
index 60b1dd9..c548e56 100644 (file)
@@ -28,10 +28,10 @@ http {
     default_type application/octet-stream;
 
     server { # simple reverse-proxy
-        listen      3905;
-        listen      [::]:3905;
-        listen      3906 ssl;
-        listen      [::]:3906 ssl;
+        listen      3904;
+        listen      [::]:3904;
+        listen      3905 ssl;
+        listen      [::]:3905 ssl;
         server_name  localhost;
         ssl_certificate     /usr/src/app/cert/cert.crt;
         ssl_certificate_key /usr/src/app/cert/key.crt;
index 8fd414f..8c3d61f 100644 (file)
@@ -1,2 +1,3 @@
 pip==20.1
-Flask==1.1.2
\ No newline at end of file
+Flask==1.1.2
+requests==2.25.1
\ No newline at end of file
index 8b2347d..dbd4297 100755 (executable)
@@ -31,12 +31,12 @@ fi
 
 if [ $1 == "nonsecure" ]; then
     #Default http port for the simulator
-    PORT=3905
+    PORT=3904
     # Set http protocol
     HTTPX="http"
 else
     #Default https port for the mr-stub
-    PORT=3906
+    PORT=3905
     # Set https protocol
     HTTPX="https"
 fi
index 8ad1d16..c9f70a1 100755 (executable)
@@ -21,4 +21,4 @@
 
 docker build --build-arg NEXUS_PROXY_REPO=nexus3.onap.org:10001/  -t mrstub .
 
-docker run --rm -it -p 3905:3905 -p 3906:3906 -v "$PWD/cert:/usr/src/app/cert" mrstub
+docker run --rm -it -p 3904:3904 -p 3905:3905 -v "$PWD/cert:/usr/src/app/cert" mrstub
diff --git a/test/simulator-group/control_panel/app.yaml b/test/simulator-group/control_panel/app.yaml
new file mode 100644 (file)
index 0000000..a962f3d
--- /dev/null
@@ -0,0 +1,37 @@
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: $CONTROL_PANEL_APP_NAME
+  namespace: $KUBE_NONRTRIC_NAMESPACE
+  labels:
+    run: $CONTROL_PANEL_APP_NAME
+    autotest: CP
+spec:
+  replicas: 1
+  selector:
+    matchLabels:
+      run: $CONTROL_PANEL_APP_NAME
+  template:
+    metadata:
+      labels:
+        run: $CONTROL_PANEL_APP_NAME
+        autotest: CP
+    spec:
+      containers:
+      - name: $CONTROL_PANEL_APP_NAME
+        image: $CONTROL_PANEL_IMAGE
+        imagePullPolicy: Never
+        ports:
+        - name: http
+          containerPort: $CONTROL_PANEL_INTERNAL_PORT
+        - name: https
+          containerPort: $CONTROL_PANEL_INTERNAL_SECURE_PORT
+        volumeMounts:
+        - mountPath: $CONTROL_PANEL_CONFIG_MOUNT_PATH/$CONTROL_PANEL_CONFIG_FILE
+          subPath: $CONTROL_PANEL_CONFIG_FILE
+          name: cp-conf-name
+      volumes:
+      - configMap:
+          defaultMode: 420
+          name: $CP_CONFIG_CONFIGMAP_NAME
+        name: cp-conf-name
\ No newline at end of file
diff --git a/test/simulator-group/control_panel/application.properties b/test/simulator-group/control_panel/application.properties
new file mode 100644 (file)
index 0000000..2fc7093
--- /dev/null
@@ -0,0 +1,37 @@
+################################################################################
+#   Copyright (c) 2020 Nordix Foundation.                                      #
+#                                                                              #
+#   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.                                             #
+################################################################################
+server.port = 8082
+server.ssl.key-store-type = PKCS12
+server.ssl.key-store-password = ericsson_kwdjfhw
+server.ssl.key-store =  classpath:keystore.jks
+server.ssl.key-password = ericsson_kwdjfhw
+server.http.port = 8080
+# https api
+policycontroller.url.prefix = https://${POLICY_AGENT_DOMAIN_NAME}:${POLICY_AGENT_EXTERNAL_SECURE_PORT}
+
+userfile = users.json
+portalapi.decryptor = org.oransc.portal.nonrtric.controlpanel.portalapi.PortalSdkDecryptorAes
+portalapi.usercookie = UserId
+portalapi.security = false
+portalapi.appname = Non-RT RIC Control Panel
+portalapi.username = Default
+portalapi.password = password
+
+# URL for enrichment coordinator service
+enrichmentcontroller.url.prefix = https://${ECS_DOMAIN_NAME}:${ECS_EXTERNAL_SECURE_PORT}/ei-producer/v1
+
+# Mimic slow endpoints by defining sleep period, in milliseconds
+mock.config.delay = 0
index 4e86f3c..0d603a0 100644 (file)
@@ -18,7 +18,7 @@ version: '3.0'
 networks:
   default:
     external:
-      name: nonrtric-docker-net
+      name: ${DOCKER_SIM_NWNAME}
 services:
   control-panel:
     image: ${CONTROL_PANEL_IMAGE}
@@ -27,6 +27,6 @@ services:
       - default
     ports:
     - ${CONTROL_PANEL_EXTERNAL_PORT}:${CONTROL_PANEL_INTERNAL_PORT}
-
+    - ${CONTROL_PANEL_EXTERNAL_SECURE_PORT}:${CONTROL_PANEL_INTERNAL_SECURE_PORT}
 
 
diff --git a/test/simulator-group/control_panel/svc.yaml b/test/simulator-group/control_panel/svc.yaml
new file mode 100644 (file)
index 0000000..85a4682
--- /dev/null
@@ -0,0 +1,21 @@
+apiVersion: v1
+kind: Service
+metadata:
+  name: $CONTROL_PANEL_APP_NAME
+  namespace: $KUBE_NONRTRIC_NAMESPACE
+  labels:
+    run: $CONTROL_PANEL_APP_NAME
+    autotest: CP
+spec:
+  type: ClusterIP
+  ports:
+  - port: $CONTROL_PANEL_EXTERNAL_PORT
+    targetPort: $CONTROL_PANEL_INTERNAL_PORT
+    protocol: TCP
+    name: http
+  - port: $CONTROL_PANEL_EXTERNAL_SECURE_PORT
+    targetPort: $CONTROL_PANEL_INTERNAL_SECURE_PORT
+    protocol: TCP
+    name: https
+  selector:
+    run: $CONTROL_PANEL_APP_NAME
\ No newline at end of file
diff --git a/test/simulator-group/cr/app.yaml b/test/simulator-group/cr/app.yaml
new file mode 100644 (file)
index 0000000..3497b88
--- /dev/null
@@ -0,0 +1,28 @@
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: $CR_APP_NAME
+  namespace: $KUBE_SIM_NAMESPACE
+  labels:
+    run: $CR_APP_NAME
+    autotest: CR
+spec:
+  replicas: 1
+  selector:
+    matchLabels:
+      run: $CR_APP_NAME
+  template:
+    metadata:
+      labels:
+        run: $CR_APP_NAME
+        autotest: CR
+    spec:
+      containers:
+      - name: $CR_APP_NAME
+        image: $CR_IMAGE
+        imagePullPolicy: Never
+        ports:
+        - name: http
+          containerPort: $CR_INTERNAL_PORT
+        - name: https
+          containerPort: $CR_INTERNAL_SECURE_PORT
diff --git a/test/simulator-group/cr/svc.yaml b/test/simulator-group/cr/svc.yaml
new file mode 100644 (file)
index 0000000..43e532b
--- /dev/null
@@ -0,0 +1,21 @@
+apiVersion: v1
+kind: Service
+metadata:
+  name: $CR_APP_NAME
+  namespace: $KUBE_SIM_NAMESPACE
+  labels:
+    run: $CR_APP_NAME
+    autotest: CR
+spec:
+  type: ClusterIP
+  ports:
+  - port: $CR_EXTERNAL_PORT
+    targetPort: $CR_INTERNAL_PORT
+    protocol: TCP
+    name: http
+  - port: $CR_EXTERNAL_SECURE_PORT
+    targetPort: $CR_INTERNAL_SECURE_PORT
+    protocol: TCP
+    name: https
+  selector:
+    run: $CR_APP_NAME
\ No newline at end of file
diff --git a/test/simulator-group/dmaapmr/app.yaml b/test/simulator-group/dmaapmr/app.yaml
new file mode 100644 (file)
index 0000000..50e6943
--- /dev/null
@@ -0,0 +1,178 @@
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: $MR_DMAAP_KUBE_APP_NAME
+  namespace: $KUBE_ONAP_NAMESPACE
+  labels:
+    run: $MR_DMAAP_KUBE_APP_NAME
+    autotest: DMAAPMR
+spec:
+  replicas: 1
+  selector:
+    matchLabels:
+      run: $MR_DMAAP_KUBE_APP_NAME
+  template:
+    metadata:
+      labels:
+        run: $MR_DMAAP_KUBE_APP_NAME
+        autotest: DMAAPMR
+    spec:
+      containers:
+      - name: $MR_DMAAP_KUBE_APP_NAME
+        image: $ONAP_DMAAPMR_IMAGE
+        imagePullPolicy: Never
+        ports:
+        - name: http
+          containerPort: $MR_INTERNAL_PORT
+        - name: https
+          containerPort: $MR_INTERNAL_SECURE_PORT
+        env:
+        - name: enableCadi
+          value: 'false'
+        volumeMounts:
+        - mountPath: /appl/dmaapMR1/bundleconfig/etc/appprops/MsgRtrApi.properties
+          subPath: MsgRtrApi.properties
+          name: dmaapmr-msg-rtr-api
+        volumeMounts:
+        - mountPath: /appl/dmaapMR1/bundleconfig/etc/logback.xml
+          subPath: logback.xml
+          name: dmaapmr-log-back
+        volumeMounts:
+        - mountPath: /appl/dmaapMR1/etc/cadi.properties
+          subPath: cadi.properties
+          name: dmaapmr-cadi
+      volumes:
+      - configMap:
+          defaultMode: 420
+          name: dmaapmr-msgrtrapi.properties
+        name: dmaapmr-msg-rtr-api
+      - configMap:
+          defaultMode: 420
+          name: dmaapmr-logback.xml
+        name: dmaapmr-log-back
+      - configMap:
+          defaultMode: 420
+          name: dmaapmr-cadi.properties
+        name: dmaapmr-cadi
+---
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: $MR_KAFKA_BWDS_NAME
+  namespace: $KUBE_ONAP_NAMESPACE
+  labels:
+    run: $MR_KAFKA_BWDS_NAME
+    autotest: DMAAPMR
+spec:
+  replicas: 1
+  selector:
+    matchLabels:
+      run: $MR_KAFKA_BWDS_NAME
+  template:
+    metadata:
+      labels:
+        run: $MR_KAFKA_BWDS_NAME
+        autotest: DMAAPMR
+    spec:
+      containers:
+      - name: $MR_KAFKA_BWDS_NAME
+        image: $ONAP_KAFKA_IMAGE
+        imagePullPolicy: Never
+        ports:
+        - name: http
+          containerPort: 9092
+        env:
+        - name: enableCadi
+          value: 'false'
+        - name: KAFKA_ZOOKEEPER_CONNECT
+          value: 'zookeeper.onap:2181'
+        - name: KAFKA_ZOOKEEPER_CONNECTION_TIMEOUT_MS
+          value: '40000'
+        - name: KAFKA_ZOOKEEPER_SESSION_TIMEOUT_MS
+          value: '40000'
+        - name: KAFKA_LISTENER_SECURITY_PROTOCOL_MAP
+          value: 'INTERNAL_PLAINTEXT:PLAINTEXT,EXTERNAL_PLAINTEXT:PLAINTEXT'
+#        - name: KAFKA_ADVERTISED_LISTENERS
+#          value: 'INTERNAL_PLAINTEXT://akfak-bwds.onap:9092'
+        - name: KAFKA_ADVERTISED_LISTENERS
+          value: 'INTERNAL_PLAINTEXT://localhost:9092'
+        - name: KAFKA_LISTENERS
+          value: 'INTERNAL_PLAINTEXT://0.0.0.0:9092'
+        - name: KAFKA_INTER_BROKER_LISTENER_NAME
+          value: INTERNAL_PLAINTEXT
+        - name: KAFKA_CONFLUENT_SUPPORT_METRICS_ENABLE
+          value: 'false'
+        - name: KAFKA_OPTS
+          value: '-Djava.security.auth.login.config=/etc/kafka/secrets/jaas/zk_client_jaas.conf'
+        - name: KAFKA_ZOOKEEPER_SET_ACL
+          value: 'true'
+        - name: KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR
+          value: '1'
+        - name: KAFKA_OFFSETS_TOPIC_NUM_PARTITIONS
+          value: '1'
+        volumeMounts:
+        - mountPath: /etc/kafka/secrets/jaas/zk_client_jaas.conf
+          subPath: zk_client_jaas.conf
+          name: dmaapmr-zk-client-jaas
+      volumes:
+      - configMap:
+          defaultMode: 420
+          name: dmaapmr-zk-client-jaas.conf
+        name: dmaapmr-zk-client-jaas
+---
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: $MR_ZOOKEEPER_APP_NAME
+  namespace: $KUBE_ONAP_NAMESPACE
+  labels:
+    run: $MR_ZOOKEEPER_APP_NAME
+    autotest: DMAAPMR
+spec:
+  replicas: 1
+  selector:
+    matchLabels:
+      run: $MR_ZOOKEEPER_APP_NAME
+  template:
+    metadata:
+      labels:
+        run: $MR_ZOOKEEPER_APP_NAME
+        autotest: DMAAPMR
+    spec:
+      containers:
+      - name: $MR_ZOOKEEPER_APP_NAME
+        image: $ONAP_ZOOKEEPER_IMAGE
+        imagePullPolicy: Never
+        ports:
+        - name: http
+          containerPort: 2181
+        env:
+        - name: ZOOKEEPER_REPLICAS
+          value: '1'
+        - name: ZOOKEEPER_TICK_TIME
+          value: '2000'
+        - name: ZOOKEEPER_SYNC_LIMIT
+          value: '5'
+        - name: ZOOKEEPER_INIT_LIMIT
+          value: '10'
+        - name: ZOOKEEPER_MAX_CLIENT_CNXNS
+          value: '200'
+        - name: ZOOKEEPER_AUTOPURGE_SNAP_RETAIN_COUNT
+          value: '3'
+        - name: ZOOKEEPER_AUTOPURGE_PURGE_INTERVAL
+          value: '24'
+        - name: ZOOKEEPER_CLIENT_PORT
+          value: '2181'
+        - name: KAFKA_OPTS
+          value: '-Djava.security.auth.login.config=/etc/zookeeper/secrets/jaas/zk_server_jaas.conf -Dzookeeper.kerberos.removeHostFromPrincipal=true -Dzookeeper.kerberos.removeRealmFromPrincipal=true -Dzookeeper.authProvider.1=org.apache.zookeeper.server.auth.SASLAuthenticationProvider -Dzookeeper.requireClientAuthScheme=sasl'
+        - name: ZOOKEEPER_SERVER_ID
+          value: '1'
+        volumeMounts:
+        - mountPath: /etc/zookeeper/secrets/jaas/zk_server_jaas.conf
+          subPath: zk_server_jaas.conf
+          name: dmaapmr-zk-server-jaas
+      volumes:
+      - configMap:
+          defaultMode: 420
+          name: dmaapmr-zk-server-jaas.conf
+        name: dmaapmr-zk-server-jaas
\ No newline at end of file
@@ -1,3 +1,4 @@
+#  ============LICENSE_START===============================================
 #  Copyright (C) 2020 Nordix Foundation. All rights reserved.
 #  ========================================================================
 #  Licensed under the Apache License, Version 2.0 (the "License");
 #  limitations under the License.
 #  ============LICENSE_END=================================================
 #
-version: '3.5'
 
+version: '3.5'
 networks:
   default:
-    driver: bridge
-    name: nonrtric-docker-net
+    external:
+      name: ${DOCKER_SIM_NWNAME}
 
 services:
-  policy-agent:
-    image: nexus3.o-ran-sc.org:10004/o-ran-sc/nonrtric-policy-agent:2.2.0
-    container_name: policy-agent
-    networks:
-      default:
-        aliases:
-          - policy-agent-container
-    ports:
-      - 8081:8081
-      - 8433:8433
-    volumes:
-      - ./pms/application_configuration.json:/opt/app/policy-agent/data/application_configuration.json:ro
-      - ./pms/application-policyagent.yaml:/opt/app/policy-agent/config/application.yaml:ro
-    # For using own certs instead of the default ones (built into the container),
-    # place them in pms/ directory, update the application-policyagent.yaml file, and uncomment the following lines
-    #  - ./pms/keystore-policyagent.jks:/opt/app/policy-agent/etc/cert/keystore.jks:ro
-    #  - ./pms/truststore-policyagent.jks:/opt/app/policy-agent/etc/cert/truststore.jks:ro
-    #  - ./pms/application-policyagent.yaml:/opt/app/policy-agent/config/application.yaml:ro
-
-  a1-sim-OSC:
-    image: nexus3.o-ran-sc.org:10004/o-ran-sc/a1-simulator:2.1.0
-    container_name: a1-sim-OSC
-    networks:
-      - default
-    ports:
-      - 30001:8085
-      - 30002:8185
-    environment:
-      - A1_VERSION=OSC_2.1.0
-      - REMOTE_HOSTS_LOGGING=1
-      - ALLOW_HTTP=true
-
-  a1-sim-STD:
-    image: nexus3.o-ran-sc.org:10004/o-ran-sc/a1-simulator:2.1.0
-    container_name: a1-sim-STD
-    networks:
-      - default
-    ports:
-      - 30003:8085
-      - 30004:8185
-    environment:
-      - A1_VERSION=STD_1.1.3
-      - REMOTE_HOSTS_LOGGING=1
-      - ALLOW_HTTP=true
-
-  policy-control-panel:
-    image: nexus3.o-ran-sc.org:10004/o-ran-sc/nonrtric-controlpanel:2.2.0
-    container_name: policy-control-panel
-    networks:
-      - default
-    ports:
-      - 8080:8080
-      - 8082:8082
-
   zookeeper:
-    image: nexus3.onap.org:10001/onap/dmaap/zookeeper:6.0.3
-    container_name: zookeeper
+    image: $ONAP_ZOOKEEPER_IMAGE
+    container_name: $MR_ZOOKEEPER_APP_NAME
     ports:
       - "2181:2181"
     environment:
@@ -92,13 +39,13 @@ services:
      KAFKA_OPTS: -Djava.security.auth.login.config=/etc/zookeeper/secrets/jaas/zk_server_jaas.conf -Dzookeeper.kerberos.removeHostFromPrincipal=true -Dzookeeper.kerberos.removeRealmFromPrincipal=true -Dzookeeper.authProvider.1=org.apache.zookeeper.server.auth.SASLAuthenticationProvider -Dzookeeper.requireClientAuthScheme=sasl
      ZOOKEEPER_SERVER_ID: 1
     volumes:
-      -  ./zk/zk_server_jaas.conf:/etc/zookeeper/secrets/jaas/zk_server_jaas.conf
+      -  ./mnt/zk/zk_server_jaas.conf:/etc/zookeeper/secrets/jaas/zk_server_jaas.conf
     networks:
       - default
 
   kafka:
-   image: nexus3.onap.org:10001/onap/dmaap/kafka111:1.0.4
-   container_name: kafka
+   image: $ONAP_KAFKA_IMAGE
+   container_name: $MR_KAFKA_APP_NAME
    ports:
     - "9092:9092"
    environment:
@@ -117,26 +64,26 @@ services:
     # Reduced the number of partitions only to avoid the timeout error for the first subscribe call in slow environment
     KAFKA_OFFSETS_TOPIC_NUM_PARTITIONS: 1
    volumes:
-     -  ./kafka/zk_client_jaas.conf:/etc/kafka/secrets/jaas/zk_client_jaas.conf
+     -  ./mnt/kafka/zk_client_jaas.conf:/etc/kafka/secrets/jaas/zk_client_jaas.conf
    networks:
       - default
    depends_on:
     - zookeeper
 
   dmaap:
-    image: nexus3.onap.org:10001/onap/dmaap/dmaap-mr:1.1.18
-    container_name: dmaap-mr
+    image: $ONAP_DMAAPMR_IMAGE
+    container_name: $MR_DMAAP_APP_NAME
     ports:
-      - "3904:3904"
-      - "3905:3905"
+      - ${MR_DMAAP_LOCALHOST_PORT}:${MR_INTERNAL_PORT}
+      - ${MR_DMAAP_LOCALHOST_SECURE_PORT}:${MR_INTERNAL_SECURE_PORT}
     environment:
      enableCadi: 'false'
     volumes:
-      - ./mr/MsgRtrApi.properties:/appl/dmaapMR1/bundleconfig/etc/appprops/MsgRtrApi.properties
-      - ./mr/logback.xml:/appl/dmaapMR1/bundleconfig/etc/logback.xml
-      - ./mr/cadi.properties:/appl/dmaapMR1/etc/cadi.properties
+      - ./mnt/mr/MsgRtrApi.properties:/appl/dmaapMR1/bundleconfig/etc/appprops/MsgRtrApi.properties
+      - ./mnt/mr/logback.xml:/appl/dmaapMR1/bundleconfig/etc/logback.xml
+      - ./mnt/mr/cadi.properties:/appl/dmaapMR1/etc/cadi.properties
     networks:
       - default
     depends_on:
       - zookeeper
-      - kafka
\ No newline at end of file
+      - kafka
diff --git a/test/simulator-group/dmaapmr/mnt/kafka/zk_client_jaas.conf b/test/simulator-group/dmaapmr/mnt/kafka/zk_client_jaas.conf
new file mode 100644 (file)
index 0000000..d4ef1eb
--- /dev/null
@@ -0,0 +1,5 @@
+Client {
+   org.apache.zookeeper.server.auth.DigestLoginModule required
+   username="kafka"
+   password="kafka_secret";
+ };
\ No newline at end of file
diff --git a/test/simulator-group/dmaapmr/mnt/mr/KUBE-MsgRtrApi.properties b/test/simulator-group/dmaapmr/mnt/mr/KUBE-MsgRtrApi.properties
new file mode 100644 (file)
index 0000000..66c7db1
--- /dev/null
@@ -0,0 +1,173 @@
+# LICENSE_START=======================================================
+#  org.onap.dmaap
+#  ================================================================================
+#  Copyright Â© 2020 Nordix Foundation. All rights reserved.
+#  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.
+#
+###############################################################################
+###############################################################################
+##
+## 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={{.Values.zookeeper.name}}:{{.Values.zookeeper.port}}
+config.zk.servers=zookeeper.onap: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={{.Values.kafka.name}}:{{.Values.kafka.port}}
+kafka.metadata.broker.list=akfak-bwds.onap: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=<use-something-unique-to-this-instance>
+
+#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.dmaap.mr
+forceAAF=false
+transidUEBtopicreqd=false
+defaultNSforUEB=org.onap.dmaap.mr
+##############################################################################
+#Mirror Maker Agent
+
+msgRtr.mirrormakeradmin.aaf=org.onap.dmaap.mr.mirrormaker|*|admin
+msgRtr.mirrormakeruser.aaf=org.onap.dmaap.mr.mirrormaker|*|user
+msgRtr.mirrormakeruser.aaf.create=org.onap.dmaap.mr.topicFactory|:org.onap.dmaap.mr.topic:
+msgRtr.mirrormaker.timeout=15000
+msgRtr.mirrormaker.topic=org.onap.dmaap.mr.mirrormakeragent
+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
\ No newline at end of file
diff --git a/test/simulator-group/dmaapmr/mnt/mr/MsgRtrApi.properties b/test/simulator-group/dmaapmr/mnt/mr/MsgRtrApi.properties
new file mode 100644 (file)
index 0000000..573a81a
--- /dev/null
@@ -0,0 +1,173 @@
+# LICENSE_START=======================================================
+#  org.onap.dmaap
+#  ================================================================================
+#  Copyright Â© 2020 Nordix Foundation. All rights reserved.
+#  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.
+#
+###############################################################################
+###############################################################################
+##
+## 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={{.Values.zookeeper.name}}:{{.Values.zookeeper.port}}
+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={{.Values.kafka.name}}:{{.Values.kafka.port}}
+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=<use-something-unique-to-this-instance>
+
+#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.dmaap.mr
+forceAAF=false
+transidUEBtopicreqd=false
+defaultNSforUEB=org.onap.dmaap.mr
+##############################################################################
+#Mirror Maker Agent
+
+msgRtr.mirrormakeradmin.aaf=org.onap.dmaap.mr.mirrormaker|*|admin
+msgRtr.mirrormakeruser.aaf=org.onap.dmaap.mr.mirrormaker|*|user
+msgRtr.mirrormakeruser.aaf.create=org.onap.dmaap.mr.topicFactory|:org.onap.dmaap.mr.topic:
+msgRtr.mirrormaker.timeout=15000
+msgRtr.mirrormaker.topic=org.onap.dmaap.mr.mirrormakeragent
+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
\ No newline at end of file
diff --git a/test/simulator-group/dmaapmr/mnt/mr/cadi.properties b/test/simulator-group/dmaapmr/mnt/mr/cadi.properties
new file mode 100644 (file)
index 0000000..dca56c8
--- /dev/null
@@ -0,0 +1,19 @@
+aaf_locate_url=https://aaf-locate.{{ include "common.namespace" . }}:8095
+aaf_url=https://AAF_LOCATE_URL/onap.org.osaaf.aaf.service:2.1
+aaf_env=DEV
+aaf_lur=org.onap.aaf.cadi.aaf.v2_0.AAFLurPerm
+
+cadi_truststore=/appl/dmaapMR1/etc/org.onap.dmaap.mr.trust.jks
+cadi_truststore_password=enc:mN6GiIzFQxKGDzAXDOs7b4j8DdIX02QrZ9QOWNRpxV3rD6whPCfizSMZkJwxi_FJ
+
+cadi_keyfile=/appl/dmaapMR1/etc/org.onap.dmaap.mr.keyfile
+
+cadi_alias=dmaapmr@mr.dmaap.onap.org
+cadi_keystore=/appl/dmaapMR1/etc/org.onap.dmaap.mr.p12
+cadi_keystore_password=enc:_JJT2gAEkRzXla5xfDIHal8pIoIB5iIos3USvZQT6sL-l14LpI5fRFR_QIGUCh5W
+cadi_x509_issuers=CN=intermediateCA_1, OU=OSAAF, O=ONAP, C=US:CN=intermediateCA_7, OU=OSAAF, O=ONAP, C=US:CN=intermediateCA_9, OU=OSAAF, O=ONAP, C=US
+
+cadi_loglevel=INFO
+cadi_protocols=TLSv1.1,TLSv1.2
+cadi_latitude=37.78187
+cadi_longitude=-122.26147
\ No newline at end of file
diff --git a/test/simulator-group/dmaapmr/mnt/mr/logback.xml b/test/simulator-group/dmaapmr/mnt/mr/logback.xml
new file mode 100644 (file)
index 0000000..8471208
--- /dev/null
@@ -0,0 +1,209 @@
+<!--
+     ============LICENSE_START=======================================================
+     Copyright Â© 2020 Nordix Foundation. All rights reserved.
+     Copyright Â© 2019 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=========================================================
+ -->
+
+<configuration scan="true" scanPeriod="3 seconds" debug="false">
+  <contextName>${module.ajsc.namespace.name}</contextName>
+  <jmxConfigurator />
+  <property name="logDirectory" value="${AJSC_HOME}/log" />
+  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+    <filter class="ch.qos.logback.classic.filter.LevelFilter">
+      <level>ERROR</level>
+      <onMatch>ACCEPT</onMatch>
+      <onMismatch>DENY</onMismatch>
+    </filter>
+    <encoder>
+      <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{1024} - %msg%n
+      </pattern>
+    </encoder>
+  </appender>
+
+  <appender name="INFO" class="ch.qos.logback.core.ConsoleAppender">
+    <filter class="ch.qos.logback.classic.filter.LevelFilter">
+      <level>INFO</level>
+      <onMatch>ACCEPT</onMatch>
+      <onMismatch>DENY</onMismatch>
+    </filter>
+  </appender>
+
+  <appender name="DEBUG" class="ch.qos.logback.core.ConsoleAppender">
+
+    <encoder>
+      <pattern>"%d [%thread] %-5level %logger{1024} - %msg%n"</pattern>
+    </encoder>
+  </appender>
+
+  <appender name="ERROR" class="ch.qos.logback.core.ConsoleAppender"> class="ch.qos.logback.core.ConsoleAppender">
+    <filter class="ch.qos.logback.classic.filter.LevelFilter">
+      <level>ERROR</level>
+      <onMatch>ACCEPT</onMatch>
+      <onMismatch>DENY</onMismatch>
+    </filter>
+    <encoder>
+      <pattern>"%d [%thread] %-5level %logger{1024} - %msg%n"</pattern>
+    </encoder>
+  </appender>
+
+
+  <!-- Msgrtr related loggers -->
+  <logger name="org.onap.dmaap.dmf.mr.service" level="INFO" />
+  <logger name="org.onap.dmaap.dmf.mr.service.impl" level="INFO" />
+
+  <logger name="org.onap.dmaap.dmf.mr.resources" level="INFO" />
+  <logger name="org.onap.dmaap.dmf.mr.resources.streamReaders" level="INFO" />
+
+  <logger name="org.onap.dmaap.dmf.mr.backends" level="INFO" />
+  <logger name="org.onap.dmaap.dmf.mr.backends.kafka" level="INFO" />
+  <logger name="org.onap.dmaap.dmf.mr.backends.memory" level="INFO" />
+
+  <logger name="org.onap.dmaap.dmf.mr.beans" level="INFO" />
+
+  <logger name="org.onap.dmaap.dmf.mr.constants" level="INFO" />
+
+  <logger name="org.onap.dmaap.dmf.mr.exception" level="INFO" />
+
+  <logger name="org.onap.dmaap.dmf.mr.listener" level="INFO" />
+
+  <logger name="org.onap.dmaap.dmf.mr.metabroker" level="INFO" />
+
+  <logger name="org.onap.dmaap.dmf.mr.metrics.publisher" level="INFO" />
+  <logger name="org.onap.dmaap.dmf.mr.metrics.publisher.impl" level="INFO" />
+
+
+
+  <logger name="org.onap.dmaap.dmf.mr.security" level="INFO" />
+  <logger name="org.onap.dmaap.dmf.mr.security.impl" level="INFO" />
+
+  <logger name="org.onap.dmaap.dmf.mr.transaction" level="INFO" />
+  <logger name="com.att.dmf.mr.transaction.impl" level="INFO" />
+
+  <logger name="org.onap.dmaap.dmf.mr.metabroker" level="INFO" />
+  <logger name="org.onap.dmaap.dmf.mr.metabroker" level="INFO" />
+
+  <logger name="org.onap.dmaap.dmf.mr.utils" level="INFO" />
+  <logger name="org.onap.dmaap.mr.filter" level="INFO" />
+
+  <!--<logger name="com.att.nsa.cambria.*" level="INFO" />-->
+
+  <!-- Msgrtr loggers in ajsc -->
+  <logger name="org.onap.dmaap.service" level="INFO" />
+  <logger name="org.onap.dmaap" level="INFO" />
+
+
+  <!-- Spring related loggers -->
+  <logger name="org.springframework" level="WARN" additivity="false"/>
+  <logger name="org.springframework.beans" level="WARN" additivity="false"/>
+  <logger name="org.springframework.web" level="WARN" additivity="false" />
+  <logger name="com.blog.spring.jms" level="WARN" additivity="false" />
+
+  <!-- AJSC Services (bootstrap services) -->
+  <logger name="ajsc" level="WARN" additivity="false"/>
+  <logger name="ajsc.RouteMgmtService" level="INFO" additivity="false"/>
+  <logger name="ajsc.ComputeService" level="INFO" additivity="false" />
+  <logger name="ajsc.VandelayService" level="WARN" additivity="false"/>
+  <logger name="ajsc.FilePersistenceService" level="WARN" additivity="false"/>
+  <logger name="ajsc.UserDefinedJarService" level="WARN" additivity="false" />
+  <logger name="ajsc.UserDefinedBeansDefService" level="WARN" additivity="false" />
+  <logger name="ajsc.LoggingConfigurationService" level="WARN" additivity="false" />
+
+  <!-- AJSC related loggers (DME2 Registration, csi logging, restlet, servlet
+    logging) -->
+  <logger name="ajsc.utils" level="WARN" additivity="false"/>
+  <logger name="ajsc.utils.DME2Helper" level="INFO" additivity="false" />
+  <logger name="ajsc.filters" level="DEBUG" additivity="false" />
+  <logger name="ajsc.beans.interceptors" level="DEBUG" additivity="false" />
+  <logger name="ajsc.restlet" level="DEBUG" additivity="false" />
+  <logger name="ajsc.servlet" level="DEBUG" additivity="false" />
+  <logger name="com.att" level="WARN" additivity="false" />
+  <logger name="com.att.ajsc.csi.logging" level="WARN" additivity="false" />
+  <logger name="com.att.ajsc.filemonitor" level="WARN" additivity="false"/>
+
+  <logger name="com.att.nsa.dmaap.util" level="INFO" additivity="false"/>
+  <logger name="com.att.cadi.filter" level="INFO" additivity="false" />
+
+
+  <!-- Other Loggers that may help troubleshoot -->
+  <logger name="net.sf" level="WARN" additivity="false" />
+  <logger name="org.apache.commons.httpclient" level="WARN" additivity="false"/>
+  <logger name="org.apache.commons" level="WARN" additivity="false" />
+  <logger name="org.apache.coyote" level="WARN" additivity="false"/>
+  <logger name="org.apache.jasper" level="WARN" additivity="false"/>
+
+  <!-- Camel Related Loggers (including restlet/servlet/jaxrs/cxf logging.
+    May aid in troubleshooting) -->
+  <logger name="org.apache.camel" level="WARN" additivity="false" />
+  <logger name="org.apache.cxf" level="WARN" additivity="false" />
+  <logger name="org.apache.camel.processor.interceptor" level="WARN" additivity="false"/>
+  <logger name="org.apache.cxf.jaxrs.interceptor" level="WARN" additivity="false" />
+  <logger name="org.apache.cxf.service" level="WARN" additivity="false" />
+  <logger name="org.restlet" level="DEBUG" additivity="false" />
+  <logger name="org.apache.camel.component.restlet" level="DEBUG" additivity="false" />
+  <logger name="org.apache.kafka" level="DEBUG" additivity="false" />
+  <logger name="org.apache.zookeeper" level="INFO" additivity="false" />
+  <logger name="org.I0Itec.zkclient" level="DEBUG" additivity="false" />
+
+  <!-- logback internals logging -->
+  <logger name="ch.qos.logback.classic" level="INFO" additivity="false"/>
+  <logger name="ch.qos.logback.core" level="INFO" additivity="false" />
+
+  <!-- logback jms appenders & loggers definition starts here -->
+  <!-- logback jms appenders & loggers definition starts here -->
+  <appender name="auditLogs" class="ch.qos.logback.core.ConsoleAppender">
+    <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
+    </filter>
+    <encoder>
+      <pattern>"%d [%thread] %-5level %logger{1024} - %msg%n"</pattern>
+    </encoder>
+  </appender>
+  <appender name="perfLogs" class="ch.qos.logback.core.ConsoleAppender">
+    <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
+    </filter>
+    <encoder>
+      <pattern>"%d [%thread] %-5level %logger{1024} - %msg%n"</pattern>
+    </encoder>
+  </appender>
+  <appender name="ASYNC-audit" class="ch.qos.logback.classic.AsyncAppender">
+    <queueSize>1000</queueSize>
+    <discardingThreshold>0</discardingThreshold>
+    <appender-ref ref="Audit-Record-Queue" />
+  </appender>
+
+  <logger name="AuditRecord" level="INFO" additivity="FALSE">
+    <appender-ref ref="STDOUT" />
+  </logger>
+  <logger name="AuditRecord_DirectCall" level="INFO" additivity="FALSE">
+    <appender-ref ref="STDOUT" />
+  </logger>
+  <appender name="ASYNC-perf" class="ch.qos.logback.classic.AsyncAppender">
+    <queueSize>1000</queueSize>
+    <discardingThreshold>0</discardingThreshold>
+    <appender-ref ref="Performance-Tracker-Queue" />
+  </appender>
+  <logger name="PerfTrackerRecord" level="INFO" additivity="FALSE">
+    <appender-ref ref="ASYNC-perf" />
+    <appender-ref ref="perfLogs" />
+  </logger>
+  <!-- logback jms appenders & loggers definition ends here -->
+
+  <root level="DEBUG">
+    <appender-ref ref="DEBUG" />
+    <appender-ref ref="ERROR" />
+    <appender-ref ref="INFO" />
+    <appender-ref ref="STDOUT" />
+  </root>
+
+</configuration>
diff --git a/test/simulator-group/dmaapmr/mnt/zk/zk_server_jaas.conf b/test/simulator-group/dmaapmr/mnt/zk/zk_server_jaas.conf
new file mode 100644 (file)
index 0000000..26bf460
--- /dev/null
@@ -0,0 +1,4 @@
+Server {
+       org.apache.zookeeper.server.auth.DigestLoginModule required
+       user_kafka=kafka_secret;
+};
\ No newline at end of file
diff --git a/test/simulator-group/dmaapmr/svc.yaml b/test/simulator-group/dmaapmr/svc.yaml
new file mode 100644 (file)
index 0000000..0a02b4f
--- /dev/null
@@ -0,0 +1,57 @@
+apiVersion: v1
+kind: Service
+metadata:
+  name: $MR_DMAAP_KUBE_APP_NAME
+  namespace: $KUBE_ONAP_NAMESPACE
+  labels:
+    run: $MR_DMAAP_KUBE_APP_NAME
+    autotest: DMAAPMR
+spec:
+  type: ClusterIP
+  ports:
+  - port: $MR_EXTERNAL_PORT
+    targetPort: $MR_INTERNAL_PORT
+    protocol: TCP
+    name: http
+  - port: $MR_EXTERNAL_SECURE_PORT
+    targetPort: $MR_INTERNAL_SECURE_PORT
+    protocol: TCP
+    name: https
+  selector:
+    run: $MR_DMAAP_KUBE_APP_NAME
+---
+apiVersion: v1
+kind: Service
+metadata:
+  name: $MR_KAFKA_BWDS_NAME
+  namespace: $KUBE_ONAP_NAMESPACE
+  labels:
+    run: $MR_KAFKA_BWDS_NAME
+    autotest: DMAAPMR
+spec:
+  type: ClusterIP
+  ports:
+  - port: 9092
+    targetPort: 9092
+    protocol: TCP
+    name: http
+  selector:
+    run: $MR_KAFKA_BWDS_NAME
+---
+apiVersion: v1
+kind: Service
+metadata:
+  name: $MR_ZOOKEEPER_APP_NAME
+  namespace: $KUBE_ONAP_NAMESPACE
+  labels:
+    run: $MR_ZOOKEEPER_APP_NAME
+    autotest: DMAAPMR
+spec:
+  type: ClusterIP
+  ports:
+  - port: 2181
+    targetPort: 2181
+    protocol: TCP
+    name: http
+  selector:
+    run: $MR_ZOOKEEPER_APP_NAME
\ No newline at end of file
diff --git a/test/simulator-group/ecs/app.yaml b/test/simulator-group/ecs/app.yaml
new file mode 100644 (file)
index 0000000..640b61d
--- /dev/null
@@ -0,0 +1,43 @@
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: $ECS_APP_NAME
+  namespace: $KUBE_NONRTRIC_NAMESPACE
+  labels:
+    run: $ECS_APP_NAME
+    autotest: ECS
+spec:
+  replicas: 1
+  selector:
+    matchLabels:
+      run: $ECS_APP_NAME
+  template:
+    metadata:
+      labels:
+        run: $ECS_APP_NAME
+        autotest: ECS
+    spec:
+      containers:
+      - name: $ECS_APP_NAME
+        image: $ECS_IMAGE
+        imagePullPolicy: Never
+        ports:
+        - name: http
+          containerPort: $ECS_INTERNAL_PORT
+        - name: https
+          containerPort: $ECS_INTERNAL_SECURE_PORT
+        volumeMounts:
+        - mountPath: $ECS_CONFIG_MOUNT_PATH
+          name: ecs-conf-name
+        volumeMounts:
+        - mountPath: $ECS_CONTAINER_MNT_DIR
+          name: ecs-data-name
+      volumes:
+      - configMap:
+          defaultMode: 420
+          name: $ECS_CONFIG_CONFIGMAP_NAME
+        name: ecs-conf-name
+      - persistentVolumeClaim:
+          claimName: $ECS_DATA_CONFIGMAP_NAME
+        name: ecs-data-name
+
diff --git a/test/simulator-group/ecs/application.yaml b/test/simulator-group/ecs/application.yaml
new file mode 100644 (file)
index 0000000..75b11ad
--- /dev/null
@@ -0,0 +1,54 @@
+################################################################################
+#   Copyright (c) 2020 Nordix Foundation.                                      #
+#                                                                              #
+#   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.                                             #
+################################################################################
+
+spring:
+  profiles:
+    active: prod
+  main:
+    allow-bean-definition-overriding: true
+  aop:
+    auto: false
+management:
+  endpoints:
+    web:
+      exposure:
+        include: "loggers,logfile,health,info,metrics,threaddump,heapdump"
+
+logging:
+  level:
+    ROOT: ERROR
+    org.springframework: ERROR
+    org.springframework.data: ERROR
+    org.springframework.web.reactive.function.client.ExchangeFunctions: ERROR
+    org.oransc.enrichment: INFO
+  file:
+    name: /var/log/enrichment-coordinator-service/application.log
+server:
+   port : 8434
+   http-port: 8083
+   ssl:
+      key-store-type: JKS
+      key-store-password: policy_agent
+      key-store: /opt/app/enrichment-coordinator-service/etc/cert/keystore.jks
+      key-password: policy_agent
+      key-alias: policy_agent
+app:
+  filepath: /opt/app/enrichment-coordinator-service/data/application_configuration.json
+  webclient:
+    trust-store-used: false
+    trust-store-password: policy_agent
+    trust-store: /opt/app/enrichment-coordinator-service/etc/cert/truststore.jks
+  vardata-directory: /var/enrichment-coordinator-service
\ No newline at end of file
diff --git a/test/simulator-group/ecs/pvc.yaml b/test/simulator-group/ecs/pvc.yaml
new file mode 100644 (file)
index 0000000..3abd359
--- /dev/null
@@ -0,0 +1,16 @@
+apiVersion: v1
+kind: PersistentVolumeClaim
+metadata:
+  name: $ECS_DATA_CONFIGMAP_NAME
+  namespace: $KUBE_NONRTRIC_NAMESPACE
+  labels:
+    run: $ECS_APP_NAME
+    autotest: ECS
+spec:
+  accessModes:
+  - ReadWriteOnce
+  resources:
+    requests:
+      storage: 10Mi
+  storageClassName: standard
+  volumeMode: Filesystem
\ No newline at end of file
diff --git a/test/simulator-group/ecs/svc.yaml b/test/simulator-group/ecs/svc.yaml
new file mode 100644 (file)
index 0000000..e311c0e
--- /dev/null
@@ -0,0 +1,21 @@
+apiVersion: v1
+kind: Service
+metadata:
+  name: $ECS_APP_NAME
+  namespace: $KUBE_NONRTRIC_NAMESPACE
+  labels:
+    run: $ECS_APP_NAME
+    autotest: ECS
+spec:
+  type: ClusterIP
+  ports:
+  - port: $ECS_EXTERNAL_PORT
+    targetPort: $ECS_INTERNAL_PORT
+    protocol: TCP
+    name: http
+  - port: $ECS_EXTERNAL_SECURE_PORT
+    targetPort: $ECS_INTERNAL_SECURE_PORT
+    protocol: TCP
+    name: https
+  selector:
+    run: $ECS_APP_NAME
\ No newline at end of file
diff --git a/test/simulator-group/httpproxy/.gitignore b/test/simulator-group/httpproxy/.gitignore
new file mode 100644 (file)
index 0000000..3384196
--- /dev/null
@@ -0,0 +1 @@
+.dockererr
\ No newline at end of file
diff --git a/test/simulator-group/httpproxy/app.yaml b/test/simulator-group/httpproxy/app.yaml
new file mode 100644 (file)
index 0000000..3e0c8ac
--- /dev/null
@@ -0,0 +1,30 @@
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: $HTTP_PROXY_APP_NAME
+  namespace: $KUBE_SIM_NAMESPACE
+  labels:
+    run: $HTTP_PROXY_APP_NAME
+    autotest: HTTPPROXY
+spec:
+  replicas: 1
+  selector:
+    matchLabels:
+      run: $HTTP_PROXY_APP_NAME
+  template:
+    metadata:
+      labels:
+        run: $HTTP_PROXY_APP_NAME
+        autotest: HTTPPROXY
+    spec:
+      containers:
+      - name: $HTTP_PROXY_APP_NAME
+        image: $HTTP_PROXY_IMAGE
+        imagePullPolicy: Never
+        ports:
+        - name: http
+          containerPort: $HTTP_PROXY_INTERNAL_PORT
+        - name: web
+          containerPort: $HTTP_PROXY_WEB_INTERNAL_PORT
+        command: ["mitmweb"]
+        args: ["--web-host", "0.0.0.0", "--no-web-open-browser", "-p", "$HTTP_PROXY_INTERNAL_PORT", "--set", "ssl_insecure"]
\ No newline at end of file
@@ -21,13 +21,12 @@ networks:
     external:
       name: ${DOCKER_SIM_NWNAME}
 services:
-  message-router:
+  httpproxy:
     networks:
       - default
-    container_name: ${MR_APP_NAME}
-    image: ${MRSTUB_IMAGE}
+    container_name: ${HTTP_PROXY_APP_NAME}
+    image: ${HTTP_PROXY_IMAGE}
+    tty: true
+    command: mitmweb --web-host 0.0.0.0 --no-web-open-browser --set ssl_insecure
     ports:
-      - ${MR_EXTERNAL_PORT}:${MR_INTERNAL_PORT}
-      - ${MR_EXTERNAL_SECURE_PORT}:${MR_INTERNAL_SECURE_PORT}
-    volumes:
-      - ${MR_CERT_MOUNT_DIR}:/usr/src/app/cert:ro
+      - ${HTTP_PROXY_WEB_EXTERNAL_PORT}:${HTTP_PROXY_WEB_INTERNAL_PORT}
\ No newline at end of file
diff --git a/test/simulator-group/httpproxy/svc.yaml b/test/simulator-group/httpproxy/svc.yaml
new file mode 100644 (file)
index 0000000..cd27563
--- /dev/null
@@ -0,0 +1,21 @@
+apiVersion: v1
+kind: Service
+metadata:
+  name: $HTTP_PROXY_APP_NAME
+  namespace: $KUBE_SIM_NAMESPACE
+  labels:
+    run: $HTTP_PROXY_APP_NAME
+    autotest: HTTP_PROXY_APP_NAME
+spec:
+  type: ClusterIP
+  ports:
+  - port: $HTTP_PROXY_EXTERNAL_PORT
+    targetPort: $HTTP_PROXY_INTERNAL_PORT
+    protocol: TCP
+    name: http
+  - port: $HTTP_PROXY_WEB_EXTERNAL_PORT
+    targetPort: $HTTP_PROXY_WEB_INTERNAL_PORT
+    protocol: TCP
+    name: web
+  selector:
+    run: $HTTP_PROXY_APP_NAME
\ No newline at end of file
diff --git a/test/simulator-group/mrstub/app.yaml b/test/simulator-group/mrstub/app.yaml
new file mode 100644 (file)
index 0000000..f29db93
--- /dev/null
@@ -0,0 +1,33 @@
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: $MR_STUB_APP_NAME
+  namespace: $KUBE_ONAP_NAMESPACE
+  labels:
+    run: $MR_STUB_APP_NAME
+    autotest: MR
+spec:
+  replicas: 1
+  selector:
+    matchLabels:
+      run: $MR_STUB_APP_NAME
+  template:
+    metadata:
+      labels:
+        run: $MR_STUB_APP_NAME
+        autotest: MR
+    spec:
+      containers:
+      - name: $MR_STUB_APP_NAME
+        image: $MRSTUB_IMAGE
+        imagePullPolicy: Never
+        ports:
+        - name: http
+          containerPort: $MR_INTERNAL_PORT
+        - name: https
+          containerPort: $MR_INTERNAL_SECURE_PORT
+        env:
+        - name: TOPIC_READ
+          value: $TOPIC_READ
+        - name: TOPIC_WRITE
+          value: $TOPIC_WRITE
\ No newline at end of file
 #  ============LICENSE_END=================================================
 #
 
-service {
-  # Name for CBS in consul, env var CONFIG_BINDING_SERVICE
-  # should be passed to Policy Agent app with this value
-  # This is only to be used when contacting cbs via local host
-  # (typicall when Policy Agent is executed as an application without a container)
-  Name = "config-binding-service-localhost"
-  # Host name where CBS is running
-  Address = "localhost"
-  # Port number where CBS is running
-  Port = 10000
-}
\ No newline at end of file
+version: '3.0'
+networks:
+  default:
+    external:
+      name: ${DOCKER_SIM_NWNAME}
+services:
+  mr-stub:
+    networks:
+      - default
+    container_name: ${MR_STUB_APP_NAME}
+    image: ${MRSTUB_IMAGE}
+    ports:
+      - ${MR_STUB_LOCALHOST_PORT}:${MR_INTERNAL_PORT}
+      - ${MR_STUB_LOCALHOST_SECURE_PORT}:${MR_INTERNAL_SECURE_PORT}
+    volumes:
+      - ${MR_STUB_CERT_MOUNT_DIR}:/usr/src/app/cert:ro
+    environment:
+      - TOPIC_READ=${TOPIC_READ}
+      - TOPIC_WRITE=${TOPIC_WRITE}
diff --git a/test/simulator-group/mrstub/svc.yaml b/test/simulator-group/mrstub/svc.yaml
new file mode 100644 (file)
index 0000000..7723677
--- /dev/null
@@ -0,0 +1,21 @@
+apiVersion: v1
+kind: Service
+metadata:
+  name: $MR_STUB_APP_NAME
+  namespace: $KUBE_ONAP_NAMESPACE
+  labels:
+    run: $MR_STUB_APP_NAME
+    autotest: MR
+spec:
+  type: ClusterIP
+  ports:
+  - port: $MR_EXTERNAL_PORT
+    targetPort: $MR_INTERNAL_PORT
+    protocol: TCP
+    name: http
+  - port: $MR_EXTERNAL_SECURE_PORT
+    targetPort: $MR_INTERNAL_SECURE_PORT
+    protocol: TCP
+    name: https
+  selector:
+    run: $MR_STUB_APP_NAME
\ No newline at end of file
diff --git a/test/simulator-group/policy_agent/app.yaml b/test/simulator-group/policy_agent/app.yaml
new file mode 100644 (file)
index 0000000..ddbae37
--- /dev/null
@@ -0,0 +1,42 @@
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: $POLICY_AGENT_APP_NAME
+  namespace: $KUBE_NONRTRIC_NAMESPACE
+  labels:
+    run: $POLICY_AGENT_APP_NAME
+    autotest: PA
+spec:
+  replicas: 1
+  selector:
+    matchLabels:
+      run: $POLICY_AGENT_APP_NAME
+  template:
+    metadata:
+      labels:
+        run: $POLICY_AGENT_APP_NAME
+        autotest: PA
+    spec:
+      containers:
+      - name: $POLICY_AGENT_APP_NAME
+        image: $POLICY_AGENT_IMAGE
+        imagePullPolicy: Never
+        ports:
+        - name: http
+          containerPort: $POLICY_AGENT_INTERNAL_PORT
+        - name: https
+          containerPort: $POLICY_AGENT_INTERNAL_SECURE_PORT
+        volumeMounts:
+        - mountPath: $POLICY_AGENT_CONFIG_MOUNT_PATH
+          name: pa-conf-name
+        - mountPath: $POLICY_AGENT_DATA_MOUNT_PATH
+          name: pa-data-name
+      volumes:
+      - configMap:
+          defaultMode: 420
+          name: $POLICY_AGENT_CONFIG_CONFIGMAP_NAME
+        name: pa-conf-name
+      - configMap:
+          defaultMode: 420
+          name: $POLICY_AGENT_DATA_CONFIGMAP_NAME
+        name: pa-data-name
\ No newline at end of file
diff --git a/test/simulator-group/policy_agent/application.yaml b/test/simulator-group/policy_agent/application.yaml
new file mode 100644 (file)
index 0000000..49111d8
--- /dev/null
@@ -0,0 +1,66 @@
+################################################################################
+#   Copyright (c) 2020 Nordix Foundation.                                      #
+#                                                                              #
+#   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.                                             #
+################################################################################
+
+spring:
+  profiles:
+    active: prod
+  main:
+    allow-bean-definition-overriding: true
+  aop:
+    auto: false
+management:
+  endpoints:
+    web:
+      exposure:
+        # Enabling of springboot actuator features. See springboot documentation.
+        include: "loggers,logfile,health,info,metrics,threaddump,heapdump"
+
+logging:
+  # Configuration of logging
+  level:
+    ROOT: ERROR
+    org.springframework: ERROR
+    org.springframework.data: ERROR
+    org.springframework.web.reactive.function.client.ExchangeFunctions: ERROR
+    ${POLICY_AGENT_PKG_NAME}: INFO
+  file: /var/log/policy-agent/application.log
+
+server:
+  # Configuration of the HTTP/REST server. The parameters are defined and handeled by the springboot framework.
+  # See springboot documentation.
+  port : 8433
+  http-port: 8081
+  ssl:
+    key-store-type: JKS
+    key-store-password: policy_agent
+    key-store: /opt/app/policy-agent/etc/cert/keystore.jks
+    key-password: policy_agent
+    key-alias: policy_agent
+app:
+  # Location of the component configuration file. The file will only be used if the Consul database is not used;
+  # configuration from the Consul will override the file.
+  filepath: /opt/app/policy-agent/data/application_configuration.json
+  webclient:
+    # Configuration of the trust store used for the HTTP client (outgoing requests)
+    # The file location and the password for the truststore is only relevant if trust-store-used == true
+    # Note that the same keystore as for the server is used.
+    trust-store-used: false
+    trust-store-password: policy_agent
+    trust-store: /opt/app/policy-agent/etc/cert/truststore.jks
+    # Configuration of usage of HTTP Proxy for the southbound accesses.
+    # The HTTP proxy (if configured) will only be used for accessing NearRT RIC:s
+    http.proxy-host: $AGENT_HTTP_PROXY_CONFIG_HOST_NAME
+    http.proxy-port: $AGENT_HTTP_PROXY_CONFIG_PORT
index 506c716..18350a0 100644 (file)
@@ -33,6 +33,8 @@ services:
       - CONSUL_HOST=${CONSUL_HOST}
       - CONSUL_PORT=${CONSUL_INTERNAL_PORT}
       - CONFIG_BINDING_SERVICE=${CONFIG_BINDING_SERVICE}
-      - HOSTNAME=${POLICY_AGENT_APP_NAME}
+      - HOSTNAME=${POLICY_AGENT_CONFIG_KEY}
+    volumes:
+    - ${POLICY_AGENT_HOST_MNT_DIR}/$POLICY_AGENT_CONFIG_FILE:${POLICY_AGENT_CONFIG_MOUNT_PATH}/$POLICY_AGENT_CONFIG_FILE
 
 
diff --git a/test/simulator-group/policy_agent/mnt/.gitignore b/test/simulator-group/policy_agent/mnt/.gitignore
new file mode 100644 (file)
index 0000000..1e82fc7
--- /dev/null
@@ -0,0 +1 @@
+*.yaml
diff --git a/test/simulator-group/policy_agent/mnt/application.yaml b/test/simulator-group/policy_agent/mnt/application.yaml
new file mode 100644 (file)
index 0000000..30ec4de
--- /dev/null
@@ -0,0 +1,66 @@
+################################################################################
+#   Copyright (c) 2020 Nordix Foundation.                                      #
+#                                                                              #
+#   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.                                             #
+################################################################################
+
+spring:
+  profiles:
+    active: prod
+  main:
+    allow-bean-definition-overriding: true
+  aop:
+    auto: false
+management:
+  endpoints:
+    web:
+      exposure:
+        # Enabling of springboot actuator features. See springboot documentation.
+        include: "loggers,logfile,health,info,metrics,threaddump,heapdump"
+
+logging:
+  # Configuration of logging
+  level:
+    ROOT: ERROR
+    org.springframework: ERROR
+    org.springframework.data: ERROR
+    org.springframework.web.reactive.function.client.ExchangeFunctions: ERROR
+    org.onap.ccsdk.oran.a1policymanagementservice: INFO
+  file: /var/log/policy-agent/application.log
+
+server:
+  # Configuration of the HTTP/REST server. The parameters are defined and handeled by the springboot framework.
+  # See springboot documentation.
+  port : 8433
+  http-port: 8081
+  ssl:
+    key-store-type: JKS
+    key-store-password: policy_agent
+    key-store: /opt/app/policy-agent/etc/cert/keystore.jks
+    key-password: policy_agent
+    key-alias: policy_agent
+app:
+  # Location of the component configuration file. The file will only be used if the Consul database is not used;
+  # configuration from the Consul will override the file.
+  filepath: /opt/app/policy-agent/data/application_configuration.json
+  webclient:
+    # Configuration of the trust store used for the HTTP client (outgoing requests)
+    # The file location and the password for the truststore is only relevant if trust-store-used == true
+    # Note that the same keystore as for the server is used.
+    trust-store-used: false
+    trust-store-password: policy_agent
+    trust-store: /opt/app/policy-agent/etc/cert/truststore.jks
+    # Configuration of usage of HTTP Proxy for the southbound accesses.
+    # The HTTP proxy (if configured) will only be used for accessing NearRT RIC:s
+    http.proxy-host: 
+    http.proxy-port: 0
diff --git a/test/simulator-group/policy_agent/svc.yaml b/test/simulator-group/policy_agent/svc.yaml
new file mode 100644 (file)
index 0000000..0a9eca9
--- /dev/null
@@ -0,0 +1,21 @@
+apiVersion: v1
+kind: Service
+metadata:
+  name: $POLICY_AGENT_APP_NAME
+  namespace: $KUBE_NONRTRIC_NAMESPACE
+  labels:
+    run: $POLICY_AGENT_APP_NAME
+    autotest: PA
+spec:
+  type: ClusterIP
+  ports:
+  - port: $POLICY_AGENT_EXTERNAL_PORT
+    targetPort: $POLICY_AGENT_INTERNAL_PORT
+    protocol: TCP
+    name: http
+  - port: $POLICY_AGENT_EXTERNAL_SECURE_PORT
+    targetPort: $POLICY_AGENT_INTERNAL_SECURE_PORT
+    protocol: TCP
+    name: https
+  selector:
+    run: $POLICY_AGENT_APP_NAME
\ No newline at end of file
diff --git a/test/simulator-group/prodstub/app.yaml b/test/simulator-group/prodstub/app.yaml
new file mode 100644 (file)
index 0000000..9fb5ad5
--- /dev/null
@@ -0,0 +1,28 @@
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: $PROD_STUB_APP_NAME
+  namespace: $KUBE_SIM_NAMESPACE
+  labels:
+    run: $PROD_STUB_APP_NAME
+    autotest: PRODSTUB
+spec:
+  replicas: 1
+  selector:
+    matchLabels:
+      run: $PROD_STUB_APP_NAME
+  template:
+    metadata:
+      labels:
+        run: $PROD_STUB_APP_NAME
+        autotest: PRODSTUB
+    spec:
+      containers:
+      - name: $PROD_STUB_APP_NAME
+        image: $PROD_STUB_IMAGE
+        imagePullPolicy: Never
+        ports:
+        - name: http
+          containerPort: $PROD_STUB_INTERNAL_PORT
+        - name: https
+          containerPort: $PROD_STUB_INTERNAL_SECURE_PORT
diff --git a/test/simulator-group/prodstub/svc.yaml b/test/simulator-group/prodstub/svc.yaml
new file mode 100644 (file)
index 0000000..1fe4048
--- /dev/null
@@ -0,0 +1,21 @@
+apiVersion: v1
+kind: Service
+metadata:
+  name: $PROD_STUB_APP_NAME
+  namespace: $KUBE_SIM_NAMESPACE
+  labels:
+    run: $PROD_STUB_APP_NAME
+    autotest: PROD_STUB
+spec:
+  type: ClusterIP
+  ports:
+  - port: $PROD_STUB_EXTERNAL_PORT
+    targetPort: $PROD_STUB_INTERNAL_PORT
+    protocol: TCP
+    name: http
+  - port: $PROD_STUB_EXTERNAL_SECURE_PORT
+    targetPort: $PROD_STUB_INTERNAL_SECURE_PORT
+    protocol: TCP
+    name: https
+  selector:
+    run: $PROD_STUB_APP_NAME
\ No newline at end of file
diff --git a/test/simulator-group/rapp_catalogue/app.yaml b/test/simulator-group/rapp_catalogue/app.yaml
new file mode 100644 (file)
index 0000000..0c0a26c
--- /dev/null
@@ -0,0 +1,28 @@
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: $RAPP_CAT_APP_NAME
+  namespace: $KUBE_NONRTRIC_NAMESPACE
+  labels:
+    run: $RAPP_CAT_APP_NAME
+    autotest: RC
+spec:
+  replicas: 1
+  selector:
+    matchLabels:
+      run: $RAPP_CAT_APP_NAME
+  template:
+    metadata:
+      labels:
+        run: $RAPP_CAT_APP_NAME
+        autotest: RC
+    spec:
+      containers:
+      - name: $RAPP_CAT_APP_NAME
+        image: $RAPP_CAT_IMAGE
+        imagePullPolicy: Never
+        ports:
+        - name: http
+          containerPort: $RAPP_CAT_INTERNAL_PORT
+        - name: https
+          containerPort: $RAPP_CAT_INTERNAL_SECURE_PORT
index 1cf35f7..35d2bef 100644 (file)
@@ -18,7 +18,7 @@ version: '3.0'
 networks:
   default:
     external:
-      name: nonrtric-docker-net
+      name: ${DOCKER_SIM_NWNAME}
 services:
   rapp-catalogue:
     image: ${RAPP_CAT_IMAGE}
diff --git a/test/simulator-group/rapp_catalogue/svc.yaml b/test/simulator-group/rapp_catalogue/svc.yaml
new file mode 100644 (file)
index 0000000..0cb6235
--- /dev/null
@@ -0,0 +1,21 @@
+apiVersion: v1
+kind: Service
+metadata:
+  name: $RAPP_CAT_APP_NAME
+  namespace: $KUBE_NONRTRIC_NAMESPACE
+  labels:
+    run: $RAPP_CAT_APP_NAME
+    autotest: RC
+spec:
+  type: ClusterIP
+  ports:
+  - port: $RAPP_CAT_EXTERNAL_PORT
+    targetPort: $RAPP_CAT_INTERNAL_PORT
+    protocol: TCP
+    name: http
+  - port: $RAPP_CAT_EXTERNAL_SECURE_PORT
+    targetPort: $RAPP_CAT_INTERNAL_SECURE_PORT
+    protocol: TCP
+    name: https
+  selector:
+    run: $RAPP_CAT_APP_NAME
\ No newline at end of file
diff --git a/test/simulator-group/ric/app.yaml b/test/simulator-group/ric/app.yaml
new file mode 100644 (file)
index 0000000..df5d982
--- /dev/null
@@ -0,0 +1,36 @@
+apiVersion: apps/v1
+kind: StatefulSet
+metadata:
+  name: $RIC_SIM_SET_NAME
+  namespace: $KUBE_NONRTRIC_NAMESPACE
+  labels:
+    run: $RIC_SIM_SET_NAME
+    autotest: RICSIM
+spec:
+  replicas: $RIC_SIM_COUNT
+  serviceName: $RIC_SIM_SET_NAME
+  selector:
+    matchLabels:
+      run: $RIC_SIM_SET_NAME
+  template:
+    metadata:
+      labels:
+        run: $RIC_SIM_SET_NAME
+        autotest: RICSIM
+    spec:
+      containers:
+      - name: $RIC_SIM_SET_NAME
+        image: $RIC_SIM_IMAGE
+        env:
+        - name: A1_VERSION
+          value: $A1_VERSION
+        - name: REMOTE_HOSTS_LOGGING
+          value: "1"
+        - name: ALLOW_HTTP
+          value: "true"
+        imagePullPolicy: Never
+        ports:
+        - name: http
+          containerPort: $RIC_SIM_INTERNAL_PORT
+        - name: https
+          containerPort: $RIC_SIM_INTERNAL_SECURE_PORT
\ No newline at end of file
diff --git a/test/simulator-group/ric/svc.yaml b/test/simulator-group/ric/svc.yaml
new file mode 100644 (file)
index 0000000..902bb64
--- /dev/null
@@ -0,0 +1,15 @@
+apiVersion: v1
+kind: Service
+metadata:
+  name: $RIC_SIM_SET_NAME
+  namespace: $KUBE_NONRTRIC_NAMESPACE
+  labels:
+    run: $RIC_SIM_SET_NAME
+    autotest: RICSIM
+spec:
+  ports:
+  - port: 80
+    name: http
+  clusterIP: None
+  selector:
+    run: $RIC_SIM_SET_NAME
\ No newline at end of file
diff --git a/test/simulator-group/sdnc/app.yaml b/test/simulator-group/sdnc/app.yaml
new file mode 100644 (file)
index 0000000..cd170f6
--- /dev/null
@@ -0,0 +1,72 @@
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: $SDNC_APP_NAME
+  namespace: $KUBE_NONRTRIC_NAMESPACE
+  labels:
+    run: $SDNC_APP_NAME
+    autotest: SDNC
+spec:
+  replicas: 1
+  selector:
+    matchLabels:
+      run: $SDNC_APP_NAME
+  template:
+    metadata:
+      labels:
+        run: $SDNC_APP_NAME
+        autotest: SDNC
+    spec:
+      containers:
+      - name: $SDNC_APP_NAME
+        image: $SDNC_A1_CONTROLLER_IMAGE
+        imagePullPolicy: Never
+        ports:
+        - name: http
+          containerPort: $SDNC_INTERNAL_PORT
+        - name: https
+          containerPort: $SDNC_INTERNAL_SECURE_PORT
+        env:
+        - name: MYSQL_ROOT_PASSWORD
+          value: openECOMP1.0
+        - name: SDNC_CONFIG_DIR
+          value: /opt/onap/sdnc/data/properties
+        - name: SDNC_DB_INIT
+          value: 'true'
+        - name: A1_TRUSTSTORE_PASSWORD
+          value: $SDNC_A1_TRUSTSTORE_PASSWORD
+        command:
+        - /opt/onap/sdnc/bin/startODL.sh
+---
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: $SDNC_DB_APP_NAME
+  namespace: $KUBE_NONRTRIC_NAMESPACE
+  labels:
+    run: $SDNC_DB_APP_NAME
+    autotest: SDNC
+spec:
+  replicas: 1
+  selector:
+    matchLabels:
+      run: $SDNC_DB_APP_NAME
+  template:
+    metadata:
+      labels:
+        run: $SDNC_DB_APP_NAME
+        autotest: SDNC
+    spec:
+      containers:
+        - name: $SDNC_DB_APP_NAME
+          image: $SDNC_DB_IMAGE
+          imagePullPolicy: Never
+          ports:
+          - name: http
+            containerPort: 3306
+          env:
+          - name: MYSQL_ROOT_PASSWORD
+            value: openECOMP1.0
+          - name: MYSQL_ROOT_HOST
+            value: '%'
+
index b9391ea..80f60f7 100644 (file)
@@ -37,7 +37,7 @@ services:
         max-size: "30m"
         max-file: "5"
 
-  a1-controller:
+  a1controller:
     image: ${SDNC_A1_CONTROLLER_IMAGE}
     depends_on :
       - db
diff --git a/test/simulator-group/sdnc/svc.yaml b/test/simulator-group/sdnc/svc.yaml
new file mode 100644 (file)
index 0000000..6a9cd1d
--- /dev/null
@@ -0,0 +1,57 @@
+apiVersion: v1
+kind: Service
+metadata:
+  name: $SDNC_APP_NAME
+  namespace: $KUBE_NONRTRIC_NAMESPACE
+  labels:
+    run: $SDNC_APP_NAME
+    autotest: SDNC
+spec:
+  type: ClusterIP
+  ports:
+  - port: $SDNC_EXTERNAL_PORT
+    targetPort: $SDNC_INTERNAL_PORT
+    protocol: TCP
+    name: http
+  - port: $SDNC_EXTERNAL_SECURE_PORT
+    targetPort: $SDNC_INTERNAL_SECURE_PORT
+    protocol: TCP
+    name: https
+  selector:
+    run: $SDNC_APP_NAME
+---
+apiVersion: v1
+kind: Service
+metadata:
+  name: dbhost
+  namespace: $KUBE_NONRTRIC_NAMESPACE
+  labels:
+    run: $SDNC_DB_APP_NAME
+    autotest: SDNC
+spec:
+  type: ClusterIP
+  ports:
+  - port: 3306
+    targetPort: 3306
+    protocol: TCP
+    name: http
+  selector:
+    run: $SDNC_DB_APP_NAME
+---
+apiVersion: v1
+kind: Service
+metadata:
+  name: sdnctldb01
+  namespace: $KUBE_NONRTRIC_NAMESPACE
+  labels:
+    run: $SDNC_DB_APP_NAME
+    autotest: SDNC
+spec:
+  type: ClusterIP
+  ports:
+  - port: 3306
+    targetPort: 3306
+    protocol: TCP
+    name: http
+  selector:
+    run: $SDNC_DB_APP_NAME
\ No newline at end of file
index 9a0616d..56a6e6d 100644 (file)
@@ -219,6 +219,8 @@ var ricbasename="ricsim"
 
 var rc_services=""
 
+var pmsprefix=""
+
 function fetchAllMetrics_pol() {
 
     console.log("Fetching policy metrics " + refreshCount_pol)
@@ -923,14 +925,17 @@ app.get("/mon",function(req, res){
     refreshCount_rc=5
 
     var bn=req.query.basename
+    pmsprefix=req.query.pmsprefix
 
-    if (bn == undefined) {
+    console.log("PMS"+pmsprefix)
+    if ((bn == undefined) || (pmsprefix == undefined)) {
         getCtr=0
-        return res.redirect('/mon?basename=ricsim');
+        return res.redirect('/mon?basename=ricsim&pmsprefix=/a1-policy/v2');
     } else {
         ricbasename=bn
     }
 
+
     //Build web page
        var htmlStr = "<!DOCTYPE html>" +
           "<html>" +
@@ -941,6 +946,7 @@ app.get("/mon",function(req, res){
             "<body>" +
             "<font size=\"-3\" face=\"monospace\">" +
             "<p>Change basename in url if other ric sim prefix is used</p>" +
+            "<p>Change pmsprefix in url if pms with other prefix is used</p>" +
             "</font>" +
             "<h3>Policy agent</h3>" +
             "<font face=\"monospace\">" +