Tempest: add tempest test cases for server networks API

Change-Id: I1a10af4c7ce06b02fdde96d22ce5a4ee2c9d2ea6
Partial-Bug: #1697813
This commit is contained in:
liusheng 2017-06-16 10:23:53 +08:00
parent 19291b87f9
commit 30767640c6
2 changed files with 22 additions and 0 deletions

View File

@ -152,3 +152,18 @@ class BaremetalComputeAPIServersTest(base.BaseBaremetalComputeTest):
console = self.baremetal_compute_client.server_get_serial_console(
self.server_ids[0])
self.assertIn('url', console)
def test_server_get_nics(self):
nics = self.baremetal_compute_client.server_get_networks(
self.server_ids[0])
self.assertIsInstance(nics, list)
nic = nics[0]
self.assertIn('network_id', nic)
self.assertIn('port_id', nic)
self.assertIn('floating_ip', nic)
self.assertIn('port_type', nic)
self.assertIn('mac_address', nic)
self.assertIsInstance(nic['fixed_ips'], list)
fixed_ip = nic['fixed_ips'][0]
self.assertIn('subnet_id', fixed_ip)
self.assertIn('ip_address', fixed_ip)

View File

@ -183,6 +183,13 @@ class BaremetalComputeClient(rest_client.RestClient):
body = self.deserialize(body)['console']
return rest_client.ResponseBody(resp, body)
def server_get_networks(self, server_id):
uri = '%s/servers/%s/networks' % (self.uri_prefix, server_id)
resp, body = self.get(uri)
self.expected_success(200, resp.status)
body = self.deserialize(body)['nics']
return rest_client.ResponseBodyList(resp, body)
class BaremetalNodeClient(rest_client.RestClient):
version = '1'