commit d7476c89e28e9c63a314208e9b18ec3eb091f218
Author: Radek Pazdera <rpazdera(a)redhat.com>
Date: Mon Oct 8 15:36:41 2012 +0200
NetTestSlave: Adding method for turning of ifaces
This patch introduces a new method to the NetTestSlave
class -- set_device_down(hwaddr).
This method can be used for turning off devices through rpc.
It will be useful for initialization of provisioned machines
through machine pool.
Signed-off-by: Radek Pazdera <rpazdera(a)redhat.com>
NetTest/NetTestSlave.py | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/NetTest/NetTestSlave.py b/NetTest/NetTestSlave.py
index a375f12..765094f 100644
--- a/NetTest/NetTestSlave.py
+++ b/NetTest/NetTestSlave.py
@@ -23,6 +23,7 @@ from NetConfig.NetConfigDevice import NetConfigDeviceAllCleanup
from NetTest.NetTestCommand import NetTestCommandContext, NetTestCommand,
CommandException
from Common.Utils import die_when_parent_die
from Common.NetUtils import scan_netdevs, test_tcp_connection
+from Common.ExecCmd import exec_cmd
DefaultRPCPort = 9999
@@ -60,6 +61,14 @@ class NetTestSlaveXMLRPC:
return netdevs
+ def set_device_down(self, hwaddr):
+ devs = self.get_devices_by_hwaddr(hwaddr)
+
+ for dev in devs:
+ exec_cmd("ip link set %s down" % dev["name"])
+
+ return True
+
def get_interface_info(self, if_id):
if_config = self._netconfig.get_interface_config(if_id)
info = {}
Show replies by date