Merge "Add --uuid option to OSC "port create" cmd"
This commit is contained in:
commit
6e417bf2c2
@ -46,6 +46,11 @@ class CreateBaremetalPort(command.ShowOne):
|
||||
required=True,
|
||||
help=_('UUID of the node that this port belongs to.')
|
||||
)
|
||||
parser.add_argument(
|
||||
'--uuid',
|
||||
dest='uuid',
|
||||
metavar='<uuid>',
|
||||
help=_('UUID of the port.'))
|
||||
parser.add_argument(
|
||||
'--extra',
|
||||
metavar="<key=value>",
|
||||
@ -104,7 +109,7 @@ class CreateBaremetalPort(command.ShowOne):
|
||||
parsed_args.local_link_connection = (
|
||||
parsed_args.local_link_connection_deprecated)
|
||||
|
||||
field_list = ['address', 'extra', 'node_uuid', 'pxe_enabled',
|
||||
field_list = ['address', 'uuid', 'extra', 'node_uuid', 'pxe_enabled',
|
||||
'local_link_connection', 'portgroup_uuid']
|
||||
fields = dict((k, v) for (k, v) in vars(parsed_args).items()
|
||||
if k in field_list and v is not None)
|
||||
|
@ -121,6 +121,34 @@ class TestCreateBaremetalPort(TestBaremetalPort):
|
||||
self.check_parser,
|
||||
self.cmd, arglist, verifylist)
|
||||
|
||||
def test_baremetal_port_create_uuid(self):
|
||||
port_uuid = "da6c8d2e-fbcd-457a-b2a7-cc5c775933af"
|
||||
arglist = [
|
||||
baremetal_fakes.baremetal_port_address,
|
||||
'--node', baremetal_fakes.baremetal_uuid,
|
||||
'--uuid', port_uuid
|
||||
]
|
||||
|
||||
verifylist = [
|
||||
('node_uuid', baremetal_fakes.baremetal_uuid),
|
||||
('address', baremetal_fakes.baremetal_port_address),
|
||||
('uuid', port_uuid)
|
||||
]
|
||||
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
|
||||
# DisplayCommandBase.take_action() returns two tuples
|
||||
self.cmd.take_action(parsed_args)
|
||||
|
||||
# Set expected values
|
||||
args = {
|
||||
'address': baremetal_fakes.baremetal_port_address,
|
||||
'node_uuid': baremetal_fakes.baremetal_uuid,
|
||||
'uuid': port_uuid
|
||||
}
|
||||
|
||||
self.baremetal_mock.port.create.assert_called_once_with(**args)
|
||||
|
||||
def _test_baremetal_port_create_llc_warning(self, additional_args,
|
||||
additional_verify_items):
|
||||
arglist = [
|
||||
|
@ -0,0 +1,5 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
Adds the ``--uuid`` option for the ``openstack baremetal port create``
|
||||
command so that the new port's UUID can be specified.
|
Loading…
x
Reference in New Issue
Block a user