diff options
Diffstat (limited to 'resources/tools/t-rex/stream_profiles')
23 files changed, 0 insertions, 2416 deletions
diff --git a/resources/tools/t-rex/stream_profiles/profile_trex_stateless_base_class.py b/resources/tools/t-rex/stream_profiles/profile_trex_stateless_base_class.py deleted file mode 100755 index a6cb97485a..0000000000 --- a/resources/tools/t-rex/stream_profiles/profile_trex_stateless_base_class.py +++ /dev/null @@ -1,212 +0,0 @@ -# Copyright (c) 2017 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. - -"""Base class for stream profiles for T-rex traffic generator. -""" - -import sys -import socket -import struct - -from random import choice -from string import letters - -from trex_stl_lib.api import * - - -class TrafficStreamsBaseClass(object): - """Base class for stream profiles for T-rex traffic generator. - """ - - STREAM_TABLE = { - 'IMIX_v4': [ - {'size': 60, 'pps': 28, 'isg': 0}, - {'size': 590, 'pps': 20, 'isg': 0.1}, - {'size': 1514, 'pps': 4, 'isg': 0.2} - ], - 'IMIX_v4_1': [ - {'size': 64, 'pps': 28, 'isg': 0}, - {'size': 570, 'pps': 16, 'isg': 0.1}, - {'size': 1518, 'pps': 4, 'isg': 0.2} - ] - } - - def __init__(self): - - # Default value of frame size, it will be overwritten by the value of - # "framesize" parameter of "get_streams" method. - self.framesize = 64 - - # If needed, add your own parameters. - - def _gen_payload(self, length): - """Generate payload. - - If needed, implement your own algorithm. - - :param length: Length of generated payload. - :type length: int - :returns: The generated payload. - :rtype: str - """ - - payload = "" - for _ in range(length): - payload += choice(letters) - - return payload - - def _get_start_end_ipv6(self, start_ip, end_ip): - """Get start host and number of hosts from IPv6 as integer. - - :param start_ip: Start IPv6. - :param end_ip: End IPv6. - :type start_ip: string - :type end_ip: string - :return: Start host, number of hosts. - :rtype tuple of int - :raises: ValueError if start_ip is greater then end_ip. - :raises: socket.error if the IP addresses are not valid IPv6 addresses. - """ - - try: - ip1 = socket.inet_pton(socket.AF_INET6, start_ip) - ip2 = socket.inet_pton(socket.AF_INET6, end_ip) - - hi1, lo1 = struct.unpack('!QQ', ip1) - hi2, lo2 = struct.unpack('!QQ', ip2) - - if ((hi1 << 64) | lo1) > ((hi2 << 64) | lo2): - raise ValueError("IPv6: start_ip is greater then end_ip") - - return lo1, abs(int(lo1) - int(lo2)) - - except socket.error as err: - print(err) - raise - - def define_packets(self): - """Define the packets to be sent from the traffic generator. - - This method MUST return: - - return base_pkt_a, base_pkt_b, vm1, vm2 - - vm1 and vm2 CAN be None. - - :returns: Packets to be sent from the traffic generator. - :rtype: tuple - """ - raise NotImplementedError - - def create_streams(self): - """Create traffic streams. - - Implement your own traffic streams. - - :returns: Traffic streams. - :rtype: list - """ - - base_pkt_a, base_pkt_b, vm1, vm2 = self.define_packets() - - # In most cases you will not have to change the code below: - - # Frame size is defined as an integer, e.g. 64, 1518: - if isinstance(self.framesize, int): - - # Create a base packet and pad it to size - payload_len = max(0, self.framesize - len(base_pkt_a) - 4) # No FCS - - # Direction 0 --> 1 - pkt_a = STLPktBuilder( - pkt=base_pkt_a / self._gen_payload(payload_len), - vm=vm1) - # Direction 1 --> 0 - pkt_b = STLPktBuilder( - pkt=base_pkt_b / self._gen_payload(payload_len), - vm=vm2) - - # Packets for latency measurement: - # Direction 0 --> 1 - pkt_lat_a = STLPktBuilder( - pkt=base_pkt_a / self._gen_payload(payload_len)) - # Direction 1 --> 0 - pkt_lat_b = STLPktBuilder( - pkt=base_pkt_b / self._gen_payload(payload_len)) - - # Create the streams: - # Direction 0 --> 1 - stream1 = STLStream(packet=pkt_a, mode=STLTXCont(pps=9000)) - # Direction 1 --> 0 - # second traffic stream with a phase of 10ns (inter-stream gap) - stream2 = STLStream(packet=pkt_b, isg=10.0, - mode=STLTXCont(pps=9000)) - - # Streams for latency measurement: - # Direction 0 --> 1 - lat_stream1 = STLStream(packet=pkt_lat_a, - flow_stats=STLFlowLatencyStats(pg_id=0), - mode=STLTXCont(pps=9000)) - # Direction 1 --> 0 - # second traffic stream with a phase of 10ns (inter-stream gap) - lat_stream2 = STLStream(packet=pkt_lat_b, isg=10.0, - flow_stats=STLFlowLatencyStats(pg_id=1), - mode=STLTXCont(pps=9000)) - - return [stream1, stream2, lat_stream1, lat_stream2] - - # Frame size is defined as a string, e.g.IMIX_v4_1: - elif isinstance(self.framesize, str): - - stream1 = [] - stream2 = [] - - for stream in self.STREAM_TABLE[self.framesize]: - payload_len_a = max(0, stream['size'] - len(base_pkt_a) - 4) - payload_len_b = max(0, stream['size'] - len(base_pkt_b) - 4) - # Create a base packet and pad it to size - pkt_a = STLPktBuilder( - pkt=base_pkt_a / self._gen_payload(payload_len_a), - vm=vm1) - pkt_b = STLPktBuilder( - pkt=base_pkt_b / self._gen_payload(payload_len_b), - vm=vm2) - - # Create the streams: - stream1.append(STLStream(packet=pkt_a, - isg=stream['isg'], - mode=STLTXCont(pps=stream['pps']))) - stream2.append(STLStream(packet=pkt_b, - isg=stream['isg'], - mode=STLTXCont(pps=stream['pps']))) - streams = list() - streams.extend(stream1) - streams.extend(stream2) - - return streams - - def get_streams(self, **kwargs): - """Get traffic streams created by "create_streams" method. - - If needed, add your own parameters. - - :param kwargs: Key-value pairs used by "create_streams" method while - creating streams. - :returns: Traffic streams. - :rtype: list - """ - - self.framesize = kwargs['framesize'] - - return self.create_streams() diff --git a/resources/tools/t-rex/stream_profiles/trex-sl-2n-ethip4-ip4src253.py b/resources/tools/t-rex/stream_profiles/trex-sl-2n-ethip4-ip4src253.py deleted file mode 100755 index f9a030b9eb..0000000000 --- a/resources/tools/t-rex/stream_profiles/trex-sl-2n-ethip4-ip4src253.py +++ /dev/null @@ -1,94 +0,0 @@ -# Copyright (c) 2017 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.10.10.2 - 10.10.10.254 - - Destination IP address range: 20.20.20.2 - - Direction 1 --> 0: - - Source IP address range: 20.20.20.2 - 20.20.20.254 - - Destination IP address range: 10.10.10.2 -""" - -from trex_stl_lib.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.10.10.2' - self.p1_src_end_ip = '10.10.10.254' - self.p1_dst_start_ip = '20.20.20.2' - - self.p2_src_start_ip = '20.20.20.2' - self.p2_src_end_ip = '20.20.20.254' - self.p2_dst_start_ip = '10.10.10.2' - - 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="src", - min_value=self.p1_src_start_ip, - max_value=self.p1_src_end_ip, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="src", pkt_offset="IP.src"), - STLVmFixIpv4(offset="IP")], - split_by_field="src") - # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name="src", - min_value=self.p2_src_start_ip, - max_value=self.p2_src_end_ip, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="src", pkt_offset="IP.src"), - STLVmFixIpv4(offset="IP")], - split_by_field="src") - - 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/tools/t-rex/stream_profiles/trex-sl-3n-ethip4-ip4dst1.py b/resources/tools/t-rex/stream_profiles/trex-sl-3n-ethip4-ip4dst1.py deleted file mode 100755 index 68b492175b..0000000000 --- a/resources/tools/t-rex/stream_profiles/trex-sl-3n-ethip4-ip4dst1.py +++ /dev/null @@ -1,73 +0,0 @@ -# Copyright (c) 2017 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 - - Direction 1 --> 0: - - Source IP address range: 20.0.0.1 - - Destination IP address range: 10.0.0.0 -""" - -from trex_stl_lib.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_ip = '10.0.0.1' - self.p1_dst_ip = '20.0.0.0' - - self.p2_src_ip = '20.0.0.1' - self.p2_dst_ip = '10.0.0.0' - - 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_ip, dst=self.p1_dst_ip, proto=61)) - # Direction 1 --> 0 - base_pkt_b = (Ether() / - IP(src=self.p2_src_ip, dst=self.p2_dst_ip, proto=61)) - - return base_pkt_a, base_pkt_b, None, None - - -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/tools/t-rex/stream_profiles/trex-sl-3n-ethip4-ip4dst100.py b/resources/tools/t-rex/stream_profiles/trex-sl-3n-ethip4-ip4dst100.py deleted file mode 100755 index 86f423a153..0000000000 --- a/resources/tools/t-rex/stream_profiles/trex-sl-3n-ethip4-ip4dst100.py +++ /dev/null @@ -1,96 +0,0 @@ -# Copyright (c) 2017 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.0.99 - - Direction 1 --> 0: - - Source IP address range: 20.0.0.1 - - Destination IP address range: 10.0.0.0 - 10.0.0.99 -""" - -from trex_stl_lib.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.0.99' - - 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.0.99' - - 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")], - split_by_field="dst") - # 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")], - split_by_field="dst") - - 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/tools/t-rex/stream_profiles/trex-sl-3n-ethip4-ip4dst1000.py b/resources/tools/t-rex/stream_profiles/trex-sl-3n-ethip4-ip4dst1000.py deleted file mode 100755 index 569c06360f..0000000000 --- a/resources/tools/t-rex/stream_profiles/trex-sl-3n-ethip4-ip4dst1000.py +++ /dev/null @@ -1,96 +0,0 @@ -# Copyright (c) 2017 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.3.231 - - Direction 1 --> 0: - - Source IP address range: 20.0.0.1 - - Destination IP address range: 10.0.0.0 - 10.0.3.231 -""" - -from trex_stl_lib.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.3.231' - - 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.3.231' - - 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")], - split_by_field="dst") - # 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")], - split_by_field="dst") - - 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/tools/t-rex/stream_profiles/trex-sl-3n-ethip4-ip4dst10000.py b/resources/tools/t-rex/stream_profiles/trex-sl-3n-ethip4-ip4dst10000.py deleted file mode 100755 index 373076f596..0000000000 --- a/resources/tools/t-rex/stream_profiles/trex-sl-3n-ethip4-ip4dst10000.py +++ /dev/null @@ -1,96 +0,0 @@ -# Copyright (c) 2017 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.39.15 - - Direction 1 --> 0: - - Source IP address range: 20.0.0.1 - - Destination IP address range: 10.0.0.0 - 10.0.39.15 -""" - -from trex_stl_lib.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.39.15' - - 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.39.15' - - 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")], - split_by_field="dst") - # 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")], - split_by_field="dst") - - 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/tools/t-rex/stream_profiles/trex-sl-3n-ethip4-ip4dst100000.py b/resources/tools/t-rex/stream_profiles/trex-sl-3n-ethip4-ip4dst100000.py deleted file mode 100755 index 3b27e9a9e0..0000000000 --- a/resources/tools/t-rex/stream_profiles/trex-sl-3n-ethip4-ip4dst100000.py +++ /dev/null @@ -1,96 +0,0 @@ -# Copyright (c) 2017 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.1.134.159 - - Direction 1 --> 0: - - Source IP address range: 20.0.0.1 - - Destination IP address range: 10.0.0.0 - 10.1.134.159 -""" - -from trex_stl_lib.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.1.134.159' - - self.p2_src_start_ip = '20.0.0.1' - self.p2_dst_start_ip = '10.0.0.0' - self.p2_dst_end_ip = '10.1.134.159' - - 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")], - split_by_field="dst") - # 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")], - split_by_field="dst") - - 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/tools/t-rex/stream_profiles/trex-sl-3n-ethip4-ip4dst1000000.py b/resources/tools/t-rex/stream_profiles/trex-sl-3n-ethip4-ip4dst1000000.py deleted file mode 100755 index 076951b566..0000000000 --- a/resources/tools/t-rex/stream_profiles/trex-sl-3n-ethip4-ip4dst1000000.py +++ /dev/null @@ -1,96 +0,0 @@ -# Copyright (c) 2017 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.15.66.63 - - Direction 1 --> 0: - - Source IP address range: 20.0.0.1 - - Destination IP address range: 10.0.0.0 - 10.15.66.63 -""" - -from trex_stl_lib.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.15.66.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.15.66.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")], - split_by_field="dst") - # 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")], - split_by_field="dst") - - 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/tools/t-rex/stream_profiles/trex-sl-3n-ethip4-ip4dst253.py b/resources/tools/t-rex/stream_profiles/trex-sl-3n-ethip4-ip4dst253.py deleted file mode 100755 index 684af82ce1..0000000000 --- a/resources/tools/t-rex/stream_profiles/trex-sl-3n-ethip4-ip4dst253.py +++ /dev/null @@ -1,96 +0,0 @@ -# Copyright (c) 2017 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: 20.20.20.2 - - Destination IP address range: 2.1.1.2 - 2.1.1.254 - - Direction 1 --> 0: - - Source IP address range: 10.10.10.2 - - Destination IP address range: 1.1.1.2 - 1.1.1.254 -""" - -from trex_stl_lib.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 = '20.20.20.2' - self.p1_dst_start_ip = '2.1.1.2' - self.p1_dst_end_ip = '2.1.1.254' - - self.p2_src_start_ip = '10.10.10.2' - self.p2_dst_start_ip = '1.1.1.2' - self.p2_dst_end_ip = '1.1.1.254' - - 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")], - split_by_field="dst") - # 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")], - split_by_field="dst") - - 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/tools/t-rex/stream_profiles/trex-sl-3n-ethip4-ip4dst253_l3fwd.py b/resources/tools/t-rex/stream_profiles/trex-sl-3n-ethip4-ip4dst253_l3fwd.py deleted file mode 100755 index 55a79942de..0000000000 --- a/resources/tools/t-rex/stream_profiles/trex-sl-3n-ethip4-ip4dst253_l3fwd.py +++ /dev/null @@ -1,96 +0,0 @@ -# Copyright (c) 2017 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: 20.20.20.2 - - Destination IP address range: 1.1.1.2 - 1.1.1.254 - - Direction 1 --> 0: - - Source IP address range: 10.10.10.2 - - Destination IP address range: 2.1.1.2 - 2.1.1.254 -""" - -from trex_stl_lib.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 = '20.20.20.2' - self.p1_dst_start_ip = '1.1.1.2' - self.p1_dst_end_ip = '1.1.1.254' - - self.p2_src_start_ip = '10.10.10.2' - self.p2_dst_start_ip = '2.1.1.2' - self.p2_dst_end_ip = '2.1.1.254' - - 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")], - split_by_field="dst") - # 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")], - split_by_field="dst") - - 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/tools/t-rex/stream_profiles/trex-sl-3n-ethip4-ip4src253.py b/resources/tools/t-rex/stream_profiles/trex-sl-3n-ethip4-ip4src253.py deleted file mode 100755 index f9a030b9eb..0000000000 --- a/resources/tools/t-rex/stream_profiles/trex-sl-3n-ethip4-ip4src253.py +++ /dev/null @@ -1,94 +0,0 @@ -# Copyright (c) 2017 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.10.10.2 - 10.10.10.254 - - Destination IP address range: 20.20.20.2 - - Direction 1 --> 0: - - Source IP address range: 20.20.20.2 - 20.20.20.254 - - Destination IP address range: 10.10.10.2 -""" - -from trex_stl_lib.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.10.10.2' - self.p1_src_end_ip = '10.10.10.254' - self.p1_dst_start_ip = '20.20.20.2' - - self.p2_src_start_ip = '20.20.20.2' - self.p2_src_end_ip = '20.20.20.254' - self.p2_dst_start_ip = '10.10.10.2' - - 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="src", - min_value=self.p1_src_start_ip, - max_value=self.p1_src_end_ip, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="src", pkt_offset="IP.src"), - STLVmFixIpv4(offset="IP")], - split_by_field="src") - # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name="src", - min_value=self.p2_src_start_ip, - max_value=self.p2_src_end_ip, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="src", pkt_offset="IP.src"), - STLVmFixIpv4(offset="IP")], - split_by_field="src") - - 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/tools/t-rex/stream_profiles/trex-sl-3n-ethip4-ip4src254.py b/resources/tools/t-rex/stream_profiles/trex-sl-3n-ethip4-ip4src254.py deleted file mode 100755 index 0a2a4a4564..0000000000 --- a/resources/tools/t-rex/stream_profiles/trex-sl-3n-ethip4-ip4src254.py +++ /dev/null @@ -1,94 +0,0 @@ -# Copyright (c) 2017 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.10.10.1 - 10.10.10.254 - - Destination IP address range: 20.20.20.1 - - Direction 1 --> 0: - - Source IP address range: 20.20.20.1 - 20.20.20.254 - - Destination IP address range: 10.10.10.1 -""" - -from trex_stl_lib.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.10.10.1' - self.p1_src_end_ip = '10.10.10.254' - self.p1_dst_start_ip = '20.20.20.1' - - self.p2_src_start_ip = '20.20.20.1' - self.p2_src_end_ip = '20.20.20.254' - self.p2_dst_start_ip = '10.10.10.1' - - 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="src", - min_value=self.p1_src_start_ip, - max_value=self.p1_src_end_ip, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="src", pkt_offset="IP.src"), - STLVmFixIpv4(offset="IP")], - split_by_field="src") - # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name="src", - min_value=self.p2_src_start_ip, - max_value=self.p2_src_end_ip, - size=4, op="inc"), - STLVmWrFlowVar(fv_name="src", pkt_offset="IP.src"), - STLVmFixIpv4(offset="IP")], - split_by_field="src") - - 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/tools/t-rex/stream_profiles/trex-sl-3n-ethip4udp-1000u15p.py b/resources/tools/t-rex/stream_profiles/trex-sl-3n-ethip4udp-1000u15p.py deleted file mode 100755 index c9f6a27b89..0000000000 --- a/resources/tools/t-rex/stream_profiles/trex-sl-3n-ethip4udp-1000u15p.py +++ /dev/null @@ -1,116 +0,0 @@ -# Copyright (c) 2017 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 / UDP - - Direction 0 --> 1: - - Source IP address range: 20.0.0.0 - 20.0.3.231 - - Destination IP address range: 12.0.0.2 - - Source UDP port range: 1024 - 1038 - - Destination UDP port range: 1024 - - Direction 1 --> 0: - - Source IP address range: 12.0.0.2 - - Destination IP address range: 200.0.0.0 - - Source UDP port range: 1024 - - Destination UDP port range: 1024 - 16023 -""" - -from trex_stl_lib.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 = '20.0.0.0' - self.p1_src_end_ip = '20.0.3.231' - self.p1_dst_start_ip = '12.0.0.2' - - self.p2_src_start_ip = '12.0.0.2' - self.p2_src_end_ip = '12.0.0.2' - self.p2_dst_start_ip = '200.0.0.0' - - # UDP ports used in packet headers. - self.p1_src_start_udp_port = 1024 - self.p1_src_end_udp_port = 1038 - self.p1_dst_start_udp_port = 1024 - - self.p2_src_start_udp_port = 1024 - self.p2_dst_start_udp_port = 1024 - self.p2_dst_end_udp_port = 16023 - - def define_packets(self): - """Defines the packets to be sent from the traffic generator. - - Packet definition: | ETH | IP | UDP | - - :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=17) / - UDP(sport=self.p1_src_start_udp_port, - dport=self.p1_dst_start_udp_port)) - # Direction 1 --> 0 - base_pkt_b = (Ether() / - IP(src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=17) / - UDP(sport=self.p2_src_start_udp_port, - dport=self.p2_dst_start_udp_port)) - - # Direction 0 --> 1 - vm1 = STLScVmRaw([ - STLVmTupleGen(ip_min=self.p1_src_start_ip, - ip_max=self.p1_src_end_ip, - port_min=self.p1_src_start_udp_port, - port_max=self.p1_src_end_udp_port, - name="tuple"), - STLVmWrFlowVar(fv_name="tuple.ip", pkt_offset="IP.src"), - STLVmFixIpv4(offset="IP"), - STLVmWrFlowVar(fv_name="tuple.port", pkt_offset="UDP.sport") - ]) - # Direction 0 --> 1 - vm2 = STLScVmRaw([ - STLVmFlowVar(name="dport", - min_value=self.p2_dst_start_udp_port, - max_value=self.p2_dst_end_udp_port, - size=2, op="inc"), - STLVmWrFlowVar(fv_name="dport", pkt_offset="UDP.dport") - ]) - - 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/tools/t-rex/stream_profiles/trex-sl-3n-ethip4udp-100u15p.py b/resources/tools/t-rex/stream_profiles/trex-sl-3n-ethip4udp-100u15p.py deleted file mode 100755 index 87a5d3067d..0000000000 --- a/resources/tools/t-rex/stream_profiles/trex-sl-3n-ethip4udp-100u15p.py +++ /dev/null @@ -1,116 +0,0 @@ -# Copyright (c) 2017 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 / UDP - - Direction 0 --> 1: - - Source IP address range: 20.0.0.0 - 20.0.0.99 - - Destination IP address range: 12.0.0.2 - - Source UDP port range: 1024 - 1038 - - Destination UDP port range: 1024 - - Direction 1 --> 0: - - Source IP address range: 12.0.0.2 - - Destination IP address range: 200.0.0.0 - - Source UDP port range: 1024 - - Destination UDP port range: 1024 - 2523 -""" - -from trex_stl_lib.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 = '20.0.0.0' - self.p1_src_end_ip = '20.0.0.99' - self.p1_dst_start_ip = '12.0.0.2' - - self.p2_src_start_ip = '12.0.0.2' - self.p2_src_end_ip = '12.0.0.2' - self.p2_dst_start_ip = '200.0.0.0' - - # UDP ports used in packet headers. - self.p1_src_start_udp_port = 1024 - self.p1_src_end_udp_port = 1038 - self.p1_dst_start_udp_port = 1024 - - self.p2_src_start_udp_port = 1024 - self.p2_dst_start_udp_port = 1024 - self.p2_dst_end_udp_port = 2523 - - def define_packets(self): - """Defines the packets to be sent from the traffic generator. - - Packet definition: | ETH | IP | UDP | - - :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=17) / - UDP(sport=self.p1_src_start_udp_port, - dport=self.p1_dst_start_udp_port)) - # Direction 1 --> 0 - base_pkt_b = (Ether() / - IP(src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=17) / - UDP(sport=self.p2_src_start_udp_port, - dport=self.p2_dst_start_udp_port)) - - # Direction 0 --> 1 - vm1 = STLScVmRaw([ - STLVmTupleGen(ip_min=self.p1_src_start_ip, - ip_max=self.p1_src_end_ip, - port_min=self.p1_src_start_udp_port, - port_max=self.p1_src_end_udp_port, - name="tuple"), - STLVmWrFlowVar(fv_name="tuple.ip", pkt_offset="IP.src"), - STLVmFixIpv4(offset="IP"), - STLVmWrFlowVar(fv_name="tuple.port", pkt_offset="UDP.sport") - ]) - # Direction 0 --> 1 - vm2 = STLScVmRaw([ - STLVmFlowVar(name="dport", - min_value=self.p2_dst_start_udp_port, - max_value=self.p2_dst_end_udp_port, - size=2, op="inc"), - STLVmWrFlowVar(fv_name="dport", pkt_offset="UDP.dport") - ]) - - 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/tools/t-rex/stream_profiles/trex-sl-3n-ethip4udp-10u15p.py b/resources/tools/t-rex/stream_profiles/trex-sl-3n-ethip4udp-10u15p.py deleted file mode 100755 index 74f2f0d1e5..0000000000 --- a/resources/tools/t-rex/stream_profiles/trex-sl-3n-ethip4udp-10u15p.py +++ /dev/null @@ -1,116 +0,0 @@ -# Copyright (c) 2017 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 / UDP - - Direction 0 --> 1: - - Source IP address range: 20.0.0.0 - 20.0.0.9 - - Destination IP address range: 12.0.0.2 - - Source UDP port range: 1024 - 1038 - - Destination UDP port range: 1024 - - Direction 1 --> 0: - - Source IP address range: 12.0.0.2 - - Destination IP address range: 200.0.0.0 - - Source UDP port range: 1024 - - Destination UDP port range: 1024 - 1173 -""" - -from trex_stl_lib.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 = '20.0.0.0' - self.p1_src_end_ip = '20.0.0.9' - self.p1_dst_start_ip = '12.0.0.2' - - self.p2_src_start_ip = '12.0.0.2' - #self.p2_src_end_ip = '12.0.0.2' - self.p2_dst_start_ip = '200.0.0.0' - - # UDP ports used in packet headers. - self.p1_src_start_udp_port = 1024 - self.p1_src_end_udp_port = 1038 - self.p1_dst_start_udp_port = 1024 - - self.p2_src_start_udp_port = 1024 - self.p2_dst_start_udp_port = 1024 - self.p2_dst_end_udp_port = 1173 - - def define_packets(self): - """Defines the packets to be sent from the traffic generator. - - Packet definition: | ETH | IP | UDP | - - :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=17) / - UDP(sport=self.p1_src_start_udp_port, - dport=self.p1_dst_start_udp_port)) - # Direction 1 --> 0 - base_pkt_b = (Ether() / - IP(src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=17) / - UDP(sport=self.p2_src_start_udp_port, - dport=self.p2_dst_start_udp_port)) - - # Direction 0 --> 1 - vm1 = STLScVmRaw([ - STLVmTupleGen(ip_min=self.p1_src_start_ip, - ip_max=self.p1_src_end_ip, - port_min=self.p1_src_start_udp_port, - port_max=self.p1_src_end_udp_port, - name="tuple"), - STLVmWrFlowVar(fv_name="tuple.ip", pkt_offset="IP.src"), - STLVmFixIpv4(offset="IP"), - STLVmWrFlowVar(fv_name="tuple.port", pkt_offset="UDP.sport") - ]) - # Direction 0 --> 1 - vm2 = STLScVmRaw([ - STLVmFlowVar(name="dport", - min_value=self.p2_dst_start_udp_port, - max_value=self.p2_dst_end_udp_port, - size=2, op="inc"), - STLVmWrFlowVar(fv_name="dport", pkt_offset="UDP.dport") - ]) - - 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/tools/t-rex/stream_profiles/trex-sl-3n-ethip4udp-1u15p.py b/resources/tools/t-rex/stream_profiles/trex-sl-3n-ethip4udp-1u15p.py deleted file mode 100755 index 220ec05e31..0000000000 --- a/resources/tools/t-rex/stream_profiles/trex-sl-3n-ethip4udp-1u15p.py +++ /dev/null @@ -1,113 +0,0 @@ -# Copyright (c) 2017 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 / UDP - - Direction 0 --> 1: - - Source IP address range: 20.0.0.0 - - Destination IP address range: 12.0.0.2 - - Source UDP port range: 1024 - 1038 - - Destination UDP port range: 1024 - - Direction 1 --> 0: - - Source IP address range: 12.0.0.2 - - Destination IP address range: 200.0.0.0 - - Source UDP port range: 1024 - - Destination UDP port range: 1024 - 1038 -""" - -from trex_stl_lib.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 = '20.0.0.0' - self.p1_src_end_ip = '20.0.0.0' - self.p1_dst_start_ip = '12.0.0.2' - - self.p2_src_start_ip = '12.0.0.2' - self.p2_src_end_ip = '12.0.0.2' - self.p2_dst_start_ip = '200.0.0.0' - - # UDP ports used in packet headers. - self.p1_src_start_udp_port = 1024 - self.p1_src_end_udp_port = 1038 - self.p1_dst_start_udp_port = 1024 - - self.p2_src_start_udp_port = 1024 - self.p2_dst_start_udp_port = 1024 - self.p2_dst_end_udp_port = 1038 - - def define_packets(self): - """Defines the packets to be sent from the traffic generator. - - Packet definition: | ETH | IP | UDP | - - :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=17) / - UDP(sport=self.p1_src_start_udp_port, - dport=self.p1_dst_start_udp_port)) - # Direction 1 --> 0 - base_pkt_b = (Ether() / - IP(src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=17) / - UDP(sport=self.p2_src_start_udp_port, - dport=self.p2_dst_start_udp_port)) - - # Direction 0 --> 1 - vm1 = STLScVmRaw([ - STLVmFlowVar(name="sport", - min_value=self.p1_src_start_udp_port, - max_value=self.p1_src_end_udp_port, - size=2, op="inc"), - STLVmWrFlowVar(fv_name="sport", pkt_offset="UDP.sport") - ]) - # Direction 0 --> 1 - vm2 = STLScVmRaw([ - STLVmFlowVar(name="dport", - min_value=self.p2_dst_start_udp_port, - max_value=self.p2_dst_end_udp_port, - size=2, op="inc"), - STLVmWrFlowVar(fv_name="dport", pkt_offset="UDP.dport") - ]) - - 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/tools/t-rex/stream_profiles/trex-sl-3n-ethip4udp-1u1p.py b/resources/tools/t-rex/stream_profiles/trex-sl-3n-ethip4udp-1u1p.py deleted file mode 100755 index 939e4ce42c..0000000000 --- a/resources/tools/t-rex/stream_profiles/trex-sl-3n-ethip4udp-1u1p.py +++ /dev/null @@ -1,88 +0,0 @@ -# Copyright (c) 2017 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 / UDP - - Direction 0 --> 1: - - Source IP address range: 20.0.0.0 - - Destination IP address range: 12.0.0.2 - - Source UDP port range: 1024 - - Destination UDP port range: 1024 - - Direction 1 --> 0: - - Source IP address range: 12.0.0.2 - - Destination IP address range: 200.0.0.0 - - Source UDP port range: 1024 - - Destination UDP port range: 1028 -""" - -from trex_stl_lib.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_ip = '20.0.0.0' - self.p1_dst_ip = '12.0.0.2' - - self.p2_src_ip = '12.0.0.2' - self.p2_dst_ip = '200.0.0.0' - - # UDP ports used in packet headers. - self.p1_src_udp_port = 1024 - self.p1_dst_udp_port = 1024 - - self.p2_src_udp_port = 1024 - self.p2_dst_udp_port = 1028 - - def define_packets(self): - """Defines the packets to be sent from the traffic generator. - - Packet definition: | ETH | IP | UDP | - - :returns: Packets to be sent from the traffic generator. - :rtype: tuple - """ - - # Direction 0 --> 1 - base_pkt_a = (Ether() / - IP(src=self.p1_src_ip, dst=self.p1_dst_ip, proto=17) / - UDP(sport=self.p1_src_udp_port, - dport=self.p1_dst_udp_port)) - # Direction 1 --> 0 - base_pkt_b = (Ether() / - IP(src=self.p2_src_ip, dst=self.p2_dst_ip, proto=17) / - UDP(sport=self.p2_src_udp_port, - dport=self.p2_dst_udp_port)) - - return base_pkt_a, base_pkt_b, None, None - - -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/tools/t-rex/stream_profiles/trex-sl-3n-ethip4udp-2000u15p.py b/resources/tools/t-rex/stream_profiles/trex-sl-3n-ethip4udp-2000u15p.py deleted file mode 100755 index 7d5651812e..0000000000 --- a/resources/tools/t-rex/stream_profiles/trex-sl-3n-ethip4udp-2000u15p.py +++ /dev/null @@ -1,116 +0,0 @@ -# Copyright (c) 2017 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 / UDP - - Direction 0 --> 1: - - Source IP address range: 20.0.0.0 - 20.0.7.207 - - Destination IP address range: 12.0.0.2 - - Source UDP port range: 1024 - 1038 - - Destination UDP port range: 1024 - - Direction 1 --> 0: - - Source IP address range: 12.0.0.2 - - Destination IP address range: 200.0.0.0 - - Source UDP port range: 1024 - - Destination UDP port range: 1024 - 31022 -""" - -from trex_stl_lib.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 = '20.0.0.0' - self.p1_src_end_ip = '20.0.7.207' - self.p1_dst_start_ip = '12.0.0.2' - - self.p2_src_start_ip = '12.0.0.2' - self.p2_src_end_ip = '12.0.0.2' - self.p2_dst_start_ip = '200.0.0.0' - - # UDP ports used in packet headers. - self.p1_src_start_udp_port = 1024 - self.p1_src_end_udp_port = 1038 - self.p1_dst_start_udp_port = 1024 - - self.p2_src_start_udp_port = 1024 - self.p2_dst_start_udp_port = 1024 - self.p2_dst_end_udp_port = 31022 - - def define_packets(self): - """Defines the packets to be sent from the traffic generator. - - Packet definition: | ETH | IP | UDP | - - :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=17) / - UDP(sport=self.p1_src_start_udp_port, - dport=self.p1_dst_start_udp_port)) - # Direction 1 --> 0 - base_pkt_b = (Ether() / - IP(src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=17) / - UDP(sport=self.p2_src_start_udp_port, - dport=self.p2_dst_start_udp_port)) - - # Direction 0 --> 1 - vm1 = STLScVmRaw([ - STLVmTupleGen(ip_min=self.p1_src_start_ip, - ip_max=self.p1_src_end_ip, - port_min=self.p1_src_start_udp_port, - port_max=self.p1_src_end_udp_port, - name="tuple"), - STLVmWrFlowVar(fv_name="tuple.ip", pkt_offset="IP.src"), - STLVmFixIpv4(offset="IP"), - STLVmWrFlowVar(fv_name="tuple.port", pkt_offset="UDP.sport") - ]) - # Direction 0 --> 1 - vm2 = STLScVmRaw([ - STLVmFlowVar(name="dport", - min_value=self.p2_dst_start_udp_port, - max_value=self.p2_dst_end_udp_port, - size=2, op="inc"), - STLVmWrFlowVar(fv_name="dport", pkt_offset="UDP.dport") - ]) - - 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/tools/t-rex/stream_profiles/trex-sl-3n-ethip4udp-4000u15p.py b/resources/tools/t-rex/stream_profiles/trex-sl-3n-ethip4udp-4000u15p.py deleted file mode 100755 index dab23b8627..0000000000 --- a/resources/tools/t-rex/stream_profiles/trex-sl-3n-ethip4udp-4000u15p.py +++ /dev/null @@ -1,116 +0,0 @@ -# Copyright (c) 2017 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 / UDP - - Direction 0 --> 1: - - Source IP address range: 20.0.0.0 - 20.0.15.159 - - Destination IP address range: 12.0.0.2 - - Source UDP port range: 1024 - 1038 - - Destination UDP port range: 1024 - - Direction 1 --> 0: - - Source IP address range: 12.0.0.2 - - Destination IP address range: 200.0.0.0 - - Source UDP port range: 1024 - - Destination UDP port range: 1024 - 61022 -""" - -from trex_stl_lib.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 = '20.0.0.0' - self.p1_src_end_ip = '20.0.15.159' - self.p1_dst_start_ip = '12.0.0.2' - - self.p2_src_start_ip = '12.0.0.2' - self.p2_src_end_ip = '12.0.0.2' - self.p2_dst_start_ip = '200.0.0.0' - - # UDP ports used in packet headers. - self.p1_src_start_udp_port = 1024 - self.p1_src_end_udp_port = 1038 - self.p1_dst_start_udp_port = 1024 - - self.p2_src_start_udp_port = 1024 - self.p2_dst_start_udp_port = 1024 - self.p2_dst_end_udp_port = 61022 - - def define_packets(self): - """Defines the packets to be sent from the traffic generator. - - Packet definition: | ETH | IP | UDP | - - :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=17) / - UDP(sport=self.p1_src_start_udp_port, - dport=self.p1_dst_start_udp_port)) - # Direction 1 --> 0 - base_pkt_b = (Ether() / - IP(src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=17) / - UDP(sport=self.p2_src_start_udp_port, - dport=self.p2_dst_start_udp_port)) - - # Direction 0 --> 1 - vm1 = STLScVmRaw([ - STLVmTupleGen(ip_min=self.p1_src_start_ip, - ip_max=self.p1_src_end_ip, - port_min=self.p1_src_start_udp_port, - port_max=self.p1_src_end_udp_port, - name="tuple"), - STLVmWrFlowVar(fv_name="tuple.ip", pkt_offset="IP.src"), - STLVmFixIpv4(offset="IP"), - STLVmWrFlowVar(fv_name="tuple.port", pkt_offset="UDP.sport") - ]) - # Direction 0 --> 1 - vm2 = STLScVmRaw([ - STLVmFlowVar(name="dport", - min_value=self.p2_dst_start_udp_port, - max_value=self.p2_dst_end_udp_port, - size=2, op="inc"), - STLVmWrFlowVar(fv_name="dport", pkt_offset="UDP.dport") - ]) - - 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/tools/t-rex/stream_profiles/trex-sl-3n-ethip6-ip6dst10000.py b/resources/tools/t-rex/stream_profiles/trex-sl-3n-ethip6-ip6dst10000.py deleted file mode 100755 index 7a85ddfc05..0000000000 --- a/resources/tools/t-rex/stream_profiles/trex-sl-3n-ethip6-ip6dst10000.py +++ /dev/null @@ -1,99 +0,0 @@ -# Copyright (c) 2017 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 / IPv6 / - - Direction 0 --> 1: - - Source IP address range: 2001:1::1 - - Destination IP address range: 2001:2::0 - 2001:2::270F - - Direction 1 --> 0: - - Source IP address range: 2001:2::1 - - Destination IP address range: 2001:1::0 - 2001:1::270F -""" - -from trex_stl_lib.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 = '2001:1::1' - self.p1_dst_start_ip = '2001:2::0' - self.p1_dst_end_ip = '2001:2::270F' - - self.p2_src_start_ip = '2001:2::1' - self.p2_dst_start_ip = '2001:1::0' - self.p2_dst_end_ip = '2001:1::270F' - - def define_packets(self): - """Defines the packets to be sent from the traffic generator. - - Packet definition: | ETH | IPv6 | - - :returns: Packets to be sent from the traffic generator. - :rtype: tuple - """ - - base_p1, count_p1 = self._get_start_end_ipv6(self.p1_dst_start_ip, - self.p1_dst_end_ip) - base_p2, count_p2 = self._get_start_end_ipv6(self.p2_dst_start_ip, - self.p2_dst_end_ip) - - # Direction 0 --> 1 - base_pkt_a = Ether() / IPv6(src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip) - # Direction 1 --> 0 - base_pkt_b = Ether() / IPv6(src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip) - - # Direction 0 --> 1 - vm1 = STLScVmRaw([STLVmFlowVar(name="ipv6_dst", - min_value=base_p1, - max_value=base_p1 + count_p1, - size=8, op="inc"), - STLVmWrFlowVar(fv_name="ipv6_dst", - pkt_offset="IPv6.dst", - offset_fixup=8)], - split_by_field="ipv6_dst") - # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name="ipv6_dst", - min_value=base_p2, - max_value=base_p2 + count_p2, - size=8, op="inc"), - STLVmWrFlowVar(fv_name="ipv6_dst", - pkt_offset="IPv6.dst", - offset_fixup=8)], - split_by_field="ipv6_dst") - - 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/tools/t-rex/stream_profiles/trex-sl-3n-ethip6-ip6dst100000.py b/resources/tools/t-rex/stream_profiles/trex-sl-3n-ethip6-ip6dst100000.py deleted file mode 100755 index b1948c9de2..0000000000 --- a/resources/tools/t-rex/stream_profiles/trex-sl-3n-ethip6-ip6dst100000.py +++ /dev/null @@ -1,99 +0,0 @@ -# Copyright (c) 2017 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 / IPv6 / - - Direction 0 --> 1: - - Source IP address range: 2001:1::1 - - Destination IP address range: 2001:2::0 - 2001:2::1:869F - - Direction 1 --> 0: - - Source IP address range: 2001:2::1 - - Destination IP address range: 2001:1::0 - 2001:1::1:869F -""" - -from trex_stl_lib.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 = '2001:1::1' - self.p1_dst_start_ip = '2001:2::0' - self.p1_dst_end_ip = '2001:2::1:869F' - - self.p2_src_start_ip = '2001:2::1' - self.p2_dst_start_ip = '2001:1::0' - self.p2_dst_end_ip = '2001:1::1:869F' - - def define_packets(self): - """Defines the packets to be sent from the traffic generator. - - Packet definition: | ETH | IPv6 | - - :returns: Packets to be sent from the traffic generator. - :rtype: tuple - """ - - base_p1, count_p1 = self._get_start_end_ipv6(self.p1_dst_start_ip, - self.p1_dst_end_ip) - base_p2, count_p2 = self._get_start_end_ipv6(self.p2_dst_start_ip, - self.p2_dst_end_ip) - - # Direction 0 --> 1 - base_pkt_a = Ether() / IPv6(src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip) - # Direction 1 --> 0 - base_pkt_b = Ether() / IPv6(src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip) - - # Direction 0 --> 1 - vm1 = STLScVmRaw([STLVmFlowVar(name="ipv6_dst", - min_value=base_p1, - max_value=base_p1 + count_p1, - size=8, op="inc"), - STLVmWrFlowVar(fv_name="ipv6_dst", - pkt_offset="IPv6.dst", - offset_fixup=8)], - split_by_field="ipv6_dst") - # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name="ipv6_dst", - min_value=base_p2, - max_value=base_p2 + count_p2, - size=8, op="inc"), - STLVmWrFlowVar(fv_name="ipv6_dst", - pkt_offset="IPv6.dst", - offset_fixup=8)], - split_by_field="ipv6_dst") - - 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/tools/t-rex/stream_profiles/trex-sl-3n-ethip6-ip6dst1000000.py b/resources/tools/t-rex/stream_profiles/trex-sl-3n-ethip6-ip6dst1000000.py deleted file mode 100755 index ace0dace76..0000000000 --- a/resources/tools/t-rex/stream_profiles/trex-sl-3n-ethip6-ip6dst1000000.py +++ /dev/null @@ -1,99 +0,0 @@ -# Copyright (c) 2017 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 / IPv6 / - - Direction 0 --> 1: - - Source IP address range: 2001:1::1 - - Destination IP address range: 2001:2::0 - 2001:2::F:423F - - Direction 1 --> 0: - - Source IP address range: 2001:2::1 - - Destination IP address range: 2001:1::0 - 2001:1::F:423F -""" - -from trex_stl_lib.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 = '2001:1::1' - self.p1_dst_start_ip = '2001:2::0' - self.p1_dst_end_ip = '2001:2::F:423F' - - self.p2_src_start_ip = '2001:2::1' - self.p2_dst_start_ip = '2001:1::0' - self.p2_dst_end_ip = '2001:1::F:423F' - - def define_packets(self): - """Defines the packets to be sent from the traffic generator. - - Packet definition: | ETH | IPv6 | - - :returns: Packets to be sent from the traffic generator. - :rtype: tuple - """ - - base_p1, count_p1 = self._get_start_end_ipv6(self.p1_dst_start_ip, - self.p1_dst_end_ip) - base_p2, count_p2 = self._get_start_end_ipv6(self.p2_dst_start_ip, - self.p2_dst_end_ip) - - # Direction 0 --> 1 - base_pkt_a = Ether() / IPv6(src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip) - # Direction 1 --> 0 - base_pkt_b = Ether() / IPv6(src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip) - - # Direction 0 --> 1 - vm1 = STLScVmRaw([STLVmFlowVar(name="ipv6_dst", - min_value=base_p1, - max_value=base_p1 + count_p1, - size=8, op="inc"), - STLVmWrFlowVar(fv_name="ipv6_dst", - pkt_offset="IPv6.dst", - offset_fixup=8)], - split_by_field="ipv6_dst") - # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name="ipv6_dst", - min_value=base_p2, - max_value=base_p2 + count_p2, - size=8, op="inc"), - STLVmWrFlowVar(fv_name="ipv6_dst", - pkt_offset="IPv6.dst", - offset_fixup=8)], - split_by_field="ipv6_dst") - - 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/tools/t-rex/stream_profiles/trex-sl-3n-ethip6-ip6src253.py b/resources/tools/t-rex/stream_profiles/trex-sl-3n-ethip6-ip6src253.py deleted file mode 100755 index be900ce2cc..0000000000 --- a/resources/tools/t-rex/stream_profiles/trex-sl-3n-ethip6-ip6src253.py +++ /dev/null @@ -1,99 +0,0 @@ -# Copyright (c) 2017 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 / IPv6 / - - Direction 0 --> 1: - - Source IP address range: 2001:1::2 - 2001:1::FE - - Destination IP address range: 2001:2::2 - - Direction 1 --> 0: - - Source IP address range: 2001:2::2 - 2001:2::FE - - Destination IP address range: 2001:1::2 -""" - -from trex_stl_lib.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 = '2001:1::2' - self.p1_src_end_ip = '2001:1::FE' - self.p1_dst_start_ip = '2001:2::2' - - self.p2_src_start_ip = '2001:2::2' - self.p2_src_end_ip = '2001:2::FE' - self.p2_dst_start_ip = '2001:1::2' - - def define_packets(self): - """Defines the packets to be sent from the traffic generator. - - Packet definition: | ETH | IPv6 | - - :returns: Packets to be sent from the traffic generator. - :rtype: tuple - """ - - base_p1, count_p1 = self._get_start_end_ipv6(self.p1_src_start_ip, - self.p1_src_end_ip) - base_p2, count_p2 = self._get_start_end_ipv6(self.p2_src_start_ip, - self.p2_src_end_ip) - - # Direction 0 --> 1 - base_pkt_a = Ether() / IPv6(src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip) - # Direction 1 --> 0 - base_pkt_b = Ether() / IPv6(src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip) - - # Direction 0 --> 1 - vm1 = STLScVmRaw([STLVmFlowVar(name="ipv6_src", - min_value=base_p1, - max_value=base_p1 + count_p1, - size=8, op="inc"), - STLVmWrFlowVar(fv_name="ipv6_src", - pkt_offset="IPv6.src", - offset_fixup=8)], - split_by_field="ipv6_src") - # Direction 1 --> 0 - vm2 = STLScVmRaw([STLVmFlowVar(name="ipv6_src", - min_value=base_p2, - max_value=base_p2 + count_p2, - size=8, op="inc"), - STLVmWrFlowVar(fv_name="ipv6_src", - pkt_offset="IPv6.src", - offset_fixup=8)], - split_by_field="ipv6_src") - - 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() |