about summary refs log tree commit diff
path: root/tools/test-networkmanager-service.py
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2024-05-05 00:07:30 +0200
committerMichael Biebl <biebl@debian.org>2024-05-05 00:07:30 +0200
commit34bb501be08aa2b313d88e67d6e0a7e0a3f9cfa6 (patch)
tree4e6220877828be4c6f261de09ec0cb2d80e32389 /tools/test-networkmanager-service.py
parentbba2e4b4de668db525cbfdfc35292e5a0b51671a (diff)
New upstream version 1.47.90 upstream/1.47.90
Diffstat (limited to 'tools/test-networkmanager-service.py')
-rwxr-xr-xtools/test-networkmanager-service.py70
1 files changed, 58 insertions, 12 deletions
diff --git a/tools/test-networkmanager-service.py b/tools/test-networkmanager-service.py
index f274a460..b4268721 100755
--- a/tools/test-networkmanager-service.py
+++ b/tools/test-networkmanager-service.py
@@ -31,6 +31,37 @@ _DEFAULT_ARG = object()
 ###############################################################################
 
 
+class AliasedProperty:
+    def __init__(self, old_name, new_name):
+        self.old_name = old_name
+        self.new_name = new_name
+
+
+ALIASED_PROPERTIES = {
+    NM.SETTING_CONNECTION_SETTING_NAME: [
+        AliasedProperty(
+            NM.SETTING_CONNECTION_MASTER,
+            "controller",  # NM.SETTING_CONNECTION_CONTROLLER
+        ),
+        AliasedProperty(
+            NM.SETTING_CONNECTION_SLAVE_TYPE,
+            "port-type",  # NM.SETTING_CONNECTION_PORT_TYPE
+        ),
+        AliasedProperty(NM.SETTING_CONNECTION_AUTOCONNECT_SLAVES, "autoconnect-ports"),
+    ],
+    NM.SETTING_WIRELESS_SETTING_NAME: [
+        AliasedProperty(
+            NM.SETTING_WIRELESS_MAC_ADDRESS_BLACKLIST, "mac-address-denylist"
+        )
+    ],
+    NM.SETTING_WIRED_SETTING_NAME: [
+        AliasedProperty(NM.SETTING_WIRED_MAC_ADDRESS_BLACKLIST, "mac-address-denylist")
+    ],
+}
+
+###############################################################################
+
+
 class Global:
     pass
 
@@ -2118,6 +2149,13 @@ class Connection(ExportedObj):
         out_signature="a{sv}",
     )
     def Update2(self, con_hash, flags, args):
+        for setting_name in ALIASED_PROPERTIES.keys():
+            if setting_name in con_hash:
+                setting = con_hash[setting_name]
+                for pty in ALIASED_PROPERTIES[setting_name]:
+                    if pty.new_name in setting and pty.old_name in setting:
+                        del setting[pty.new_name]
+
         self.update_connection(con_hash, True)
         return []
 
@@ -2329,12 +2367,16 @@ class IP4Config(ExportedObj):
                 a = {
                     "dest": Util.random_ip(seed, net="192.168.0.0/16")[0],
                     "prefix": Util.random_int(seed, 17, 32),
-                    "next-hop": None
-                    if (Util.random_int(seed) % 3 == 0)
-                    else Util.random_ip(seed, net="192.168.0.0/16")[0],
-                    "metric": -1
-                    if (Util.random_int(seed) % 3 == 0)
-                    else Util.random_int(seed, 0, 0xFFFFFFFF),
+                    "next-hop": (
+                        None
+                        if (Util.random_int(seed) % 3 == 0)
+                        else Util.random_ip(seed, net="192.168.0.0/16")[0]
+                    ),
+                    "metric": (
+                        -1
+                        if (Util.random_int(seed) % 3 == 0)
+                        else Util.random_int(seed, 0, 0xFFFFFFFF)
+                    ),
                 }
                 routes.append(a)
 
@@ -2527,12 +2569,16 @@ class IP6Config(ExportedObj):
                 a = {
                     "dest": Util.random_ip(seed, net="2001:a::/64")[0],
                     "prefix": Util.random_int(seed, 65, 128),
-                    "next-hop": None
-                    if (Util.random_int(seed) % 3 == 0)
-                    else Util.random_ip(seed, net="2001:a::/64")[0],
-                    "metric": -1
-                    if (Util.random_int(seed) % 3 == 0)
-                    else Util.random_int(seed, 0, 0xFFFFFFFF),
+                    "next-hop": (
+                        None
+                        if (Util.random_int(seed) % 3 == 0)
+                        else Util.random_ip(seed, net="2001:a::/64")[0]
+                    ),
+                    "metric": (
+                        -1
+                        if (Util.random_int(seed) % 3 == 0)
+                        else Util.random_int(seed, 0, 0xFFFFFFFF)
+                    ),
                 }
                 routes.append(a)