diff --git a/neutronclient/neutron/v2_0/port.py b/neutronclient/neutron/v2_0/port.py index 49a2610c2..f4a3e2229 100644 --- a/neutronclient/neutron/v2_0/port.py +++ b/neutronclient/neutron/v2_0/port.py @@ -238,12 +238,16 @@ class CreatePort(neutronV20.CreateCommand, UpdatePortSecGroupMixin, '--mac_address', help=argparse.SUPPRESS) parser.add_argument( - '--vnic-type', metavar='', - choices=['direct', 'macvtap', 'normal', 'baremetal'], + '--vnic-type', + metavar='', + choices=['direct', 'direct-physical', 'macvtap', + 'normal', 'baremetal'], help=_('VNIC type for this port.')) parser.add_argument( '--vnic_type', - choices=['direct', 'macvtap', 'normal', 'baremetal'], + choices=['direct', 'direct-physical', 'macvtap', + 'normal', 'baremetal'], help=argparse.SUPPRESS) parser.add_argument( '--binding-profile', diff --git a/neutronclient/tests/unit/test_cli20_port.py b/neutronclient/tests/unit/test_cli20_port.py index 0fe898532..3c2e4c585 100644 --- a/neutronclient/tests/unit/test_cli20_port.py +++ b/neutronclient/tests/unit/test_cli20_port.py @@ -153,6 +153,26 @@ class CLITestV20PortJSON(test_cli20.CLITestV20Base): self._test_create_resource(resource, cmd, name, myid, args, position_names, position_values) + def test_create_port_vnic_type_direct_physical(self): + # Create port: --vnic_type direct-physical netid. + resource = 'port' + cmd = port.CreatePort(test_cli20.MyApp(sys.stdout), None) + name = 'myname' + myid = 'myid' + netid = 'netid' + args = ['--vnic_type', 'direct-physical', netid] + position_names = ['binding:vnic_type', 'network_id'] + position_values = ['direct-physical', netid] + self._test_create_resource(resource, cmd, name, myid, args, + position_names, position_values) + + # Test dashed options + args = ['--vnic-type', 'direct-physical', netid] + position_names = ['binding:vnic_type', 'network_id'] + position_values = ['direct-physical', netid] + self._test_create_resource(resource, cmd, name, myid, args, + position_names, position_values) + def test_create_port_vnic_type_macvtap(self): # Create port: --vnic_type macvtap netid. resource = 'port' diff --git a/releasenotes/notes/direct-physical-vnic-port-create-736d8b2600faf22b.yaml b/releasenotes/notes/direct-physical-vnic-port-create-736d8b2600faf22b.yaml new file mode 100644 index 000000000..911377496 --- /dev/null +++ b/releasenotes/notes/direct-physical-vnic-port-create-736d8b2600faf22b.yaml @@ -0,0 +1,6 @@ +--- +features: + - Added new 'direct-physical' vnic-type option for port-create CLI command. + Passing this particular value allows for a port to be create with the + vnic-type used for assigning SR-IOV physical functions to + instances.