Enabling testing for the containerized installer 43/98643/4
authorr.kuralamudhan <kuralamudhan.ramakrishnan@intel.com>
Wed, 20 Nov 2019 07:05:47 +0000 (23:05 -0800)
committerr.kuralamudhan <kuralamudhan.ramakrishnan@intel.com>
Wed, 20 Nov 2019 14:41:11 +0000 (06:41 -0800)
Issue-ID: MULTICLOUD-942
Signed-off-by: r.kuralamudhan <kuralamudhan.ramakrishnan@intel.com>
Change-Id: I4c5da84002135d856c5c3dcccf103aa52bb8a0f9

kud/build/Dockerfile
kud/hosting_providers/containerized/README.md
kud/hosting_providers/containerized/installer.sh
kud/tests/plugin_edgex.sh
kud/tests/plugin_fw.sh

index da100bb..38c6329 100644 (file)
@@ -1,4 +1,8 @@
 FROM ubuntu:18.04 as base
+ARG KUD_ENABLE_TESTS=false
+ARG KUD_PLUGIN_ENABLED=false
+ENV KUD_ENABLE_TESTS=$KUD_ENABLE_TESTS
+ENV KUD_PLUGIN_ENABLED=$KUD_PLUGIN_ENABLED
 ADD . /usr/src/multicloud-k8s
 USER root
 SHELL ["/bin/bash", "-c"]
index d165962..12ce1a1 100644 (file)
@@ -27,7 +27,7 @@ Kubernetes jobs(a cluster per job) are used to install multiple clusters and log
 
 ## Quickstart Installation Guide
 
-Build the kud docker images as follows:
+Build the kud docker images as follows, add KUD_ENABLE_TESTS & KUD_PLUGIN_ENABLED for the testing only:
 
 ```
 $ git clone https://github.com/onap/multicloud-k8s.git && cd multicloud-k8s
@@ -38,6 +38,8 @@ $  docker build  --rm \
        --build-arg HTTPS_PROXY=${HTTPS_PROXY} \
        --build-arg no_proxy=${no_proxy} \
        --build-arg NO_PROXY=${NO_PROXY} \
+        --build-arg KUD_ENABLE_TESTS=true \
+        --build-arg KUD_PLUGIN_ENABLED=true \
        -t github.com/onap/multicloud-k8s:latest . -f build/Dockerfile
 ```
 Let's create a cluster-101 and cluster-102 hosts.ini as follows
index ad44dc5..713847e 100755 (executable)
@@ -19,7 +19,7 @@ function install_prerequisites {
 #install package for docker images
     apt-get update
     apt-get install -y curl vim wget git \
-        software-properties-common python-pip
+        software-properties-common python-pip sudo
     add-apt-repository -y ppa:longsleep/golang-backports
     apt-get update
     apt-get install -y golang-go rsync
@@ -136,21 +136,17 @@ function install_addons {
 
 # install_plugin() - Install ONAP Multicloud Kubernetes plugin
 function install_plugin {
-    echo "Installing multicloud/k8s plugin"
-    mkdir -p /opt/{kubeconfig,consul/config}
-    cp $HOME/.kube/config /opt/kubeconfig/kud
-
-    pushd $kud_folder/../../../deployments
-    ./build.sh
+    echo "Installing multicloud/k8s onap4k8s plugin"
     if [[ "${testing_enabled}" == "true" ]]; then
-        ./start.sh
         pushd $kud_tests
-        for functional_test in plugin plugin_edgex plugin_fw; do
-            bash ${functional_test}.sh
+        echo "Test the onap4k8s installation"
+        bash onap4k8s.sh
+        echo "Test the onap4k8s plugin installation"
+        for functional_test in plugin_edgex plugin_fw; do
+            bash ${functional_test}.sh --external
         done
         popd
     fi
-    popd
 }
 
 # _print_kubernetes_info() - Prints the login Kubernetes information
@@ -191,6 +187,7 @@ k8s_info_file=$kud_folder/k8s_info.log
 testing_enabled=${KUD_ENABLE_TESTS:-false}
 
 mkdir -p /opt/csar
+export CSAR_DIR=/opt/csar
 
 function install_pkg {
 # Install dependencies
index 8eae569..ae390ad 100755 (executable)
@@ -17,7 +17,16 @@ source _common_test.sh
 source _functions.sh
 source _common.sh
 
-base_url="http://localhost:9015/v1"
+if [ ${1:+1} ]; then
+    if [ "$1" == "--external" ]; then
+        master_ip=$(kubectl cluster-info | grep "Kubernetes master" | \
+            awk -F ":" '{print $2}' | awk -F "//" '{print $2}')
+        onap_svc_node_port=30498
+        base_url="http://$master_ip:$onap_svc_node_port/v1"
+    fi
+fi
+
+base_url=${base_url:-"http://localhost:9015/v1"}
 kubeconfig_path="$HOME/.kube/config"
 csar_id=cb009bfe-bbee-11e8-9766-525400435678
 rb_name="edgex"
@@ -91,6 +100,9 @@ response="$(call_api -d "${payload}" "${base_url}/instance")"
 echo "$response"
 vnf_id="$(jq -r '.id' <<< "${response}")"
 
+print_msg "Waiting for EdgeX instances"
+sleep 240
+
 print_msg "Validating Kubernetes"
 kubectl get --no-headers=true --namespace=${namespace} deployment edgex-core-command
 kubectl get --no-headers=true --namespace=${namespace} service edgex-core-command
index d7bed4f..eec467c 100755 (executable)
@@ -17,7 +17,16 @@ source _common_test.sh
 source _functions.sh
 source _common.sh
 
-base_url="http://localhost:9015/v1"
+if [ ${1:+1} ]; then
+    if [ "$1" == "--external" ]; then
+        master_ip=$(kubectl cluster-info | grep "Kubernetes master" | \
+            awk -F ":" '{print $2}' | awk -F "//" '{print $2}')
+        onap_svc_node_port=30498
+        base_url="http://$master_ip:$onap_svc_node_port/v1"
+    fi
+fi
+
+base_url=${base_url:-"http://localhost:9015/v1"}
 kubeconfig_path="$HOME/.kube/config"
 csar_id=cc009bfe-bbee-11e8-9766-525400435678
 rb_name="vfw"
@@ -98,6 +107,9 @@ wait_for_pod -n "${namespace}" -l app=firewall
 wait_for_pod -n "${namespace}" -l app=packetgen
 # TODO: Provide some health check to verify vFW work
 
+print_msg "Waiting for VNF instances"
+sleep 480
+
 print_msg "Retrieving VNF details"
 call_api "${base_url}/instance/${vnf_id}"