diff options
author | Jiří Klimeš <jklimes@redhat.com> | 2014-12-17 10:31:12 +0100 |
---|---|---|
committer | Jiří Klimeš <jklimes@redhat.com> | 2015-01-12 14:41:38 +0100 |
commit | e6204c0ffc5a4fabe024cfcb2cde69168dac8d11 (patch) | |
tree | 2ff2b3ad112267a60c4f35b84261b170f08160f4 | |
parent | fb35bb004497651e0fee47fdfc4a1a5791571445 (diff) | |
download | NetworkManager-jk/numeric-bond-modes.tar.gz |
ifcfg-rh: add a testcase for numeric bonding mode values in BONDING_OPTSjk/numeric-bond-modes
4 files changed, 40 insertions, 1 deletions
diff --git a/src/settings/plugins/ifcfg-rh/reader.c b/src/settings/plugins/ifcfg-rh/reader.c index e892394dcf..9b25098e47 100644 --- a/src/settings/plugins/ifcfg-rh/reader.c +++ b/src/settings/plugins/ifcfg-rh/reader.c @@ -3839,7 +3839,8 @@ handle_bond_option (NMSettingBond *s_bond, } if (!nm_setting_bond_add_option (s_bond, key, sanitized ? sanitized : value)) - PARSE_WARNING ("invalid bonding option '%s'", key); + PARSE_WARNING ("invalid bonding option '%s' = %s", + key, sanitized ? sanitized : value); g_free (sanitized); } diff --git a/src/settings/plugins/ifcfg-rh/tests/network-scripts/Makefile.am b/src/settings/plugins/ifcfg-rh/tests/network-scripts/Makefile.am index 8941da3a62..352db1e718 100644 --- a/src/settings/plugins/ifcfg-rh/tests/network-scripts/Makefile.am +++ b/src/settings/plugins/ifcfg-rh/tests/network-scripts/Makefile.am @@ -106,6 +106,7 @@ EXTRA_DIST = \ ifcfg-test-bond-main \ ifcfg-test-bond-slave \ ifcfg-test-bond-slave-ib \ + ifcfg-test-bond-mode-numeric \ ifcfg-test-dcb \ ifcfg-test-dcb-default-app-priorities \ ifcfg-test-dcb-bad-booleans \ diff --git a/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-bond-mode-numeric b/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-bond-mode-numeric new file mode 100644 index 0000000000..9989f58b97 --- /dev/null +++ b/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-bond-mode-numeric @@ -0,0 +1,5 @@ +DEVICE=bond0 +ONBOOT=no +TYPE=Bond +BOOTPROTO=dhcp +BONDING_OPTS="mode=4 miimon=100" diff --git a/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c b/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c index e05a4ccb20..c56be79638 100644 --- a/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c +++ b/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c @@ -11443,6 +11443,37 @@ test_write_bond_slave_ib (void) g_object_unref (reread); } +static void +test_read_bond_opts_mode_numeric (void) +{ + NMConnection *connection; + NMSettingConnection *s_con; + NMSettingBond *s_bond; + gboolean success; + GError *error = NULL; + + connection = connection_from_file_test (TEST_IFCFG_DIR "/network-scripts/ifcfg-test-bond-mode-numeric", + NULL, TYPE_ETHERNET, NULL, &error); + g_assert_no_error (error); + g_assert (connection); + + success = nm_connection_verify (connection, &error); + g_assert_no_error (error); + g_assert (success); + + g_assert_cmpstr (nm_connection_get_interface_name (connection), ==, "bond0"); + + s_con = nm_connection_get_setting_connection (connection); + g_assert (s_con); + g_assert_cmpstr (nm_setting_connection_get_connection_type (s_con), ==, NM_SETTING_BOND_SETTING_NAME); + + s_bond = nm_connection_get_setting_bond (connection); + g_assert (s_bond); + g_assert_cmpstr (nm_setting_bond_get_option_by_name (s_bond, NM_SETTING_BOND_OPTION_MODE), ==, "802.3ad"); + + g_object_unref (connection); +} + #define DCB_ALL_FLAGS (NM_SETTING_DCB_FLAG_ENABLE | \ NM_SETTING_DCB_FLAG_ADVERTISE | \ NM_SETTING_DCB_FLAG_WILLING) @@ -12525,6 +12556,7 @@ int main (int argc, char **argv) test_write_bond_main (); test_write_bond_slave (); test_write_bond_slave_ib (); + g_test_add_func (TPATH "bond/bonding-opts-numeric-mode", test_read_bond_opts_mode_numeric); /* bridging */ test_read_bridge_main (); |