blob: a167a29335c9bfa08c9410b5988799992fdcfdaa [file] [log] [blame]
Andy Bavier0088c212020-01-08 13:44:03 -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.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="n"
Andy Bavier4af02722020-01-15 10:24:24 -070040 EXTRA_HELM_FLAGS="--set log_agent.enabled=False ${params.extraHelmFlags}"
Andy Bavier4a02b232020-01-09 14:50:30 -070041 ROBOT_MISC_ARGS="${params.extraRobotArgs} -d $WORKSPACE/RobotLogs"
Andy Bavier0088c212020-01-08 13:44:03 -070042 }
43 stages {
44
45 stage('Repo') {
46 steps {
47 step([$class: 'WsCleanup'])
48 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
64 stage('Download kind-voltha') {
65 steps {
66 sh """
67 git clone https://github.com/ciena/kind-voltha.git
68 """
69 }
70 }
71
72 stage('Deploy Voltha') {
73 steps {
74 sh """
75 cd kind-voltha/
Andy Bavier4af02722020-01-15 10:24:24 -070076 JUST_K8S=y ./voltha up
77 kail -n voltha -n default > $WORKSPACE/onos-voltha-combined.log &
Andy Bavier0088c212020-01-08 13:44:03 -070078 ./voltha up
79 """
80 }
81 }
82
83 stage('Run E2E Tests') {
84 steps {
85 sh '''
Andy Bavier0088c212020-01-08 13:44:03 -070086 mkdir -p $WORKSPACE/RobotLogs
87 git clone https://gerrit.opencord.org/voltha-system-tests
88 cd kind-voltha
89 for i in \$(seq 1 ${testRuns})
90 do
91 make -C $WORKSPACE/voltha-system-tests ${makeTarget}
92 echo "Completed run: \$i"
93 echo ""
Andy Bavier0088c212020-01-08 13:44:03 -070094 done
95 '''
96 }
97 }
98 }
99
100 post {
101 always {
102 sh '''
103 set +e
Andy Bavier4af02722020-01-15 10:24:24 -0700104 cp $WORKSPACE/kind-voltha/install-minimal.log $WORKSPACE/
Andy Bavier0088c212020-01-08 13:44:03 -0700105 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\t'}{.imageID}{'\\n'}" | sort | uniq -c
106 kubectl get nodes -o wide
107 kubectl get pods -o wide
108 kubectl get pods -n voltha -o wide
Andy Bavier4af02722020-01-15 10:24:24 -0700109
110 sync
111 pkill kail || true
112
113 ## Pull out errors from log files
114 extract_errors_go() {
115 echo
116 echo "Error summary for $1:"
117 grep $1 $WORKSPACE/onos-voltha-combined.log | grep '"level":"error"' | cut -d ' ' -f 2- | jq -r '.msg'
118 echo
119 }
120
121 extract_errors_python() {
122 echo
123 echo "Error summary for $1:"
124 grep $1 $WORKSPACE/onos-voltha-combined.log | grep 'ERROR' | cut -d ' ' -f 2-
125 echo
126 }
127
128 extract_errors_go voltha-rw-core > $WORKSPACE/error-report.log
129 extract_errors_go adapter-open-olt >> $WORKSPACE/error-report.log
130 extract_errors_python adapter-open-onu >> $WORKSPACE/error-report.log
131 extract_errors_python voltha-ofagent >> $WORKSPACE/error-report.log
132
Andy Bavier0088c212020-01-08 13:44:03 -0700133 ## shut down voltha
Andy Bavier4af02722020-01-15 10:24:24 -0700134 cd $WORKSPACE/kind-voltha/
Andy Bavier0088c212020-01-08 13:44:03 -0700135 WAIT_ON_DOWN=y ./voltha down
136 '''
137 step([$class: 'RobotPublisher',
138 disableArchiveOutput: false,
139 logFileName: 'RobotLogs/log*.html',
140 otherFiles: '',
141 outputFileName: 'RobotLogs/output*.xml',
142 outputPath: '.',
143 passThreshold: 100,
144 reportFileName: 'RobotLogs/report*.html',
145 unstableThreshold: 0]);
146 archiveArtifacts artifacts: '*.log'
147
148 }
149 }
150}