summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--neutronclient/neutron/v2_0/port.py10
-rw-r--r--neutronclient/tests/unit/test_cli20_port.py20
-rw-r--r--releasenotes/notes/direct-physical-vnic-port-create-736d8b2600faf22b.yaml6
3 files changed, 33 insertions, 3 deletions
diff --git a/neutronclient/neutron/v2_0/port.py b/neutronclient/neutron/v2_0/port.py
index c611d26..719d4ad 100644
--- a/neutronclient/neutron/v2_0/port.py
+++ b/neutronclient/neutron/v2_0/port.py
@@ -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',
diff --git a/neutronclient/tests/unit/test_cli20_port.py b/neutronclient/tests/unit/test_cli20_port.py
index de21976..4b6d617 100644
--- a/neutronclient/tests/unit/test_cli20_port.py
+++ b/neutronclient/tests/unit/test_cli20_port.py
@@ -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'
diff --git a/releasenotes/notes/direct-physical-vnic-port-create-736d8b2600faf22b.yaml b/releasenotes/notes/direct-physical-vnic-port-create-736d8b2600faf22b.yaml
new file mode 100644
index 0000000..9113774
--- /dev/null
+++ b/releasenotes/notes/direct-physical-vnic-port-create-736d8b2600faf22b.yaml
@@ -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.