Add test to create a port with specific port group UUID

Add test to create a port with specific port group UUID
using --portgroup option in ironicclient.

Change-Id: Ib5124cd787e8504e61a8615a69937866c6b0b0b6
Partial-Bug: #1562035
This commit is contained in:
Kyrylo Romanenko 2016-12-16 15:52:02 +02:00
parent 3992c5ddb6
commit 4d24d4b093
2 changed files with 19 additions and 0 deletions

View File

@ -352,12 +352,14 @@ class FunctionalTestBase(base.ClientTestBase):
def create_port(self,
node_id,
mac_address=None,
flags='',
params=''):
if mac_address is None:
mac_address = data_utils.rand_mac_address()
port = self.ironic('port-create',
flags=flags,
params='--address {0} --node {1} {2}'
.format(mac_address, node_id, params))
if not port:

View File

@ -115,3 +115,20 @@ class PortSanityTestIronicClient(base.FunctionalTestBase):
addresses = {x['Address'] for x in port_list}
self.assertTrue({self.port['address'],
other_port['address']}.issubset(addresses))
def test_port_create_with_portgroup_uuid(self):
"""Test steps:
1) Create node in setUp().
2) Create a port group.
3) Create a port with specified port group UUID.
4) Check port properties for portgroup_uuid.
"""
flag = '--ironic-api-version 1.25'
port_group = self.create_portgroup(self.node['uuid'])
port = self.create_port(
self.node['uuid'],
flags=flag,
params='--portgroup {0}'.format(port_group['uuid']))
self.assertEqual(port_group['uuid'], port['portgroup_uuid'])