summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2019-10-31 16:38:36 +0100
committerThomas Haller <thaller@redhat.com>2019-11-07 11:34:36 +0100
commitec39498fc6d70cf6887f08b4dfbc5cff021fc231 (patch)
treeeeab0b603e979befb473f6fa940578d7f632d2e4
parentabb68d90fc8cef0e7a2895b6540b3e766c17648d (diff)
downloadNetworkManager-ec39498fc6d70cf6887f08b4dfbc5cff021fc231.tar.gz
tests: support D-Bus property Device.StateReason in mock service
The device interface (org.freedesktop.NetworkManager.Device) has two properties: "State" and "StateReason". Both of them are supported by NetworkManager for a very long time. Note that "StateReason" is a tuple and also exposes the state along the reason. When reworking libnm, we will ignore the "State" property and only consider "StateReason". The advantage is less code and not using redundant state. This will also work well, because NetworkManager's D-Bus API supports this property for a very long time. However, that would then break the CI tests, because currently "tools/test-networkmanager-service.py" does not expose that property. Add it.
-rwxr-xr-xtools/test-networkmanager-service.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/tools/test-networkmanager-service.py b/tools/test-networkmanager-service.py
index 19d4baef2c..e91b45233e 100755
--- a/tools/test-networkmanager-service.py
+++ b/tools/test-networkmanager-service.py
@@ -672,6 +672,7 @@ PRP_DEVICE_UDI = "Udi"
PRP_DEVICE_IFACE = "Interface"
PRP_DEVICE_DRIVER = "Driver"
PRP_DEVICE_STATE = "State"
+PRP_DEVICE_STATE_REASON = "StateReason"
PRP_DEVICE_ACTIVE_CONNECTION = "ActiveConnection"
PRP_DEVICE_IP4_CONFIG = "Ip4Config"
PRP_DEVICE_IP6_CONFIG = "Ip6Config"
@@ -700,11 +701,14 @@ class Device(ExportedObj):
self.dhcp4_config = None
self.dhcp6_config = None
+ self.prp_state = NM.DeviceState.UNAVAILABLE
+
props = {
PRP_DEVICE_UDI: "/sys/devices/virtual/%s" % (iface),
PRP_DEVICE_IFACE: iface,
PRP_DEVICE_DRIVER: "virtual",
- PRP_DEVICE_STATE: dbus.UInt32(NM.DeviceState.UNAVAILABLE),
+ PRP_DEVICE_STATE: dbus.UInt32(self.prp_state),
+ PRP_DEVICE_STATE_REASON: dbus.Struct((dbus.UInt32(self.prp_state), dbus.UInt32(NM.DeviceStateReason.NONE))),
PRP_DEVICE_ACTIVE_CONNECTION: ExportedObj.to_path(None),
PRP_DEVICE_IP4_CONFIG: ExportedObj.to_path(self.ip4_config),
PRP_DEVICE_IP6_CONFIG: ExportedObj.to_path(self.ip6_config),