Hardik Windlass | 6d9a82e | 2021-07-08 16:23:21 +0000 | [diff] [blame] | 1 | // 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 |
| 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 | pipeline { |
| 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" |
| 39 | KUBECONFIG="$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf" |
| 40 | } |
| 41 | |
| 42 | stages{ |
| 43 | stage('Download Code') { |
| 44 | steps { |
| 45 | getVolthaCode([ |
| 46 | branch: "${branch}", |
| 47 | volthaSystemTestsChange: "${volthaSystemTestsChange}", |
| 48 | volthaHelmChartsChange: "${volthaHelmChartsChange}", |
| 49 | ]) |
| 50 | } |
| 51 | } |
| 52 | stage ("Parse deployment configuration file") { |
| 53 | steps { |
| 54 | sh returnStdout: true, script: "rm -rf ${configBaseDir}" |
Hardik Windlass | 6f854a1 | 2021-07-12 13:20:21 +0000 | [diff] [blame] | 55 | sh returnStdout: true, script: "git clone -b ${branch} ${cordRepoUrl}/${configBaseDir}" |
Hardik Windlass | 6d9a82e | 2021-07-08 16:23:21 +0000 | [diff] [blame] | 56 | script { |
| 57 | if ( params.workFlow == "DT" ) { |
| 58 | deployment_config = readYaml file: "${configBaseDir}/${configDeploymentDir}/${configFileName}-DT.yaml" |
| 59 | } |
| 60 | else if ( params.workFlow == "TT" ) |
| 61 | { |
| 62 | deployment_config = readYaml file: "${configBaseDir}/${configDeploymentDir}/${configFileName}-TT.yaml" |
| 63 | } |
| 64 | else |
| 65 | { |
| 66 | deployment_config = readYaml file: "${configBaseDir}/${configDeploymentDir}/${configFileName}.yaml" |
| 67 | } |
| 68 | } |
| 69 | } |
| 70 | } |
| 71 | stage('Clean up') { |
| 72 | steps { |
| 73 | timeout(15) { |
| 74 | script { |
| 75 | helmTeardown(["default", infraNamespace, volthaNamespace]) |
| 76 | } |
| 77 | timeout(1) { |
| 78 | sh returnStdout: false, script: ''' |
| 79 | # remove orphaned port-forward from different namespaces |
| 80 | ps aux | grep port-forw | grep -v grep | awk '{print $2}' | xargs --no-run-if-empty kill -9 || true |
| 81 | ''' |
| 82 | } |
| 83 | } |
| 84 | } |
| 85 | } |
| 86 | stage('Install Voltha') { |
| 87 | steps { |
| 88 | timeout(20) { |
| 89 | script { |
| 90 | // if we're downloading a voltha-helm-charts patch, then install from a local copy of the charts |
| 91 | def localCharts = false |
| 92 | if (volthaHelmChartsChange != "" || branch != "master") { |
| 93 | localCharts = true |
| 94 | } |
| 95 | |
| 96 | // should the config file be suffixed with the workflow? see "deployment_config" |
| 97 | def localHelmFlags = "-f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/voltha/${configFileName}.yml --set global.log_level=${logLevel} " |
| 98 | |
| 99 | if (workFlow.toLowerCase() == "dt") { |
| 100 | localHelmFlags += " --set radius.enabled=false " |
| 101 | } |
| 102 | if (workFlow.toLowerCase() == "tt") { |
| 103 | localHelmFlags += " --set radius.enabled=false --set global.incremental_evto_update=true " |
| 104 | if (enableMultiUni.toBoolean()) { |
| 105 | localHelmFlags += " --set voltha-adapter-openonu.adapter_open_onu.uni_port_mask=${uniPortMask} " |
| 106 | } |
| 107 | } |
| 108 | |
| 109 | // NOTE temporary workaround expose ONOS node ports (pod-config needs to be updated to contain these values) |
| 110 | // and to connect the ofagent to all instances of ONOS |
| 111 | localHelmFlags = localHelmFlags + " --set onos-classic.onosSshPort=30115 " + |
| 112 | "--set onos-classic.onosApiPort=30120 " + |
| 113 | "--set onos-classic.onosOfPort=31653 " + |
| 114 | "--set onos-classic.individualOpenFlowNodePorts=true " + |
| 115 | "--set voltha.onos_classic.replicas=${params.NumOfOnos}" |
| 116 | |
| 117 | if (bbsimReplicas.toInteger() != 0) { |
| 118 | localHelmFlags = localHelmFlags + " --set onu=${onuNumber},pon=${ponNumber} " |
| 119 | } |
| 120 | |
| 121 | // adding user specified helm flags at the end so they'll have priority over everything else |
| 122 | localHelmFlags = localHelmFlags + " ${extraHelmFlags}" |
| 123 | |
| 124 | volthaDeploy([ |
| 125 | workflow: workFlow.toLowerCase(), |
| 126 | extraHelmFlags: localHelmFlags, |
| 127 | localCharts: localCharts, |
| 128 | kubeconfig: "$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf", |
| 129 | onosReplica: params.NumOfOnos, |
| 130 | atomixReplica: params.NumOfAtomix, |
| 131 | kafkaReplica: params.NumOfKafka, |
| 132 | etcdReplica: params.NumOfEtcd, |
| 133 | bbsimReplica: bbsimReplicas.toInteger(), |
| 134 | ]) |
| 135 | } |
| 136 | sh """ |
| 137 | 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"& |
| 138 | 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"& |
| 139 | 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"& |
| 140 | ps aux | grep port-forward |
| 141 | """ |
| 142 | getPodsInfo("$WORKSPACE") |
| 143 | } |
| 144 | } |
| 145 | } |
| 146 | stage('Push Tech-Profile') { |
| 147 | steps { |
| 148 | script { |
| 149 | if ( params.configurePod && params.profile != "Default" ) { |
| 150 | for(int i=0; i < deployment_config.olts.size(); i++) { |
| 151 | def tech_prof_directory = "XGS-PON" |
| 152 | // If no debian package is specified we default to GPON for the ADTRAN OLT. |
| 153 | if (!deployment_config.olts[i].containsKey("oltDebVersion") || deployment_config.olts[i].oltDebVersion.contains("asgvolt64")){ |
| 154 | tech_prof_directory = "GPON" |
| 155 | } |
| 156 | timeout(1) { |
| 157 | sh returnStatus: true, script: """ |
| 158 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
| 159 | etcd_container=\$(kubectl get pods -n ${infraNamespace} | grep etcd | awk 'NR==1{print \$1}') |
| 160 | if [[ "${workFlow}" == "TT" ]]; then |
| 161 | if [[ "${params.enableMultiUni}" == "true" ]]; then |
| 162 | kubectl cp -n ${infraNamespace} $WORKSPACE/voltha-system-tests/tests/data/TechProfile-TT-multi-uni-HSIA.json \$etcd_container:/tmp/hsia.json |
| 163 | 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' |
| 164 | kubectl cp -n ${infraNamespace} $WORKSPACE/voltha-system-tests/tests/data/TechProfile-TT-multi-uni-VoIP.json \$etcd_container:/tmp/voip.json |
| 165 | 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' |
| 166 | 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 |
| 167 | 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' |
| 168 | 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 |
| 169 | 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' |
| 170 | else |
| 171 | kubectl cp -n ${infraNamespace} $WORKSPACE/voltha-system-tests/tests/data/TechProfile-TT-HSIA.json \$etcd_container:/tmp/hsia.json |
| 172 | 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' |
| 173 | kubectl cp -n ${infraNamespace} $WORKSPACE/voltha-system-tests/tests/data/TechProfile-TT-VoIP.json \$etcd_container:/tmp/voip.json |
| 174 | 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' |
| 175 | kubectl cp -n ${infraNamespace} $WORKSPACE/voltha-system-tests/tests/data/TechProfile-TT-MCAST-AdditionalBW-None.json \$etcd_container:/tmp/mcast_additionalBW_none.json |
| 176 | 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' |
| 177 | kubectl cp -n ${infraNamespace} $WORKSPACE/voltha-system-tests/tests/data/TechProfile-TT-MCAST-AdditionalBW-NA.json \$etcd_container:/tmp/mcast_additionalBW_na.json |
| 178 | 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' |
| 179 | fi |
| 180 | else |
| 181 | kubectl cp -n ${infraNamespace} $WORKSPACE/voltha-system-tests/tests/data/TechProfile-${profile}.json \$etcd_container:/tmp/flexpod.json |
| 182 | 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' |
| 183 | fi |
| 184 | """ |
| 185 | } |
| 186 | timeout(1) { |
| 187 | sh returnStatus: true, script: """ |
| 188 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
| 189 | etcd_container=\$(kubectl get pods -n ${infraNamespace} | grep etcd | awk 'NR==1{print \$1}') |
| 190 | kubectl exec -n ${infraNamespace} -it \$etcd_container -- /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/voltha/technology_profiles/${tech_prof_directory}/64' |
| 191 | """ |
| 192 | } |
| 193 | } |
| 194 | } |
| 195 | } |
| 196 | } |
| 197 | } |
| 198 | stage('Push MIB templates') { |
| 199 | steps { |
| 200 | sh """ |
| 201 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
| 202 | etcd_container=\$(kubectl get pods -n ${infraNamespace} | grep etcd | awk 'NR==1{print \$1}') |
| 203 | kubectl cp -n ${infraNamespace} $WORKSPACE/voltha-system-tests/tests/data/MIB_Alpha.json \$etcd_container:/tmp/MIB_Alpha.json |
| 204 | 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' |
| 205 | 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' |
| 206 | kubectl cp -n ${infraNamespace} $WORKSPACE/voltha-system-tests/tests/data/MIB_Scom.json \$etcd_container:/tmp/MIB_Scom.json |
| 207 | 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' |
| 208 | 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' |
| 209 | """ |
| 210 | } |
| 211 | } |
| 212 | stage('Push Sadis-config') { |
| 213 | steps { |
| 214 | timeout(1) { |
| 215 | sh returnStatus: true, script: """ |
| 216 | if [[ "${workFlow}" == "DT" ]]; then |
| 217 | 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 |
| 218 | elif [[ "${workFlow}" == "TT" ]]; then |
| 219 | 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 |
| 220 | else |
| 221 | # this is the ATT case, rename the file in *-sadis-ATT.json so that we can avoid special cases and just load the file |
| 222 | 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 |
| 223 | fi |
| 224 | """ |
| 225 | } |
| 226 | } |
| 227 | } |
| 228 | stage('Switch Configurations in ONOS') { |
| 229 | steps { |
| 230 | script { |
| 231 | if ( deployment_config.fabric_switches.size() > 0 ) { |
| 232 | timeout(1) { |
| 233 | def netcfg = "$WORKSPACE/${configBaseDir}/${configToscaDir}/voltha/${configFileName}-onos-netcfg-switch.json" |
| 234 | if (params.inBandManagement){ |
| 235 | netcfg = "$WORKSPACE/${configBaseDir}/${configToscaDir}/voltha/${configFileName}-onos-netcfg-switch-inband.json" |
| 236 | } |
| 237 | sh """ |
| 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 @${netcfg} |
| 239 | curl -sSL --user karaf:karaf -X POST http://${deployment_config.nodes[0].ip}:30120/onos/v1/applications/org.onosproject.segmentrouting/active |
| 240 | """ |
| 241 | } |
| 242 | timeout(1) { |
| 243 | waitUntil { |
| 244 | sr_active_out = sh returnStatus: true, script: """ |
| 245 | 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" |
| 246 | 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" |
| 247 | 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" |
| 248 | 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" |
| 249 | 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" |
| 250 | curl -sSL --user karaf:karaf -X GET http://${deployment_config.nodes[0].ip}:30120/onos/v1/applications/org.onosproject.segmentrouting | jq '.state' | grep ACTIVE |
| 251 | 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" |
| 252 | 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" |
| 253 | 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" |
| 254 | """ |
| 255 | return sr_active_out == 0 |
| 256 | } |
| 257 | } |
| 258 | timeout(7) { |
| 259 | for(int i=0; i < deployment_config.hosts.src.size(); i++) { |
| 260 | for(int j=0; j < deployment_config.olts.size(); j++) { |
| 261 | def aggPort = -1 |
| 262 | if(deployment_config.olts[j].serial == deployment_config.hosts.src[i].olt){ |
| 263 | aggPort = deployment_config.olts[j].aggPort |
| 264 | if(aggPort == -1){ |
| 265 | throw new Exception("Upstream port for the olt is not configured, field aggPort is empty") |
| 266 | } |
| 267 | sh """ |
| 268 | sleep 30 # NOTE why are we sleeping? |
| 269 | 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' |
| 270 | """ |
| 271 | } |
| 272 | } |
| 273 | } |
| 274 | } |
| 275 | } |
| 276 | } |
| 277 | } |
| 278 | } |
| 279 | stage('Reinstall OLT software') { |
| 280 | steps { |
| 281 | script { |
| 282 | if ( params.reinstallOlt ) { |
| 283 | for(int i=0; i < deployment_config.olts.size(); i++) { |
| 284 | // NOTE what is oltDebVersion23? is that for VOLTHA-2.3? do we still need this differentiation? |
| 285 | sh returnStdout: true, script: """ |
Hardik Windlass | 6cdbfa2 | 2021-07-13 06:21:35 +0000 | [diff] [blame] | 286 | ssh-keyscan -H ${deployment_config.olts[i].sship} >> ~/.ssh/known_hosts |
| 287 | if [ "${params.inBandManagement}" == "true" ]; then |
Hardik Windlass | 6d9a82e | 2021-07-08 16:23:21 +0000 | [diff] [blame] | 288 | 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 Windlass | 6d9a82e | 2021-07-08 16:23:21 +0000 | [diff] [blame] | 289 | fi |
Hardik Windlass | 6cdbfa2 | 2021-07-13 06:21:35 +0000 | [diff] [blame] | 290 | 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 Windlass | 6d9a82e | 2021-07-08 16:23:21 +0000 | [diff] [blame] | 291 | sleep 10 |
| 292 | """ |
| 293 | timeout(5) { |
| 294 | waitUntil { |
| 295 | olt_sw_present = sh returnStdout: true, script: """ |
| 296 | if [ "${deployment_config.olts[i].oltDebVersion}" == *"asfvolt16"* ]; then |
| 297 | 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' |
| 298 | else |
| 299 | 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' |
| 300 | fi |
| 301 | if (${deployment_config.olts[i].fortygig}); then |
| 302 | if [[ "${params.inBandManagement}" == "true" ]]; then |
| 303 | ssh-keyscan -H ${deployment_config.olts[i].sship} >> ~/.ssh/known_hosts |
| 304 | sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].sship} 'mkdir -p /opt/openolt/' |
| 305 | 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/' |
| 306 | 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' |
| 307 | 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/' |
| 308 | fi |
| 309 | fi |
| 310 | """ |
| 311 | return olt_sw_present.toInteger() > 0 |
| 312 | } |
| 313 | } |
| 314 | } |
| 315 | } |
| 316 | } |
| 317 | } |
| 318 | } |
| 319 | stage('Restart OLT processes') { |
| 320 | steps { |
| 321 | script { |
| 322 | for(int i=0; i < deployment_config.olts.size(); i++) { |
| 323 | int waitTimerForOltUp = 360 |
| 324 | if ( params.inBandManagement ) { |
| 325 | waitTimerForOltUp = 540 |
| 326 | } |
| 327 | timeout(15) { |
| 328 | sh returnStdout: true, script: """ |
| 329 | ssh-keyscan -H ${deployment_config.olts[i].sship} >> ~/.ssh/known_hosts |
| 330 | 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 |
| 331 | sleep ${waitTimerForOltUp} |
| 332 | """ |
| 333 | } |
| 334 | timeout(15) { |
| 335 | waitUntil { |
| 336 | 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'" |
| 337 | return devprocess.toInteger() > 0 |
| 338 | } |
| 339 | } |
| 340 | timeout(15) { |
| 341 | waitUntil { |
| 342 | 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'" |
| 343 | return openoltprocess.toInteger() > 0 |
| 344 | } |
| 345 | } |
| 346 | } |
| 347 | } |
| 348 | } |
| 349 | } |
| 350 | } |
| 351 | |
| 352 | post { |
| 353 | aborted { |
| 354 | getPodsInfo("$WORKSPACE/failed") |
| 355 | sh """ |
| 356 | kubectl logs -n voltha -l app.kubernetes.io/part-of=voltha > $WORKSPACE/failed/voltha.log || true |
| 357 | """ |
| 358 | archiveArtifacts artifacts: '**/*.log,**/*.txt' |
| 359 | } |
| 360 | failure { |
| 361 | getPodsInfo("$WORKSPACE/failed") |
| 362 | sh """ |
| 363 | kubectl logs -n voltha -l app.kubernetes.io/part-of=voltha > $WORKSPACE/failed/voltha.logs || true |
| 364 | """ |
| 365 | archiveArtifacts artifacts: '**/*.log,**/*.txt' |
| 366 | } |
| 367 | always { |
| 368 | archiveArtifacts artifacts: '*.txt' |
| 369 | } |
| 370 | } |
| 371 | } |