Merge "Show and reset Kafka status after every suite"
authorGary Wu <gary.i.wu@huawei.com>
Thu, 4 Apr 2019 18:49:51 +0000 (18:49 +0000)
committerGerrit Code Review <gerrit@onap.org>
Thu, 4 Apr 2019 18:49:51 +0000 (18:49 +0000)
plans/dcaegen2-collectors-hv-ves/testsuites/env_local.sh
plans/dcaegen2-collectors-hv-ves/testsuites/setup.sh
plans/usecases/5G-bulkpm/composefile/docker-compose-e2e.yml
plans/usecases/5G-bulkpm/setup.sh
plans/usecases/5G-bulkpm/teardown.sh
plans/vfc-gvnfm-vnfmgr/sanity-check/setup.sh [new file with mode: 0755]
plans/vfc-gvnfm-vnfmgr/sanity-check/teardown.sh [new file with mode: 0755]
plans/vfc-gvnfm-vnfmgr/sanity-check/testplan.txt [new file with mode: 0644]
tests/usecases/5G-bulkpm/BulkpmE2E.robot
tests/vfc/gvnfm-vnfmgr/test.robot [new file with mode: 0644]
tests/vfc/nfvo-catalog/test.robot

index e1bf2a8..280f0c4 100755 (executable)
@@ -39,5 +39,3 @@ export HV_VES_IMAGE="hv-collector-main"
 export DCAE_APP_SIMULATOR_IMAGE="hv-collector-dcae-app-simulator"
 export XNF_SIMULATOR_IMAGE="hv-ves-collector-xnf-simulator"
 
-
-
index 06eaf54..73fdbc2 100755 (executable)
@@ -21,14 +21,15 @@ set -euo pipefail
 
 RUN_CSIT_LOCAL=${RUN_CSIT_LOCAL:-false}
 
+echo "Replacing obsolete 'docker-py' with 'docker' package"
+pip uninstall -y docker-py
+pip install docker
+
 if ${RUN_CSIT_LOCAL} ; then
-  echo "Building locally - assuming all dependencies are installed"
+  echo "Local run"
   source env_local.sh
 else
-  echo "Default run - install all dependencies"
-  pip uninstall -y docker-py
-  pip install docker
-
+  echo "Default (CI) run"
   COMPOSE_VERSION=1.23.2
   COMPOSE_LOCATION='/usr/local/bin/docker-compose'
   sudo curl -L https://github.com/docker/compose/releases/download/${COMPOSE_VERSION}/docker-compose-$(uname -s)-$(uname -m) -o ${COMPOSE_LOCATION}
index f3c47bb..4f6c4da 100644 (file)
@@ -20,6 +20,8 @@ services:
       interval: 10s
       timeout: 10s
       retries: 5
+    extra_hosts:
+      - "dmaap-dr-node:1.1.1.1"
 
   datarouter-node:
     image: nexus3.onap.org:10001/onap/dmaap/datarouter-node:2.0.2-SNAPSHOT-latest
@@ -33,6 +35,8 @@ services:
     depends_on:
       datarouter-prov:
         condition: service_healthy
+    extra_hosts:
+      - "dmaap-dr-prov:2.2.2.2"
 
   datarouter-subscriber:
       image: nexus3.onap.org:10001/onap/dmaap/datarouter-subscriber:2.0.2-SNAPSHOT-latest
@@ -90,18 +94,4 @@ services:
     container_name: cbs
     image: nexus3.onap.org:10001/onap/org.onap.dcaegen2.platform.configbinding.app-app:latest
     environment:
-       CONSUL_HOST:
-
-  buscontroller:
-    container_name: buscontroller
-    image: nexus3.onap.org:10001/onap/dmaap/dmaap-bc:latest
-    ports:
-      - "18080:8080"
-      - "18443:8443"
-    extra_hosts:
-      - "dmaap-dr-prov:DMAAPDR"
-      - "message-router:DMAAPMR"
-    volumes:
-      - /tmp/docker-databus-controller.conf:/opt/app/config/conf
-    depends_on:
-      - datarouter-prov
+       CONSUL_HOST:
\ No newline at end of file
index 3d3a9ef..5d99b1c 100644 (file)
@@ -76,10 +76,9 @@ sed -i 's/DMAAPMR/'$DMAAP_MR_IP'/g' /tmp/docker-databus-controller.conf
 docker login -u docker -p docker nexus3.onap.org:10001
 docker-compose up -d
 echo "Disregard the message ERROR: for datarouter-node  Container 1234456 is unhealthy, this is expected behaiour at this stage"
-docker kill datarouter-prov
-docker kill datarouter-node
 docker kill vescollector
 docker kill cbs
+sleep 10
 CONSUL_IP=$(docker inspect '--format={{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' consul )
 sed -i -e '/CONSUL_HOST:/ s/:.*/: '$CONSUL_IP'/' docker-compose.yml
 HOST_IP=$(ip route get 8.8.8.8 | awk '/8.8.8.8/ {print $NF}')
@@ -87,6 +86,23 @@ sed -i -e '/DMAAPHOST:/ s/:.*/: '$HOST_IP'/' docker-compose.yml
 MARIADB=$(docker inspect '--format={{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' mariadb )
 sed -i 's/datarouter-mariadb/'$MARIADB'/g' $WORKSPACE/archives/dmaapdr/datarouter/datarouter-docker-compose/src/main/resources/prov_data/provserver.properties
 docker-compose up -d
+sleep 5
+# Get IP address of datarrouger-prov, datarouter-node, fileconsumer-node.
+DR_PROV_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' datarouter-prov)
+DR_NODE_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' datarouter-node)
+DR_SUBSCIBER_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' fileconsumer-node)
+DR_GATEWAY_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.Gateway}}{{end}}' datarouter-prov)
+
+echo DR_PROV_IP=${DR_PROV_IP}
+echo DR_NODE_IP=${DR_NODE_IP}
+echo DR_GATEWAY_IP=${DR_GATEWAY_IP}
+echo DR_SUBSCIBER_IP=${DR_SUBSCIBER_IP}
+
+docker kill datarouter-node
+docker kill datarouter-prov
+sed -i 's/1.1.1.1/'$DR_NODE_IP'/g' docker-compose.yml
+sed -i 's/2.2.2.2/'$DR_PROV_IP'/g' docker-compose.yml
+docker-compose up -d
 
 # Wait for initialization of Docker container for datarouter-node, datarouter-prov and mariadb
 for i in {1..10}; do
@@ -103,23 +119,12 @@ for i in {1..10}; do
 done
 
 sleep 5
-# Get IP address of datarrouger-prov, datarouter-node, fileconsumer-node.
-DR_PROV_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' datarouter-prov)
-DR_NODE_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' datarouter-node)
-DR_SUBSCIBER_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' fileconsumer-node)
-DR_GATEWAY_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.Gateway}}{{end}}' datarouter-prov)
-
-echo DR_PROV_IP=${DR_PROV_IP}
-echo DR_NODE_IP=${DR_NODE_IP}
-echo DR_GATEWAY_IP=${DR_GATEWAY_IP}
-echo DR_SUBSCIBER_IP=${DR_SUBSCIBER_IP}
 
 docker exec -i datarouter-prov sh -c "curl -k  -X PUT https://$DR_PROV_IP:8443/internal/api/NODES?val=dmaap-dr-node\|$DR_GATEWAY_IP"
 docker exec -i datarouter-prov sh -c "curl -k  -X PUT https://$DR_PROV_IP:8443/internal/api/PROV_AUTH_ADDRESSES?val=dmaap-dr-prov\|$DR_GATEWAY_IP"
-docker exec datarouter-prov /bin/sh -c "echo '${DR_NODE_IP}' dmaap-dr-node >> /etc/hosts"
-docker exec datarouter-node /bin/sh -c "echo '${DR_PROV_IP}' dmaap-dr-prov >> /etc/hosts"
 docker exec datarouter-node /bin/sh -c "echo '${DR_SUBSCIBER_IP}' dmaap-dr-subscriber >> /etc/hosts"
 
+
 # Get IP address of DMAAP, KAFKA, Zookeeper
 DMAAP_MR_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $DMAAP)
 KAFKA_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $KAFKA)
@@ -131,11 +136,6 @@ export VESC_IP=${VESC_IP}
 export HOST_IP=${HOST_IP}
 export DMAAP_MR_IP=${DMAAP_MR_IP}
 
-docker kill buscontroller
-sed -i 's/DMAAPDR/'$DR_PROV_IP'/g' docker-compose.yml
-sed -i 's/DMAAPMR/'$DMAAP_MR_IP'/g' docker-compose.yml
-docker-compose up -d
-sed -i 's/DMAAPDR/'$DR_PROV_IP'/g' /tmp/docker-databus-controller.conf
 
 # Data File Collector configuration :
 sed -i 's/DR_NODE_IP/'$DR_NODE_IP'/g' docker-compose.yml
@@ -156,13 +156,12 @@ docker exec dfc /bin/sh -c " sed -i 's/org.onap.dcaegen2.collectors.datafile: WA
 docker restart dfc
 sleep 2
 
-# Wait for initialization of Docker container for datarouter-node, datarouter-prov and mariadb, Consul, CBS, Buscontroller
+# Wait for initialization of Docker container for datarouter-node, datarouter-prov and mariadb, Consul, CBS
 for i in {1..10}; do
     if  [ $(docker inspect --format '{{ .State.Running }}' consul) ] && \
-        [ $(docker inspect --format '{{ .State.Running }}' cbs) ] && \
-        [ $(docker inspect --format '{{ .State.Running }}' buscontroller) ]
+        [ $(docker inspect --format '{{ .State.Running }}' cbs) ] 
     then
-        echo "Data Router, Consul, Config Binding Service, Buscontroller Services Running"
+        echo "Data Router, Consul, Config Binding Service Services Running"
         break
     else
         echo sleep $i
index 7a99941..78de759 100644 (file)
@@ -15,5 +15,4 @@ kill-instance.sh mariadb
 kill-instance.sh dfc
 kill-instance.sh sftp
 kill-instance.sh cbs
-kill-instance.sh consul
-kill-instance.sh buscontroller
\ No newline at end of file
+kill-instance.sh consul
\ No newline at end of file
diff --git a/plans/vfc-gvnfm-vnfmgr/sanity-check/setup.sh b/plans/vfc-gvnfm-vnfmgr/sanity-check/setup.sh
new file mode 100755 (executable)
index 0000000..0c4efcc
--- /dev/null
@@ -0,0 +1,67 @@
+#!/bin/bash
+#
+# Copyright 2019 ZTE Corporation.
+#
+# 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.
+#
+# Place the scripts in run order:
+# Start all process required for executing test case
+
+source ${SCRIPTS}/common_functions.sh
+
+
+#start msb
+docker run -d -p 8500:8500  --name msb_consul consul:0.9.3
+MSB_CONSUL_IP=`get-instance-ip.sh msb_consul`
+echo MSB_CONSUL_IP=${MSB_CONSUL_IP}
+docker run -d  -p 10081:10081  -e CONSUL_IP=$MSB_CONSUL_IP --name msb_discovery nexus3.onap.org:10001/onap/msb/msb_discovery
+MSB_DISCOVERY_IP=`get-instance-ip.sh msb_discovery`
+echo MSB_DISCOVERY_IP=${MSB_DISCOVERY_IP}
+docker run -d -p 80:80 -e CONSUL_IP=$MSB_CONSUL_IP -e SDCLIENT_IP=$MSB_DISCOVERY_IP -e "ROUTE_LABELS=visualRange:1" --name msb_internal_apigateway nexus3.onap.org:10001/onap/msb/msb_apigateway
+MSB_IAG_IP=`get-instance-ip.sh msb_internal_apigateway`
+echo MSB_IAG_IP=${MSB_IAG_IP}
+
+docker run -d -p 3306:3306 --name vfc-db nexus3.onap.org:10001/onap/vfc/db
+VFC_DB_IP=`get-instance-ip.sh vfc-db`
+echo VFC_DB_IP=${VFC_DB_IP}
+
+# Wait for initialization(8500 Consul, 10081 Service Registration & Discovery, 80 api gateway)
+for i in {1..10}; do
+    curl -sS -m 1 ${MSB_CONSUL_IP}:8500 && curl -sS -m 1 ${MSB_DISCOVERY_IP}:10081 && curl -sS -m 1 ${MSB_IAG_IP}:80 && break
+    echo sleep $i
+    sleep $i
+done
+
+# Wait for initialization(3306 DB)
+for i in {1..3}; do
+    curl -sS -m 1 ${VFC_DB_IP}:3306 && break
+    echo sleep $i
+    sleep $i
+done
+
+# wait for container initalization
+echo sleep 60
+sleep 60
+# start vfc-vnfres
+docker run -d --name vfc-vnfmgr -e MSB_ADDR=${MSB_IAG_IP}:80 -e MYSQL_ADDR=${VFC_DB_IP}:3306 nexus3.onap.org:10001/onap/vfc/vnfmgr
+VNFMGR_IP=`get-instance-ip.sh vfc-vnfmgr`
+
+# Wait for initialization
+for i in {1..10}; do
+    curl -sS ${VNFMGR_IP}:8803 && break
+    echo sleep $i
+    sleep $i
+done
+
+# Pass any variables required by Robot test suites in ROBOT_VARIABLES
+ROBOT_VARIABLES="-v MSB_IAG_IP:${MSB_IAG_IP} -v VNFMGR_IP:${VNFMGR_IP} -v SCRIPTS:${SCRIPTS}"
diff --git a/plans/vfc-gvnfm-vnfmgr/sanity-check/teardown.sh b/plans/vfc-gvnfm-vnfmgr/sanity-check/teardown.sh
new file mode 100755 (executable)
index 0000000..09db55b
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/bash
+#
+# Copyright 2017 ZTE Corporation.
+#
+# 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.
+#
+
+# This script is sourced by run-csit.sh after Robot test completion.
+kill-instance.sh msb_internal_apigateway
+kill-instance.sh msb_discovery
+kill-instance.sh msb_consul
+kill-instance.sh vfc-db
+kill-instance.sh vfc-vnfres
diff --git a/plans/vfc-gvnfm-vnfmgr/sanity-check/testplan.txt b/plans/vfc-gvnfm-vnfmgr/sanity-check/testplan.txt
new file mode 100644 (file)
index 0000000..ac51e67
--- /dev/null
@@ -0,0 +1,3 @@
+# Test suites are relative paths under [integration/csit.git]/tests/.
+# Place the suites in run order.
+vfc/gvnfm-vnfres/test.robot
index f8ba0fb..dcf9721 100644 (file)
@@ -20,9 +20,9 @@ ${CLI_EXEC_CLI}                          curl -k https://${DR_PROV_IP}:8443/inte
 ${CLI_EXEC_CLI_FILECONSUMER}             docker exec fileconsumer-node /bin/sh -c "ls /opt/app/subscriber/delivery | grep .xml"
 ${CLI_EXEC_CLI_DFC_LOG}                  docker exec dfc /bin/sh -c "cat /var/log/ONAP/application.log" > /tmp/dfc_docker.log.robot
 ${CLI_EXEC_CLI_DFC_LOG_GREP}             grep "Publish to DR successful!" /tmp/dfc_docker.log.robot
+${CLI_EXEC_CLI_FILECONSUMER_CP}          docker cp fileconsumer-node:/opt/app/subscriber/delivery/xNF.pm.xml.M %{WORKSPACE}
+${CLI_EXEC_RENAME_METADATA}              mv %{WORKSPACE}/xNF.pm.xml.M  %{WORKSPACE}/metadata.json
 
-${CLI_EXEC_CLI_FILECONSUMER_CP}          docker cp fileconsumer-node:/opt/app/subscriber/delivery/oteNB5309_xNF.pm.xml.M %{WORKSPACE}
-${CLI_EXEC_RENAME_METADATA}              mv %{WORKSPACE}/oteNB5309_xNF.pm.xml.M  %{WORKSPACE}/metadata.json
 ${metadataSchemaPath}                    %{WORKSPACE}/tests/usecases/5G-bulkpm/assets/metadata.schema.json
 ${metadataJsonPath}                      %{WORKSPACE}/metadata.json
 
@@ -86,7 +86,7 @@ Verify Fileconsumer Receive PM file from Data Router
     ${cli_cmd_output}=              Run Process                     ${CLI_EXEC_CLI_FILECONSUMER}        shell=yes
     Log                             ${cli_cmd_output.stdout}
     Should Be Equal As Strings      ${cli_cmd_output.rc}            0
-    Should Contain                  ${cli_cmd_output.stdout}        oteNB5309_xNF.pm.xml
+    Should Contain                  ${cli_cmd_output.stdout}        xNF.pm.xml
 
 Verify File Consumer Receive valid metadata from Data Router
     [Tags]                          Bulk_PM_E2E_06
@@ -94,7 +94,7 @@ Verify File Consumer Receive valid metadata from Data Router
     ${cli_cmd_output}=              Run Process                     ${CLI_EXEC_CLI_FILECONSUMER}        shell=yes
     Log                             ${cli_cmd_output.stdout}
     Should Be Equal As Strings      ${cli_cmd_output.rc}            0
-    Should Contain                  ${cli_cmd_output.stdout}        oteNB5309_xNF.pm.xml.M
+    Should Contain                  ${cli_cmd_output.stdout}        xNF.pm.xml.M
     ${cli_cmd_output}=              Run Process                     ${CLI_EXEC_CLI_FILECONSUMER_CP}     shell=yes
     ${cli_cmd_output}=              Run Process                     ${CLI_EXEC_RENAME_METADATA}         shell=yes
     ${validation_result}=           Validate                        ${metadataSchemaPath}    ${metadataJsonPath}
diff --git a/tests/vfc/gvnfm-vnfmgr/test.robot b/tests/vfc/gvnfm-vnfmgr/test.robot
new file mode 100644 (file)
index 0000000..773d83a
--- /dev/null
@@ -0,0 +1,33 @@
+*** settings ***
+Library     Collections
+Library     RequestsLibrary
+Library     OperatingSystem
+Library     json
+
+*** Variables ***
+@{return_ok_list}=   200  201  202
+${queryswagger_url}    /api/vnfmgr/v1/swagger.json
+${healthcheck_url}   /api/vnfmgr/v1/health_check
+
+*** Test Cases ***
+VnfMgrSwaggerTest
+    [Documentation]    query vnfmgr swagger info rest test
+    ${headers}    Create Dictionary    Content-Type=application/json    Accept=application/json
+    Create Session    web_session    http://${VNFMGR_IP}:8802    headers=${headers}
+    ${resp}=  Get Request    web_session    ${queryswagger_url}
+    ${responese_code}=     Convert To String      ${resp.status_code}
+    List Should Contain Value    ${return_ok_list}   ${responese_code}
+    ${response_json}    json.loads    ${resp.content}
+    ${swagger_version}=    Convert To String      ${response_json['swagger']}
+    Should Be Equal    ${swagger_version}    2.0
+
+VnfMgrHealthCheckTest
+    [Documentation]    check health for vnfmgr by MSB
+    ${headers}    Create Dictionary    Content-Type=application/json    Accept=application/json
+    Create Session    web_session    http://${VNFMGR_IP}:8803    headers=${headers}
+    ${resp}=  Get Request    web_session    ${healthcheck_url}
+    ${responese_code}=     Convert To String      ${resp.status_code}
+    List Should Contain Value    ${return_ok_list}   ${responese_code}
+    ${response_json}    json.loads    ${resp.content}
+    ${health_status}=    Convert To String      ${response_json['status']}
+    Should Be Equal    ${health_status}    active
index 99dff9b..b83bee4 100644 (file)
@@ -9,6 +9,7 @@ Library     json
 ${queryswagger_url}        /api/catalog/v1/swagger.json
 ${queryVNFPackage_url}     /api/catalog/v1/vnfpackages
 ${queryNSPackages_url}     /api/catalog/v1/nspackages
+${healthcheck_url}         /api/catalog/v1/health_check
 
 *** Test Cases ***
 GetVNFPackages
@@ -17,3 +18,14 @@ GetVNFPackages
     ${resp}=              Get Request          web_session                      ${queryVNFPackage_url}
     ${responese_code}=    Convert To String    ${resp.status_code}
     List Should Contain Value    ${return_ok_list}   ${responese_code}
+
+CatalogHealthCheckTest
+    [Documentation]    check health for catalog by MSB
+    ${headers}    Create Dictionary    Content-Type=application/json    Accept=application/json
+    Create Session    web_session    http://${CATALOG_IP}:8806    headers=${headers}
+    ${resp}=  Get Request    web_session    ${healthcheck_url}
+    ${responese_code}=     Convert To String      ${resp.status_code}
+    List Should Contain Value    ${return_ok_list}   ${responese_code}
+    ${response_json}    json.loads    ${resp.content}
+    ${health_status}=    Convert To String      ${response_json['status']}
+    Should Be Equal    ${health_status}    active