From 20accc70e41ac4a533fe65868438bd099196f492 Mon Sep 17 00:00:00 2001
From: Tim Rozet <trozet@redhat.com>
Date: Mon, 28 Nov 2016 15:38:50 -0500
Subject: Updates FD.IO ODL scenarios to use Carbon ODL version

JIRA: APEX-346

Change-Id: I9ffa32da906f50441dfc05610d0668e84c992e81
Signed-off-by: Tim Rozet <trozet@redhat.com>
(cherry picked from commit af3976a683b8bdfd6a16d599940c2aa8dea3a077)
---
 build/overcloud-opendaylight.sh        | 11 +++++++++++
 config/deploy/os-odl_l2-fdio-ha.yaml   |  2 +-
 config/deploy/os-odl_l2-fdio-noha.yaml |  2 +-
 lib/overcloud-deploy-functions.sh      | 24 +++++++++++++++++++-----
 4 files changed, 32 insertions(+), 7 deletions(-)

diff --git a/build/overcloud-opendaylight.sh b/build/overcloud-opendaylight.sh
index 377a9a93..a23d57d3 100755
--- a/build/overcloud-opendaylight.sh
+++ b/build/overcloud-opendaylight.sh
@@ -43,6 +43,15 @@ enabled=1
 gpgcheck=0
 EOF
 
+# Master Repo
+cat > /tmp/opendaylight_master.repo << EOF
+[opendaylight-6-release]
+name=CentOS CBS OpenDaylight Carbon repository
+baseurl=http://cbs.centos.org/repos/nfv7-opendaylight-6-testing/\$basearch/os/
+enabled=1
+gpgcheck=0
+EOF
+
 # SDNVPN - Copy tunnel setup script
 wget https://raw.githubusercontent.com/openstack/fuel-plugin-opendaylight/brahmaputra-sr2/deployment_scripts/puppet/modules/opendaylight/templates/setup_TEPs.py
 
@@ -55,6 +64,8 @@ LIBGUESTFS_BACKEND=direct virt-customize \
     --upload networking-odl.tar.gz:/root/ \
     --upload /tmp/opendaylight_boron.repo:/etc/yum.repos.d/opendaylight.repo \
     --run-command "yum install --downloadonly --downloaddir=/root/boron/ opendaylight" \
+    --upload /tmp/opendaylight_master.repo:/etc/yum.repos.d/opendaylight.repo \
+    --run-command "yum install --downloadonly --downloaddir=/root/master/ opendaylight" \
     --upload /tmp/opendaylight.repo:/etc/yum.repos.d/opendaylight.repo \
     --install opendaylight,python-networking-odl \
     --install https://github.com/michaeltchapman/networking_rpm/raw/master/openstack-neutron-bgpvpn-2015.2-1.el7.centos.noarch.rpm \
diff --git a/config/deploy/os-odl_l2-fdio-ha.yaml b/config/deploy/os-odl_l2-fdio-ha.yaml
index 82836573..d4a86b0f 100644
--- a/config/deploy/os-odl_l2-fdio-ha.yaml
+++ b/config/deploy/os-odl_l2-fdio-ha.yaml
@@ -4,7 +4,7 @@ global_params:
 deploy_options:
   sdn_controller: opendaylight
   sdn_l3: false
-  odl_version: boron
+  odl_version: carbon
   tacker: true
   congress: true
   sfc: false
diff --git a/config/deploy/os-odl_l2-fdio-noha.yaml b/config/deploy/os-odl_l2-fdio-noha.yaml
index 53d6181a..b9e0cea6 100644
--- a/config/deploy/os-odl_l2-fdio-noha.yaml
+++ b/config/deploy/os-odl_l2-fdio-noha.yaml
@@ -4,7 +4,7 @@ global_params:
 deploy_options:
   sdn_controller: opendaylight
   sdn_l3: false
-  odl_version: boron
+  odl_version: carbon
   tacker: true
   congress: true
   sfc: false
diff --git a/lib/overcloud-deploy-functions.sh b/lib/overcloud-deploy-functions.sh
index f23390b7..54a1b3ee 100755
--- a/lib/overcloud-deploy-functions.sh
+++ b/lib/overcloud-deploy-functions.sh
@@ -130,12 +130,26 @@ EOI
   fi
 
   # Set ODL version accordingly
-  if [[ "${deploy_options_array['sdn_controller']}" == 'opendaylight' && "${deploy_options_array['odl_version']}" == 'boron' ]]; then
-    ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" <<EOI
-      LIBGUESTFS_BACKEND=direct virt-customize --run-command "yum -y remove opendaylight" \
-                                               --run-command "yum -y install /root/boron/*" \
-                                               -a overcloud-full.qcow2
+  if [[ "${deploy_options_array['sdn_controller']}" == 'opendaylight' && -n "${deploy_options_array['odl_version']}" ]]; then
+    case "${deploy_options_array['odl_version']}" in
+      boron)  odl_version='boron'
+              ;;
+      cabron) odl_version='master'
+              ;;
+      beryllium) odl_version=''
+              ;;
+      *) echo -e "${red}Invalid ODL version ${deploy_options_array['odl_version']}.  Please use 'carbon' or 'boron' values.${reset}"
+         exit 1
+         ;;
+    esac
+
+    if [ -n "$odl_version" ]; then
+      ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" <<EOI
+        LIBGUESTFS_BACKEND=direct virt-customize --run-command "yum -y remove opendaylight" \
+                                                 --run-command "yum -y install /root/${odl_version}/*" \
+                                                 -a overcloud-full.qcow2
 EOI
+    fi
   fi
 
   # Add performance deploy options if they have been set
-- 
cgit