Improvement & Enhancement of csit tests 03/123803/7
authorecaiyanlinux <martin.c.yan@est.tech>
Thu, 2 Sep 2021 10:21:00 +0000 (12:21 +0200)
committerecaiyanlinux <martin.c.yan@est.tech>
Thu, 2 Sep 2021 13:09:36 +0000 (15:09 +0200)
Improve integration with sdnc
Use env variables to replace image urls & tags

Signed-off-by: ecaiyanlinux <martin.c.yan@est.tech>
Issue-ID: CCSDK-3433
Change-Id: Id6d6e428e5ddba018b50710710d077613d02b2e8

csit/scripts/healthcheck/.env [new file with mode: 0644]
csit/scripts/healthcheck/config/application_configuration.json.sdnc
csit/scripts/healthcheck/docker-compose.yml
csit/scripts/healthcheck/sdnc/docker-compose.yml
csit/scripts/healthcheck/test/health_check.sh
csit/scripts/healthcheck/test/pms_a1sim.sh
csit/scripts/healthcheck/test/pms_a1sim_sdnc.sh
csit/tests/healthcheck/test3.robot [new file with mode: 0644]

diff --git a/csit/scripts/healthcheck/.env b/csit/scripts/healthcheck/.env
new file mode 100644 (file)
index 0000000..2794b02
--- /dev/null
@@ -0,0 +1,32 @@
+#  ============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=================================================
+#
+
+#PMS
+PMS_IMAGE_BASE="onap/ccsdk-oran-a1policymanagementservice"
+PMS_IMAGE_TAG="1.2.1-SNAPSHOT-latest"
+
+#A1_SIM
+A1_SIM_IMAGE_BASE="nexus3.o-ran-sc.org:10002/o-ran-sc/a1-simulator"
+A1_SIM_IMAGE_TAG="2.1.0"
+
+#DB
+DB_IMAGE_BASE="mysql/mysql-server"
+DB_IMAGE_TAG="5.6"
+
+#A1CONTROLLER
+A1CONTROLLER_IMAGE_BASE="nexus3.onap.org:10002/onap/sdnc-image"
+A1CONTROLLER_IMAGE_TAG="2.1.2"
\ No newline at end of file
index 66af21f..d38efb8 100644 (file)
@@ -3,7 +3,7 @@
        "controller": [
          {
            "name": "controller1",
-           "baseUrl": "https://sdnc:8443",
+           "baseUrl": "https://a1controller:8443",
            "userName": "admin",
            "password": "Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U"
          }
index 06befdc..d6dda49 100644 (file)
@@ -21,7 +21,7 @@ networks:
 
 services:
   policy-agent:
-    image: onap/ccsdk-oran-a1policymanagementservice:1.2.1-SNAPSHOT-latest
+    image: "${PMS_IMAGE_BASE}:${PMS_IMAGE_TAG}"
     container_name: policy-agent
     networks:
       default:
@@ -39,7 +39,7 @@ services:
     #  - ./config/application-policyagent.yaml:/opt/app/policy-agent/config/application.yaml:ro
 
   a1-sim-OSC:
-    image: nexus3.o-ran-sc.org:10002/o-ran-sc/a1-simulator:2.1.0
+    image: "${A1_SIM_IMAGE_BASE}:${A1_SIM_IMAGE_TAG}"
     container_name: a1-sim-OSC
     networks:
       - default
@@ -52,7 +52,7 @@ services:
       - ALLOW_HTTP=true
 
   a1-sim-STD:
-    image: nexus3.o-ran-sc.org:10002/o-ran-sc/a1-simulator:2.1.0
+    image: "${A1_SIM_IMAGE_BASE}:${A1_SIM_IMAGE_TAG}"
     container_name: a1-sim-STD
     networks:
       - default
@@ -65,7 +65,7 @@ services:
       - ALLOW_HTTP=true
 
   a1-sim-STD-v2:
-    image: nexus3.o-ran-sc.org:10002/o-ran-sc/a1-simulator:2.1.0
+    image: "${A1_SIM_IMAGE_BASE}:${A1_SIM_IMAGE_TAG}"
     container_name: a1-sim-STD-v2
     networks:
       - default
index ace2dec..f6902f9 100644 (file)
@@ -20,73 +20,55 @@ networks:
     driver: bridge
 
 services:
-  mariadb:
-    image: nexus3.onap.org:10001/mariadb:10.1.11
+  db:
+    image: "${DB_IMAGE_BASE}:${DB_IMAGE_TAG}"
+    container_name: sdncdb
+    networks:
+      - default
     ports:
-      - "3306:3306"
-    container_name: mariadb
-    volumes:
-      - /etc/localtime:/etc/localtime:ro
+      - "3306"
     environment:
-      - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
-      - MYSQL_USER=${MYSQL_USER}
-      - MYSQL_PASSWORD=${MYSQL_PASSWORD}
-      - MYSQL_DATABASE=${MYSQL_DATABASE}
-    hostname:
-      mariadb.so.testlab.onap.org
+      - MYSQL_ROOT_PASSWORD=itsASecret
+      - MYSQL_ROOT_HOST=%
+      - MYSQL_USER=sdnctl
+      - MYSQL_PASSWORD=gamma
+      - MYSQL_DATABASE=sdnctl
     logging:
-      driver: "json-file"
+      driver:   "json-file"
       options:
         max-size: "30m"
         max-file: "5"
 
-  sdnc:
-    image: onap/sdnc-image:2.1.2
-    container_name: sdnc
-    volumes:
-      - /etc/localtime:/etc/localtime:ro
-      - ./sdnc/config:/opt/opendaylight/current/certs
+  a1controller:
+    image: "${A1CONTROLLER_IMAGE_BASE}:${A1CONTROLLER_IMAGE_TAG}"
+    depends_on :
+      - db
+    container_name: a1controller
+    networks:
+      - default
     entrypoint: ["/opt/onap/sdnc/bin/startODL.sh"]
     ports:
-      - "8282:8181"
-    hostname:
-      sdnc
+      - 8282:8181
+      - 8444:8443
     links:
-      - mariadb:dbhost
-      - mariadb:sdnctldb01
-      - mariadb:sdnctldb02
+      - db:dbhost
+      - db:sdnctldb01
+      - db:sdnctldb02
     environment:
-      - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
-      - MYSQL_USER=${MYSQL_USER}
-      - MYSQL_PASSWORD=${MYSQL_PASSWORD}
-      - MYSQL_DATABASE=${MYSQL_DATABASE}
+      - MYSQL_ROOT_PASSWORD=itsASecret
+      - MYSQL_USER=sdnctl
+      - MYSQL_PASSWORD=gamma
+      - MYSQL_DATABASE=sdnctl
       - SDNC_CONFIG_DIR=/opt/onap/sdnc/data/properties
       - SDNC_BIN=/opt/onap/sdnc/bin
       - ODL_CERT_DIR=/tmp
-      - ODL_ADMIN_USERNAME=${ODL_USER}
-      - ODL_ADMIN_PASSWORD=${ODL_PASSWORD}
-      - ODL_USER=${ODL_USER}
-      - ODL_PASSWORD=${ODL_PASSWORD}
-      - ODL_CERT_DIR=/opt/opendaylight/current/certs
-      - SDNC_DB_INIT=true  
-      - HONEYCOMB_USER=${HONEYCOMB_USER}
-      - HONEYCOMB_PASSWORD=${HONEYCOMB_PASSWORD}
-      - TRUSTSTORE_PASSWORD=${TRUSTSTORE_PASSWORD}
-      - KEYSTORE_PASSWORD=${KEYSTORE_PASSWORD}
-      - SO_USER=${SO_USER}
-      - SO_PASSWORD=${SO_PASSWORD}
-      - NENG_USER=${NENG_USER}
-      - NENG_PASSWORD=${NENG_PASSWORD}
-      - CDS_USER=${CDS_USER}
-      - CDS_PASSWORD=${CDS_PASSWORD}
-      - ANSIBLE_USER=${ANSIBLE_USER}
-      - ANSIBLE_PASSWORD=${ANSIBLE_PASSWORD}
-      - SQL_CRYPTKEY=${SQL_CRYPTKEY}
+      - ODL_ADMIN_USERNAME=admin
+      - ODL_ADMIN_PASSWORD=Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U
+      - ODL_USER=admin
+      - ODL_PASSWORD=Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U
+      - SDNC_DB_INIT=true
       - A1_TRUSTSTORE_PASSWORD=a1adapter
-    depends_on:
-      - mariadb
-    dns:
-      - ${DNS_IP_ADDR-10.0.100.1}
+      - AAI_TRUSTSTORE_PASSWORD=changeit
     logging:
       driver:   "json-file"
       options:
index 409e85f..e08cc3e 100755 (executable)
@@ -29,9 +29,9 @@ cp application_configuration.json.nosdnc application_configuration.json
 cd ${SHELL_FOLDER}/../
 
 # start NONRTRIC containers with docker compose and configuration from docker-compose.yml
-curl -L https://github.com/docker/compose/releases/download/1.27.0/docker-compose-`uname -s`-`uname -m` > docker-compose
+curl -L https://github.com/docker/compose/releases/download/1.29.0/docker-compose-`uname -s`-`uname -m` > docker-compose
 chmod +x docker-compose
-./docker-compose up -d
+./docker-compose --env-file .env up -d
 
 
 checkStatus(){
index fadc056..b28cc02 100755 (executable)
@@ -25,7 +25,9 @@ cd ${SHELL_FOLDER}/../config
 cp application_configuration.json.nosdnc application_configuration.json
 
 cd ${SHELL_FOLDER}/../
-docker-compose up -d
+curl -L https://github.com/docker/compose/releases/download/1.29.0/docker-compose-`uname -s`-`uname -m` > docker-compose
+chmod +x docker-compose
+./docker-compose --env-file .env up -d
 
 checkStatus(){
     for i in {1..60}; do
index c75d605..c80e68a 100755 (executable)
@@ -26,7 +26,10 @@ cd ${SHELL_FOLDER}/../config
 cp application_configuration.json.sdnc application_configuration.json
 
 cd ${SHELL_FOLDER}/../
-docker-compose -f docker-compose.yml -f sdnc/docker-compose.yml up -d
+
+curl -L https://github.com/docker/compose/releases/download/1.29.0/docker-compose-`uname -s`-`uname -m` > docker-compose
+chmod +x docker-compose
+./docker-compose --env-file .env -f docker-compose.yml -f sdnc/docker-compose.yml up -d
 
 checkStatus(){
     for i in {1..60}; do
diff --git a/csit/tests/healthcheck/test3.robot b/csit/tests/healthcheck/test3.robot
new file mode 100644 (file)
index 0000000..cedac7e
--- /dev/null
@@ -0,0 +1,16 @@
+*** Settings ***
+Library           OperatingSystem
+Library           Process
+
+*** Variables ***
+
+${pms_a1sim_sdnc}      ${SCRIPTS}/healthcheck/test/pms_a1sim_sdnc.sh
+
+
+*** Test Cases ***
+
+Health check test case for NONRTRIC
+    [Documentation]                Deploy NONRTRIC with SDNC
+    Start Process                   ${pms_a1sim_sdnc}  >>  log_hc.txt    shell=yes
+    ${cli_cmd_output}=              Wait For Process    timeout=600
+    Should Be Equal as Integers     ${cli_cmd_output.rc}    0