summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2010-05-12 20:13:31 +0200
committerMarcel Holtmann <marcel@holtmann.org>2010-05-12 20:13:31 +0200
commit8ef138ed47359f81dd6143a20d39ef249bf75dcd (patch)
treee67efbb918e334a5671cfb2613198a3a5a968fb5 /test
parent1eae10743f813bf0cb7aaef12fb5e6cdc489f6de (diff)
downloadconnman-8ef138ed47359f81dd6143a20d39ef249bf75dcd.tar.gz
connman-8ef138ed47359f81dd6143a20d39ef249bf75dcd.tar.bz2
connman-8ef138ed47359f81dd6143a20d39ef249bf75dcd.zip
Add support for setting manual DNS server configuration
Diffstat (limited to 'test')
-rwxr-xr-xtest/list-services9
-rwxr-xr-xtest/monitor-services9
-rwxr-xr-xtest/set-nameservers20
3 files changed, 38 insertions, 0 deletions
diff --git a/test/list-services b/test/list-services
index 8105f61c..e7476561 100755
--- a/test/list-services
+++ b/test/list-services
@@ -10,6 +10,13 @@ def extract_values(values):
val += " }"
return val
+def extract_list(list):
+ val = "["
+ for i in list:
+ val += " " + str(i)
+ val += " ]"
+ return val
+
bus = dbus.SystemBus()
manager = dbus.Interface(bus.get_object("org.moblin.connman", "/"),
@@ -28,6 +35,8 @@ for path in properties["Services"]:
for key in properties.keys():
if key in ["IPv4", "IPv4.Configuration", "Proxy", "Ethernet"]:
val = extract_values(properties[key])
+ elif key in ["Nameservers", "Nameservers.Configuration"]:
+ val = extract_list(properties[key])
elif key in ["Favorite", "Immutable", "AutoConnect",
"SetupRequired", "PassphraseRequired"]:
if properties[key] == dbus.Boolean(1):
diff --git a/test/monitor-services b/test/monitor-services
index f1d7cf1c..5657444c 100755
--- a/test/monitor-services
+++ b/test/monitor-services
@@ -13,6 +13,13 @@ def extract_values(values):
val += " }"
return val
+def extract_list(list):
+ val = "["
+ for i in list:
+ val += " " + str(i)
+ val += " ]"
+ return val
+
def property_changed(name, value, path):
service = path[path.rfind("/") + 1:]
if name in ["Profiles", "Services", "Providers", "Technologies",
@@ -23,6 +30,8 @@ def property_changed(name, value, path):
val = val + " ]"
elif name in ["IPv4", "IPv4.Configuration", "Proxy", "Ethernet"]:
val = extract_values(value)
+ elif name in ["Nameservers", "Nameservers.Configuration"]:
+ val = extract_list(value)
elif name in ["Strength", "Priority"]:
val = int(value)
else:
diff --git a/test/set-nameservers b/test/set-nameservers
new file mode 100755
index 00000000..9e513a5b
--- /dev/null
+++ b/test/set-nameservers
@@ -0,0 +1,20 @@
+#!/usr/bin/python
+
+import sys
+import dbus
+
+if (len(sys.argv) < 2):
+ print "Usage: %s <service> [nameserver*]" % (sys.argv[0])
+ sys.exit(1)
+
+bus = dbus.SystemBus()
+path = "/profile/default/" + sys.argv[1]
+service = dbus.Interface(bus.get_object('org.moblin.connman', path),
+ 'org.moblin.connman.Service')
+
+properties = service.GetProperties()
+
+print "Setting nameserver to %s" % (sys.argv[2:])
+
+service.SetProperty("Nameservers.Configuration",
+ dbus.Array(sys.argv[2:], signature=dbus.Signature('s')))