Luca Prete | 45401c8 | 2019-01-15 15:31:22 -0800 | [diff] [blame] | 1 | // Copyright 2017-present Open Networking Foundation |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
| 15 | node ("${TestNodeName}") { |
| 16 | timeout (100) { |
| 17 | try { |
| 18 | stage ("Parse deployment configuration file") { |
Matteo Scandolo | 9f8056b | 2019-01-17 10:33:51 -0800 | [diff] [blame] | 19 | sh returnStdout: true, script: "rm -rf helm-charts helm-repo-tools ${configBaseDir}" |
Luca Prete | 45401c8 | 2019-01-15 15:31:22 -0800 | [diff] [blame] | 20 | sh returnStdout: true, script: "git clone -b ${branch} ${cordRepoUrl}/helm-repo-tools" |
Wei-Yu Chen | 992665b | 2019-01-17 10:21:32 -0800 | [diff] [blame] | 21 | sh returnStdout: true, script: "git clone -b ${branch} ${cordRepoUrl}/helm-charts" |
Luca Prete | 45401c8 | 2019-01-15 15:31:22 -0800 | [diff] [blame] | 22 | sh returnStdout: true, script: "git clone -b ${branch} ${cordRepoUrl}/${configBaseDir}" |
Wei-Yu Chen | 1a5f9ff | 2019-02-07 10:18:55 -0800 | [diff] [blame] | 23 | //sh returnStdout: true, script: "cd ${configBaseDir}; git fetch https://gerrit.opencord.org/pod-configs refs/changes/02/12902/1 && git checkout FETCH_HEAD; cd -" |
Luca Prete | 45401c8 | 2019-01-15 15:31:22 -0800 | [diff] [blame] | 24 | deployment_config = readYaml file: "${configBaseDir}/${configDeploymentDir}/${configFileName}.yaml" |
| 25 | } |
| 26 | stage('Clean up') { |
| 27 | timeout(10) { |
| 28 | sh returnStdout: true, script: """ |
| 29 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
| 30 | for hchart in \$(helm list -q | grep -E -v 'docker-registry|mavenrepo|ponnet'); |
| 31 | do |
| 32 | echo "Purging chart: \${hchart}" |
| 33 | helm delete --purge "\${hchart}" |
| 34 | done |
| 35 | """ |
| 36 | timeout(5) { |
| 37 | waitUntil { |
| 38 | helm_deleted = sh returnStdout: true, script: """ |
| 39 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf && |
| 40 | helm ls -q | grep -E -v 'docker-registry|mavenrepo|ponnet' | wc -l |
| 41 | """ |
| 42 | return helm_deleted.toInteger() == 0 |
| 43 | } |
| 44 | } |
Wei-Yu Chen | 1a5f9ff | 2019-02-07 10:18:55 -0800 | [diff] [blame] | 45 | |
| 46 | // In Multi-cluster scenario, we only need to install SR-IOV on data plane cluster |
| 47 | if ( ! params.installEpcControlPlane ) { |
| 48 | timeout(5) { |
| 49 | dir ("helm-charts") { |
| 50 | stage("Cleanup SR-IOV Network Device Plugin Daemonset") { |
| 51 | sh returnStdout: true, script: """ |
| 52 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
| 53 | kubectl delete -f mcord/cni-config/05-sriov-device-plugin.yaml || true |
| 54 | kubectl delete -f mcord/cni-config/04-sriov-device-plugin-configmap.yaml || true |
| 55 | kubectl delete -f mcord/cni-config/03-network-definition.yaml || true |
| 56 | kubectl delete -f mcord/cni-config/02-network-crd.yaml || true |
| 57 | kubectl delete -f mcord/cni-config/01-cni-service-account.yaml || true |
| 58 | """ |
| 59 | } |
Wei-Yu Chen | 213821c | 2019-01-17 10:21:32 -0800 | [diff] [blame] | 60 | } |
| 61 | } |
| 62 | } |
Wei-Yu Chen | 1a5f9ff | 2019-02-07 10:18:55 -0800 | [diff] [blame] | 63 | |
Luca Prete | 45401c8 | 2019-01-15 15:31:22 -0800 | [diff] [blame] | 64 | timeout(5) { |
| 65 | waitUntil { |
| 66 | kubectl_deleted = sh returnStdout: true, script: """ |
| 67 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf && |
Matteo Scandolo | 736f6b8 | 2019-01-24 15:29:07 -0800 | [diff] [blame] | 68 | kubectl get pods --all-namespaces --no-headers | grep -E -v 'kube-system|docker-registry|mavenrepo|ponnet|test' | wc -l |
Luca Prete | 45401c8 | 2019-01-15 15:31:22 -0800 | [diff] [blame] | 69 | """ |
| 70 | return kubectl_deleted.toInteger() == 0 |
| 71 | } |
| 72 | } |
| 73 | } |
| 74 | } |
Wei-Yu Chen | 1a5f9ff | 2019-02-07 10:18:55 -0800 | [diff] [blame] | 75 | |
Matteo Scandolo | 65046b2 | 2019-02-04 09:59:49 -0800 | [diff] [blame] | 76 | // OLT Software START |
| 77 | if ( params.reinstallOlt ) { |
| 78 | stage('Reinstall OLT software') { |
| 79 | for(int i=0; i < deployment_config.olts.size(); i++) { |
| 80 | sh returnStdout: true, script: """ |
| 81 | 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' |
| 82 | """ |
| 83 | timeout(5) { |
| 84 | waitUntil { |
| 85 | olt_sw_present = sh returnStdout: true, script: """ |
| 86 | 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' |
| 87 | """ |
| 88 | return olt_sw_present.toInteger() == 0 |
| 89 | } |
| 90 | } |
| 91 | sh returnStdout: true, script: """ |
| 92 | sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} "dpkg --install ${oltDebVersion}" |
| 93 | """ |
| 94 | timeout(5) { |
| 95 | waitUntil { |
| 96 | olt_sw_present = sh returnStdout: true, script: """ |
| 97 | 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' |
| 98 | """ |
| 99 | return olt_sw_present.toInteger() == 1 |
| 100 | } |
| 101 | } |
| 102 | // If the OLT is connected to a 40G switch interface, set the NNI port to be downgraded |
| 103 | if ("${deployment_config.olts[i].fortygig}" != null && "${deployment_config.olts[i].fortygig}" == 'true') { |
| 104 | sh returnStdout: true, script: """ |
| 105 | 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' |
| 106 | sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} '/opt/bcm68620/svk_init.sh' |
| 107 | """ |
| 108 | } |
| 109 | } |
| 110 | } |
Wei-Yu Chen | 1a5f9ff | 2019-02-07 10:18:55 -0800 | [diff] [blame] | 111 | |
Matteo Scandolo | 65046b2 | 2019-02-04 09:59:49 -0800 | [diff] [blame] | 112 | stage('Restart OLT processes') { |
| 113 | for(int i=0; i < deployment_config.olts.size(); i++) { |
| 114 | timeout(5) { |
| 115 | sh returnStdout: true, script: """ |
| 116 | ssh-keyscan -H ${deployment_config.olts[i].ip} >> ~/.ssh/known_hosts |
| 117 | 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 |
| 118 | sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} 'service openolt stop' || true |
| 119 | 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' |
| 120 | sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} '> /var/log/openolt.log' |
| 121 | sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} 'service bal_core_dist start &' |
| 122 | sleep 5 |
| 123 | sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} 'service openolt start &' |
| 124 | """ |
| 125 | } |
| 126 | timeout(15) { |
| 127 | waitUntil { |
| 128 | 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'" |
| 129 | return onu_discovered.toInteger() > 0 |
| 130 | } |
| 131 | } |
| 132 | } |
| 133 | } |
| 134 | } |
Wei-Yu Chen | 1a5f9ff | 2019-02-07 10:18:55 -0800 | [diff] [blame] | 135 | |
| 136 | // Start to deploy etcd clusters and M-CORD Services |
Luca Prete | 62a48c8 | 2019-01-16 10:40:01 -0800 | [diff] [blame] | 137 | stage('Add Helm repositories') { |
Luca Prete | 45401c8 | 2019-01-15 15:31:22 -0800 | [diff] [blame] | 138 | sh returnStdout: true, script: """ |
| 139 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
Wei-Yu Chen | 76dd793 | 2019-01-18 14:14:23 -0800 | [diff] [blame] | 140 | helm init --upgrade --force-upgrade |
Luca Prete | 45401c8 | 2019-01-15 15:31:22 -0800 | [diff] [blame] | 141 | helm repo add cord https://charts.opencord.org |
Luca Prete | 62a48c8 | 2019-01-16 10:40:01 -0800 | [diff] [blame] | 142 | helm repo add incubator http://storage.googleapis.com/kubernetes-charts-incubator |
Luca Prete | 45401c8 | 2019-01-15 15:31:22 -0800 | [diff] [blame] | 143 | helm repo update |
| 144 | """ |
| 145 | timeout(1) { |
| 146 | waitUntil { |
Wei-Yu Chen | 76dd793 | 2019-01-18 14:14:23 -0800 | [diff] [blame] | 147 | tillerpod_running = sh returnStdout: true, script: """ |
| 148 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf && |
| 149 | kubectl -n kube-system get pods | grep tiller-deploy | grep Running | wc -l |
| 150 | """ |
| 151 | return tillerpod_running.toInteger() == 1 |
| 152 | } |
| 153 | } |
| 154 | timeout(1) { |
| 155 | waitUntil { |
Luca Prete | 45401c8 | 2019-01-15 15:31:22 -0800 | [diff] [blame] | 156 | cord_repo_present = sh returnStdout: true, script: """ |
| 157 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf && |
| 158 | helm repo list | grep cord | wc -l |
| 159 | """ |
| 160 | return cord_repo_present.toInteger() == 1 |
| 161 | } |
| 162 | } |
| 163 | } |
Wei-Yu Chen | 1a5f9ff | 2019-02-07 10:18:55 -0800 | [diff] [blame] | 164 | stage('Install etcd-cluster') { |
| 165 | timeout(10) { |
| 166 | sh returnStdout: true, script: """ |
| 167 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
| 168 | helm install -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml --version 0.8.3 -n etcd-operator stable/etcd-operator |
| 169 | """ |
| 170 | } |
| 171 | timeout(10) { |
| 172 | waitUntil { |
| 173 | etcd_operator_running = sh returnStdout: true, script: """ |
| 174 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf && |
| 175 | kubectl get pods | grep etcd-operator | grep -i running | grep 1/1 | wc -l |
| 176 | """ |
| 177 | return etcd_operator_running.toInteger() == 3 |
| 178 | } |
| 179 | } |
| 180 | timeout(1) { |
| 181 | waitUntil { |
| 182 | etcd_operator_definition = sh returnStdout: true, script: """ |
| 183 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
| 184 | kubectl get crd -o json | jq -r '.items[].spec | select(.group=="etcd.database.coreos.com").names.kind' | grep -E 'EtcdBackup|EtcdCluster|EtcdRestore' | wc -l |
| 185 | """ |
| 186 | return etcd_operator_definition.toInteger() == 3 |
| 187 | } |
Matteo Scandolo | 08aea47 | 2019-01-23 11:45:37 -0800 | [diff] [blame] | 188 | |
Wei-Yu Chen | 1a5f9ff | 2019-02-07 10:18:55 -0800 | [diff] [blame] | 189 | } |
| 190 | timeout(10) { |
| 191 | sh returnStdout: true, script: """ |
| 192 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
| 193 | helm install -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml --set etcdNodePort=32379 --set clusterSize=1 -n etcd cord/etcd-cluster |
| 194 | """ |
| 195 | } |
| 196 | timeout(10) { |
| 197 | waitUntil { |
| 198 | etcd_cluster_running = sh returnStdout: true, script: """ |
| 199 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf && |
| 200 | kubectl get pods | grep etcd-cluster | grep -i running | grep 1/1 | wc -l |
| 201 | """ |
| 202 | return etcd_cluster_running.toInteger() == 1 |
| 203 | } |
| 204 | } |
| 205 | } |
Matteo Scandolo | cf526e7 | 2019-02-14 17:46:50 -0800 | [diff] [blame] | 206 | |
Matteo Scandolo | e7f232a | 2019-02-04 16:47:10 -0800 | [diff] [blame] | 207 | dir ("helm-charts") { |
| 208 | stage('Install SR-IOV CNI and SR-IOV Network Device Plugin') { |
| 209 | sh returnStdout: true, script: """ |
| 210 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
| 211 | kubectl apply -f mcord/cni-config/02-network-crd.yaml |
Matteo Scandolo | e7f232a | 2019-02-04 16:47:10 -0800 | [diff] [blame] | 212 | """ |
Matteo Scandolo | e7f232a | 2019-02-04 16:47:10 -0800 | [diff] [blame] | 213 | |
Wei-Yu Chen | 1a5f9ff | 2019-02-07 10:18:55 -0800 | [diff] [blame] | 214 | timeout(1) { |
| 215 | waitUntil { |
| 216 | network_crd_exist = sh returnStdout: true, script: """ |
| 217 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
| 218 | kubectl get crd -o json | jq -r '.items[].spec | select(.group=="k8s.cni.cncf.io").names.kind' | grep -E 'NetworkAttachmentDefinition' | wc -l |
| 219 | """ |
| 220 | return network_crd_exist.toInteger() == 1 |
| 221 | } |
| 222 | } |
| 223 | |
Matteo Scandolo | 08aea47 | 2019-01-23 11:45:37 -0800 | [diff] [blame] | 224 | sh returnStdout: true, script: """ |
| 225 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
Wei-Yu Chen | 1a5f9ff | 2019-02-07 10:18:55 -0800 | [diff] [blame] | 226 | kubectl apply -f mcord/cni-config/ |
Matteo Scandolo | 08aea47 | 2019-01-23 11:45:37 -0800 | [diff] [blame] | 227 | """ |
Wei-Yu Chen | 1a5f9ff | 2019-02-07 10:18:55 -0800 | [diff] [blame] | 228 | |
| 229 | // Because of SR-IOV daemonset will restart the kubelet and containerd, so we need to wait tiller up. |
| 230 | timeout(1) { |
| 231 | waitUntil { |
| 232 | tillerpod_running = sh returnStdout: true, script: """ |
| 233 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
| 234 | kubectl -n kube-system get pods | grep tiller-deploy | grep Running | wc -l |
| 235 | """ |
| 236 | return tillerpod_running.toInteger() == 1 |
| 237 | } |
| 238 | } |
| 239 | |
| 240 | // Sometimes tillerpod is up, but it's not ready to accept deployment yet, let's wait. |
| 241 | timeout(1) { |
| 242 | waitUntil { |
| 243 | helm_client_working = sh returnStatus: true, script: """ |
| 244 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
| 245 | helm ls |
| 246 | """ |
| 247 | return helm_client_working == 0 |
| 248 | } |
Matteo Scandolo | 08aea47 | 2019-01-23 11:45:37 -0800 | [diff] [blame] | 249 | } |
| 250 | } |
| 251 | } |
| 252 | |
Wei-Yu Chen | 1a5f9ff | 2019-02-07 10:18:55 -0800 | [diff] [blame] | 253 | // Deploy Sequence: EPC Data plane > vBBU > EPC Control plane |
Andy Bavier | 77df9fb | 2019-02-02 10:49:04 -0700 | [diff] [blame] | 254 | stage("Install M-CORD Data Plane Services") { |
Wei-Yu Chen | 1a5f9ff | 2019-02-07 10:18:55 -0800 | [diff] [blame] | 255 | mcord_dataplane_working = sh returnStdout: true, script: """ |
Andy Bavier | 77df9fb | 2019-02-02 10:49:04 -0700 | [diff] [blame] | 256 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
| 257 | helm install -n mcord-data-plane --namespace epc -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml cord/mcord-data-plane |
| 258 | """ |
| 259 | } |
| 260 | |
Andy Bavier | 77df9fb | 2019-02-02 10:49:04 -0700 | [diff] [blame] | 261 | stage("Install M-CORD BBU Services") { |
Wei-Yu Chen | 1a5f9ff | 2019-02-07 10:18:55 -0800 | [diff] [blame] | 262 | mcord_bbu_working = sh returnStdout: true, script: """ |
Wei-Yu Chen | 992665b | 2019-01-17 10:21:32 -0800 | [diff] [blame] | 263 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
Andy Bavier | 77df9fb | 2019-02-02 10:49:04 -0700 | [diff] [blame] | 264 | helm install -n mcord-bbu --namespace epc -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml cord/mcord-bbu |
Wei-Yu Chen | 992665b | 2019-01-17 10:21:32 -0800 | [diff] [blame] | 265 | """ |
Luca Prete | 45401c8 | 2019-01-15 15:31:22 -0800 | [diff] [blame] | 266 | } |
Wei-Yu Chen | 992665b | 2019-01-17 10:21:32 -0800 | [diff] [blame] | 267 | |
Wei-Yu Chen | 1a5f9ff | 2019-02-07 10:18:55 -0800 | [diff] [blame] | 268 | // if ( params.installEpcControlPlane ) { |
| 269 | // timeout(2) { |
| 270 | // waitUntil { |
| 271 | // mcord_bbu_running = sh returnStdout: true, script: """ |
| 272 | // export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf && |
| 273 | // kubectl -n epc get pods | grep accelleran | grep -i running | grep 3/3 | wc -l |
| 274 | // """ |
| 275 | // return mcord_bbu_running.toInteger() == 1 |
| 276 | // } |
| 277 | // } |
| 278 | // stage("Install M-CORD Control Plane Services") { |
| 279 | // mcord_controlplane_working = sh returnStdout: true, script: """ |
| 280 | // export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
| 281 | // ngic_s1u_net_ip=\$(kubectl exec -n epc ngic-dp-0 ifconfig s1u-net | grep 'inet addr' | cut -d: -f2 | awk '{print \$1}') |
| 282 | // bbu_eth0=\$(kubectl -n epc get pods accelleran-0 --template={{.status.podIP}}) |
| 283 | // helm install -n mcord-control-plane --namespace epc -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml cord/mcord-control-plane --set accelleran_hostname=\$bbu_eth0 --set spgwu_s1u_ip=\$ngic_s1u_net_ip |
| 284 | // """ |
| 285 | // } |
| 286 | // } |
| 287 | |
| 288 | stage("Install CDN Local Services") { |
| 289 | timeout(2) { |
| 290 | waitUntil { |
| 291 | ngic_dataplane_running = sh returnStdout: true, script: """ |
| 292 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf && |
| 293 | kubectl -n epc get pods | grep ngic-dp | grep -i running | grep 1/1 | wc -l |
| 294 | """ |
| 295 | return ngic_dataplane_running.toInteger() == 1 |
| 296 | } |
| 297 | } |
| 298 | |
| 299 | mcord_local_cdn_working = sh returnStdout: true, script: """ |
| 300 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
| 301 | ngic_sgi_net_ip=\$(kubectl exec -n epc ngic-dp-0 ifconfig sgi-net | grep 'inet addr' | cut -d: -f2 | awk '{print \$1}') |
| 302 | helm install -n cdn-local --set remote_ip="10.90.0.152" --set spgwu_sgiip=\$ngic_sgi_net_ip --namespace epc cord/mcord-cdn-local |
| 303 | """ |
| 304 | } |
| 305 | |
Matteo Scandolo | 202064f | 2019-01-24 15:01:39 -0800 | [diff] [blame] | 306 | stage('Install CORD Kafka') { |
| 307 | timeout(10) { |
| 308 | sh returnStdout: true, script: """ |
| 309 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
| 310 | 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 |
| 311 | """ |
| 312 | } |
| 313 | timeout(10) { |
| 314 | waitUntil { |
| 315 | kafka_instances_running = sh returnStdout: true, script: """ |
| 316 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf && |
| 317 | kubectl get pods | grep cord-kafka | grep -i running | grep 1/1 | wc -l |
| 318 | """ |
| 319 | return kafka_instances_running.toInteger() == 2 |
| 320 | } |
| 321 | } |
| 322 | } |
Wei-Yu Chen | 992665b | 2019-01-17 10:21:32 -0800 | [diff] [blame] | 323 | // stage('Install Logging Infrastructure') { |
| 324 | // timeout(10) { |
| 325 | // sh returnStdout: true, script: """ |
| 326 | // export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
| 327 | // 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 |
| 328 | // helm-repo-tools/wait_for_pods.sh |
| 329 | // """ |
| 330 | // } |
| 331 | // } |
Matteo Scandolo | cf526e7 | 2019-02-14 17:46:50 -0800 | [diff] [blame] | 332 | stage('Install Monitoring Infrastructure') { |
| 333 | timeout(10) { |
| 334 | sh returnStdout: true, script: """ |
| 335 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
| 336 | helm install -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml -n nem-monitoring cord/nem-monitoring --version 1.0.1 |
| 337 | helm-repo-tools/wait_for_pods.sh |
| 338 | """ |
| 339 | } |
| 340 | } |
Matteo Scandolo | 202064f | 2019-01-24 15:01:39 -0800 | [diff] [blame] | 341 | stage('Install ONOS') { |
| 342 | timeout(10) { |
| 343 | sh returnStdout: true, script: """ |
| 344 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
Matteo Scandolo | 6c637ce | 2019-01-31 14:58:38 -0800 | [diff] [blame] | 345 | helm install -n onos -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml cord/onos --version 1.1.0 |
Matteo Scandolo | 202064f | 2019-01-24 15:01:39 -0800 | [diff] [blame] | 346 | """ |
| 347 | } |
| 348 | timeout(10) { |
| 349 | waitUntil { |
| 350 | onos_completed = sh returnStdout: true, script: """ |
| 351 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf && |
Wei-Yu Chen | 1a5f9ff | 2019-02-07 10:18:55 -0800 | [diff] [blame] | 352 | kubectl get pods | grep -i onos | grep -i running | grep 1/1 | wc -l |
Matteo Scandolo | 202064f | 2019-01-24 15:01:39 -0800 | [diff] [blame] | 353 | """ |
| 354 | return onos_completed.toInteger() == 1 |
| 355 | } |
| 356 | } |
| 357 | } |
Wei-Yu Chen | 1a5f9ff | 2019-02-07 10:18:55 -0800 | [diff] [blame] | 358 | |
| 359 | stage('Install ONOS progRAN') { |
| 360 | timeout(10) { |
| 361 | sh returnStdout: true, script: """ |
| 362 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
| 363 | echo \$(pwd) |
| 364 | helm install -n onos-progran -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml cord/onos-progran |
| 365 | """ |
| 366 | } |
| 367 | timeout(10) { |
| 368 | waitUntil { |
| 369 | onos_progran_completed = sh returnStdout: true, script: """ |
| 370 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf && |
| 371 | kubectl get pods | grep -i onos-progran | grep -i running | grep 1/1 | wc -l |
| 372 | """ |
| 373 | return onos_progran_completed.toInteger() == 1 |
| 374 | } |
| 375 | } |
Matteo Scandolo | 8e1fc8a | 2019-02-15 14:50:27 -0800 | [diff] [blame] | 376 | timeout(2) { |
| 377 | sh returnStdout: true, script: """ |
| 378 | sshpass -p karaf ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30116 -l karaf ${deployment_config.nodes[0].ip} 'app deactivate org.onosproject.progran' |
| 379 | sshpass -p karaf ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30116 -l karaf ${deployment_config.nodes[0].ip} 'app activate org.onosproject.progran' |
| 380 | """ |
| 381 | } |
Wei-Yu Chen | 1a5f9ff | 2019-02-07 10:18:55 -0800 | [diff] [blame] | 382 | } |
| 383 | |
Matteo Scandolo | 202064f | 2019-01-24 15:01:39 -0800 | [diff] [blame] | 384 | stage('Install xos-core') { |
| 385 | timeout(10) { |
| 386 | sh returnStdout: true, script: """ |
| 387 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
Matteo Scandolo | 6c637ce | 2019-01-31 14:58:38 -0800 | [diff] [blame] | 388 | helm install -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml -n xos-core cord/xos-core --version 2.3.3 |
Matteo Scandolo | 202064f | 2019-01-24 15:01:39 -0800 | [diff] [blame] | 389 | """ |
| 390 | } |
| 391 | timeout(10) { |
| 392 | waitUntil { |
| 393 | xos_core_completed = sh returnStdout: true, script: """ |
| 394 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf && |
| 395 | kubectl get pods | grep -i xos | grep -i running | grep 1/1 | wc -l |
| 396 | """ |
| 397 | return xos_core_completed.toInteger() == 6 |
| 398 | } |
| 399 | } |
| 400 | } |
| 401 | stage('Install M-CORD Profile') { |
| 402 | timeout(10) { |
| 403 | sh returnStdout: true, script: """ |
| 404 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
| 405 | helm install -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml -n mcord cord/mcord |
| 406 | """ |
| 407 | } |
| 408 | timeout(10) { |
| 409 | waitUntil { |
| 410 | tosca_completed = sh returnStdout: true, script: """ |
| 411 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf && |
| 412 | kubectl get pods | grep -i mcord-tosca-loader | grep -i completed | wc -l |
| 413 | """ |
| 414 | return tosca_completed.toInteger() == 1 |
| 415 | } |
| 416 | } |
| 417 | } |
Luca Prete | 45401c8 | 2019-01-15 15:31:22 -0800 | [diff] [blame] | 418 | |
Matteo Scandolo | ef6e402 | 2019-01-25 14:40:10 -0800 | [diff] [blame] | 419 | // SEBA Begin |
| 420 | stage('Install SEBA Profile') { |
| 421 | timeout(10) { |
| 422 | sh returnStdout: true, script: """ |
| 423 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
Matteo Scandolo | 6c637ce | 2019-01-31 14:58:38 -0800 | [diff] [blame] | 424 | helm install -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml -n seba cord/seba-services --set fabric.enabled=false --set onos-service.enabled=false --version 1.0.5 |
Matteo Scandolo | ef6e402 | 2019-01-25 14:40:10 -0800 | [diff] [blame] | 425 | """ |
| 426 | } |
| 427 | timeout(10) { |
| 428 | waitUntil { |
| 429 | tosca_completed = sh returnStdout: true, script: """ |
| 430 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf && |
| 431 | kubectl get pods | grep -i seba-services-tosca-loader | grep -i completed | wc -l |
| 432 | """ |
| 433 | return tosca_completed.toInteger() == 1 |
| 434 | } |
| 435 | } |
| 436 | } |
| 437 | |
| 438 | stage('Install base-kubernetes') { |
| 439 | timeout(10) { |
| 440 | sh returnStdout: true, script: """ |
| 441 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
Matteo Scandolo | 6c637ce | 2019-01-31 14:58:38 -0800 | [diff] [blame] | 442 | helm install -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml -n base-kubernetes cord/base-kubernetes --version 1.0.2 |
Matteo Scandolo | ef6e402 | 2019-01-25 14:40:10 -0800 | [diff] [blame] | 443 | """ |
| 444 | } |
| 445 | timeout(10) { |
| 446 | waitUntil { |
| 447 | base_kubernetes_tosca_running = sh returnStdout: true, script: """ |
| 448 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf && |
| 449 | kubectl get pods | grep -i base-kubernetes-tosca-loader | grep -i completed | wc -l |
| 450 | """ |
| 451 | return base_kubernetes_tosca_running.toInteger() == 1 |
| 452 | } |
| 453 | } |
| 454 | } |
| 455 | |
| 456 | stage('Install att workflow') { |
| 457 | timeout(10) { |
| 458 | sh returnStdout: true, script: """ |
| 459 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
| 460 | helm install -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml --set att-workflow-driver.kafkaService=cord-kafka -n att-workflow --version 1.0.2 cord/att-workflow |
| 461 | """ |
| 462 | } |
| 463 | timeout(10) { |
| 464 | waitUntil { |
| 465 | att_workflow_tosca_completed = sh returnStdout: true, script: """ |
| 466 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf && |
| 467 | kubectl get pods | grep -i att-workflow-tosca-loader | grep -i completed | wc -l |
| 468 | """ |
| 469 | return att_workflow_tosca_completed.toInteger() == 1 |
| 470 | } |
| 471 | } |
| 472 | } |
| 473 | |
| 474 | stage('Install voltha') { |
| 475 | timeout(10) { |
| 476 | sh returnStdout: true, script: """ |
| 477 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
Matteo Scandolo | 6c637ce | 2019-01-31 14:58:38 -0800 | [diff] [blame] | 478 | helm install -n voltha -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml cord/voltha --set etcd.cluster.enabled=false --version 1.0.3 |
Matteo Scandolo | ef6e402 | 2019-01-25 14:40:10 -0800 | [diff] [blame] | 479 | """ |
| 480 | } |
| 481 | timeout(10) { |
| 482 | waitUntil { |
| 483 | voltha_completed = sh returnStdout: true, script: """ |
| 484 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf && |
| 485 | kubectl get pods -n voltha | grep -i running | grep 1/1 | wc -l |
| 486 | """ |
| 487 | return voltha_completed.toInteger() == 8 |
| 488 | } |
| 489 | } |
| 490 | } |
| 491 | // SEBA end |
| 492 | |
Luca Prete | 45401c8 | 2019-01-15 15:31:22 -0800 | [diff] [blame] | 493 | if ( params.configurePod ) { |
Matteo Scandolo | 202064f | 2019-01-24 15:01:39 -0800 | [diff] [blame] | 494 | dir ("${configBaseDir}/${configToscaDir}/mcord") { |
| 495 | stage('Configure MCORD - Fabric') { |
Luca Prete | 45401c8 | 2019-01-15 15:31:22 -0800 | [diff] [blame] | 496 | timeout(1) { |
| 497 | waitUntil { |
| 498 | out_fabric = sh returnStdout: true, script: """ |
| 499 | 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 |
| 500 | """ |
| 501 | return out_fabric.toInteger() == 1 |
| 502 | } |
| 503 | } |
| 504 | } |
Matteo Scandolo | ef6e402 | 2019-01-25 14:40:10 -0800 | [diff] [blame] | 505 | } |
| 506 | dir ("${configBaseDir}/${configToscaDir}/att-workflow") { |
| 507 | stage('Configure SEBA - Fabric and whitelist') { |
| 508 | timeout(1) { |
| 509 | waitUntil { |
| 510 | out_fabric = sh returnStdout: true, script: """ |
| 511 | 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 |
| 512 | """ |
| 513 | return out_fabric.toInteger() == 1 |
| 514 | } |
| 515 | } |
| 516 | } |
| 517 | stage('Configure SEBA - Subscriber') { |
| 518 | timeout(1) { |
| 519 | waitUntil { |
| 520 | out_subscriber = sh returnStdout: true, script: """ |
| 521 | 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 |
| 522 | """ |
| 523 | return out_subscriber.toInteger() == 1 |
| 524 | } |
| 525 | } |
| 526 | } |
| 527 | stage('Configure SEBA - OLT') { |
| 528 | timeout(1) { |
| 529 | waitUntil { |
| 530 | out_olt = sh returnStdout: true, script: """ |
| 531 | 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 |
| 532 | """ |
| 533 | return out_olt.toInteger() == 1 |
| 534 | } |
| 535 | } |
| 536 | } |
Luca Prete | 45401c8 | 2019-01-15 15:31:22 -0800 | [diff] [blame] | 537 | } |
| 538 | } |
| 539 | currentBuild.result = 'SUCCESS' |
| 540 | } catch (err) { |
Wei-Yu Chen | 1a5f9ff | 2019-02-07 10:18:55 -0800 | [diff] [blame] | 541 | println err.message |
Luca Prete | 45401c8 | 2019-01-15 15:31:22 -0800 | [diff] [blame] | 542 | currentBuild.result = 'FAILURE' |
| 543 | step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "${notificationEmail}", sendToIndividuals: false]) |
| 544 | } |
| 545 | echo "RESULT: ${currentBuild.result}" |
| 546 | } |
| 547 | } |