Create port with specific port group UUID in OSC

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

Change-Id: I0678899098d78c2a5f6cc0557254b8635020703d
Partial-Bug: #1632646
This commit is contained in:
Kyrylo Romanenko 2016-12-16 14:38:07 +00:00
parent 45663ebb44
commit b3699257f7

@ -104,3 +104,21 @@ class BaremetalPortTests(base.TestCase):
show_prop = self.port_show(self.port['uuid'], ['extra'])
self.assertNotIn(extra_key, show_prop['extra'])
def test_port_create_with_portgroup(self):
"""Create port with specific port group UUID.
Test steps:
1) Create node in setUp().
2) Create a port group.
3) Create a port with specified port group.
4) Check port properties for portgroup_uuid.
"""
api_version = ' --os-baremetal-api-version 1.24'
port_group = self.port_group_create(self.node['uuid'],
params=api_version)
port = self.port_create(
self.node['uuid'],
params='--port-group {0} {1}'.format(port_group['uuid'],
api_version))
self.assertEqual(port_group['uuid'], port['portgroup_uuid'])