diff options
author | 2020-05-10 05:18:37 +0000 | |
---|---|---|
committer | 2020-06-18 11:03:54 +0000 | |
commit | 4128c7b463d44b589a3443e3058d40cad037e11b (patch) | |
tree | cb23564f7f1babc451b1deba3d7eec2f2e998bb3 /src/plugins/ikev2/test/test_ikev2.py | |
parent | df35a20f9bb3d5b86ea6eb19ea6b998c769d1c44 (diff) |
ikev2: use both local and remote ID for profile lookup
Type: fix
Ticket: VPP-1890
Change-Id: I9441d5afc38df7dabf6cccaead69dd32646d2a9e
Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
Diffstat (limited to 'src/plugins/ikev2/test/test_ikev2.py')
-rw-r--r-- | src/plugins/ikev2/test/test_ikev2.py | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/plugins/ikev2/test/test_ikev2.py b/src/plugins/ikev2/test/test_ikev2.py index 0c9ac743b21..d2d82ba58e4 100644 --- a/src/plugins/ikev2/test/test_ikev2.py +++ b/src/plugins/ikev2/test/test_ikev2.py @@ -98,13 +98,16 @@ class IKEv2ChildSA(object): class IKEv2SA(object): def __init__(self, test, is_initiator=True, spi=b'\x04' * 8, - id=None, id_type='fqdn', nonce=None, auth_data=None, - local_ts=None, remote_ts=None, auth_method='shared-key'): + i_id=None, r_id=None, id_type='fqdn', nonce=None, + auth_data=None, local_ts=None, remote_ts=None, + auth_method='shared-key'): self.dh_params = None self.test = test self.is_initiator = is_initiator nonce = nonce or os.urandom(32) self.auth_data = auth_data + self.i_id = i_id + self.r_id = r_id if isinstance(id_type, str): self.id_type = IDType.value(id_type) else: @@ -113,12 +116,10 @@ class IKEv2SA(object): if self.is_initiator: self.rspi = None self.ispi = spi - self.i_id = id self.i_nonce = nonce else: self.rspi = spi self.ispi = None - self.r_id = id self.r_nonce = None self.child_sas = [IKEv2ChildSA(local_ts, remote_ts)] @@ -390,8 +391,9 @@ class TestResponder(VppTestCase): self.p.add_remote_ts(start_addr=0xa000000, end_addr=0xa0000ff) self.p.add_vpp_config() - self.sa = IKEv2SA(self, id=self.p.remote_id['data'], is_initiator=True, - auth_data=self.p.auth['data'], + self.sa = IKEv2SA(self, i_id=self.p.remote_id['data'], + r_id=self.p.local_id['data'], + is_initiator=True, auth_data=self.p.auth['data'], id_type=self.p.local_id['id_type'], local_ts=self.p.remote_ts, remote_ts=self.p.local_ts) @@ -456,8 +458,10 @@ class TestResponder(VppTestCase): SPIsize=4, SPI=os.urandom(4), trans_nb=4, trans=trans)) tsi, tsr = self.sa.generate_ts() - plain = (ikev2.IKEv2_payload_IDi(next_payload='AUTH', + plain = (ikev2.IKEv2_payload_IDi(next_payload='IDr', IDtype=self.sa.id_type, load=self.sa.i_id) / + ikev2.IKEv2_payload_IDr(next_payload='AUTH', + IDtype=self.sa.id_type, load=self.sa.r_id) / ikev2.IKEv2_payload_AUTH(next_payload='SA', auth_type=2, load=self.sa.auth_data) / ikev2.IKEv2_payload_SA(next_payload='TSi', prop=props) / |