diff options
author | Frode Nordahl <frode.nordahl@canonical.com> | 2021-09-14 14:24:58 +0200 |
---|---|---|
committer | Frode Nordahl <frode.nordahl@canonical.com> | 2021-09-14 14:31:24 +0200 |
commit | 1df1f38a91afd158336044a57f7e4c8e11108a94 (patch) | |
tree | 0e6b2e62bab8bef13f1baa759855042a045c509c | |
parent | 792ad115b3e266e70932946ed5187691edb061fc (diff) | |
download | python-neutronclient-1df1f38a91afd158336044a57f7e4c8e11108a94.tar.gz |
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
-rw-r--r-- | neutronclient/neutron/v2_0/port.py | 6 | ||||
-rw-r--r-- | neutronclient/tests/unit/test_cli20_port.py | 20 |
2 files changed, 23 insertions, 3 deletions
diff --git a/neutronclient/neutron/v2_0/port.py b/neutronclient/neutron/v2_0/port.py index 0982b04..3fe7354 100644 --- a/neutronclient/neutron/v2_0/port.py +++ b/neutronclient/neutron/v2_0/port.py @@ -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( diff --git a/neutronclient/tests/unit/test_cli20_port.py b/neutronclient/tests/unit/test_cli20_port.py index e1ab411..ab7e956 100644 --- a/neutronclient/tests/unit/test_cli20_port.py +++ b/neutronclient/tests/unit/test_cli20_port.py @@ -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) |