Merge "Auto Generated INFO.yaml file"
[joid.git] / ci / deploy.sh
index b722d2a..3bbddb6 100755 (executable)
@@ -9,7 +9,7 @@ source common/tools.sh
 
 opnfvsdn=nosdn
 opnfvtype=noha
-openstack=ocata
+openstack=queens
 opnfvlab=default
 opnfvlabfile=
 opnfvrel=e
@@ -20,20 +20,18 @@ opnfvmodel=openstack
 virtinstall=0
 maasinstall=0
 
-jujuver=`juju --version`
-
 usage() { echo "Usage: $0
-    [-s|--sdn <nosdn|odl|opencontrail>]
+    [-s|--sdn <nosdn|odl|ocl>]
     [-t|--type <noha|ha|tip>]
-    [-o|--openstack <ocata>]
+    [-o|--openstack <ocata|queens>]
     [-l|--lab <default|custom>]
-    [-f|--feature <ipv6,dpdk,lxd,dvr,openbaton>]
+    [-f|--feature <ipv6,dpdk,lxd,dvr,openbaton,multus>]
     [-d|--distro <xenial>]
     [-a|--arch <amd64|ppc64el|aarch64>]
     [-m|--model <openstack|kubernetes>]
     [-i|--virtinstall <0|1>]
     [--maasinstall <0|1>]
-    [--labfile <labvonfig.yaml file>]
+    [--labfile <labconfig.yaml file>]
     [-r|--release <e>]" 1>&2 exit 1;
 }
 
@@ -92,7 +90,7 @@ for argument in $options
 
             -d|--distro )
                 if ([ "arguments[index]" != "" ]); then
-                    opnfdistro=${arguments[index]}
+                    opnfvdistro=${arguments[index]}
                 fi;
                 ;;
 
@@ -199,14 +197,14 @@ deploy() {
                 python genDeploymentConfig.py -l labconfig.yaml > deployconfig.yaml
             fi
         else
-            echo_error "MAAS not deployed please deploy MAAS first."
+            if [ "$maasinstall" -eq 0 ]; then
+                echo_error "MAAS not deployed please deploy MAAS first."
+            else
+                echo_info "MAAS not deployed this will deploy MAAS first."
+            fi
         fi
     fi
 
-    #create json file which is missing in case of new deployment after maas and git tree cloned freshly.
-    python -c 'import sys, yaml, json; json.dump(yaml.load(sys.stdin), sys.stdout, indent=4)' < labconfig.yaml > labconfig.json
-    python -c 'import sys, yaml, json; json.dump(yaml.load(sys.stdin), sys.stdout, indent=4)' < deployconfig.yaml > deployconfig.json
-
     # Install MAAS and expecting the labconfig.yaml at local directory.
 
     if [ "$maasinstall" -eq 1 ]; then
@@ -229,7 +227,7 @@ deploy() {
         ./cleanvm.sh || true
 
         if [ "$virtinstall" -eq 1 ]; then
-            ./00-maasdeploy.sh virtual
+            ./03-maasdeploy.sh virtual
         else
             if [ -z "$labfile" ]; then
                 if [ ! -e ./labconfig.yaml ]; then
@@ -250,18 +248,23 @@ deploy() {
                 cp $labfile ./labconfig.yaml
             fi
 
-            ./00-maasdeploy.sh custom
+            ./03-maasdeploy.sh custom
         fi
     fi
 
+    #create json file which is missing in case of new deployment after maas and git tree cloned freshly.
+    python -c 'import sys, yaml, json; json.dump(yaml.load(sys.stdin), sys.stdout, indent=4)' < labconfig.yaml > labconfig.json
+    python -c 'import sys, yaml, json; json.dump(yaml.load(sys.stdin), sys.stdout, indent=4)' < deployconfig.yaml > deployconfig.json
+
     if [[ "$opnfvtype" = "ha" && "$opnfvlab" = "default" ]]; then
         createresource
     fi
 
     #bootstrap the node
-    ./01-bootstrap.sh
+    ./01-bootstrap.sh $opnfvdistro
 
     juju model-config default-series=$opnfvdistro enable-os-refresh-update=false enable-os-upgrade=false
+    juju set-model-constraints tags=
 
     # case default deploy the opnfv platform:
     ./02-deploybundle.sh $opnfvtype $openstack $opnfvlab $opnfvsdn $opnfvfeature $opnfvdistro $opnfvmodel
@@ -270,6 +273,7 @@ deploy() {
 #check whether charms are still executing the code even juju-deployer says installed.
 check_status() {
     waitstatus=$1
+    waittime=$2
     retval=0
     timeoutiter=0
 
@@ -277,7 +281,7 @@ check_status() {
     while [ $retval -eq 0 ]; do
         if juju status | grep -q $waitstatus; then
            echo_info "Still waiting for $waitstatus units"
-           if [ $timeoutiter -ge 180 ]; then
+           if [ $timeoutiter -ge $waittime ]; then
                echo_error 'Timed out'
                retval=1
            else
@@ -307,7 +311,7 @@ fi
 echo_info "Deployment started"
 deploy
 
-check_status executing
+check_status executing 180
 
 echo_info "Deployment finished"
 juju status --format=tabular
@@ -317,16 +321,30 @@ python -c 'import sys, yaml, json; json.dump(yaml.load(sys.stdin), sys.stdout, i
 
 # Configuring deployment
 if ([ $opnfvmodel == "openstack" ]); then
+
     echo_info "Configuring OpenStack deployment"
 
     ./openstack.sh "$opnfvsdn" "$opnfvlab" "$opnfvdistro" "$openstack" || true
 
     # creating heat domain after pushing the public API into /etc/hosts
-    if [[ "$jujuver" > "2" ]]; then
-        status=`juju run-action heat/0 domain-setup`
+    status=`juju run-action heat/0 domain-setup`
+    echo $status
+    if  ([ $opnfvsdn != "ocl" ]) then
+      status=`juju run-action ceilometer/0 ceilometer-upgrade`
+    fi
+    echo $status
+    if ([ $opnftype == "ha" ]); then
+        status=`juju run-action heat/1 domain-setup`
         echo $status
-    else
-        status=`juju action do heat/0 domain-setup`
+        if  ([ $opnfvsdn != "ocl" ]) then
+          status=`juju run-action ceilometer/1 ceilometer-upgrade`
+        fi
+        echo $status
+        status=`juju run-action heat/2 domain-setup`
+        echo $status
+        if  ([ $opnfvsdn != "ocl" ]) then
+          status=`juju run-action ceilometer/2 ceilometer-upgrade`
+        fi
         echo $status
     fi
 
@@ -339,11 +357,11 @@ if ([ $opnfvmodel == "openstack" ]); then
 
 elif ([ $opnfvmodel == "kubernetes" ]); then
    #Workarounf for master chanrm as it takes 5 minutes to run properly
-    check_status waiting
-    check_status executing
+    check_status waiting 50
+    check_status executing 50
     echo_info "Configuring Kubernetes deployment"
 
-    ./k8.sh
+    ./k8.sh $opnfvfeature
 fi
 
 # expose the juju gui-url to login into juju gui