blob: 916e037b774b6213db804a2667447d4198c65e58 [file] [log] [blame]
Kailash8b8de742019-07-30 08:54:51 -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
15// voltha-2.x e2e tests
16// uses kind-voltha to deploy voltha-2.X
17// uses bbsim to simulate OLT/ONUs
18
19pipeline {
20
21 /* no label, executor is determined by JJB */
22 agent {
Zack Williamsb3292082019-10-11 17:15:18 -070023 label "${params.buildNode}"
Kailash8b8de742019-07-30 08:54:51 -070024 }
Kailash4b323ff2019-08-02 17:52:49 -070025 options {
26 timeout(time: 40, unit: 'MINUTES')
27 }
Andy Bavier218385e2019-11-13 09:51:38 -070028 environment {
29 KUBECONFIG="$HOME/.kube/kind-config-voltha-minimal"
30 VOLTCONFIG="$HOME/.volt/config-minimal"
31 PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$WORKSPACE/kind-voltha/bin"
32 TYPE="minimal"
33 FANCY=0
34 WITH_SIM_ADAPTERS="n"
35 WITH_RADIUS="y"
36 WITH_BBSIM="y"
37 DEPLOY_K8S="y"
38 VOLTHA_LOG_LEVEL="DEBUG"
39 CONFIG_SADIS="y"
40 EXTRA_HELM_FLAGS="${params.extraHelmFlags}"
41 ROBOT_MISC_ARGS="-d $WORKSPACE/RobotLogs"
42 }
Kailash8b8de742019-07-30 08:54:51 -070043 stages {
44
45 stage('Download kind-voltha') {
46 steps {
47 sh """
Andy Bavier7787d462019-08-21 15:56:17 -070048 git clone https://github.com/ciena/kind-voltha.git
Kailash8b8de742019-07-30 08:54:51 -070049 """
50 }
51 }
52
53 stage('Deploy Voltha') {
54 steps {
55 sh """
56 cd kind-voltha/
Andy Bavier218385e2019-11-13 09:51:38 -070057 ./voltha up
Kailash8b8de742019-07-30 08:54:51 -070058 """
59 }
60 }
61
Kailash8b8de742019-07-30 08:54:51 -070062 stage('Run E2E Tests') {
63 steps {
64 sh '''
Andy Bavier218385e2019-11-13 09:51:38 -070065 rm -rf $WORKSPACE/RobotLogs; mkdir -p $WORKSPACE/RobotLogs
Kailash8b8de742019-07-30 08:54:51 -070066 git clone https://gerrit.opencord.org/voltha-system-tests
Andy Bavier218385e2019-11-13 09:51:38 -070067 make -C $WORKSPACE/voltha-system-tests ${makeTarget} || true
Kailash8b8de742019-07-30 08:54:51 -070068 '''
69 }
70 }
71 }
72
73 post {
74 always {
75 sh '''
Andy Bavier218385e2019-11-13 09:51:38 -070076 set +e
Kailash4b323ff2019-08-02 17:52:49 -070077 cd kind-voltha/
78 cp install-minimal.log $WORKSPACE/
Andy Bavieraec60382019-10-29 15:09:04 -070079 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\t'}{.imageID}{'\\n'}" | sort | uniq -c
Kailash887a2962019-08-14 13:26:33 -070080 kubectl get nodes -o wide
81 kubectl get pods -o wide
82 kubectl get pods -n voltha -o wide
Kailash4b323ff2019-08-02 17:52:49 -070083 ## get default pod logs
84 for pod in \$(kubectl get pods --no-headers | awk '{print \$1}');
85 do
86 if [[ \$pod == *"onos"* && \$pod != *"onos-service"* ]]; then
87 kubectl logs \$pod onos> $WORKSPACE/\$pod.log;
88 else
89 kubectl logs \$pod> $WORKSPACE/\$pod.log;
90 fi
91 done
92 ## get voltha pod logs
93 for pod in \$(kubectl get pods --no-headers -n voltha | awk '{print \$1}');
94 do
Kailash6be1aa92019-08-05 18:11:11 -070095 if [[ \$pod == *"-api-"* ]]; then
Kailash4b323ff2019-08-02 17:52:49 -070096 kubectl logs \$pod arouter -n voltha > $WORKSPACE/\$pod.log;
Andy Bavierd55712a2019-10-18 16:00:29 -070097 elif [[ \$pod == "bbsim-"* ]]; then
98 kubectl logs \$pod -n voltha -p > $WORKSPACE/\$pod.log;
Kailash4b323ff2019-08-02 17:52:49 -070099 else
100 kubectl logs \$pod -n voltha > $WORKSPACE/\$pod.log;
101 fi
102 done
Andy Bavier3a58ba32019-09-20 16:31:40 -0700103 ## clean up node
104 WAIT_ON_DOWN=y ./voltha down
105 cd $WORKSPACE/
106 rm -rf kind-voltha/ voltha-system-tests/ || true
Kailash8b8de742019-07-30 08:54:51 -0700107 '''
108 step([$class: 'RobotPublisher',
109 disableArchiveOutput: false,
110 logFileName: 'RobotLogs/log*.html',
111 otherFiles: '',
112 outputFileName: 'RobotLogs/output*.xml',
113 outputPath: '.',
Matteo Scandolo26bc17e2019-09-24 09:03:01 -0700114 passThreshold: 100,
Kailash8b8de742019-07-30 08:54:51 -0700115 reportFileName: 'RobotLogs/report*.html',
116 unstableThreshold: 0]);
117 archiveArtifacts artifacts: '*.log'
118
119 }
120 }
121}