blob: 8d282c525c6959c96da180f836aa6cc052325179 [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 {
23 label "${params.executorNode}"
24 }
Kailash4b323ff2019-08-02 17:52:49 -070025 options {
26 timeout(time: 40, unit: 'MINUTES')
27 }
Kailash8b8de742019-07-30 08:54:51 -070028
29 stages {
30
31 stage('Download kind-voltha') {
32 steps {
33 sh """
Andy Bavier7787d462019-08-21 15:56:17 -070034 git clone https://github.com/ciena/kind-voltha.git
Kailash8b8de742019-07-30 08:54:51 -070035 """
36 }
37 }
38
39 stage('Deploy Voltha') {
40 steps {
41 sh """
42 cd kind-voltha/
Andy Bavierff4f9952019-10-18 15:22:55 -070043 export DESIRED_VERSION=v2.14.3 # For Helm
Andy Bavierd2216f82019-10-04 17:04:38 -070044 EXTRA_HELM_FLAGS="${params.extraHelmFlags}" VOLTHA_LOG_LEVEL=DEBUG TYPE=minimal WITH_RADIUS=y WITH_BBSIM=y INSTALL_ONOS_APPS=y CONFIG_SADIS=y WITH_SIM_ADAPTERS=n FANCY=0 ./voltha up
Kailash8b8de742019-07-30 08:54:51 -070045 """
46 }
47 }
48
Kailash8b8de742019-07-30 08:54:51 -070049 stage('Run E2E Tests') {
50 steps {
51 sh '''
52 git clone https://gerrit.opencord.org/voltha-system-tests
53 cd kind-voltha/
54 export KUBECONFIG="$(./bin/kind get kubeconfig-path --name="voltha-minimal")"
55 export VOLTCONFIG="/home/jenkins/.volt/config-minimal"
Andy Bavierf96864e2019-09-20 15:10:14 -070056 export PATH=$WORKSPACE/kind-voltha/bin:$PATH
Andy Bavier69e67d52019-10-11 14:10:57 -070057 make -C $WORKSPACE/voltha-system-tests sanity-kind || true
Kailash8b8de742019-07-30 08:54:51 -070058 '''
59 }
60 }
61 }
62
63 post {
64 always {
65 sh '''
66 # copy robot logs
67 if [ -d RobotLogs ]; then rm -r RobotLogs; fi; mkdir RobotLogs
Andy Bavierbdecd992019-10-15 17:41:26 -070068 cp -r $WORKSPACE/voltha-system-tests/tests/*/*.html ./RobotLogs || true
69 cp -r $WORKSPACE/voltha-system-tests/tests/*/*.xml ./RobotLogs || true
Kailash4b323ff2019-08-02 17:52:49 -070070 cd kind-voltha/
71 cp install-minimal.log $WORKSPACE/
72 export KUBECONFIG="$(./bin/kind get kubeconfig-path --name="voltha-minimal")"
73 export VOLTCONFIG="/home/jenkins/.volt/config-minimal"
Andy Bavierf96864e2019-09-20 15:10:14 -070074 export PATH=$WORKSPACE/kind-voltha/bin:$PATH
Kailash07e1a612019-08-06 22:04:36 -070075 kubectl get pods --all-namespaces -o jsonpath="{..image}" |tr -s "[[:space:]]" "\n" | sort | uniq -c
Kailash887a2962019-08-14 13:26:33 -070076 kubectl get nodes -o wide
77 kubectl get pods -o wide
78 kubectl get pods -n voltha -o wide
Kailash4b323ff2019-08-02 17:52:49 -070079 ## get default pod logs
80 for pod in \$(kubectl get pods --no-headers | awk '{print \$1}');
81 do
82 if [[ \$pod == *"onos"* && \$pod != *"onos-service"* ]]; then
83 kubectl logs \$pod onos> $WORKSPACE/\$pod.log;
84 else
85 kubectl logs \$pod> $WORKSPACE/\$pod.log;
86 fi
87 done
88 ## get voltha pod logs
89 for pod in \$(kubectl get pods --no-headers -n voltha | awk '{print \$1}');
90 do
Kailash6be1aa92019-08-05 18:11:11 -070091 if [[ \$pod == *"-api-"* ]]; then
Kailash4b323ff2019-08-02 17:52:49 -070092 kubectl logs \$pod arouter -n voltha > $WORKSPACE/\$pod.log;
93 else
94 kubectl logs \$pod -n voltha > $WORKSPACE/\$pod.log;
95 fi
96 done
Andy Bavier3a58ba32019-09-20 16:31:40 -070097 ## clean up node
98 WAIT_ON_DOWN=y ./voltha down
99 cd $WORKSPACE/
100 rm -rf kind-voltha/ voltha-system-tests/ || true
Kailash8b8de742019-07-30 08:54:51 -0700101 '''
102 step([$class: 'RobotPublisher',
103 disableArchiveOutput: false,
104 logFileName: 'RobotLogs/log*.html',
105 otherFiles: '',
106 outputFileName: 'RobotLogs/output*.xml',
107 outputPath: '.',
Matteo Scandolo26bc17e2019-09-24 09:03:01 -0700108 passThreshold: 100,
Kailash8b8de742019-07-30 08:54:51 -0700109 reportFileName: 'RobotLogs/report*.html',
110 unstableThreshold: 0]);
111 archiveArtifacts artifacts: '*.log'
112
113 }
114 }
115}