blob: 5779ac1a9b47c1e51e96399b6ae84a1587dca357 [file] [log] [blame]
Joey Armstrongdf24f602023-03-02 18:18:21 -05001// -*- groovy -*-
Joey Armstrong1fa8cb82023-03-03 14:05:51 -05002// -----------------------------------------------------------------------
Joey Armstrong980e37f2023-02-28 18:57:41 -05003// Copyright 2017-2023 Open Networking Foundation (ONF) and the ONF Contributors
4//
5// Licensed under the Apache License, Version 2.0 (the "License");
6// you may not use this file except in compliance with the License.
7// You may obtain a copy of the License at
8//
9// http://www.apache.org/licenses/LICENSE-2.0
10//
11// Unless required by applicable law or agreed to in writing, software
12// distributed under the License is distributed on an "AS IS" BASIS,
13// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14// See the License for the specific language governing permissions and
15// limitations under the License.
Joey Armstrongdf24f602023-03-02 18:18:21 -050016// -----------------------------------------------------------------------
17// Intent: used to deploy VOLTHA and configure ONOS physical PODs
18// -----------------------------------------------------------------------
Joey Armstrong980e37f2023-02-28 18:57:41 -050019
20// NOTE we are importing the library even if it's global so that it's
21// easier to change the keywords during a replay
22library identifier: 'cord-jenkins-libraries@master',
23 retriever: modernSCM([
24 $class: 'GitSCMSource',
25 remote: 'https://gerrit.opencord.org/ci-management.git'
26])
27
28def infraNamespace = "infra"
29def volthaNamespace = "voltha"
30
Joey Armstrongdf24f602023-03-02 18:18:21 -050031// -----------------------------------------------------------------------
Joey Armstrong1fa8cb82023-03-03 14:05:51 -050032// Intent: Visible in jenkins UI, job configure screen
Joey Armstrongdf24f602023-03-02 18:18:21 -050033// -----------------------------------------------------------------------
34def getIam(String func)
35{
36 // Cannot rely on a stack trace due to jenkins manipulation
37 String src = [
Joey Armstrong1fa8cb82023-03-03 14:05:51 -050038 'jjb',
39 'pipeline',
40 'voltha',
41 'playground',
42 'voltha-tt-physical-functional-tests.groovy'
Joey Armstrongdf24f602023-03-02 18:18:21 -050043 ].join('/')
Joey Armstrong1fa8cb82023-03-03 14:05:51 -050044
Joey Armstrongdf24f602023-03-02 18:18:21 -050045 String iam = [src, func].join('::')
Joey Armstrong1fa8cb82023-03-03 14:05:51 -050046 iam += sprintf('[ver:1.0]')
Joey Armstrongdf24f602023-03-02 18:18:21 -050047 return iam
48}
49
50// -----------------------------------------------------------------------
51// -----------------------------------------------------------------------
Joey Armstrong980e37f2023-02-28 18:57:41 -050052def deploy_custom_oltAdapterChart(namespace, name, chart, extraHelmFlags) {
53 sh """
54 helm install --create-namespace --set defaults.image_pullPolicy=Always --namespace ${namespace} ${extraHelmFlags} ${name} ${chart}
55 """
56}
57
Joey Armstrongdf24f602023-03-02 18:18:21 -050058pipeline
59{
60 /* no label, executor is determined by JJB */
61 agent
62 {
Joey Armstrong1fa8cb82023-03-03 14:05:51 -050063 label "${params.buildNode}"
Joey Armstrong980e37f2023-02-28 18:57:41 -050064 }
Joey Armstrongdf24f602023-03-02 18:18:21 -050065
66 options
67 {
Joey Armstrong1fa8cb82023-03-03 14:05:51 -050068 timeout(time: 35, unit: 'MINUTES')
Joey Armstrongdf24f602023-03-02 18:18:21 -050069 }
70
71 environment
72 {
Joey Armstrong1fa8cb82023-03-03 14:05:51 -050073 PATH="$PATH:$WORKSPACE/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin"
74 KUBECONFIG="$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf"
Joey Armstrongdf24f602023-03-02 18:18:21 -050075 }
76
77 stages
78 {
Joey Armstrong1fa8cb82023-03-03 14:05:51 -050079 stage('Download Code')
80 {
81 iam(this)
82 {
83 enter = true
84 label = getIam()
85 }
Joey Armstrongdf24f602023-03-02 18:18:21 -050086
Joey Armstrong1fa8cb82023-03-03 14:05:51 -050087 steps {
88 getVolthaCode([
89 branch: "${branch}",
90 volthaSystemTestsChange: "${volthaSystemTestsChange}",
91 volthaHelmChartsChange: "${volthaHelmChartsChange}",
92 ])
93 }
Joey Armstrongdf24f602023-03-02 18:18:21 -050094
Joey Armstrong1fa8cb82023-03-03 14:05:51 -050095 iam(this)
96 {
97 leave = true
98 label = getIam()
99 }
100 }
Joey Armstrongdf24f602023-03-02 18:18:21 -0500101
Joey Armstrong1fa8cb82023-03-03 14:05:51 -0500102 stage ("Parse deployment configuration file") {
103 steps {
104 sh returnStdout: true, script: "rm -rf ${configBaseDir}"
105 sh returnStdout: true, script: "git clone -b ${branch} ${cordRepoUrl}/${configBaseDir}"
106 script {
107 String conf = "${configBaseDir}/${configDeploymentDir}/${configFileName}"
108 String flow = params.workFlow
Joey Armstrongdf24f602023-03-02 18:18:21 -0500109
Joey Armstrong1fa8cb82023-03-03 14:05:51 -0500110 conf += (flow == 'DT') ? '-DT.yaml'
111 : (flow == 'TT') ? '-TT.yaml'
112 : '.yaml'
113
114 deployment_config = readYaml file: conf
115
116 /*
117 if ( params.workFlow == "DT" )
118 {
119 conf += '-DT.yaml'
Joey Armstrongdf24f602023-03-02 18:18:21 -0500120// deployment_config = readYaml file: "${configBaseDir}/${configDeploymentDir}/${configFileName}-DT.yaml"
Joey Armstrong980e37f2023-02-28 18:57:41 -0500121 }
122 else if ( params.workFlow == "TT" )
123 {
124 deployment_config = readYaml file: "${configBaseDir}/${configDeploymentDir}/${configFileName}-TT.yaml"
125 }
126 else
127 {
128 deployment_config = readYaml file: "${configBaseDir}/${configDeploymentDir}/${configFileName}.yaml"
129 }
Joey Armstrong1fa8cb82023-03-03 14:05:51 -0500130 */
Joey Armstrong980e37f2023-02-28 18:57:41 -0500131 }
132 }
133 }
Joey Armstrongdf24f602023-03-02 18:18:21 -0500134
Joey Armstrong980e37f2023-02-28 18:57:41 -0500135 stage('Clean up') {
136 steps {
137 timeout(15) {
138 script {
139 helmTeardown(["default", infraNamespace, volthaNamespace])
140 }
141 timeout(1) {
142 sh returnStdout: false, script: '''
143 # remove orphaned port-forward from different namespaces
144 ps aux | grep port-forw | grep -v grep | awk '{print $2}' | xargs --no-run-if-empty kill -9 || true
145 '''
146 }
147 }
148 }
149 }
150 stage('Install Voltha') {
151 steps {
152 timeout(20) {
153 installVoltctl("${branch}")
154 script {
155 // if we're downloading a voltha-helm-charts patch, then install from a local copy of the charts
156 def localCharts = false
157 if (volthaHelmChartsChange != "") {
158 localCharts = true
159 }
160
161 // should the config file be suffixed with the workflow? see "deployment_config"
162 def localHelmFlags = "-f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/voltha/${configFileName}.yml --set global.log_level=${logLevel} "
163
164 if (workFlow.toLowerCase() == "dt") {
165 localHelmFlags += " --set radius.enabled=false "
166 }
167 if (workFlow.toLowerCase() == "tt") {
168 localHelmFlags += " --set radius.enabled=false --set global.incremental_evto_update=true "
169 if (enableMultiUni.toBoolean()) {
170 localHelmFlags += " --set voltha-adapter-openonu.adapter_open_onu.uni_port_mask=${uniPortMask} "
171 }
172 }
173
174 // NOTE temporary workaround expose ONOS node ports (pod-config needs to be updated to contain these values)
175 // and to connect the ofagent to all instances of ONOS
176 localHelmFlags = localHelmFlags + " --set onos-classic.onosSshPort=30115 " +
177 "--set onos-classic.onosApiPort=30120 " +
178 "--set onos-classic.onosOfPort=31653 " +
179 "--set onos-classic.individualOpenFlowNodePorts=true " +
180 "--set voltha.onos_classic.replicas=${params.NumOfOnos}"
181
182 if (bbsimReplicas.toInteger() != 0) {
183 localHelmFlags = localHelmFlags + " --set onu=${onuNumber},pon=${ponNumber} "
184 }
185
186 // adding user specified helm flags at the end so they'll have priority over everything else
187 localHelmFlags = localHelmFlags + " ${extraHelmFlags}"
188
189 def numberOfAdaptersToWait = 2
190
191 if(openoltAdapterChart != "onf/voltha-adapter-openolt") {
192 localHelmFlags = localHelmFlags + " --set voltha-adapter-openolt.enabled=false"
193 // We skip waiting for adapters in the volthaDeploy step because it's already waiting for
194 // both of them after the deployment of the custom olt adapter. See line 156.
195 numberOfAdaptersToWait = 0
196 }
197
198 volthaDeploy([
199 workflow: workFlow.toLowerCase(),
200 extraHelmFlags: localHelmFlags,
201 localCharts: localCharts,
202 kubeconfig: "$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf",
203 onosReplica: params.NumOfOnos,
204 atomixReplica: params.NumOfAtomix,
205 kafkaReplica: params.NumOfKafka,
206 etcdReplica: params.NumOfEtcd,
207 bbsimReplica: bbsimReplicas.toInteger(),
208 withFttb: withFttb.toBoolean(),
209 adaptersToWait: numberOfAdaptersToWait,
210 ])
211
212 if(openoltAdapterChart != "onf/voltha-adapter-openolt"){
213 extraHelmFlags = extraHelmFlags + " --set global.log_level=${logLevel}"
214 deploy_custom_oltAdapterChart(volthaNamespace, oltAdapterReleaseName, openoltAdapterChart, extraHelmFlags)
215 waitForAdapters([
216 adaptersToWait: 2
217 ])
218 }
219 }
220 sh """
221 JENKINS_NODE_COOKIE="dontKillMe" _TAG="voltha-api" bash -c "while true; do kubectl port-forward --address 0.0.0.0 -n ${volthaNamespace} svc/voltha-voltha-api 55555:55555; done"&
222 JENKINS_NODE_COOKIE="dontKillMe" _TAG="etcd" bash -c "while true; do kubectl port-forward --address 0.0.0.0 -n ${infraNamespace} svc/voltha-infra-etcd ${params.VolthaEtcdPort}:2379; done"&
223 JENKINS_NODE_COOKIE="dontKillMe" _TAG="kafka" bash -c "while true; do kubectl port-forward --address 0.0.0.0 -n ${infraNamespace} svc/voltha-infra-kafka 9092:9092; done"&
224 ps aux | grep port-forward
225 """
226 getPodsInfo("$WORKSPACE")
227 }
228 }
229 }
230 stage('Push Tech-Profile') {
231 steps {
232 script {
233 if ( params.configurePod && params.profile != "Default" ) {
234 for(int i=0; i < deployment_config.olts.size(); i++) {
235 def tech_prof_directory = "XGS-PON"
236 if (deployment_config.olts[i].containsKey("board_technology")){
237 tech_prof_directory = deployment_config.olts[i]["board_technology"]
238 }
239 timeout(1) {
240 sh returnStatus: true, script: """
241 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
242 etcd_container=\$(kubectl get pods -n ${infraNamespace} -l app.kubernetes.io/name=etcd --no-headers | awk 'NR==1{print \$1}')
243 if [[ "${workFlow}" == "TT" ]]; then
244 kubectl cp -n ${infraNamespace} $WORKSPACE/voltha-system-tests/tests/data/TechProfile-TT-HSIA.json \$etcd_container:/tmp/hsia.json
245 kubectl exec -n ${infraNamespace} -it \$etcd_container -- /bin/sh -c 'cat /tmp/hsia.json | ETCDCTL_API=3 etcdctl put service/voltha/technology_profiles/${tech_prof_directory}/64'
246 kubectl cp -n ${infraNamespace} $WORKSPACE/voltha-system-tests/tests/data/TechProfile-TT-VoIP.json \$etcd_container:/tmp/voip.json
247 kubectl exec -n ${infraNamespace} -it \$etcd_container -- /bin/sh -c 'cat /tmp/voip.json | ETCDCTL_API=3 etcdctl put service/voltha/technology_profiles/${tech_prof_directory}/65'
248 if [[ "${params.enableMultiUni}" == "true" ]]; then
249 kubectl cp -n ${infraNamespace} $WORKSPACE/voltha-system-tests/tests/data/TechProfile-TT-multi-uni-MCAST-AdditionalBW-None.json \$etcd_container:/tmp/mcast_additionalBW_none.json
250 kubectl exec -n ${infraNamespace} -it \$etcd_container -- /bin/sh -c 'cat /tmp/mcast_additionalBW_none.json | ETCDCTL_API=3 etcdctl put service/voltha/technology_profiles/${tech_prof_directory}/66'
251 kubectl cp -n ${infraNamespace} $WORKSPACE/voltha-system-tests/tests/data/TechProfile-TT-multi-uni-MCAST-AdditionalBW-NA.json \$etcd_container:/tmp/mcast_additionalBW_na.json
252 kubectl exec -n ${infraNamespace} -it \$etcd_container -- /bin/sh -c 'cat /tmp/mcast_additionalBW_na.json | ETCDCTL_API=3 etcdctl put service/voltha/technology_profiles/${tech_prof_directory}/67'
253 else
254 kubectl cp -n ${infraNamespace} $WORKSPACE/voltha-system-tests/tests/data/TechProfile-TT-MCAST-AdditionalBW-None.json \$etcd_container:/tmp/mcast_additionalBW_none.json
255 kubectl exec -n ${infraNamespace} -it \$etcd_container -- /bin/sh -c 'cat /tmp/mcast_additionalBW_none.json | ETCDCTL_API=3 etcdctl put service/voltha/technology_profiles/${tech_prof_directory}/66'
256 kubectl cp -n ${infraNamespace} $WORKSPACE/voltha-system-tests/tests/data/TechProfile-TT-MCAST-AdditionalBW-NA.json \$etcd_container:/tmp/mcast_additionalBW_na.json
257 kubectl exec -n ${infraNamespace} -it \$etcd_container -- /bin/sh -c 'cat /tmp/mcast_additionalBW_na.json | ETCDCTL_API=3 etcdctl put service/voltha/technology_profiles/${tech_prof_directory}/67'
258 fi
259 else
260 kubectl cp -n ${infraNamespace} $WORKSPACE/voltha-system-tests/tests/data/TechProfile-${profile}.json \$etcd_container:/tmp/flexpod.json
261 kubectl exec -n ${infraNamespace} -it \$etcd_container -- /bin/sh -c 'cat /tmp/flexpod.json | ETCDCTL_API=3 etcdctl put service/voltha/technology_profiles/${tech_prof_directory}/64'
262 fi
263 """
264 }
265 timeout(1) {
266 sh returnStatus: true, script: """
267 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
268 etcd_container=\$(kubectl get pods -n ${infraNamespace} -l app.kubernetes.io/name=etcd --no-headers | awk 'NR==1{print \$1}')
269 kubectl exec -n ${infraNamespace} -it \$etcd_container -- /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/voltha/technology_profiles/${tech_prof_directory}/64'
270 """
271 }
272 }
273 }
274 }
275 }
276 }
277 stage('Push MIB templates') {
278 steps {
279 sh """
280 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
281 etcd_container=\$(kubectl get pods -n ${infraNamespace} -l app.kubernetes.io/name=etcd --no-headers | awk 'NR==1{print \$1}')
282 kubectl cp -n ${infraNamespace} $WORKSPACE/voltha-system-tests/tests/data/MIB_Alpha.json \$etcd_container:/tmp/MIB_Alpha.json
283 kubectl exec -n ${infraNamespace} -it \$etcd_container -- /bin/sh -c 'cat /tmp/MIB_Alpha.json | ETCDCTL_API=3 etcdctl put service/voltha/omci_mibs/go_templates/BRCM/BVM4K00BRA0915-0083/5023_020O02414'
284 kubectl exec -n ${infraNamespace} -it \$etcd_container -- /bin/sh -c 'cat /tmp/MIB_Alpha.json | ETCDCTL_API=3 etcdctl put service/voltha/omci_mibs/templates/BRCM/BVM4K00BRA0915-0083/5023_020O02414'
285 kubectl cp -n ${infraNamespace} $WORKSPACE/voltha-system-tests/tests/data/MIB_Scom.json \$etcd_container:/tmp/MIB_Scom.json
286 kubectl exec -n ${infraNamespace} -it \$etcd_container -- /bin/sh -c 'cat /tmp/MIB_Scom.json | ETCDCTL_API=3 etcdctl put service/voltha/omci_mibs/go_templates/SCOM/Glasfaser-Modem/090140.1.0.304'
287 kubectl exec -n ${infraNamespace} -it \$etcd_container -- /bin/sh -c 'cat /tmp/MIB_Scom.json | ETCDCTL_API=3 etcdctl put service/voltha/omci_mibs/templates/SCOM/Glasfaser-Modem/090140.1.0.304'
288 """
289 }
290 }
291 stage('Push Sadis-config') {
292 steps {
293 timeout(1) {
294 sh returnStatus: true, script: """
295 if [[ "${workFlow}" == "DT" ]]; then
296 curl -sSL --user karaf:karaf -X POST -H Content-Type:application/json http://${deployment_config.nodes[0].ip}:30120/onos/v1/network/configuration --data @$WORKSPACE/voltha-system-tests/tests/data/${configFileName}-sadis-DT.json
297 elif [[ "${workFlow}" == "TT" ]]; then
298 curl -sSL --user karaf:karaf -X POST -H Content-Type:application/json http://${deployment_config.nodes[0].ip}:30120/onos/v1/network/configuration --data @$WORKSPACE/voltha-system-tests/tests/data/${configFileName}-sadis-TT.json
299 else
300 # this is the ATT case, rename the file in *-sadis-ATT.json so that we can avoid special cases and just load the file
301 curl -sSL --user karaf:karaf -X POST -H Content-Type:application/json http://${deployment_config.nodes[0].ip}:30120/onos/v1/network/configuration --data @$WORKSPACE/voltha-system-tests/tests/data/${configFileName}-sadis.json
302 fi
303 """
304 }
305 }
306 }
307 stage('Switch Configurations in ONOS') {
308 steps {
309 script {
310 if ( deployment_config.fabric_switches.size() > 0 ) {
311 timeout(1) {
312 def netcfg = "$WORKSPACE/${configBaseDir}/${configToscaDir}/voltha/${configFileName}-onos-netcfg-switch.json"
313 if (params.inBandManagement){
314 netcfg = "$WORKSPACE/${configBaseDir}/${configToscaDir}/voltha/${configFileName}-onos-netcfg-switch-inband.json"
315 }
316 sh """
317 curl -sSL --user karaf:karaf -X POST -H Content-Type:application/json http://${deployment_config.nodes[0].ip}:30120/onos/v1/network/configuration --data @${netcfg}
318 curl -sSL --user karaf:karaf -X POST http://${deployment_config.nodes[0].ip}:30120/onos/v1/applications/org.onosproject.segmentrouting/active
319 """
320 }
321 timeout(3) {
322 setOnosLogLevels([
323 onosNamespace: infraNamespace,
324 apps: [
325 'org.opencord.dhcpl2relay',
326 'org.opencord.olt',
327 'org.opencord.aaa',
328 'org.opencord.maclearner',
329 'org.onosproject.net.flowobjective.impl.FlowObjectiveManager',
330 'org.onosproject.net.flowobjective.impl.InOrderFlowObjectiveManager'
331 ]
332 ])
333 waitUntil {
334 sr_active_out = sh returnStatus: true, script: """
335 curl -sSL --user karaf:karaf -X GET http://${deployment_config.nodes[0].ip}:30120/onos/v1/applications/org.onosproject.segmentrouting | jq '.state' | grep ACTIVE
336 sshpass -p karaf ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@${deployment_config.nodes[0].ip} "cfg set org.onosproject.provider.lldp.impl.LldpLinkProvider enabled false"
337 sshpass -p karaf ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@${deployment_config.nodes[0].ip} "cfg set org.onosproject.net.flow.impl.FlowRuleManager purgeOnDisconnection false"
338 sshpass -p karaf ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@${deployment_config.nodes[0].ip} "cfg set org.onosproject.net.meter.impl.MeterManager purgeOnDisconnection false"
339 """
340 return sr_active_out == 0
341 }
342 }
343 timeout(8) {
344 for(int i=0; i < deployment_config.hosts.src.size(); i++) {
345 for(int j=0; j < deployment_config.olts.size(); j++) {
346 def aggPort = -1
347 if(deployment_config.olts[j].serial == deployment_config.hosts.src[i].olt){
348 aggPort = deployment_config.olts[j].aggPort
349 if(aggPort == -1){
350 throw new Exception("Upstream port for the olt is not configured, field aggPort is empty")
351 }
352 sh """
353 sleep 10 # NOTE why are we sleeping?
354 curl -X POST --user karaf:karaf --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{"deviceId": "${deployment_config.fabric_switches[0].device_id}", "vlanId": "${deployment_config.hosts.src[i].s_tag}", "endpoints": [${deployment_config.fabric_switches[0].bngPort},${aggPort}]}' 'http://${deployment_config.nodes[0].ip}:30120/onos/segmentrouting/xconnect'
355 """
356 }
357 }
358 }
359 }
360 }
361 }
362 }
363 }
364 stage('Reinstall OLT software') {
365 steps {
366 script {
367 if ( params.reinstallOlt ) {
368 for(int i=0; i < deployment_config.olts.size(); i++) {
369 // NOTE what is oltDebVersion23? is that for VOLTHA-2.3? do we still need this differentiation?
370 sh returnStdout: true, script: """
371 ssh-keyscan -H ${deployment_config.olts[i].sship} >> ~/.ssh/known_hosts
372 if [ "${params.inBandManagement}" == "true" ]; then
373 sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].sship} 'kill -9 `pgrep -f "[b]ash /opt/openolt/openolt_dev_mgmt_daemon_process_watchdog"` || true'
374 fi
375 sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].sship} "dpkg --install ${deployment_config.olts[i].oltDebVersion}"
376 sleep 10
377 """
378 timeout(5) {
379 waitUntil {
380 olt_sw_present = sh returnStdout: true, script: """
381 if [[ "${deployment_config.olts[i].oltDebVersion}" == *"asfvolt16"* ]]; then
382 sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].sship} 'dpkg --list | grep asfvolt16 | wc -l'
383 elif [[ "${deployment_config.olts[i].oltDebVersion}" == *"asgvolt64"* ]]; then
384 sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].sship} 'dpkg --list | grep asgvolt64 | wc -l'
385 elif [[ "${deployment_config.olts[i].oltDebVersion}" == *"rlt-1600x-w"* ]]; then
386 sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].sship} 'dpkg --list | grep rlt-1600x-w | wc -l'
387 elif [[ "${deployment_config.olts[i].oltDebVersion}" == *"rlt-1600g-w"* ]]; then
388 sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].sship} 'dpkg --list | grep rlt-1600g-w | wc -l'
389 elif [[ "${deployment_config.olts[i].oltDebVersion}" == *"rlt-3200g-w"* ]]; then
390 sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].sship} 'dpkg --list | grep rlt-3200g-w | wc -l'
391 elif [[ "${deployment_config.olts[i].oltDebVersion}" == *"sda3016ss"* ]]; then
392 sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].sship} 'dpkg --list | grep sda3016ss | wc -l'
393 else
394 echo Unknown Debian package for openolt
395 fi
396 if (${deployment_config.olts[i].fortygig}); then
397 if [[ "${params.inBandManagement}" == "true" ]]; then
398 ssh-keyscan -H ${deployment_config.olts[i].sship} >> ~/.ssh/known_hosts
399 sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].sship} 'mkdir -p /opt/openolt/'
400 sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].sship} 'cp /root/watchdog-script/* /opt/openolt/'
401 sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].sship} 'cp /root/bal_cli_appl/example_user_appl /broadcom'
402 sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].sship} 'cp in-band-startup-script/* /etc/init.d/'
403 fi
404 fi
405 """
406 return olt_sw_present.toInteger() > 0
407 }
408 }
409 }
410 }
411 }
412 }
413 }
414 stage('Restart OLT processes') {
415 steps {
416 script {
417 //rebooting OLTs
418 for(int i=0; i < deployment_config.olts.size(); i++) {
419 timeout(15) {
420 sh returnStdout: true, script: """
421 ssh-keyscan -H ${deployment_config.olts[i].sship} >> ~/.ssh/known_hosts
422 sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].sship} 'rm -f /var/log/openolt.log; rm -f /var/log/dev_mgmt_daemon.log; rm -f /var/log/openolt_process_watchdog.log; reboot > /dev/null &' || true
423 """
424 }
425 }
426 sh returnStdout: true, script: """
427 sleep ${params.waitTimerForOltUp}
428 """
429 //Checking dev_management_deamon and openoltprocesses
430 for(int i=0; i < deployment_config.olts.size(); i++) {
431 if ( params.oltAdapterReleaseName != "open-olt" ) {
432 timeout(15) {
433 waitUntil {
434 devprocess = sh returnStdout: true, script: "sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].sship} 'ps -ef | grep dev_mgmt_daemon | wc -l'"
435 return devprocess.toInteger() > 0
436 }
437 }
438 timeout(15) {
439 waitUntil {
440 openoltprocess = sh returnStdout: true, script: "sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].sship} 'ps -ef | grep openolt | wc -l'"
441 return openoltprocess.toInteger() > 0
442 }
443 }
444 }
445 }
446 }
447 }
448 }
449 }
450
451 post {
452 aborted {
453 getPodsInfo("$WORKSPACE/failed")
454 sh """
455 kubectl logs -n voltha -l app.kubernetes.io/part-of=voltha > $WORKSPACE/failed/voltha.log || true
456 """
457 archiveArtifacts artifacts: '**/*.log,**/*.txt'
458 }
459 failure {
460 getPodsInfo("$WORKSPACE/failed")
461 sh """
462 kubectl logs -n voltha -l app.kubernetes.io/part-of=voltha > $WORKSPACE/failed/voltha.logs || true
463 """
464 archiveArtifacts artifacts: '**/*.log,**/*.txt'
465 }
466 always {
467 archiveArtifacts artifacts: '*.txt'
468 }
469 }
470}