blob: ba61757b6ff25fc04b38d4994929be59205d7801 [file] [log] [blame]
hwchiufdc49242019-11-18 16:37:22 -08001// 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.buildNode}"
24 }
25 options {
26 timeout(time: 40, unit: 'MINUTES')
27 }
28 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} --set voltha-etcd-cluster.clusterSize=3"
41 ROBOT_MISC_ARGS="-d $WORKSPACE/RobotLogs"
42 }
43 stages {
44
45 stage('Download kind-voltha') {
46 steps {
47 sh """
48 git clone https://github.com/ciena/kind-voltha.git
49 """
50 }
51 }
52
53 stage('Deploy Voltha') {
54 steps {
55 sh """
hwchiuc7d5d032019-12-03 16:42:47 -080056 pushd kind-voltha/
hwchiufdc49242019-11-18 16:37:22 -080057 ./voltha up
hwchiuc7d5d032019-12-03 16:42:47 -080058 popd
hwchiufdc49242019-11-18 16:37:22 -080059 """
60 }
61 }
62
63 stage('Run E2E Tests') {
64 steps {
65 sh '''
66 rm -rf $WORKSPACE/RobotLogs; mkdir -p $WORKSPACE/RobotLogs
67 git clone https://gerrit.opencord.org/voltha-system-tests
68 make -C $WORKSPACE/voltha-system-tests ${makeTarget} || true
69 '''
70 }
71 }
72
73 //Remove this stage once https://jira.opencord.org/browse/VOL-1977 be resolved
74 stage('Deploy Voltha Again') {
75 steps {
76 sh """
hwchiuc7d5d032019-12-03 16:42:47 -080077 pushd kind-voltha/
hwchiufdc49242019-11-18 16:37:22 -080078 ./voltha down
79 ./voltha up
hwchiuc7d5d032019-12-03 16:42:47 -080080 popd
hwchiufdc49242019-11-18 16:37:22 -080081 """
82 }
83 }
84 stage('Kubernetes Functional Tests') {
85 steps {
86 sh '''
87 rm -rf $WORKSPACE/RobotLogs; mkdir -p $WORKSPACE/RobotLogs
88 make -C $WORKSPACE/voltha-system-tests system-scale-test || true
89 '''
90 }
91 }
92 }
93
94 post {
95 always {
96 sh '''
97 set +e
98 cd kind-voltha/
99 cp install-minimal.log $WORKSPACE/
100 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\t'}{.imageID}{'\\n'}" | sort | uniq -c
101 kubectl get nodes -o wide
102 kubectl get pods -o wide
103 kubectl get pods -n voltha -o wide
104 ## get default pod logs
105 for pod in \$(kubectl get pods --no-headers | awk '{print \$1}');
106 do
107 if [[ \$pod == *"onos"* && \$pod != *"onos-service"* ]]; then
108 kubectl logs \$pod onos> $WORKSPACE/\$pod.log;
109 else
110 kubectl logs \$pod> $WORKSPACE/\$pod.log;
111 fi
112 done
113 ## get voltha pod logs
114 for pod in \$(kubectl get pods --no-headers -n voltha | awk '{print \$1}');
115 do
116 if [[ \$pod == *"-api-"* ]]; then
117 kubectl logs \$pod arouter -n voltha > $WORKSPACE/\$pod.log;
118 elif [[ \$pod == "bbsim-"* ]]; then
119 kubectl logs \$pod -n voltha -p > $WORKSPACE/\$pod.log;
120 else
121 kubectl logs \$pod -n voltha > $WORKSPACE/\$pod.log;
122 fi
123 done
124 ## clean up node
125 WAIT_ON_DOWN=y ./voltha down
126 cd $WORKSPACE/
127 rm -rf kind-voltha/ voltha-system-tests/ || true
128 '''
129 step([$class: 'RobotPublisher',
130 disableArchiveOutput: false,
131 logFileName: 'RobotLogs/*log*.html',
132 otherFiles: '',
133 outputFileName: 'RobotLogs/*output*.xml',
134 outputPath: '.',
135 passThreshold: 100,
136 reportFileName: 'RobotLogs/*report*.html',
137 unstableThreshold: 0]);
138 archiveArtifacts artifacts: '*.log'
139
140 }
141 }
142}