blob: 7e33c264976e913644756dadcc876e3e2285e6f8 [file] [log] [blame]
Kailash Khalasic1a90f12018-09-13 13:13:22 -07001// 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
15node ("${TestNodeName}") {
You Wange3214b92018-10-11 10:59:00 -070016 timeout (200) {
Kailash Khalasic1a90f12018-09-13 13:13:22 -070017 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 Wang59ded6c2018-10-05 17:43:44 -070021 deployment_config = readYaml file: "${configBaseDir}/${configDeploymentDir}/${configFileName}.yaml"
Kailash Khalasic1a90f12018-09-13 13:13:22 -070022 }
Suchitra Vemuri1b1ede22019-03-05 14:35:15 -080023 stage('Download Cord-Tester and Voltha Repo') {
Kailash Khalasic1a90f12018-09-13 13:13:22 -070024 timeout(2) {
25 sh returnStdout: true, script: """
Suchitra Vemuri058afcd2019-03-05 15:39:50 -080026 rm -rf helm-charts cord-tester voltha
You Wang59ded6c2018-10-05 17:43:44 -070027 git clone -b ${branch} ${cordRepoUrl}/helm-charts
Kailash Khalasic1a90f12018-09-13 13:13:22 -070028 git clone -b ${branch} ${cordRepoUrl}/cord-tester
Suchitra Vemuri1b1ede22019-03-05 14:35:15 -080029 git clone -b ${branch} ${cordRepoUrl}/voltha
Kailash Khalasic1a90f12018-09-13 13:13:22 -070030 """
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 Wange3214b92018-10-11 10:59:00 -070048 timeout(180) {
Kailash Khalasic1a90f12018-09-13 13:13:22 -070049 sh """
50 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
51 cd $WORKSPACE/cord-tester/src/test/cord-api/Tests/
Suchitra Vemuri9b796f22019-04-01 16:13:25 -070052 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 Khalasic1a90f12018-09-13 13:13:22 -070053 """
54 }
55 }
Suchitra Vemuric9501b82019-04-16 15:44:00 -070056 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 Khalasic1a90f12018-09-13 13:13:22 -070065 stage('Publish test results') {
66 sh returnStdout: true, script: """
67 if [ -d RobotLogs ]; then rm -r RobotLogs; fi; mkdir RobotLogs;
68 mkdir RobotLogs/TestDoc || true
69 cp -r $WORKSPACE/cord-tester/src/test/robot/Log/* $WORKSPACE/RobotLogs || true
70 cp -r $WORKSPACE/cord-tester/src/test/cord-api/Tests/Log/* $WORKSPACE/RobotLogs || true
71 """
Kailash Khalasic1a90f12018-09-13 13:13:22 -070072 step([$class: 'RobotPublisher',
73 disableArchiveOutput: false,
74 logFileName: 'RobotLogs/log*.html',
75 otherFiles: '',
76 outputFileName: 'RobotLogs/output*.xml',
77 outputPath: '.',
78 passThreshold: 100,
79 reportFileName: 'RobotLogs/report*.html',
80 unstableThreshold: 0
81 ])
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}