Joey Armstrong | 7bcb578 | 2023-06-07 12:25:57 -0400 | [diff] [blame] | 1 | // Copyright 2017-2023 Open Networking Foundation (ONF) and the ONF Contributors |
| 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 |
| 19 | library identifier: 'cord-jenkins-libraries@master', |
| 20 | retriever: modernSCM([ |
| 21 | $class: 'GitSCMSource', |
| 22 | remote: 'https://gerrit.opencord.org/ci-management.git' |
| 23 | ]) |
| 24 | |
| 25 | def infraNamespace = "infra" |
| 26 | def volthaNamespace = "voltha" |
| 27 | |
| 28 | def 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 | |
| 34 | pipeline { |
| 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}" |
| 61 | sh returnStdout: true, script: "git clone -b ${branch} ${cordRepoUrl}/${configBaseDir}" |
| 62 | 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) { |
| 95 | installVoltctl("${branch}") |
| 96 | 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 != "") { |
| 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 | |
| 131 | def numberOfAdaptersToWait = 2 |
| 132 | |
| 133 | if(openoltAdapterChart != "onf/voltha-adapter-openolt") { |
| 134 | localHelmFlags = localHelmFlags + " --set voltha-adapter-openolt.enabled=false" |
| 135 | // We skip waiting for adapters in the volthaDeploy step because it's already waiting for |
| 136 | // both of them after the deployment of the custom olt adapter. See line 156. |
| 137 | numberOfAdaptersToWait = 0 |
| 138 | } |
| 139 | |
| 140 | volthaDeploy([ |
| 141 | workflow: workFlow.toLowerCase(), |
| 142 | extraHelmFlags: localHelmFlags, |
| 143 | localCharts: localCharts, |
| 144 | kubeconfig: "$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf", |
| 145 | onosReplica: params.NumOfOnos, |
| 146 | atomixReplica: params.NumOfAtomix, |
| 147 | kafkaReplica: params.NumOfKafka, |
| 148 | etcdReplica: params.NumOfEtcd, |
| 149 | bbsimReplica: bbsimReplicas.toInteger(), |
| 150 | withFttb: withFttb.toBoolean(), |
| 151 | adaptersToWait: numberOfAdaptersToWait, |
| 152 | ]) |
| 153 | |
| 154 | if(openoltAdapterChart != "onf/voltha-adapter-openolt"){ |
| 155 | extraHelmFlags = extraHelmFlags + " --set global.log_level=${logLevel}" |
| 156 | deploy_custom_oltAdapterChart(volthaNamespace, oltAdapterReleaseName, openoltAdapterChart, extraHelmFlags) |
| 157 | waitForAdapters([ |
| 158 | adaptersToWait: 2 |
| 159 | ]) |
| 160 | } |
| 161 | } |
| 162 | sh """ |
| 163 | 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"& |
| 164 | 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"& |
| 165 | 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"& |
| 166 | ps aux | grep port-forward |
| 167 | """ |
| 168 | getPodsInfo("$WORKSPACE") |
| 169 | } |
| 170 | } |
| 171 | } |
| 172 | stage('Push Tech-Profile') { |
| 173 | steps { |
| 174 | script { |
| 175 | if ( params.configurePod && params.profile != "Default" ) { |
| 176 | for(int i=0; i < deployment_config.olts.size(); i++) { |
| 177 | def tech_prof_directory = "XGS-PON" |
| 178 | if (deployment_config.olts[i].containsKey("board_technology")){ |
| 179 | tech_prof_directory = deployment_config.olts[i]["board_technology"] |
| 180 | } |
| 181 | timeout(1) { |
| 182 | sh returnStatus: true, script: """ |
| 183 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
| 184 | etcd_container=\$(kubectl get pods -n ${infraNamespace} -l app.kubernetes.io/name=etcd --no-headers | awk 'NR==1{print \$1}') |
| 185 | if [[ "${workFlow}" == "TT" ]]; then |
| 186 | kubectl cp -n ${infraNamespace} $WORKSPACE/voltha-system-tests/tests/data/TechProfile-TT-HSIA.json \$etcd_container:/tmp/hsia.json |
| 187 | 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' |
| 188 | kubectl cp -n ${infraNamespace} $WORKSPACE/voltha-system-tests/tests/data/TechProfile-TT-VoIP.json \$etcd_container:/tmp/voip.json |
| 189 | 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' |
| 190 | if [[ "${params.enableMultiUni}" == "true" ]]; then |
| 191 | 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 |
| 192 | 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' |
| 193 | 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 |
| 194 | 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' |
| 195 | else |
| 196 | kubectl cp -n ${infraNamespace} $WORKSPACE/voltha-system-tests/tests/data/TechProfile-TT-MCAST-AdditionalBW-None.json \$etcd_container:/tmp/mcast_additionalBW_none.json |
| 197 | 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' |
| 198 | kubectl cp -n ${infraNamespace} $WORKSPACE/voltha-system-tests/tests/data/TechProfile-TT-MCAST-AdditionalBW-NA.json \$etcd_container:/tmp/mcast_additionalBW_na.json |
| 199 | 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' |
| 200 | fi |
| 201 | else |
| 202 | kubectl cp -n ${infraNamespace} $WORKSPACE/voltha-system-tests/tests/data/TechProfile-${profile}.json \$etcd_container:/tmp/flexpod.json |
| 203 | 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' |
| 204 | fi |
| 205 | """ |
| 206 | } |
| 207 | timeout(1) { |
| 208 | sh returnStatus: true, script: """ |
| 209 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
| 210 | etcd_container=\$(kubectl get pods -n ${infraNamespace} -l app.kubernetes.io/name=etcd --no-headers | awk 'NR==1{print \$1}') |
| 211 | kubectl exec -n ${infraNamespace} -it \$etcd_container -- /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/voltha/technology_profiles/${tech_prof_directory}/64' |
| 212 | """ |
| 213 | } |
| 214 | } |
| 215 | } |
| 216 | } |
| 217 | } |
| 218 | } |
| 219 | stage('Push MIB templates') { |
| 220 | steps { |
| 221 | sh """ |
| 222 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
| 223 | etcd_container=\$(kubectl get pods -n ${infraNamespace} -l app.kubernetes.io/name=etcd --no-headers | awk 'NR==1{print \$1}') |
| 224 | kubectl cp -n ${infraNamespace} $WORKSPACE/voltha-system-tests/tests/data/MIB_Alpha.json \$etcd_container:/tmp/MIB_Alpha.json |
| 225 | 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' |
| 226 | 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' |
| 227 | kubectl cp -n ${infraNamespace} $WORKSPACE/voltha-system-tests/tests/data/MIB_Scom.json \$etcd_container:/tmp/MIB_Scom.json |
| 228 | 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' |
| 229 | 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' |
| 230 | """ |
| 231 | } |
| 232 | } |
| 233 | stage('Push Sadis-config') { |
| 234 | steps { |
| 235 | timeout(1) { |
| 236 | sh returnStatus: true, script: """ |
| 237 | if [[ "${workFlow}" == "DT" ]]; then |
| 238 | 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 |
| 239 | elif [[ "${workFlow}" == "TT" ]]; then |
| 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-TT.json |
| 241 | else |
| 242 | # this is the ATT case, rename the file in *-sadis-ATT.json so that we can avoid special cases and just load the file |
| 243 | 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 |
| 244 | fi |
| 245 | """ |
| 246 | } |
| 247 | } |
| 248 | } |
| 249 | stage('Switch Configurations in ONOS') { |
| 250 | steps { |
| 251 | script { |
| 252 | if ( deployment_config.fabric_switches.size() > 0 ) { |
| 253 | timeout(1) { |
| 254 | def netcfg = "$WORKSPACE/${configBaseDir}/${configToscaDir}/voltha/${configFileName}-onos-netcfg-switch.json" |
| 255 | if (params.inBandManagement){ |
| 256 | netcfg = "$WORKSPACE/${configBaseDir}/${configToscaDir}/voltha/${configFileName}-onos-netcfg-switch-inband.json" |
| 257 | } |
| 258 | sh """ |
| 259 | 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} |
| 260 | curl -sSL --user karaf:karaf -X POST http://${deployment_config.nodes[0].ip}:30120/onos/v1/applications/org.onosproject.segmentrouting/active |
| 261 | """ |
| 262 | } |
| 263 | timeout(3) { |
| 264 | setOnosLogLevels([ |
| 265 | onosNamespace: infraNamespace, |
| 266 | apps: [ |
| 267 | 'org.opencord.dhcpl2relay', |
| 268 | 'org.opencord.olt', |
| 269 | 'org.opencord.aaa', |
| 270 | 'org.opencord.maclearner', |
| 271 | 'org.onosproject.net.flowobjective.impl.FlowObjectiveManager', |
| 272 | 'org.onosproject.net.flowobjective.impl.InOrderFlowObjectiveManager' |
| 273 | ] |
| 274 | ]) |
| 275 | waitUntil { |
| 276 | sr_active_out = sh returnStatus: true, script: """ |
| 277 | curl -sSL --user karaf:karaf -X GET http://${deployment_config.nodes[0].ip}:30120/onos/v1/applications/org.onosproject.segmentrouting | jq '.state' | grep ACTIVE |
| 278 | 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" |
| 279 | 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" |
| 280 | 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" |
| 281 | """ |
| 282 | return sr_active_out == 0 |
| 283 | } |
| 284 | } |
| 285 | timeout(8) { |
| 286 | for(int i=0; i < deployment_config.hosts.src.size(); i++) { |
| 287 | for(int j=0; j < deployment_config.olts.size(); j++) { |
| 288 | def aggPort = -1 |
| 289 | if(deployment_config.olts[j].serial == deployment_config.hosts.src[i].olt){ |
| 290 | aggPort = deployment_config.olts[j].aggPort |
| 291 | if(aggPort == -1){ |
| 292 | throw new Exception("Upstream port for the olt is not configured, field aggPort is empty") |
| 293 | } |
| 294 | sh """ |
| 295 | sleep 10 # NOTE why are we sleeping? |
| 296 | 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' |
| 297 | """ |
| 298 | } |
| 299 | } |
| 300 | } |
| 301 | } |
| 302 | } |
| 303 | } |
| 304 | } |
| 305 | } |
| 306 | stage('Reinstall OLT software') { |
| 307 | steps { |
| 308 | script { |
| 309 | if ( params.reinstallOlt ) { |
| 310 | for(int i=0; i < deployment_config.olts.size(); i++) { |
| 311 | // NOTE what is oltDebVersion23? is that for VOLTHA-2.3? do we still need this differentiation? |
| 312 | sh returnStdout: true, script: """ |
| 313 | ssh-keyscan -H ${deployment_config.olts[i].sship} >> ~/.ssh/known_hosts |
| 314 | if [ "${params.inBandManagement}" == "true" ]; then |
| 315 | 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' |
| 316 | fi |
| 317 | 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}" |
| 318 | sleep 10 |
| 319 | """ |
| 320 | timeout(5) { |
| 321 | waitUntil { |
| 322 | olt_sw_present = sh returnStdout: true, script: """ |
| 323 | if [[ "${deployment_config.olts[i].oltDebVersion}" == *"asfvolt16"* ]]; then |
| 324 | 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' |
| 325 | elif [[ "${deployment_config.olts[i].oltDebVersion}" == *"asgvolt64"* ]]; then |
| 326 | 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' |
| 327 | elif [[ "${deployment_config.olts[i].oltDebVersion}" == *"rlt-1600x-w"* ]]; then |
| 328 | 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' |
| 329 | elif [[ "${deployment_config.olts[i].oltDebVersion}" == *"rlt-1600g-w"* ]]; then |
| 330 | 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' |
| 331 | elif [[ "${deployment_config.olts[i].oltDebVersion}" == *"rlt-3200g-w"* ]]; then |
| 332 | 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' |
| 333 | elif [[ "${deployment_config.olts[i].oltDebVersion}" == *"sda3016ss"* ]]; then |
| 334 | 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' |
| 335 | else |
| 336 | echo Unknown Debian package for openolt |
| 337 | fi |
| 338 | if (${deployment_config.olts[i].fortygig}); then |
| 339 | if [[ "${params.inBandManagement}" == "true" ]]; then |
| 340 | ssh-keyscan -H ${deployment_config.olts[i].sship} >> ~/.ssh/known_hosts |
| 341 | sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].sship} 'mkdir -p /opt/openolt/' |
| 342 | 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/' |
| 343 | 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' |
| 344 | 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/' |
| 345 | fi |
| 346 | fi |
| 347 | """ |
| 348 | return olt_sw_present.toInteger() > 0 |
| 349 | } |
| 350 | } |
| 351 | } |
| 352 | } |
| 353 | } |
| 354 | } |
| 355 | } |
| 356 | stage('Restart OLT processes') { |
| 357 | steps { |
| 358 | script { |
| 359 | //rebooting OLTs |
| 360 | for(int i=0; i < deployment_config.olts.size(); i++) { |
| 361 | timeout(15) { |
| 362 | sh returnStdout: true, script: """ |
| 363 | ssh-keyscan -H ${deployment_config.olts[i].sship} >> ~/.ssh/known_hosts |
| 364 | 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 |
| 365 | """ |
| 366 | } |
| 367 | } |
| 368 | sh returnStdout: true, script: """ |
| 369 | sleep ${params.waitTimerForOltUp} |
| 370 | """ |
| 371 | //Checking dev_management_deamon and openoltprocesses |
| 372 | for(int i=0; i < deployment_config.olts.size(); i++) { |
| 373 | if ( params.oltAdapterReleaseName != "open-olt" ) { |
| 374 | timeout(15) { |
| 375 | waitUntil { |
| 376 | 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'" |
| 377 | return devprocess.toInteger() > 0 |
| 378 | } |
| 379 | } |
| 380 | timeout(15) { |
| 381 | waitUntil { |
| 382 | 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'" |
| 383 | return openoltprocess.toInteger() > 0 |
| 384 | } |
| 385 | } |
| 386 | } |
| 387 | } |
| 388 | } |
| 389 | } |
| 390 | } |
| 391 | } |
| 392 | |
| 393 | post { |
| 394 | aborted { |
| 395 | getPodsInfo("$WORKSPACE/failed") |
| 396 | sh """ |
| 397 | kubectl logs -n voltha -l app.kubernetes.io/part-of=voltha > $WORKSPACE/failed/voltha.log || true |
| 398 | """ |
| 399 | archiveArtifacts artifacts: '**/*.log,**/*.txt' |
| 400 | } |
| 401 | failure { |
| 402 | getPodsInfo("$WORKSPACE/failed") |
| 403 | sh """ |
| 404 | kubectl logs -n voltha -l app.kubernetes.io/part-of=voltha > $WORKSPACE/failed/voltha.logs || true |
| 405 | """ |
| 406 | archiveArtifacts artifacts: '**/*.log,**/*.txt' |
| 407 | } |
| 408 | always { |
| 409 | archiveArtifacts artifacts: '*.txt' |
| 410 | } |
| 411 | } |
| 412 | } |