Joey Armstrong | 7adbfb0 | 2023-01-24 17:02:37 -0500 | [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 | |
Joey Armstrong | 6c0b855 | 2023-06-28 17:41:48 -0400 | [diff] [blame] | 25 | // ----------------------------------------------------------------------- |
| 26 | // ----------------------------------------------------------------------- |
| 27 | def getIam(String func) |
| 28 | { |
| 29 | // Cannot rely on a stack trace due to jenkins manipulation |
| 30 | String src = 'jjb/pipeline/votlha-2.11/physical-build.groovy' |
| 31 | String iam = [src, func].join('::') |
| 32 | return iam |
| 33 | } |
| 34 | |
Joey Armstrong | 7adbfb0 | 2023-01-24 17:02:37 -0500 | [diff] [blame] | 35 | def infraNamespace = "infra" |
| 36 | def volthaNamespace = "voltha" |
| 37 | |
Joey Armstrong | 6c0b855 | 2023-06-28 17:41:48 -0400 | [diff] [blame] | 38 | // ----------------------------------------------------------------------- |
| 39 | // ----------------------------------------------------------------------- |
Joey Armstrong | 7adbfb0 | 2023-01-24 17:02:37 -0500 | [diff] [blame] | 40 | def deploy_custom_oltAdapterChart(namespace, name, chart, extraHelmFlags) { |
Joey Armstrong | 6c0b855 | 2023-06-28 17:41:48 -0400 | [diff] [blame] | 41 | String iam = getIam('deploy_custom_oltAdapterChart') |
| 42 | println("** ${iam}: ENTER") |
| 43 | |
| 44 | sh """ |
Joey Armstrong | 7adbfb0 | 2023-01-24 17:02:37 -0500 | [diff] [blame] | 45 | helm install --create-namespace --set defaults.image_pullPolicy=Always --namespace ${namespace} ${extraHelmFlags} ${name} ${chart} |
| 46 | """ |
Joey Armstrong | 6c0b855 | 2023-06-28 17:41:48 -0400 | [diff] [blame] | 47 | |
| 48 | println("** ${iam}: LEAVE") |
| 49 | return |
Joey Armstrong | 7adbfb0 | 2023-01-24 17:02:37 -0500 | [diff] [blame] | 50 | } |
| 51 | |
| 52 | pipeline { |
| 53 | |
| 54 | /* no label, executor is determined by JJB */ |
| 55 | agent { |
| 56 | label "${params.buildNode}" |
| 57 | } |
| 58 | options { |
| 59 | timeout(time: 35, unit: 'MINUTES') |
| 60 | } |
| 61 | environment { |
| 62 | PATH="$PATH:$WORKSPACE/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin" |
| 63 | KUBECONFIG="$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf" |
| 64 | } |
| 65 | |
| 66 | stages{ |
| 67 | stage('Download Code') { |
| 68 | steps { |
| 69 | getVolthaCode([ |
| 70 | branch: "${branch}", |
| 71 | volthaSystemTestsChange: "${volthaSystemTestsChange}", |
| 72 | volthaHelmChartsChange: "${volthaHelmChartsChange}", |
| 73 | ]) |
| 74 | } |
| 75 | } |
| 76 | stage ("Parse deployment configuration file") { |
| 77 | steps { |
| 78 | sh returnStdout: true, script: "rm -rf ${configBaseDir}" |
| 79 | sh returnStdout: true, script: "git clone -b ${branch} ${cordRepoUrl}/${configBaseDir}" |
| 80 | script { |
| 81 | if ( params.workFlow == "DT" ) { |
| 82 | deployment_config = readYaml file: "${configBaseDir}/${configDeploymentDir}/${configFileName}-DT.yaml" |
| 83 | } |
| 84 | else if ( params.workFlow == "TT" ) |
| 85 | { |
| 86 | deployment_config = readYaml file: "${configBaseDir}/${configDeploymentDir}/${configFileName}-TT.yaml" |
| 87 | } |
| 88 | else |
| 89 | { |
| 90 | deployment_config = readYaml file: "${configBaseDir}/${configDeploymentDir}/${configFileName}.yaml" |
| 91 | } |
| 92 | } |
| 93 | } |
| 94 | } |
| 95 | stage('Clean up') { |
| 96 | steps { |
| 97 | timeout(15) { |
| 98 | script { |
| 99 | helmTeardown(["default", infraNamespace, volthaNamespace]) |
| 100 | } |
| 101 | timeout(1) { |
| 102 | sh returnStdout: false, script: ''' |
| 103 | # remove orphaned port-forward from different namespaces |
| 104 | ps aux | grep port-forw | grep -v grep | awk '{print $2}' | xargs --no-run-if-empty kill -9 || true |
| 105 | ''' |
| 106 | } |
| 107 | } |
| 108 | } |
| 109 | } |
| 110 | stage('Install Voltha') { |
| 111 | steps { |
| 112 | timeout(20) { |
| 113 | installVoltctl("${branch}") |
| 114 | script { |
| 115 | // if we're downloading a voltha-helm-charts patch, then install from a local copy of the charts |
| 116 | def localCharts = false |
| 117 | if (volthaHelmChartsChange != "") { |
| 118 | localCharts = true |
| 119 | } |
| 120 | |
| 121 | // should the config file be suffixed with the workflow? see "deployment_config" |
| 122 | def localHelmFlags = "-f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/voltha/${configFileName}.yml --set global.log_level=${logLevel} " |
| 123 | |
| 124 | if (workFlow.toLowerCase() == "dt") { |
| 125 | localHelmFlags += " --set radius.enabled=false " |
| 126 | } |
| 127 | if (workFlow.toLowerCase() == "tt") { |
| 128 | localHelmFlags += " --set radius.enabled=false --set global.incremental_evto_update=true " |
| 129 | if (enableMultiUni.toBoolean()) { |
| 130 | localHelmFlags += " --set voltha-adapter-openonu.adapter_open_onu.uni_port_mask=${uniPortMask} " |
| 131 | } |
| 132 | } |
| 133 | |
| 134 | // NOTE temporary workaround expose ONOS node ports (pod-config needs to be updated to contain these values) |
| 135 | // and to connect the ofagent to all instances of ONOS |
| 136 | localHelmFlags = localHelmFlags + " --set onos-classic.onosSshPort=30115 " + |
| 137 | "--set onos-classic.onosApiPort=30120 " + |
| 138 | "--set onos-classic.onosOfPort=31653 " + |
| 139 | "--set onos-classic.individualOpenFlowNodePorts=true " + |
| 140 | "--set voltha.onos_classic.replicas=${params.NumOfOnos}" |
| 141 | |
| 142 | if (bbsimReplicas.toInteger() != 0) { |
| 143 | localHelmFlags = localHelmFlags + " --set onu=${onuNumber},pon=${ponNumber} " |
| 144 | } |
| 145 | |
| 146 | // adding user specified helm flags at the end so they'll have priority over everything else |
| 147 | localHelmFlags = localHelmFlags + " ${extraHelmFlags}" |
| 148 | |
| 149 | def numberOfAdaptersToWait = 2 |
| 150 | |
| 151 | if(openoltAdapterChart != "onf/voltha-adapter-openolt") { |
| 152 | localHelmFlags = localHelmFlags + " --set voltha-adapter-openolt.enabled=false" |
| 153 | // We skip waiting for adapters in the volthaDeploy step because it's already waiting for |
| 154 | // both of them after the deployment of the custom olt adapter. See line 156. |
| 155 | numberOfAdaptersToWait = 0 |
| 156 | } |
| 157 | |
| 158 | volthaDeploy([ |
| 159 | workflow: workFlow.toLowerCase(), |
| 160 | extraHelmFlags: localHelmFlags, |
| 161 | localCharts: localCharts, |
| 162 | kubeconfig: "$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf", |
| 163 | onosReplica: params.NumOfOnos, |
| 164 | atomixReplica: params.NumOfAtomix, |
| 165 | kafkaReplica: params.NumOfKafka, |
| 166 | etcdReplica: params.NumOfEtcd, |
| 167 | bbsimReplica: bbsimReplicas.toInteger(), |
| 168 | withFttb: withFttb.toBoolean(), |
| 169 | adaptersToWait: numberOfAdaptersToWait, |
| 170 | ]) |
| 171 | |
| 172 | if(openoltAdapterChart != "onf/voltha-adapter-openolt"){ |
| 173 | extraHelmFlags = extraHelmFlags + " --set global.log_level=${logLevel}" |
| 174 | deploy_custom_oltAdapterChart(volthaNamespace, oltAdapterReleaseName, openoltAdapterChart, extraHelmFlags) |
| 175 | waitForAdapters([ |
| 176 | adaptersToWait: 2 |
| 177 | ]) |
| 178 | } |
| 179 | } |
| 180 | sh """ |
| 181 | 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"& |
| 182 | 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"& |
| 183 | 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"& |
| 184 | ps aux | grep port-forward |
| 185 | """ |
| 186 | getPodsInfo("$WORKSPACE") |
| 187 | } |
| 188 | } |
| 189 | } |
| 190 | stage('Push Tech-Profile') { |
| 191 | steps { |
| 192 | script { |
| 193 | if ( params.configurePod && params.profile != "Default" ) { |
| 194 | for(int i=0; i < deployment_config.olts.size(); i++) { |
| 195 | def tech_prof_directory = "XGS-PON" |
| 196 | if (deployment_config.olts[i].containsKey("board_technology")){ |
| 197 | tech_prof_directory = deployment_config.olts[i]["board_technology"] |
| 198 | } |
| 199 | timeout(1) { |
| 200 | sh returnStatus: true, script: """ |
| 201 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
| 202 | etcd_container=\$(kubectl get pods -n ${infraNamespace} -l app.kubernetes.io/name=etcd --no-headers | awk 'NR==1{print \$1}') |
| 203 | if [[ "${workFlow}" == "TT" ]]; then |
| 204 | kubectl cp -n ${infraNamespace} $WORKSPACE/voltha-system-tests/tests/data/TechProfile-TT-HSIA.json \$etcd_container:/tmp/hsia.json |
| 205 | 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' |
| 206 | kubectl cp -n ${infraNamespace} $WORKSPACE/voltha-system-tests/tests/data/TechProfile-TT-VoIP.json \$etcd_container:/tmp/voip.json |
| 207 | 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' |
| 208 | if [[ "${params.enableMultiUni}" == "true" ]]; then |
| 209 | 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 |
| 210 | 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' |
| 211 | 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 |
| 212 | 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' |
| 213 | else |
| 214 | kubectl cp -n ${infraNamespace} $WORKSPACE/voltha-system-tests/tests/data/TechProfile-TT-MCAST-AdditionalBW-None.json \$etcd_container:/tmp/mcast_additionalBW_none.json |
| 215 | 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' |
| 216 | kubectl cp -n ${infraNamespace} $WORKSPACE/voltha-system-tests/tests/data/TechProfile-TT-MCAST-AdditionalBW-NA.json \$etcd_container:/tmp/mcast_additionalBW_na.json |
| 217 | 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' |
| 218 | fi |
| 219 | else |
| 220 | kubectl cp -n ${infraNamespace} $WORKSPACE/voltha-system-tests/tests/data/TechProfile-${profile}.json \$etcd_container:/tmp/flexpod.json |
| 221 | 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' |
| 222 | fi |
| 223 | """ |
| 224 | } |
| 225 | timeout(1) { |
| 226 | sh returnStatus: true, script: """ |
| 227 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
| 228 | etcd_container=\$(kubectl get pods -n ${infraNamespace} -l app.kubernetes.io/name=etcd --no-headers | awk 'NR==1{print \$1}') |
| 229 | kubectl exec -n ${infraNamespace} -it \$etcd_container -- /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/voltha/technology_profiles/${tech_prof_directory}/64' |
| 230 | """ |
| 231 | } |
| 232 | } |
| 233 | } |
| 234 | } |
| 235 | } |
| 236 | } |
| 237 | stage('Push MIB templates') { |
| 238 | steps { |
| 239 | sh """ |
| 240 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
| 241 | etcd_container=\$(kubectl get pods -n ${infraNamespace} -l app.kubernetes.io/name=etcd --no-headers | awk 'NR==1{print \$1}') |
| 242 | kubectl cp -n ${infraNamespace} $WORKSPACE/voltha-system-tests/tests/data/MIB_Alpha.json \$etcd_container:/tmp/MIB_Alpha.json |
| 243 | 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' |
| 244 | 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' |
| 245 | kubectl cp -n ${infraNamespace} $WORKSPACE/voltha-system-tests/tests/data/MIB_Scom.json \$etcd_container:/tmp/MIB_Scom.json |
| 246 | 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' |
| 247 | 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' |
| 248 | """ |
| 249 | } |
| 250 | } |
| 251 | stage('Push Sadis-config') { |
| 252 | steps { |
| 253 | timeout(1) { |
| 254 | sh returnStatus: true, script: """ |
| 255 | if [[ "${workFlow}" == "DT" ]]; then |
| 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 @$WORKSPACE/voltha-system-tests/tests/data/${configFileName}-sadis-DT.json |
| 257 | elif [[ "${workFlow}" == "TT" ]]; then |
| 258 | 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 |
| 259 | else |
| 260 | # this is the ATT case, rename the file in *-sadis-ATT.json so that we can avoid special cases and just load the file |
| 261 | 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 |
| 262 | fi |
| 263 | """ |
| 264 | } |
| 265 | } |
| 266 | } |
| 267 | stage('Switch Configurations in ONOS') { |
| 268 | steps { |
| 269 | script { |
| 270 | if ( deployment_config.fabric_switches.size() > 0 ) { |
| 271 | timeout(1) { |
| 272 | def netcfg = "$WORKSPACE/${configBaseDir}/${configToscaDir}/voltha/${configFileName}-onos-netcfg-switch.json" |
| 273 | if (params.inBandManagement){ |
| 274 | netcfg = "$WORKSPACE/${configBaseDir}/${configToscaDir}/voltha/${configFileName}-onos-netcfg-switch-inband.json" |
| 275 | } |
| 276 | sh """ |
| 277 | 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} |
| 278 | curl -sSL --user karaf:karaf -X POST http://${deployment_config.nodes[0].ip}:30120/onos/v1/applications/org.onosproject.segmentrouting/active |
| 279 | """ |
| 280 | } |
| 281 | timeout(3) { |
| 282 | setOnosLogLevels([ |
| 283 | onosNamespace: infraNamespace, |
| 284 | apps: [ |
| 285 | 'org.opencord.dhcpl2relay', |
| 286 | 'org.opencord.olt', |
| 287 | 'org.opencord.aaa', |
| 288 | 'org.opencord.maclearner', |
| 289 | 'org.onosproject.net.flowobjective.impl.FlowObjectiveManager', |
| 290 | 'org.onosproject.net.flowobjective.impl.InOrderFlowObjectiveManager' |
| 291 | ] |
| 292 | ]) |
| 293 | waitUntil { |
| 294 | sr_active_out = sh returnStatus: true, script: """ |
| 295 | curl -sSL --user karaf:karaf -X GET http://${deployment_config.nodes[0].ip}:30120/onos/v1/applications/org.onosproject.segmentrouting | jq '.state' | grep ACTIVE |
| 296 | 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" |
| 297 | 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" |
| 298 | 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" |
| 299 | """ |
| 300 | return sr_active_out == 0 |
| 301 | } |
| 302 | } |
| 303 | timeout(8) { |
| 304 | for(int i=0; i < deployment_config.hosts.src.size(); i++) { |
| 305 | for(int j=0; j < deployment_config.olts.size(); j++) { |
| 306 | def aggPort = -1 |
| 307 | if(deployment_config.olts[j].serial == deployment_config.hosts.src[i].olt){ |
| 308 | aggPort = deployment_config.olts[j].aggPort |
| 309 | if(aggPort == -1){ |
| 310 | throw new Exception("Upstream port for the olt is not configured, field aggPort is empty") |
| 311 | } |
| 312 | sh """ |
| 313 | sleep 10 # NOTE why are we sleeping? |
| 314 | 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' |
| 315 | """ |
| 316 | } |
| 317 | } |
| 318 | } |
| 319 | } |
| 320 | } |
| 321 | } |
| 322 | } |
| 323 | } |
| 324 | stage('Reinstall OLT software') { |
| 325 | steps { |
| 326 | script { |
| 327 | if ( params.reinstallOlt ) { |
| 328 | for(int i=0; i < deployment_config.olts.size(); i++) { |
| 329 | // NOTE what is oltDebVersion23? is that for VOLTHA-2.3? do we still need this differentiation? |
| 330 | sh returnStdout: true, script: """ |
| 331 | ssh-keyscan -H ${deployment_config.olts[i].sship} >> ~/.ssh/known_hosts |
| 332 | if [ "${params.inBandManagement}" == "true" ]; then |
| 333 | 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' |
| 334 | fi |
| 335 | 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}" |
| 336 | sleep 10 |
| 337 | """ |
| 338 | timeout(5) { |
| 339 | waitUntil { |
| 340 | olt_sw_present = sh returnStdout: true, script: """ |
| 341 | if [[ "${deployment_config.olts[i].oltDebVersion}" == *"asfvolt16"* ]]; then |
| 342 | 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' |
| 343 | elif [[ "${deployment_config.olts[i].oltDebVersion}" == *"asgvolt64"* ]]; then |
| 344 | 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' |
| 345 | elif [[ "${deployment_config.olts[i].oltDebVersion}" == *"rlt-1600x-w"* ]]; then |
| 346 | 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' |
| 347 | elif [[ "${deployment_config.olts[i].oltDebVersion}" == *"rlt-1600g-w"* ]]; then |
| 348 | 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' |
| 349 | elif [[ "${deployment_config.olts[i].oltDebVersion}" == *"rlt-3200g-w"* ]]; then |
| 350 | 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' |
| 351 | elif [[ "${deployment_config.olts[i].oltDebVersion}" == *"sda3016ss"* ]]; then |
| 352 | 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' |
| 353 | else |
| 354 | echo Unknown Debian package for openolt |
| 355 | fi |
| 356 | if (${deployment_config.olts[i].fortygig}); then |
| 357 | if [[ "${params.inBandManagement}" == "true" ]]; then |
| 358 | ssh-keyscan -H ${deployment_config.olts[i].sship} >> ~/.ssh/known_hosts |
| 359 | sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].sship} 'mkdir -p /opt/openolt/' |
| 360 | 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/' |
| 361 | 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' |
| 362 | 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/' |
| 363 | fi |
| 364 | fi |
| 365 | """ |
| 366 | return olt_sw_present.toInteger() > 0 |
| 367 | } |
| 368 | } |
| 369 | } |
| 370 | } |
| 371 | } |
| 372 | } |
| 373 | } |
| 374 | stage('Restart OLT processes') { |
| 375 | steps { |
| 376 | script { |
| 377 | //rebooting OLTs |
| 378 | for(int i=0; i < deployment_config.olts.size(); i++) { |
| 379 | timeout(15) { |
| 380 | sh returnStdout: true, script: """ |
| 381 | ssh-keyscan -H ${deployment_config.olts[i].sship} >> ~/.ssh/known_hosts |
| 382 | 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 |
| 383 | """ |
| 384 | } |
| 385 | } |
| 386 | sh returnStdout: true, script: """ |
| 387 | sleep ${params.waitTimerForOltUp} |
| 388 | """ |
| 389 | //Checking dev_management_deamon and openoltprocesses |
| 390 | for(int i=0; i < deployment_config.olts.size(); i++) { |
| 391 | if ( params.oltAdapterReleaseName != "open-olt" ) { |
| 392 | timeout(15) { |
| 393 | waitUntil { |
| 394 | 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'" |
| 395 | return devprocess.toInteger() > 0 |
| 396 | } |
| 397 | } |
| 398 | timeout(15) { |
| 399 | waitUntil { |
| 400 | 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'" |
| 401 | return openoltprocess.toInteger() > 0 |
| 402 | } |
| 403 | } |
| 404 | } |
| 405 | } |
| 406 | } |
| 407 | } |
| 408 | } |
| 409 | } |
| 410 | |
| 411 | post { |
| 412 | aborted { |
| 413 | getPodsInfo("$WORKSPACE/failed") |
| 414 | sh """ |
| 415 | kubectl logs -n voltha -l app.kubernetes.io/part-of=voltha > $WORKSPACE/failed/voltha.log || true |
| 416 | """ |
| 417 | archiveArtifacts artifacts: '**/*.log,**/*.txt' |
| 418 | } |
| 419 | failure { |
| 420 | getPodsInfo("$WORKSPACE/failed") |
| 421 | sh """ |
| 422 | kubectl logs -n voltha -l app.kubernetes.io/part-of=voltha > $WORKSPACE/failed/voltha.logs || true |
| 423 | """ |
| 424 | archiveArtifacts artifacts: '**/*.log,**/*.txt' |
| 425 | } |
| 426 | always { |
| 427 | archiveArtifacts artifacts: '*.txt' |
| 428 | } |
| 429 | } |
| 430 | } |