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 | 6a5485b | 2019-09-17 15:26:03 -0700 | [diff] [blame] | 38 | screen -dmS voltha-api-minimal bash -c 'while true; do kubectl port-forward -n voltha service/voltha-api 55555:55555; done' |
| 39 | screen -dmS voltha-ssh kubectl port-forward -n voltha service/voltha-cli 5022:5022 |
Suchitra Vemuri | b994594 | 2019-09-11 15:39:02 -0700 | [diff] [blame] | 40 | export VOLTCONFIG=/home/cord/.volt/config |
Suchitra Vemuri | baed17e | 2019-08-30 15:22:09 -0700 | [diff] [blame] | 41 | cd $WORKSPACE/voltha-system-tests/tests |
Suchitra Vemuri | b8ed2d5 | 2019-09-30 13:22:51 -0700 | [diff] [blame] | 42 | robot --removekeywords wuks -d Log -V $WORKSPACE/${configBaseDir}/${configDeploymentDir}/${configFileName}.yaml -v POD_NAME:${configFileName} -v KUBERNETES_CONFIGS_DIR:$WORKSPACE/${configBaseDir}/${configKubernetesDir} functional/Voltha_PODTests.robot || true |
Suchitra Vemuri | baed17e | 2019-08-30 15:22:09 -0700 | [diff] [blame] | 43 | """ |
| 44 | } |
| 45 | } |
| 46 | stage('Publish test results') { |
| 47 | sh returnStdout: true, script: """ |
| 48 | if [ -d RobotLogs ]; then rm -r RobotLogs; fi; mkdir RobotLogs; |
| 49 | mkdir RobotLogs/TestDoc || true |
Suchitra Vemuri | b8ed2d5 | 2019-09-30 13:22:51 -0700 | [diff] [blame] | 50 | cp -r $WORKSPACE/voltha-system-tests/tests/functional/Log/* $WORKSPACE/RobotLogs || true |
Kailash | e7be87f | 2019-09-12 12:54:54 -0700 | [diff] [blame] | 51 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
| 52 | ## get default pod logs |
| 53 | for pod in \$(kubectl get pods --no-headers | awk '{print \$1}'); |
| 54 | do |
| 55 | if [[ \$pod == *"onos"* && \$pod != *"onos-service"* ]]; then |
| 56 | kubectl logs \$pod onos> $WORKSPACE/\$pod.log; |
| 57 | else |
| 58 | kubectl logs \$pod> $WORKSPACE/\$pod.log; |
| 59 | fi |
| 60 | done |
| 61 | ## get voltha pod logs |
| 62 | for pod in \$(kubectl get pods --no-headers -n voltha | awk '{print \$1}'); |
| 63 | do |
| 64 | if [[ \$pod == *"-api-"* ]]; then |
| 65 | kubectl logs \$pod arouter -n voltha > $WORKSPACE/\$pod.log; |
| 66 | else |
| 67 | kubectl logs \$pod -n voltha > $WORKSPACE/\$pod.log; |
| 68 | fi |
| 69 | done |
Suchitra Vemuri | baed17e | 2019-08-30 15:22:09 -0700 | [diff] [blame] | 70 | """ |
| 71 | step([$class: 'RobotPublisher', |
| 72 | disableArchiveOutput: false, |
| 73 | logFileName: 'RobotLogs/log*.html', |
| 74 | otherFiles: '', |
| 75 | outputFileName: 'RobotLogs/output*.xml', |
| 76 | outputPath: '.', |
| 77 | passThreshold: 100, |
| 78 | reportFileName: 'RobotLogs/report*.html', |
| 79 | unstableThreshold: 0 |
Kailash | e7be87f | 2019-09-12 12:54:54 -0700 | [diff] [blame] | 80 | ]); |
| 81 | archiveArtifacts artifacts: '*.log' |
Suchitra Vemuri | baed17e | 2019-08-30 15:22:09 -0700 | [diff] [blame] | 82 | } |
| 83 | currentBuild.result = 'SUCCESS' |
| 84 | } catch (err) { |
| 85 | currentBuild.result = 'FAILURE' |
| 86 | step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "${notificationEmail}", sendToIndividuals: false]) |
| 87 | } |
| 88 | echo "RESULT: ${currentBuild.result}" |
| 89 | } |
| 90 | } |