Kailash | 6f5acb6 | 2019-08-28 14:38:45 -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 | |
| 15 | node ("${TestNodeName}") { |
Suchitra Vemuri | b4f365f | 2020-03-27 15:09:36 -0700 | [diff] [blame] | 16 | def withKind = false |
Andy Bavier | af5883e | 2020-06-03 12:54:21 -0700 | [diff] [blame] | 17 | def VolthaEtcdPort = '2379' |
Suchitra Vemuri | b4f365f | 2020-03-27 15:09:36 -0700 | [diff] [blame] | 18 | if (params.withKind != null){ |
| 19 | withKind = params.withKind |
| 20 | } |
Andy Bavier | af5883e | 2020-06-03 12:54:21 -0700 | [diff] [blame] | 21 | if (params.VolthaEtcdPort != null){ |
| 22 | VolthaEtcdPort = params.VolthaEtcdPort |
| 23 | } |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 24 | timeout (100) { |
| 25 | try { |
| 26 | stage ("Parse deployment configuration file") { |
Suchitra Vemuri | b4f365f | 2020-03-27 15:09:36 -0700 | [diff] [blame] | 27 | sh returnStdout: true, script: "rm -rf ${configBaseDir} voltha-system-tests kind-voltha" |
Suchitra Vemuri | e514b8c | 2019-09-23 19:37:18 -0700 | [diff] [blame] | 28 | sh returnStdout: true, script: "git clone -b master ${cordRepoUrl}/${configBaseDir}" |
Suchitra Vemuri | b4f365f | 2020-03-27 15:09:36 -0700 | [diff] [blame] | 29 | sh returnStdout: true, script: "git clone -b ${branch} ${cordRepoUrl}/voltha-system-tests" |
Suchitra Vemuri | a956221 | 2020-04-10 19:32:03 -0700 | [diff] [blame] | 30 | sh returnStdout: true, script: "git clone -b master ${cordRepoUrl}/kind-voltha" |
Suchitra Vemuri | b4f365f | 2020-03-27 15:09:36 -0700 | [diff] [blame] | 31 | if ( params.workFlow == "DT" ) { |
| 32 | deployment_config = readYaml file: "${configBaseDir}/${configDeploymentDir}/${configFileName}-DT.yaml" |
| 33 | } |
Suchitra Vemuri | 32dea01 | 2020-07-08 16:40:06 -0700 | [diff] [blame] | 34 | else if ( params.workFlow == "TT" ) |
| 35 | { |
| 36 | deployment_config = readYaml file: "${configBaseDir}/${configDeploymentDir}/${configFileName}-TT.yaml" |
| 37 | } |
Suchitra Vemuri | b4f365f | 2020-03-27 15:09:36 -0700 | [diff] [blame] | 38 | else |
| 39 | { |
| 40 | deployment_config = readYaml file: "${configBaseDir}/${configDeploymentDir}/${configFileName}.yaml" |
| 41 | } |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 42 | } |
| 43 | stage('Clean up') { |
Suchitra Vemuri | 76261d0 | 2020-05-08 16:33:32 -0700 | [diff] [blame] | 44 | timeout(15) { |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 45 | sh returnStdout: true, script: """ |
| 46 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
Matteo Scandolo | 1294aeb | 2019-09-24 16:20:32 -0700 | [diff] [blame] | 47 | for hchart in \$(helm list -q | grep -E -v 'docker-registry|mavenrepo|ponnet'); |
| 48 | do |
| 49 | echo "Purging chart: \${hchart}" |
| 50 | helm delete --purge "\${hchart}" |
| 51 | done |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 52 | """ |
| 53 | timeout(5) { |
| 54 | waitUntil { |
| 55 | helm_deleted = sh returnStdout: true, script: """ |
| 56 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf && |
| 57 | helm ls -q | grep -E -v 'docker-registry|mavenrepo|ponnet' | wc -l |
| 58 | """ |
| 59 | return helm_deleted.toInteger() == 0 |
| 60 | } |
| 61 | } |
| 62 | timeout(5) { |
| 63 | waitUntil { |
| 64 | kubectl_deleted = sh returnStdout: true, script: """ |
| 65 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf && |
| 66 | kubectl get pods --all-namespaces --no-headers | grep -E -v 'kube-system|docker-registry|mavenrepo|ponnet' | wc -l |
| 67 | """ |
| 68 | return kubectl_deleted.toInteger() == 0 |
| 69 | } |
| 70 | } |
Suchitra Vemuri | b4f365f | 2020-03-27 15:09:36 -0700 | [diff] [blame] | 71 | timeout(1) { |
Hung-Wei Chiu | 2fa1562 | 2020-04-07 16:40:35 -0700 | [diff] [blame] | 72 | sh returnStdout: false, script: """ |
| 73 | #Remove all while true; do kubectl port-forward ...done; rules |
| 74 | for port_fwd_id in `ps -ax | grep "port-forward" | grep -E "onos|voltha" | grep "while true"| awk '{print \$1}'`; |
| 75 | do |
| 76 | cat /proc/\$port_fwd_id/cmdline |
| 77 | kill -9 \$port_fwd_id |
| 78 | done |
| 79 | |
| 80 | #Remove all kubectl port-forward rules |
| 81 | for port_fwd_id in `ps -ax | grep "port-forward" | grep -E "onos|voltha" | awk '{print \$1}'`; |
| 82 | do |
| 83 | cat /proc/\$port_fwd_id/cmdline |
| 84 | kill -9 \$port_fwd_id |
| 85 | done |
Suchitra Vemuri | b4f365f | 2020-03-27 15:09:36 -0700 | [diff] [blame] | 86 | """ |
| 87 | } |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 88 | } |
| 89 | } |
Suchitra Vemuri | 1934abc | 2019-11-05 12:41:11 -0800 | [diff] [blame] | 90 | stage('Install Voltha') { |
Suchitra Vemuri | 76261d0 | 2020-05-08 16:33:32 -0700 | [diff] [blame] | 91 | timeout(20) { |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 92 | sh returnStdout: true, script: """ |
| 93 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
| 94 | cd kind-voltha/ |
Andy Bavier | 4f23d9d | 2020-07-02 06:14:00 -0700 | [diff] [blame] | 95 | export EXTRA_HELM_FLAGS="" |
Suchitra Vemuri | b4f365f | 2020-03-27 15:09:36 -0700 | [diff] [blame] | 96 | if [ "${branch}" != "master" ]; then |
| 97 | cd $WORKSPACE/kind-voltha |
Andy Bavier | 4f23d9d | 2020-07-02 06:14:00 -0700 | [diff] [blame] | 98 | # The releases/ file also specifies EXTRA_HELM_FLAGS |
Suchitra Vemuri | b4f365f | 2020-03-27 15:09:36 -0700 | [diff] [blame] | 99 | source releases/${branch} |
Suchitra Vemuri | 1934abc | 2019-11-05 12:41:11 -0800 | [diff] [blame] | 100 | fi |
Andy Bavier | 4f23d9d | 2020-07-02 06:14:00 -0700 | [diff] [blame] | 101 | # Make sure that the EXTRA_HELM_FLAGS from the releases/ file appear at the end to override earlier values |
| 102 | export EXTRA_HELM_FLAGS="-f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/voltha/${configFileName}.yml \$EXTRA_HELM_FLAGS" |
Andy Bavier | 7cee6f4 | 2019-11-05 16:49:47 -0700 | [diff] [blame] | 103 | |
Andy Bavier | af5883e | 2020-06-03 12:54:21 -0700 | [diff] [blame] | 104 | # JENKINS_NODE_COOKIE=dontKillMe ask Jenkins doesn't kill the proces after this job. |
| 105 | # we want the `while true; do kubectl port-forward` keep alive |
| 106 | export JENKINS_NODE_COOKIE=dontKillMe |
| 107 | export NUM_OF_OPENONU=${NumOfOpenOnu} |
| 108 | export NUM_OF_ONOS=${NumOfOnos} |
| 109 | export NUM_OF_ATOMIX=${NumOfAtomix} |
Andy Bavier | 7cee6f4 | 2019-11-05 16:49:47 -0700 | [diff] [blame] | 110 | # VOL-2194 ONOS SSH and REST ports hardcoded to 30115/30120 in tests |
Andy Bavier | af5883e | 2020-06-03 12:54:21 -0700 | [diff] [blame] | 111 | export ONOS_SSH_PORT=30115 |
| 112 | export ONOS_API_PORT=30120 |
| 113 | export VOLTHA_LOG_LEVEL=DEBUG |
| 114 | export WITH_SIM_ADAPTERS=n |
| 115 | export DEPLOY_K8S=no |
| 116 | export INSTALL_KUBECTL=no |
| 117 | export INSTALL_HELM=no |
Matteo Scandolo | 1fdb2f8 | 2020-06-04 09:26:43 -0700 | [diff] [blame] | 118 | export WITH_RADIUS=yes |
Andy Bavier | af5883e | 2020-06-03 12:54:21 -0700 | [diff] [blame] | 119 | export FANCY=0 |
| 120 | # VOL-3162 Forwaring port 2379 does not work on ONF demo pod |
| 121 | export VOLTHA_ETCD_PORT=${VolthaEtcdPort} |
| 122 | |
Suchitra Vemuri | b4f365f | 2020-03-27 15:09:36 -0700 | [diff] [blame] | 123 | if [[ "${workFlow}" == "DT" ]]; then |
Andy Bavier | af5883e | 2020-06-03 12:54:21 -0700 | [diff] [blame] | 124 | WITH_EAPOL=no WITH_DHCP=no WITH_IGMP=no WITH_RADIUS=no ./voltha up |
Suchitra Vemuri | 32dea01 | 2020-07-08 16:40:06 -0700 | [diff] [blame] | 125 | elif [[ "${workFlow}" == "TT" ]]; then |
| 126 | WITH_EAPOL=no WITH_DHCP=no WITH_INCREMENTAL_EVTO_UPDATE=yes WITH_IGMP=yes WITH_RADIUS=no ./voltha up |
Suchitra Vemuri | b4f365f | 2020-03-27 15:09:36 -0700 | [diff] [blame] | 127 | else |
Andy Bavier | af5883e | 2020-06-03 12:54:21 -0700 | [diff] [blame] | 128 | ./voltha up |
Suchitra Vemuri | b4f365f | 2020-03-27 15:09:36 -0700 | [diff] [blame] | 129 | fi |
Andy Bavier | 7cee6f4 | 2019-11-05 16:49:47 -0700 | [diff] [blame] | 130 | |
Matteo Scandolo | 727c797 | 2020-04-13 13:09:25 -0700 | [diff] [blame] | 131 | kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\t'}{.image}{'\\n'}" | sort | uniq |
| 132 | kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\t'}{.imageID}{'\\n'}" | sort | uniq |
Suchitra Vemuri | 1934abc | 2019-11-05 12:41:11 -0800 | [diff] [blame] | 133 | kubectl get nodes -o wide |
| 134 | kubectl get pods -n voltha -o wide |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 135 | """ |
Suchitra Vemuri | 1934abc | 2019-11-05 12:41:11 -0800 | [diff] [blame] | 136 | } |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 137 | } |
Suchitra Vemuri | b4f365f | 2020-03-27 15:09:36 -0700 | [diff] [blame] | 138 | if ( withKind && deployment_config.fabric_switches.size() > 0 ) { |
| 139 | stage('OpenFlow port forward for aggregation switch') { |
| 140 | timeout(1) { |
| 141 | sh returnStdout: true, script: """ |
| 142 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
| 143 | #This uses the default route out, porperly configured is the management |
| 144 | mgmt_address=`ip route get 1 | awk '{print \$NF;exit}'` |
Andrea Campanella | c5f7db7 | 2020-05-08 10:58:11 +0200 | [diff] [blame] | 145 | JENKINS_NODE_COOKIE=dontkill kubectl port-forward -n default service/onos-onos-classic-hs --address=\$mgmt_address 6653:6653 >> /dev/null 2>&1 & |
Suchitra Vemuri | b4f365f | 2020-03-27 15:09:36 -0700 | [diff] [blame] | 146 | """ |
| 147 | } |
| 148 | } |
| 149 | } |
| 150 | if ( params.configurePod && params.profile != "Default" ) { |
Suchitra Vemuri | 7268009 | 2019-10-03 12:39:20 -0700 | [diff] [blame] | 151 | stage('Push Tech-Profile') { |
Andrea Campanella | bea0276 | 2020-04-23 10:59:08 +0200 | [diff] [blame] | 152 | for(int i=0; i < deployment_config.olts.size(); i++) { |
| 153 | def tech_prof_directory = "XGS-PON" |
| 154 | if (deployment_config.olts[i].oltDebVersion.contains("asgvolt64")){ |
| 155 | tech_prof_directory = "GPON" |
| 156 | } |
| 157 | timeout(1) { |
| 158 | out_push_tp = sh returnStatus: true, script: """ |
| 159 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
Suchitra Vemuri | 2d04590 | 2020-06-08 18:32:19 -0700 | [diff] [blame] | 160 | etcd_container=\$(kubectl get pods | grep etcd | awk 'NR==1{print \$1}') |
Suchitra Vemuri | 32dea01 | 2020-07-08 16:40:06 -0700 | [diff] [blame] | 161 | if [[ "${workFlow}" == "TT" ]]; then |
| 162 | kubectl cp $WORKSPACE/voltha-system-tests/tests/data/TechProfile-TT-HSIA.json \$etcd_container:/tmp/hsia.json |
| 163 | put_result=\$(kubectl exec -it \$etcd_container -- /bin/sh -c 'cat /tmp/hsia.json | ETCDCTL_API=3 etcdctl put service/voltha/technology_profiles/${tech_prof_directory}/64') |
| 164 | kubectl cp $WORKSPACE/voltha-system-tests/tests/data/TechProfile-TT-VoIP.json \$etcd_container:/tmp/voip.json |
| 165 | put_result=\$(kubectl exec -it \$etcd_container -- /bin/sh -c 'cat /tmp/voip.json | ETCDCTL_API=3 etcdctl put service/voltha/technology_profiles/${tech_prof_directory}/65') |
| 166 | kubectl cp $WORKSPACE/voltha-system-tests/tests/data/TechProfile-TT-MCAST.json \$etcd_container:/tmp/mcast.json |
| 167 | put_result=\$(kubectl exec -it \$etcd_container -- /bin/sh -c 'cat /tmp/mcast.json | ETCDCTL_API=3 etcdctl put service/voltha/technology_profiles/${tech_prof_directory}/66') |
| 168 | else |
| 169 | kubectl cp $WORKSPACE/voltha-system-tests/tests/data/TechProfile-${profile}.json \$etcd_container:/tmp/flexpod.json |
| 170 | put_result=\$(kubectl exec -it \$etcd_container -- /bin/sh -c 'cat /tmp/flexpod.json | ETCDCTL_API=3 etcdctl put service/voltha/technology_profiles/${tech_prof_directory}/64') |
| 171 | fi |
| 172 | |
Andrea Campanella | bea0276 | 2020-04-23 10:59:08 +0200 | [diff] [blame] | 173 | """ |
| 174 | return out_push_tp == 0 |
| 175 | } |
| 176 | timeout(1) { |
| 177 | out_get_tp = sh returnStatus: true, script: """ |
Andrea Campanella | 85b0a8d | 2020-05-14 12:56:47 +0200 | [diff] [blame] | 178 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
Suchitra Vemuri | 2d04590 | 2020-06-08 18:32:19 -0700 | [diff] [blame] | 179 | etcd_container=\$(kubectl get pods | grep etcd | awk 'NR==1{print \$1}') |
| 180 | get_result=\$(kubectl exec -it \$etcd_container -- /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/voltha/technology_profiles/${tech_prof_directory}/64') |
Andrea Campanella | bea0276 | 2020-04-23 10:59:08 +0200 | [diff] [blame] | 181 | """ |
| 182 | return out_get_tp == 0 |
| 183 | } |
Suchitra Vemuri | 7268009 | 2019-10-03 12:39:20 -0700 | [diff] [blame] | 184 | } |
hwchiu | c77c7d2 | 2019-10-18 13:58:35 -0700 | [diff] [blame] | 185 | } |
| 186 | } |
| 187 | stage('Push Sadis-config') { |
| 188 | timeout(1) { |
| 189 | sadis_out = sh returnStatus: true, script: """ |
Suchitra Vemuri | 992377e | 2020-06-20 18:03:49 -0700 | [diff] [blame] | 190 | export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
| 191 | etcd_container=\$(kubectl get pods | grep etcd | awk 'NR==1{print \$1}') |
| 192 | kubectl cp $WORKSPACE/voltha-system-tests/tests/data/MIB_Alpha.json \$etcd_container:/tmp/MIB_Alpha.json |
| 193 | put_result=\$(kubectl exec -it \$etcd_container -- /bin/sh -c 'cat /tmp/MIB_Alpha.json | ETCDCTL_API=3 etcdctl put service/voltha/omci_mibs/templates/BRCM/BVM4K00BRA0915-0083/5023_020O02414') |
Suchitra Vemuri | b4f365f | 2020-03-27 15:09:36 -0700 | [diff] [blame] | 194 | if [[ "${workFlow}" == "DT" ]]; then |
| 195 | curl -sSL --user karaf:karaf -X POST -H Content-Type:application/json http://${deployment_config.nodes[0].ip}:30120/onos/v1/network/configuration --data @$WORKSPACE/voltha-system-tests/tests/data/${configFileName}-sadis-DT.json |
Suchitra Vemuri | 32dea01 | 2020-07-08 16:40:06 -0700 | [diff] [blame] | 196 | elif [[ "${workFlow}" == "TT" ]]; then |
| 197 | curl -sSL --user karaf:karaf -X POST -H Content-Type:application/json http://${deployment_config.nodes[0].ip}:30120/onos/v1/network/configuration --data @$WORKSPACE/voltha-system-tests/tests/data/${configFileName}-sadis-TT.json |
Suchitra Vemuri | b4f365f | 2020-03-27 15:09:36 -0700 | [diff] [blame] | 198 | else |
Suchitra Vemuri | 7268009 | 2019-10-03 12:39:20 -0700 | [diff] [blame] | 199 | curl -sSL --user karaf:karaf -X POST -H Content-Type:application/json http://${deployment_config.nodes[0].ip}:30120/onos/v1/network/configuration --data @$WORKSPACE/voltha-system-tests/tests/data/${configFileName}-sadis.json |
Suchitra Vemuri | b4f365f | 2020-03-27 15:09:36 -0700 | [diff] [blame] | 200 | fi |
| 201 | """ |
| 202 | return sadis_out == 0 |
You Wang | b9526e6 | 2019-10-07 15:25:48 -0700 | [diff] [blame] | 203 | } |
hwchiu | c77c7d2 | 2019-10-18 13:58:35 -0700 | [diff] [blame] | 204 | } |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 205 | if ( params.reinstallOlt ) { |
| 206 | stage('Reinstall OLT software') { |
| 207 | for(int i=0; i < deployment_config.olts.size(); i++) { |
| 208 | sh returnStdout: true, script: """ |
Suchitra Vemuri | 66174b0 | 2020-05-14 16:44:28 -0700 | [diff] [blame] | 209 | if [ "${branch}" != "master" ]; then |
| 210 | sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} "dpkg --install ${deployment_config.olts[i].oltDebVersion23}" |
| 211 | else |
| 212 | sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} "dpkg --install ${deployment_config.olts[i].oltDebVersion}" |
| 213 | fi |
Suchitra Vemuri | b4f365f | 2020-03-27 15:09:36 -0700 | [diff] [blame] | 214 | sleep 10 |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 215 | """ |
| 216 | timeout(5) { |
| 217 | waitUntil { |
| 218 | olt_sw_present = sh returnStdout: true, script: """ |
Suchitra Vemuri | 66174b0 | 2020-05-14 16:44:28 -0700 | [diff] [blame] | 219 | if [[ "${deployment_config.olts[i].oltDebVersion}" == *"asfvolt16-2.4"* ]] || [[ "${deployment_config.olts[i].oltDebVersion23}" == *"asfvolt16-2.4"* ]]; then |
Andrea Campanella | ce9e990 | 2020-04-07 18:29:42 +0200 | [diff] [blame] | 220 | 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' |
| 221 | else |
| 222 | sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} 'dpkg --list | grep asgvolt64 | wc -l' |
| 223 | fi |
Suchitra Vemuri | 66174b0 | 2020-05-14 16:44:28 -0700 | [diff] [blame] | 224 | if (${deployment_config.olts[i].fortygig}); then |
| 225 | if [[ "${deployment_config.olts[i].oltDebVersion}" == *"asfvolt16-2.4"* ]] || [[ "${deployment_config.olts[i].oltDebVersion23}" == *"asfvolt16-2.4"* ]]; then |
| 226 | sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} 'echo "port ce128 sp=40000 if=XLAUI" >> /broadcom/qax.soc' |
| 227 | else |
| 228 | 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' |
| 229 | fi |
Suchitra Vemuri | b4f365f | 2020-03-27 15:09:36 -0700 | [diff] [blame] | 230 | fi |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 231 | """ |
Andrea Campanella | ce9e990 | 2020-04-07 18:29:42 +0200 | [diff] [blame] | 232 | return olt_sw_present.toInteger() > 0 |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 233 | } |
| 234 | } |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 235 | } |
| 236 | } |
Suchitra Vemuri | b4f365f | 2020-03-27 15:09:36 -0700 | [diff] [blame] | 237 | stage('Restart OLT processes') { |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 238 | for(int i=0; i < deployment_config.olts.size(); i++) { |
| 239 | timeout(5) { |
| 240 | sh returnStdout: true, script: """ |
| 241 | ssh-keyscan -H ${deployment_config.olts[i].ip} >> ~/.ssh/known_hosts |
Andy Bavier | 1923ecc | 2020-06-18 14:06:40 -0700 | [diff] [blame] | 242 | sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} 'rm -f /var/log/openolt.log; rm -f /var/log/dev_mgmt_daemon.log; reboot' || true |
Suchitra Vemuri | b4f365f | 2020-03-27 15:09:36 -0700 | [diff] [blame] | 243 | sleep 120 |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 244 | """ |
| 245 | } |
| 246 | timeout(15) { |
| 247 | waitUntil { |
Suchitra Vemuri | b4f365f | 2020-03-27 15:09:36 -0700 | [diff] [blame] | 248 | devprocess = sh returnStdout: true, script: "sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} 'ps -ef | grep dev_mgmt_daemon | wc -l'" |
| 249 | return devprocess.toInteger() > 0 |
| 250 | } |
| 251 | } |
| 252 | timeout(15) { |
| 253 | waitUntil { |
| 254 | openoltprocess = sh returnStdout: true, script: "sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} 'ps -ef | grep openolt | wc -l'" |
| 255 | return openoltprocess.toInteger() > 0 |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 256 | } |
| 257 | } |
| 258 | } |
| 259 | } |
| 260 | } |
Matteo Scandolo | 1294aeb | 2019-09-24 16:20:32 -0700 | [diff] [blame] | 261 | if ( deployment_config.fabric_switches.size() > 0 ) { |
You Wang | 25e5861 | 2019-10-01 16:30:28 -0700 | [diff] [blame] | 262 | stage('Switch Configurations in ONOS') { |
| 263 | timeout(1) { |
Andrea Campanella | 817dfb8 | 2020-05-21 12:00:28 +0200 | [diff] [blame] | 264 | def netcfg = "$WORKSPACE/${configBaseDir}/${configToscaDir}/voltha/${configFileName}-onos-netcfg-switch.json" |
| 265 | if (params.inBandManagement){ |
| 266 | netcfg = "$WORKSPACE/${configBaseDir}/${configToscaDir}/voltha/${configFileName}-onos-netcfg-switch-inband.json" |
| 267 | } |
You Wang | 25e5861 | 2019-10-01 16:30:28 -0700 | [diff] [blame] | 268 | netcfg_out = sh returnStatus: true, script: """ |
Andrea Campanella | 817dfb8 | 2020-05-21 12:00:28 +0200 | [diff] [blame] | 269 | curl -sSL --user karaf:karaf -X POST -H Content-Type:application/json http://${deployment_config.nodes[0].ip}:30120/onos/v1/network/configuration --data @${netcfg} |
You Wang | 25e5861 | 2019-10-01 16:30:28 -0700 | [diff] [blame] | 270 | curl -sSL --user karaf:karaf -X POST http://${deployment_config.nodes[0].ip}:30120/onos/v1/applications/org.onosproject.segmentrouting/active |
Suchitra Vemuri | b4f365f | 2020-03-27 15:09:36 -0700 | [diff] [blame] | 271 | |
You Wang | 25e5861 | 2019-10-01 16:30:28 -0700 | [diff] [blame] | 272 | """ |
| 273 | return netcfg_out == 0 |
| 274 | } |
| 275 | timeout(1) { |
| 276 | waitUntil { |
| 277 | sr_active_out = sh returnStatus: true, script: """ |
You Wang | eb76aeb | 2019-12-09 22:08:23 -0800 | [diff] [blame] | 278 | ssh-keygen -R [${deployment_config.nodes[0].ip}]:30115 |
Suchitra Vemuri | c325726 | 2019-12-05 19:06:42 -0800 | [diff] [blame] | 279 | ssh-keyscan -p 30115 -H ${deployment_config.nodes[0].ip} >> ~/.ssh/known_hosts |
| 280 | sshpass -p karaf ssh -p 30115 karaf@${deployment_config.nodes[0].ip} "log:set TRACE org.opencord.dhcpl2relay" |
| 281 | sshpass -p karaf ssh -p 30115 karaf@${deployment_config.nodes[0].ip} "log:set TRACE org.opencord.aaa" |
| 282 | sshpass -p karaf ssh -p 30115 karaf@${deployment_config.nodes[0].ip} "log:set TRACE org.opencord.olt" |
You Wang | 25e5861 | 2019-10-01 16:30:28 -0700 | [diff] [blame] | 283 | curl -sSL --user karaf:karaf -X GET http://${deployment_config.nodes[0].ip}:30120/onos/v1/applications/org.onosproject.segmentrouting | jq '.state' | grep ACTIVE |
Suchitra Vemuri | b4f365f | 2020-03-27 15:09:36 -0700 | [diff] [blame] | 284 | sshpass -p karaf ssh -p 30115 karaf@${deployment_config.nodes[0].ip} "cfg set org.onosproject.net.flow.impl.FlowRuleManager purgeOnDisconnection false" |
Andrea Campanella | 086bcbb | 2020-04-01 09:56:23 +0200 | [diff] [blame] | 285 | sshpass -p karaf ssh -p 30115 karaf@${deployment_config.nodes[0].ip} "cfg set org.onosproject.net.meter.impl.MeterManager purgeOnDisconnection false" |
You Wang | 25e5861 | 2019-10-01 16:30:28 -0700 | [diff] [blame] | 286 | """ |
| 287 | return sr_active_out == 0 |
| 288 | } |
| 289 | } |
Andrea Campanella | bea0276 | 2020-04-23 10:59:08 +0200 | [diff] [blame] | 290 | timeout(5) { |
You Wang | 25e5861 | 2019-10-01 16:30:28 -0700 | [diff] [blame] | 291 | for(int i=0; i < deployment_config.hosts.src.size(); i++) { |
Andrea Campanella | bea0276 | 2020-04-23 10:59:08 +0200 | [diff] [blame] | 292 | def aggPort = -1 |
| 293 | for(int j=0; j < deployment_config.olts.size(); j++) { |
| 294 | if(deployment_config.olts[j].serial == deployment_config.hosts.src[j].olt){ |
| 295 | aggPort = deployment_config.olts[j].aggPort |
| 296 | } |
| 297 | } |
| 298 | if(aggPort == -1){ |
| 299 | throw new Exception("Upstream port for the olt is not configured, field aggPort is empty") |
| 300 | } |
You Wang | 25e5861 | 2019-10-01 16:30:28 -0700 | [diff] [blame] | 301 | xconnect_out = sh returnStatus: true, script: """ |
Suchitra Vemuri | 992377e | 2020-06-20 18:03:49 -0700 | [diff] [blame] | 302 | sleep 30 |
Suchitra Vemuri | f82086d | 2020-01-16 19:55:16 -0800 | [diff] [blame] | 303 | version=\$(sshpass -p karaf ssh -p 30115 karaf@${deployment_config.nodes[0].ip} "summary" | grep version) |
Suchitra Vemuri | b4f365f | 2020-03-27 15:09:36 -0700 | [diff] [blame] | 304 | sleep 10 |
Suchitra Vemuri | f82086d | 2020-01-16 19:55:16 -0800 | [diff] [blame] | 305 | if [[ \$version == *"version=2.2"* ]]; then |
Andrea Campanella | bea0276 | 2020-04-23 10:59:08 +0200 | [diff] [blame] | 306 | curl -X POST --user karaf:karaf --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{"deviceId": "${deployment_config.fabric_switches[0].device_id}", "vlanId": "${deployment_config.hosts.src[i].s_tag}", "endpoints": [${deployment_config.fabric_switches[0].bngPort},${aggPort}]}' 'http://${deployment_config.nodes[0].ip}:30120/onos/segmentrouting/xconnect' |
Suchitra Vemuri | f82086d | 2020-01-16 19:55:16 -0800 | [diff] [blame] | 307 | else |
Andrea Campanella | bea0276 | 2020-04-23 10:59:08 +0200 | [diff] [blame] | 308 | curl -X POST --user karaf:karaf --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{"deviceId": "${deployment_config.fabric_switches[0].device_id}", "vlanId": "${deployment_config.hosts.src[i].s_tag}", "ports": [${deployment_config.fabric_switches[0].bngPort},${aggPort}]}' 'http://${deployment_config.nodes[0].ip}:30120/onos/segmentrouting/xconnect' |
Suchitra Vemuri | f82086d | 2020-01-16 19:55:16 -0800 | [diff] [blame] | 309 | fi |
You Wang | 25e5861 | 2019-10-01 16:30:28 -0700 | [diff] [blame] | 310 | """ |
| 311 | } |
| 312 | } |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 313 | } |
Matteo Scandolo | 1294aeb | 2019-09-24 16:20:32 -0700 | [diff] [blame] | 314 | } |
Suchitra Vemuri | 36b3569 | 2020-07-15 11:48:47 -0700 | [diff] [blame] | 315 | if ( params.inBandManagement ) { |
Suchitra Vemuri | aa99e4c | 2020-07-15 14:33:03 -0700 | [diff] [blame^] | 316 | stage('Reboot OLT') { |
Suchitra Vemuri | 36b3569 | 2020-07-15 11:48:47 -0700 | [diff] [blame] | 317 | for(int i=0; i < deployment_config.olts.size(); i++) { |
| 318 | timeout(5) { |
| 319 | sh returnStdout: true, script: """ |
| 320 | ssh-keyscan -H ${deployment_config.olts[i].sship} >> ~/.ssh/known_hosts |
| 321 | sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].sship} 'rm -f /var/log/openolt.log; rm -f /var/log/dev_mgmt_daemon.log; reboot' || true |
| 322 | sleep 300 |
| 323 | """ |
| 324 | } |
| 325 | timeout(15) { |
| 326 | waitUntil { |
| 327 | devprocess = sh returnStdout: true, script: "sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].sship} 'ps -ef | grep dev_mgmt_daemon | wc -l'" |
| 328 | return devprocess.toInteger() > 0 |
| 329 | } |
| 330 | } |
| 331 | timeout(15) { |
| 332 | waitUntil { |
| 333 | openoltprocess = sh returnStdout: true, script: "sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].sship} 'ps -ef | grep openolt | wc -l'" |
| 334 | return openoltprocess.toInteger() > 0 |
| 335 | } |
| 336 | } |
| 337 | } |
| 338 | } |
| 339 | } |
| 340 | |
Kailash | 6f5acb6 | 2019-08-28 14:38:45 -0700 | [diff] [blame] | 341 | currentBuild.result = 'SUCCESS' |
| 342 | } catch (err) { |
| 343 | currentBuild.result = 'FAILURE' |
| 344 | step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "${notificationEmail}", sendToIndividuals: false]) |
| 345 | throw err |
| 346 | } |
| 347 | echo "RESULT: ${currentBuild.result}" |
| 348 | } |
| 349 | } |