| // Copyright 2017-present Open Networking Foundation |
| // |
| // Licensed under the Apache License, Version 2.0 (the "License"); |
| // you may not use this file except in compliance with the License. |
| // You may obtain a copy of the License at |
| // |
| // http://www.apache.org/licenses/LICENSE-2.0 |
| // |
| // Unless required by applicable law or agreed to in writing, software |
| // distributed under the License is distributed on an "AS IS" BASIS, |
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| // See the License for the specific language governing permissions and |
| // limitations under the License. |
| |
| node ("${TestNodeName}") { |
| def withKind = false |
| def VolthaEtcdPort = '2379' |
| if (params.withKind != null){ |
| withKind = params.withKind |
| } |
| if (params.VolthaEtcdPort != null){ |
| VolthaEtcdPort = params.VolthaEtcdPort |
| } |
| timeout (100) { |
| try { |
| stage ("Parse deployment configuration file") { |
| sh returnStdout: true, script: "rm -rf ${configBaseDir} voltha-system-tests kind-voltha" |
| sh returnStdout: true, script: "git clone -b master ${cordRepoUrl}/${configBaseDir}" |
| sh returnStdout: true, script: "git clone -b ${branch} ${cordRepoUrl}/voltha-system-tests" |
| sh returnStdout: true, script: "git clone -b master ${cordRepoUrl}/kind-voltha" |
| if ( params.workFlow == "DT" ) { |
| deployment_config = readYaml file: "${configBaseDir}/${configDeploymentDir}/${configFileName}-DT.yaml" |
| } |
| else if ( params.workFlow == "TT" ) |
| { |
| deployment_config = readYaml file: "${configBaseDir}/${configDeploymentDir}/${configFileName}-TT.yaml" |
| } |
| else |
| { |
| deployment_config = readYaml file: "${configBaseDir}/${configDeploymentDir}/${configFileName}.yaml" |
| } |
| } |
| stage('Clean up') { |
| timeout(15) { |
| sh returnStdout: true, script: """ |
| echo "cleaning up" |
| export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
| HELM_MAJOR=\$(helm version --client --short | sed -E -e 's/^.*v([0-9]+)\\.[0-9]+\\.[0-9]+.*\$/\\1/') |
| for hchart in \$(helm list -q | grep -E -v 'docker-registry|mavenrepo|ponnet|local-path-storage|cattle'); |
| do |
| echo "Purging chart: \${hchart}" |
| if [ \$HELM_MAJOR -le 2 ]; then |
| helm delete --purge "\${hchart}" |
| else |
| helm uninstall "\${hchart}" |
| fi |
| done |
| if [ \$HELM_MAJOR -gt 2 ]; then |
| for hchart in \$(helm list -q -n voltha | grep -E -v 'docker-registry|mavenrepo|ponnet|local-path-storage|cattle'); |
| do |
| echo "Purging chart: \${hchart}" |
| if [ \$HELM_MAJOR -le 2 ]; then |
| helm delete --purge "\${hchart}" |
| else |
| helm uninstall -n voltha "\${hchart}" |
| fi |
| done |
| fi |
| """ |
| timeout(5) { |
| waitUntil { |
| helm_deleted = sh returnStdout: true, script: """ |
| |
| export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
| HELM_MAJOR=\$(helm version --client --short | sed -E -e 's/^.*v([0-9]+)\\.[0-9]+\\.[0-9]+.*\$/\\1/') |
| |
| if [ \$HELM_MAJOR -le 2 ]; then |
| helm list -q | grep -E -v 'docker-registry|mavenrepo|ponnet|local-path-storage|cattle' | wc -l |
| else |
| helm list -q --all-namespaces | grep -E -v 'docker-registry|mavenrepo|ponnet|local-path-storage|cattle' | wc -l |
| fi |
| """ |
| return helm_deleted.toInteger() == 0 |
| } |
| } |
| timeout(5) { |
| waitUntil { |
| kubectl_deleted = sh returnStdout: true, script: """ |
| export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf && |
| kubectl get pods --all-namespaces --no-headers | grep -E -v 'kube-system|docker-registry|mavenrepo|ponnet|local-path-storage|cattle' | wc -l |
| """ |
| return kubectl_deleted.toInteger() == 0 |
| } |
| } |
| timeout(1) { |
| sh returnStdout: false, script: """ |
| #Remove all while true; do kubectl port-forward ...done; rules |
| for port_fwd_id in `ps -ax | grep "port-forward" | grep -E "onos|voltha" | grep "while true"| awk '{print \$1}'`; |
| do |
| kill -9 \$port_fwd_id || true |
| done |
| |
| #Remove all kubectl port-forward rules |
| for port_fwd_id in `ps -ax | grep "port-forward" | grep -E "onos|voltha" | awk '{print \$1}'`; |
| do |
| kill -9 \$port_fwd_id || true |
| done |
| """ |
| } |
| } |
| } |
| stage('Install Voltha') { |
| timeout(20) { |
| sh returnStdout: true, script: """ |
| export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
| cd kind-voltha/ |
| export EXTRA_HELM_FLAGS="" |
| if [ "${branch}" != "master" ]; then |
| cd $WORKSPACE/kind-voltha |
| # The releases/ file also specifies EXTRA_HELM_FLAGS |
| source releases/${branch} |
| fi |
| # Make sure that the EXTRA_HELM_FLAGS from the releases/ file appear at the end to override earlier values |
| export EXTRA_HELM_FLAGS="-f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/voltha/${configFileName}.yml \$EXTRA_HELM_FLAGS" |
| |
| # JENKINS_NODE_COOKIE=dontKillMe ask Jenkins doesn't kill the proces after this job. |
| # we want the `while true; do kubectl port-forward` keep alive |
| export JENKINS_NODE_COOKIE=dontKillMe |
| export NUM_OF_OPENONU=${NumOfOpenOnu} |
| export NUM_OF_ONOS=${NumOfOnos} |
| export NUM_OF_ATOMIX=${NumOfAtomix} |
| # VOL-2194 ONOS SSH and REST ports hardcoded to 30115/30120 in tests |
| export ONOS_SSH_PORT=30115 |
| export ONOS_API_PORT=30120 |
| export VOLTHA_LOG_LEVEL=DEBUG |
| export WITH_SIM_ADAPTERS=n |
| export DEPLOY_K8S=no |
| export INSTALL_KUBECTL=no |
| export INSTALL_HELM=no |
| export WITH_RADIUS=yes |
| export FANCY=0 |
| export SCHEDULE_ON_CONTROL_NODES=yes |
| # VOL-3162 Forwaring port 2379 does not work on ONF demo pod |
| export VOLTHA_ETCD_PORT=${VolthaEtcdPort} |
| |
| if [[ "${workFlow}" == "DT" ]]; then |
| WITH_EAPOL=no WITH_DHCP=no WITH_IGMP=no WITH_RADIUS=no ./voltha up |
| elif [[ "${workFlow}" == "TT" ]]; then |
| WITH_EAPOL=no WITH_DHCP=yes WITH_INCREMENTAL_EVTO_UPDATE=yes WITH_IGMP=yes WITH_RADIUS=no ./voltha up |
| else |
| ./voltha up |
| fi |
| |
| kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\t'}{.image}{'\\n'}" | sort | uniq |
| kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\t'}{.imageID}{'\\n'}" | sort | uniq |
| kubectl get nodes -o wide |
| kubectl get pods -n voltha -o wide |
| kubectl get pods |
| """ |
| } |
| } |
| if ( withKind && deployment_config.fabric_switches.size() > 0 ) { |
| stage('OpenFlow port forward for aggregation switch') { |
| timeout(1) { |
| sh returnStdout: true, script: """ |
| export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
| #This uses the default route out, porperly configured is the management |
| mgmt_address=`ip route get 1 | awk '{print \$NF;exit}'` |
| JENKINS_NODE_COOKIE=dontkill kubectl port-forward -n default service/onos-onos-classic-hs --address=\$mgmt_address 6653:6653 >> /dev/null 2>&1 & |
| """ |
| } |
| } |
| } |
| if ( params.configurePod && params.profile != "Default" ) { |
| stage('Push Tech-Profile') { |
| for(int i=0; i < deployment_config.olts.size(); i++) { |
| def tech_prof_directory = "XGS-PON" |
| if (deployment_config.olts[i].oltDebVersion.contains("asgvolt64")){ |
| tech_prof_directory = "GPON" |
| } |
| timeout(1) { |
| out_push_tp = sh returnStatus: true, script: """ |
| export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
| etcd_container=\$(kubectl get pods | grep etcd | awk 'NR==1{print \$1}') |
| if [[ "${workFlow}" == "TT" ]]; then |
| kubectl cp $WORKSPACE/voltha-system-tests/tests/data/TechProfile-TT-HSIA.json \$etcd_container:/tmp/hsia.json |
| 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') |
| kubectl cp $WORKSPACE/voltha-system-tests/tests/data/TechProfile-TT-VoIP.json \$etcd_container:/tmp/voip.json |
| 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') |
| kubectl cp $WORKSPACE/voltha-system-tests/tests/data/TechProfile-TT-MCAST.json \$etcd_container:/tmp/mcast.json |
| 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') |
| else |
| kubectl cp $WORKSPACE/voltha-system-tests/tests/data/TechProfile-${profile}.json \$etcd_container:/tmp/flexpod.json |
| 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') |
| fi |
| |
| """ |
| return out_push_tp == 0 |
| } |
| timeout(1) { |
| out_get_tp = sh returnStatus: true, script: """ |
| export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
| etcd_container=\$(kubectl get pods | grep etcd | awk 'NR==1{print \$1}') |
| get_result=\$(kubectl exec -it \$etcd_container -- /bin/sh -c 'ETCDCTL_API=3 etcdctl get --prefix service/voltha/technology_profiles/${tech_prof_directory}/64') |
| """ |
| return out_get_tp == 0 |
| } |
| } |
| } |
| } |
| stage('Push Sadis-config') { |
| timeout(1) { |
| sadis_out = sh returnStatus: true, script: """ |
| export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf |
| etcd_container=\$(kubectl get pods | grep etcd | awk 'NR==1{print \$1}') |
| kubectl cp $WORKSPACE/voltha-system-tests/tests/data/MIB_Alpha.json \$etcd_container:/tmp/MIB_Alpha.json |
| 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') |
| kubectl cp $WORKSPACE/voltha-system-tests/tests/data/MIB_Scom.json \$etcd_container:/tmp/MIB_Scom.json |
| 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') |
| if [[ "${workFlow}" == "DT" ]]; then |
| 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 |
| elif [[ "${workFlow}" == "TT" ]]; then |
| 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 |
| else |
| 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 |
| fi |
| """ |
| return sadis_out == 0 |
| } |
| } |
| if ( deployment_config.fabric_switches.size() > 0 ) { |
| stage('Switch Configurations in ONOS') { |
| timeout(1) { |
| def netcfg = "$WORKSPACE/${configBaseDir}/${configToscaDir}/voltha/${configFileName}-onos-netcfg-switch.json" |
| if (params.inBandManagement){ |
| netcfg = "$WORKSPACE/${configBaseDir}/${configToscaDir}/voltha/${configFileName}-onos-netcfg-switch-inband.json" |
| } |
| netcfg_out = sh returnStatus: true, script: """ |
| 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} |
| curl -sSL --user karaf:karaf -X POST http://${deployment_config.nodes[0].ip}:30120/onos/v1/applications/org.onosproject.segmentrouting/active |
| |
| """ |
| return netcfg_out == 0 |
| } |
| timeout(1) { |
| waitUntil { |
| sr_active_out = sh returnStatus: true, script: """ |
| 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" |
| 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" |
| 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" |
| 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" |
| 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" |
| curl -sSL --user karaf:karaf -X GET http://${deployment_config.nodes[0].ip}:30120/onos/v1/applications/org.onosproject.segmentrouting | jq '.state' | grep ACTIVE |
| 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" |
| 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" |
| """ |
| return sr_active_out == 0 |
| } |
| } |
| timeout(5) { |
| for(int i=0; i < deployment_config.hosts.src.size(); i++) { |
| for(int j=0; j < deployment_config.olts.size(); j++) { |
| def aggPort = -1 |
| if(deployment_config.olts[j].serial == deployment_config.hosts.src[i].olt){ |
| aggPort = deployment_config.olts[j].aggPort |
| if(aggPort == -1){ |
| throw new Exception("Upstream port for the olt is not configured, field aggPort is empty") |
| } |
| xconnect_out = sh returnStatus: true, script: """ |
| sleep 30 |
| version=\$(sshpass -p karaf ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@${deployment_config.nodes[0].ip} "summary" | grep version) |
| sleep 10 |
| if [[ \$version == *"version=2.2"* ]]; then |
| 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' |
| else |
| 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' |
| fi |
| """ |
| } |
| |
| } |
| } |
| } |
| } |
| } |
| if ( params.reinstallOlt ) { |
| stage('Reinstall OLT software') { |
| for(int i=0; i < deployment_config.olts.size(); i++) { |
| sh returnStdout: true, script: """ |
| if [[ "${branch}" != "master" ]] && [[ "${params.inBandManagement}" == "true" ]]; then |
| ssh-keyscan -H ${deployment_config.olts[i].sship} >> ~/.ssh/known_hosts |
| sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].sship} 'kill -9 `pgrep -f "[b]ash /opt/openolt/openolt_dev_mgmt_daemon_process_watchdog"` || true' |
| sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].sship} "dpkg --install ${deployment_config.olts[i].oltDebVersion23}" |
| fi |
| if [[ "${branch}" != "master" ]] && [[ "${params.inBandManagement}" == "false" ]]; then |
| ssh-keyscan -H ${deployment_config.olts[i].sship} >> ~/.ssh/known_hosts |
| sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].sship} "dpkg --install ${deployment_config.olts[i].oltDebVersion23}" |
| fi |
| if [[ "${branch}" == "master" ]] && [[ "${params.inBandManagement}" == "true" ]]; then |
| ssh-keyscan -H ${deployment_config.olts[i].sship} >> ~/.ssh/known_hosts |
| sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].sship} 'kill -9 `pgrep -f "[b]ash /opt/openolt/openolt_dev_mgmt_daemon_process_watchdog"` || true' |
| sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].sship} "dpkg --install ${deployment_config.olts[i].oltDebVersion}" |
| fi |
| if [[ "${branch}" == "master" ]] && [[ "${params.inBandManagement}" == "false" ]]; then |
| ssh-keyscan -H ${deployment_config.olts[i].sship} >> ~/.ssh/known_hosts |
| sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].sship} "dpkg --install ${deployment_config.olts[i].oltDebVersion}" |
| fi |
| sleep 10 |
| """ |
| timeout(5) { |
| waitUntil { |
| olt_sw_present = sh returnStdout: true, script: """ |
| if [ "${deployment_config.olts[i].oltDebVersion}" == *"asfvolt16"* ]; then |
| sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].sship} 'dpkg --list | grep asfvolt16 | wc -l' |
| else |
| sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].sship} 'dpkg --list | grep asgvolt64 | wc -l' |
| fi |
| if (${deployment_config.olts[i].fortygig}); then |
| if [[ "${params.inBandManagement}" == "true" ]]; then |
| ssh-keyscan -H ${deployment_config.olts[i].sship} >> ~/.ssh/known_hosts |
| sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].sship} 'mkdir -p /opt/openolt/' |
| sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].sship} 'cp /root/watchdog-script/* /opt/openolt/' |
| sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].sship} 'cp /root/bal_cli_appl/example_user_appl /broadcom' |
| sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].sship} 'cp in-band-startup-script/* /etc/init.d/' |
| sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].sship} 'echo "port ce128 sp=40000 if=XLAUI" >> /broadcom/qax.soc' |
| else |
| sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].sship} 'echo "port ce128 sp=40000 if=XLAUI" >> /broadcom/qax.soc' |
| fi |
| fi |
| """ |
| return olt_sw_present.toInteger() > 0 |
| } |
| } |
| } |
| } |
| stage('Restart OLT processes') { |
| for(int i=0; i < deployment_config.olts.size(); i++) { |
| timeout(15) { |
| sh returnStdout: true, script: """ |
| ssh-keyscan -H ${deployment_config.olts[i].sship} >> ~/.ssh/known_hosts |
| 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/openolt_process_watchdog.log; reboot' || true |
| sleep 360 |
| """ |
| } |
| timeout(15) { |
| waitUntil { |
| 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'" |
| return devprocess.toInteger() > 0 |
| } |
| } |
| timeout(15) { |
| waitUntil { |
| 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'" |
| return openoltprocess.toInteger() > 0 |
| } |
| } |
| } |
| } |
| } |
| /*if ( params.inBandManagement ) { |
| stage('Reboot OLT') { |
| for(int i=0; i < deployment_config.olts.size(); i++) { |
| timeout(10) { |
| sh returnStdout: true, script: """ |
| ssh-keyscan -H ${deployment_config.olts[i].sship} >> ~/.ssh/known_hosts |
| 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 |
| sleep 360 |
| """ |
| } |
| timeout(15) { |
| waitUntil { |
| 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'" |
| return devprocess.toInteger() > 0 |
| } |
| } |
| timeout(15) { |
| waitUntil { |
| 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'" |
| return openoltprocess.toInteger() > 0 |
| } |
| } |
| } |
| } |
| }*/ |
| |
| currentBuild.result = 'SUCCESS' |
| } catch (err) { |
| currentBuild.result = 'FAILURE' |
| step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "${notificationEmail}", sendToIndividuals: false]) |
| throw err |
| } |
| echo "RESULT: ${currentBuild.result}" |
| } |
| } |