From 69e97e204d6866410f227bf421e94dc988ee6250 Mon Sep 17 00:00:00 2001 From: Igor Duarte Cardoso Date: Thu, 27 Jul 2017 12:46:22 +0000 Subject: [PATCH] Add missing correlation type "mpls" to port pair Add missing correlation type "mpls" to Port Pair create command's help (PortPairCreate). The merged Port Pair command was still using the older help description, before MPLS correlation support was merged to networking-sfc. Also add unit test coverage for correlation type "mpls". Closes-Bug: #1708968 Change-Id: I708345b25b600ca94504725f1559988ae29413b8 (cherry picked from commit ff86783fd4345b1f4cd9ebc3cb90eadca3f2a261) --- neutronclient/osc/v2/sfc/sfc_port_pair.py | 4 ++-- .../tests/unit/osc/v2/sfc/test_port_pair.py | 16 ++++++++++++---- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/neutronclient/osc/v2/sfc/sfc_port_pair.py b/neutronclient/osc/v2/sfc/sfc_port_pair.py index 26f369c77..57cc47834 100755 --- a/neutronclient/osc/v2/sfc/sfc_port_pair.py +++ b/neutronclient/osc/v2/sfc/sfc_port_pair.py @@ -58,8 +58,8 @@ class CreateSfcPortPair(command.ShowOne): action=parseractions.MultiKeyValueAction, optional_keys=['correlation', 'weight'], help=_('Dictionary of service function parameters. ' - 'Currently, only correlation=None and weight ' - 'is supported. Weight is an integer that influences ' + 'Currently, correlation=(None|mpls) and weight ' + 'are supported. Weight is an integer that influences ' 'the selection of a port pair within a port pair group ' 'for a flow. The higher the weight, the more flows will ' 'hash to the port pair. The default weight is 1.')) diff --git a/neutronclient/tests/unit/osc/v2/sfc/test_port_pair.py b/neutronclient/tests/unit/osc/v2/sfc/test_port_pair.py index e6c539ae6..e15e6d01c 100755 --- a/neutronclient/tests/unit/osc/v2/sfc/test_port_pair.py +++ b/neutronclient/tests/unit/osc/v2/sfc/test_port_pair.py @@ -81,16 +81,17 @@ class TestCreateSfcPortPair(fakes.TestNeutronClientOSCV2): self.assertEqual(self.columns, columns) self.assertEqual(self.data, data) - def test_create_port_pair_all_options(self): + def _test_create_port_pair_all_options(self, correlation): arglist = [ "--description", self._port_pair['description'], "--egress", self._port_pair['egress'], "--ingress", self._port_pair['ingress'], self._port_pair['name'], - "--service-function-parameters", 'correlation=None,weight=1', + "--service-function-parameters", + 'correlation=%s,weight=1' % correlation, ] - sfp = [{'correlation': 'None', 'weight': '1'}] + sfp = [{'correlation': correlation, 'weight': '1'}] verifylist = [ ('ingress', self._port_pair['ingress']), @@ -109,12 +110,19 @@ class TestCreateSfcPortPair(fakes.TestNeutronClientOSCV2): 'egress': self._port_pair['egress'], 'description': self._port_pair['description'], 'service_function_parameters': - [{'correlation': 'None', 'weight': '1'}], + [{'correlation': correlation, 'weight': + '1'}], } }) self.assertEqual(self.columns, columns) self.assertEqual(self.data, data) + def test_create_port_pair_all_options(self): + self._test_create_port_pair_all_options('None') + + def test_create_port_pair_all_options_mpls(self): + self._test_create_port_pair_all_options('mpls') + class TestDeleteSfcPortPair(fakes.TestNeutronClientOSCV2):