blob: e9f3818e99edd39faf0f34cd37f5afc20f0ea531 [file] [log] [blame]
Joey Armstrong56fdfec2024-03-01 13:43:36 -05001#!/usr/bin/env groovy
2// -----------------------------------------------------------------------
3// Copyright 2017-2024 Open Networking Foundation Contributors
Matteo Scandolod82d1de2021-04-06 14:55:58 -07004//
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 Armstrong56fdfec2024-03-01 13:43:36 -050016// -----------------------------------------------------------------------
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 Scandolod82d1de2021-04-06 14:55:58 -070024
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 Klare415f3b72023-10-25 09:23:15 +020027
Matteo Scandolod82d1de2021-04-06 14:55:58 -070028library identifier: 'cord-jenkins-libraries@master',
29 retriever: modernSCM([
30 $class: 'GitSCMSource',
31 remote: 'https://gerrit.opencord.org/ci-management.git'
32])
33
Joey Armstrong6c0b8552023-06-28 17:41:48 -040034// -----------------------------------------------------------------------
35// -----------------------------------------------------------------------
36def 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 Scandolod82d1de2021-04-06 14:55:58 -070044def infraNamespace = "infra"
45def volthaNamespace = "voltha"
46
Joey Armstrong6c0b8552023-06-28 17:41:48 -040047// -----------------------------------------------------------------------
48// -----------------------------------------------------------------------
Andrea Campanella20361592021-08-26 18:45:28 +020049def deploy_custom_oltAdapterChart(namespace, name, chart, extraHelmFlags) {
Joey Armstrong6c0b8552023-06-28 17:41:48 -040050 String iam = getIam('deploy_custom_oltAdapterChart')
51 println("** ${iam}: ENTER")
52
53 sh """
Andrea Campanella20361592021-08-26 18:45:28 +020054 helm install --create-namespace --set defaults.image_pullPolicy=Always --namespace ${namespace} ${extraHelmFlags} ${name} ${chart}
55 """
Joey Armstrong6c0b8552023-06-28 17:41:48 -040056
57 println("** ${iam}: LEAVE")
58 return
Andrea Campanella20361592021-08-26 18:45:28 +020059}
60
Matteo Scandolod82d1de2021-04-06 14:55:58 -070061pipeline {
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 Scandolod43bb302021-04-20 10:19:29 -070072 KUBECONFIG="$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf"
Matteo Scandolod82d1de2021-04-06 14:55:58 -070073 }
74
75 stages{
76 stage('Download Code') {
Matteo Scandolod43bb302021-04-20 10:19:29 -070077 steps {
78 getVolthaCode([
79 branch: "${branch}",
Hardik Windlass791917b2021-05-28 04:55:37 +000080 volthaSystemTestsChange: "${volthaSystemTestsChange}",
Matteo Scandolod43bb302021-04-20 10:19:29 -070081 volthaHelmChartsChange: "${volthaHelmChartsChange}",
82 ])
83 }
Matteo Scandolod82d1de2021-04-06 14:55:58 -070084 }
85 stage ("Parse deployment configuration file") {
Matteo Scandolod43bb302021-04-20 10:19:29 -070086 steps {
87 sh returnStdout: true, script: "rm -rf ${configBaseDir}"
Hardik Windlass6f854a12021-07-12 13:20:21 +000088 sh returnStdout: true, script: "git clone -b ${branch} ${cordRepoUrl}/${configBaseDir}"
Matteo Scandolod43bb302021-04-20 10:19:29 -070089 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 Scandolod82d1de2021-04-06 14:55:58 -0700102 }
103 }
104 stage('Clean up') {
Matteo Scandolod43bb302021-04-20 10:19:29 -0700105 steps {
106 timeout(15) {
107 script {
108 helmTeardown(["default", infraNamespace, volthaNamespace])
109 }
110 timeout(1) {
111 sh returnStdout: false, script: '''
Matteo Scandolo16bb6fe2021-04-26 13:15:39 -0700112 # remove orphaned port-forward from different namespaces
Andrea Campanella4c8af942021-05-12 10:12:13 +0200113 ps aux | grep port-forw | grep -v grep | awk '{print $2}' | xargs --no-run-if-empty kill -9 || true
Matteo Scandolod43bb302021-04-20 10:19:29 -0700114 '''
115 }
Matteo Scandolod82d1de2021-04-06 14:55:58 -0700116 }
117 }
118 }
119 stage('Install Voltha') {
Matteo Scandolod43bb302021-04-20 10:19:29 -0700120 steps {
121 timeout(20) {
Hardik Windlass9658cd22021-10-25 11:13:25 +0000122 installVoltctl("${branch}")
Matteo Scandolod43bb302021-04-20 10:19:29 -0700123 script {
124 // if we're downloading a voltha-helm-charts patch, then install from a local copy of the charts
125 def localCharts = false
126 if (volthaHelmChartsChange != "") {
127 localCharts = true
128 }
Matteo Scandolod82d1de2021-04-06 14:55:58 -0700129
Matteo Scandolo16bb6fe2021-04-26 13:15:39 -0700130 // should the config file be suffixed with the workflow? see "deployment_config"
Matteo Scandolod47bfb22021-05-24 09:40:05 -0700131 def localHelmFlags = "-f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/voltha/${configFileName}.yml --set global.log_level=${logLevel} "
Matteo Scandolod82d1de2021-04-06 14:55:58 -0700132
Matteo Scandolo16bb6fe2021-04-26 13:15:39 -0700133 if (workFlow.toLowerCase() == "dt") {
Matteo Scandolod47bfb22021-05-24 09:40:05 -0700134 localHelmFlags += " --set radius.enabled=false "
Matteo Scandolo16bb6fe2021-04-26 13:15:39 -0700135 }
136 if (workFlow.toLowerCase() == "tt") {
Matteo Scandolod47bfb22021-05-24 09:40:05 -0700137 localHelmFlags += " --set radius.enabled=false --set global.incremental_evto_update=true "
Hardik Windlassb6e6a3a2021-07-02 17:22:01 +0000138 if (enableMultiUni.toBoolean()) {
Hardik Windlass6598b032021-07-02 10:12:01 +0000139 localHelmFlags += " --set voltha-adapter-openonu.adapter_open_onu.uni_port_mask=${uniPortMask} "
140 }
Matteo Scandolo16bb6fe2021-04-26 13:15:39 -0700141 }
142
Matteo Scandolod43bb302021-04-20 10:19:29 -0700143 // NOTE temporary workaround expose ONOS node ports (pod-config needs to be updated to contain these values)
Andrea Campanella07ec1e22021-06-04 16:18:41 +0200144 // and to connect the ofagent to all instances of ONOS
Matteo Scandolod47bfb22021-05-24 09:40:05 -0700145 localHelmFlags = localHelmFlags + " --set onos-classic.onosSshPort=30115 " +
Matteo Scandolod82d1de2021-04-06 14:55:58 -0700146 "--set onos-classic.onosApiPort=30120 " +
147 "--set onos-classic.onosOfPort=31653 " +
Andrea Campanella07ec1e22021-06-04 16:18:41 +0200148 "--set onos-classic.individualOpenFlowNodePorts=true " +
149 "--set voltha.onos_classic.replicas=${params.NumOfOnos}"
Matteo Scandolod82d1de2021-04-06 14:55:58 -0700150
Hardik Windlass908533a2021-05-24 16:35:58 +0000151 if (bbsimReplicas.toInteger() != 0) {
Matteo Scandolod47bfb22021-05-24 09:40:05 -0700152 localHelmFlags = localHelmFlags + " --set onu=${onuNumber},pon=${ponNumber} "
Hardik Windlassc7379022021-05-12 13:52:24 +0530153 }
154
Matteo Scandolod47bfb22021-05-24 09:40:05 -0700155 // adding user specified helm flags at the end so they'll have priority over everything else
Andrea Campanellad4ab9502021-05-25 10:53:58 +0200156 localHelmFlags = localHelmFlags + " ${extraHelmFlags}"
Matteo Scandolod47bfb22021-05-24 09:40:05 -0700157
Andrea Campanella365ea1e2021-09-28 10:50:01 +0200158 def numberOfAdaptersToWait = 2
159
Andrea Campanellace8aa762021-08-27 09:32:22 +0200160 if(openoltAdapterChart != "onf/voltha-adapter-openolt") {
Andrea Campanella20361592021-08-26 18:45:28 +0200161 localHelmFlags = localHelmFlags + " --set voltha-adapter-openolt.enabled=false"
Andrea Campanella365ea1e2021-09-28 10:50:01 +0200162 // We skip waiting for adapters in the volthaDeploy step because it's already waiting for
163 // both of them after the deployment of the custom olt adapter. See line 156.
164 numberOfAdaptersToWait = 0
Andrea Campanella20361592021-08-26 18:45:28 +0200165 }
166
Matteo Scandolod43bb302021-04-20 10:19:29 -0700167 volthaDeploy([
168 workflow: workFlow.toLowerCase(),
Matteo Scandolod47bfb22021-05-24 09:40:05 -0700169 extraHelmFlags: localHelmFlags,
Matteo Scandolod43bb302021-04-20 10:19:29 -0700170 localCharts: localCharts,
171 kubeconfig: "$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf",
172 onosReplica: params.NumOfOnos,
173 atomixReplica: params.NumOfAtomix,
Hardik Windlassc7379022021-05-12 13:52:24 +0530174 kafkaReplica: params.NumOfKafka,
Hardik Windlass1685e5b2021-05-13 14:07:44 +0530175 etcdReplica: params.NumOfEtcd,
Hardik Windlass908533a2021-05-24 16:35:58 +0000176 bbsimReplica: bbsimReplicas.toInteger(),
Hardik Windlassc97ceae2022-05-13 10:12:55 +0530177 withFttb: withFttb.toBoolean(),
Andrea Campanella365ea1e2021-09-28 10:50:01 +0200178 adaptersToWait: numberOfAdaptersToWait,
Matteo Scandolod43bb302021-04-20 10:19:29 -0700179 ])
Andrea Campanella20361592021-08-26 18:45:28 +0200180
Andrea Campanella365ea1e2021-09-28 10:50:01 +0200181 if(openoltAdapterChart != "onf/voltha-adapter-openolt"){
182 extraHelmFlags = extraHelmFlags + " --set global.log_level=${logLevel}"
183 deploy_custom_oltAdapterChart(volthaNamespace, oltAdapterReleaseName, openoltAdapterChart, extraHelmFlags)
184 waitForAdapters([
185 adaptersToWait: 2
186 ])
187 }
Matteo Scandolod82d1de2021-04-06 14:55:58 -0700188 }
189 sh """
Matteo Scandolo79f133f2021-04-27 13:53:21 -0700190 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 Scandolod43bb302021-04-20 10:19:29 -0700191 ps aux | grep port-forward
Matteo Scandolod82d1de2021-04-06 14:55:58 -0700192 """
Matteo Scandolod43bb302021-04-20 10:19:29 -0700193 getPodsInfo("$WORKSPACE")
Matteo Scandolod82d1de2021-04-06 14:55:58 -0700194 }
Matteo Scandolod43bb302021-04-20 10:19:29 -0700195 }
196 }
197 stage('Push Tech-Profile') {
198 steps {
199 script {
200 if ( params.configurePod && params.profile != "Default" ) {
201 for(int i=0; i < deployment_config.olts.size(); i++) {
202 def tech_prof_directory = "XGS-PON"
Girish Gowdrab8e98862021-07-07 14:09:13 -0700203 if (deployment_config.olts[i].containsKey("board_technology")){
Girish Gowdra28af4562021-07-07 11:52:13 -0700204 tech_prof_directory = deployment_config.olts[i]["board_technology"]
Matteo Scandolod43bb302021-04-20 10:19:29 -0700205 }
206 timeout(1) {
207 sh returnStatus: true, script: """
208 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
Andrea Campanella04b393a2021-07-22 10:48:33 +0200209 etcd_container=\$(kubectl get pods -n ${infraNamespace} -l app.kubernetes.io/name=etcd --no-headers | awk 'NR==1{print \$1}')
Matteo Scandolod43bb302021-04-20 10:19:29 -0700210 if [[ "${workFlow}" == "TT" ]]; then
TorstenThieme1befe442022-01-25 10:35:10 +0000211 kubectl cp -n ${infraNamespace} $WORKSPACE/voltha-system-tests/tests/data/TechProfile-TT-HSIA.json \$etcd_container:/tmp/hsia.json
212 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'
213 kubectl cp -n ${infraNamespace} $WORKSPACE/voltha-system-tests/tests/data/TechProfile-TT-VoIP.json \$etcd_container:/tmp/voip.json
214 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 Windlassb6e6a3a2021-07-02 17:22:01 +0000215 if [[ "${params.enableMultiUni}" == "true" ]]; then
Hardik Windlass6598b032021-07-02 10:12:01 +0000216 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
217 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'
218 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
219 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'
220 else
Hardik Windlass6598b032021-07-02 10:12:01 +0000221 kubectl cp -n ${infraNamespace} $WORKSPACE/voltha-system-tests/tests/data/TechProfile-TT-MCAST-AdditionalBW-None.json \$etcd_container:/tmp/mcast_additionalBW_none.json
222 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'
223 kubectl cp -n ${infraNamespace} $WORKSPACE/voltha-system-tests/tests/data/TechProfile-TT-MCAST-AdditionalBW-NA.json \$etcd_container:/tmp/mcast_additionalBW_na.json
224 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'
225 fi
Matteo Scandolod43bb302021-04-20 10:19:29 -0700226 else
227 kubectl cp -n ${infraNamespace} $WORKSPACE/voltha-system-tests/tests/data/TechProfile-${profile}.json \$etcd_container:/tmp/flexpod.json
228 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'
229 fi
230 """
231 }
232 timeout(1) {
233 sh returnStatus: true, script: """
234 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
Andrea Campanella04b393a2021-07-22 10:48:33 +0200235 etcd_container=\$(kubectl get pods -n ${infraNamespace} -l app.kubernetes.io/name=etcd --no-headers | awk 'NR==1{print \$1}')
Matteo Scandolod43bb302021-04-20 10:19:29 -0700236 kubectl exec -n ${infraNamespace} -it \$etcd_container -- /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/voltha/technology_profiles/${tech_prof_directory}/64'
237 """
Matteo Scandolod82d1de2021-04-06 14:55:58 -0700238 }
239 }
240 }
241 }
242 }
243 }
Matteo Scandolod43bb302021-04-20 10:19:29 -0700244 stage('Push MIB templates') {
245 steps {
246 sh """
247 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
Andrea Campanella04b393a2021-07-22 10:48:33 +0200248 etcd_container=\$(kubectl get pods -n ${infraNamespace} -l app.kubernetes.io/name=etcd --no-headers | awk 'NR==1{print \$1}')
Matteo Scandolod43bb302021-04-20 10:19:29 -0700249 kubectl cp -n ${infraNamespace} $WORKSPACE/voltha-system-tests/tests/data/MIB_Alpha.json \$etcd_container:/tmp/MIB_Alpha.json
250 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'
251 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'
252 kubectl cp -n ${infraNamespace} $WORKSPACE/voltha-system-tests/tests/data/MIB_Scom.json \$etcd_container:/tmp/MIB_Scom.json
253 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'
254 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'
255 """
256 }
257 }
258 stage('Push Sadis-config') {
259 steps {
260 timeout(1) {
261 sh returnStatus: true, script: """
262 if [[ "${workFlow}" == "DT" ]]; then
263 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
264 elif [[ "${workFlow}" == "TT" ]]; then
265 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
266 else
267 # this is the ATT case, rename the file in *-sadis-ATT.json so that we can avoid special cases and just load the file
268 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 Scandolod82d1de2021-04-06 14:55:58 -0700269 fi
Matteo Scandolod82d1de2021-04-06 14:55:58 -0700270 """
Matteo Scandolod43bb302021-04-20 10:19:29 -0700271 }
272 }
273 }
274 stage('Switch Configurations in ONOS') {
275 steps {
276 script {
277 if ( deployment_config.fabric_switches.size() > 0 ) {
278 timeout(1) {
279 def netcfg = "$WORKSPACE/${configBaseDir}/${configToscaDir}/voltha/${configFileName}-onos-netcfg-switch.json"
280 if (params.inBandManagement){
281 netcfg = "$WORKSPACE/${configBaseDir}/${configToscaDir}/voltha/${configFileName}-onos-netcfg-switch-inband.json"
282 }
283 sh """
284 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}
285 curl -sSL --user karaf:karaf -X POST http://${deployment_config.nodes[0].ip}:30120/onos/v1/applications/org.onosproject.segmentrouting/active
Matteo Scandolod82d1de2021-04-06 14:55:58 -0700286 """
Matteo Scandolod43bb302021-04-20 10:19:29 -0700287 }
Hardik Windlassc97ceae2022-05-13 10:12:55 +0530288 timeout(3) {
Matteo Scandolo857376b2021-11-05 14:53:22 -0700289 setOnosLogLevels([
290 onosNamespace: infraNamespace,
291 apps: [
292 'org.opencord.dhcpl2relay',
293 'org.opencord.olt',
294 'org.opencord.aaa',
Andrea Campanellac0762392022-03-11 15:01:13 +0100295 'org.opencord.maclearner',
Matteo Scandolo857376b2021-11-05 14:53:22 -0700296 'org.onosproject.net.flowobjective.impl.FlowObjectiveManager',
297 'org.onosproject.net.flowobjective.impl.InOrderFlowObjectiveManager'
298 ]
299 ])
Matteo Scandolod43bb302021-04-20 10:19:29 -0700300 waitUntil {
301 sr_active_out = sh returnStatus: true, script: """
Matteo Scandolod43bb302021-04-20 10:19:29 -0700302 curl -sSL --user karaf:karaf -X GET http://${deployment_config.nodes[0].ip}:30120/onos/v1/applications/org.onosproject.segmentrouting | jq '.state' | grep ACTIVE
303 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"
304 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"
305 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"
306 """
307 return sr_active_out == 0
308 }
309 }
Hardik Windlassc97ceae2022-05-13 10:12:55 +0530310 timeout(8) {
Matteo Scandolod43bb302021-04-20 10:19:29 -0700311 for(int i=0; i < deployment_config.hosts.src.size(); i++) {
312 for(int j=0; j < deployment_config.olts.size(); j++) {
313 def aggPort = -1
314 if(deployment_config.olts[j].serial == deployment_config.hosts.src[i].olt){
315 aggPort = deployment_config.olts[j].aggPort
316 if(aggPort == -1){
317 throw new Exception("Upstream port for the olt is not configured, field aggPort is empty")
318 }
319 sh """
Hardik Windlass728a86c2021-10-01 17:58:12 +0530320 sleep 10 # NOTE why are we sleeping?
Matteo Scandolod43bb302021-04-20 10:19:29 -0700321 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'
322 """
323 }
324 }
325 }
Matteo Scandolod82d1de2021-04-06 14:55:58 -0700326 }
327 }
328 }
329 }
Matteo Scandolod43bb302021-04-20 10:19:29 -0700330 }
331 stage('Reinstall OLT software') {
332 steps {
333 script {
334 if ( params.reinstallOlt ) {
335 for(int i=0; i < deployment_config.olts.size(); i++) {
336 // NOTE what is oltDebVersion23? is that for VOLTHA-2.3? do we still need this differentiation?
337 sh returnStdout: true, script: """
Hardik Windlass6cdbfa22021-07-13 06:21:35 +0000338 ssh-keyscan -H ${deployment_config.olts[i].sship} >> ~/.ssh/known_hosts
339 if [ "${params.inBandManagement}" == "true" ]; then
Matteo Scandolod43bb302021-04-20 10:19:29 -0700340 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 Scandolod43bb302021-04-20 10:19:29 -0700341 fi
Hardik Windlass6cdbfa22021-07-13 06:21:35 +0000342 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 Scandolod43bb302021-04-20 10:19:29 -0700343 sleep 10
344 """
345 timeout(5) {
346 waitUntil {
347 olt_sw_present = sh returnStdout: true, script: """
Andrea Campanella272bd202021-12-17 09:46:26 +0100348 if [[ "${deployment_config.olts[i].oltDebVersion}" == *"asfvolt16"* ]]; then
Matteo Scandolod43bb302021-04-20 10:19:29 -0700349 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 Campanella272bd202021-12-17 09:46:26 +0100350 elif [[ "${deployment_config.olts[i].oltDebVersion}" == *"asgvolt64"* ]]; then
Matteo Scandolod43bb302021-04-20 10:19:29 -0700351 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 Campanella272bd202021-12-17 09:46:26 +0100352 elif [[ "${deployment_config.olts[i].oltDebVersion}" == *"rlt-1600x-w"* ]]; then
353 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'
354 elif [[ "${deployment_config.olts[i].oltDebVersion}" == *"rlt-1600g-w"* ]]; then
355 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'
356 elif [[ "${deployment_config.olts[i].oltDebVersion}" == *"rlt-3200g-w"* ]]; then
357 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 Gowdraabc5dcf2022-05-18 12:40:07 -0700358 elif [[ "${deployment_config.olts[i].oltDebVersion}" == *"sda3016ss"* ]]; then
359 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 Campanella272bd202021-12-17 09:46:26 +0100360 else
361 echo Unknown Debian package for openolt
Matteo Scandolod43bb302021-04-20 10:19:29 -0700362 fi
363 if (${deployment_config.olts[i].fortygig}); then
364 if [[ "${params.inBandManagement}" == "true" ]]; then
365 ssh-keyscan -H ${deployment_config.olts[i].sship} >> ~/.ssh/known_hosts
366 sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].sship} 'mkdir -p /opt/openolt/'
367 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/'
368 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'
369 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/'
370 fi
371 fi
372 """
373 return olt_sw_present.toInteger() > 0
374 }
375 }
Matteo Scandolod82d1de2021-04-06 14:55:58 -0700376 }
377 }
Matteo Scandolod43bb302021-04-20 10:19:29 -0700378 }
379 }
380 }
381 stage('Restart OLT processes') {
382 steps {
383 script {
Andrea Campanellaecefbc82021-08-27 11:06:31 +0200384 //rebooting OLTs
Matteo Scandolod43bb302021-04-20 10:19:29 -0700385 for(int i=0; i < deployment_config.olts.size(); i++) {
Girish Gowdrac5a3ef82021-10-06 12:58:49 -0700386 timeout(15) {
Matteo Scandolod43bb302021-04-20 10:19:29 -0700387 sh returnStdout: true, script: """
388 ssh-keyscan -H ${deployment_config.olts[i].sship} >> ~/.ssh/known_hosts
Girish Gowdrac5a3ef82021-10-06 12:58:49 -0700389 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 Scandolod43bb302021-04-20 10:19:29 -0700390 """
391 }
Andrea Campanellaecefbc82021-08-27 11:06:31 +0200392 }
393 sh returnStdout: true, script: """
394 sleep ${params.waitTimerForOltUp}
395 """
396 //Checking dev_management_deamon and openoltprocesses
397 for(int i=0; i < deployment_config.olts.size(); i++) {
398 if ( params.oltAdapterReleaseName != "open-olt" ) {
399 timeout(15) {
400 waitUntil {
401 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'"
402 return devprocess.toInteger() > 0
403 }
Matteo Scandolod43bb302021-04-20 10:19:29 -0700404 }
Andrea Campanellaecefbc82021-08-27 11:06:31 +0200405 timeout(15) {
406 waitUntil {
407 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'"
408 return openoltprocess.toInteger() > 0
409 }
Matteo Scandolod43bb302021-04-20 10:19:29 -0700410 }
Matteo Scandolod82d1de2021-04-06 14:55:58 -0700411 }
412 }
413 }
414 }
415 }
416 }
417
418 post {
Matteo Scandolo0da60532021-05-06 08:59:42 -0700419 aborted {
420 getPodsInfo("$WORKSPACE/failed")
421 sh """
422 kubectl logs -n voltha -l app.kubernetes.io/part-of=voltha > $WORKSPACE/failed/voltha.log || true
423 """
424 archiveArtifacts artifacts: '**/*.log,**/*.txt'
425 }
426 failure {
427 getPodsInfo("$WORKSPACE/failed")
428 sh """
429 kubectl logs -n voltha -l app.kubernetes.io/part-of=voltha > $WORKSPACE/failed/voltha.logs || true
430 """
431 archiveArtifacts artifacts: '**/*.log,**/*.txt'
432 }
Matteo Scandolod82d1de2021-04-06 14:55:58 -0700433 always {
434 archiveArtifacts artifacts: '*.txt'
435 }
436 }
437}
Joey Armstrong56fdfec2024-03-01 13:43:36 -0500438
439// [EOF]