Add support for 'smart-nic' vnic-type

The 'smart-nic' vnic_type was added in the Train time frame in
I91f63810626ce4e054e358f5de5e46434c4da131.  This vnic_type will
also be used to support off-path SmartNIC port binding with OVN,
and it is expected that the user will create ports with this
vnic_type as part of the workflow.

As such the client must allow users to interact with this
vnic_type and this patch addresses that.

Partial-Bug: #1932154
Change-Id: I7f80bb47db7f8608db4d6a646b0f4b0ef6d6fb48
This commit is contained in:
Frode Nordahl 2021-09-14 14:24:58 +02:00
parent 792ad115b3
commit 1df1f38a91
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)