port: Add 'direct-physical' as a valid vnic-type

When creating a port, it is now valid to pass direct-physical as a
vnic-type, as it's been implemented in the following change:

If1ab969c2002c649a3d51635ca2765c262e2d37f

This patch enables this in the neutron CLI.

DocImpact
Related-bug: 1500993
Change-Id: If3426a6a5b07f6159fd636ae65d0ad3c296db990
This commit is contained in:
Nikola Dipanov
2015-12-30 10:15:46 +00:00
parent 9371c45864
commit 199cb1e4f8
3 changed files with 33 additions and 3 deletions

View File

@@ -238,12 +238,16 @@ class CreatePort(neutronV20.CreateCommand, UpdatePortSecGroupMixin,
'--mac_address',
help=argparse.SUPPRESS)
parser.add_argument(
'--vnic-type', metavar='<direct | macvtap | normal | baremetal>',
choices=['direct', 'macvtap', 'normal', 'baremetal'],
'--vnic-type',
metavar='<direct | direct-physical | macvtap '
'| normal | baremetal>',
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',

View File

@@ -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'

View File

@@ -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.