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