blob: d5ecedb367848a5abb82b234df7c5cb8e5282834 [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}"
Andy Bavier3708d072019-12-10 15:22:18 -070041 ROBOT_MISC_ARGS="${params.extraRobotArgs} -d $WORKSPACE/RobotLogs"
Andy Bavier218385e2019-11-13 09:51:38 -070042 }
Kailash8b8de742019-07-30 08:54:51 -070043 stages {
44
Andy Bavier4c8b3232019-11-22 16:17:47 -070045 stage('Repo') {
46 steps {
Andy Bavier2c9ce042019-11-23 07:36:31 -070047 step([$class: 'WsCleanup'])
Andy Bavier4c8b3232019-11-22 16:17:47 -070048 checkout(changelog: true,
49 poll: false,
50 scm: [$class: 'RepoScm',
51 manifestRepositoryUrl: "${params.manifestUrl}",
52 manifestBranch: "${params.manifestBranch}",
53 currentBranch: true,
54 destinationDir: 'voltha',
55 forceSync: true,
56 resetFirst: true,
57 quiet: true,
58 jobs: 4,
59 showAllChanges: true]
60 )
61 }
62 }
63
Kailash8b8de742019-07-30 08:54:51 -070064 stage('Download kind-voltha') {
65 steps {
66 sh """
Andy Bavier7787d462019-08-21 15:56:17 -070067 git clone https://github.com/ciena/kind-voltha.git
Kailash8b8de742019-07-30 08:54:51 -070068 """
69 }
70 }
71
72 stage('Deploy Voltha') {
73 steps {
74 sh """
75 cd kind-voltha/
Andy Bavier218385e2019-11-13 09:51:38 -070076 ./voltha up
Kailash8b8de742019-07-30 08:54:51 -070077 """
78 }
79 }
80
Kailash8b8de742019-07-30 08:54:51 -070081 stage('Run E2E Tests') {
82 steps {
83 sh '''
Andy Bavier2c9ce042019-11-23 07:36:31 -070084 mkdir -p $WORKSPACE/RobotLogs
Kailash8b8de742019-07-30 08:54:51 -070085 git clone https://gerrit.opencord.org/voltha-system-tests
Andy Bavier3708d072019-12-10 15:22:18 -070086 for i in \$(seq 1 ${testRuns})
87 do
88 make -C $WORKSPACE/voltha-system-tests ${makeTarget}
89 kubectl -n voltha delete pod -lapp=bbsim # VOL-2342
90 kubectl -n voltha wait pod -lapp=bbsim --for condition=Ready --timeout=60s # VOL-2342
Andy Bavier529888d2019-12-11 16:55:34 -070091 http -a karaf:karaf --ignore-stdin DELETE http://localhost:8181/onos/v1/applications/org.opencord.dhcpl2relay/active > /dev/null # VOL-2343
92 http -a karaf:karaf --ignore-stdin POST http://localhost:8181/onos/v1/applications/org.opencord.dhcpl2relay/active > /dev/null # VOL-2343
Andy Bavier9ccdbfb2019-12-13 17:05:17 -070093 http -a karaf:karaf --ignore-stdin DELETE http://localhost:8181/onos/v1/applications/org.opencord.aaa/active > /dev/null # VOL-2363
94 http -a karaf:karaf --ignore-stdin POST http://localhost:8181/onos/v1/applications/org.opencord.aaa/active > /dev/null # VOL-2363
Andy Bavier529888d2019-12-11 16:55:34 -070095 sleep 10
Andy Bavier3708d072019-12-10 15:22:18 -070096 done
Kailash8b8de742019-07-30 08:54:51 -070097 '''
98 }
99 }
100 }
101
102 post {
103 always {
104 sh '''
Andy Bavier218385e2019-11-13 09:51:38 -0700105 set +e
Kailash4b323ff2019-08-02 17:52:49 -0700106 cd kind-voltha/
107 cp install-minimal.log $WORKSPACE/
Andy Bavieraec60382019-10-29 15:09:04 -0700108 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\t'}{.imageID}{'\\n'}" | sort | uniq -c
Kailash887a2962019-08-14 13:26:33 -0700109 kubectl get nodes -o wide
110 kubectl get pods -o wide
111 kubectl get pods -n voltha -o wide
Kailash4b323ff2019-08-02 17:52:49 -0700112 ## get default pod logs
113 for pod in \$(kubectl get pods --no-headers | awk '{print \$1}');
114 do
115 if [[ \$pod == *"onos"* && \$pod != *"onos-service"* ]]; then
116 kubectl logs \$pod onos> $WORKSPACE/\$pod.log;
117 else
118 kubectl logs \$pod> $WORKSPACE/\$pod.log;
119 fi
120 done
121 ## get voltha pod logs
122 for pod in \$(kubectl get pods --no-headers -n voltha | awk '{print \$1}');
123 do
Kailash6be1aa92019-08-05 18:11:11 -0700124 if [[ \$pod == *"-api-"* ]]; then
Kailash4b323ff2019-08-02 17:52:49 -0700125 kubectl logs \$pod arouter -n voltha > $WORKSPACE/\$pod.log;
126 else
127 kubectl logs \$pod -n voltha > $WORKSPACE/\$pod.log;
128 fi
129 done
Andy Bavier2c9ce042019-11-23 07:36:31 -0700130 ## shut down voltha
Andy Bavier3a58ba32019-09-20 16:31:40 -0700131 WAIT_ON_DOWN=y ./voltha down
Kailash8b8de742019-07-30 08:54:51 -0700132 '''
133 step([$class: 'RobotPublisher',
134 disableArchiveOutput: false,
135 logFileName: 'RobotLogs/log*.html',
136 otherFiles: '',
137 outputFileName: 'RobotLogs/output*.xml',
138 outputPath: '.',
Matteo Scandolo26bc17e2019-09-24 09:03:01 -0700139 passThreshold: 100,
Kailash8b8de742019-07-30 08:54:51 -0700140 reportFileName: 'RobotLogs/report*.html',
141 unstableThreshold: 0]);
142 archiveArtifacts artifacts: '*.log'
143
144 }
145 }
146}