From 0042a39d9245b9262b95b7b124a2bb15ba2682e5 Mon Sep 17 00:00:00 2001 From: Kevin Benton Date: Mon, 23 Nov 2015 17:08:42 -0800 Subject: [PATCH] Add 'baremetal' as an allowed vnic type For wiring up ports for baremetal servers, a new vnic type of 'baremetal' will be used to allow mechanism drivers to easily distinguish which ports should contain switch port information. This patch adds 'baremetal' as an allowed option on the client. Change-Id: If25a1af55a3b849227c9145341ae5e3577a5d7fb Partial-Implements: blueprint neutron-ironic-integration --- neutronclient/neutron/v2_0/port.py | 6 +++--- 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 74c713c8d..e98e0f00d 100644 --- a/neutronclient/neutron/v2_0/port.py +++ b/neutronclient/neutron/v2_0/port.py @@ -239,12 +239,12 @@ class CreatePort(neutronV20.CreateCommand, UpdatePortSecGroupMixin, '--mac_address', help=argparse.SUPPRESS) parser.add_argument( - '--vnic-type', metavar='', - choices=['direct', 'macvtap', 'normal'], + '--vnic-type', metavar='', + choices=['direct', 'macvtap', 'normal', 'baremetal'], help=_('VNIC type for this port.')) parser.add_argument( '--vnic_type', - choices=['direct', 'macvtap', 'normal'], + choices=['direct', '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 db873c1e5..ad9b2b89d 100644 --- a/neutronclient/tests/unit/test_cli20_port.py +++ b/neutronclient/tests/unit/test_cli20_port.py @@ -173,6 +173,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_baremetal(self): + """Create port: --vnic_type baremetal netid.""" + resource = 'port' + cmd = port.CreatePort(test_cli20.MyApp(sys.stdout), None) + name = 'myname' + myid = 'myid' + netid = 'netid' + args = ['--vnic_type', 'baremetal', netid] + position_names = ['binding:vnic_type', 'network_id'] + position_values = ['baremetal', netid] + self._test_create_resource(resource, cmd, name, myid, args, + position_names, position_values) + + # Test dashed options + args = ['--vnic-type', 'baremetal', netid] + position_names = ['binding:vnic_type', 'network_id'] + position_values = ['baremetal', 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)