From: Daniel Henrique Barboza <dhbarboza82(a)gmail.com>
This patch adds the 'module' key to the interfaces API. This
information was already being retrieved by the model but
the control class was ignoring it.
Docs and test changes included.
Signed-off-by: Daniel Henrique Barboza <dhbarboza82(a)gmail.com>
---
control/interfaces.py | 3 ++-
docs/API.md | 2 ++
tests/test_rest.py | 2 +-
3 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/control/interfaces.py b/control/interfaces.py
index b04fc26..c65839a 100644
--- a/control/interfaces.py
+++ b/control/interfaces.py
@@ -43,4 +43,5 @@ class Interface(Resource):
'type': self.info['type'],
'ipaddr': self.info['ipaddr'],
'netmask': self.info['netmask'],
- 'status': self.info['status']}
+ 'status': self.info['status'],
+ 'module': self.info['module']}
diff --git a/docs/API.md b/docs/API.md
index 9d42c53..3a0cf02 100644
--- a/docs/API.md
+++ b/docs/API.md
@@ -663,6 +663,8 @@ A interface represents available interface on host.
* bonding: The combination of network interfaces on one host for redundancy
and/or increased throughput.
* bridge: A network device that connects multiple network segments.
+ * module: the name of the kernel module used to load this interface. Returns
+ 'unknown' if not applicable (ex: interface is a vlan).
* **POST**: *See Interface Actions*
diff --git a/tests/test_rest.py b/tests/test_rest.py
index b73d16c..c1294ee 100644
--- a/tests/test_rest.py
+++ b/tests/test_rest.py
@@ -1271,7 +1271,7 @@ class RestTests(unittest.TestCase):
resp = self.request('/plugins/kimchi/interfaces').read()
self.assertIn('name', resp)
interfaces = json.loads(resp)
- keys = ['name', 'type', 'ipaddr', 'netmask',
'status']
+ keys = ['name', 'type', 'ipaddr', 'netmask',
'status', 'module']
for interface in interfaces:
self.assertEquals(sorted(keys), sorted(interface.keys()))
--
2.5.5