[VVP] parameterizing devstack branch for install

- Also modifying default storage class override logic

Issue-ID: INT-1424
Signed-off-by: stark, steven <steven.stark@att.com>
Change-Id: If8981f3a59437e21617edb30a6bca06ee6fa36a2
diff --git a/deployment/aks/README.md b/deployment/aks/README.md
index a5be9a9..1b46e51 100644
--- a/deployment/aks/README.md
+++ b/deployment/aks/README.md
@@ -135,6 +135,7 @@
 DEVSTACK_VNET_NAME=        Name of VNET that DevStack VM will attach to. 
 DEVSTACK_SUBNET_NAME=      Name of SUBNET attached to DEVSTACK_VNET_NAME.
 DEVSTACK_DISK_SIZE=        Size of OS Disk for DevStack VM.
+DEVSTACK_BRANCH=           Branch to use when installing devstack.
 OPENSTACK_USER=            User name that will be added to OpenStack after devstack has finished installing. This is also the username that will be used to create a cloud site in ONAP SO.
 OPENSTACK_PASS=            Password to use for OPENSTACK_USER.
 OPENSTACK_TENANT=          Tenant name that will be added to OpenStack after devstack has finished installing. This is also the username that will be used to create a cloud site in ONAP SO.
diff --git a/deployment/aks/cloud.conf b/deployment/aks/cloud.conf
index 0865d7a..d37da0e 100644
--- a/deployment/aks/cloud.conf
+++ b/deployment/aks/cloud.conf
@@ -58,6 +58,7 @@
 DEVSTACK_VNET_NAME=
 DEVSTACK_SUBNET_NAME=
 DEVSTACK_DISK_SIZE=
+DEVSTACK_BRANCH=
 OPENSTACK_USER=
 OPENSTACK_PASS=
 OPENSTACK_TENANT=
diff --git a/deployment/aks/cloud.conf.example b/deployment/aks/cloud.conf.example
index d3f5087..3172be1 100644
--- a/deployment/aks/cloud.conf.example
+++ b/deployment/aks/cloud.conf.example
@@ -58,6 +58,7 @@
 DEVSTACK_VNET_NAME=$BUILD"-DEVSTACKVNET"
 DEVSTACK_SUBNET_NAME=$BUILD"-DEVSTACKSUBNET"
 DEVSTACK_DISK_SIZE=512
+DEVSTACK_BRANCH="stable/stein"
 OPENSTACK_USER="onap_user"
 OPENSTACK_PASS="supersecret"
 OPENSTACK_TENANT="onap_project"
diff --git a/deployment/aks/cloud.sh b/deployment/aks/cloud.sh
index 555ba12..b998651 100755
--- a/deployment/aks/cloud.sh
+++ b/deployment/aks/cloud.sh
@@ -133,6 +133,7 @@
 DEVSTACK_VNET_NAME      = "$DEVSTACK_VNET_NAME"
 DEVSTACK_SUBNET_NAME    = "$DEVSTACK_SUBNET_NAME"
 DEVSTACK_DISK_SIZE      = "$DEVSTACK_DISK_SIZE"
+DEVSTACK_BRANCH         = "$DEVSTACK_BRANCH"
 OPENSTACK_USER          = "$OPENSTACK_USER"
 OPENSTACK_PASS          = "$OPENSTACK_PASS"
 OPENSTACK_TENANT        = "$OPENSTACK_TENANT"
@@ -209,6 +210,7 @@
                         --openstack-password "$OPENSTACK_PASS" \
                         --openstack-tenant "$OPENSTACK_TENANT" \
                         --image-list "$IMAGE_LIST" \
+                        --devstack-branch "$DEVSTACK_BRANCH" \
                         --no-prompt
 
 
@@ -451,4 +453,3 @@
 $DIR/post_install.sh "$BUILD_DIR/onap.conf" "$DIR/cloud.conf"
 
 fi
-
diff --git a/deployment/aks/create_devstack.sh b/deployment/aks/create_devstack.sh
index 63ce547..87c76a1 100755
--- a/deployment/aks/create_devstack.sh
+++ b/deployment/aks/create_devstack.sh
@@ -35,6 +35,7 @@
 OPENSTACK_PASS=
 OS_PROJECT_NAME=
 IMAGE_LIST=
+DEVSTACK_BRANCH=
 
 function check_required_parameter() {
   # arg1 = parameter
@@ -84,6 +85,7 @@
       echo "--openstack-username        default user name for openstack [optional]"
       echo "--openstack-password        default password for openstack [optional]"
       echo "--openstack-tenant          default tenant name for openstack [optional]"
+      echo "--devstack-branch           branch to use for devstack install [optional]"
       echo ""
       exit 0
       ;;
@@ -176,6 +178,11 @@
       OS_PROJECT_NAME=$1
       shift
       ;;
+    --devstack-branch)
+      shift
+      DEVSTACK_BRANCH=$1
+      shift
+      ;;
     *)
       echo "Unknown Argument $1. Try running with --help."
       exit 0
@@ -201,7 +208,7 @@
 OPENSTACK_PASS=$(check_optional_paramater "$OPENSTACK_PASS" "secret")
 OS_PROJECT_NAME=$(check_optional_paramater "$OS_PROJECT_NAME" "admin")
 IMAGE_LIST=$(check_optional_paramater "$IMAGE_LIST" "")
-
+DEVSTACK_BRANCH=$(check_optional_paramater "$DEVSTACK_BRANCH" "master")
 
 if [ $NO_PROMPT = 0 ]; then
   read -p "Would you like to proceed? [y/n]" -n 1 -r
@@ -254,7 +261,7 @@
       DEBIAN_FRONTEND=noninteractive sudo apt-get install -qqy git || sudo yum install -qy git
       sudo chown stack:stack /home/stack
       cd /home/stack
-      git clone https://git.openstack.org/openstack-dev/devstack
+      git clone -b $DEVSTACK_BRANCH https://git.openstack.org/openstack-dev/devstack
       cd devstack
       cat > local.conf <<EOF
       [[local|localrc]]
@@ -272,8 +279,8 @@
       enable_service h-eng h-api h-api-cfn h-api-cw
       disable_service tempest
 
-      enable_plugin heat https://git.openstack.org/openstack/heat
-      enable_plugin heat-dashboard https://opendev.org/openstack/heat-dashboard
+      enable_plugin heat https://git.openstack.org/openstack/heat $DEVSTACK_BRANCH
+      enable_plugin heat-dashboard https://opendev.org/openstack/heat-dashboard $DEVSTACK_BRANCH
 
       ## Neutron options
       Q_USE_SECGROUP=True
@@ -367,4 +374,3 @@
 
 ### Enabling IP Forwarding on DEVSTACK vnic ###
 az network nic update --ids "$DEVSTACK_NIC_ID" --ip-forwarding
-
diff --git a/deployment/aks/create_onap.sh b/deployment/aks/create_onap.sh
index 4f3a673..9a494df 100755
--- a/deployment/aks/create_onap.sh
+++ b/deployment/aks/create_onap.sh
@@ -29,13 +29,10 @@
 export KUBECONFIG="$KUBECONFIG"
 kubectl get nodes
 
-COUNTER=0
-until [ $COUNTER -ge 10 ]; do
-
 echo "overriding default storage class for AKS"
 kubectl delete sc default
 sleep 1
-cat  <<EOF | kubectl apply -f -
+cat > "$BUILD_DIR/tmp-sc.yaml" <<EOF
 apiVersion: storage.k8s.io/v1
 kind: StorageClass
 metadata:
@@ -49,14 +46,7 @@
 volumeBindingMode: Immediate
 EOF
 
-if [ $? -eq 0 ]; then
-  COUNTER=10
-else
-  COUNTER=$((COUNTER +1))
-fi
-
-sleep 5
-done
+kubectl replace -f "$BUILD_DIR/tmp-sc.yaml" --force
 
 git clone -b "$OOM_BRANCH" http://gerrit.onap.org/r/oom --recurse-submodules