Adding network configuration options 61/4661/8
authorDan Radez <dradez@redhat.com>
Tue, 15 Dec 2015 20:44:01 +0000 (15:44 -0500)
committerDan Radez <dradez@redhat.com>
Fri, 18 Dec 2015 18:29:07 +0000 (13:29 -0500)
- enabling subnet configuration for undercloud
- enabling external network configuration

Change-Id: Id1951d31faa1a68f850a75e2466d30b8abcea8ac

build/instack.sh
build/opnfv-apex.spec
ci/deploy.sh
config/deploy/deploy_settings.yaml

index 69fec70..48aef0b 100755 (executable)
@@ -113,7 +113,6 @@ else
    echo -e "${blue}\rInstack VM has IP $UNDERCLOUD${reset}"
 fi
 
-
 # ensure that we can ssh to the undercloud
 CNT=10
 while ! ssh -T ${SSH_OPTIONS[@]}  "root@$UNDERCLOUD" "echo ''" > /dev/null && [ $CNT -gt 0 ]; do
index 88ec642..ee81948 100644 (file)
@@ -1,7 +1,7 @@
 Name:          opnfv-apex
-Version:       2.5
+Version:       2.6
 Release:       %{release}
-Summary:       RDO Manager disk images for deployment
+Summary:       Scripts and Disk images for deployment
 
 Group:         System Environment
 License:       Apache 2.0
@@ -13,9 +13,10 @@ BuildRequires:       openvswitch qemu-kvm python-docutils
 Requires:      openvswitch qemu-kvm bridge-utils libguestfs-tools
 
 %description
-These files are disk images used to launch the instack
+These files are scripts and disk images used to launch the instack
 libvirt VM and to load into the instack undercloud machine
-to deploy an OpenStack overcloud.
+to deploy an OpenStack overcloud. Installation is done via RDO Manager
+https://rdoproject.org
 
 %prep
 %setup -q
@@ -55,6 +56,7 @@ install docs/installation-instructions/index.rst %{buildroot}%{_docdir}/opnfv/in
 install docs/installation-instructions.html %{buildroot}%{_docdir}/opnfv/
 install docs/release-notes/index.rst %{buildroot}%{_docdir}/opnfv/release-notes.rst
 install docs/release-notes.html %{buildroot}%{_docdir}/opnfv/
+install config/deploy/deploy_settings.yaml %{buildroot}%{_docdir}/opnfv/deploy_settings.yaml.example
 
 %files
 %{_bindir}/opnfv-deploy
@@ -78,9 +80,12 @@ install docs/release-notes.html %{buildroot}%{_docdir}/opnfv/
 %doc %{_docdir}/opnfv/installation-instructions.html
 %doc %{_docdir}/opnfv/release-notes.rst
 %doc %{_docdir}/opnfv/release-notes.html
+%doc %{_docdir}/opnfv/deploy_settings.yaml.example
 
 
 %changelog
+* Tue Dec 15 2015 Dan Radez <dradez@redhat.com> - 2.6-1
+- Added deploy settings for flat network config
 * Wed Dec 09 2015 Dan Radez <dradez@redhat.com> - 2.5-1
 - Updating the OpenDaylight Patch
 * Fri Dec 05 2015 Dan Radez <dradez@redhat.com> - 2.4-1
index 24187f1..d090280 100755 (executable)
@@ -53,7 +53,7 @@ parse_yaml() {
       for (i in vname) {if (i > indent) {delete vname[i]}}
       if (length($3) > 0) {
          vn=""; for (i=0; i<indent; i++) {vn=(vn)(vname[i])("_")}
-         printf("%s%s%s=\"%s\"\n", "'$prefix'",vn, $2, $3);
+         printf("%s%s%s=%s\n", "'$prefix'",vn, $2, $3);
       }
    }'
 }
@@ -401,7 +401,7 @@ function setup_virtual_baremetal {
 
 ##Copy over the glance images and instack json file
 ##params: none
-function copy_materials_to_instack {
+function configure_undercloud {
 
   echo
   echo "Copying configuration file and disk images to instack"
@@ -409,18 +409,6 @@ function copy_materials_to_instack {
   scp ${SSH_OPTIONS[@]} $NETENV "stack@$UNDERCLOUD":
   scp ${SSH_OPTIONS[@]} -r $CONFIG/nics/ "stack@$UNDERCLOUD":
 
-  if [[ ${#deploy_options_array[@]} -eq 0 || ${deploy_options_array['sdn_controller']} == 'opendaylight' ]]; then
-    DEPLOY_OPTIONS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/opendaylight.yaml"
-  elif [ ${deploy_options_array['sdn_controller']} == 'opendaylight-external' ]; then
-    DEPLOY_OPTIONS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/opendaylight-external.yaml"
-  elif [ ${deploy_options_array['sdn_controller']} == 'onos' ]; then
-    echo -e "${red}ERROR: ONOS is currently unsupported...exiting${reset}"
-    exit 1
-  elif [ ${deploy_options_array['sdn_controller']} == 'opencontrail' ]; then
-    echo -e "${red}ERROR: OpenContrail is currently unsupported...exiting${reset}"
-    exit 1
-  fi
-
   # ensure stack user on instack machine has an ssh key
   ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" "if [ ! -e ~/.ssh/id_rsa.pub ]; then ssh-keygen -t rsa -N '' -f ~/.ssh/id_rsa; fi"
 
@@ -466,15 +454,58 @@ sed -i 's~INSERT_STACK_USER_PRIV_KEY~'"\$stack_key"'~' instackenv.json
 EOI
   fi
 
-# copy stack's ssh key to this users authorized keys
-ssh -T ${SSH_OPTIONS[@]} "root@$UNDERCLOUD" "cat /home/stack/.ssh/id_rsa.pub" >> ~/.ssh/authorized_keys
+  # copy stack's ssh key to this users authorized keys
+  ssh -T ${SSH_OPTIONS[@]} "root@$UNDERCLOUD" "cat /home/stack/.ssh/id_rsa.pub" >> ~/.ssh/authorized_keys
+
+  # configure undercloud on Undercloud VM
+  echo "Running undercloud configuration."
+  echo "Logging undercloud configuration to instack:/home/stack/apex-undercloud-install.log"
+  ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" << EOI
+if [ -n "$DEPLOY_SETTINGS_FILE" ]; then
+  sed -i 's/#local_ip/local_ip/' undercloud.conf
+  sed -i 's/#network_gateway/network_gateway/' undercloud.conf
+  sed -i 's/#network_cidr/network_cidr/' undercloud.conf
+  sed -i 's/#dhcp_start/dhcp_start/' undercloud.conf
+  sed -i 's/#dhcp_end/dhcp_end/' undercloud.conf
+  sed -i 's/#inspection_iprange/inspection_iprange/' undercloud.conf
+  sed -i 's/#undercloud_debug/undercloud_debug/' undercloud.conf
+
+  openstack-config --set undercloud.conf DEFAULT local_ip ${deploy_options_array['instack_ip']}/${deploy_options_array['provisioning_cidr']##*/}
+  openstack-config --set undercloud.conf DEFAULT network_gateway ${deploy_options_array['provisioning_gateway']}
+  openstack-config --set undercloud.conf DEFAULT network_cidr ${deploy_options_array['provisioning_cidr']}
+  openstack-config --set undercloud.conf DEFAULT dhcp_start ${deploy_options_array['provisioning_dhcp_start']}
+  openstack-config --set undercloud.conf DEFAULT dhcp_end ${deploy_options_array['provisioning_dhcp_end']}
+  openstack-config --set undercloud.conf DEFAULT inspection_iprange ${deploy_options_array['provisioning_inspection_iprange']}
+  openstack-config --set undercloud.conf DEFAULT undercloud_debug false
+
+  if [ -n "$net_isolation_enabled" ]; then 
+    sed -i '/ControlPlaneSubnetCidr/c\\  ControlPlaneSubnetCidr: "${deploy_options_array['provisioning_cidr']##*/}"' network-environment.yaml
+    sed -i '/ControlPlaneDefaultRoute/c\\  ControlPlaneDefaultRoute: ${deploy_options_array['provisioning_gateway']}' network-environment.yaml
+    sed -i '/ExternalNetCidr/c\\  ExternalNetCidr: ${deploy_options_array['ext_net_cidr']}' network-environment.yaml
+    sed -i '/ExternalAllocationPools/c\\  ExternalAllocationPools: [{'start': '${deploy_options_array['ext_allocation_pool_start']}', 'end': '${deploy_options_array['ext_allocation_pool_end']}'}]' network-environment.yaml
+    sed -i '/ExternalInterfaceDefaultRoute/c\\  ExternalInterfaceDefaultRoute: ${deploy_options_array['ext_gateway']}' network-environment.yaml
+  fi
+fi
+
+openstack undercloud install &> apex-undercloud-install.log
+EOI
 }
 
 ##preping it for deployment and launch the deploy
 ##params: none
 function undercloud_prep_overcloud_deploy {
-# configure undercloud on Undercloud VM
-ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" "openstack undercloud install > apex-undercloud-install.log"
+
+  if [[ ${#deploy_options_array[@]} -eq 0 || ${deploy_options_array['sdn_controller']} == 'opendaylight' ]]; then
+    DEPLOY_OPTIONS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/opendaylight.yaml"
+  elif [ ${deploy_options_array['sdn_controller']} == 'opendaylight-external' ]; then
+    DEPLOY_OPTIONS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/opendaylight-external.yaml"
+  elif [ ${deploy_options_array['sdn_controller']} == 'onos' ]; then
+    echo -e "${red}ERROR: ONOS is currently unsupported...exiting${reset}"
+    exit 1
+  elif [ ${deploy_options_array['sdn_controller']} == 'opencontrail' ]; then
+    echo -e "${red}ERROR: OpenContrail is currently unsupported...exiting${reset}"
+    exit 1
+  fi
 
   # check if HA is enabled
   if [[ "$ha_enabled" == "TRUE" ]]; then
@@ -639,7 +670,7 @@ main() {
   elif [ -n "$INVENTORY_FILE" ]; then
     parse_inventory_file
   fi
-  copy_materials_to_instack
+  configure_undercloud
   undercloud_prep_overcloud_deploy
 }
 
index f024116..52d3913 100644 (file)
@@ -3,9 +3,26 @@ global_params:
   network_isolation_settings: network/network-environment-example.yaml
 
 deploy_options:
+  # instack_ip
+  # IP address given to instack on the provisioning network
+  instack_ip: 192.0.2.1
+  # CIDR of provisioning network
+  provisioning_cidr: 192.0.2.0/24
+  # gateway IP of provisioning network
+  provisioning_gateway: 192.0.2.1
+  # IP pool start used for provisioning overcloud nodes
+  provisioning_dhcp_start: 192.0.2.5
+  # IP pool end used for inspecting overcloud nodes
+  provisioning_dhcp_end: 192.0.2.24
+  # IP pool used for inspecting overcloud nodes on the provisioning network
+  provisioning_inspection_iprange: 192.0.2.100,192.0.2.124
   sdn_controller: opendaylight
   tacker: false
   congress: false
-
-
-  
+  # CIDR used to for the external network
+  ext_net_cidr: 192.168.37.0/24
+  # Allocation pools for floating ip addresses on the ext net
+  ext_allocation_pool_start: 192.168.37.50
+  ext_allocation_pool_end: 192.168.37.99
+  # Default Gateway for External Network
+  ext_gateway: 192.168.37.1