blob: 30a4011341a35fecea6caa73eb0a762d69d52932 [file] [log] [blame]
Suchitra Vemuribaed17e2019-08-30 15:22:09 -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}") {
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 Vemurib9945942019-09-11 15:39:02 -070026 rm -rf helm-charts cord-tester voltha voltha-system-tests
Matteo Scandolo1294aeb2019-09-24 16:20:32 -070027 git clone -b ${branch} ${cordRepoUrl}/helm-charts # NOTE do we need helm-charts?
Suchitra Vemuribaed17e2019-08-30 15:22:09 -070028 git clone -b ${branch} ${cordRepoUrl}/cord-tester
29 git clone -b ${branch} ${cordRepoUrl}/voltha-system-tests
Matteo Scandolo1294aeb2019-09-24 16:20:32 -070030 git clone -b ${branch} ${cordRepoUrl}/voltha # NOTE do we need the voltha source code??
Suchitra Vemuribaed17e2019-08-30 15:22:09 -070031 """
32 }
33 }
34 stage('Subscriber Validation and Ping Tests') {
35 timeout(180) {
36 sh """
37 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
Suchitra Vemurida6dda92019-10-15 18:30:16 -070038 cd $WORKSPACE
39 rm -rf *.log
Suchitra Vemuri017a14b2019-10-30 14:31:29 -070040 export VOLTCONFIG=/home/cord/.volt/config ; sleep 10
Suchitra Vemuribaed17e2019-08-30 15:22:09 -070041 cd $WORKSPACE/voltha-system-tests/tests
Suchitra Vemurib8ed2d52019-09-30 13:22:51 -070042 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
Matteo Scandolo727c7972020-04-13 13:09:25 -070043 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\t'}{.image}{'\\n'}" | sort | uniq
44 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\t'}{.imageID}{'\\n'}" | sort | uniq
Suchitra Vemurida6dda92019-10-15 18:30:16 -070045 kubectl get nodes -o wide
46 kubectl get pods -n voltha -o wide
Suchitra Vemuribaed17e2019-08-30 15:22:09 -070047 """
48 }
49 }
50 stage('Publish test results') {
51 sh returnStdout: true, script: """
52 if [ -d RobotLogs ]; then rm -r RobotLogs; fi; mkdir RobotLogs;
53 mkdir RobotLogs/TestDoc || true
Suchitra Vemuri59003862019-10-01 21:59:11 -070054 cp -r $WORKSPACE/voltha-system-tests/tests/Log/* $WORKSPACE/RobotLogs || true
Kailashe7be87f2019-09-12 12:54:54 -070055 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
56 ## get default pod logs
57 for pod in \$(kubectl get pods --no-headers | awk '{print \$1}');
58 do
59 if [[ \$pod == *"onos"* && \$pod != *"onos-service"* ]]; then
60 kubectl logs \$pod onos> $WORKSPACE/\$pod.log;
61 else
62 kubectl logs \$pod> $WORKSPACE/\$pod.log;
63 fi
64 done
65 ## get voltha pod logs
66 for pod in \$(kubectl get pods --no-headers -n voltha | awk '{print \$1}');
67 do
68 if [[ \$pod == *"-api-"* ]]; then
69 kubectl logs \$pod arouter -n voltha > $WORKSPACE/\$pod.log;
70 else
71 kubectl logs \$pod -n voltha > $WORKSPACE/\$pod.log;
72 fi
73 done
Suchitra Vemuribaed17e2019-08-30 15:22:09 -070074 """
75 step([$class: 'RobotPublisher',
76 disableArchiveOutput: false,
77 logFileName: 'RobotLogs/log*.html',
78 otherFiles: '',
79 outputFileName: 'RobotLogs/output*.xml',
80 outputPath: '.',
81 passThreshold: 100,
82 reportFileName: 'RobotLogs/report*.html',
83 unstableThreshold: 0
Kailashe7be87f2019-09-12 12:54:54 -070084 ]);
85 archiveArtifacts artifacts: '*.log'
Suchitra Vemuribaed17e2019-08-30 15:22:09 -070086 }
87 currentBuild.result = 'SUCCESS'
88 } catch (err) {
89 currentBuild.result = 'FAILURE'
90 step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "${notificationEmail}", sendToIndividuals: false])
91 }
92 echo "RESULT: ${currentBuild.result}"
93 }
94}