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