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" |
| 40 | CONFIG_SADIS="y" |
| 41 | EXTRA_HELM_FLAGS="${params.extraHelmFlags} --set voltha-etcd-cluster.clusterSize=3" |
| 42 | ROBOT_MISC_ARGS="-d $WORKSPACE/RobotLogs" |
| 43 | } |
hwchiu | 593a95a | 2020-01-30 10:09:39 -0800 | [diff] [blame] | 44 | |
hwchiu | fdc4924 | 2019-11-18 16:37:22 -0800 | [diff] [blame] | 45 | stages { |
hwchiu | cd8fc95 | 2020-02-04 13:01:48 -0800 | [diff] [blame] | 46 | stage('Create Kubernetes Cluster') { |
hwchiu | fdc4924 | 2019-11-18 16:37:22 -0800 | [diff] [blame] | 47 | steps { |
| 48 | sh """ |
| 49 | git clone https://github.com/ciena/kind-voltha.git |
hwchiu | c7d5d03 | 2019-12-03 16:42:47 -0800 | [diff] [blame] | 50 | pushd kind-voltha/ |
hwchiu | cd8fc95 | 2020-02-04 13:01:48 -0800 | [diff] [blame] | 51 | JUST_K8S=y ./voltha up |
| 52 | popd |
| 53 | """ |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | stage('Setup log collector') { |
| 58 | steps { |
| 59 | sh """ |
hwchiu | 593a95a | 2020-01-30 10:09:39 -0800 | [diff] [blame] | 60 | 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] | 61 | kail -n voltha -n default > $WORKSPACE/onos-voltha-combined.log & |
| 62 | """ |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | stage('Deploy Voltha') { |
| 67 | steps { |
| 68 | sh """ |
| 69 | pushd kind-voltha/ |
| 70 | ./voltha up |
hwchiu | c7d5d03 | 2019-12-03 16:42:47 -0800 | [diff] [blame] | 71 | popd |
hwchiu | fdc4924 | 2019-11-18 16:37:22 -0800 | [diff] [blame] | 72 | """ |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | stage('Run E2E Tests') { |
| 77 | steps { |
| 78 | sh ''' |
| 79 | rm -rf $WORKSPACE/RobotLogs; mkdir -p $WORKSPACE/RobotLogs |
| 80 | git clone https://gerrit.opencord.org/voltha-system-tests |
hwchiu | 593a95a | 2020-01-30 10:09:39 -0800 | [diff] [blame] | 81 | 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] | 82 | ''' |
| 83 | } |
| 84 | } |
| 85 | |
hwchiu | fdc4924 | 2019-11-18 16:37:22 -0800 | [diff] [blame] | 86 | stage('Kubernetes Functional Tests') { |
| 87 | steps { |
| 88 | sh ''' |
hwchiu | 593a95a | 2020-01-30 10:09:39 -0800 | [diff] [blame] | 89 | 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] | 90 | ''' |
| 91 | } |
| 92 | } |
hwchiu | 8585b57 | 2019-12-16 11:20:43 -0800 | [diff] [blame] | 93 | |
hwchiu | 8585b57 | 2019-12-16 11:20:43 -0800 | [diff] [blame] | 94 | stage('Kubernetes Failure Scenario Tests') { |
| 95 | steps { |
| 96 | sh ''' |
hwchiu | 593a95a | 2020-01-30 10:09:39 -0800 | [diff] [blame] | 97 | 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] | 98 | ''' |
| 99 | } |
| 100 | } |
| 101 | |
hwchiu | fdc4924 | 2019-11-18 16:37:22 -0800 | [diff] [blame] | 102 | } |
| 103 | |
| 104 | post { |
hwchiu | 593a95a | 2020-01-30 10:09:39 -0800 | [diff] [blame] | 105 | always { |
| 106 | sh ''' |
| 107 | set +e |
| 108 | cp $WORKSPACE/kind-voltha/install-full.log $WORKSPACE/ |
| 109 | kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\t'}{.imageID}{'\\n'}" | sort | uniq -c |
| 110 | kubectl get nodes -o wide |
| 111 | kubectl get pods -o wide |
| 112 | kubectl get pods -n voltha -o wide |
hwchiu | 8585b57 | 2019-12-16 11:20:43 -0800 | [diff] [blame] | 113 | |
hwchiu | 593a95a | 2020-01-30 10:09:39 -0800 | [diff] [blame] | 114 | sync |
| 115 | pkill kail || true |
| 116 | |
| 117 | ## Pull out errors from log files |
| 118 | extract_errors_go() { |
| 119 | echo |
| 120 | echo "Error summary for $1:" |
| 121 | grep $1 $WORKSPACE/onos-voltha-combined.log | grep '"level":"error"' | cut -d ' ' -f 2- | jq -r '.msg' |
| 122 | echo |
| 123 | } |
| 124 | |
| 125 | extract_errors_python() { |
| 126 | echo |
| 127 | echo "Error summary for $1:" |
| 128 | grep $1 $WORKSPACE/onos-voltha-combined.log | grep 'ERROR' | cut -d ' ' -f 2- |
| 129 | echo |
| 130 | } |
| 131 | |
| 132 | extract_errors_go voltha-rw-core > $WORKSPACE/error-report.log |
| 133 | extract_errors_go adapter-open-olt >> $WORKSPACE/error-report.log |
| 134 | extract_errors_python adapter-open-onu >> $WORKSPACE/error-report.log |
| 135 | extract_errors_python voltha-ofagent >> $WORKSPACE/error-report.log |
| 136 | |
| 137 | ## shut down kind-voltha |
| 138 | cd $WORKSPACE/kind-voltha |
| 139 | WAIT_ON_DOWN=y ./voltha down |
| 140 | |
| 141 | ''' |
hwchiu | fdc4924 | 2019-11-18 16:37:22 -0800 | [diff] [blame] | 142 | step([$class: 'RobotPublisher', |
| 143 | disableArchiveOutput: false, |
| 144 | logFileName: 'RobotLogs/*log*.html', |
| 145 | otherFiles: '', |
| 146 | outputFileName: 'RobotLogs/*output*.xml', |
| 147 | outputPath: '.', |
| 148 | passThreshold: 100, |
| 149 | reportFileName: 'RobotLogs/*report*.html', |
| 150 | unstableThreshold: 0]); |
| 151 | archiveArtifacts artifacts: '*.log' |
| 152 | |
| 153 | } |
| 154 | } |
| 155 | } |