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 | |
Andrea Campanella | 2036159 | 2021-08-26 18:45:28 +0200 | [diff] [blame] | 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 | |
Hardik Windlass | 6d9a82e | 2021-07-08 16:23:21 +0000 | [diff] [blame] | 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}" |
Hardik Windlass | 6f854a1 | 2021-07-12 13:20:21 +0000 | [diff] [blame] | 61 | sh returnStdout: true, script: "git clone -b ${branch} ${cordRepoUrl}/${configBaseDir}" |
Hardik Windlass | 6d9a82e | 2021-07-08 16:23:21 +0000 | [diff] [blame] | 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 | script { |
| 96 | // if we're downloading a voltha-helm-charts patch, then install from a local copy of the charts |
| 97 | def localCharts = false |
| 98 | if (volthaHelmChartsChange != "" || branch != "master") { |
| 99 | localCharts = true |
| 100 | } |
| 101 | |
| 102 | // should the config file be suffixed with the workflow? see "deployment_config" |
| 103 | def localHelmFlags = "-f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/voltha/${configFileName}.yml --set global.log_level=${logLevel} " |
| 104 | |
| 105 | if (workFlow.toLowerCase() == "dt") { |
| 106 | localHelmFlags += " --set radius.enabled=false " |
| 107 | } |
| 108 | if (workFlow.toLowerCase() == "tt") { |
| 109 | localHelmFlags += " --set radius.enabled=false --set global.incremental_evto_update=true " |
| 110 | if (enableMultiUni.toBoolean()) { |
| 111 | localHelmFlags += " --set voltha-adapter-openonu.adapter_open_onu.uni_port_mask=${uniPortMask} " |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | // NOTE temporary workaround expose ONOS node ports (pod-config needs to be updated to contain these values) |
| 116 | // and to connect the ofagent to all instances of ONOS |
| 117 | localHelmFlags = localHelmFlags + " --set onos-classic.onosSshPort=30115 " + |
| 118 | "--set onos-classic.onosApiPort=30120 " + |
| 119 | "--set onos-classic.onosOfPort=31653 " + |
| 120 | "--set onos-classic.individualOpenFlowNodePorts=true " + |
| 121 | "--set voltha.onos_classic.replicas=${params.NumOfOnos}" |
| 122 | |
| 123 | if (bbsimReplicas.toInteger() != 0) { |
| 124 | localHelmFlags = localHelmFlags + " --set onu=${onuNumber},pon=${ponNumber} " |
| 125 | } |
| 126 | |
| 127 | // adding user specified helm flags at the end so they'll have priority over everything else |
| 128 | localHelmFlags = localHelmFlags + " ${extraHelmFlags}" |
| 129 | |
Andrea Campanella | ce8aa76 | 2021-08-27 09:32:22 +0200 | [diff] [blame] | 130 | if(openoltAdapterChart != "onf/voltha-adapter-openolt") { |
Andrea Campanella | 2036159 | 2021-08-26 18:45:28 +0200 | [diff] [blame] | 131 | localHelmFlags = localHelmFlags + " --set voltha-adapter-openolt.enabled=false" |
| 132 | } |
| 133 | |
Hardik Windlass | 6d9a82e | 2021-07-08 16:23:21 +0000 | [diff] [blame] | 134 | volthaDeploy([ |
| 135 | workflow: workFlow.toLowerCase(), |
| 136 | extraHelmFlags: localHelmFlags, |
| 137 | localCharts: localCharts, |
| 138 | kubeconfig: "$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf", |
| 139 | onosReplica: params.NumOfOnos, |
| 140 | atomixReplica: params.NumOfAtomix, |
| 141 | kafkaReplica: params.NumOfKafka, |
| 142 | etcdReplica: params.NumOfEtcd, |
| 143 | bbsimReplica: bbsimReplicas.toInteger(), |
| 144 | ]) |
Andrea Campanella | 2036159 | 2021-08-26 18:45:28 +0200 | [diff] [blame] | 145 | |
Andrea Campanella | ce8aa76 | 2021-08-27 09:32:22 +0200 | [diff] [blame] | 146 | if(openoltAdapterChart != "onf/voltha-adapter-openolt"){ |
Andrea Campanella | 2036159 | 2021-08-26 18:45:28 +0200 | [diff] [blame] | 147 | deploy_custom_oltAdapterChart(volthaNamespace, oltAdapterReleaseName, openoltAdapterChart, extraHelmFlags) |
| 148 | } |
Hardik Windlass | 6d9a82e | 2021-07-08 16:23:21 +0000 | [diff] [blame] | 149 | } |
| 150 | sh """ |
| 151 | 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"& |
| 152 | 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"& |
| 153 | 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"& |
| 154 | ps aux | grep port-forward |
| 155 | """ |
| 156 | getPodsInfo("$WORKSPACE") |
| 157 | } |
| 158 | } |
| 159 | } |
| 160 | stage('Push Tech-Profile') { |
| 161 | steps { |
| 162 | script { |
| 163 | if ( params.configurePod && params.profile != "Default" ) { |
| 164 | for(int i=0; i < deployment_config.olts.size(); i++) { |
| 165 | def tech_prof_directory = "XGS-PON" |
Girish Gowdra | a061841 | 2021-07-14 20:10:39 -0700 | [diff] [blame] | 166 | if (deployment_config.olts[i].containsKey("board_technology")){ |
| 167 | tech_prof_directory = deployment_config.olts[i]["board_technology"] |
Hardik Windlass | 6d9a82e | 2021-07-08 16:23:21 +0000 | [diff] [blame] | 168 | } |
| 169 | timeout(1) { |
| 170 | sh returnStatus: true, script: """ |
| 171 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
| 172 | etcd_container=\$(kubectl get pods -n ${infraNamespace} | grep etcd | awk 'NR==1{print \$1}') |
| 173 | if [[ "${workFlow}" == "TT" ]]; then |
| 174 | if [[ "${params.enableMultiUni}" == "true" ]]; then |
| 175 | kubectl cp -n ${infraNamespace} $WORKSPACE/voltha-system-tests/tests/data/TechProfile-TT-multi-uni-HSIA.json \$etcd_container:/tmp/hsia.json |
| 176 | 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' |
| 177 | kubectl cp -n ${infraNamespace} $WORKSPACE/voltha-system-tests/tests/data/TechProfile-TT-multi-uni-VoIP.json \$etcd_container:/tmp/voip.json |
| 178 | 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' |
| 179 | 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 |
| 180 | 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' |
| 181 | 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 |
| 182 | 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' |
| 183 | else |
| 184 | kubectl cp -n ${infraNamespace} $WORKSPACE/voltha-system-tests/tests/data/TechProfile-TT-HSIA.json \$etcd_container:/tmp/hsia.json |
| 185 | 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' |
| 186 | kubectl cp -n ${infraNamespace} $WORKSPACE/voltha-system-tests/tests/data/TechProfile-TT-VoIP.json \$etcd_container:/tmp/voip.json |
| 187 | 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' |
| 188 | kubectl cp -n ${infraNamespace} $WORKSPACE/voltha-system-tests/tests/data/TechProfile-TT-MCAST-AdditionalBW-None.json \$etcd_container:/tmp/mcast_additionalBW_none.json |
| 189 | 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' |
| 190 | kubectl cp -n ${infraNamespace} $WORKSPACE/voltha-system-tests/tests/data/TechProfile-TT-MCAST-AdditionalBW-NA.json \$etcd_container:/tmp/mcast_additionalBW_na.json |
| 191 | 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' |
| 192 | fi |
| 193 | else |
| 194 | kubectl cp -n ${infraNamespace} $WORKSPACE/voltha-system-tests/tests/data/TechProfile-${profile}.json \$etcd_container:/tmp/flexpod.json |
| 195 | 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' |
| 196 | fi |
| 197 | """ |
| 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} | grep etcd | awk 'NR==1{print \$1}') |
| 203 | kubectl exec -n ${infraNamespace} -it \$etcd_container -- /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/voltha/technology_profiles/${tech_prof_directory}/64' |
| 204 | """ |
| 205 | } |
| 206 | } |
| 207 | } |
| 208 | } |
| 209 | } |
| 210 | } |
| 211 | stage('Push MIB templates') { |
| 212 | steps { |
| 213 | sh """ |
| 214 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
| 215 | etcd_container=\$(kubectl get pods -n ${infraNamespace} | grep etcd | awk 'NR==1{print \$1}') |
| 216 | kubectl cp -n ${infraNamespace} $WORKSPACE/voltha-system-tests/tests/data/MIB_Alpha.json \$etcd_container:/tmp/MIB_Alpha.json |
| 217 | 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' |
| 218 | 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' |
| 219 | kubectl cp -n ${infraNamespace} $WORKSPACE/voltha-system-tests/tests/data/MIB_Scom.json \$etcd_container:/tmp/MIB_Scom.json |
| 220 | 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' |
| 221 | 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' |
| 222 | """ |
| 223 | } |
| 224 | } |
| 225 | stage('Push Sadis-config') { |
| 226 | steps { |
| 227 | timeout(1) { |
| 228 | sh returnStatus: true, script: """ |
| 229 | if [[ "${workFlow}" == "DT" ]]; then |
| 230 | 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 |
| 231 | elif [[ "${workFlow}" == "TT" ]]; then |
| 232 | 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 |
| 233 | else |
| 234 | # this is the ATT case, rename the file in *-sadis-ATT.json so that we can avoid special cases and just load the file |
| 235 | 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 |
| 236 | fi |
| 237 | """ |
| 238 | } |
| 239 | } |
| 240 | } |
| 241 | stage('Switch Configurations in ONOS') { |
| 242 | steps { |
| 243 | script { |
| 244 | if ( deployment_config.fabric_switches.size() > 0 ) { |
| 245 | timeout(1) { |
| 246 | def netcfg = "$WORKSPACE/${configBaseDir}/${configToscaDir}/voltha/${configFileName}-onos-netcfg-switch.json" |
| 247 | if (params.inBandManagement){ |
| 248 | netcfg = "$WORKSPACE/${configBaseDir}/${configToscaDir}/voltha/${configFileName}-onos-netcfg-switch-inband.json" |
| 249 | } |
| 250 | sh """ |
| 251 | 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} |
| 252 | curl -sSL --user karaf:karaf -X POST http://${deployment_config.nodes[0].ip}:30120/onos/v1/applications/org.onosproject.segmentrouting/active |
| 253 | """ |
| 254 | } |
| 255 | timeout(1) { |
| 256 | waitUntil { |
| 257 | sr_active_out = sh returnStatus: true, script: """ |
| 258 | 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" |
| 259 | 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" |
| 260 | 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" |
Andrea Campanella | 39b9b3d | 2021-09-09 16:54:20 +0200 | [diff] [blame] | 261 | #TRACE in the pipeliner is too chatty, moving to DEBUG |
| 262 | sshpass -p karaf ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@${deployment_config.nodes[0].ip} "log:set DEBUG org.opencord.olt.driver" |
Hardik Windlass | 6d9a82e | 2021-07-08 16:23:21 +0000 | [diff] [blame] | 263 | 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" |
| 264 | 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" |
| 265 | curl -sSL --user karaf:karaf -X GET http://${deployment_config.nodes[0].ip}:30120/onos/v1/applications/org.onosproject.segmentrouting | jq '.state' | grep ACTIVE |
| 266 | 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" |
| 267 | 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" |
| 268 | 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" |
| 269 | """ |
| 270 | return sr_active_out == 0 |
| 271 | } |
| 272 | } |
| 273 | timeout(7) { |
| 274 | for(int i=0; i < deployment_config.hosts.src.size(); i++) { |
| 275 | for(int j=0; j < deployment_config.olts.size(); j++) { |
| 276 | def aggPort = -1 |
| 277 | if(deployment_config.olts[j].serial == deployment_config.hosts.src[i].olt){ |
| 278 | aggPort = deployment_config.olts[j].aggPort |
| 279 | if(aggPort == -1){ |
| 280 | throw new Exception("Upstream port for the olt is not configured, field aggPort is empty") |
| 281 | } |
| 282 | sh """ |
| 283 | sleep 30 # NOTE why are we sleeping? |
| 284 | 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' |
| 285 | """ |
| 286 | } |
| 287 | } |
| 288 | } |
| 289 | } |
| 290 | } |
| 291 | } |
| 292 | } |
| 293 | } |
| 294 | stage('Reinstall OLT software') { |
| 295 | steps { |
| 296 | script { |
| 297 | if ( params.reinstallOlt ) { |
| 298 | for(int i=0; i < deployment_config.olts.size(); i++) { |
| 299 | // NOTE what is oltDebVersion23? is that for VOLTHA-2.3? do we still need this differentiation? |
| 300 | sh returnStdout: true, script: """ |
Hardik Windlass | 6cdbfa2 | 2021-07-13 06:21:35 +0000 | [diff] [blame] | 301 | ssh-keyscan -H ${deployment_config.olts[i].sship} >> ~/.ssh/known_hosts |
| 302 | if [ "${params.inBandManagement}" == "true" ]; then |
Hardik Windlass | 6d9a82e | 2021-07-08 16:23:21 +0000 | [diff] [blame] | 303 | 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] | 304 | fi |
Hardik Windlass | 6cdbfa2 | 2021-07-13 06:21:35 +0000 | [diff] [blame] | 305 | 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] | 306 | sleep 10 |
| 307 | """ |
| 308 | timeout(5) { |
| 309 | waitUntil { |
| 310 | olt_sw_present = sh returnStdout: true, script: """ |
| 311 | if [ "${deployment_config.olts[i].oltDebVersion}" == *"asfvolt16"* ]; then |
| 312 | 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' |
| 313 | else |
| 314 | 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' |
| 315 | fi |
| 316 | if (${deployment_config.olts[i].fortygig}); then |
| 317 | if [[ "${params.inBandManagement}" == "true" ]]; then |
| 318 | ssh-keyscan -H ${deployment_config.olts[i].sship} >> ~/.ssh/known_hosts |
| 319 | sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].sship} 'mkdir -p /opt/openolt/' |
| 320 | 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/' |
| 321 | 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' |
| 322 | 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/' |
| 323 | fi |
| 324 | fi |
| 325 | """ |
| 326 | return olt_sw_present.toInteger() > 0 |
| 327 | } |
| 328 | } |
| 329 | } |
| 330 | } |
| 331 | } |
| 332 | } |
| 333 | } |
| 334 | stage('Restart OLT processes') { |
| 335 | steps { |
| 336 | script { |
Andrea Campanella | ecefbc8 | 2021-08-27 11:06:31 +0200 | [diff] [blame] | 337 | //rebooting OLTs |
Hardik Windlass | 6d9a82e | 2021-07-08 16:23:21 +0000 | [diff] [blame] | 338 | for(int i=0; i < deployment_config.olts.size(); i++) { |
Andrea Campanella | ecefbc8 | 2021-08-27 11:06:31 +0200 | [diff] [blame] | 339 | if ( params.oltAdapterReleaseName != "open-olt" ) { |
| 340 | timeout(15) { |
| 341 | sh returnStdout: true, script: """ |
| 342 | ssh-keyscan -H ${deployment_config.olts[i].sship} >> ~/.ssh/known_hosts |
| 343 | 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 |
| 344 | """ |
| 345 | } |
| 346 | } else { |
Hardik Windlass | 6d9a82e | 2021-07-08 16:23:21 +0000 | [diff] [blame] | 347 | sh returnStdout: true, script: """ |
| 348 | ssh-keyscan -H ${deployment_config.olts[i].sship} >> ~/.ssh/known_hosts |
Andrea Campanella | ecefbc8 | 2021-08-27 11:06:31 +0200 | [diff] [blame] | 349 | sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].sship} 'reboot > /dev/null &' || true |
Hardik Windlass | 6d9a82e | 2021-07-08 16:23:21 +0000 | [diff] [blame] | 350 | """ |
| 351 | } |
Andrea Campanella | ecefbc8 | 2021-08-27 11:06:31 +0200 | [diff] [blame] | 352 | } |
| 353 | sh returnStdout: true, script: """ |
| 354 | sleep ${params.waitTimerForOltUp} |
| 355 | """ |
| 356 | //Checking dev_management_deamon and openoltprocesses |
| 357 | for(int i=0; i < deployment_config.olts.size(); i++) { |
| 358 | if ( params.oltAdapterReleaseName != "open-olt" ) { |
| 359 | timeout(15) { |
| 360 | waitUntil { |
| 361 | 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'" |
| 362 | return devprocess.toInteger() > 0 |
| 363 | } |
Hardik Windlass | 6d9a82e | 2021-07-08 16:23:21 +0000 | [diff] [blame] | 364 | } |
Andrea Campanella | ecefbc8 | 2021-08-27 11:06:31 +0200 | [diff] [blame] | 365 | timeout(15) { |
| 366 | waitUntil { |
| 367 | 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'" |
| 368 | return openoltprocess.toInteger() > 0 |
| 369 | } |
Hardik Windlass | 6d9a82e | 2021-07-08 16:23:21 +0000 | [diff] [blame] | 370 | } |
| 371 | } |
| 372 | } |
| 373 | } |
| 374 | } |
| 375 | } |
| 376 | } |
| 377 | |
| 378 | post { |
| 379 | aborted { |
| 380 | getPodsInfo("$WORKSPACE/failed") |
| 381 | sh """ |
| 382 | kubectl logs -n voltha -l app.kubernetes.io/part-of=voltha > $WORKSPACE/failed/voltha.log || true |
| 383 | """ |
| 384 | archiveArtifacts artifacts: '**/*.log,**/*.txt' |
| 385 | } |
| 386 | failure { |
| 387 | getPodsInfo("$WORKSPACE/failed") |
| 388 | sh """ |
| 389 | kubectl logs -n voltha -l app.kubernetes.io/part-of=voltha > $WORKSPACE/failed/voltha.logs || true |
| 390 | """ |
| 391 | archiveArtifacts artifacts: '**/*.log,**/*.txt' |
| 392 | } |
| 393 | always { |
| 394 | archiveArtifacts artifacts: '*.txt' |
| 395 | } |
| 396 | } |
| 397 | } |