Added a command-line to set device mastership role.
diff --git a/cli/src/main/java/org/onlab/onos/cli/net/DeviceRoleCommand.java b/cli/src/main/java/org/onlab/onos/cli/net/DeviceRoleCommand.java
new file mode 100644
index 0000000..32da169
--- /dev/null
+++ b/cli/src/main/java/org/onlab/onos/cli/net/DeviceRoleCommand.java
@@ -0,0 +1,33 @@
+package org.onlab.onos.cli.net;
+
+import org.apache.karaf.shell.commands.Argument;
+import org.apache.karaf.shell.commands.Command;
+import org.onlab.onos.cli.AbstractShellCommand;
+import org.onlab.onos.net.DeviceId;
+import org.onlab.onos.net.MastershipRole;
+import org.onlab.onos.net.device.DeviceAdminService;
+
+/**
+ * Sets role of the controller node for the given infrastructure device.
+ */
+@Command(scope = "onos", name = "device-role",
+         description = "Sets role of the controller node for the given infrastructure device")
+public class DeviceRoleCommand extends AbstractShellCommand {
+
+    @Argument(index = 0, name = "uri", description = "Device ID",
+              required = true, multiValued = false)
+    String uri = null;
+
+    @Argument(index = 1, name = "role", description = "Mastership role",
+              required = true, multiValued = false)
+    String role = null;
+
+    @Override
+    protected Object doExecute() throws Exception {
+        MastershipRole mastershipRole = MastershipRole.valueOf(role.toUpperCase());
+        getService(DeviceAdminService.class).setRole(DeviceId.deviceId(uri),
+                                                     mastershipRole);
+        return null;
+    }
+
+}