blob: 774df4bed05569c1743764aa8264c23541028d6a [file] [log] [blame]
Hardik Windlass6d9a82e2021-07-08 16:23:21 +00001// 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// used to deploy VOLTHA and configure ONOS physical PODs
16
17// NOTE we are importing the library even if it's global so that it's
18// easier to change the keywords during a replay
19library identifier: 'cord-jenkins-libraries@master',
20 retriever: modernSCM([
21 $class: 'GitSCMSource',
22 remote: 'https://gerrit.opencord.org/ci-management.git'
23])
24
25def infraNamespace = "infra"
26def volthaNamespace = "voltha"
27
Andrea Campanella20361592021-08-26 18:45:28 +020028def deploy_custom_oltAdapterChart(namespace, name, chart, extraHelmFlags) {
29 sh """
30 helm install --create-namespace --set defaults.image_pullPolicy=Always --namespace ${namespace} ${extraHelmFlags} ${name} ${chart}
31 """
32}
33
Hardik Windlass6d9a82e2021-07-08 16:23:21 +000034pipeline {
35
36 /* no label, executor is determined by JJB */
37 agent {
38 label "${params.buildNode}"
39 }
40 options {
41 timeout(time: 35, unit: 'MINUTES')
42 }
43 environment {
44 PATH="$PATH:$WORKSPACE/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin"
45 KUBECONFIG="$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf"
46 }
47
48 stages{
49 stage('Download Code') {
50 steps {
51 getVolthaCode([
52 branch: "${branch}",
53 volthaSystemTestsChange: "${volthaSystemTestsChange}",
54 volthaHelmChartsChange: "${volthaHelmChartsChange}",
55 ])
56 }
57 }
58 stage ("Parse deployment configuration file") {
59 steps {
60 sh returnStdout: true, script: "rm -rf ${configBaseDir}"
Hardik Windlass6f854a12021-07-12 13:20:21 +000061 sh returnStdout: true, script: "git clone -b ${branch} ${cordRepoUrl}/${configBaseDir}"
Hardik Windlass6d9a82e2021-07-08 16:23:21 +000062 script {
63 if ( params.workFlow == "DT" ) {
64 deployment_config = readYaml file: "${configBaseDir}/${configDeploymentDir}/${configFileName}-DT.yaml"
65 }
66 else if ( params.workFlow == "TT" )
67 {
68 deployment_config = readYaml file: "${configBaseDir}/${configDeploymentDir}/${configFileName}-TT.yaml"
69 }
70 else
71 {
72 deployment_config = readYaml file: "${configBaseDir}/${configDeploymentDir}/${configFileName}.yaml"
73 }
74 }
75 }
76 }
77 stage('Clean up') {
78 steps {
79 timeout(15) {
80 script {
81 helmTeardown(["default", infraNamespace, volthaNamespace])
82 }
83 timeout(1) {
84 sh returnStdout: false, script: '''
85 # remove orphaned port-forward from different namespaces
86 ps aux | grep port-forw | grep -v grep | awk '{print $2}' | xargs --no-run-if-empty kill -9 || true
87 '''
88 }
89 }
90 }
91 }
92 stage('Install Voltha') {
93 steps {
94 timeout(20) {
Hardik Windlass9658cd22021-10-25 11:13:25 +000095 installVoltctl("$branch")
Hardik Windlass6d9a82e2021-07-08 16:23:21 +000096 script {
97 // if we're downloading a voltha-helm-charts patch, then install from a local copy of the charts
98 def localCharts = false
99 if (volthaHelmChartsChange != "" || branch != "master") {
100 localCharts = true
101 }
102
103 // should the config file be suffixed with the workflow? see "deployment_config"
104 def localHelmFlags = "-f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/voltha/${configFileName}.yml --set global.log_level=${logLevel} "
105
106 if (workFlow.toLowerCase() == "dt") {
107 localHelmFlags += " --set radius.enabled=false "
108 }
109 if (workFlow.toLowerCase() == "tt") {
110 localHelmFlags += " --set radius.enabled=false --set global.incremental_evto_update=true "
111 if (enableMultiUni.toBoolean()) {
112 localHelmFlags += " --set voltha-adapter-openonu.adapter_open_onu.uni_port_mask=${uniPortMask} "
113 }
114 }
115
116 // NOTE temporary workaround expose ONOS node ports (pod-config needs to be updated to contain these values)
117 // and to connect the ofagent to all instances of ONOS
118 localHelmFlags = localHelmFlags + " --set onos-classic.onosSshPort=30115 " +
119 "--set onos-classic.onosApiPort=30120 " +
120 "--set onos-classic.onosOfPort=31653 " +
121 "--set onos-classic.individualOpenFlowNodePorts=true " +
122 "--set voltha.onos_classic.replicas=${params.NumOfOnos}"
123
124 if (bbsimReplicas.toInteger() != 0) {
125 localHelmFlags = localHelmFlags + " --set onu=${onuNumber},pon=${ponNumber} "
126 }
127
128 // adding user specified helm flags at the end so they'll have priority over everything else
129 localHelmFlags = localHelmFlags + " ${extraHelmFlags}"
130
Matteo Scandolo1dd38322022-01-14 14:48:21 -0800131 // in VOLTHA-2.8 there is no need to wait for the adapters
132 def numberOfAdaptersToWait = 0
Andrea Campanella20361592021-08-26 18:45:28 +0200133
Hardik Windlass6d9a82e2021-07-08 16:23:21 +0000134 volthaDeploy([
135 workflow: workFlow.toLowerCase(),
136 extraHelmFlags: localHelmFlags,
137 localCharts: localCharts,
138 kubeconfig: "$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf",
139 onosReplica: params.NumOfOnos,
140 atomixReplica: params.NumOfAtomix,
141 kafkaReplica: params.NumOfKafka,
142 etcdReplica: params.NumOfEtcd,
143 bbsimReplica: bbsimReplicas.toInteger(),
Andrea Campanella365ea1e2021-09-28 10:50:01 +0200144 adaptersToWait: numberOfAdaptersToWait,
Hardik Windlass6d9a82e2021-07-08 16:23:21 +0000145 ])
Andrea Campanella20361592021-08-26 18:45:28 +0200146
Andrea Campanella365ea1e2021-09-28 10:50:01 +0200147 if(openoltAdapterChart != "onf/voltha-adapter-openolt"){
148 extraHelmFlags = extraHelmFlags + " --set global.log_level=${logLevel}"
149 deploy_custom_oltAdapterChart(volthaNamespace, oltAdapterReleaseName, openoltAdapterChart, extraHelmFlags)
150 waitForAdapters([
Matteo Scandolo1dd38322022-01-14 14:48:21 -0800151 adaptersToWait: 0 // in VOLTHA-2.8 there is no need to wait for the adapters
Andrea Campanella365ea1e2021-09-28 10:50:01 +0200152 ])
153 }
Hardik Windlass6d9a82e2021-07-08 16:23:21 +0000154 }
155 sh """
156 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"&
157 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"&
158 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"&
159 ps aux | grep port-forward
160 """
161 getPodsInfo("$WORKSPACE")
162 }
163 }
164 }
165 stage('Push Tech-Profile') {
166 steps {
167 script {
168 if ( params.configurePod && params.profile != "Default" ) {
169 for(int i=0; i < deployment_config.olts.size(); i++) {
170 def tech_prof_directory = "XGS-PON"
Girish Gowdraa0618412021-07-14 20:10:39 -0700171 if (deployment_config.olts[i].containsKey("board_technology")){
172 tech_prof_directory = deployment_config.olts[i]["board_technology"]
Hardik Windlass6d9a82e2021-07-08 16:23:21 +0000173 }
174 timeout(1) {
175 sh returnStatus: true, script: """
176 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
177 etcd_container=\$(kubectl get pods -n ${infraNamespace} | grep etcd | awk 'NR==1{print \$1}')
178 if [[ "${workFlow}" == "TT" ]]; then
179 if [[ "${params.enableMultiUni}" == "true" ]]; then
180 kubectl cp -n ${infraNamespace} $WORKSPACE/voltha-system-tests/tests/data/TechProfile-TT-multi-uni-HSIA.json \$etcd_container:/tmp/hsia.json
181 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'
182 kubectl cp -n ${infraNamespace} $WORKSPACE/voltha-system-tests/tests/data/TechProfile-TT-multi-uni-VoIP.json \$etcd_container:/tmp/voip.json
183 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'
184 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
185 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'
186 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
187 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'
188 else
189 kubectl cp -n ${infraNamespace} $WORKSPACE/voltha-system-tests/tests/data/TechProfile-TT-HSIA.json \$etcd_container:/tmp/hsia.json
190 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'
191 kubectl cp -n ${infraNamespace} $WORKSPACE/voltha-system-tests/tests/data/TechProfile-TT-VoIP.json \$etcd_container:/tmp/voip.json
192 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'
193 kubectl cp -n ${infraNamespace} $WORKSPACE/voltha-system-tests/tests/data/TechProfile-TT-MCAST-AdditionalBW-None.json \$etcd_container:/tmp/mcast_additionalBW_none.json
194 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'
195 kubectl cp -n ${infraNamespace} $WORKSPACE/voltha-system-tests/tests/data/TechProfile-TT-MCAST-AdditionalBW-NA.json \$etcd_container:/tmp/mcast_additionalBW_na.json
196 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'
197 fi
198 else
199 kubectl cp -n ${infraNamespace} $WORKSPACE/voltha-system-tests/tests/data/TechProfile-${profile}.json \$etcd_container:/tmp/flexpod.json
200 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'
201 fi
202 """
203 }
204 timeout(1) {
205 sh returnStatus: true, script: """
206 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
207 etcd_container=\$(kubectl get pods -n ${infraNamespace} | grep etcd | awk 'NR==1{print \$1}')
208 kubectl exec -n ${infraNamespace} -it \$etcd_container -- /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/voltha/technology_profiles/${tech_prof_directory}/64'
209 """
210 }
211 }
212 }
213 }
214 }
215 }
216 stage('Push MIB templates') {
217 steps {
218 sh """
219 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
220 etcd_container=\$(kubectl get pods -n ${infraNamespace} | grep etcd | awk 'NR==1{print \$1}')
221 kubectl cp -n ${infraNamespace} $WORKSPACE/voltha-system-tests/tests/data/MIB_Alpha.json \$etcd_container:/tmp/MIB_Alpha.json
222 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'
223 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'
224 kubectl cp -n ${infraNamespace} $WORKSPACE/voltha-system-tests/tests/data/MIB_Scom.json \$etcd_container:/tmp/MIB_Scom.json
225 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'
226 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'
227 """
228 }
229 }
230 stage('Push Sadis-config') {
231 steps {
232 timeout(1) {
233 sh returnStatus: true, script: """
234 if [[ "${workFlow}" == "DT" ]]; then
235 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
236 elif [[ "${workFlow}" == "TT" ]]; then
237 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
238 else
239 # this is the ATT case, rename the file in *-sadis-ATT.json so that we can avoid special cases and just load the file
240 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
241 fi
242 """
243 }
244 }
245 }
246 stage('Switch Configurations in ONOS') {
247 steps {
248 script {
249 if ( deployment_config.fabric_switches.size() > 0 ) {
250 timeout(1) {
251 def netcfg = "$WORKSPACE/${configBaseDir}/${configToscaDir}/voltha/${configFileName}-onos-netcfg-switch.json"
252 if (params.inBandManagement){
253 netcfg = "$WORKSPACE/${configBaseDir}/${configToscaDir}/voltha/${configFileName}-onos-netcfg-switch-inband.json"
254 }
255 sh """
256 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}
257 curl -sSL --user karaf:karaf -X POST http://${deployment_config.nodes[0].ip}:30120/onos/v1/applications/org.onosproject.segmentrouting/active
258 """
259 }
260 timeout(1) {
261 waitUntil {
262 sr_active_out = sh returnStatus: true, script: """
263 sshpass -p karaf ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@${deployment_config.nodes[0].ip} "log:set TRACE org.opencord.dhcpl2relay"
264 sshpass -p karaf ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@${deployment_config.nodes[0].ip} "log:set TRACE org.opencord.aaa"
265 sshpass -p karaf ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@${deployment_config.nodes[0].ip} "log:set TRACE org.opencord.olt"
Andrea Campanella39b9b3d2021-09-09 16:54:20 +0200266 #TRACE in the pipeliner is too chatty, moving to DEBUG
267 sshpass -p karaf ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@${deployment_config.nodes[0].ip} "log:set DEBUG org.opencord.olt.driver"
Hardik Windlass6d9a82e2021-07-08 16:23:21 +0000268 sshpass -p karaf ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@${deployment_config.nodes[0].ip} "log:set DEBUG org.onosproject.net.flowobjective.impl.FlowObjectiveManager"
269 sshpass -p karaf ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@${deployment_config.nodes[0].ip} "log:set DEBUG org.onosproject.net.flowobjective.impl.InOrderFlowObjectiveManager"
270 curl -sSL --user karaf:karaf -X GET http://${deployment_config.nodes[0].ip}:30120/onos/v1/applications/org.onosproject.segmentrouting | jq '.state' | grep ACTIVE
271 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"
272 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"
273 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"
274 """
275 return sr_active_out == 0
276 }
277 }
278 timeout(7) {
279 for(int i=0; i < deployment_config.hosts.src.size(); i++) {
280 for(int j=0; j < deployment_config.olts.size(); j++) {
281 def aggPort = -1
282 if(deployment_config.olts[j].serial == deployment_config.hosts.src[i].olt){
283 aggPort = deployment_config.olts[j].aggPort
284 if(aggPort == -1){
285 throw new Exception("Upstream port for the olt is not configured, field aggPort is empty")
286 }
287 sh """
288 sleep 30 # NOTE why are we sleeping?
289 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'
290 """
291 }
292 }
293 }
294 }
295 }
296 }
297 }
298 }
299 stage('Reinstall OLT software') {
300 steps {
301 script {
302 if ( params.reinstallOlt ) {
303 for(int i=0; i < deployment_config.olts.size(); i++) {
304 // NOTE what is oltDebVersion23? is that for VOLTHA-2.3? do we still need this differentiation?
305 sh returnStdout: true, script: """
Hardik Windlass6cdbfa22021-07-13 06:21:35 +0000306 ssh-keyscan -H ${deployment_config.olts[i].sship} >> ~/.ssh/known_hosts
307 if [ "${params.inBandManagement}" == "true" ]; then
Hardik Windlass6d9a82e2021-07-08 16:23:21 +0000308 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'
Hardik Windlass6d9a82e2021-07-08 16:23:21 +0000309 fi
Hardik Windlass6cdbfa22021-07-13 06:21:35 +0000310 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}"
Hardik Windlass6d9a82e2021-07-08 16:23:21 +0000311 sleep 10
312 """
313 timeout(5) {
314 waitUntil {
315 olt_sw_present = sh returnStdout: true, script: """
Andrea Campanella842cb5d2021-12-17 18:33:05 +0100316 if [[ "${deployment_config.olts[i].oltDebVersion}" == *"asfvolt16"* ]]; then
Hardik Windlass6d9a82e2021-07-08 16:23:21 +0000317 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'
Andrea Campanella842cb5d2021-12-17 18:33:05 +0100318 elif [[ "${deployment_config.olts[i].oltDebVersion}" == *"asgvolt64"* ]]; then
Hardik Windlass6d9a82e2021-07-08 16:23:21 +0000319 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'
Andrea Campanella842cb5d2021-12-17 18:33:05 +0100320 elif [[ "${deployment_config.olts[i].oltDebVersion}" == *"rlt-1600x-w"* ]]; then
321 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'
322 elif [[ "${deployment_config.olts[i].oltDebVersion}" == *"rlt-1600g-w"* ]]; then
323 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'
324 elif [[ "${deployment_config.olts[i].oltDebVersion}" == *"rlt-3200g-w"* ]]; then
325 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'
326 else
327 echo Unknown Debian package for openolt
Hardik Windlass6d9a82e2021-07-08 16:23:21 +0000328 fi
329 if (${deployment_config.olts[i].fortygig}); then
330 if [[ "${params.inBandManagement}" == "true" ]]; then
331 ssh-keyscan -H ${deployment_config.olts[i].sship} >> ~/.ssh/known_hosts
332 sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].sship} 'mkdir -p /opt/openolt/'
333 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/'
334 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'
335 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/'
336 fi
337 fi
338 """
339 return olt_sw_present.toInteger() > 0
340 }
341 }
342 }
343 }
344 }
345 }
346 }
347 stage('Restart OLT processes') {
348 steps {
349 script {
Andrea Campanellaecefbc82021-08-27 11:06:31 +0200350 //rebooting OLTs
Hardik Windlass6d9a82e2021-07-08 16:23:21 +0000351 for(int i=0; i < deployment_config.olts.size(); i++) {
Girish Gowdrac5a3ef82021-10-06 12:58:49 -0700352 timeout(15) {
Hardik Windlass6d9a82e2021-07-08 16:23:21 +0000353 sh returnStdout: true, script: """
354 ssh-keyscan -H ${deployment_config.olts[i].sship} >> ~/.ssh/known_hosts
Girish Gowdrac5a3ef82021-10-06 12:58:49 -0700355 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
Hardik Windlass6d9a82e2021-07-08 16:23:21 +0000356 """
357 }
Andrea Campanellaecefbc82021-08-27 11:06:31 +0200358 }
359 sh returnStdout: true, script: """
360 sleep ${params.waitTimerForOltUp}
361 """
362 //Checking dev_management_deamon and openoltprocesses
363 for(int i=0; i < deployment_config.olts.size(); i++) {
364 if ( params.oltAdapterReleaseName != "open-olt" ) {
365 timeout(15) {
366 waitUntil {
367 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'"
368 return devprocess.toInteger() > 0
369 }
Hardik Windlass6d9a82e2021-07-08 16:23:21 +0000370 }
Andrea Campanellaecefbc82021-08-27 11:06:31 +0200371 timeout(15) {
372 waitUntil {
373 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'"
374 return openoltprocess.toInteger() > 0
375 }
Hardik Windlass6d9a82e2021-07-08 16:23:21 +0000376 }
377 }
378 }
379 }
380 }
381 }
382 }
383
384 post {
385 aborted {
386 getPodsInfo("$WORKSPACE/failed")
387 sh """
388 kubectl logs -n voltha -l app.kubernetes.io/part-of=voltha > $WORKSPACE/failed/voltha.log || true
389 """
390 archiveArtifacts artifacts: '**/*.log,**/*.txt'
391 }
392 failure {
393 getPodsInfo("$WORKSPACE/failed")
394 sh """
395 kubectl logs -n voltha -l app.kubernetes.io/part-of=voltha > $WORKSPACE/failed/voltha.logs || true
396 """
397 archiveArtifacts artifacts: '**/*.log,**/*.txt'
398 }
399 always {
400 archiveArtifacts artifacts: '*.txt'
401 }
402 }
403}