Fix network_isolation argparse issue 99/17999/2
authorFeng Pan <fpan@redhat.com>
Thu, 4 Aug 2016 02:27:25 +0000 (22:27 -0400)
committerFeng Pan <fpan@redhat.com>
Thu, 4 Aug 2016 22:10:03 +0000 (18:10 -0400)
JIRA: APEX-222

Change-Id: I435852fbe1597bf03f617dc14a6718de699b648f
Signed-off-by: Feng Pan <fpan@redhat.com>
ci/deploy.sh
lib/parse-functions.sh
lib/python/apex_python_utils.py
lib/undercloud-functions.sh
tests/test_apex_python_utils_py.py

index 57c6376..432499a 100755 (executable)
@@ -26,6 +26,7 @@ interactive="FALSE"
 ping_site="8.8.8.8"
 ntp_server="pool.ntp.org"
 net_isolation_enabled="TRUE"
+net_isolation_arg=""
 post_config="TRUE"
 debug="FALSE"
 
@@ -130,6 +131,7 @@ parse_cmdline() {
             ;;
         --flat )
                 net_isolation_enabled="FALSE"
+                net_isolation_arg="--flat"
                 echo "Underlay Network Isolation Disabled: using flat configuration"
                 shift 1
             ;;
index e8dd982..0be62e2 100755 (executable)
@@ -63,7 +63,7 @@ parse_network_settings() {
     fi
   done
 
-  if output=$(python3.4 -B $LIB/python/apex_python_utils.py parse-net-settings -s $NETSETS -i $net_isolation_enabled -e $CONFIG/network-environment.yaml $parse_ext); then
+  if output=$(python3.4 -B $LIB/python/apex_python_utils.py parse-net-settings -s $NETSETS $net_isolation_arg -e $CONFIG/network-environment.yaml $parse_ext); then
       echo -e "${blue}${output}${reset}"
       eval "$output"
   else
index c548437..8ea40f2 100755 (executable)
@@ -131,9 +131,9 @@ def get_parser():
                               default='network-settings.yaml',
                               dest='net_settings_file',
                               help='path to network settings file')
-    net_settings.add_argument('-i', '--network-isolation', type=bool,
+    net_settings.add_argument('--flat', action='store_false',
                               default=True, dest='network_isolation',
-                              help='network isolation')
+                              help='disable network isolation')
     net_settings.add_argument('-e', '--net-env-file',
                               default="network-environment.yaml",
                               dest='net_env_file',
@@ -172,9 +172,9 @@ def get_parser():
                               default='network-settings.yaml',
                               dest='net_settings_file',
                               help='path to network settings file')
-    nic_template.add_argument('-i', '--network-isolation', type=bool,
+    nic_template.add_argument('--flat', action='store_false',
                               default=True, dest='network_isolation',
-                              help='network isolation')
+                              help='disable network isolation')
     nic_template.add_argument('-n', '--enabled-networks', required=True,
                               dest='enabled_networks',
                               help='enabled network list')
index 0e26fa8..f5b53ee 100755 (executable)
@@ -136,12 +136,12 @@ function configure_undercloud {
       ovs_dpdk_bridge=''
     fi
 
-    if ! controller_nic_template=$(python3.4 -B $LIB/python/apex_python_utils.py nic-template -r controller -s $NETSETS -i $net_isolation_enabled -t $CONFIG/nics-template.yaml.jinja2 -n "$enabled_network_list" -e "br-ex" -af $ip_addr_family); then
+    if ! controller_nic_template=$(python3.4 -B $LIB/python/apex_python_utils.py nic-template -r controller -s $NETSETS $net_isolation_arg -t $CONFIG/nics-template.yaml.jinja2 -n "$enabled_network_list" -e "br-ex" -af $ip_addr_family); then
       echo -e "${red}ERROR: Failed to generate controller NIC heat template ${reset}"
       exit 1
     fi
 
-    if ! compute_nic_template=$(python3.4 -B $LIB/python/apex_python_utils.py nic-template -r compute -s $NETSETS -i $net_isolation_enabled -t $CONFIG/nics-template.yaml.jinja2 -n "$enabled_network_list" -e $ext_net_type -af $ip_addr_family -d "$ovs_dpdk_bridge"); then
+    if ! compute_nic_template=$(python3.4 -B $LIB/python/apex_python_utils.py nic-template -r compute -s $NETSETS $net_isolation_arg -t $CONFIG/nics-template.yaml.jinja2 -n "$enabled_network_list" -e $ext_net_type -af $ip_addr_family -d "$ovs_dpdk_bridge"); then
       echo -e "${red}ERROR: Failed to generate compute NIC heat template ${reset}"
       exit 1
     fi
index 47c1009..12ac409 100644 (file)
@@ -57,7 +57,7 @@ class TestCommonUtils(object):
     def test_parse_net_settings(self):
         args = self.parser.parse_args(['parse-net-settings',
                                        '-s', net_sets,
-                                       '-i', 'True',
+                                       '--flat',
                                        '-e', net_env])
         assert_equal(parse_net_settings(args), None)