Kailash Khalasi | c1a90f1 | 2018-09-13 13:13:22 -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 | |
Zack Williams | 5ce76d4 | 2020-02-28 15:45:56 -0700 | [diff] [blame] | 15 | node ("${buildNode}") { |
You Wang | e3214b9 | 2018-10-11 10:59:00 -0700 | [diff] [blame] | 16 | timeout (200) { |
Kailash Khalasi | c1a90f1 | 2018-09-13 13:13:22 -0700 | [diff] [blame] | 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}" |
You Wang | 59ded6c | 2018-10-05 17:43:44 -0700 | [diff] [blame] | 21 | deployment_config = readYaml file: "${configBaseDir}/${configDeploymentDir}/${configFileName}.yaml" |
Kailash Khalasi | c1a90f1 | 2018-09-13 13:13:22 -0700 | [diff] [blame] | 22 | } |
Suchitra Vemuri | 1b1ede2 | 2019-03-05 14:35:15 -0800 | [diff] [blame] | 23 | stage('Download Cord-Tester and Voltha Repo') { |
Kailash Khalasi | c1a90f1 | 2018-09-13 13:13:22 -0700 | [diff] [blame] | 24 | timeout(2) { |
| 25 | sh returnStdout: true, script: """ |
Suchitra Vemuri | 058afcd | 2019-03-05 15:39:50 -0800 | [diff] [blame] | 26 | rm -rf helm-charts cord-tester voltha |
You Wang | 59ded6c | 2018-10-05 17:43:44 -0700 | [diff] [blame] | 27 | git clone -b ${branch} ${cordRepoUrl}/helm-charts |
Kailash Khalasi | c1a90f1 | 2018-09-13 13:13:22 -0700 | [diff] [blame] | 28 | git clone -b ${branch} ${cordRepoUrl}/cord-tester |
Suchitra Vemuri | 1b1ede2 | 2019-03-05 14:35:15 -0800 | [diff] [blame] | 29 | git clone -b ${branch} ${cordRepoUrl}/voltha |
Kailash Khalasi | c1a90f1 | 2018-09-13 13:13:22 -0700 | [diff] [blame] | 30 | """ |
| 31 | } |
| 32 | } |
| 33 | stage('Test Configurations') { |
| 34 | timeout(10) { |
| 35 | sh """ |
| 36 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
| 37 | cd $WORKSPACE/cord-tester/src/test/cord-api/Properties/ |
| 38 | sed -i \"s/^\\(SERVER_IP = \\).*/\\1\'${deployment_config.nodes[0].ip}\'/\" RestApiProperties.py |
| 39 | sed -i \"s/^\\(SERVER_PORT = \\).*/\\1\'30006\'/\" RestApiProperties.py |
| 40 | sed -i \"s/^\\(XOS_USER = \\).*/\\1\'admin@opencord.org\'/\" RestApiProperties.py |
| 41 | sed -i \"s/^\\(XOS_PASSWD = \\).*/\\1\'letmein\'/\" RestApiProperties.py |
| 42 | cd $WORKSPACE/cord-tester/src/test/cord-api/Tests/ |
| 43 | rm -rf Log/ || true |
| 44 | """ |
| 45 | } |
| 46 | } |
| 47 | stage('Subscriber Validation and Ping Tests') { |
You Wang | e3214b9 | 2018-10-11 10:59:00 -0700 | [diff] [blame] | 48 | timeout(180) { |
Kailash Khalasi | c1a90f1 | 2018-09-13 13:13:22 -0700 | [diff] [blame] | 49 | sh """ |
| 50 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
| 51 | cd $WORKSPACE/cord-tester/src/test/cord-api/Tests/ |
Suchitra Vemuri | 9b796f2 | 2019-04-01 16:13:25 -0700 | [diff] [blame] | 52 | robot --removekeywords wuks -d Log -T -l log-ATT_Test001 -V $WORKSPACE/${configBaseDir}/${configDeploymentDir}/${configFileName}.yaml -v POD_NAME:${configFileName} -v KUBERNETES_CONFIGS_DIR:$WORKSPACE/${configBaseDir}/${configKubernetesDir} -v HELM_CHARTS_DIR:$WORKSPACE/helm-charts WorkflowValidations/ATT_Test001.robot || true |
Kailash Khalasi | c1a90f1 | 2018-09-13 13:13:22 -0700 | [diff] [blame] | 53 | """ |
| 54 | } |
| 55 | } |
Suchitra Vemuri | c9501b8 | 2019-04-16 15:44:00 -0700 | [diff] [blame] | 56 | stage('DataPlane Failure Tests') { |
| 57 | timeout(180) { |
| 58 | sh """ |
| 59 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
| 60 | cd $WORKSPACE/cord-tester/src/test/cord-api/Tests/ |
| 61 | robot --removekeywords wuks -d Log -T -l log-DataPlane_FailureTests -V $WORKSPACE/${configBaseDir}/${configDeploymentDir}/${configFileName}.yaml -v POD_NAME:${configFileName} -v KUBERNETES_CONFIGS_DIR:$WORKSPACE/${configBaseDir}/${configKubernetesDir} -v HELM_CHARTS_DIR:$WORKSPACE/helm-charts WorkflowValidations/DataPlane_FailureTests.robot || true |
| 62 | """ |
| 63 | } |
| 64 | } |
Kailash | 3286b3f | 2019-07-29 18:43:26 -0700 | [diff] [blame] | 65 | stage('System Upgrade Tests') { |
| 66 | timeout(180) { |
| 67 | sh """ |
| 68 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
| 69 | ## re-push tosca to ensure environment state |
| 70 | cd $WORKSPACE/${configBaseDir}/${configToscaDir}/att-workflow |
| 71 | curl -s -H "xos-username:admin@opencord.org" -H "xos-password:letmein" -X POST --data-binary @${configFileName}-fabric.yaml http://${deployment_config.nodes[0].ip}:30007/run || true |
| 72 | curl -s -H "xos-username:admin@opencord.org" -H "xos-password:letmein" -X POST --data-binary @${configFileName}-subscriber.yaml http://${deployment_config.nodes[0].ip}:30007/run || true |
| 73 | curl -s -H "xos-username:admin@opencord.org" -H "xos-password:letmein" -X POST --data-binary @${configFileName}-olt.yaml http://${deployment_config.nodes[0].ip}:30007/run || true |
| 74 | cd $WORKSPACE/cord-tester/src/test/cord-api/Tests/ |
Kailash | 5ed7a08 | 2019-07-30 07:10:34 -0700 | [diff] [blame] | 75 | robot --removekeywords wuks -d Log -T -l log-SystemUpgrade -V $WORKSPACE/${configBaseDir}/${configDeploymentDir}/${configFileName}.yaml -v POD_NAME:${configFileName} -v KUBERNETES_CONFIGS_DIR:$WORKSPACE/${configBaseDir}/${configKubernetesDir} -v HELM_CHARTS_DIR:$WORKSPACE/helm-charts -e notready WorkflowValidations/SystemUpgrade.robot || true |
Kailash | 3286b3f | 2019-07-29 18:43:26 -0700 | [diff] [blame] | 76 | """ |
| 77 | } |
| 78 | } |
Kailash Khalasi | c1a90f1 | 2018-09-13 13:13:22 -0700 | [diff] [blame] | 79 | stage('Publish test results') { |
| 80 | sh returnStdout: true, script: """ |
| 81 | if [ -d RobotLogs ]; then rm -r RobotLogs; fi; mkdir RobotLogs; |
| 82 | mkdir RobotLogs/TestDoc || true |
| 83 | cp -r $WORKSPACE/cord-tester/src/test/robot/Log/* $WORKSPACE/RobotLogs || true |
| 84 | cp -r $WORKSPACE/cord-tester/src/test/cord-api/Tests/Log/* $WORKSPACE/RobotLogs || true |
| 85 | """ |
Kailash Khalasi | c1a90f1 | 2018-09-13 13:13:22 -0700 | [diff] [blame] | 86 | step([$class: 'RobotPublisher', |
| 87 | disableArchiveOutput: false, |
| 88 | logFileName: 'RobotLogs/log*.html', |
| 89 | otherFiles: '', |
| 90 | outputFileName: 'RobotLogs/output*.xml', |
| 91 | outputPath: '.', |
| 92 | passThreshold: 100, |
| 93 | reportFileName: 'RobotLogs/report*.html', |
| 94 | unstableThreshold: 0 |
| 95 | ]) |
| 96 | } |
| 97 | currentBuild.result = 'SUCCESS' |
| 98 | } catch (err) { |
| 99 | currentBuild.result = 'FAILURE' |
| 100 | step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "${notificationEmail}", sendToIndividuals: false]) |
| 101 | } |
| 102 | echo "RESULT: ${currentBuild.result}" |
| 103 | } |
| 104 | } |