diff options
author | Peter Mikus <pmikus@cisco.com> | 2019-06-19 12:37:05 +0000 |
---|---|---|
committer | Peter Mikus <pmikus@cisco.com> | 2019-07-09 13:40:36 +0000 |
commit | d5a0c7319ac12bbf56cfae8d9c6778bb2834f7dd (patch) | |
tree | e82324b219c42a15a45ba74e2dd7c8f0a3d110b4 /resources/libraries | |
parent | 533fcfe3d177447aee7a3dca5f0d7a5f06d70377 (diff) |
Add scale ipsec tunnel tests 20K
Change-Id: Ib52e1735b6b82ea9fea44c06c379f117068e94c1
Signed-off-by: Peter Mikus <pmikus@cisco.com>
Diffstat (limited to 'resources/libraries')
-rw-r--r-- | resources/libraries/python/IPsecUtil.py | 43 |
1 files changed, 28 insertions, 15 deletions
diff --git a/resources/libraries/python/IPsecUtil.py b/resources/libraries/python/IPsecUtil.py index 3346da2526..123043828d 100644 --- a/resources/libraries/python/IPsecUtil.py +++ b/resources/libraries/python/IPsecUtil.py @@ -661,6 +661,18 @@ class IPsecUtil(object): vat = VatExecutor() with open(tmp_fn1, 'w') as tmp_f1, open(tmp_fn2, 'w') as tmp_f2: + tmp_f1.write( + 'exec create loopback interface\n' + 'exec set interface state loop0 up\n' + 'exec set interface ip address {uifc} {iaddr}/24\n' + .format( + iaddr=ip_address(unicode(if2_ip_addr)) - 1, + uifc=Topology.get_interface_name(nodes['DUT1'], if1_key))) + tmp_f2.write( + 'exec set interface ip address {uifc} {iaddr}/24\n' + .format( + iaddr=ip_address(unicode(if2_ip_addr)), + uifc=Topology.get_interface_name(nodes['DUT2'], if2_key))) for i in range(0, n_tunnels): ckey = gen_key(IPsecUtil.get_crypto_alg_key_len(crypto_alg)) ikey = gen_key(IPsecUtil.get_integ_alg_key_len(integ_alg)) @@ -675,7 +687,7 @@ class IPsecUtil(object): local_integ_key=ikey, remote_integ_key=ikey)) tmp_f1.write( - 'exec set interface ip address {uifc} {laddr}/24\n' + 'exec set interface ip address loop0 {laddr}/32\n' 'ipsec_tunnel_if_add_del ' 'local_spi {local_spi} ' 'remote_spi {remote_spi} ' @@ -693,11 +705,10 @@ class IPsecUtil(object): remote_crypto_key=ckey, integ=integ, laddr=ip_address(unicode(if1_ip_addr)) + i * addr_incr, - raddr=ip_address(unicode(if2_ip_addr)) + i * addr_incr, + raddr=ip_address(unicode(if2_ip_addr)), uifc=Topology.get_interface_name(nodes['DUT1'], if1_key))) tmp_f2.write( - 'exec set interface ip address {uifc} {laddr}/24\n' 'ipsec_tunnel_if_add_del ' 'local_spi {local_spi} ' 'remote_spi {remote_spi} ' @@ -714,42 +725,44 @@ class IPsecUtil(object): local_crypto_key=ckey, remote_crypto_key=ckey, integ=integ, - laddr=ip_address(unicode(if2_ip_addr)) + i * addr_incr, - raddr=ip_address(unicode(if1_ip_addr)) + i * addr_incr, - uifc=Topology.get_interface_name(nodes['DUT2'], - if2_key))) - vat.execute_script(tmp_fn1, nodes['DUT1'], timeout=300, json_out=False, + laddr=ip_address(unicode(if2_ip_addr)), + raddr=ip_address(unicode(if1_ip_addr)) + i * addr_incr)) + vat.execute_script(tmp_fn1, nodes['DUT1'], timeout=1800, json_out=False, copy_on_execute=True) - vat.execute_script(tmp_fn2, nodes['DUT2'], timeout=300, json_out=False, + vat.execute_script(tmp_fn2, nodes['DUT2'], timeout=1800, json_out=False, copy_on_execute=True) os.remove(tmp_fn1) os.remove(tmp_fn2) with open(tmp_fn1, 'w') as tmp_f1, open(tmp_fn2, 'w') as tmp_f2: + tmp_f2.write( + 'exec ip route add {raddr} via {uifc} {iaddr}\n' + .format( + raddr=ip_network(unicode(if1_ip_addr+'/8'), False), + iaddr=ip_address(unicode(if2_ip_addr)) - 1, + uifc=Topology.get_interface_name(nodes['DUT2'], if2_key))) for i in range(0, n_tunnels): tmp_f1.write( 'exec set interface unnumbered ipsec{i} use {uifc}\n' 'exec set interface state ipsec{i} up\n' - 'exec ip route add {taddr}/32 via {raddr} ipsec{i}\n' + 'exec ip route add {taddr}/32 via ipsec{i}\n' .format( taddr=ip_address(unicode(raddr_ip2)) + i, - raddr=ip_address(unicode(if2_ip_addr)) + i * addr_incr, i=i, uifc=Topology.get_interface_name(nodes['DUT1'], if1_key))) tmp_f2.write( 'exec set interface unnumbered ipsec{i} use {uifc}\n' 'exec set interface state ipsec{i} up\n' - 'exec ip route add {taddr}/32 via {raddr} ipsec{i}\n' + 'exec ip route add {taddr}/32 via ipsec{i}\n' .format( taddr=ip_address(unicode(raddr_ip1)) + i, - raddr=ip_address(unicode(if1_ip_addr)) + i * addr_incr, i=i, uifc=Topology.get_interface_name(nodes['DUT2'], if2_key))) - vat.execute_script(tmp_fn1, nodes['DUT1'], timeout=300, json_out=False, + vat.execute_script(tmp_fn1, nodes['DUT1'], timeout=1800, json_out=False, copy_on_execute=True) - vat.execute_script(tmp_fn2, nodes['DUT2'], timeout=300, json_out=False, + vat.execute_script(tmp_fn2, nodes['DUT2'], timeout=1800, json_out=False, copy_on_execute=True) os.remove(tmp_fn1) os.remove(tmp_fn2) |