Suchitra Vemuri | baed17e | 2019-08-30 15:22:09 -0700 | [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 | node ("${TestNodeName}") { |
| 16 | timeout (200) { |
| 17 | try { |
| 18 | stage ("Parse deployment configuration file") { |
| 19 | sh returnStdout: true, script: "rm -rf ${configBaseDir}" |
| 20 | sh returnStdout: true, script: "git clone -b ${branch} ${cordRepoUrl}/${configBaseDir}" |
| 21 | deployment_config = readYaml file: "${configBaseDir}/${configDeploymentDir}/${configFileName}.yaml" |
| 22 | } |
| 23 | stage('Download Test repos') { |
| 24 | timeout(2) { |
| 25 | sh returnStdout: true, script: """ |
Suchitra Vemuri | b994594 | 2019-09-11 15:39:02 -0700 | [diff] [blame] | 26 | rm -rf helm-charts cord-tester voltha voltha-system-tests |
Matteo Scandolo | 1294aeb | 2019-09-24 16:20:32 -0700 | [diff] [blame] | 27 | git clone -b ${branch} ${cordRepoUrl}/helm-charts # NOTE do we need helm-charts? |
Suchitra Vemuri | baed17e | 2019-08-30 15:22:09 -0700 | [diff] [blame] | 28 | git clone -b ${branch} ${cordRepoUrl}/cord-tester |
| 29 | git clone -b ${branch} ${cordRepoUrl}/voltha-system-tests |
Matteo Scandolo | 1294aeb | 2019-09-24 16:20:32 -0700 | [diff] [blame] | 30 | git clone -b ${branch} ${cordRepoUrl}/voltha # NOTE do we need the voltha source code?? |
Suchitra Vemuri | baed17e | 2019-08-30 15:22:09 -0700 | [diff] [blame] | 31 | """ |
| 32 | } |
| 33 | } |
| 34 | stage('Subscriber Validation and Ping Tests') { |
| 35 | timeout(180) { |
| 36 | sh """ |
| 37 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
Suchitra Vemuri | da6dda9 | 2019-10-15 18:30:16 -0700 | [diff] [blame] | 38 | cd $WORKSPACE |
| 39 | rm -rf *.log |
Suchitra Vemuri | 017a14b | 2019-10-30 14:31:29 -0700 | [diff] [blame] | 40 | export VOLTCONFIG=/home/cord/.volt/config ; sleep 10 |
Matteo Scandolo | 71ae536 | 2020-06-03 11:45:24 -0700 | [diff] [blame] | 41 | cd $WORKSPACE/voltha-system-tests |
| 42 | make vst_venv |
| 43 | source vst_venv/bin/activate |
| 44 | cd tests |
Suchitra Vemuri | 62dbe01 | 2020-06-04 15:27:24 -0700 | [diff] [blame] | 45 | robot --removekeywords wuks -i sanity -i functional -e bbsim -e notready -d Log -V $WORKSPACE/${configBaseDir}/${configDeploymentDir}/${configFileName}.yaml -v POD_NAME:${configFileName} -v KUBERNETES_CONFIGS_DIR:$WORKSPACE/${configBaseDir}/${configKubernetesDir} functional/Voltha_PODTests.robot || true |
| 46 | //robot --removekeywords wuks -i PowerSwitch -i functional -e bbsim -e notready -d Log -T -V $WORKSPACE/${configBaseDir}/${configDeploymentDir}/${configFileName}.yaml -v POD_NAME:${configFileName} -v KUBERNETES_CONFIGS_DIR:$WORKSPACE/${configBaseDir}/${configKubernetesDir} functional/Voltha_FailureScenarios.robot || true |
| 47 | //robot --removekeywords wuks -i functional -e bbsim -e notready -d Log -T -V $WORKSPACE/${configBaseDir}/${configDeploymentDir}/${configFileName}.yaml -v POD_NAME:${configFileName} -v KUBERNETES_CONFIGS_DIR:$WORKSPACE/${configBaseDir}/${configKubernetesDir} functional/Voltha_ErrorScenarios.robot || true |
Matteo Scandolo | 727c797 | 2020-04-13 13:09:25 -0700 | [diff] [blame] | 48 | kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\t'}{.image}{'\\n'}" | sort | uniq |
| 49 | kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\t'}{.imageID}{'\\n'}" | sort | uniq |
Suchitra Vemuri | da6dda9 | 2019-10-15 18:30:16 -0700 | [diff] [blame] | 50 | kubectl get nodes -o wide |
| 51 | kubectl get pods -n voltha -o wide |
Suchitra Vemuri | baed17e | 2019-08-30 15:22:09 -0700 | [diff] [blame] | 52 | """ |
| 53 | } |
| 54 | } |
| 55 | stage('Publish test results') { |
| 56 | sh returnStdout: true, script: """ |
| 57 | if [ -d RobotLogs ]; then rm -r RobotLogs; fi; mkdir RobotLogs; |
| 58 | mkdir RobotLogs/TestDoc || true |
Suchitra Vemuri | 5900386 | 2019-10-01 21:59:11 -0700 | [diff] [blame] | 59 | cp -r $WORKSPACE/voltha-system-tests/tests/Log/* $WORKSPACE/RobotLogs || true |
Kailash | e7be87f | 2019-09-12 12:54:54 -0700 | [diff] [blame] | 60 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
| 61 | ## get default pod logs |
| 62 | for pod in \$(kubectl get pods --no-headers | awk '{print \$1}'); |
| 63 | do |
Matteo Scandolo | 9988d26 | 2020-06-05 08:49:15 -0700 | [diff] [blame] | 64 | kubectl logs \$pod> $WORKSPACE/\$pod.log; |
Kailash | e7be87f | 2019-09-12 12:54:54 -0700 | [diff] [blame] | 65 | done |
| 66 | ## get voltha pod logs |
| 67 | for pod in \$(kubectl get pods --no-headers -n voltha | awk '{print \$1}'); |
| 68 | do |
| 69 | if [[ \$pod == *"-api-"* ]]; then |
| 70 | kubectl logs \$pod arouter -n voltha > $WORKSPACE/\$pod.log; |
| 71 | else |
| 72 | kubectl logs \$pod -n voltha > $WORKSPACE/\$pod.log; |
| 73 | fi |
| 74 | done |
Suchitra Vemuri | baed17e | 2019-08-30 15:22:09 -0700 | [diff] [blame] | 75 | """ |
| 76 | step([$class: 'RobotPublisher', |
| 77 | disableArchiveOutput: false, |
| 78 | logFileName: 'RobotLogs/log*.html', |
| 79 | otherFiles: '', |
| 80 | outputFileName: 'RobotLogs/output*.xml', |
| 81 | outputPath: '.', |
| 82 | passThreshold: 100, |
| 83 | reportFileName: 'RobotLogs/report*.html', |
| 84 | unstableThreshold: 0 |
Kailash | e7be87f | 2019-09-12 12:54:54 -0700 | [diff] [blame] | 85 | ]); |
| 86 | archiveArtifacts artifacts: '*.log' |
Suchitra Vemuri | baed17e | 2019-08-30 15:22:09 -0700 | [diff] [blame] | 87 | } |
| 88 | currentBuild.result = 'SUCCESS' |
| 89 | } catch (err) { |
| 90 | currentBuild.result = 'FAILURE' |
| 91 | step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "${notificationEmail}", sendToIndividuals: false]) |
| 92 | } |
| 93 | echo "RESULT: ${currentBuild.result}" |
| 94 | } |
| 95 | } |