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} |
Suchitra Vemuri | 923f243 | 2019-07-01 18:22:31 -0700 | [diff] [blame^] | 58 | git clone https://gerrit.opencord.org/helm-charts |
Luca Prete | 62a48c8 | 2019-01-16 10:40:01 -0800 | [diff] [blame] | 59 | helm repo add incubator http://storage.googleapis.com/kubernetes-charts-incubator |
Kailash | 4321b4d | 2018-12-18 13:11:08 -0800 | [diff] [blame] | 60 | helm repo update |
| 61 | """ |
| 62 | timeout(1) { |
| 63 | waitUntil { |
| 64 | cord_repo_present = sh returnStdout: true, script: """ |
| 65 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf && |
| 66 | helm repo list | grep cord | wc -l |
Kailash Khalasi | 100cf46 | 2018-09-20 10:24:57 -0700 | [diff] [blame] | 67 | """ |
Kailash | 4321b4d | 2018-12-18 13:11:08 -0800 | [diff] [blame] | 68 | return cord_repo_present.toInteger() == 1 |
Matteo Scandolo | 2f8271f | 2018-12-12 15:54:54 -0800 | [diff] [blame] | 69 | } |
| 70 | } |
Suchitra Vemuri | ddb2779 | 2018-08-23 15:29:42 -0700 | [diff] [blame] | 71 | } |
Luca Prete | 31eda02 | 2018-12-21 13:49:44 -0800 | [diff] [blame] | 72 | stage('Install CORD Kafka') { |
| 73 | timeout(10) { |
| 74 | sh returnStdout: true, script: """ |
| 75 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
Zack Williams | 2a45834 | 2019-01-14 14:53:24 -0700 | [diff] [blame] | 76 | 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] | 77 | """ |
| 78 | } |
| 79 | timeout(10) { |
| 80 | waitUntil { |
| 81 | kafka_instances_running = sh returnStdout: true, script: """ |
| 82 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf && |
| 83 | 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] | 84 | """ |
Luca Prete | 31eda02 | 2018-12-21 13:49:44 -0800 | [diff] [blame] | 85 | return kafka_instances_running.toInteger() == 2 |
Kailash | 4321b4d | 2018-12-18 13:11:08 -0800 | [diff] [blame] | 86 | } |
| 87 | } |
Luca Prete | 31eda02 | 2018-12-21 13:49:44 -0800 | [diff] [blame] | 88 | } |
Matteo Scandolo | 863e3b1 | 2019-04-16 14:55:10 -0700 | [diff] [blame] | 89 | if ( params.installMonitoringAndLogging ) { |
| 90 | stage('Install Logging Infrastructure') { |
| 91 | timeout(10) { |
| 92 | sh returnStdout: true, script: """ |
| 93 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
| 94 | 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 |
| 95 | helm-repo-tools/wait_for_pods.sh |
| 96 | """ |
| 97 | } |
| 98 | } |
| 99 | stage('Install Monitoring Infrastructure') { |
| 100 | timeout(10) { |
| 101 | sh returnStdout: true, script: """ |
| 102 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
| 103 | helm install -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml -n nem-monitoring cord/nem-monitoring |
| 104 | helm-repo-tools/wait_for_pods.sh |
| 105 | """ |
| 106 | } |
| 107 | } |
Luca Prete | 31eda02 | 2018-12-21 13:49:44 -0800 | [diff] [blame] | 108 | } |
| 109 | stage('Install etcd-cluster') { |
| 110 | timeout(10) { |
| 111 | sh returnStdout: true, script: """ |
| 112 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
Zack Williams | 2a45834 | 2019-01-14 14:53:24 -0700 | [diff] [blame] | 113 | 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] | 114 | """ |
| 115 | } |
| 116 | timeout(10) { |
| 117 | waitUntil { |
| 118 | etcd_running = sh returnStdout: true, script: """ |
| 119 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf && |
| 120 | kubectl get pods | grep etcd | grep -i running | grep 1/1 | wc -l |
Kailash | 4321b4d | 2018-12-18 13:11:08 -0800 | [diff] [blame] | 121 | """ |
Luca Prete | 31eda02 | 2018-12-21 13:49:44 -0800 | [diff] [blame] | 122 | return etcd_running.toInteger() == 3 |
Kailash | 4321b4d | 2018-12-18 13:11:08 -0800 | [diff] [blame] | 123 | } |
| 124 | } |
Luca Prete | 31eda02 | 2018-12-21 13:49:44 -0800 | [diff] [blame] | 125 | } |
| 126 | stage('Install voltha') { |
| 127 | timeout(10) { |
| 128 | sh returnStdout: true, script: """ |
| 129 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
Suchitra Vemuri | 923f243 | 2019-07-01 18:22:31 -0700 | [diff] [blame^] | 130 | cd helm-charts |
| 131 | helm dep update voltha |
| 132 | #helm install -n voltha -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml cord/voltha --version 1.0.5 |
| 133 | helm install -n voltha -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml voltha |
Luca Prete | 31eda02 | 2018-12-21 13:49:44 -0800 | [diff] [blame] | 134 | """ |
| 135 | } |
| 136 | timeout(10) { |
| 137 | waitUntil { |
| 138 | voltha_completed = sh returnStdout: true, script: """ |
| 139 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf && |
| 140 | kubectl get pods -n voltha | grep -i running | grep 1/1 | wc -l |
Kailash | 4321b4d | 2018-12-18 13:11:08 -0800 | [diff] [blame] | 141 | """ |
Luca Prete | 31eda02 | 2018-12-21 13:49:44 -0800 | [diff] [blame] | 142 | return voltha_completed.toInteger() == 8 |
Kailash | 4321b4d | 2018-12-18 13:11:08 -0800 | [diff] [blame] | 143 | } |
| 144 | } |
Luca Prete | 31eda02 | 2018-12-21 13:49:44 -0800 | [diff] [blame] | 145 | } |
| 146 | stage('Install ONOS') { |
| 147 | timeout(10) { |
| 148 | sh returnStdout: true, script: """ |
| 149 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
Suchitra Vemuri | 923f243 | 2019-07-01 18:22:31 -0700 | [diff] [blame^] | 150 | cd helm-charts |
| 151 | helm dep update onos |
| 152 | #helm install -n onos -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml cord/onos |
| 153 | helm install -n onos -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml onos |
Luca Prete | 31eda02 | 2018-12-21 13:49:44 -0800 | [diff] [blame] | 154 | """ |
| 155 | } |
| 156 | timeout(10) { |
| 157 | waitUntil { |
| 158 | onos_completed = sh returnStdout: true, script: """ |
| 159 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf && |
| 160 | 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] | 161 | """ |
Luca Prete | 31eda02 | 2018-12-21 13:49:44 -0800 | [diff] [blame] | 162 | return onos_completed.toInteger() == 1 |
Kailash | 4321b4d | 2018-12-18 13:11:08 -0800 | [diff] [blame] | 163 | } |
| 164 | } |
Luca Prete | 31eda02 | 2018-12-21 13:49:44 -0800 | [diff] [blame] | 165 | } |
| 166 | stage('Install xos-core') { |
| 167 | timeout(10) { |
| 168 | sh returnStdout: true, script: """ |
| 169 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
Suchitra Vemuri | 923f243 | 2019-07-01 18:22:31 -0700 | [diff] [blame^] | 170 | cd helm-charts |
| 171 | helm dep update xos-core |
| 172 | #helm install -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml -n xos-core cord/xos-core |
| 173 | helm install -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml -n xos-core xos-core |
Luca Prete | 31eda02 | 2018-12-21 13:49:44 -0800 | [diff] [blame] | 174 | """ |
| 175 | } |
| 176 | timeout(10) { |
| 177 | waitUntil { |
| 178 | xos_core_completed = sh returnStdout: true, script: """ |
| 179 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf && |
| 180 | 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] | 181 | """ |
Luca Prete | 31eda02 | 2018-12-21 13:49:44 -0800 | [diff] [blame] | 182 | return xos_core_completed.toInteger() == 6 |
Kailash | 4321b4d | 2018-12-18 13:11:08 -0800 | [diff] [blame] | 183 | } |
| 184 | } |
Luca Prete | 31eda02 | 2018-12-21 13:49:44 -0800 | [diff] [blame] | 185 | } |
| 186 | stage('Install seba-services') { |
| 187 | timeout(10) { |
| 188 | sh returnStdout: true, script: """ |
| 189 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
Suchitra Vemuri | 923f243 | 2019-07-01 18:22:31 -0700 | [diff] [blame^] | 190 | cd helm-charts |
| 191 | helm dep update xos-profiles/seba-services |
| 192 | #helm install -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml -n seba-services cord/seba-services |
| 193 | helm install -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml -n seba-services xos-profiles/seba-services |
Luca Prete | 31eda02 | 2018-12-21 13:49:44 -0800 | [diff] [blame] | 194 | """ |
| 195 | } |
| 196 | timeout(10) { |
| 197 | waitUntil { |
| 198 | att_workflow_tosca_completed = sh returnStdout: true, script: """ |
| 199 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf && |
| 200 | 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] | 201 | """ |
Luca Prete | 31eda02 | 2018-12-21 13:49:44 -0800 | [diff] [blame] | 202 | return att_workflow_tosca_completed.toInteger() == 1 |
Kailash | 4321b4d | 2018-12-18 13:11:08 -0800 | [diff] [blame] | 203 | } |
| 204 | } |
Luca Prete | 31eda02 | 2018-12-21 13:49:44 -0800 | [diff] [blame] | 205 | } |
| 206 | stage('Install base-kubernetes') { |
| 207 | timeout(10) { |
| 208 | sh returnStdout: true, script: """ |
| 209 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
Suchitra Vemuri | 923f243 | 2019-07-01 18:22:31 -0700 | [diff] [blame^] | 210 | cd helm-charts |
| 211 | helm dep update xos-profiles/base-kubernets |
| 212 | #helm install -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml -n base-kubernetes cord/base-kubernetes |
| 213 | helm install -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml -n base-kubernetes xos-profiles/base-kubernetes |
Luca Prete | 31eda02 | 2018-12-21 13:49:44 -0800 | [diff] [blame] | 214 | """ |
| 215 | } |
| 216 | timeout(10) { |
| 217 | waitUntil { |
| 218 | base_kubernetes_tosca_running = sh returnStdout: true, script: """ |
| 219 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf && |
| 220 | 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] | 221 | """ |
Luca Prete | 31eda02 | 2018-12-21 13:49:44 -0800 | [diff] [blame] | 222 | return base_kubernetes_tosca_running.toInteger() == 1 |
Kailash | 4321b4d | 2018-12-18 13:11:08 -0800 | [diff] [blame] | 223 | } |
| 224 | } |
Luca Prete | 31eda02 | 2018-12-21 13:49:44 -0800 | [diff] [blame] | 225 | } |
| 226 | stage('Install att workflow') { |
| 227 | timeout(10) { |
| 228 | sh returnStdout: true, script: """ |
| 229 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
Suchitra Vemuri | 923f243 | 2019-07-01 18:22:31 -0700 | [diff] [blame^] | 230 | cd helm-charts |
| 231 | helm dep update workflows/att-workflow |
| 232 | #helm install -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml --set att-workflow-driver.kafkaService=cord-kafka -n att-workflow cord/att-workflow |
| 233 | helm install -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml --set att-workflow-driver.kafkaService=cord-kafka -n att-workflow workflows/att-workflow |
Luca Prete | 31eda02 | 2018-12-21 13:49:44 -0800 | [diff] [blame] | 234 | """ |
Kailash | 58255ca | 2018-12-19 09:48:46 -0800 | [diff] [blame] | 235 | } |
Luca Prete | 31eda02 | 2018-12-21 13:49:44 -0800 | [diff] [blame] | 236 | timeout(10) { |
| 237 | waitUntil { |
| 238 | att_workflow_tosca_completed = sh returnStdout: true, script: """ |
| 239 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf && |
| 240 | 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] | 241 | """ |
Luca Prete | 31eda02 | 2018-12-21 13:49:44 -0800 | [diff] [blame] | 242 | return att_workflow_tosca_completed.toInteger() == 1 |
Kailash | 4321b4d | 2018-12-18 13:11:08 -0800 | [diff] [blame] | 243 | } |
| 244 | } |
| 245 | } |
| 246 | |
Kailash | 9b56c86 | 2018-11-29 08:45:25 -0800 | [diff] [blame] | 247 | if ( params.reinstallOlt ) { |
| 248 | stage('Reinstall OLT software') { |
| 249 | for(int i=0; i < deployment_config.olts.size(); i++) { |
Luca Prete | b3029bd | 2018-08-28 16:31:39 -0700 | [diff] [blame] | 250 | sh returnStdout: true, script: """ |
Kailash | 9b56c86 | 2018-11-29 08:45:25 -0800 | [diff] [blame] | 251 | 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] | 252 | """ |
Kailash | 9b56c86 | 2018-11-29 08:45:25 -0800 | [diff] [blame] | 253 | timeout(5) { |
| 254 | waitUntil { |
| 255 | olt_sw_present = sh returnStdout: true, script: """ |
| 256 | 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' |
| 257 | """ |
| 258 | return olt_sw_present.toInteger() == 0 |
| 259 | } |
| 260 | } |
| 261 | sh returnStdout: true, script: """ |
| 262 | sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} "dpkg --install ${oltDebVersion}" |
| 263 | """ |
| 264 | timeout(5) { |
| 265 | waitUntil { |
| 266 | olt_sw_present = sh returnStdout: true, script: """ |
| 267 | 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' |
| 268 | """ |
| 269 | return olt_sw_present.toInteger() == 1 |
| 270 | } |
| 271 | } |
| 272 | // If the OLT is connected to a 40G switch interface, set the NNI port to be downgraded |
| 273 | if ("${deployment_config.olts[i].fortygig}" != null && "${deployment_config.olts[i].fortygig}" == 'true') { |
| 274 | sh returnStdout: true, script: """ |
| 275 | 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' |
| 276 | sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} '/opt/bcm68620/svk_init.sh' |
| 277 | """ |
| 278 | } |
Luca Prete | b3029bd | 2018-08-28 16:31:39 -0700 | [diff] [blame] | 279 | } |
| 280 | } |
Kailash | 9b56c86 | 2018-11-29 08:45:25 -0800 | [diff] [blame] | 281 | stage('Restart OLT processes') { |
| 282 | for(int i=0; i < deployment_config.olts.size(); i++) { |
| 283 | timeout(5) { |
| 284 | sh returnStdout: true, script: """ |
| 285 | ssh-keyscan -H ${deployment_config.olts[i].ip} >> ~/.ssh/known_hosts |
| 286 | 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 |
| 287 | sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} 'service openolt stop' || true |
| 288 | 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' |
| 289 | sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} '> /var/log/openolt.log' |
| 290 | sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} 'service bal_core_dist start &' |
| 291 | sleep 5 |
| 292 | sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} 'service openolt start &' |
| 293 | """ |
| 294 | } |
| 295 | timeout(15) { |
| 296 | waitUntil { |
| 297 | 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'" |
| 298 | return onu_discovered.toInteger() > 0 |
| 299 | } |
Luca Prete | b3029bd | 2018-08-28 16:31:39 -0700 | [diff] [blame] | 300 | } |
| 301 | } |
| 302 | } |
| 303 | } |
Kailash Khalasi | 4d18e20 | 2018-09-14 13:32:16 -0700 | [diff] [blame] | 304 | if ( params.configurePod ) { |
Kailash Khalasi | def2f4e | 2018-09-17 10:39:14 -0700 | [diff] [blame] | 305 | dir ("${configBaseDir}/${configToscaDir}/att-workflow") { |
Kailash Khalasi | 4d18e20 | 2018-09-14 13:32:16 -0700 | [diff] [blame] | 306 | stage('Configure R-CORD - Fabric and whitelist') { |
| 307 | timeout(1) { |
| 308 | waitUntil { |
| 309 | out_fabric = sh returnStdout: true, script: """ |
| 310 | 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 |
| 311 | """ |
| 312 | return out_fabric.toInteger() == 1 |
| 313 | } |
Kailash Khalasi | c1a90f1 | 2018-09-13 13:13:22 -0700 | [diff] [blame] | 314 | } |
| 315 | } |
Kailash Khalasi | 4d18e20 | 2018-09-14 13:32:16 -0700 | [diff] [blame] | 316 | stage('Configure R-CORD - Subscriber') { |
| 317 | timeout(1) { |
| 318 | waitUntil { |
| 319 | out_subscriber = sh returnStdout: true, script: """ |
| 320 | 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 |
| 321 | """ |
| 322 | return out_subscriber.toInteger() == 1 |
| 323 | } |
Kailash Khalasi | c1a90f1 | 2018-09-13 13:13:22 -0700 | [diff] [blame] | 324 | } |
| 325 | } |
Kailash Khalasi | 4d18e20 | 2018-09-14 13:32:16 -0700 | [diff] [blame] | 326 | stage('Configure R-CORD - OLT') { |
| 327 | timeout(1) { |
| 328 | waitUntil { |
| 329 | out_olt = sh returnStdout: true, script: """ |
| 330 | 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 |
| 331 | """ |
| 332 | return out_olt.toInteger() == 1 |
| 333 | } |
Kailash Khalasi | c1a90f1 | 2018-09-13 13:13:22 -0700 | [diff] [blame] | 334 | } |
| 335 | } |
Luca Prete | b3029bd | 2018-08-28 16:31:39 -0700 | [diff] [blame] | 336 | } |
Suchitra Vemuri | ddb2779 | 2018-08-23 15:29:42 -0700 | [diff] [blame] | 337 | } |
Matteo Scandolo | 8819edd | 2018-11-27 13:18:08 -0800 | [diff] [blame] | 338 | if ( params.installBBSim ) { |
Luca Prete | 31eda02 | 2018-12-21 13:49:44 -0800 | [diff] [blame] | 339 | stage('Install BBSim') { |
| 340 | timeout(10) { |
| 341 | sh returnStdout: true, script: """ |
| 342 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
Suchitra Vemuri | 82fd4ff | 2019-03-05 20:41:15 -0800 | [diff] [blame] | 343 | 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] | 344 | """ |
| 345 | } |
| 346 | timeout(10) { |
| 347 | waitUntil { |
| 348 | bbsim_running = sh returnStdout: true, script: """ |
| 349 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf && |
| 350 | kubectl get pods -n voltha | grep -i bbsim | wc -l |
Matteo Scandolo | 8819edd | 2018-11-27 13:18:08 -0800 | [diff] [blame] | 351 | """ |
Luca Prete | 31eda02 | 2018-12-21 13:49:44 -0800 | [diff] [blame] | 352 | return bbsim_running.toInteger() == 1 |
Matteo Scandolo | 8819edd | 2018-11-27 13:18:08 -0800 | [diff] [blame] | 353 | } |
| 354 | } |
| 355 | } |
| 356 | dir ("${configBaseDir}/${configToscaDir}/bbsim") { |
| 357 | stage('Configure BBSim - OLT') { |
| 358 | timeout(1) { |
| 359 | waitUntil { |
| 360 | out_olt = sh returnStdout: true, script: """ |
| 361 | 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 |
| 362 | """ |
| 363 | return out_olt.toInteger() == 1 |
| 364 | } |
| 365 | } |
| 366 | } |
| 367 | } |
| 368 | } |
Luca Prete | b3029bd | 2018-08-28 16:31:39 -0700 | [diff] [blame] | 369 | currentBuild.result = 'SUCCESS' |
| 370 | } catch (err) { |
| 371 | currentBuild.result = 'FAILURE' |
| 372 | step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "${notificationEmail}", sendToIndividuals: false]) |
Matteo Scandolo | b060767 | 2019-04-16 15:33:37 -0700 | [diff] [blame] | 373 | throw err |
Luca Prete | b3029bd | 2018-08-28 16:31:39 -0700 | [diff] [blame] | 374 | } |
| 375 | echo "RESULT: ${currentBuild.result}" |
Suchitra Vemuri | ddb2779 | 2018-08-23 15:29:42 -0700 | [diff] [blame] | 376 | } |
| 377 | } |