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 | |
parent | 533fcfe3d177447aee7a3dca5f0d7a5f06d70377 (diff) |
Add scale ipsec tunnel tests 20K
Change-Id: Ib52e1735b6b82ea9fea44c06c379f117068e94c1
Signed-off-by: Peter Mikus <pmikus@cisco.com>
Diffstat (limited to 'resources')
4 files changed, 310 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) diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst20000.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst20000.py new file mode 100755 index 0000000000..87eceb155b --- /dev/null +++ b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst20000.py @@ -0,0 +1,94 @@ +# Copyright (c) 2019 Cisco and/or its affiliates. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Stream profile for T-rex traffic generator. + +Stream profile: + - Two streams sent in directions 0 --> 1 and 1 --> 0 at the same time. + - Packet: ETH / IP / + - Direction 0 --> 1: + - Source IP address range: 10.0.0.1 + - Destination IP address range: 20.0.0.0 - 20.0.78.31 + - Direction 1 --> 0: + - Source IP address range: 20.0.0.1 + - Destination IP address range: 10.0.0.0 - 10.0.78.31 +""" + +from trex.stl.api import * +from profile_trex_stateless_base_class import TrafficStreamsBaseClass + + +class TrafficStreams(TrafficStreamsBaseClass): + """Stream profile.""" + + def __init__(self): + """Initialization and setting of streams' parameters.""" + + super(TrafficStreamsBaseClass, self).__init__() + + # IPs used in packet headers. + self.p1_src_start_ip = '10.0.0.1' + self.p1_dst_start_ip = '20.0.0.0' + self.p1_dst_end_ip = '20.0.78.31' + + self.p2_src_start_ip = '20.0.0.1' + self.p2_dst_start_ip = '10.0.0.0' + self.p2_dst_end_ip = '10.0.78.31' + + def define_packets(self): + """Defines the packets to be sent from the traffic generator. + + Packet definition: | ETH | IP | + + :returns: Packets to be sent from the traffic generator. + :rtype: tuple + """ + + # Direction 0 --> 1 + base_pkt_a = (Ether() / + IP(src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip, + proto=61)) + # Direction 1 --> 0 + base_pkt_b = (Ether() / + IP(src=self.p2_src_start_ip, + dst=self.p2_dst_start_ip, + proto=61)) + + # Direction 0 --> 1 + vm1 = STLScVmRaw([STLVmFlowVar(name="dst", + min_value=self.p1_dst_start_ip, + max_value=self.p1_dst_end_ip, + size=4, op="inc"), + STLVmWrFlowVar(fv_name="dst", pkt_offset="IP.dst"), + STLVmFixIpv4(offset="IP")]) + # Direction 1 --> 0 + vm2 = STLScVmRaw([STLVmFlowVar(name="dst", + min_value=self.p2_dst_start_ip, + max_value=self.p2_dst_end_ip, + size=4, op="inc"), + STLVmWrFlowVar(fv_name="dst", pkt_offset="IP.dst"), + STLVmFixIpv4(offset="IP")]) + + return base_pkt_a, base_pkt_b, vm1, vm2 + + +def register(): + """Register this traffic profile to T-rex. + + Do not change this function. + + :return: Traffic streams. + :rtype: Object + """ + return TrafficStreams() diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40000.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40000.py new file mode 100644 index 0000000000..068af2f3c3 --- /dev/null +++ b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40000.py @@ -0,0 +1,94 @@ +# Copyright (c) 2019 Cisco and/or its affiliates. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Stream profile for T-rex traffic generator. + +Stream profile: + - Two streams sent in directions 0 --> 1 and 1 --> 0 at the same time. + - Packet: ETH / IP / + - Direction 0 --> 1: + - Source IP address range: 10.0.0.1 + - Destination IP address range: 20.0.0.0 - 20.0.156.63 + - Direction 1 --> 0: + - Source IP address range: 20.0.0.1 + - Destination IP address range: 10.0.0.0 - 10.0.156.63 +""" + +from trex.stl.api import * +from profile_trex_stateless_base_class import TrafficStreamsBaseClass + + +class TrafficStreams(TrafficStreamsBaseClass): + """Stream profile.""" + + def __init__(self): + """Initialization and setting of streams' parameters.""" + + super(TrafficStreamsBaseClass, self).__init__() + + # IPs used in packet headers. + self.p1_src_start_ip = '10.0.0.1' + self.p1_dst_start_ip = '20.0.0.0' + self.p1_dst_end_ip = '20.0.156.63' + + self.p2_src_start_ip = '20.0.0.1' + self.p2_dst_start_ip = '10.0.0.0' + self.p2_dst_end_ip = '10.0.156.63' + + def define_packets(self): + """Defines the packets to be sent from the traffic generator. + + Packet definition: | ETH | IP | + + :returns: Packets to be sent from the traffic generator. + :rtype: tuple + """ + + # Direction 0 --> 1 + base_pkt_a = (Ether() / + IP(src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip, + proto=61)) + # Direction 1 --> 0 + base_pkt_b = (Ether() / + IP(src=self.p2_src_start_ip, + dst=self.p2_dst_start_ip, + proto=61)) + + # Direction 0 --> 1 + vm1 = STLScVmRaw([STLVmFlowVar(name="dst", + min_value=self.p1_dst_start_ip, + max_value=self.p1_dst_end_ip, + size=4, op="inc"), + STLVmWrFlowVar(fv_name="dst", pkt_offset="IP.dst"), + STLVmFixIpv4(offset="IP")]) + # Direction 1 --> 0 + vm2 = STLScVmRaw([STLVmFlowVar(name="dst", + min_value=self.p2_dst_start_ip, + max_value=self.p2_dst_end_ip, + size=4, op="inc"), + STLVmWrFlowVar(fv_name="dst", pkt_offset="IP.dst"), + STLVmFixIpv4(offset="IP")]) + + return base_pkt_a, base_pkt_b, vm1, vm2 + + +def register(): + """Register this traffic profile to T-rex. + + Do not change this function. + + :return: Traffic streams. + :rtype: Object + """ + return TrafficStreams()
\ No newline at end of file diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst60000.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst60000.py new file mode 100644 index 0000000000..82a9f8c3cb --- /dev/null +++ b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst60000.py @@ -0,0 +1,94 @@ +# Copyright (c) 2019 Cisco and/or its affiliates. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Stream profile for T-rex traffic generator. + +Stream profile: + - Two streams sent in directions 0 --> 1 and 1 --> 0 at the same time. + - Packet: ETH / IP / + - Direction 0 --> 1: + - Source IP address range: 10.0.0.1 + - Destination IP address range: 20.0.0.0 - 20.0.234.95 + - Direction 1 --> 0: + - Source IP address range: 20.0.0.1 + - Destination IP address range: 10.0.0.0 - 10.0.234.95 +""" + +from trex.stl.api import * +from profile_trex_stateless_base_class import TrafficStreamsBaseClass + + +class TrafficStreams(TrafficStreamsBaseClass): + """Stream profile.""" + + def __init__(self): + """Initialization and setting of streams' parameters.""" + + super(TrafficStreamsBaseClass, self).__init__() + + # IPs used in packet headers. + self.p1_src_start_ip = '10.0.0.1' + self.p1_dst_start_ip = '20.0.0.0' + self.p1_dst_end_ip = '20.0.234.95' + + self.p2_src_start_ip = '20.0.0.1' + self.p2_dst_start_ip = '10.0.0.0' + self.p2_dst_end_ip = '10.0.234.95' + + def define_packets(self): + """Defines the packets to be sent from the traffic generator. + + Packet definition: | ETH | IP | + + :returns: Packets to be sent from the traffic generator. + :rtype: tuple + """ + + # Direction 0 --> 1 + base_pkt_a = (Ether() / + IP(src=self.p1_src_start_ip, + dst=self.p1_dst_start_ip, + proto=61)) + # Direction 1 --> 0 + base_pkt_b = (Ether() / + IP(src=self.p2_src_start_ip, + dst=self.p2_dst_start_ip, + proto=61)) + + # Direction 0 --> 1 + vm1 = STLScVmRaw([STLVmFlowVar(name="dst", + min_value=self.p1_dst_start_ip, + max_value=self.p1_dst_end_ip, + size=4, op="inc"), + STLVmWrFlowVar(fv_name="dst", pkt_offset="IP.dst"), + STLVmFixIpv4(offset="IP")]) + # Direction 1 --> 0 + vm2 = STLScVmRaw([STLVmFlowVar(name="dst", + min_value=self.p2_dst_start_ip, + max_value=self.p2_dst_end_ip, + size=4, op="inc"), + STLVmWrFlowVar(fv_name="dst", pkt_offset="IP.dst"), + STLVmFixIpv4(offset="IP")]) + + return base_pkt_a, base_pkt_b, vm1, vm2 + + +def register(): + """Register this traffic profile to T-rex. + + Do not change this function. + + :return: Traffic streams. + :rtype: Object + """ + return TrafficStreams() |