blob: 25cd2a03100b2a1931c87c6e39285ee5fe07d059 [file] [log] [blame]
Matteo Scandolod82d1de2021-04-06 14:55:58 -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// 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
28pipeline {
29
30 /* no label, executor is determined by JJB */
31 agent {
32 label "${params.buildNode}"
33 }
34 options {
35 timeout(time: 35, unit: 'MINUTES')
36 }
37 environment {
38 PATH="$PATH:$WORKSPACE/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin"
Matteo Scandolod43bb302021-04-20 10:19:29 -070039 KUBECONFIG="$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf"
Matteo Scandolod82d1de2021-04-06 14:55:58 -070040 }
41
42 stages{
43 stage('Download Code') {
Matteo Scandolod43bb302021-04-20 10:19:29 -070044 steps {
45 getVolthaCode([
46 branch: "${branch}",
47 volthaHelmChartsChange: "${volthaHelmChartsChange}",
48 ])
49 }
Matteo Scandolod82d1de2021-04-06 14:55:58 -070050 }
51 stage ("Parse deployment configuration file") {
Matteo Scandolod43bb302021-04-20 10:19:29 -070052 steps {
53 sh returnStdout: true, script: "rm -rf ${configBaseDir}"
54 sh returnStdout: true, script: "git clone -b master ${cordRepoUrl}/${configBaseDir}"
55 script {
56 if ( params.workFlow == "DT" ) {
57 deployment_config = readYaml file: "${configBaseDir}/${configDeploymentDir}/${configFileName}-DT.yaml"
58 }
59 else if ( params.workFlow == "TT" )
60 {
61 deployment_config = readYaml file: "${configBaseDir}/${configDeploymentDir}/${configFileName}-TT.yaml"
62 }
63 else
64 {
65 deployment_config = readYaml file: "${configBaseDir}/${configDeploymentDir}/${configFileName}.yaml"
66 }
67 }
Matteo Scandolod82d1de2021-04-06 14:55:58 -070068 }
69 }
70 stage('Clean up') {
Matteo Scandolod43bb302021-04-20 10:19:29 -070071 steps {
72 timeout(15) {
73 script {
74 helmTeardown(["default", infraNamespace, volthaNamespace])
75 }
76 timeout(1) {
77 sh returnStdout: false, script: '''
Matteo Scandolo16bb6fe2021-04-26 13:15:39 -070078 # remove orphaned port-forward from different namespaces
Andrea Campanella4c8af942021-05-12 10:12:13 +020079 ps aux | grep port-forw | grep -v grep | awk '{print $2}' | xargs --no-run-if-empty kill -9 || true
Matteo Scandolod43bb302021-04-20 10:19:29 -070080 '''
81 }
Matteo Scandolod82d1de2021-04-06 14:55:58 -070082 }
83 }
84 }
85 stage('Install Voltha') {
Matteo Scandolod43bb302021-04-20 10:19:29 -070086 steps {
87 timeout(20) {
88 script {
89 // if we're downloading a voltha-helm-charts patch, then install from a local copy of the charts
90 def localCharts = false
91 if (volthaHelmChartsChange != "") {
92 localCharts = true
93 }
Matteo Scandolod82d1de2021-04-06 14:55:58 -070094
Matteo Scandolo16bb6fe2021-04-26 13:15:39 -070095 // should the config file be suffixed with the workflow? see "deployment_config"
Matteo Scandolod47bfb22021-05-24 09:40:05 -070096 def localHelmFlags = "-f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/voltha/${configFileName}.yml --set global.log_level=${logLevel} "
Matteo Scandolod82d1de2021-04-06 14:55:58 -070097
Matteo Scandolo16bb6fe2021-04-26 13:15:39 -070098 if (workFlow.toLowerCase() == "dt") {
Matteo Scandolod47bfb22021-05-24 09:40:05 -070099 localHelmFlags += " --set radius.enabled=false "
Matteo Scandolo16bb6fe2021-04-26 13:15:39 -0700100 }
101 if (workFlow.toLowerCase() == "tt") {
Matteo Scandolod47bfb22021-05-24 09:40:05 -0700102 localHelmFlags += " --set radius.enabled=false --set global.incremental_evto_update=true "
Matteo Scandolo16bb6fe2021-04-26 13:15:39 -0700103 }
104
Matteo Scandolod43bb302021-04-20 10:19:29 -0700105 // NOTE temporary workaround expose ONOS node ports (pod-config needs to be updated to contain these values)
Matteo Scandolod47bfb22021-05-24 09:40:05 -0700106 localHelmFlags = localHelmFlags + " --set onos-classic.onosSshPort=30115 " +
Matteo Scandolod82d1de2021-04-06 14:55:58 -0700107 "--set onos-classic.onosApiPort=30120 " +
108 "--set onos-classic.onosOfPort=31653 " +
109 "--set onos-classic.individualOpenFlowNodePorts=true "
110
Hardik Windlass908533a2021-05-24 16:35:58 +0000111 if (bbsimReplicas.toInteger() != 0) {
Matteo Scandolod47bfb22021-05-24 09:40:05 -0700112 localHelmFlags = localHelmFlags + " --set onu=${onuNumber},pon=${ponNumber} "
Hardik Windlassc7379022021-05-12 13:52:24 +0530113 }
114
Matteo Scandolod47bfb22021-05-24 09:40:05 -0700115 // adding user specified helm flags at the end so they'll have priority over everything else
Andrea Campanellad4ab9502021-05-25 10:53:58 +0200116 localHelmFlags = localHelmFlags + " ${extraHelmFlags}"
Matteo Scandolod47bfb22021-05-24 09:40:05 -0700117
Matteo Scandolod43bb302021-04-20 10:19:29 -0700118 volthaDeploy([
119 workflow: workFlow.toLowerCase(),
Matteo Scandolod47bfb22021-05-24 09:40:05 -0700120 extraHelmFlags: localHelmFlags,
Matteo Scandolod43bb302021-04-20 10:19:29 -0700121 localCharts: localCharts,
122 kubeconfig: "$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf",
123 onosReplica: params.NumOfOnos,
124 atomixReplica: params.NumOfAtomix,
Hardik Windlassc7379022021-05-12 13:52:24 +0530125 kafkaReplica: params.NumOfKafka,
Hardik Windlass1685e5b2021-05-13 14:07:44 +0530126 etcdReplica: params.NumOfEtcd,
Hardik Windlass908533a2021-05-24 16:35:58 +0000127 bbsimReplica: bbsimReplicas.toInteger(),
Matteo Scandolod43bb302021-04-20 10:19:29 -0700128 ])
Matteo Scandolod82d1de2021-04-06 14:55:58 -0700129 }
130 sh """
Matteo Scandolo79f133f2021-04-27 13:53:21 -0700131 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"&
132 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"&
133 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"&
Matteo Scandolod43bb302021-04-20 10:19:29 -0700134 ps aux | grep port-forward
Matteo Scandolod82d1de2021-04-06 14:55:58 -0700135 """
Matteo Scandolod43bb302021-04-20 10:19:29 -0700136 getPodsInfo("$WORKSPACE")
Matteo Scandolod82d1de2021-04-06 14:55:58 -0700137 }
Matteo Scandolod43bb302021-04-20 10:19:29 -0700138 }
139 }
140 stage('Push Tech-Profile') {
141 steps {
142 script {
143 if ( params.configurePod && params.profile != "Default" ) {
144 for(int i=0; i < deployment_config.olts.size(); i++) {
145 def tech_prof_directory = "XGS-PON"
146 // If no debian package is specified we default to GPON for the ADTRAN OLT.
147 if (!deployment_config.olts[i].containsKey("oltDebVersion") || deployment_config.olts[i].oltDebVersion.contains("asgvolt64")){
148 tech_prof_directory = "GPON"
149 }
150 timeout(1) {
151 sh returnStatus: true, script: """
152 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
153 etcd_container=\$(kubectl get pods -n ${infraNamespace} | grep etcd | awk 'NR==1{print \$1}')
154 if [[ "${workFlow}" == "TT" ]]; then
155 kubectl cp -n ${infraNamespace} $WORKSPACE/voltha-system-tests/tests/data/TechProfile-TT-HSIA.json \$etcd_container:/tmp/hsia.json
156 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'
157 kubectl cp -n ${infraNamespace} $WORKSPACE/voltha-system-tests/tests/data/TechProfile-TT-VoIP.json \$etcd_container:/tmp/voip.json
158 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'
Hardik Windlassfc2cdcb2021-05-18 08:38:06 +0000159 kubectl cp -n ${infraNamespace} $WORKSPACE/voltha-system-tests/tests/data/TechProfile-TT-MCAST-AdditionalBW-None.json \$etcd_container:/tmp/mcast_additionalBW_none.json
160 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'
161 kubectl cp -n ${infraNamespace} $WORKSPACE/voltha-system-tests/tests/data/TechProfile-TT-MCAST-AdditionalBW-NA.json \$etcd_container:/tmp/mcast_additionalBW_na.json
162 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'
Matteo Scandolod43bb302021-04-20 10:19:29 -0700163 else
164 kubectl cp -n ${infraNamespace} $WORKSPACE/voltha-system-tests/tests/data/TechProfile-${profile}.json \$etcd_container:/tmp/flexpod.json
165 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'
166 fi
167 """
168 }
169 timeout(1) {
170 sh returnStatus: true, script: """
171 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
172 etcd_container=\$(kubectl get pods -n ${infraNamespace} | grep etcd | awk 'NR==1{print \$1}')
173 kubectl exec -n ${infraNamespace} -it \$etcd_container -- /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/voltha/technology_profiles/${tech_prof_directory}/64'
174 """
Matteo Scandolod82d1de2021-04-06 14:55:58 -0700175 }
176 }
177 }
178 }
179 }
180 }
Matteo Scandolod43bb302021-04-20 10:19:29 -0700181 stage('Push MIB templates') {
182 steps {
183 sh """
184 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
185 etcd_container=\$(kubectl get pods -n ${infraNamespace} | grep etcd | awk 'NR==1{print \$1}')
186 kubectl cp -n ${infraNamespace} $WORKSPACE/voltha-system-tests/tests/data/MIB_Alpha.json \$etcd_container:/tmp/MIB_Alpha.json
187 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'
188 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'
189 kubectl cp -n ${infraNamespace} $WORKSPACE/voltha-system-tests/tests/data/MIB_Scom.json \$etcd_container:/tmp/MIB_Scom.json
190 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'
191 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'
192 """
193 }
194 }
195 stage('Push Sadis-config') {
196 steps {
197 timeout(1) {
198 sh returnStatus: true, script: """
199 if [[ "${workFlow}" == "DT" ]]; then
200 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
201 elif [[ "${workFlow}" == "TT" ]]; then
202 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
203 else
204 # this is the ATT case, rename the file in *-sadis-ATT.json so that we can avoid special cases and just load the file
205 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
Matteo Scandolod82d1de2021-04-06 14:55:58 -0700206 fi
Matteo Scandolod82d1de2021-04-06 14:55:58 -0700207 """
Matteo Scandolod43bb302021-04-20 10:19:29 -0700208 }
209 }
210 }
211 stage('Switch Configurations in ONOS') {
212 steps {
213 script {
214 if ( deployment_config.fabric_switches.size() > 0 ) {
215 timeout(1) {
216 def netcfg = "$WORKSPACE/${configBaseDir}/${configToscaDir}/voltha/${configFileName}-onos-netcfg-switch.json"
217 if (params.inBandManagement){
218 netcfg = "$WORKSPACE/${configBaseDir}/${configToscaDir}/voltha/${configFileName}-onos-netcfg-switch-inband.json"
219 }
220 sh """
221 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}
222 curl -sSL --user karaf:karaf -X POST http://${deployment_config.nodes[0].ip}:30120/onos/v1/applications/org.onosproject.segmentrouting/active
Matteo Scandolod82d1de2021-04-06 14:55:58 -0700223 """
Matteo Scandolod43bb302021-04-20 10:19:29 -0700224 }
225 timeout(1) {
226 waitUntil {
227 sr_active_out = sh returnStatus: true, script: """
228 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"
229 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"
230 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"
231 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"
232 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"
233 curl -sSL --user karaf:karaf -X GET http://${deployment_config.nodes[0].ip}:30120/onos/v1/applications/org.onosproject.segmentrouting | jq '.state' | grep ACTIVE
234 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"
235 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"
236 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"
237 """
238 return sr_active_out == 0
239 }
240 }
241 timeout(5) {
242 for(int i=0; i < deployment_config.hosts.src.size(); i++) {
243 for(int j=0; j < deployment_config.olts.size(); j++) {
244 def aggPort = -1
245 if(deployment_config.olts[j].serial == deployment_config.hosts.src[i].olt){
246 aggPort = deployment_config.olts[j].aggPort
247 if(aggPort == -1){
248 throw new Exception("Upstream port for the olt is not configured, field aggPort is empty")
249 }
250 sh """
251 sleep 30 # NOTE why are we sleeping?
252 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'
253 """
254 }
255 }
256 }
Matteo Scandolod82d1de2021-04-06 14:55:58 -0700257 }
258 }
259 }
260 }
Matteo Scandolod43bb302021-04-20 10:19:29 -0700261 }
262 stage('Reinstall OLT software') {
263 steps {
264 script {
265 if ( params.reinstallOlt ) {
266 for(int i=0; i < deployment_config.olts.size(); i++) {
267 // NOTE what is oltDebVersion23? is that for VOLTHA-2.3? do we still need this differentiation?
268 sh returnStdout: true, script: """
269 if [[ "${branch}" != "master" ]] && [[ "${params.inBandManagement}" == "true" ]]; then
270 ssh-keyscan -H ${deployment_config.olts[i].sship} >> ~/.ssh/known_hosts
271 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'
272 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].oltDebVersion23}"
273 fi
274 if [[ "${branch}" != "master" ]] && [[ "${params.inBandManagement}" == "false" ]]; then
275 ssh-keyscan -H ${deployment_config.olts[i].sship} >> ~/.ssh/known_hosts
276 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].oltDebVersion23}"
277 fi
278 if [[ "${branch}" == "master" ]] && [[ "${params.inBandManagement}" == "true" ]]; then
279 ssh-keyscan -H ${deployment_config.olts[i].sship} >> ~/.ssh/known_hosts
280 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'
281 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}"
282 fi
283 if [[ "${branch}" == "master" ]] && [[ "${params.inBandManagement}" == "false" ]]; then
284 ssh-keyscan -H ${deployment_config.olts[i].sship} >> ~/.ssh/known_hosts
285 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}"
286 fi
287 sleep 10
288 """
289 timeout(5) {
290 waitUntil {
291 olt_sw_present = sh returnStdout: true, script: """
292 if [ "${deployment_config.olts[i].oltDebVersion}" == *"asfvolt16"* ]; then
293 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'
294 else
295 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'
296 fi
297 if (${deployment_config.olts[i].fortygig}); then
298 if [[ "${params.inBandManagement}" == "true" ]]; then
299 ssh-keyscan -H ${deployment_config.olts[i].sship} >> ~/.ssh/known_hosts
300 sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].sship} 'mkdir -p /opt/openolt/'
301 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/'
302 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'
303 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/'
304 fi
305 fi
306 """
307 return olt_sw_present.toInteger() > 0
308 }
309 }
Matteo Scandolod82d1de2021-04-06 14:55:58 -0700310 }
311 }
Matteo Scandolod43bb302021-04-20 10:19:29 -0700312 }
313 }
314 }
315 stage('Restart OLT processes') {
316 steps {
317 script {
318 for(int i=0; i < deployment_config.olts.size(); i++) {
319 int waitTimerForOltUp = 360
320 if ( params.inBandManagement ) {
321 waitTimerForOltUp = 540
322 }
323 timeout(15) {
324 sh returnStdout: true, script: """
325 ssh-keyscan -H ${deployment_config.olts[i].sship} >> ~/.ssh/known_hosts
Andrea Campanellafdb8f3b2021-05-03 10:41:17 +0200326 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 -f > /dev/null &' || true
Matteo Scandolod43bb302021-04-20 10:19:29 -0700327 sleep ${waitTimerForOltUp}
328 """
329 }
330 timeout(15) {
331 waitUntil {
332 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'"
333 return devprocess.toInteger() > 0
334 }
335 }
336 timeout(15) {
337 waitUntil {
338 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'"
339 return openoltprocess.toInteger() > 0
340 }
Matteo Scandolod82d1de2021-04-06 14:55:58 -0700341 }
342 }
343 }
344 }
345 }
346 }
347
348 post {
Matteo Scandolo0da60532021-05-06 08:59:42 -0700349 aborted {
350 getPodsInfo("$WORKSPACE/failed")
351 sh """
352 kubectl logs -n voltha -l app.kubernetes.io/part-of=voltha > $WORKSPACE/failed/voltha.log || true
353 """
354 archiveArtifacts artifacts: '**/*.log,**/*.txt'
355 }
356 failure {
357 getPodsInfo("$WORKSPACE/failed")
358 sh """
359 kubectl logs -n voltha -l app.kubernetes.io/part-of=voltha > $WORKSPACE/failed/voltha.logs || true
360 """
361 archiveArtifacts artifacts: '**/*.log,**/*.txt'
362 }
Matteo Scandolod82d1de2021-04-06 14:55:58 -0700363 always {
364 archiveArtifacts artifacts: '*.txt'
365 }
366 }
367}