[VOL-3641] Correct for loop in cross-connect installation to get proper upstream port
Change-Id: I7c19684b03346ae77bffb0030fad44e48ca710c1
diff --git a/Jenkinsfile-voltha-build b/Jenkinsfile-voltha-build
index 8fcf242..9141fde 100644
--- a/Jenkinsfile-voltha-build
+++ b/Jenkinsfile-voltha-build
@@ -259,25 +259,26 @@
}
timeout(5) {
for(int i=0; i < deployment_config.hosts.src.size(); i++) {
- def aggPort = -1
for(int j=0; j < deployment_config.olts.size(); j++) {
- if(deployment_config.olts[j].serial == deployment_config.hosts.src[j].olt){
+ 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(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
- """
}
}
}