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
This commit is contained in:
zhanghao 2020-05-13 05:04:55 -04:00
parent 85ef7b7108
commit c8d61703c2
3 changed files with 26 additions and 1 deletions

View File

@ -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(

View File

@ -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):

View File

@ -0,0 +1,5 @@
---
features:
- |
The ``--phase1-negotiation-mode`` option supports ``aggressive`` mode
in VPNaaS ikepolicy commands.