blob: 0706a07a2915a2f98a031f6521cd9fcb5d7dbf4b [file] [log] [blame]
Joey Armstrong56fdfec2024-03-01 13:43:36 -05001// -----------------------------------------------------------------------
2// Copyright 2017-2024 Open Networking Foundation Contributors
Kailash46a2a9a2019-01-23 12:39:04 -08003//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
Joey Armstrong56fdfec2024-03-01 13:43:36 -050015// -----------------------------------------------------------------------
16// SPDX-FileCopyrightText: 2017-2024 Open Networking Foundation Contributors
17// SPDX-License-Identifier: Apache-2.0
18// -----------------------------------------------------------------------
19// Entropy: 0fcb5ffa-d1a4-11ee-be5e-9f44b7181764
20// -----------------------------------------------------------------------
21// Intent: chart-api-test-helm.groovy
22// Checks functionality of the helm-chart, without overriding the ver/tag used
23// -----------------------------------------------------------------------
Kailash46a2a9a2019-01-23 12:39:04 -080024
25pipeline {
26
27 /* no label, executor is determined by JJB */
28 agent {
Zack Williamsb3292082019-10-11 17:15:18 -070029 label "${params.buildNode}"
Kailash46a2a9a2019-01-23 12:39:04 -080030 }
31
32 stages {
Kailash595a27e2019-03-22 19:53:14 -070033 stage('Clean up') {
34 steps {
35 sh """
36 rm -rf *
37 for hchart in \$(helm list -q | grep -E -v 'docker-registry|mavenrepo|ponnet');
38 do
39 echo "Purging chart: \${hchart}"
40 helm delete --purge "\${hchart}"
41 done
42 """
43 }
44 }
Kailash46a2a9a2019-01-23 12:39:04 -080045 stage('repo') {
46 steps {
47 checkout(changelog: false, \
48 poll: false,
49 scm: [$class: 'RepoScm', \
50 manifestRepositoryUrl: "${params.manifestUrl}", \
51 manifestBranch: "${params.manifestBranch}", \
52 currentBranch: true, \
53 destinationDir: 'cord', \
54 forceSync: true,
55 resetFirst: true, \
56 quiet: true, \
57 jobs: 4, \
58 showAllChanges: true] \
59 )
60 }
61 }
62
Kailash46a2a9a2019-01-23 12:39:04 -080063 stage('Build BBSIM') {
64 steps {
65 sh '''
66 git clone https://github.com/opencord/voltha-bbsim
67 cd voltha-bbsim/
Kailashff5c5402019-01-28 15:47:54 -080068 docker images | grep bbsim
Kailash46a2a9a2019-01-23 12:39:04 -080069 '''
70 }
71 }
72
73 stage('Install BBSIM w/SEBA') {
74 steps {
75 sh """
76 #!/usr/bin/env bash
77 set -eu -o pipefail
78
Kailashff5c5402019-01-28 15:47:54 -080079 git clone https://gerrit.opencord.org/pod-configs
Kailash46a2a9a2019-01-23 12:39:04 -080080 pushd cord/helm-charts
81
82 helm install -f examples/kafka-single.yaml --version 0.13.3 -n cord-kafka incubator/kafka
83
Kailash46a2a9a2019-01-23 12:39:04 -080084 helm-repo-tools/wait_for_pods.sh
85
86 helm upgrade --install etcd-operator --version 0.8.3 stable/etcd-operator
Kailashe4ac2862019-03-21 12:03:40 -070087 sleep 60
Kailash46a2a9a2019-01-23 12:39:04 -080088 JOBS_TIMEOUT=900 ./helm-repo-tools/wait_for_jobs.sh
89
90 helm dep up voltha
Kailashff5c5402019-01-28 15:47:54 -080091 helm install -f $WORKSPACE/pod-configs/kubernetes-configs/${params.deploymentConfig} voltha -n voltha
92 JOBS_TIMEOUT=900 ./helm-repo-tools/wait_for_pods.sh voltha
93
94 helm dep up onos
95 helm install onos -n onos -f $WORKSPACE/pod-configs/kubernetes-configs/${params.deploymentConfig}
96 JOBS_TIMEOUT=900 ./helm-repo-tools/wait_for_pods.sh
Kailash46a2a9a2019-01-23 12:39:04 -080097
98 helm dep up xos-core
Kailash595a27e2019-03-22 19:53:14 -070099 helm install xos-core -n xos-core -f $WORKSPACE/pod-configs/kubernetes-configs/${params.deploymentConfig}
Kailash46a2a9a2019-01-23 12:39:04 -0800100
101 helm dep update xos-profiles/seba-services
Kailash595a27e2019-03-22 19:53:14 -0700102 helm install xos-profiles/seba-services -n seba-services -f $WORKSPACE/pod-configs/kubernetes-configs/${params.deploymentConfig}
Kailashff5c5402019-01-28 15:47:54 -0800103 JOBS_TIMEOUT=900 ./helm-repo-tools/wait_for_pods.sh
104
Kailash0db702b2019-01-29 13:54:19 -0800105 helm dep update xos-profiles/base-kubernetes
Kailash595a27e2019-03-22 19:53:14 -0700106 helm install xos-profiles/base-kubernetes -n base-kubernetes -f $WORKSPACE/pod-configs/kubernetes-configs/${params.deploymentConfig}
Kailash46a2a9a2019-01-23 12:39:04 -0800107
108 helm dep update workflows/att-workflow
Kailash595a27e2019-03-22 19:53:14 -0700109 helm install workflows/att-workflow -n att-workflow --set att-workflow-driver.kafkaService=cord-kafka -f $WORKSPACE/pod-configs/kubernetes-configs/${params.deploymentConfig}
Kailash46a2a9a2019-01-23 12:39:04 -0800110
111 # wait for services to load
112 JOBS_TIMEOUT=900 ./helm-repo-tools/wait_for_jobs.sh
Kailashff5c5402019-01-28 15:47:54 -0800113
Kailash46a2a9a2019-01-23 12:39:04 -0800114 echo "# Checking helm deployments"
115 kubectl get pods
116 helm list
117
Kailashe4ac2862019-03-21 12:03:40 -0700118 helm install --set images.bbsim.tag=latest --set images.bbsim.pullPolicy=IfNotPresent --set onus_per_pon_port=${params.OnuCount} ${params.EmulationMode} bbsim -n bbsim
Kailash595a27e2019-03-22 19:53:14 -0700119
Kailash46a2a9a2019-01-23 12:39:04 -0800120 for hchart in \$(helm list -q);
121 do
122 echo "## 'helm status' for chart: \${hchart} ##"
123 helm status "\${hchart}"
124 done
125 popd
126 """
127 }
128 }
Kailashd0294882019-03-19 13:23:32 -0700129 stage('Load BBSIM-DHCP Tosca') {
130 steps {
131 sh '''
132 #!/usr/bin/env bash
133 set -eu -o pipefail
134 pushd cord/helm-charts
135 curl -H "xos-username: admin@opencord.org" -H "xos-password: letmein" -X POST --data-binary @examples/bbsim-dhcp.yaml http://127.0.0.1:30007/run
Kailashaf893c72019-06-26 14:36:55 -0700136 curl -H "xos-username: admin@opencord.org" -H "xos-password: letmein" -X POST --data-binary @examples/technology-profile.yaml http://127.0.0.1:30007/run
Kailashd0294882019-03-19 13:23:32 -0700137 popd
138 '''
139 }
140 }
Kailash46a2a9a2019-01-23 12:39:04 -0800141 stage('Test BBSIM') {
142 steps {
Kailashef0be3d2019-03-19 09:21:22 -0700143 sh """
Kailash46a2a9a2019-01-23 12:39:04 -0800144 #!/usr/bin/env bash
145 set -eu -o pipefail
Kailashe4ac2862019-03-21 12:03:40 -0700146 pushd cord/test/cord-tester/src/test/cord-api/Tests/BBSim
Kailash595a27e2019-03-22 19:53:14 -0700147 robot -e notready -v number_of_onus:${params.OnuCount} -v timeout:${params.TestTimeout} ${params.TestTags} BBSIMScale.robot || true
Kailashef0be3d2019-03-19 09:21:22 -0700148 """
Kailash46a2a9a2019-01-23 12:39:04 -0800149 }
150 }
Kailash595a27e2019-03-22 19:53:14 -0700151 stage ('Display Kafka Events') {
152 steps {
153 sh """
154 CORD_KAFKA_IP=\$(kubectl exec cord-kafka-0 -- ip a | grep -oE "([0-9]{1,3}\\.){3}[0-9]{1,3}\\b" | grep 192)
155 kafkacat -e -C -b \$CORD_KAFKA_IP -t onu.events -f 'Topic %t [%p] at offset %o: key %k: %s\n >0'
156 kafkacat -e -C -b \$CORD_KAFKA_IP -t authentication.events -f 'Topic %t [%p] at offset %o: key %k: %s\n >0'
157 kafkacat -e -C -b \$CORD_KAFKA_IP -t dhcp.events -f 'Topic %t [%p] at offset %o: key %k: %s\n >0'
158 """
159 }
160 }
Kailashd0294882019-03-19 13:23:32 -0700161
Kailash595a27e2019-03-22 19:53:14 -0700162 stage ('Archive Artifacts') {
Kailashaad0e712019-03-22 20:42:07 -0700163 when { expression { return params.ArchiveLogs } }
Kailash595a27e2019-03-22 19:53:14 -0700164 steps {
165 sh '''
166 kubectl get pods --all-namespaces
167 ## get default pod logs
168 for pod in \$(kubectl get pods --no-headers | awk '{print \$1}');
169 do
170 if [[ \$pod == *"onos"* && \$pod != *"onos-service"* ]]; then
171 kubectl logs \$pod onos> $WORKSPACE/\$pod.log;
172 else
173 kubectl logs \$pod> $WORKSPACE/\$pod.log;
174 fi
175 done
176 ## get voltha pod logs
177 for pod in \$(kubectl get pods --no-headers -n voltha | awk '{print \$1}');
178 do
179 kubectl logs \$pod -n voltha > $WORKSPACE/\$pod.log;
180 done
181 '''
182 }
183 }
Kailashaad0e712019-03-22 20:42:07 -0700184 }
Kailash46a2a9a2019-01-23 12:39:04 -0800185 post {
186 always {
187 sh '''
Kailash46a2a9a2019-01-23 12:39:04 -0800188 # copy robot logs
189 if [ -d RobotLogs ]; then rm -r RobotLogs; fi; mkdir RobotLogs
Kailashf2688e02019-03-18 21:11:13 -0700190 cp -r $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Tests/BBSim/*ml ./RobotLogs
Kailash46a2a9a2019-01-23 12:39:04 -0800191
192 echo "# removing helm deployments"
193 kubectl get pods
194 helm list
Kailash46a2a9a2019-01-23 12:39:04 -0800195 '''
196 step([$class: 'RobotPublisher',
197 disableArchiveOutput: false,
198 logFileName: 'RobotLogs/log*.html',
199 otherFiles: '',
200 outputFileName: 'RobotLogs/output*.xml',
201 outputPath: '.',
202 passThreshold: 100,
203 reportFileName: 'RobotLogs/report*.html',
204 unstableThreshold: 0]);
Kailash2c1900c2019-02-11 12:18:27 -0800205 archiveArtifacts artifacts: '*.log'
Kailash46a2a9a2019-01-23 12:39:04 -0800206 step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "kailash@opennetworking.org", sendToIndividuals: false])
207
208 }
209 }
210}
Joey Armstrong56fdfec2024-03-01 13:43:36 -0500211
212// [EOF]