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