hwchiu | fdc4924 | 2019-11-18 16:37:22 -0800 | [diff] [blame] | 1 | // Copyright 2017-present Open Networking Foundation |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
| 15 | // voltha-2.x e2e tests |
| 16 | // uses kind-voltha to deploy voltha-2.X |
| 17 | // uses bbsim to simulate OLT/ONUs |
| 18 | |
hwchiu | 8585b57 | 2019-12-16 11:20:43 -0800 | [diff] [blame] | 19 | |
hwchiu | fdc4924 | 2019-11-18 16:37:22 -0800 | [diff] [blame] | 20 | pipeline { |
| 21 | |
| 22 | /* no label, executor is determined by JJB */ |
| 23 | agent { |
| 24 | label "${params.buildNode}" |
| 25 | } |
| 26 | options { |
hwchiu | 8585b57 | 2019-12-16 11:20:43 -0800 | [diff] [blame] | 27 | timeout(time: 80, unit: 'MINUTES') |
hwchiu | fdc4924 | 2019-11-18 16:37:22 -0800 | [diff] [blame] | 28 | } |
| 29 | environment { |
hwchiu | 593a95a | 2020-01-30 10:09:39 -0800 | [diff] [blame] | 30 | KUBECONFIG="$HOME/.kube/kind-config-voltha-full" |
| 31 | VOLTCONFIG="$HOME/.volt/config-full" |
hwchiu | fdc4924 | 2019-11-18 16:37:22 -0800 | [diff] [blame] | 32 | PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$WORKSPACE/kind-voltha/bin" |
hwchiu | 593a95a | 2020-01-30 10:09:39 -0800 | [diff] [blame] | 33 | TYPE="full" |
hwchiu | fdc4924 | 2019-11-18 16:37:22 -0800 | [diff] [blame] | 34 | FANCY=0 |
| 35 | WITH_SIM_ADAPTERS="n" |
| 36 | WITH_RADIUS="y" |
| 37 | WITH_BBSIM="y" |
| 38 | DEPLOY_K8S="y" |
| 39 | VOLTHA_LOG_LEVEL="DEBUG" |
Andrea Campanella | f300fc3 | 2020-09-11 14:01:12 +0200 | [diff] [blame] | 40 | CONFIG_SADIS="external" |
| 41 | BBSIM_CFG="configs/bbsim-sadis-att.yaml" |
hwchiu | fdc4924 | 2019-11-18 16:37:22 -0800 | [diff] [blame] | 42 | ROBOT_MISC_ARGS="-d $WORKSPACE/RobotLogs" |
Matteo Scandolo | b611b1f | 2021-01-05 09:11:49 -0800 | [diff] [blame] | 43 | NUM_OF_ETCD=3 |
| 44 | SCHEDULE_ON_CONTROL_NODES="y" |
hwchiu | fdc4924 | 2019-11-18 16:37:22 -0800 | [diff] [blame] | 45 | } |
hwchiu | 593a95a | 2020-01-30 10:09:39 -0800 | [diff] [blame] | 46 | |
hwchiu | fdc4924 | 2019-11-18 16:37:22 -0800 | [diff] [blame] | 47 | stages { |
hwchiu | cd8fc95 | 2020-02-04 13:01:48 -0800 | [diff] [blame] | 48 | stage('Create Kubernetes Cluster') { |
hwchiu | fdc4924 | 2019-11-18 16:37:22 -0800 | [diff] [blame] | 49 | steps { |
| 50 | sh """ |
Andy Bavier | b5c8caf | 2020-04-06 14:12:07 -0700 | [diff] [blame] | 51 | git clone https://gerrit.opencord.org/kind-voltha |
hwchiu | c7d5d03 | 2019-12-03 16:42:47 -0800 | [diff] [blame] | 52 | pushd kind-voltha/ |
hwchiu | cd8fc95 | 2020-02-04 13:01:48 -0800 | [diff] [blame] | 53 | JUST_K8S=y ./voltha up |
| 54 | popd |
| 55 | """ |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | stage('Setup log collector') { |
| 60 | steps { |
| 61 | sh """ |
hwchiu | 593a95a | 2020-01-30 10:09:39 -0800 | [diff] [blame] | 62 | bash <( curl -sfL https://raw.githubusercontent.com/boz/kail/master/godownloader.sh) -b "$WORKSPACE/kind-voltha/bin" |
hwchiu | cd8fc95 | 2020-02-04 13:01:48 -0800 | [diff] [blame] | 63 | kail -n voltha -n default > $WORKSPACE/onos-voltha-combined.log & |
| 64 | """ |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | stage('Deploy Voltha') { |
| 69 | steps { |
| 70 | sh """ |
Andy Bavier | 22a8da0 | 2020-03-31 12:40:09 -0700 | [diff] [blame] | 71 | export EXTRA_HELM_FLAGS="" |
Andy Bavier | cf2afa4 | 2020-03-31 10:20:27 -0700 | [diff] [blame] | 72 | if [ "${branch}" != "master" ]; then |
| 73 | echo "on branch: ${branch}, sourcing kind-voltha/releases/${branch}" |
| 74 | source "$WORKSPACE/kind-voltha/releases/${branch}" |
Andy Bavier | 10926f1 | 2020-03-27 16:53:43 -0700 | [diff] [blame] | 75 | else |
| 76 | echo "on master, using default settings for kind-voltha" |
| 77 | fi |
| 78 | |
Matteo Scandolo | b611b1f | 2021-01-05 09:11:49 -0800 | [diff] [blame] | 79 | EXTRA_HELM_FLAGS+="${params.extraHelmFlags} " |
Andy Bavier | 22a8da0 | 2020-03-31 12:40:09 -0700 | [diff] [blame] | 80 | echo \$EXTRA_HELM_FLAGS |
Andy Bavier | b567af7 | 2020-03-30 10:27:15 -0700 | [diff] [blame] | 81 | |
hwchiu | cd8fc95 | 2020-02-04 13:01:48 -0800 | [diff] [blame] | 82 | pushd kind-voltha/ |
| 83 | ./voltha up |
hwchiu | c7d5d03 | 2019-12-03 16:42:47 -0800 | [diff] [blame] | 84 | popd |
hwchiu | fdc4924 | 2019-11-18 16:37:22 -0800 | [diff] [blame] | 85 | """ |
| 86 | } |
| 87 | } |
| 88 | |
| 89 | stage('Run E2E Tests') { |
| 90 | steps { |
| 91 | sh ''' |
| 92 | rm -rf $WORKSPACE/RobotLogs; mkdir -p $WORKSPACE/RobotLogs |
Andy Bavier | cf2afa4 | 2020-03-31 10:20:27 -0700 | [diff] [blame] | 93 | git clone -b ${branch} https://gerrit.opencord.org/voltha-system-tests |
hwchiu | 593a95a | 2020-01-30 10:09:39 -0800 | [diff] [blame] | 94 | make ROBOT_DEBUG_LOG_OPT="-l sanity_log.html -r sanity_report.html -o sanity_output.xml" -C $WORKSPACE/voltha-system-tests ${makeTarget} |
hwchiu | fdc4924 | 2019-11-18 16:37:22 -0800 | [diff] [blame] | 95 | ''' |
| 96 | } |
| 97 | } |
| 98 | |
Andy Bavier | 4be3706 | 2020-06-29 15:17:26 -0700 | [diff] [blame] | 99 | stage('Kubernetes ETCD Scale Test') { |
hwchiu | fdc4924 | 2019-11-18 16:37:22 -0800 | [diff] [blame] | 100 | steps { |
| 101 | sh ''' |
hwchiu | 593a95a | 2020-01-30 10:09:39 -0800 | [diff] [blame] | 102 | make ROBOT_DEBUG_LOG_OPT="-l functional_log.html -r functional_report.html -o functional_output.xml" -C $WORKSPACE/voltha-system-tests system-scale-test |
hwchiu | fdc4924 | 2019-11-18 16:37:22 -0800 | [diff] [blame] | 103 | ''' |
| 104 | } |
| 105 | } |
hwchiu | 8585b57 | 2019-12-16 11:20:43 -0800 | [diff] [blame] | 106 | |
Andy Bavier | 4be3706 | 2020-06-29 15:17:26 -0700 | [diff] [blame] | 107 | stage('Kubernetes ETCD Failure Test') { |
hwchiu | 8585b57 | 2019-12-16 11:20:43 -0800 | [diff] [blame] | 108 | steps { |
| 109 | sh ''' |
hwchiu | 593a95a | 2020-01-30 10:09:39 -0800 | [diff] [blame] | 110 | make ROBOT_DEBUG_LOG_OPT="-l failure_log.html -r failure_report.html -o failure_output.xml" -C $WORKSPACE/voltha-system-tests failure-test |
hwchiu | 8585b57 | 2019-12-16 11:20:43 -0800 | [diff] [blame] | 111 | ''' |
| 112 | } |
| 113 | } |
| 114 | |
hwchiu | fdc4924 | 2019-11-18 16:37:22 -0800 | [diff] [blame] | 115 | } |
| 116 | |
| 117 | post { |
hwchiu | 593a95a | 2020-01-30 10:09:39 -0800 | [diff] [blame] | 118 | always { |
| 119 | sh ''' |
| 120 | set +e |
| 121 | cp $WORKSPACE/kind-voltha/install-full.log $WORKSPACE/ |
Matteo Scandolo | 97b1257 | 2020-04-13 12:44:46 -0700 | [diff] [blame] | 122 | kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}" | sort | uniq |
| 123 | kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.imageID}{'\\n'}" | sort | uniq |
hwchiu | 593a95a | 2020-01-30 10:09:39 -0800 | [diff] [blame] | 124 | kubectl get nodes -o wide |
| 125 | kubectl get pods -o wide |
| 126 | kubectl get pods -n voltha -o wide |
hwchiu | 8585b57 | 2019-12-16 11:20:43 -0800 | [diff] [blame] | 127 | |
hwchiu | 593a95a | 2020-01-30 10:09:39 -0800 | [diff] [blame] | 128 | sync |
| 129 | pkill kail || true |
| 130 | |
| 131 | ## Pull out errors from log files |
| 132 | extract_errors_go() { |
| 133 | echo |
| 134 | echo "Error summary for $1:" |
| 135 | grep $1 $WORKSPACE/onos-voltha-combined.log | grep '"level":"error"' | cut -d ' ' -f 2- | jq -r '.msg' |
| 136 | echo |
| 137 | } |
| 138 | |
| 139 | extract_errors_python() { |
| 140 | echo |
| 141 | echo "Error summary for $1:" |
| 142 | grep $1 $WORKSPACE/onos-voltha-combined.log | grep 'ERROR' | cut -d ' ' -f 2- |
| 143 | echo |
| 144 | } |
| 145 | |
| 146 | extract_errors_go voltha-rw-core > $WORKSPACE/error-report.log |
| 147 | extract_errors_go adapter-open-olt >> $WORKSPACE/error-report.log |
| 148 | extract_errors_python adapter-open-onu >> $WORKSPACE/error-report.log |
| 149 | extract_errors_python voltha-ofagent >> $WORKSPACE/error-report.log |
| 150 | |
| 151 | ## shut down kind-voltha |
| 152 | cd $WORKSPACE/kind-voltha |
| 153 | WAIT_ON_DOWN=y ./voltha down |
| 154 | |
| 155 | ''' |
hwchiu | fdc4924 | 2019-11-18 16:37:22 -0800 | [diff] [blame] | 156 | step([$class: 'RobotPublisher', |
| 157 | disableArchiveOutput: false, |
| 158 | logFileName: 'RobotLogs/*log*.html', |
| 159 | otherFiles: '', |
| 160 | outputFileName: 'RobotLogs/*output*.xml', |
| 161 | outputPath: '.', |
| 162 | passThreshold: 100, |
| 163 | reportFileName: 'RobotLogs/*report*.html', |
| 164 | unstableThreshold: 0]); |
| 165 | archiveArtifacts artifacts: '*.log' |
| 166 | |
| 167 | } |
| 168 | } |
| 169 | } |