From c17a6a3ac3a97190913e7b28b3294913354d5be3 Mon Sep 17 00:00:00 2001 From: Venkatrangan Govindarajan Date: Thu, 17 Sep 2020 17:33:58 +0530 Subject: [PATCH] Adding new job for odlmicro CSIT - It is a non karaf controller - Added new script to invoke the robot command only - odlmicro will be installed by the robot test JIRA: ODLMICRO-32 Signed-off-by: Venkatrangan Govindarajan Change-Id: I1341ea98c6b1e4a68c3aded4386eedd58c2691d8 --- .../integration-deploy-controller-run-test.sh | 6 + jjb/integration/integration-macros.yaml | 9 ++ jjb/integration/integration-run-test.sh | 110 ++++++++++++++++++ jjb/integration/integration-templates.yaml | 7 ++ jjb/odlmicro/odlmicro-csit.yaml | 37 ++++++ 5 files changed, 169 insertions(+) create mode 100755 jjb/integration/integration-run-test.sh create mode 100644 jjb/odlmicro/odlmicro-csit.yaml diff --git a/jjb/integration/integration-deploy-controller-run-test.sh b/jjb/integration/integration-deploy-controller-run-test.sh index baae769d8..28439606c 100755 --- a/jjb/integration/integration-deploy-controller-run-test.sh +++ b/jjb/integration/integration-deploy-controller-run-test.sh @@ -1,5 +1,10 @@ #!/bin/bash #@IgnoreInspection BashAddShebang + +if [ "${IS_KARAF_APPL}" = "False" ] ; then + echo "Not a Karaf Distro skipping karaf deployment" + exit +fi # Activate robotframework virtualenv # ${ROBOT_VENV} comes from the integration-install-robotframework.sh # script. @@ -7,6 +12,7 @@ source "${ROBOT_VENV}/bin/activate" source /tmp/common-functions.sh "${BUNDLEFOLDER}" + echo "#################################################" echo "## Configure Cluster and Start ##" echo "#################################################" diff --git a/jjb/integration/integration-macros.yaml b/jjb/integration/integration-macros.yaml index 8a1897310..68f479003 100644 --- a/jjb/integration/integration-macros.yaml +++ b/jjb/integration/integration-macros.yaml @@ -345,6 +345,15 @@ builders: - shell: !include-raw: integration-deploy-controller-run-test.sh +# Macro: integration-deply-non-karaf-controller-run-test +# Operation: this macro deploys non-karaf controller application and run test +# Used by: {project}-csit-1node-* job templates + +- builder: + name: integration-run-test + builders: + - shell: !include-raw: integration-run-test.sh + # Macro: integration-configure-clustering # Operation: this macro configures the clustering # Used by: {project}-csit-3node-* job templates diff --git a/jjb/integration/integration-run-test.sh b/jjb/integration/integration-run-test.sh new file mode 100755 index 000000000..35c54ecde --- /dev/null +++ b/jjb/integration/integration-run-test.sh @@ -0,0 +1,110 @@ +#!/bin/bash +#@IgnoreInspection BashAddShebang +if [ "${IS_KARAF_APPL}" = "True" ] ; then + echo "Karaf Deployments, Tests must have already run" + exit +fi +# Activate robotframework virtualenv +# ${ROBOT_VENV} comes from the integration-install-robotframework.sh +# script. +# shellcheck source=${ROBOT_VENV}/bin/activate disable=SC1091 +source "${ROBOT_VENV}/bin/activate" +source /tmp/common-functions.sh "${BUNDLEFOLDER}" +echo "#################################################" +echo "## invoke Tests for non-karaf Controllers ##" +echo "#################################################" + + +# shellcheck disable=SC2034 +nodes_list=$(get_nodes_list) + +add_jvm_support + +if [ "${NUM_OPENSTACK_SYSTEM}" -gt 0 ]; then + echo "Exiting without running tests to deploy openstack for testing" + exit +fi + +echo "Generating mininet variables..." +for i in $(seq 1 "${NUM_TOOLS_SYSTEM}") +do + MININETIP="TOOLS_SYSTEM_${i}_IP" + tools_variables=${tools_variables}" -v ${MININETIP}:${!MININETIP}" +done + +get_test_suites SUITES + +echo "Starting Robot test suites ${SUITES} ..." +# ${TESTOPTIONS}, ${SUITES} are space-separated parameters and should not be quoted. +# shellcheck disable=SC2086 +robot -N "${TESTPLAN}" \ + --removekeywords wuks -c critical -e exclude -e "skip_if_${DISTROSTREAM}" \ + -v BUNDLEFOLDER:"${BUNDLEFOLDER}" \ + -v BUNDLE_URL:"${ACTUAL_BUNDLE_URL}" \ + -v CONTROLLER:"${ODL_SYSTEM_IP}" \ + -v CONTROLLER_USER:"${USER}" \ + -v GERRIT_BRANCH:"${GERRIT_BRANCH}" \ + -v GERRIT_PROJECT:"${GERRIT_PROJECT}" \ + -v GERRIT_REFSPEC:"${GERRIT_REFSPEC}" \ + -v JAVA_HOME:"${JAVA_HOME}" \ + -v JDKVERSION:"${JDKVERSION}" \ + -v JENKINS_WORKSPACE:"${WORKSPACE}" \ + -v MININET1:"${TOOLS_SYSTEM_2_IP}" \ + -v MININET2:"${TOOLS_SYSTEM_3_IP}" \ + -v MININET3:"${TOOLS_SYSTEM_4_IP}" \ + -v MININET4:"${TOOLS_SYSTEM_5_IP}" \ + -v MININET5:"${TOOLS_SYSTEM_6_IP}" \ + -v MININET:"${TOOLS_SYSTEM_IP}" \ + -v MININET_USER:"${USER}" \ + -v NEXUSURL_PREFIX:"${NEXUSURL_PREFIX}" \ + -v NUM_ODL_SYSTEM:"${NUM_ODL_SYSTEM}" \ + -v NUM_TOOLS_SYSTEM:"${NUM_TOOLS_SYSTEM}" \ + -v ODL_STREAM:"${DISTROSTREAM}" \ + -v ODL_SYSTEM_1_IP:"${ODL_SYSTEM_IP}" \ + -v ODL_SYSTEM_IP:"${ODL_SYSTEM_IP}" \ + -v ODL_SYSTEM_USER:"${USER}" \ + -v SUITES:"${SUITES}" \ + -v TOOLS_SYSTEM_IP:"${TOOLS_SYSTEM_IP}" ${tools_variables} \ + -v TOOLS_SYSTEM_USER:"${USER}" \ + -v USER_HOME:"${HOME}" \ + -v WORKSPACE:/tmp \ + ${TESTOPTIONS} ${SUITES} || true + +echo "Examining the files in data/log and checking filesize" +# shellcheck disable=SC2029 +ssh "${ODL_SYSTEM_IP}" "ls -altr /tmp/" +# shellcheck disable=SC2029 +ssh "${ODL_SYSTEM_IP}" "du -hs /tmp/" + +for i in $(seq 1 "${NUM_ODL_SYSTEM}") +do + CONTROLLERIP="ODL_SYSTEM_${i}_IP" + echo "Let's take the karaf thread dump again..." + ssh "${!CONTROLLERIP}" "sudo ps aux" > "${WORKSPACE}"/ps_after.log + pid=$(grep org.opendaylight.netconf.micro.NetconfMain "${WORKSPACE}/ps_after.log" | grep -v grep | tr -s ' ' | cut -f2 -d' ') + echo "karaf main: org.apache.karaf.main.Main, pid:${pid}" + # shellcheck disable=SC2029 + ssh "${!CONTROLLERIP}" "${JAVA_HOME}/bin/jstack -l ${pid}" > "${WORKSPACE}/karaf_${i}_${pid}_threads_after.log" || true + echo "Killing ODL" + set +e # We do not want to create red dot just because something went wrong while fetching logs. + ssh "${!CONTROLLERIP}" bash -c 'ps axf | grep org.opendaylight.netconf.micro.NetconfMain | grep -v grep | awk '"'"'{print "kill -9 " $1}'"'"' | sh' +done + +sleep 5 +# FIXME: Unify the copy process between various scripts. +# TODO: Use rsync. +for i in $(seq 1 "${NUM_ODL_SYSTEM}") +do + CONTROLLERIP="ODL_SYSTEM_${i}_IP" + echo "Compressing karaf.log ${i}" + ssh "${!CONTROLLERIP}" gzip --best "/tmp/odlmicro_netconf.log" + echo "Fetching compressed karaf.log ${i}" + scp "${!CONTROLLERIP}:/tmp/odlmicro_netconf.log.gz" "odlmicro${i}.log.gz" +done + +echo "Examine copied files" +ls -lt + +true # perhaps Jenkins is testing last exit code + +# vim: ts=4 sw=4 sts=4 et ft=sh : diff --git a/jjb/integration/integration-templates.yaml b/jjb/integration/integration-templates.yaml index 427bf02b8..f3b39a4d7 100644 --- a/jjb/integration/integration-templates.yaml +++ b/jjb/integration/integration-templates.yaml @@ -190,12 +190,18 @@ tools_system_count: "1" tools_system_flavor: "odl-highcpu-2" tools_system_image: "ZZCI - Ubuntu 16.04 - mininet-ovs-28 - x86_64 - 20200813-051640.743" + controller-is-a-karaf-feature: "True" ##################### # Job configuration # ##################### parameters: + - string: + name: IS_KARAF_APPL + description: "Boolean to let pipeline know if the project has a different deployer" + default: "{controller-is-a-karaf-feature}" + - integration-csit-parameters: archive-artifacts: "{archive-artifacts}" branch: "{branch}" @@ -265,6 +271,7 @@ - integration-detect-variables - integration-install-common-functions - integration-deploy-controller-run-test + - integration-run-test - integration-cleanup-tmp publishers: diff --git a/jjb/odlmicro/odlmicro-csit.yaml b/jjb/odlmicro/odlmicro-csit.yaml new file mode 100644 index 000000000..4f464e928 --- /dev/null +++ b/jjb/odlmicro/odlmicro-csit.yaml @@ -0,0 +1,37 @@ +--- +- project: + name: odlmicro-csit-system + jobs: + - inttest-csit-1node + + # The project name + project: "odlmicro" + controller-is-a-karaf-feature: "False" + + # The functionality under test + testplan: "{project}-{functionality}.txt" + + # Project branches. + stream: + - silicon: + branch: "master" + jre: "openjdk11" + functionality: "netconf" + robot-options: > + -e ODLMICRO_IGN + -v ODL_MICRO_VERSION:1.0.1-SNAPSHOT + -v NETCONF_TESTTOOL_VERSION:1.9.0-SNAPSHOT + - aluminium: + branch: "stable/aluminium" + jre: "openjdk11" + functionality: "netconf" + robot-options: > + -e ODLMICRO_IGN + -v ODL_MICRO_VERSION:1.0.0-SNAPSHOT + -v NETCONF_TESTTOOL_VERSION:1.9.0-SNAPSHOT + + install: + - manual: + scope: "test" + + tools_system_count: 1 -- 2.36.6