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