Merge "Add support for 'smart-nic' vnic-type"

This commit is contained in:
Zuul 2022-01-19 23:35:59 +00:00 committed by Gerrit Code Review
commit 6ca3341352
2 changed files with 23 additions and 3 deletions

View File

@ -245,15 +245,15 @@ class CreatePort(neutronV20.CreateCommand, UpdatePortSecGroupMixin,
parser.add_argument(
'--vnic-type',
metavar='<direct | direct-physical | macvtap '
'| normal | baremetal>',
'| normal | baremetal | smart-nic>',
choices=['direct', 'direct-physical', 'macvtap',
'normal', 'baremetal'],
'normal', 'baremetal', 'smart-nic'],
type=utils.convert_to_lowercase,
help=_('VNIC type for this port.'))
parser.add_argument(
'--vnic_type',
choices=['direct', 'direct-physical', 'macvtap',
'normal', 'baremetal'],
'normal', 'baremetal', 'smart-nic'],
type=utils.convert_to_lowercase,
help=argparse.SUPPRESS)
parser.add_argument(

View File

@ -214,6 +214,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_smart_nic(self):
# Create port: --vnic_type smart-nic netid.
resource = 'port'
cmd = port.CreatePort(test_cli20.MyApp(sys.stdout), None)
name = 'myname'
myid = 'myid'
netid = 'netid'
args = ['--vnic_type', 'smart-nic', netid]
position_names = ['binding:vnic_type', 'network_id']
position_values = ['smart-nic', netid]
self._test_create_resource(resource, cmd, name, myid, args,
position_names, position_values)
# Test dashed options
args = ['--vnic-type', 'smart-nic', netid]
position_names = ['binding:vnic_type', 'network_id']
position_values = ['smart-nic', netid]
self._test_create_resource(resource, cmd, name, myid, args,
position_names, position_values)
def test_create_port_with_binding_profile(self):
resource = 'port'
cmd = port.CreatePort(test_cli20.MyApp(sys.stdout), None)