ifcfg-rh: add a testcase for numeric bonding mode values in BONDING_OPTS
This commit is contained in:
@@ -3832,7 +3832,8 @@ handle_bond_option (NMSettingBond *s_bond,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!nm_setting_bond_add_option (s_bond, key, sanitized ? sanitized : value))
|
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);
|
g_free (sanitized);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -106,6 +106,7 @@ EXTRA_DIST = \
|
|||||||
ifcfg-test-bond-main \
|
ifcfg-test-bond-main \
|
||||||
ifcfg-test-bond-slave \
|
ifcfg-test-bond-slave \
|
||||||
ifcfg-test-bond-slave-ib \
|
ifcfg-test-bond-slave-ib \
|
||||||
|
ifcfg-test-bond-mode-numeric \
|
||||||
ifcfg-test-dcb \
|
ifcfg-test-dcb \
|
||||||
ifcfg-test-dcb-default-app-priorities \
|
ifcfg-test-dcb-default-app-priorities \
|
||||||
ifcfg-test-dcb-bad-booleans \
|
ifcfg-test-dcb-bad-booleans \
|
||||||
|
@@ -0,0 +1,5 @@
|
|||||||
|
DEVICE=bond0
|
||||||
|
ONBOOT=no
|
||||||
|
TYPE=Bond
|
||||||
|
BOOTPROTO=dhcp
|
||||||
|
BONDING_OPTS="mode=4 miimon=100"
|
@@ -11443,6 +11443,37 @@ test_write_bond_slave_ib (void)
|
|||||||
g_object_unref (reread);
|
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 | \
|
#define DCB_ALL_FLAGS (NM_SETTING_DCB_FLAG_ENABLE | \
|
||||||
NM_SETTING_DCB_FLAG_ADVERTISE | \
|
NM_SETTING_DCB_FLAG_ADVERTISE | \
|
||||||
NM_SETTING_DCB_FLAG_WILLING)
|
NM_SETTING_DCB_FLAG_WILLING)
|
||||||
@@ -12525,6 +12556,7 @@ int main (int argc, char **argv)
|
|||||||
test_write_bond_main ();
|
test_write_bond_main ();
|
||||||
test_write_bond_slave ();
|
test_write_bond_slave ();
|
||||||
test_write_bond_slave_ib ();
|
test_write_bond_slave_ib ();
|
||||||
|
g_test_add_func (TPATH "bond/bonding-opts-numeric-mode", test_read_bond_opts_mode_numeric);
|
||||||
|
|
||||||
/* bridging */
|
/* bridging */
|
||||||
test_read_bridge_main ();
|
test_read_bridge_main ();
|
||||||
|
Reference in New Issue
Block a user