Suchitra Vemuri | ddb2779 | 2018-08-23 15:29:42 -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 | |
Suchitra Vemuri | ddb2779 | 2018-08-23 15:29:42 -0700 | [diff] [blame] | 15 | node ("${TestNodeName}") { |
Luca Prete | b3029bd | 2018-08-28 16:31:39 -0700 | [diff] [blame] | 16 | timeout (100) { |
| 17 | try { |
| 18 | stage ("Parse deployment configuration file") { |
Luca Prete | 4863405 | 2018-12-21 15:31:51 -0800 | [diff] [blame] | 19 | sh returnStdout: true, script: "rm -rf helm-repo-tools ${configBaseDir}" |
| 20 | sh returnStdout: true, script: "git clone -b ${branch} ${cordRepoUrl}/helm-repo-tools" |
You Wang | d6c5e8c | 2018-08-29 12:49:51 -0700 | [diff] [blame] | 21 | sh returnStdout: true, script: "git clone -b ${branch} ${cordRepoUrl}/${configBaseDir}" |
You Wang | 59ded6c | 2018-10-05 17:43:44 -0700 | [diff] [blame] | 22 | deployment_config = readYaml file: "${configBaseDir}/${configDeploymentDir}/${configFileName}.yaml" |
Suchitra Vemuri | ddb2779 | 2018-08-23 15:29:42 -0700 | [diff] [blame] | 23 | } |
Luca Prete | b3029bd | 2018-08-28 16:31:39 -0700 | [diff] [blame] | 24 | stage('Clean up') { |
| 25 | timeout(10) { |
| 26 | sh returnStdout: true, script: """ |
Luca Prete | b3029bd | 2018-08-28 16:31:39 -0700 | [diff] [blame] | 27 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
Luca Prete | 5a97015 | 2018-08-29 15:20:47 -0700 | [diff] [blame] | 28 | for hchart in \$(helm list -q | grep -E -v 'docker-registry|mavenrepo|ponnet'); |
Luca Prete | b3029bd | 2018-08-28 16:31:39 -0700 | [diff] [blame] | 29 | do |
| 30 | echo "Purging chart: \${hchart}" |
| 31 | helm delete --purge "\${hchart}" |
| 32 | done |
Suchitra Vemuri | ddb2779 | 2018-08-23 15:29:42 -0700 | [diff] [blame] | 33 | """ |
Luca Prete | b3029bd | 2018-08-28 16:31:39 -0700 | [diff] [blame] | 34 | timeout(5) { |
| 35 | waitUntil { |
| 36 | helm_deleted = sh returnStdout: true, script: """ |
| 37 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf && |
Luca Prete | b496667 | 2018-08-29 16:49:48 -0700 | [diff] [blame] | 38 | helm ls -q | grep -E -v 'docker-registry|mavenrepo|ponnet' | wc -l |
Suchitra Vemuri | ddb2779 | 2018-08-23 15:29:42 -0700 | [diff] [blame] | 39 | """ |
Luca Prete | b3029bd | 2018-08-28 16:31:39 -0700 | [diff] [blame] | 40 | return helm_deleted.toInteger() == 0 |
| 41 | } |
| 42 | } |
| 43 | timeout(5) { |
| 44 | waitUntil { |
| 45 | kubectl_deleted = sh returnStdout: true, script: """ |
| 46 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf && |
Luca Prete | b496667 | 2018-08-29 16:49:48 -0700 | [diff] [blame] | 47 | kubectl get pods --all-namespaces --no-headers | grep -E -v 'kube-system|docker-registry|mavenrepo|ponnet' | wc -l |
Luca Prete | b3029bd | 2018-08-28 16:31:39 -0700 | [diff] [blame] | 48 | """ |
| 49 | return kubectl_deleted.toInteger() == 0 |
Suchitra Vemuri | ddb2779 | 2018-08-23 15:29:42 -0700 | [diff] [blame] | 50 | } |
| 51 | } |
| 52 | } |
| 53 | } |
Luca Prete | 62a48c8 | 2019-01-16 10:40:01 -0800 | [diff] [blame] | 54 | stage('Add Helm repositories') { |
Kailash | 4321b4d | 2018-12-18 13:11:08 -0800 | [diff] [blame] | 55 | sh returnStdout: true, script: """ |
| 56 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
Kailash | e841eca | 2019-03-13 13:18:14 -0700 | [diff] [blame] | 57 | helm repo add cord ${helmRepoUrl} |
Luca Prete | 62a48c8 | 2019-01-16 10:40:01 -0800 | [diff] [blame] | 58 | helm repo add incubator http://storage.googleapis.com/kubernetes-charts-incubator |
Kailash | 4321b4d | 2018-12-18 13:11:08 -0800 | [diff] [blame] | 59 | helm repo update |
| 60 | """ |
| 61 | timeout(1) { |
| 62 | waitUntil { |
| 63 | cord_repo_present = sh returnStdout: true, script: """ |
| 64 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf && |
| 65 | helm repo list | grep cord | wc -l |
Kailash Khalasi | 100cf46 | 2018-09-20 10:24:57 -0700 | [diff] [blame] | 66 | """ |
Kailash | 4321b4d | 2018-12-18 13:11:08 -0800 | [diff] [blame] | 67 | return cord_repo_present.toInteger() == 1 |
Matteo Scandolo | 2f8271f | 2018-12-12 15:54:54 -0800 | [diff] [blame] | 68 | } |
| 69 | } |
Suchitra Vemuri | ddb2779 | 2018-08-23 15:29:42 -0700 | [diff] [blame] | 70 | } |
Luca Prete | 31eda02 | 2018-12-21 13:49:44 -0800 | [diff] [blame] | 71 | stage('Install CORD Kafka') { |
| 72 | timeout(10) { |
| 73 | sh returnStdout: true, script: """ |
| 74 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
Zack Williams | 2a45834 | 2019-01-14 14:53:24 -0700 | [diff] [blame] | 75 | helm install --version 0.13.3 --set configurationOverrides."offsets\\.topic\\.replication\\.factor"=1 --set configurationOverrides."log\\.retention\\.hours"=4 --set configurationOverrides."log\\.message\\.timestamp\\.type"="LogAppendTime" --set replicas=1 --set persistence.enabled=false --set zookeeper.replicaCount=1 --set zookeeper.persistence.enabled=false -n cord-kafka incubator/kafka |
Luca Prete | 31eda02 | 2018-12-21 13:49:44 -0800 | [diff] [blame] | 76 | """ |
| 77 | } |
| 78 | timeout(10) { |
| 79 | waitUntil { |
| 80 | kafka_instances_running = sh returnStdout: true, script: """ |
| 81 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf && |
| 82 | kubectl get pods | grep cord-kafka | grep -i running | grep 1/1 | wc -l |
Kailash | 4321b4d | 2018-12-18 13:11:08 -0800 | [diff] [blame] | 83 | """ |
Luca Prete | 31eda02 | 2018-12-21 13:49:44 -0800 | [diff] [blame] | 84 | return kafka_instances_running.toInteger() == 2 |
Kailash | 4321b4d | 2018-12-18 13:11:08 -0800 | [diff] [blame] | 85 | } |
| 86 | } |
Luca Prete | 31eda02 | 2018-12-21 13:49:44 -0800 | [diff] [blame] | 87 | } |
Matteo Scandolo | 863e3b1 | 2019-04-16 14:55:10 -0700 | [diff] [blame] | 88 | if ( params.installMonitoringAndLogging ) { |
| 89 | stage('Install Logging Infrastructure') { |
| 90 | timeout(10) { |
| 91 | sh returnStdout: true, script: """ |
| 92 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
| 93 | helm install -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml --set elasticsearch.cluster.env.MINIMUM_MASTER_NODES="1" --set elasticsearch.client.replicas=1 --set elasticsearch.master.replicas=2 --set elasticsearch.master.persistence.enabled=false --set elasticsearch.data.replicas=1 --set elasticsearch.data.persistence.enabled=false -n logging cord/logging |
| 94 | helm-repo-tools/wait_for_pods.sh |
| 95 | """ |
| 96 | } |
| 97 | } |
| 98 | stage('Install Monitoring Infrastructure') { |
| 99 | timeout(10) { |
| 100 | sh returnStdout: true, script: """ |
| 101 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
| 102 | helm install -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml -n nem-monitoring cord/nem-monitoring |
| 103 | helm-repo-tools/wait_for_pods.sh |
| 104 | """ |
| 105 | } |
| 106 | } |
Luca Prete | 31eda02 | 2018-12-21 13:49:44 -0800 | [diff] [blame] | 107 | } |
| 108 | stage('Install etcd-cluster') { |
| 109 | timeout(10) { |
| 110 | sh returnStdout: true, script: """ |
| 111 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
Zack Williams | 2a45834 | 2019-01-14 14:53:24 -0700 | [diff] [blame] | 112 | helm install -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml --version 0.8.3 -n etcd-operator stable/etcd-operator |
Luca Prete | 31eda02 | 2018-12-21 13:49:44 -0800 | [diff] [blame] | 113 | """ |
| 114 | } |
| 115 | timeout(10) { |
| 116 | waitUntil { |
| 117 | etcd_running = sh returnStdout: true, script: """ |
| 118 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf && |
| 119 | kubectl get pods | grep etcd | grep -i running | grep 1/1 | wc -l |
Kailash | 4321b4d | 2018-12-18 13:11:08 -0800 | [diff] [blame] | 120 | """ |
Luca Prete | 31eda02 | 2018-12-21 13:49:44 -0800 | [diff] [blame] | 121 | return etcd_running.toInteger() == 3 |
Kailash | 4321b4d | 2018-12-18 13:11:08 -0800 | [diff] [blame] | 122 | } |
| 123 | } |
Luca Prete | 31eda02 | 2018-12-21 13:49:44 -0800 | [diff] [blame] | 124 | } |
| 125 | stage('Install voltha') { |
| 126 | timeout(10) { |
| 127 | sh returnStdout: true, script: """ |
| 128 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
Kailash | 3349934 | 2019-07-01 21:39:01 -0700 | [diff] [blame^] | 129 | helm install -n voltha -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml cord/voltha --version 1.0.6 |
Luca Prete | 31eda02 | 2018-12-21 13:49:44 -0800 | [diff] [blame] | 130 | """ |
| 131 | } |
| 132 | timeout(10) { |
| 133 | waitUntil { |
| 134 | voltha_completed = sh returnStdout: true, script: """ |
| 135 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf && |
| 136 | kubectl get pods -n voltha | grep -i running | grep 1/1 | wc -l |
Kailash | 4321b4d | 2018-12-18 13:11:08 -0800 | [diff] [blame] | 137 | """ |
Luca Prete | 31eda02 | 2018-12-21 13:49:44 -0800 | [diff] [blame] | 138 | return voltha_completed.toInteger() == 8 |
Kailash | 4321b4d | 2018-12-18 13:11:08 -0800 | [diff] [blame] | 139 | } |
| 140 | } |
Luca Prete | 31eda02 | 2018-12-21 13:49:44 -0800 | [diff] [blame] | 141 | } |
| 142 | stage('Install ONOS') { |
| 143 | timeout(10) { |
| 144 | sh returnStdout: true, script: """ |
| 145 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
Suchitra Vemuri | 923f243 | 2019-07-01 18:22:31 -0700 | [diff] [blame] | 146 | cd helm-charts |
Kailash | 3349934 | 2019-07-01 21:39:01 -0700 | [diff] [blame^] | 147 | helm install -n onos -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml cord/onos |
Luca Prete | 31eda02 | 2018-12-21 13:49:44 -0800 | [diff] [blame] | 148 | """ |
| 149 | } |
| 150 | timeout(10) { |
| 151 | waitUntil { |
| 152 | onos_completed = sh returnStdout: true, script: """ |
| 153 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf && |
| 154 | kubectl get pods | grep -i onos | grep -i running | grep 2/2 | wc -l |
Kailash | 4321b4d | 2018-12-18 13:11:08 -0800 | [diff] [blame] | 155 | """ |
Luca Prete | 31eda02 | 2018-12-21 13:49:44 -0800 | [diff] [blame] | 156 | return onos_completed.toInteger() == 1 |
Kailash | 4321b4d | 2018-12-18 13:11:08 -0800 | [diff] [blame] | 157 | } |
| 158 | } |
Luca Prete | 31eda02 | 2018-12-21 13:49:44 -0800 | [diff] [blame] | 159 | } |
| 160 | stage('Install xos-core') { |
| 161 | timeout(10) { |
| 162 | sh returnStdout: true, script: """ |
| 163 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
Kailash | 3349934 | 2019-07-01 21:39:01 -0700 | [diff] [blame^] | 164 | helm install -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml -n xos-core cord/xos-core |
| 165 | |
Luca Prete | 31eda02 | 2018-12-21 13:49:44 -0800 | [diff] [blame] | 166 | """ |
| 167 | } |
| 168 | timeout(10) { |
| 169 | waitUntil { |
| 170 | xos_core_completed = sh returnStdout: true, script: """ |
| 171 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf && |
| 172 | kubectl get pods | grep -i xos | grep -i running | grep 1/1 | wc -l |
Kailash | 4321b4d | 2018-12-18 13:11:08 -0800 | [diff] [blame] | 173 | """ |
Luca Prete | 31eda02 | 2018-12-21 13:49:44 -0800 | [diff] [blame] | 174 | return xos_core_completed.toInteger() == 6 |
Kailash | 4321b4d | 2018-12-18 13:11:08 -0800 | [diff] [blame] | 175 | } |
| 176 | } |
Luca Prete | 31eda02 | 2018-12-21 13:49:44 -0800 | [diff] [blame] | 177 | } |
| 178 | stage('Install seba-services') { |
| 179 | timeout(10) { |
| 180 | sh returnStdout: true, script: """ |
| 181 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
Kailash | 3349934 | 2019-07-01 21:39:01 -0700 | [diff] [blame^] | 182 | helm install -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml -n seba-services cord/seba-services |
Luca Prete | 31eda02 | 2018-12-21 13:49:44 -0800 | [diff] [blame] | 183 | """ |
| 184 | } |
| 185 | timeout(10) { |
| 186 | waitUntil { |
| 187 | att_workflow_tosca_completed = sh returnStdout: true, script: """ |
| 188 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf && |
| 189 | kubectl get pods | grep -i seba-services-tosca-loader | grep -i completed | wc -l |
Kailash | 4321b4d | 2018-12-18 13:11:08 -0800 | [diff] [blame] | 190 | """ |
Luca Prete | 31eda02 | 2018-12-21 13:49:44 -0800 | [diff] [blame] | 191 | return att_workflow_tosca_completed.toInteger() == 1 |
Kailash | 4321b4d | 2018-12-18 13:11:08 -0800 | [diff] [blame] | 192 | } |
| 193 | } |
Luca Prete | 31eda02 | 2018-12-21 13:49:44 -0800 | [diff] [blame] | 194 | } |
| 195 | stage('Install base-kubernetes') { |
| 196 | timeout(10) { |
| 197 | sh returnStdout: true, script: """ |
| 198 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
Kailash | 3349934 | 2019-07-01 21:39:01 -0700 | [diff] [blame^] | 199 | helm install -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml -n base-kubernetes cord/base-kubernetes |
Luca Prete | 31eda02 | 2018-12-21 13:49:44 -0800 | [diff] [blame] | 200 | """ |
| 201 | } |
| 202 | timeout(10) { |
| 203 | waitUntil { |
| 204 | base_kubernetes_tosca_running = sh returnStdout: true, script: """ |
| 205 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf && |
| 206 | kubectl get pods | grep -i base-kubernetes-tosca-loader | grep -i completed | wc -l |
Kailash | 4321b4d | 2018-12-18 13:11:08 -0800 | [diff] [blame] | 207 | """ |
Luca Prete | 31eda02 | 2018-12-21 13:49:44 -0800 | [diff] [blame] | 208 | return base_kubernetes_tosca_running.toInteger() == 1 |
Kailash | 4321b4d | 2018-12-18 13:11:08 -0800 | [diff] [blame] | 209 | } |
| 210 | } |
Luca Prete | 31eda02 | 2018-12-21 13:49:44 -0800 | [diff] [blame] | 211 | } |
| 212 | stage('Install att workflow') { |
| 213 | timeout(10) { |
| 214 | sh returnStdout: true, script: """ |
| 215 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
Kailash | 3349934 | 2019-07-01 21:39:01 -0700 | [diff] [blame^] | 216 | helm install -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml --set att-workflow-driver.kafkaService=cord-kafka -n att-workflow cord/att-workflow |
Luca Prete | 31eda02 | 2018-12-21 13:49:44 -0800 | [diff] [blame] | 217 | """ |
Kailash | 58255ca | 2018-12-19 09:48:46 -0800 | [diff] [blame] | 218 | } |
Luca Prete | 31eda02 | 2018-12-21 13:49:44 -0800 | [diff] [blame] | 219 | timeout(10) { |
| 220 | waitUntil { |
| 221 | att_workflow_tosca_completed = sh returnStdout: true, script: """ |
| 222 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf && |
| 223 | kubectl get pods | grep -i att-workflow-tosca-loader | grep -i completed | wc -l |
Kailash | 58255ca | 2018-12-19 09:48:46 -0800 | [diff] [blame] | 224 | """ |
Luca Prete | 31eda02 | 2018-12-21 13:49:44 -0800 | [diff] [blame] | 225 | return att_workflow_tosca_completed.toInteger() == 1 |
Kailash | 4321b4d | 2018-12-18 13:11:08 -0800 | [diff] [blame] | 226 | } |
| 227 | } |
| 228 | } |
| 229 | |
Kailash | 9b56c86 | 2018-11-29 08:45:25 -0800 | [diff] [blame] | 230 | if ( params.reinstallOlt ) { |
| 231 | stage('Reinstall OLT software') { |
| 232 | for(int i=0; i < deployment_config.olts.size(); i++) { |
Luca Prete | b3029bd | 2018-08-28 16:31:39 -0700 | [diff] [blame] | 233 | sh returnStdout: true, script: """ |
Kailash | 9b56c86 | 2018-11-29 08:45:25 -0800 | [diff] [blame] | 234 | sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} 'dpkg --remove asfvolt16 && dpkg --purge asfvolt16' |
Luca Prete | b3029bd | 2018-08-28 16:31:39 -0700 | [diff] [blame] | 235 | """ |
Kailash | 9b56c86 | 2018-11-29 08:45:25 -0800 | [diff] [blame] | 236 | timeout(5) { |
| 237 | waitUntil { |
| 238 | olt_sw_present = sh returnStdout: true, script: """ |
| 239 | sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} 'dpkg --list | grep asfvolt16 | wc -l' |
| 240 | """ |
| 241 | return olt_sw_present.toInteger() == 0 |
| 242 | } |
| 243 | } |
| 244 | sh returnStdout: true, script: """ |
| 245 | sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} "dpkg --install ${oltDebVersion}" |
| 246 | """ |
| 247 | timeout(5) { |
| 248 | waitUntil { |
| 249 | olt_sw_present = sh returnStdout: true, script: """ |
| 250 | sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} 'dpkg --list | grep asfvolt16 | wc -l' |
| 251 | """ |
| 252 | return olt_sw_present.toInteger() == 1 |
| 253 | } |
| 254 | } |
| 255 | // If the OLT is connected to a 40G switch interface, set the NNI port to be downgraded |
| 256 | if ("${deployment_config.olts[i].fortygig}" != null && "${deployment_config.olts[i].fortygig}" == 'true') { |
| 257 | sh returnStdout: true, script: """ |
| 258 | sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} 'echo "port ce128 sp=40000" >> /broadcom/qax.soc' |
| 259 | sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} '/opt/bcm68620/svk_init.sh' |
| 260 | """ |
| 261 | } |
Luca Prete | b3029bd | 2018-08-28 16:31:39 -0700 | [diff] [blame] | 262 | } |
| 263 | } |
Kailash | 9b56c86 | 2018-11-29 08:45:25 -0800 | [diff] [blame] | 264 | stage('Restart OLT processes') { |
| 265 | for(int i=0; i < deployment_config.olts.size(); i++) { |
| 266 | timeout(5) { |
| 267 | sh returnStdout: true, script: """ |
| 268 | ssh-keyscan -H ${deployment_config.olts[i].ip} >> ~/.ssh/known_hosts |
| 269 | sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} 'service bal_core_dist stop' || true |
| 270 | sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} 'service openolt stop' || true |
| 271 | sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} '> /var/log/bal_core_dist.log' |
| 272 | sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} '> /var/log/openolt.log' |
| 273 | sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} 'service bal_core_dist start &' |
| 274 | sleep 5 |
| 275 | sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} 'service openolt start &' |
| 276 | """ |
| 277 | } |
| 278 | timeout(15) { |
| 279 | waitUntil { |
| 280 | onu_discovered = sh returnStdout: true, script: "sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} 'cat /var/log/openolt.log | grep \"oper_state: up\" | wc -l'" |
| 281 | return onu_discovered.toInteger() > 0 |
| 282 | } |
Luca Prete | b3029bd | 2018-08-28 16:31:39 -0700 | [diff] [blame] | 283 | } |
| 284 | } |
| 285 | } |
| 286 | } |
Kailash Khalasi | 4d18e20 | 2018-09-14 13:32:16 -0700 | [diff] [blame] | 287 | if ( params.configurePod ) { |
Kailash Khalasi | def2f4e | 2018-09-17 10:39:14 -0700 | [diff] [blame] | 288 | dir ("${configBaseDir}/${configToscaDir}/att-workflow") { |
Kailash Khalasi | 4d18e20 | 2018-09-14 13:32:16 -0700 | [diff] [blame] | 289 | stage('Configure R-CORD - Fabric and whitelist') { |
| 290 | timeout(1) { |
| 291 | waitUntil { |
| 292 | out_fabric = sh returnStdout: true, script: """ |
| 293 | curl -s -H "xos-username:admin@opencord.org" -H "xos-password:letmein" -X POST --data-binary @${configFileName}-fabric.yaml http://${deployment_config.nodes[0].ip}:30007/run | grep -i "created models" | wc -l |
| 294 | """ |
| 295 | return out_fabric.toInteger() == 1 |
| 296 | } |
Kailash Khalasi | c1a90f1 | 2018-09-13 13:13:22 -0700 | [diff] [blame] | 297 | } |
| 298 | } |
Kailash Khalasi | 4d18e20 | 2018-09-14 13:32:16 -0700 | [diff] [blame] | 299 | stage('Configure R-CORD - Subscriber') { |
| 300 | timeout(1) { |
| 301 | waitUntil { |
| 302 | out_subscriber = sh returnStdout: true, script: """ |
| 303 | curl -s -H 'xos-username:admin@opencord.org' -H 'xos-password:letmein' -X POST --data-binary @${configFileName}-subscriber.yaml http://${deployment_config.nodes[0].ip}:30007/run | grep -i "created models" | wc -l |
| 304 | """ |
| 305 | return out_subscriber.toInteger() == 1 |
| 306 | } |
Kailash Khalasi | c1a90f1 | 2018-09-13 13:13:22 -0700 | [diff] [blame] | 307 | } |
| 308 | } |
Kailash Khalasi | 4d18e20 | 2018-09-14 13:32:16 -0700 | [diff] [blame] | 309 | stage('Configure R-CORD - OLT') { |
| 310 | timeout(1) { |
| 311 | waitUntil { |
| 312 | out_olt = sh returnStdout: true, script: """ |
| 313 | curl -H 'xos-username:admin@opencord.org' -H 'xos-password:letmein' -X POST --data-binary @${configFileName}-olt.yaml http://${deployment_config.nodes[0].ip}:30007/run | grep -i "created models" | wc -l |
| 314 | """ |
| 315 | return out_olt.toInteger() == 1 |
| 316 | } |
Kailash Khalasi | c1a90f1 | 2018-09-13 13:13:22 -0700 | [diff] [blame] | 317 | } |
| 318 | } |
Luca Prete | b3029bd | 2018-08-28 16:31:39 -0700 | [diff] [blame] | 319 | } |
Suchitra Vemuri | ddb2779 | 2018-08-23 15:29:42 -0700 | [diff] [blame] | 320 | } |
Matteo Scandolo | 8819edd | 2018-11-27 13:18:08 -0800 | [diff] [blame] | 321 | if ( params.installBBSim ) { |
Luca Prete | 31eda02 | 2018-12-21 13:49:44 -0800 | [diff] [blame] | 322 | stage('Install BBSim') { |
| 323 | timeout(10) { |
| 324 | sh returnStdout: true, script: """ |
| 325 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
Suchitra Vemuri | 82fd4ff | 2019-03-05 20:41:15 -0800 | [diff] [blame] | 326 | helm install -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml -n bbsim cord/bbsim --set onus_per_pon_port=${onuNumber} |
Luca Prete | 31eda02 | 2018-12-21 13:49:44 -0800 | [diff] [blame] | 327 | """ |
| 328 | } |
| 329 | timeout(10) { |
| 330 | waitUntil { |
| 331 | bbsim_running = sh returnStdout: true, script: """ |
| 332 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf && |
| 333 | kubectl get pods -n voltha | grep -i bbsim | wc -l |
Matteo Scandolo | 8819edd | 2018-11-27 13:18:08 -0800 | [diff] [blame] | 334 | """ |
Luca Prete | 31eda02 | 2018-12-21 13:49:44 -0800 | [diff] [blame] | 335 | return bbsim_running.toInteger() == 1 |
Matteo Scandolo | 8819edd | 2018-11-27 13:18:08 -0800 | [diff] [blame] | 336 | } |
| 337 | } |
| 338 | } |
| 339 | dir ("${configBaseDir}/${configToscaDir}/bbsim") { |
| 340 | stage('Configure BBSim - OLT') { |
| 341 | timeout(1) { |
| 342 | waitUntil { |
| 343 | out_olt = sh returnStdout: true, script: """ |
| 344 | curl -H 'xos-username:admin@opencord.org' -H 'xos-password:letmein' -X POST --data-binary @bbsim-16.yaml http://${deployment_config.nodes[0].ip}:30007/run | grep -i "created models" | wc -l |
| 345 | """ |
| 346 | return out_olt.toInteger() == 1 |
| 347 | } |
| 348 | } |
| 349 | } |
| 350 | } |
| 351 | } |
Luca Prete | b3029bd | 2018-08-28 16:31:39 -0700 | [diff] [blame] | 352 | currentBuild.result = 'SUCCESS' |
| 353 | } catch (err) { |
| 354 | currentBuild.result = 'FAILURE' |
| 355 | step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "${notificationEmail}", sendToIndividuals: false]) |
Matteo Scandolo | b060767 | 2019-04-16 15:33:37 -0700 | [diff] [blame] | 356 | throw err |
Luca Prete | b3029bd | 2018-08-28 16:31:39 -0700 | [diff] [blame] | 357 | } |
| 358 | echo "RESULT: ${currentBuild.result}" |
Suchitra Vemuri | ddb2779 | 2018-08-23 15:29:42 -0700 | [diff] [blame] | 359 | } |
| 360 | } |