Merge "Updating heat cli calls to converged cli"
[apex.git] / lib / configure-deps-functions.sh
index 2c5411e..1d238f8 100755 (executable)
@@ -33,13 +33,9 @@ function configure_deps {
   systemctl status libvirtd || systemctl start libvirtd
   systemctl status openvswitch || systemctl start openvswitch
 
-  # If flat we only use admin network
-  if [[ "$net_isolation_enabled" == "FALSE" ]]; then
-    virsh_enabled_networks="admin_network"
-    enabled_network_list="admin_network"
-  # For baremetal we only need to create/attach Undercloud to admin and public
-  elif [ "$virtual" == "FALSE" ]; then
-    virsh_enabled_networks="admin_network public_network"
+  # For baremetal we only need to create/attach Undercloud to admin and external
+  if [ "$virtual" == "FALSE" ]; then
+    virsh_enabled_networks="admin external"
   else
     virsh_enabled_networks=$enabled_network_list
   fi
@@ -54,7 +50,7 @@ function configure_deps {
     for network in ${enabled_network_list}; do
       echo "${blue}INFO: Creating Virsh Network: $network & OVS Bridge: ${NET_MAP[$network]}${reset}"
       ovs-vsctl list-br | grep "^${NET_MAP[$network]}$" > /dev/null || ovs-vsctl add-br ${NET_MAP[$network]}
-      virsh net-list --all | grep $network > /dev/null || (cat > ${libvirt_dir}/apex-virsh-net.xml && virsh net-define ${libvirt_dir}/apex-virsh-net.xml) << EOF
+      virsh net-list --all | grep " $network " > /dev/null || (cat > ${libvirt_dir}/apex-virsh-net.xml && virsh net-define ${libvirt_dir}/apex-virsh-net.xml) << EOF
 <network>
   <name>$network</name>
   <forward mode='bridge'/>
@@ -62,7 +58,7 @@ function configure_deps {
   <virtualport type='openvswitch'/>
 </network>
 EOF
-      if ! (virsh net-list --all | grep $network > /dev/null); then
+      if ! (virsh net-list --all | grep " $network " > /dev/null); then
           echo "${red}ERROR: unable to create network: ${network}${reset}"
           exit 1;
       fi
@@ -76,7 +72,7 @@ EOF
 
     # bridge interfaces to correct OVS instances for baremetal deployment
     for network in ${enabled_network_list}; do
-      if [[ "$network" != "admin_network" && "$network" != "public_network" ]]; then
+      if [[ "$network" != "admin" && "$network" != "external" ]]; then
         continue
       fi
       this_interface=$(eval echo \${${network}_bridged_interface})
@@ -95,11 +91,17 @@ EOF
     done
   else
     for network in ${OPNFV_NETWORK_TYPES}; do
+      if ! ovs-vsctl --may-exist add-br ${NET_MAP[$network]}; then
+       echo -e "${red}ERROR: Failed to create ovs bridge ${NET_MAP[$network]}{$reset}"
+       exit 1
+      fi
       echo "${blue}INFO: Creating Virsh Network: $network${reset}"
-      virsh net-list --all | grep $network > /dev/null || (cat > ${libvirt_dir}/apex-virsh-net.xml && virsh net-define ${libvirt_dir}/apex-virsh-net.xml) << EOF
+      virsh net-list --all | grep " $network " > /dev/null || (cat > ${libvirt_dir}/apex-virsh-net.xml && virsh net-define ${libvirt_dir}/apex-virsh-net.xml) << EOF
 <network ipv6='yes'>
 <name>$network</name>
+<forward mode='bridge'/>
 <bridge name='${NET_MAP[$network]}'/>
+<virtualport type='openvswitch'/>
 </network>
 EOF
       if ! (virsh net-list --all | grep $network > /dev/null); then
@@ -112,7 +114,7 @@ EOF
     done
 
     echo -e "${blue}INFO: Bridges set: ${reset}"
-    brctl show
+    ovs-vsctl list-br
   fi
 
   echo -e "${blue}INFO: virsh networks set: ${reset}"