Skip to content

Commit 980ff38

Browse files
Jenkinsopenstack-gerrit
Jenkins
authored andcommitted
Merge "port: Add 'direct-physical' as a valid vnic-type"
2 parents 8105a78 + 199cb1e commit 980ff38

File tree

3 files changed

+33
-3
lines changed

3 files changed

+33
-3
lines changed

neutronclient/neutron/v2_0/port.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,12 +238,16 @@ def add_known_arguments(self, parser):
238238
'--mac_address',
239239
help=argparse.SUPPRESS)
240240
parser.add_argument(
241-
'--vnic-type', metavar='<direct | macvtap | normal | baremetal>',
242-
choices=['direct', 'macvtap', 'normal', 'baremetal'],
241+
'--vnic-type',
242+
metavar='<direct | direct-physical | macvtap '
243+
'| normal | baremetal>',
244+
choices=['direct', 'direct-physical', 'macvtap',
245+
'normal', 'baremetal'],
243246
help=_('VNIC type for this port.'))
244247
parser.add_argument(
245248
'--vnic_type',
246-
choices=['direct', 'macvtap', 'normal', 'baremetal'],
249+
choices=['direct', 'direct-physical', 'macvtap',
250+
'normal', 'baremetal'],
247251
help=argparse.SUPPRESS)
248252
parser.add_argument(
249253
'--binding-profile',

neutronclient/tests/unit/test_cli20_port.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,26 @@ def test_create_port_vnic_type_direct(self):
153153
self._test_create_resource(resource, cmd, name, myid, args,
154154
position_names, position_values)
155155

156+
def test_create_port_vnic_type_direct_physical(self):
157+
# Create port: --vnic_type direct-physical netid.
158+
resource = 'port'
159+
cmd = port.CreatePort(test_cli20.MyApp(sys.stdout), None)
160+
name = 'myname'
161+
myid = 'myid'
162+
netid = 'netid'
163+
args = ['--vnic_type', 'direct-physical', netid]
164+
position_names = ['binding:vnic_type', 'network_id']
165+
position_values = ['direct-physical', netid]
166+
self._test_create_resource(resource, cmd, name, myid, args,
167+
position_names, position_values)
168+
169+
# Test dashed options
170+
args = ['--vnic-type', 'direct-physical', netid]
171+
position_names = ['binding:vnic_type', 'network_id']
172+
position_values = ['direct-physical', netid]
173+
self._test_create_resource(resource, cmd, name, myid, args,
174+
position_names, position_values)
175+
156176
def test_create_port_vnic_type_macvtap(self):
157177
# Create port: --vnic_type macvtap netid.
158178
resource = 'port'
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
features:
3+
- Added new 'direct-physical' vnic-type option for port-create CLI command.
4+
Passing this particular value allows for a port to be create with the
5+
vnic-type used for assigning SR-IOV physical functions to
6+
instances.

0 commit comments

Comments
 (0)