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