Add ironic port show by mac address
Add support for ironic port-show command
to show port by mac address.
Change-Id: I9114c2e5d0ac9812dfda07452fcdfead34002b6a
Closes-Bug: #1413897
diff --git a/tempest/api/baremetal/admin/test_ports.py b/tempest/api/baremetal/admin/test_ports.py
index 3392ab9..4aedaa4 100644
--- a/tempest/api/baremetal/admin/test_ports.py
+++ b/tempest/api/baremetal/admin/test_ports.py
@@ -87,6 +87,11 @@
self._assertExpected(self.port, port)
@test.attr(type='smoke')
+ def test_show_port_by_address(self):
+ _, port = self.client.show_port_by_address(self.port['address'])
+ self._assertExpected(self.port, port['ports'][0])
+
+ @test.attr(type='smoke')
def test_show_port_with_links(self):
_, port = self.client.show_port(self.port['uuid'])
self.assertIn('links', port.keys())
diff --git a/tempest/services/baremetal/v1/base_v1.py b/tempest/services/baremetal/v1/base_v1.py
index 9359808..9435dbf 100644
--- a/tempest/services/baremetal/v1/base_v1.py
+++ b/tempest/services/baremetal/v1/base_v1.py
@@ -114,6 +114,19 @@
"""
return self._show_request('ports', uuid)
+ @base.handle_errors
+ def show_port_by_address(self, address):
+ """
+ Gets a specific port by address.
+
+ :param address: MAC address of the port.
+ :return: Serialized port as a dictionary.
+
+ """
+ uri = '/ports/detail?address=%s' % address
+
+ return self._show_request('ports', uuid=None, uri=uri)
+
def show_driver(self, driver_name):
"""
Gets a specific driver.