improve dockerized test 57/2757/1
authorYongchaoWu <yongchao.wu@est.tech>
Thu, 5 Mar 2020 11:44:08 +0000 (12:44 +0100)
committeryongchao <yongchao.wu@est.tech>
Wed, 11 Mar 2020 15:49:11 +0000 (16:49 +0100)
Include dashbaord and SDNC A1 Adapter bringing up in the test start.

Issue-ID: NONRTRIC-148
Signed-off-by: YongchaoWu <yongchao.wu@est.tech>
Change-Id: I5f8a94192dde0a5d97113df9173c5f9a9e76024c

near-rt-ric-simulator/auto-test/Dockerize_test.sh
near-rt-ric-simulator/common/test_env.sh
near-rt-ric-simulator/common/testcase_common.sh
near-rt-ric-simulator/simulator-group/consul_cbs/config.json
near-rt-ric-simulator/simulator-group/dashboard/docker-compose.yml [new file with mode: 0644]
near-rt-ric-simulator/simulator-group/sdnc/docker-compose.yml [new file with mode: 0644]

index 93cc310..f959ef8 100755 (executable)
@@ -2,7 +2,7 @@
 
 TC_ONELINE_DESCR="dockerirze the test, setup docker container for policy agent, cbs, consul, near realtime ric simulator"
 
-. ../common/testcase_common.sh $1 $2
+. ../common/testcase_common.sh $1 $2 $3
 
 #### TEST BEGIN ####
 
@@ -16,6 +16,10 @@ start_simulators
 
 consul_config_app         "../simulator-group/consul_cbs/config.json"
 
+start_dashboard
+
+start_sdnc
+
 start_policy_agent
 
 check_policy_agent_logs
index b307a69..b50a02d 100755 (executable)
@@ -2,10 +2,14 @@
 
 # Set the images for the Policy agent app to use for the auto tests. Do not add the image tag.
 #
-# Local image and tag, shall point to locally built image (non-nexus path)
+# Local Policy Agent image and tag, shall point to locally built image (non-nexus path)
 export POLICY_AGENT_LOCAL_IMAGE=o-ran-sc/nonrtric-policy-agent
 # Remote image
 export POLICY_AGENT_REMOTE_IMAGE=nexus3.o-ran-sc.org:10004/o-ran-sc/nonrtric-policy-agent
+# SDNC A1 Adapter remote image
+export SDNC_A1_ADAPTER_IMAGE=nexus3.o-ran-sc.org:10004/o-ran-sc/nonrtric-a1-controller:1.7.4
+# Dashboard remote image
+export DASHBOARD_IMAGE=nexus3.o-ran-sc.org:10004/o-ran-sc/nonrtric-dashboard:1.0.1
 
 # Common env var for auto-test.
 
index d9a012e..7d55b15 100755 (executable)
@@ -2,7 +2,7 @@
 
 . ../common/test_env.sh
 
-echo "Test case started as: ${BASH_SOURCE[$i+1]} "$1 $2
+echo "Test case started as: ${BASH_SOURCE[$i+1]} "$1 $2 $3
 echo "Numbers of ric simulator started" $2
 
 # This is a script that contains all the functions needed for auto test
@@ -13,9 +13,10 @@ START_ARG=$1
 IMAGE_TAG="1.0.0-SNAPSHOT"
 IMAGE_TAG_REMOTE="latest"
 RIC_NUMBER=$2
+SDNC=$3
 
-if [ $# -lt 1 ] || [ $# -gt 2 ]; then
-       echo "Expected arg: local  | remote  and numbers of the rics "
+if [ $# -lt 1 ] || [ $# -gt 4 ]; then
+       echo "Expected arg: local  | remote  and numbers of the rics and SDNC "
        exit 1
 elif [ $1 == "local" ]; then
        if [ -z $POLICY_AGENT_LOCAL_IMAGE ]; then
@@ -165,6 +166,42 @@ start_ric_simulator() {
        echo ""
 }
 
+start_dashboard() {
+
+  DOCKER_SIM_NWNAME="nonrtric-docker-net"
+  echo "Creating docker network $DOCKER_SIM_NWNAME, if needed"
+  docker network ls| grep $DOCKER_SIM_NWNAME > /dev/null || docker network create $DOCKER_SIM_NWNAME
+
+  echo "start dashboard"
+  curdir=$PWD
+  cd $SIM_GROUP
+  cd dashboard/
+
+  docker-compose up -d
+
+  cd $curdir
+       echo ""
+}
+
+start_sdnc() {
+
+  if [ $SDNC == "sdnc" ]; then
+    DOCKER_SIM_NWNAME="nonrtric-docker-net"
+    echo "Creating docker network $DOCKER_SIM_NWNAME, if needed"
+    docker network ls| grep $DOCKER_SIM_NWNAME > /dev/null || docker network create $DOCKER_SIM_NWNAME
+
+    echo "start sdnc"
+    curdir=$PWD
+    cd $SIM_GROUP
+    cd sdnc/
+
+    docker-compose up -d a1-controller
+
+    cd $curdir
+         echo ""
+       fi
+}
+
 prepare_consul_config() {
   echo "prepare consul config"
   curdir=$PWD
@@ -193,6 +230,8 @@ start_simulators() {
        echo ""
 }
 
+
+
 clean_containers() {
        echo "Stopping all containers, policy agent app(s) and simulators with name prefix 'policy_agent'"
        docker stop $(docker ps -q --filter name=/policy-agent) &> /dev/null
@@ -202,6 +241,16 @@ clean_containers() {
        docker stop $(docker ps -q --filter name=ric-simulator) &> /dev/null
        echo "Removing all containers, policy agent app and simulators with name prefix 'ric-simulator'"
        docker rm $(docker ps -a -q --filter name=ric-simulator) &> /dev/null
+       echo "Removing all containers, policy agent app and simulators with name prefix 'dashboard'"
+       docker rm $(docker ps -a -q --filter name=dashboard) &> /dev/null
+       echo "Removing all containers, policy agent app and simulators with name prefix 'a1-controller'"
+       docker rm $(docker ps -a -q --filter name=a1-controller) &> /dev/null
+       echo "Removing all containers, policy agent app and simulators with name prefix 'sdnc_db_container'"
+       docker rm $(docker ps -a -q --filter name=sdnc_db_container) &> /dev/null
+       echo "Removing all containers, policy agent app and simulators with name prefix 'cbs'"
+       docker rm $(docker ps -a -q --filter name=polman_cbs) &> /dev/null
+       echo "Removing all containers, policy agent app and simulators with name prefix 'consul'"
+       docker rm $(docker ps -a -q --filter name=polman_consul) &> /dev/null
        echo "Removing unused docker networks with substring 'policy agent' in network name"
        docker network rm $(docker network ls -q --filter name=nonrtric)
        echo ""
index 432eddf..52acc38 100644 (file)
@@ -1,21 +1,5 @@
 {
     "ric": [
-        {
-            "name": "ric_ric-simulator_6",
-            "baseUrl": "http://ric_ric-simulator_6:8085/",
-            "managedElementIds": [
-                "kista_ric_ric-simulator_6",
-                "stockholm_ric_ric-simulator_6"
-            ]
-        },
-        {
-            "name": "ric_ric-simulator_2",
-            "baseUrl": "http://ric_ric-simulator_2:8085/",
-            "managedElementIds": [
-                "kista_ric_ric-simulator_2",
-                "stockholm_ric_ric-simulator_2"
-            ]
-        },
         {
             "name": "ric_ric-simulator_3",
             "baseUrl": "http://ric_ric-simulator_3:8085/",
             ]
         },
         {
-            "name": "ric_ric-simulator_7",
-            "baseUrl": "http://ric_ric-simulator_7:8085/",
-            "managedElementIds": [
-                "kista_ric_ric-simulator_7",
-                "stockholm_ric_ric-simulator_7"
-            ]
-        },
-        {
-            "name": "ric_ric-simulator_8",
-            "baseUrl": "http://ric_ric-simulator_8:8085/",
-            "managedElementIds": [
-                "kista_ric_ric-simulator_8",
-                "stockholm_ric_ric-simulator_8"
-            ]
-        },
-        {
-            "name": "ric_ric-simulator_5",
-            "baseUrl": "http://ric_ric-simulator_5:8085/",
+            "name": "ric_ric-simulator_2",
+            "baseUrl": "http://ric_ric-simulator_2:8085/",
             "managedElementIds": [
-                "kista_ric_ric-simulator_5",
-                "stockholm_ric_ric-simulator_5"
+                "kista_ric_ric-simulator_2",
+                "stockholm_ric_ric-simulator_2"
             ]
         },
         {
                 "kista_ric_ric-simulator_1",
                 "stockholm_ric_ric-simulator_1"
             ]
-        },
-        {
-            "name": "ric_ric-simulator_9",
-            "baseUrl": "http://ric_ric-simulator_9:8085/",
-            "managedElementIds": [
-                "kista_ric_ric-simulator_9",
-                "stockholm_ric_ric-simulator_9"
-            ]
-        },
-        {
-            "name": "ric_ric-simulator_4",
-            "baseUrl": "http://ric_ric-simulator_4:8085/",
-            "managedElementIds": [
-                "kista_ric_ric-simulator_4",
-                "stockholm_ric_ric-simulator_4"
-            ]
-        },
-        {
-            "name": "ric_ric-simulator_10",
-            "baseUrl": "http://ric_ric-simulator_10:8085/",
-            "managedElementIds": [
-                "kista_ric_ric-simulator_10",
-                "stockholm_ric_ric-simulator_10"
-            ]
         }
     ],
     "streams_publishes": {
         "dmaap_publisher": {
             "type": "message_router",
             "dmaap_info": {
-                "topic_url": "http://admin:admin@localhost:6845/events/A1-POLICY-AGENT-WRITE"
+                "topic_url": "http://message-router:3905/events/A1-POLICY-AGENT-WRITE"
             }
         }
     },
@@ -93,7 +37,7 @@
         "dmaap_subscriber": {
             "type": "message_router",
             "dmaap_info": {
-                "topic_url": "http://admin:admin@localhost:6845/events/A1-POLICY-AGENT-READ/users/policy-agent"
+                "topic_url": "http://message-router:3905/events/A1-POLICY-AGENT-READ/users/policy-agent"
             }
         }
     }
diff --git a/near-rt-ric-simulator/simulator-group/dashboard/docker-compose.yml b/near-rt-ric-simulator/simulator-group/dashboard/docker-compose.yml
new file mode 100644 (file)
index 0000000..ef4ecd3
--- /dev/null
@@ -0,0 +1,15 @@
+networks:
+  nonrtric-docker-net:
+    external:
+      name: nonrtric-docker-net
+services:
+  dashboard:
+    image: nexus3.o-ran-sc.org:10004/o-ran-sc/nonrtric-dashboard:1.0.1
+
+    networks:
+      nonrtric-docker-net: null
+    ports:
+    - 8080:8080
+version: '3.0'
+
+
diff --git a/near-rt-ric-simulator/simulator-group/sdnc/docker-compose.yml b/near-rt-ric-simulator/simulator-group/sdnc/docker-compose.yml
new file mode 100644 (file)
index 0000000..c5007c8
--- /dev/null
@@ -0,0 +1,65 @@
+# ==================================================================================
+#   Modifications 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.
+# ==================================================================================
+version: '2.1'
+
+networks:
+  default:
+    driver: bridge
+    name: nonrtric-docker-net
+
+services:
+  db:
+    image: mysql/mysql-server:5.6
+    container_name: sdnc_db_container
+    networks:
+      - default
+    ports:
+      - "3306"
+    environment:
+      - MYSQL_ROOT_PASSWORD=openECOMP1.0
+      - MYSQL_ROOT_HOST=%
+    logging:
+      driver:   "json-file"
+      options:
+        max-size: "30m"
+        max-file: "5"
+
+  a1-controller:
+    image: nexus3.o-ran-sc.org:10002/o-ran-sc/nonrtric-a1-controller:1.7.4
+    depends_on :
+      - db
+    container_name: a1-controller-container
+    networks:
+      - default
+    entrypoint: ["/opt/onap/sdnc/bin/startODL.sh"]
+    ports:
+      - "8282:8181"
+    links:
+      - db:dbhost
+      - db:sdnctldb01
+      - db:sdnctldb02
+    environment:
+      - MYSQL_ROOT_PASSWORD=openECOMP1.0
+      - SDNC_CONFIG_DIR=/opt/onap/sdnc/data/properties
+    dns:
+      - ${DNS_IP_ADDR-10.0.100.1}
+    logging:
+      driver:   "json-file"
+      options:
+        max-size: "30m"
+        max-file: "5"
+    extra_hosts:
+        aaf.osaaf.org: 10.12.6.214