about summary refs log tree commit diff
path: root/src/devices/tests
diff options
context:
space:
mode:
authorSebastien Bacher <seb128@ubuntu.com>2019-05-10 15:07:08 +0200
committerSebastien Bacher <seb128@ubuntu.com>2019-05-22 13:41:30 +0200
commitd57a1dd26f8e9859252b0983c2d2ec3b95eb5714 (patch)
tree46f1146e87af8cc7b58b751f7e575bd0abb2f59d /src/devices/tests
parentad9ed8bfb963266b4eea524131845f406cfc55d7 (diff)
parent85563b7fc7ec2cd21e38debb9b28db342e2e8e7c (diff)
Import Debian changes 1.18.0-1ubuntu1
network-manager (1.18.0-1ubuntu1) eoan; urgency=medium

  * Update to 1.18, merge on Debian, new version includes nwe support for
    policy routing rules and for VLAN filtering for Linux bridge.
  * Remaining Ubuntu changes
    - Use systemd-resolved instead of dnsmasq
    - debian/control:
      + Depend on isc-dhcp-client instead of recommends
      + Recommend network-manager-pptp
      + Suggest avahi-autoipd for IPv4LL support
    - debian/rules, debian/network-manager.postinst:
      + Don't restart NetworkManager on upgrade but recommend restarting
        the computer
    - debian/rules, debian/network-manager.postinst:
      + Don't install sysvinit scripts or migrate from sysvinit
    - debian/network-manager.postinst:
      + Don't add the netdev group.
      + drop in an empty override file for NetworkManager to manage all
        devices for upgrade from any version, as long as there is no
        netplan configuration yet.
    - debian/default-wifi-powersave-on.conf, debian/rules:
      + Install a config file to enable WiFi powersave
    - Enable build tests
    - Add autopkgtests
    - debian/source_network-manager.py, debian/network-manager.install,
      debian/network-manager.links: Add apport hook
    - Add network-manager-config-connectivity-ubuntu package
    - NetworkManager.conf: disable MAC randomization feature. There is no
      easy way for desktop users to disable this feature yet. And there are
      reports that it doesn't work well with some systems.
    - Update Vcs links to point to Ubuntu branch
    - Add patches. See patch descriptions for more details:
      + Provide-access-to-some-of-NM-s-interfaces-to-whoopsie.patch
      + Update-dnsmasq-parameters.patch
      + Disable-general-with-expect.patch
      + libnm-Check-self-still-NMManager-or-not.patch
      + dns-manager-don-t-merge-split-DNS-search-domains.patch (but disabled)
      + Read-system-connections-from-run.patch
    - debian/tests/urfkill-integration - don't stop/start network manager
    - Revert "Add Conflicts to network-manager-dev against deprecated libraries"
      This reverts commit b4acc5e03e2b821e1cccc69529bb70826c741942.  We're still
      building libnm-glib for now, so these packages have a use in Ubuntu.
  * Removed delta, not needed anymore
    - debian/network-manager.maintscript
      + Remove /etc/dbus-1/system.d/nm-ofono.conf
Diffstat (limited to 'src/devices/tests')
-rw-r--r--src/devices/tests/test-acd.c26
-rw-r--r--src/devices/tests/test-lldp.c76
2 files changed, 83 insertions, 19 deletions
diff --git a/src/devices/tests/test-acd.c b/src/devices/tests/test-acd.c
index aff71825..8b52ee2c 100644
--- a/src/devices/tests/test-acd.c
+++ b/src/devices/tests/test-acd.c
@@ -111,8 +111,8 @@ acd_manager_probe_terminated (NMAcdManager *acd_manager, gpointer user_data)
 static void
 test_acd_common (test_fixture *fixture, TestInfo *info)
 {
-	NMAcdManager *manager;
-	GMainLoop *loop;
+	nm_auto_free_acdmgr NMAcdManager *manager = NULL;
+	nm_auto_unref_gmainloop GMainLoop *loop = NULL;
 	int i;
 	const guint WAIT_TIME_OPTIMISTIC = 50;
 	guint wait_time;
@@ -120,6 +120,7 @@ test_acd_common (test_fixture *fixture, TestInfo *info)
 		.probe_terminated_callback = acd_manager_probe_terminated,
 		.user_data_destroy         = (GDestroyNotify) g_main_loop_unref,
 	};
+	int r;
 
 	if (_skip_acd_test ())
 		return;
@@ -131,8 +132,10 @@ test_acd_common (test_fixture *fixture, TestInfo *info)
 	wait_time = WAIT_TIME_OPTIMISTIC;
 again:
 
+	nm_clear_pointer (&loop, g_main_loop_unref);
 	loop = g_main_loop_new (NULL, FALSE);
 
+	nm_clear_pointer (&manager, nm_acd_manager_free);
 	manager = nm_acd_manager_new (fixture->ifindex0,
 	                              fixture->hwaddr0,
 	                              fixture->hwaddr0_len,
@@ -148,9 +151,10 @@ again:
 		                        24, 0, 3600, 1800, 0, NULL);
 	}
 
-	g_assert (nm_acd_manager_start_probe (manager, wait_time));
+	r = nm_acd_manager_start_probe (manager, wait_time);
+	g_assert_cmpint (r, ==, 0);
+
 	g_assert (nmtst_main_loop_run (loop, 2000));
-	g_main_loop_unref (loop);
 
 	for (i = 0; info->addresses[i]; i++) {
 		gboolean val;
@@ -164,7 +168,6 @@ again:
 			/* probably we just had a glitch and the system took longer than
 			 * expected. Re-verify with a large timeout this time. */
 			wait_time = 1000;
-			nm_clear_pointer (&manager, nm_acd_manager_free);
 			goto again;
 		}
 
@@ -172,8 +175,6 @@ again:
 		         i, nm_utils_inet4_ntop (info->addresses[i], sbuf),
 		         info->expected_result[i] ? "detect no duplicated" : "detect a duplicate");
 	}
-
-	nm_acd_manager_free (manager);
 }
 
 static void
@@ -199,8 +200,9 @@ test_acd_probe_2 (test_fixture *fixture, gconstpointer user_data)
 static void
 test_acd_announce (test_fixture *fixture, gconstpointer user_data)
 {
-	NMAcdManager *manager;
-	GMainLoop *loop;
+	nm_auto_free_acdmgr NMAcdManager *manager = NULL;
+	nm_auto_unref_gmainloop GMainLoop *loop = NULL;
+	int r;
 
 	if (_skip_acd_test ())
 		return;
@@ -216,11 +218,9 @@ test_acd_announce (test_fixture *fixture, gconstpointer user_data)
 	g_assert (nm_acd_manager_add_address (manager, ADDR2));
 
 	loop = g_main_loop_new (NULL, FALSE);
-	nm_acd_manager_announce_addresses (manager);
+	r = nm_acd_manager_announce_addresses (manager);
+	g_assert_cmpint (r, ==, 0);
 	g_assert (!nmtst_main_loop_run (loop, 200));
-	g_main_loop_unref (loop);
-
-	nm_acd_manager_free (manager);
 }
 
 static void
diff --git a/src/devices/tests/test-lldp.c b/src/devices/tests/test-lldp.c
index 7227d082..7b135f58 100644
--- a/src/devices/tests/test-lldp.c
+++ b/src/devices/tests/test-lldp.c
@@ -231,8 +231,10 @@ TEST_RECV_FRAME_DEFINE (_test_recv_data1_frame0,
 static void
 _test_recv_data1_check (GMainLoop *loop, NMLldpListener *listener)
 {
-	GVariant *neighbors, *attr;
+	GVariant *neighbors, *attr, *child;
 	gs_unref_variant GVariant *neighbor = NULL;
+	guint v_uint = 0;
+	const char *v_str = NULL;
 
 	neighbors = nm_lldp_listener_get_neighbors (listener);
 	nmtst_assert_variant_is_of_type (neighbors, G_VARIANT_TYPE ("aa{sv}"));
@@ -242,7 +244,7 @@ _test_recv_data1_check (GMainLoop *loop, NMLldpListener *listener)
 	                              SD_LLDP_CHASSIS_SUBTYPE_MAC_ADDRESS, "00:01:30:F9:AD:A0",
 	                              SD_LLDP_PORT_SUBTYPE_INTERFACE_NAME, "1/1");
 	g_assert (neighbor);
-	g_assert_cmpint (g_variant_n_children (neighbor), ==, 4 + 10);
+	g_assert_cmpint (g_variant_n_children (neighbor), ==, 4 + 16);
 
 	attr = g_variant_lookup_value (neighbor, NM_LLDP_ATTR_DESTINATION, G_VARIANT_TYPE_STRING);
 	nmtst_assert_variant_string (attr, NM_LLDP_DEST_NEAREST_BRIDGE);
@@ -270,11 +272,49 @@ _test_recv_data1_check (GMainLoop *loop, NMLldpListener *listener)
 	nmtst_assert_variant_uint32 (attr, 20);
 	nm_clear_g_variant (&attr);
 
-	/* unsupported: Management Address */
-	/* unsupported: IEEE 802.3 - Power Via MDI */
-	/* unsupported: IEEE 802.3 - MAC/PHY Configuration/Status */
+	/* Management Address */
+	attr = g_variant_lookup_value (neighbor, NM_LLDP_ATTR_MANAGEMENT_ADDRESSES, G_VARIANT_TYPE ("aa{sv}"));
+	g_assert (attr);
+	g_assert_cmpuint (g_variant_n_children (attr), ==, 1);
+	child = g_variant_get_child_value (attr, 0);
+	g_assert (child);
+	g_variant_lookup (child, "interface-number", "u", &v_uint);
+	g_assert_cmpint (v_uint, ==, 1001);
+	g_variant_lookup (child, "interface-number-subtype", "u", &v_uint);
+	g_assert_cmpint (v_uint, ==, 2);
+	g_variant_lookup (child, "address-subtype", "u", &v_uint);
+	g_assert_cmpint (v_uint, ==, 6);
+	nm_clear_g_variant (&child);
+	nm_clear_g_variant (&attr);
+
+	/* IEEE 802.3 - Power Via MDI */
+	attr = g_variant_lookup_value (neighbor, NM_LLDP_ATTR_IEEE_802_3_POWER_VIA_MDI, G_VARIANT_TYPE_VARDICT);
+	g_assert (attr);
+	g_variant_lookup (attr, "mdi-power-support", "u", &v_uint);
+	g_assert_cmpint (v_uint, ==, 7);
+	g_variant_lookup (attr, "pse-power-pair", "u", &v_uint);
+	g_assert_cmpint (v_uint, ==, 1);
+	g_variant_lookup (attr, "power-class", "u", &v_uint);
+	g_assert_cmpint (v_uint, ==, 0);
+	nm_clear_g_variant (&attr);
+
+	/* IEEE 802.3 - MAC/PHY Configuration/Status */
+	attr = g_variant_lookup_value (neighbor, NM_LLDP_ATTR_IEEE_802_3_MAC_PHY_CONF, G_VARIANT_TYPE_VARDICT);
+	g_assert (attr);
+	g_variant_lookup (attr, "autoneg", "u", &v_uint);
+	g_assert_cmpint (v_uint, ==, 3);
+	g_variant_lookup (attr, "pmd-autoneg-cap", "u", &v_uint);
+	g_assert_cmpint (v_uint, ==, 0x6c00);
+	g_variant_lookup (attr, "operational-mau-type", "u", &v_uint);
+	g_assert_cmpint (v_uint, ==, 16);
+	nm_clear_g_variant (&attr);
+
 	/* unsupported: IEEE 802.3 - Link Aggregation */
-	/* unsupported: IEEE 802.3 - Maximum Frame Size*/
+
+	/* Maximum Frame Size */
+	attr = g_variant_lookup_value (neighbor, NM_LLDP_ATTR_IEEE_802_3_MAX_FRAME_SIZE, G_VARIANT_TYPE_UINT32);
+	nmtst_assert_variant_uint32 (attr, 1522);
+	nm_clear_g_variant (&attr);
 
 	/* IEEE 802.1 - Port VLAN ID */
 	attr = g_variant_lookup_value (neighbor, NM_LLDP_ATTR_IEEE_802_1_PVID, G_VARIANT_TYPE_UINT32);
@@ -289,6 +329,18 @@ _test_recv_data1_check (GMainLoop *loop, NMLldpListener *listener)
 	nmtst_assert_variant_uint32 (attr, 1);
 	nm_clear_g_variant (&attr);
 
+	/* new PPVID attributes */
+	attr = g_variant_lookup_value (neighbor, NM_LLDP_ATTR_IEEE_802_1_PPVIDS, G_VARIANT_TYPE ("aa{sv}"));
+	g_assert_cmpuint (g_variant_n_children (attr), ==, 1);
+	child = g_variant_get_child_value (attr, 0);
+	g_assert (child);
+	g_variant_lookup (child, "ppvid", "u", &v_uint);
+	g_assert_cmpint (v_uint, ==, 0);
+	g_variant_lookup (child, "flags", "u", &v_uint);
+	g_assert_cmpint (v_uint, ==, 1);
+	nm_clear_g_variant (&child);
+	nm_clear_g_variant (&attr);
+
 	/* IEEE 802.1 - VLAN Name */
 	attr = g_variant_lookup_value (neighbor, NM_LLDP_ATTR_IEEE_802_1_VLAN_NAME, G_VARIANT_TYPE_STRING);
 	nmtst_assert_variant_string (attr, "v2-0488-03-0505");
@@ -297,6 +349,18 @@ _test_recv_data1_check (GMainLoop *loop, NMLldpListener *listener)
 	nmtst_assert_variant_uint32 (attr, 488);
 	nm_clear_g_variant (&attr);
 
+	/* new VLAN attributes */
+	attr = g_variant_lookup_value (neighbor, NM_LLDP_ATTR_IEEE_802_1_VLANS, G_VARIANT_TYPE ("aa{sv}"));
+	g_assert_cmpuint (g_variant_n_children (attr), ==, 1);
+	child = g_variant_get_child_value (attr, 0);
+	g_assert (child);
+	g_variant_lookup (child, "vid", "u", &v_uint);
+	g_assert_cmpint (v_uint, ==, 488);
+	g_variant_lookup (child, "name", "&s", &v_str);
+	g_assert_cmpstr (v_str, ==, "v2-0488-03-0505");
+	nm_clear_g_variant (&child);
+	nm_clear_g_variant (&attr);
+
 	/* unsupported: IEEE 802.1 - Protocol Identity */
 }