From c8d61703c2e74c559b601cf23d1aa59366b32874 Mon Sep 17 00:00:00 2001 From: zhanghao Date: Wed, 13 May 2020 05:04:55 -0400 Subject: [PATCH] Add aggressive negotiation mode for ikepolicy The phase1 negotiation mode adds support for aggressive mode, which can be selected when creating an ikepolicy. Change-Id: I8148011558094db07b5f9eba70b16cfe6eeaf98f Partial-Bug: #1701413 --- neutronclient/osc/v2/vpnaas/ikepolicy.py | 2 +- .../unit/osc/v2/vpnaas/test_ikepolicy.py | 20 +++++++++++++++++++ ...ive-negotiation-mode-5218b1baff930eb8.yaml | 5 +++++ 3 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/add-aggressive-negotiation-mode-5218b1baff930eb8.yaml diff --git a/neutronclient/osc/v2/vpnaas/ikepolicy.py b/neutronclient/osc/v2/vpnaas/ikepolicy.py index eb598ead2..73b6402d3 100644 --- a/neutronclient/osc/v2/vpnaas/ikepolicy.py +++ b/neutronclient/osc/v2/vpnaas/ikepolicy.py @@ -64,7 +64,7 @@ def _get_common_parser(parser): help=_('Encryption algorithm')) parser.add_argument( '--phase1-negotiation-mode', - choices=['main'], + choices=['main', 'aggressive'], type=_convert_to_lowercase, help=_('IKE Phase1 negotiation mode')) parser.add_argument( diff --git a/neutronclient/tests/unit/osc/v2/vpnaas/test_ikepolicy.py b/neutronclient/tests/unit/osc/v2/vpnaas/test_ikepolicy.py index 24663d6a2..fd621fde5 100644 --- a/neutronclient/tests/unit/osc/v2/vpnaas/test_ikepolicy.py +++ b/neutronclient/tests/unit/osc/v2/vpnaas/test_ikepolicy.py @@ -208,6 +208,10 @@ class TestCreateIKEPolicy(TestIKEPolicy, common.TestCreateVPNaaS): def test_create_with_all_params_name(self): self._test_create_with_all_params({'name': 'new_ikepolicy'}) + def test_create_with_all_params_aggressive_mode(self): + self._test_create_with_all_params( + {'phase1_negotiation_mode': 'aggressive'}) + class TestDeleteIKEPolicy(TestIKEPolicy, common.TestDeleteVPNaaS): @@ -292,6 +296,22 @@ class TestSetIKEPolicy(TestIKEPolicy, common.TestSetVPNaaS): target, {self.res: {'auth_algorithm': 'sha256'}}) self.assertIsNone(result) + def test_set_phase1_negotiation_mode_with_aggressive(self): + target = self.resource['id'] + phase1_negotiation_mode = 'aggressive' + arglist = [target, + '--phase1-negotiation-mode', phase1_negotiation_mode] + verifylist = [ + (self.res, target), + ('phase1_negotiation_mode', phase1_negotiation_mode), + ] + parsed_args = self.check_parser(self.cmd, arglist, verifylist) + result = self.cmd.take_action(parsed_args) + + self.mocked.assert_called_once_with( + target, {self.res: {'phase1_negotiation_mode': 'aggressive'}}) + self.assertIsNone(result) + class TestShowIKEPolicy(TestIKEPolicy, common.TestShowVPNaaS): diff --git a/releasenotes/notes/add-aggressive-negotiation-mode-5218b1baff930eb8.yaml b/releasenotes/notes/add-aggressive-negotiation-mode-5218b1baff930eb8.yaml new file mode 100644 index 000000000..ae1b6672f --- /dev/null +++ b/releasenotes/notes/add-aggressive-negotiation-mode-5218b1baff930eb8.yaml @@ -0,0 +1,5 @@ +--- +features: + - | + The ``--phase1-negotiation-mode`` option supports ``aggressive`` mode + in VPNaaS ikepolicy commands.