[PATCH v2 06/11] NetTestSlave: Adding RPC method for dev querying

rpazdera at redhat.com rpazdera at redhat.com
Mon Aug 13 10:01:47 UTC 2012


From: Radek Pazdera <rpazdera at redhat.com>

This commit adds simple RPC method to the slave that allows the
controler to issue a device queries and obtain information about
available devices by hwaddr.

Signed-off-by: Radek Pazdera <rpazdera at redhat.com>
---
 NetTest/NetTestSlave.py |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/NetTest/NetTestSlave.py b/NetTest/NetTestSlave.py
index 12440f7..a7722e4 100644
--- a/NetTest/NetTestSlave.py
+++ b/NetTest/NetTestSlave.py
@@ -22,6 +22,7 @@ from NetConfig.NetConfig import NetConfig
 from NetConfig.NetConfigDevice import NetConfigDeviceAllCleanup
 from NetTest.NetTestCommand import NetTestCommand, CommandException
 from Common.Utils import die_when_parent_die
+from Common.NetUtils import scan_netdevs
 
 DefaultRPCPort = 9999
 
@@ -46,6 +47,16 @@ class NetTestSlaveXMLRPC:
         Logs.append_network_hadler(logger_address, port)
         return True
 
+    def get_devices_by_hwaddr(self, hwaddr):
+        name_scan = scan_netdevs()
+        netdevs = []
+
+        for entry in name_scan:
+            if entry["hwaddr"] == hwaddr:
+                netdevs.append(entry)
+
+        return netdevs
+
     def get_interface_info(self, if_id):
         if_config = self._netconfig.get_interface_config(if_id)
         info = {}
-- 
1.7.7.6



More information about the LNST-developers mailing list