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