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