Adapting BGPVPN scenario to new composable service
[apex.git] / lib / overcloud-deploy-functions.sh
index d219e14..d2ae027 100755 (executable)
@@ -29,34 +29,30 @@ function overcloud_deploy {
     if [ "${deploy_options_array['sfc']}" == 'True' ]; then
       DEPLOY_OPTIONS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/opendaylight_sfc.yaml"
     elif [ "${deploy_options_array['vpn']}" == 'True' ]; then
-      DEPLOY_OPTIONS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/neutron-opendaylight-bgpvpn.yaml"
+      DEPLOY_OPTIONS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/neutron-bgpvpn-opendaylight.yaml"
       if [ "${deploy_options_array['gluon']}" == 'True' ]; then
         DEPLOY_OPTIONS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/services/gluon.yaml"
       fi
     elif [ "${deploy_options_array['vpp']}" == 'True' ]; then
       if [ "${deploy_options_array['odl_vpp_netvirt']}" == "True" ]; then
         DEPLOY_OPTIONS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/neutron-opendaylight-netvirt-vpp.yaml"
-      elif [ "${deploy_options_array['sdn_l3']}" == "True" ]; then
-        DEPLOY_OPTIONS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/neutron-opendaylight-honeycomb.yaml"
       else
-        DEPLOY_OPTIONS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/neutron-opendaylight-honeycomb-l2.yaml"
+        DEPLOY_OPTIONS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/neutron-opendaylight-honeycomb.yaml"
       fi
     else
-      DEPLOY_OPTIONS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/neutron-opendaylight-l3.yaml"
+      DEPLOY_OPTIONS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/neutron-opendaylight.yaml"
     fi
     SDN_IMAGE=opendaylight
   elif [ "${deploy_options_array['sdn_controller']}" == 'opendaylight-external' ]; then
     DEPLOY_OPTIONS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/opendaylight-external.yaml"
     SDN_IMAGE=opendaylight
   elif [ "${deploy_options_array['sdn_controller']}" == 'onos' ]; then
-    echo -e "${red}ERROR: ONOS is unsupported in Danube...exiting${reset}"
-    exit 1
-    #if [ "${deploy_options_array['sfc']}" == 'True' ]; then
-    #  DEPLOY_OPTIONS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/onos_sfc.yaml"
-    #else
-    #  DEPLOY_OPTIONS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/onos.yaml"
-    #fi
-    #SDN_IMAGE=onos
+    if [ "${deploy_options_array['sfc']}" == 'True' ]; then
+      DEPLOY_OPTIONS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/neutron-onos-sfc.yaml"
+    else
+      DEPLOY_OPTIONS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/neutron-onos.yaml"
+    fi
+    SDN_IMAGE=onos
   elif [ "${deploy_options_array['sdn_controller']}" == 'ovn' ]; then
     if [[ "$ha_enabled" == "True" ]]; then
       DEPLOY_OPTIONS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/neutron-ml2-ovn-ha.yaml"
@@ -124,7 +120,6 @@ EOI
       ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" <<EOI
       LIBGUESTFS_BACKEND=direct virt-customize \
          --run-command "systemctl enable zrpcd" \
-         --run-command "systemctl enable bgpd" \
          -a overcloud-full.qcow2
 EOI
   fi
@@ -168,6 +163,8 @@ EOI
 
   # upgrade ovs into ovs 2.5.90 with NSH function if SFC is enabled
   if [[ "${deploy_options_array['sfc']}" == 'True' && "${deploy_options_array['dataplane']}" == 'ovs' ]]; then
+    echo "ONOS SFC is currently unavailable. JIRA: APEX-417"
+    exit 1
     ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" <<EOI
          LIBGUESTFS_BACKEND=direct virt-customize --run-command "yum install -y /root/ovs/rpm/rpmbuild/RPMS/x86_64/${ovs_kmod_rpm_name}" \
                                                   --run-command "yum upgrade -y /root/ovs/rpm/rpmbuild/RPMS/x86_64/${ovs_rpm_name}" \
@@ -182,18 +179,12 @@ EOI
                                                -a overcloud-full.qcow2
 EOI
 
-    # Disable clustering for ODL FDIO HA scenarios
-    if [[ "${deploy_options_array['sdn_controller']}" == 'opendaylight' ]]; then
-      ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" <<EOI
-      LIBGUESTFS_BACKEND=direct virt-customize --run-command "cd /etc/puppet/modules/tripleo/ && patch -p1 < disable_odl_clustering.patch" \
-                                               -a overcloud-full.qcow2
-EOI
-    fi
-
-    # Configure routing node for odl-fdio
+    # Configure routing node and interface role mapping for odl-fdio
     if [[ "${deploy_options_array['sdn_l3']}" == 'True' ]]; then
       ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" <<EOI
         sed -i "/opendaylight::vpp_routing_node:/c\    opendaylight::vpp_routing_node: ${deploy_options_array['odl_vpp_routing_node']}.${domain_name}" ${ENV_FILE}
+        sed -i "/ControllerExtraConfig:/ c\  ControllerExtraConfig:\n    tripleo::profile::base::neutron::agents::honeycomb::interface_role_mapping:  \"['${tenant_nic_mapping_controller_members}:tenant-interface']\"" ${ENV_FILE}
+        sed -i "/NovaComputeExtraConfig:/ c\  NovaComputeExtraConfig:\n    tripleo::profile::base::neutron::agents::honeycomb::interface_role_mapping:  \"['${tenant_nic_mapping_compute_members}:tenant-interface','${external_nic_mapping_compute_members}:public-interface']\"" ${ENV_FILE}
 EOI
     fi
   fi
@@ -262,29 +253,36 @@ EOI
   # Set ODL version accordingly
   if [[ "${deploy_options_array['sdn_controller']}" == 'opendaylight' && -n "${deploy_options_array['odl_version']}" ]]; then
     case "${deploy_options_array['odl_version']}" in
-      beryllium) odl_version=''
+      carbon) odl_version=''
               ;;
-      boron)  odl_version='boron'
-              ;;
-      carbon) odl_version='master'
-              ;;
-      *) echo -e "${red}Invalid ODL version ${deploy_options_array['odl_version']}.  Please use 'carbon' or 'boron' values.${reset}"
+      *) echo -e "${red}Invalid ODL version ${deploy_options_array['odl_version']}.  Please use 'carbon'.${reset}"
          exit 1
          ;;
     esac
 
-    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
+    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
+
+    # Overwrite puppet-opendaylight with carbon. By default we install boron branch.
+    if [ "${deploy_options_array['odl_version']}" == 'carbon' ]; then
+      ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" <<EOI
+        LIBGUESTFS_BACKEND=direct virt-customize --run-command "rm -rf /etc/puppet/modules/opendaylight" \
+                                                 --run-command "cd /etc/puppet/modules/ && tar xzf /root/puppet-opendaylight-carbon.tar.gz" \
+                                                 -a overcloud-full.qcow2
 EOI
+    fi
   fi
 
   # Override ODL if we enable netvirt for fdio
   if [[ "${deploy_options_array['odl_vpp_netvirt']}" == 'True' && "${deploy_options_array['sdn_controller']}" == 'opendaylight' ]]; then
     ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" <<EOI
-      LIBGUESTFS_BACKEND=direct virt-customize --run-command "rm -rf /opt/opendaylight/*" \
-                                               --run-command "tar zxvf /root/odl-netvirt-vpp-distribution.tar.gz -C /opt/opendaylight/" \
+      LIBGUESTFS_BACKEND=direct virt-customize --run-command "yum -y remove opendaylight" \
+                                               --run-command "yum -y install /root/opendaylight-7.0.0-0.1.20170531snap665.el7.noarch.rpm" \
                                                -a overcloud-full.qcow2
 EOI
   fi
@@ -339,6 +337,12 @@ EOI
   DEPLOY_OPTIONS+=" --control-flavor control --compute-flavor compute"
   if [[ "$virtual" == "TRUE" ]]; then
      DEPLOY_OPTIONS+=" -e virtual-environment.yaml"
+     echo 'Ensuring Virtual BMC device status'
+     for i in $(vbmc list | grep down | awk '{ print $2}'); do
+         vbmc start $i
+         sleep 5
+     done
+     vbmc list
   fi
 
   echo -e "${blue}INFO: Deploy options set:\n${DEPLOY_OPTIONS}${reset}"
@@ -362,41 +366,33 @@ echo "Uploading overcloud glance images"
 openstack overcloud image upload
 
 echo "Configuring undercloud and discovering nodes"
-openstack baremetal import --json instackenv.json
+
 
 if [[ -z "$virtual" ]]; then
-  openstack baremetal introspection bulk start
-  if [[ -n "$root_disk_list" ]]; then
-    openstack baremetal configure boot --root-device=${root_disk_list}
-  else
-    openstack baremetal configure boot
-  fi
+  openstack overcloud node import instackenv.json
+  openstack overcloud node introspect --all-manageable --provide
+  #if [[ -n "$root_disk_list" ]]; then
+    # TODO: replace node configure boot with ironic node-update
+    # TODO: configure boot is not used in ocata here anymore
+    #openstack overcloud node configure boot --root-device=${root_disk_list}
+    #https://github.com/openstack/tripleo-quickstart-extras/blob/master/roles/overcloud-prep-images/templates/overcloud-prep-images.sh.j2#L73-L130
+    #ironic node-update $ironic_node add properties/root_device='{"{{ node['key'] }}": "{{ node['value'] }}"}'
+  #fi
 else
-  openstack baremetal configure boot
+  openstack overcloud node import --provide instackenv.json
 fi
 
-echo "Configuring flavors"
-for flavor in baremetal control compute; do
-  echo -e "${blue}INFO: Updating flavor: \${flavor}${reset}"
-  if openstack flavor list | grep \${flavor}; then
-    openstack flavor delete \${flavor}
-  fi
-  openstack flavor create --id auto --ram 4096 --disk 39 --vcpus 1 \${flavor}
-  if ! openstack flavor list | grep \${flavor}; then
-    echo -e "${red}ERROR: Unable to create flavor \${flavor}${reset}"
-  fi
-done
-openstack flavor set --property "cpu_arch"="x86_64" --property "capabilities:boot_option"="local" baremetal
-openstack flavor set --property "cpu_arch"="x86_64" --property "capabilities:boot_option"="local" --property "capabilities:profile"="control" control
-openstack flavor set --property "cpu_arch"="x86_64" --property "capabilities:boot_option"="local" --property "capabilities:profile"="compute" compute
+openstack flavor set --property "cpu_arch"="x86_64" baremetal
+openstack flavor set --property "cpu_arch"="x86_64" control
+openstack flavor set --property "cpu_arch"="x86_64" compute
 echo "Configuring nameserver on ctlplane network"
 dns_server_ext=''
 for dns_server in ${dns_servers}; do
   dns_server_ext="\${dns_server_ext} --dns-nameserver \${dns_server}"
 done
-neutron subnet-update \$(neutron subnet-list | grep -Ev "id|tenant|external|storage" | grep -v \\\\-\\\\- | awk {'print \$2'}) \${dns_server_ext}
+openstack subnet set ctlplane-subnet \${dns_server_ext}
 sed -i '/CloudDomain:/c\  CloudDomain: '${domain_name} ${ENV_FILE}
-echo "Executing overcloud deployment, this should run for an extended period without output."
+echo "Executing overcloud deployment, this could run for an extended period without output."
 sleep 60 #wait for Hypervisor stats to check-in to nova
 # save deploy command so it can be used for debugging
 cat > deploy_command << EOF