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