summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorLucas De Marchi <lucas.demarchi@profusion.mobi>2010-02-18 09:16:59 -0200
committerMarcel Holtmann <marcel@holtmann.org>2010-02-18 09:14:22 -0800
commita71874c4ff953b2f3c8089767dc7a7a57a46d36c (patch)
tree4b990271d489837279699d30a4021d1c2cee70be /test
parent8393bb169f348d55133e828748ff87860e93cad0 (diff)
downloadconnman-a71874c4ff953b2f3c8089767dc7a7a57a46d36c.tar.gz
connman-a71874c4ff953b2f3c8089767dc7a7a57a46d36c.tar.bz2
connman-a71874c4ff953b2f3c8089767dc7a7a57a46d36c.zip
Add script to set IP configuration method
This script is used to set IPv4.Configuration property of a service, allowing to change among dhcp and manual methods.
Diffstat (limited to 'test')
-rwxr-xr-xtest/set-ip-method33
1 files changed, 33 insertions, 0 deletions
diff --git a/test/set-ip-method b/test/set-ip-method
new file mode 100755
index 00000000..0d08e4d3
--- /dev/null
+++ b/test/set-ip-method
@@ -0,0 +1,33 @@
+#!/usr/bin/python
+
+import sys
+import dbus
+
+def print_usage():
+ print "Usage: %s <service> [off|dhcp|manual <address> [netmask]]" % (sys.argv[0])
+
+
+if (len(sys.argv) < 3):
+ print_usage()
+ 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 method %s for %s" % (sys.argv[2], sys.argv[1])
+
+ipv4_configuration = { "Method": sys.argv[2] }
+if (len(sys.argv) > 3):
+ ipv4_configuration["Address"] = sys.argv[3]
+if (len(sys.argv) > 4):
+ ipv4_configuration["Netmask"] = sys.argv[4]
+
+
+service.SetProperty("IPv4.Configuration", ipv4_configuration)
+print "New IPv4.Configuration: ", ipv4_configuration
+
+print