diff options
author | Vratko Polak <vrpolak@cisco.com> | 2020-05-04 13:05:26 +0200 |
---|---|---|
committer | Vratko Polak <vrpolak@cisco.com> | 2020-05-06 14:03:21 +0000 |
commit | 79f5ba9bf7656972dd988508eff9465562dde42c (patch) | |
tree | a84714e81d65bfc4f0454fa8e327d4129f58ac79 /resources | |
parent | 16ef90a2415aa3b65341fdb6517cf58721bfff7a (diff) |
Separate files needing GPL license
+ Keep apache license for now, until this is completed:
https://wiki.fd.io/view/TSC/Relicensing_Procedure
+ Add utilities for switching license comment blocks.
- They do not preserve attributes, so executable flag is lost.
+ Move the affected files to GPL/.
+ Update paths so files are executed from the new location.
+ Change the way scripts are started to do not require executable flag.
+ Employ OptionString when constructing longer command lines.
+ Move also PacketVerifier.py and TrafficScriptArg.py
as they are linked with traffic scripts.
+ That means the two files are outside "resources" package tree now.
+ Added __init__.py files so relative imports work in new package tree.
+ Start traffic scripts as python modules to allow relative imports.
+ Once again needed because they are outside the default PYTHONPATH.
Change-Id: Ieb135629e890adbaf5b79497570f3be25b746f9f
Signed-off-by: Vratko Polak <vrpolak@cisco.com>
Diffstat (limited to 'resources')
152 files changed, 243 insertions, 23581 deletions
diff --git a/resources/libraries/python/PacketVerifier.py b/resources/libraries/python/PacketVerifier.py deleted file mode 100644 index fb2337e49d..0000000000 --- a/resources/libraries/python/PacketVerifier.py +++ /dev/null @@ -1,344 +0,0 @@ -# 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. - -"""PacketVerifier module. - - Example. :: - - | >>> from scapy.all import * - | >>> from PacketVerifier import * - | >>> rxq = RxQueue('eth1') - | >>> txq = TxQueue('eth1') - | >>> src_mac = "AA:BB:CC:DD:EE:FF" - | >>> dst_mac = "52:54:00:ca:5d:0b" - | >>> src_ip = "11.11.11.10" - | >>> dst_ip = "11.11.11.11" - | >>> sent_packets = [] - | >>> pkt_send = Ether(src=src_mac, dst=dst_mac) / - | ... IP(src=src_ip, dst=dst_ip) / - | ... ICMP() - | >>> sent_packets.append(pkt_send) - | >>> txq.send(pkt_send) - | >>> pkt_send = Ether(src=src_mac, dst=dst_mac) / - | ... ARP(hwsrc=src_mac, psrc=src_ip, hwdst=dst_mac, pdst=dst_ip, op=2) - | >>> sent_packets.append(pkt_send) - | >>> txq.send(pkt_send) - | >>> rxq.recv(100, sent_packets).show() - | ###[ Ethernet ]### - | dst = aa:bb:cc:dd:ee:ff - | src = 52:54:00:ca:5d:0b - | type = 0x800 - | ###[ IP ]### - | version = 4L - | ihl = 5L - | tos = 0x0 - | len = 28 - | id = 43183 - | flags = - | frag = 0L - | ttl = 64 - | proto = icmp - | chksum = 0xa607 - | src = 11.11.11.11 - | dst = 11.11.11.10 - | options - | ###[ ICMP ]### - | type = echo-reply - | code = 0 - | chksum = 0xffff - | id = 0x0 - | seq = 0x0 - | ###[ Padding ]### - | load = 'RT\x00\xca]\x0b\xaa\xbb\xcc\xdd\xee\xff\x08\x06\x00\x01\x08\x00' - - Example end. -""" - -import os -import select - -from scapy.all import ETH_P_IP, ETH_P_IPV6, ETH_P_ALL, ETH_P_ARP -from scapy.config import conf -from scapy.layers.inet6 import IPv6 -from scapy.layers.l2 import Ether, ARP -from scapy.packet import Raw - -# Enable libpcap's L2listen -conf.use_pcap = True - -__all__ = [ - u"RxQueue", u"TxQueue", u"Interface", u"create_gratuitous_arp_request", - u"auto_pad", u"checksum_equal" -] - -# TODO: http://stackoverflow.com/questions/320232/ -# ensuring-subprocesses-are-dead-on-exiting-python-program - - -class PacketVerifier: - """Base class for TX and RX queue objects for packet verifier.""" - def __init__(self, interface_name): - os.system( - f"sudo echo 1 > /proc/sys/net/ipv6/conf/{interface_name}/" - f"disable_ipv6" - ) - os.system(f"sudo ip link set {interface_name} up promisc on") - self._ifname = interface_name - - -def extract_one_packet(buf): - """Extract one packet from the incoming buf buffer. - - Takes string as input and looks for first whole packet in it. - If it finds one, it returns substring from the buf parameter. - - :param buf: String representation of incoming packet buffer. - :type buf: str - :returns: String representation of first packet in buf. - :rtype: str - """ - pkt_len = 0 - - if len(buf) < 60: - return None - - try: - ether_type = Ether(buf[0:14]).type - except AttributeError: - raise RuntimeError(f"No EtherType in packet {buf!r}") - - if ether_type == ETH_P_IP: - # 14 is Ethernet fame header size. - # 4 bytes is just enough to look for length in ip header. - # ip total length contains just the IP packet length so add the Ether - # header. - pkt_len = Ether(buf[0:14+4]).len + 14 - if len(buf) < 60: - return None - elif ether_type == ETH_P_IPV6: - if not Ether(buf[0:14+6]).haslayer(IPv6): - raise RuntimeError(f"Invalid IPv6 packet {buf!r}") - # ... to add to the above, 40 bytes is the length of IPV6 header. - # The ipv6.len only contains length of the payload and not the header - pkt_len = Ether(buf)[u"IPv6"].plen + 14 + 40 - if len(buf) < 60: - return None - elif ether_type == ETH_P_ARP: - pkt = Ether(buf[:20]) - if not pkt.haslayer(ARP): - raise RuntimeError(u"Incomplete ARP packet") - # len(eth) + arp(2 hw addr type + 2 proto addr type - # + 1b len + 1b len + 2b operation) - - pkt_len = 14 + 8 - pkt_len += 2 * pkt.getlayer(ARP).hwlen - pkt_len += 2 * pkt.getlayer(ARP).plen - - del pkt - elif ether_type == 32821: # RARP (Reverse ARP) - pkt = Ether(buf[:20]) - pkt.type = ETH_P_ARP # Change to ARP so it works with scapy - pkt = Ether(pkt) - if not pkt.haslayer(ARP): - pkt.show() - raise RuntimeError(u"Incomplete RARP packet") - - # len(eth) + arp(2 hw addr type + 2 proto addr type - # + 1b len + 1b len + 2b operation) - pkt_len = 14 + 8 - pkt_len += 2 * pkt.getlayer(ARP).hwlen - pkt_len += 2 * pkt.getlayer(ARP).plen - - del pkt - else: - raise RuntimeError(f"Unknown protocol {ether_type}") - - if pkt_len < 60: - pkt_len = 60 - - if len(buf) < pkt_len: - return None - - return buf[0:pkt_len] - - -def packet_reader(interface_name, queue): - """Sub-process routine that reads packets and puts them to queue. - - This function is meant to be run in separate subprocess and is in tight - loop reading raw packets from interface passed as parameter. - - :param interface_name: Name of interface to read packets from. - :param queue: Queue in which this function will push incoming packets. - :type interface_name: str - :type queue: multiprocessing.Queue - """ - sock = conf.L2listen(iface=interface_name, type=ETH_P_ALL) - - while True: - pkt = sock.recv(0x7fff) - queue.put(pkt) - - -class RxQueue(PacketVerifier): - """Receive queue object. - - This object creates raw socket, reads packets from it and provides - function to access them. - - :param interface_name: Which interface to bind to. - :type interface_name: str - """ - def __init__(self, interface_name): - PacketVerifier.__init__(self, interface_name) - self._sock = conf.L2listen(iface=interface_name, type=ETH_P_ALL) - - def recv(self, timeout=3, ignore=None, verbose=True): - """Read next received packet. - - Returns scapy's Ether() object created from next packet in the queue. - Queue is being filled in parallel in subprocess. If no packet - arrives in given timeout queue.Empty exception will be risen. - - :param timeout: How many seconds to wait for next packet. - :param ignore: List of packets that should be ignored. - :param verbose: Used to suppress detailed logging of received packets. - :type timeout: int - :type ignore: list - :type verbose: bool - - :returns: Ether() initialized object from packet data. - :rtype: scapy.Ether - """ - ignore_list = list() - if ignore is not None: - for ig_pkt in ignore: - # Auto pad all packets in ignore list - ignore_list.append(str(auto_pad(ig_pkt))) - while True: - rlist, _, _ = select.select([self._sock], [], [], timeout) - if self._sock not in rlist: - return None - - pkt = self._sock.recv(0x7fff) - pkt_pad = str(auto_pad(pkt)) - print(f"Received packet on {self._ifname} of len {len(pkt)}") - if verbose: - if hasattr(pkt, u"show2"): - pkt.show2() - else: - # Never happens in practice, but Pylint does not know that. - print(f"Unexpected instance: {pkt!r}") - print() - if pkt_pad in ignore_list: - ignore_list.remove(pkt_pad) - print(u"Received packet ignored.") - continue - return pkt - - -class TxQueue(PacketVerifier): - """Transmission queue object. - - This object is used to send packets over RAW socket on a interface. - - :param interface_name: Which interface to send packets from. - :type interface_name: str - """ - def __init__(self, interface_name): - PacketVerifier.__init__(self, interface_name) - self._sock = conf.L2socket(iface=interface_name, type=ETH_P_ALL) - - def send(self, pkt, verbose=True): - """Send packet out of the bound interface. - - :param pkt: Packet to send. - :param verbose: Used to suppress detailed logging of sent packets. - :type pkt: string or scapy Packet derivative. - :type verbose: bool - """ - pkt = auto_pad(pkt) - print(f"Sending packet out of {self._ifname} of len {len(pkt)}") - if verbose: - pkt.show2() - print() - - self._sock.send(pkt) - - -class Interface: - """Class for network interfaces. Contains methods for sending and receiving - packets.""" - def __init__(self, if_name): - """Initialize the interface class. - - :param if_name: Name of the interface. - :type if_name: str - """ - self.if_name = if_name - self.sent_packets = [] - self.rxq = RxQueue(if_name) - self.txq = TxQueue(if_name) - - def send_pkt(self, pkt): - """Send the provided packet out the interface.""" - self.sent_packets.append(pkt) - self.txq.send(pkt) - - def recv_pkt(self, timeout=3): - """Read one packet from the interface's receive queue. - - :param timeout: Timeout value in seconds. - :type timeout: int - :returns: Ether() initialized object from packet data. - :rtype: scapy.Ether - """ - return self.rxq.recv(timeout, self.sent_packets) - - -def create_gratuitous_arp_request(src_mac, src_ip): - """Creates scapy representation of gratuitous ARP request.""" - return (Ether(src=src_mac, dst=u"ff:ff:ff:ff:ff:ff") / - ARP(psrc=src_ip, hwsrc=src_mac, pdst=src_ip) - ) - - -def auto_pad(packet): - """Pads zeroes at the end of the packet if the total len < 60 bytes.""" - # padded = str(packet) - if len(packet) < 60: - packet[Raw].load += (b"\0" * (60 - len(packet))) - return packet - - -def checksum_equal(chksum1, chksum2): - """Compares two checksums in one's complement notation. - - Checksums to be compared are calculated as 16 bit one's complement of the - one's complement sum of 16 bit words of some buffer. - In one's complement notation 0x0000 (positive zero) and 0xFFFF - (negative zero) are equivalent. - - :param chksum1: First checksum. - :param chksum2: Second checksum. - :type chksum1: uint16 - :type chksum2: uint16 - - :returns: True if checksums are equivalent, False otherwise. - :rtype: boolean - """ - if chksum1 == 0xFFFF: - chksum1 = 0 - if chksum2 == 0xFFFF: - chksum2 = 0 - return chksum1 == chksum2 diff --git a/resources/libraries/python/TrafficGenerator.py b/resources/libraries/python/TrafficGenerator.py index 539ced584a..c63dc2d504 100644 --- a/resources/libraries/python/TrafficGenerator.py +++ b/resources/libraries/python/TrafficGenerator.py @@ -75,7 +75,7 @@ class TGDropRateSearchImpl(DropRateSearch): :param loss_acceptance: Permitted drop ratio or frames count. :param loss_acceptance_type: Type of permitted loss. :param traffic_profile: Module name as a traffic profile identifier. - See resources/traffic_profiles/trex for implemented modules. + See GPL/traffic_profiles/trex for implemented modules. :param skip_warmup: Start TRex without warmup traffic if true. :type rate: float :type frame_size: str @@ -406,12 +406,13 @@ class TrafficGenerator(AbstractMeasurer): ) raise RuntimeError(u"Start TRex failed!") - # Test if TRex starts successfully. - cmd = f"sh -c \"{Constants.REMOTE_FW_DIR}/resources/tools/" \ - f"trex/trex_server_info.py\"" + # Test if TRex starts successfuly. + command_line = OptionString().add(u"python3") + dirname = f"{Constants.REMOTE_FW_DIR}/GPL/tools/trex" + command_line.add(f"'{dirname}/trex_server_info.py'") try: exec_cmd_no_error( - tg_node, cmd, sudo=True, + tg_node, command_line, sudo=True, message=u"Test TRex failed!", retries=20 ) except RuntimeError: @@ -488,16 +489,16 @@ class TrafficGenerator(AbstractMeasurer): :raises RuntimeError: If stop traffic script fails. """ # No need to check subtype, we know it is TREX. - x_args = u"" + command_line = OptionString().add(u"python3") + dirname = f"{Constants.REMOTE_FW_DIR}/GPL/tools/trex" + command_line.add(f"'{dirname}/trex_stateless_stop.py'") + command_line.change_prefix(u"--") for index, value in enumerate(self._xstats): if value is not None: - # Nested quoting is fun. value = value.replace(u"'", u"\"") - x_args += f" --xstat{index}='\"'\"'{value}'\"'\"'" + command_line.add_equals(f"xstat{index}", f"'{value}'") stdout, _ = exec_cmd_no_error( - node, f"sh -c '{Constants.REMOTE_FW_DIR}/resources/tools/trex/" - f"trex_stateless_stop.py{x_args}'", - message=u"TRex stateless runtime error" + node, command_line, message=u"TRex stateless runtime error" ) self._parse_traffic_results(stdout) @@ -514,7 +515,7 @@ class TrafficGenerator(AbstractMeasurer): :param rate: Traffic rate expressed with units (pps, %) :param frame_size: L2 frame size to send (without padding and IPG). :param traffic_profile: Module name as a traffic profile identifier. - See resources/traffic_profiles/trex for implemented modules. + See GPL/traffic_profiles/trex for implemented modules. :param async_call: If enabled then don't wait for all incomming trafic. :param latency: With latency measurement. :param warmup_time: Warmup time period. @@ -539,30 +540,31 @@ class TrafficGenerator(AbstractMeasurer): # No need to check subtype, we know it is TREX. reorder = self._ifaces_reordered # Just to make the next line fit. p_0, p_1 = (rx_port, tx_port) if reorder else (tx_port, rx_port) - if not isinstance(duration, (float, int)): duration = float(duration) if not isinstance(warmup_time, (float, int)): warmup_time = float(warmup_time) - command = f"sh -c \"" \ - f"{Constants.REMOTE_FW_DIR}/resources/tools/trex/" \ - f"trex_stateless_profile.py " \ - f"--profile {Constants.REMOTE_FW_DIR}/resources/" \ - f"traffic_profiles/trex/{traffic_profile}.py " \ - f"--duration {duration!r} --frame_size {frame_size} " \ - f"--rate {rate!r} --warmup_time {warmup_time!r} " \ - f"--port_0 {p_0} --port_1 {p_1} " \ - f"--traffic_directions {traffic_directions}" - if async_call: - command += u" --async_start" - if latency: - command += u" --latency" - if Constants.TREX_SEND_FORCE: - command += u" --force" - command += u"\"" + + command_line = OptionString().add(u"python3") + dirname = f"{Constants.REMOTE_FW_DIR}/GPL/tools/trex" + command_line.add(f"'{dirname}/trex_stateless_profile.py'") + command_line.change_prefix(u"--") + dirname = f"{Constants.REMOTE_FW_DIR}/GPL/traffic_profiles/trex" + quoted_path = f"'{dirname}/{traffic_profile}.py'" + command_line.add_with_value(u"profile", quoted_path) + command_line.add_with_value(u"duration", f"{duration!r}") + command_line.add_with_value(u"frame_size", frame_size) + command_line.add_with_value(u"rate", f"{rate!r}") + command_line.add_with_value(u"warmup_time", f"{warmup_time!r}") + command_line.add_with_value(u"port_0", p_0) + command_line.add_with_value(u"port_1", p_1) + command_line.add_with_value(u"traffic_directions", traffic_directions) + command_line.add_if(u"async_start", async_call) + command_line.add_if(u"latency", latency) + command_line.add_if(u"force", Constants.TREX_SEND_FORCE) stdout, _ = exec_cmd_no_error( - self._node, command, timeout=float(duration) + 60, + self._node, command_line, timeout=float(duration) + 60, message=u"TRex stateless runtime error" ) @@ -630,7 +632,7 @@ class TrafficGenerator(AbstractMeasurer): :param rate: Offered load per interface (e.g. 1%, 3gbps, 4mpps, ...). :param frame_size: Frame size (L2) in Bytes. :param traffic_profile: Module name as a traffic profile identifier. - See resources/traffic_profiles/trex for implemented modules. + See GPL/traffic_profiles/trex for implemented modules. :param warmup_time: Warmup phase in seconds. :param async_call: Async mode. :param latency: With latency measurement. @@ -720,7 +722,7 @@ class TrafficGenerator(AbstractMeasurer): :param frame_size: Frame size identifier or value [B]. :param traffic_profile: Module name as a traffic profile identifier. - See resources/traffic_profiles/trex for implemented modules. + See GPL/traffic_profiles/trex for implemented modules. :param warmup_time: Traffic duration before measurement starts [s]. :param traffic_directions: Traffic is bi- (2) or uni- (1) directional. Default: 2 @@ -811,7 +813,7 @@ class OptimizedSearch: :param frame_size: Frame size identifier or value [B]. :param traffic_profile: Module name as a traffic profile identifier. - See resources/traffic_profiles/trex for implemented modules. + See GPL/traffic_profiles/trex for implemented modules. :param minimum_transmit_rate: Minimal uni-directional target transmit rate [pps]. :param maximum_transmit_rate: Maximal uni-directional @@ -879,7 +881,7 @@ class OptimizedSearch: :param frame_size: Frame size identifier or value [B]. :param traffic_profile: Module name as a traffic profile identifier. - See resources/traffic_profiles/trex for implemented modules. + See GPL/traffic_profiles/trex for implemented modules. :param minimum_transmit_rate: Minimal uni-directional target transmit rate [pps]. :param maximum_transmit_rate: Maximal uni-directional diff --git a/resources/libraries/python/TrafficScriptArg.py b/resources/libraries/python/TrafficScriptArg.py deleted file mode 100644 index 247eccbc2f..0000000000 --- a/resources/libraries/python/TrafficScriptArg.py +++ /dev/null @@ -1,68 +0,0 @@ -# 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. - -"""Traffic scripts argument parser library.""" - -import argparse - - -class TrafficScriptArg: - """Traffic scripts argument parser. - - Parse arguments for traffic script. Default has two arguments '--tx_if' - and '--rx_if'. You can provide more arguments. All arguments have string - representation of the value. You can add also optional arguments. Default - value for optional arguments is empty string. - - :param more_args: List of additional arguments (optional). - :param opt_args: List of optional arguments (optional). - :type more_args: list - :type opt_args: list - - :Example: - - >>> from TrafficScriptArg import TrafficScriptArg - >>> args = TrafficScriptArg(['src_mac', 'dst_mac', 'src_ip', 'dst_ip']) - """ - - def __init__(self, more_args=None, opt_args=None): - parser = argparse.ArgumentParser() - parser.add_argument(u"--tx_if", help=u"interface that sends traffic") - parser.add_argument(u"--rx_if", help=u"interface that receives traffic") - - if more_args is not None: - for arg in more_args: - arg_name = f"--{arg}" - parser.add_argument(arg_name) - - if opt_args is not None: - for arg in opt_args: - arg_name = f"--{arg}" - parser.add_argument(arg_name, nargs=u"?", default=u"") - - self._parser = parser - self._args = vars(parser.parse_args()) - - def get_arg(self, arg_name): - """Get argument value. - - :param arg_name: Argument name. - :type arg_name: str - :returns: Argument value. - :rtype: str - """ - arg_val = self._args.get(arg_name) - if arg_val is None: - raise Exception(f"Argument '{arg_name}' not found") - - return arg_val diff --git a/resources/libraries/python/TrafficScriptExecutor.py b/resources/libraries/python/TrafficScriptExecutor.py index a9a733bbdf..8faa084ca1 100644 --- a/resources/libraries/python/TrafficScriptExecutor.py +++ b/resources/libraries/python/TrafficScriptExecutor.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 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: @@ -55,11 +55,11 @@ class TrafficScriptExecutor: """ ssh = SSH() ssh.connect(node) + module_name = script_file_name[:-3].replace('/', '.') cmd = f"cd {Constants.REMOTE_FW_DIR}; virtualenv -p $(which python3) " \ f"--system-site-packages --never-download env && " \ f"export PYTHONPATH=${{PWD}}; . ${{PWD}}/env/bin/activate; " \ - f"resources/traffic_scripts/{script_file_name} {script_args}" - + f"cd GPL; python -m traffic_scripts.{module_name} {script_args}" ret_code, stdout, stderr = ssh.exec_command_sudo( f'sh -c "{TrafficScriptExecutor._escape(cmd)}"', timeout=timeout ) diff --git a/resources/tools/block_replacer/apache2gpl.sh b/resources/tools/block_replacer/apache2gpl.sh new file mode 100644 index 0000000000..f248393d50 --- /dev/null +++ b/resources/tools/block_replacer/apache2gpl.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +# Copyright (c) 2020 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. + +set -exuo pipefail + +if [[ "${#}" != "1" ]]; then + echo 'An utility to switch license comment blocks.' + echo 'Requires files "gpl_block.txt" and "apache_block.txt" in the working' + echo 'directory, and a single argument pointing to root directory.' + echo 'Affects only .sh and .py files.' + exit 1 +fi + +find "${1}" \( -name "*.py" -o -name "*.sh" \) -print0 | xargs -0 \ +python3 replace.py "apache_block.txt" "gpl_block.txt" diff --git a/resources/tools/block_replacer/apache_block.txt b/resources/tools/block_replacer/apache_block.txt new file mode 100644 index 0000000000..790a3c4ea1 --- /dev/null +++ b/resources/tools/block_replacer/apache_block.txt @@ -0,0 +1,11 @@ +# 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. diff --git a/resources/tools/block_replacer/gpl2apache.sh b/resources/tools/block_replacer/gpl2apache.sh new file mode 100644 index 0000000000..a1ef8df075 --- /dev/null +++ b/resources/tools/block_replacer/gpl2apache.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +# Copyright (c) 2020 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. + +set -exuo pipefail + +if [[ "${#}" != "1" ]]; then + echo 'An utility to switch license comment blocks.' + echo 'Requires files "gpl_block.txt" and "apache_block.txt" in the working' + echo 'directory, and a single argument pointing to root directory.' + echo 'Affects only .sh and .py files.' + exit 1 +fi + +find "${1}" \( -name "*.py" -o -name "*.sh" \) -print0 | xargs -0 \ +python3 replace.py "gpl_block.txt" "apache_block.txt" diff --git a/resources/tools/block_replacer/gpl_block.txt b/resources/tools/block_replacer/gpl_block.txt new file mode 100644 index 0000000000..2dbbb2af06 --- /dev/null +++ b/resources/tools/block_replacer/gpl_block.txt @@ -0,0 +1,13 @@ +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this file. If not, see <https://www.gnu.org/licenses/>. diff --git a/resources/tools/block_replacer/replace.py b/resources/tools/block_replacer/replace.py new file mode 100644 index 0000000000..02d1889331 --- /dev/null +++ b/resources/tools/block_replacer/replace.py @@ -0,0 +1,126 @@ +#!/usr/bin/env python3 + +# Copyright (c) 2020 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. + +"""A script simplifying replacement of blocks of lines. + +A bash solution created by combining these two: + https://unix.stackexchange.com/a/181215 + https://stackoverflow.com/a/23849180 +does not seem to work if the blocks contain complicated characters. +""" + +import argparse +import os +import tempfile + +def main(): + """Main function for the block replacing script.""" + + description = '''Replace a block of lines with another block. + + Both block-to-replace and replacing-block are read from a file. + The replacement is performed on a file, in-place. + Only first block occurence is replaced. + If the block-to-replace is preceded by a partial match, + it may not be recognized. + + The current implementation uses temporary files, + created in the working directory. + if something fails, thise temporary files need to be deleted manually. + + TODO: Preserve target attributes. Maybe https://pypi.org/project/in-place/ +''' + parser = argparse.ArgumentParser(description) + parser.add_argument( + u"before", type=str, + help=u"Path to file containing the old content to replace." + ) + parser.add_argument( + u"after", type=str, + help=u"Path to file containing the new content to replace with." + ) + parser.add_argument( + u"targets", metavar=u"target", nargs=u"+", type=str, + help=u"Paths to file where the replacement should be made." + ) + args = parser.parse_args() + + do_it(args) + + +def do_it(args): + """Read contents, create edited target, replace the original target with it. + + :param args: Parsed command line arguments. + :type args: Object (typically argparse.Namespace) which contains + "before", "after" and "target" fields. + """ + with open(args.before, u"r") as file_in: + content_before = file_in.readlines() + before_len = len(content_before) + with open(args.after, u"r") as file_in: + content_after = file_in.readlines() + + for target in args.targets: + with tempfile.NamedTemporaryFile( + dir=u".", mode=u"w", delete=False + ) as file_out: + with open(target, u"r") as file_in: + # Phase one, searching for content, copying what does not match. + buffer_lines = list() + line_index_to_check = 0 + content_found = False + while 1: + line_in = file_in.readline() + if not line_in: + print(f"{target}: Content not found.") + for line_out in buffer_lines: + file_out.write(line_out) + buffer_lines = list() + break + if line_in != content_before[line_index_to_check]: + line_index_to_check = 0 + if buffer_lines: + for line_out in buffer_lines: + file_out.write(line_out) + buffer_lines = list() + file_out.write(line_in) + continue + buffer_lines.append(line_in) + line_index_to_check += 1 + if line_index_to_check < before_len: + continue + # Buffer has the match! Do not write it. + content_found = True + break + if not content_found: + file_out.close() + os.remove(file_out.name) + continue + # Phase two, write the replacement instead. + for line_out in content_after: + file_out.write(line_out) + # Phase three, copy the rest of the file. + while 1: + line_in = file_in.readline() + if not line_in: + print(f"{target}: Replacement done.") + break + file_out.write(line_in) + os.replace(file_out.name, target) + + +if __name__ == u"__main__": + main() diff --git a/resources/tools/trex/trex_server_info.py b/resources/tools/trex/trex_server_info.py deleted file mode 100755 index b34709b206..0000000000 --- a/resources/tools/trex/trex_server_info.py +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/python3 - -# 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. - -"""This script uses T-REX stateless API to drive t-rex instance. - -Requirements: -- T-REX: https://github.com/cisco-system-traffic-generator/trex-core - - compiled and running T-REX process (eg. ./t-rex-64 -i) - - trex.stl.api library -- Script must be executed on a node with T-REX instance - -Functionality: -1. Verify the API functionality and get server information - -""" - -import sys - -sys.path.insert( - 0, u"/opt/trex-core-2.73/scripts/automation/trex_control_plane/interactive/" -) -from trex.stl.api import * - - -def main(): - """Check server info and quit.""" - client = STLClient() - try: - # connect to server - client.connect() - - # get server info - print(client.get_server_system_info()) - except STLError as ex_error: - print(ex_error, file=sys.stderr) - sys.exit(1) - finally: - client.disconnect() - - -if __name__ == u"__main__": - main() diff --git a/resources/tools/trex/trex_stateless_profile.py b/resources/tools/trex/trex_stateless_profile.py deleted file mode 100755 index a0de5c0cd3..0000000000 --- a/resources/tools/trex/trex_stateless_profile.py +++ /dev/null @@ -1,345 +0,0 @@ -#!/usr/bin/python3 - -# Copyright (c) 2020 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. - -"""This module gets a traffic profile together with other parameters, reads -the profile and sends the traffic. At the end, it measures the packet loss and -latency. -""" - -import argparse -import json -import sys -import time - -sys.path.insert( - 0, u"/opt/trex-core-2.73/scripts/automation/trex_control_plane/interactive/" -) -from trex.stl.api import * - - -def fmt_latency(lat_min, lat_avg, lat_max, hdrh): - """Return formatted, rounded latency. - - :param lat_min: Min latency - :param lat_avg: Average latency - :param lat_max: Max latency - :param hdrh: Base64 encoded compressed HDRHistogram object. - :type lat_min: str - :type lat_avg: str - :type lat_max: str - :type hdrh: str - :return: Formatted and rounded output (hdrh unchanged) "min/avg/max/hdrh". - :rtype: str - """ - try: - t_min = int(round(float(lat_min))) - except ValueError: - t_min = int(-1) - try: - t_avg = int(round(float(lat_avg))) - except ValueError: - t_avg = int(-1) - try: - t_max = int(round(float(lat_max))) - except ValueError: - t_max = int(-1) - - return u"/".join(str(tmp) for tmp in (t_min, t_avg, t_max, hdrh)) - - -def simple_burst( - profile_file, duration, framesize, rate, warmup_time, port_0, port_1, - latency, async_start=False, traffic_directions=2, force=False): - """Send traffic and measure packet loss and latency. - - Procedure: - - reads the given traffic profile with streams, - - connects to the T-rex client, - - resets the ports, - - removes all existing streams, - - adds streams from the traffic profile to the ports, - - if the warm-up time is more than 0, sends the warm-up traffic, reads the - statistics, - - clears the statistics from the client, - - starts the traffic, - - waits for the defined time (or runs forever if async mode is defined), - - stops the traffic, - - reads and displays the statistics and - - disconnects from the client. - - :param profile_file: A python module with T-rex traffic profile. - :param framesize: Frame size. - :param duration: Duration of traffic run in seconds (-1=infinite). - :param rate: Traffic rate [percentage, pps, bps]. - :param warmup_time: Traffic warm-up time in seconds, 0 = disable. - :param port_0: Port 0 on the traffic generator. - :param port_1: Port 1 on the traffic generator. - :param latency: With latency stats. - :param async_start: Start the traffic and exit. - :param traffic_directions: Bidirectional (2) or unidirectional (1) traffic. - :param force: Force start regardless of ports state. - :type profile_file: str - :type framesize: int or str - :type duration: float - :type rate: str - :type warmup_time: float - :type port_0: int - :type port_1: int - :type latency: bool - :type async_start: bool - :type traffic_directions: int - :type force: bool - """ - client = None - total_rcvd = 0 - total_sent = 0 - approximated_duration = 0 - approximated_rate = 0 - lost_a = 0 - lost_b = 0 - lat_a = u"-1/-1/-1/" - lat_b = u"-1/-1/-1/" - - # Read the profile: - try: - print(f"### Profile file:\n{profile_file}") - profile = STLProfile.load( - profile_file, direction=0, port_id=0, framesize=framesize - ) - streams = profile.get_streams() - except STLError as err: - print(f"Error while loading profile '{profile_file}' {err!r}") - sys.exit(1) - - try: - # Create the client: - client = STLClient() - # Connect to server: - client.connect() - # Prepare our ports (the machine has 0 <--> 1 with static route): - client.reset(ports=[port_0, port_1]) - client.remove_all_streams(ports=[port_0, port_1]) - - if u"macsrc" in profile_file: - client.set_port_attr(ports=[port_0, port_1], promiscuous=True) - if isinstance(framesize, int): - client.add_streams(streams[0], ports=[port_0]) - if traffic_directions > 1: - client.add_streams(streams[1], ports=[port_1]) - elif isinstance(framesize, str): - client.add_streams(streams[0:3], ports=[port_0]) - if traffic_directions > 1: - client.add_streams(streams[3:6], ports=[port_1]) - if latency: - try: - if isinstance(framesize, int): - client.add_streams(streams[2], ports=[port_0]) - if traffic_directions > 1: - client.add_streams(streams[3], ports=[port_1]) - elif isinstance(framesize, str): - latency = False - except STLError: - # Disable latency if NIC does not support requested stream type - print(u"##### FAILED to add latency streams #####") - latency = False - ports = [port_0] - if traffic_directions > 1: - ports.append(port_1) - # Warm-up phase: - if warmup_time > 0: - # Clear the stats before injecting: - client.clear_stats() - - # Choose rate and start traffic: - client.start(ports=ports, mult=rate, duration=warmup_time, - force=force) - - # Block until done: - time_start = time.monotonic() - client.wait_on_traffic(ports=ports, timeout=warmup_time+30) - time_stop = time.monotonic() - approximated_duration = time_stop - time_start - - if client.get_warnings(): - for warning in client.get_warnings(): - print(warning) - - # Read the stats after the test: - stats = client.get_stats() - - print(u"##### Warmup statistics #####") - print(json.dumps(stats, indent=4, separators=(u",", u": "))) - - lost_a = stats[port_0][u"opackets"] - stats[port_1][u"ipackets"] - if traffic_directions > 1: - lost_b = stats[port_1][u"opackets"] - stats[port_0][u"ipackets"] - - print(f"\npackets lost from {port_0} --> {port_1}: {lost_a} pkts") - if traffic_directions > 1: - print(f"packets lost from {port_1} --> {port_0}: {lost_b} pkts") - - # Clear the stats before injecting: - client.clear_stats() - lost_a = 0 - lost_b = 0 - - # Choose rate and start traffic: - client.start(ports=ports, mult=rate, duration=duration) - - if async_start: - # For async stop, we need to export the current snapshot. - xsnap0 = client.ports[0].get_xstats().reference_stats - print(f"Xstats snapshot 0: {xsnap0!r}") - if traffic_directions > 1: - xsnap1 = client.ports[1].get_xstats().reference_stats - print(f"Xstats snapshot 1: {xsnap1!r}") - else: - # Block until done: - time_start = time.monotonic() - client.wait_on_traffic(ports=ports, timeout=duration+30) - time_stop = time.monotonic() - approximated_duration = time_stop - time_start - - if client.get_warnings(): - for warning in client.get_warnings(): - print(warning) - - # Read the stats after the test - stats = client.get_stats() - - print(u"##### Statistics #####") - print(json.dumps(stats, indent=4, separators=(u",", u": "))) - - lost_a = stats[port_0][u"opackets"] - stats[port_1][u"ipackets"] - if traffic_directions > 1: - lost_b = stats[port_1][u"opackets"] - stats[port_0][u"ipackets"] - - # Stats index is not a port number, but "pgid". - if latency: - lat_obj = stats[u"latency"][0][u"latency"] - lat_a = fmt_latency( - str(lat_obj[u"total_min"]), str(lat_obj[u"average"]), - str(lat_obj[u"total_max"]), str(lat_obj[u"hdrh"])) - if traffic_directions > 1: - lat_obj = stats[u"latency"][1][u"latency"] - lat_b = fmt_latency( - str(lat_obj[u"total_min"]), str(lat_obj[u"average"]), - str(lat_obj[u"total_max"]), str(lat_obj[u"hdrh"])) - - if traffic_directions > 1: - total_sent = stats[0][u"opackets"] + stats[1][u"opackets"] - total_rcvd = stats[0][u"ipackets"] + stats[1][u"ipackets"] - else: - total_sent = stats[port_0][u"opackets"] - total_rcvd = stats[port_1][u"ipackets"] - try: - approximated_rate = total_sent / approximated_duration - except ZeroDivisionError: - pass - - print(f"\npackets lost from {port_0} --> {port_1}: {lost_a} pkts") - if traffic_directions > 1: - print(f"packets lost from {port_1} --> {port_0}: {lost_b} pkts") - - except STLError as ex_error: - print(ex_error, file=sys.stderr) - sys.exit(1) - - finally: - if async_start: - if client: - client.disconnect(stop_traffic=False, release_ports=True) - else: - if client: - client.disconnect() - print( - f"rate={rate!r}, totalReceived={total_rcvd}, " - f"totalSent={total_sent}, frameLoss={lost_a + lost_b}, " - f"targetDuration={duration!r}, " - f"approximatedDuration={approximated_duration!r}, " - f"approximatedRate={approximated_rate}, " - f"latencyStream0(usec)={lat_a}, latencyStream1(usec)={lat_b}, " - ) - - -def main(): - """Main function for the traffic generator using T-rex. - - It verifies the given command line arguments and runs "simple_burst" - function. - """ - parser = argparse.ArgumentParser() - parser.add_argument( - u"-p", u"--profile", required=True, type=str, - help=u"Python traffic profile." - ) - parser.add_argument( - u"-d", u"--duration", required=True, type=float, - help=u"Duration of traffic run." - ) - parser.add_argument( - u"-s", u"--frame_size", required=True, - help=u"Size of a Frame without padding and IPG." - ) - parser.add_argument( - u"-r", u"--rate", required=True, - help=u"Traffic rate with included units (%, pps)." - ) - parser.add_argument( - u"-w", u"--warmup_time", type=float, default=5.0, - help=u"Traffic warm-up time in seconds, 0 = disable." - ) - parser.add_argument( - u"--port_0", required=True, type=int, - help=u"Port 0 on the traffic generator." - ) - parser.add_argument( - u"--port_1", required=True, type=int, - help=u"Port 1 on the traffic generator." - ) - parser.add_argument( - u"--async_start", action=u"store_true", default=False, - help=u"Non-blocking call of the script." - ) - parser.add_argument( - u"--latency", action=u"store_true", default=False, - help=u"Add latency stream." - ) - parser.add_argument( - u"--traffic_directions", type=int, default=2, - help=u"Send bi- (2) or uni- (1) directional traffic." - ) - parser.add_argument( - u"--force", action=u"store_true", default=False, - help=u"Force start regardless of ports state." - ) - - args = parser.parse_args() - - try: - framesize = int(args.frame_size) - except ValueError: - framesize = args.frame_size - - simple_burst( - profile_file=args.profile, duration=args.duration, framesize=framesize, - rate=args.rate, warmup_time=args.warmup_time, port_0=args.port_0, - port_1=args.port_1, latency=args.latency, async_start=args.async_start, - traffic_directions=args.traffic_directions, force=args.force - ) - - -if __name__ == u"__main__": - main() diff --git a/resources/tools/trex/trex_stateless_stop.py b/resources/tools/trex/trex_stateless_stop.py deleted file mode 100755 index 5e8721d28c..0000000000 --- a/resources/tools/trex/trex_stateless_stop.py +++ /dev/null @@ -1,104 +0,0 @@ -#!/usr/bin/python3 - -# Copyright (c) 2020 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. - -"""This script uses T-REX stateless API to drive t-rex instance. - -Requirements: -- T-REX: https://github.com/cisco-system-traffic-generator/trex-core - - compiled and running T-REX process (eg. ./t-rex-64 -i) - - trex.stl.api library -- Script must be executed on a node with T-REX instance - -Functionality: -1. Stop any running traffic -2. Optionally restore reference counter values. -3. Return conter differences. -""" - -import argparse -import json -import sys - -from collections import OrderedDict # Needed to parse xstats representation. - -sys.path.insert( - 0, u"/opt/trex-core-2.73/scripts/automation/trex_control_plane/interactive/" -) -from trex.stl.api import * - - -def main(): - """Stop traffic if any is running. Report xstats.""" - parser = argparse.ArgumentParser() - parser.add_argument( - u"--xstat0", type=str, default=u"", - help=u"Reference xstat object if any." - ) - parser.add_argument( - u"--xstat1", type=str, default=u"", - help=u"Reference xstat object if any." - ) - args = parser.parse_args() - - client = STLClient() - try: - # connect to server - client.connect() - - client.acquire(force=True) - # TODO: Support unidirection. - client.stop(ports=[0, 1]) - - # Read the stats after the test, - # we need to update values before the last trial started. - if args.xstat0: - snapshot = eval(args.xstat0) - client.ports[0].get_xstats().reference_stats = snapshot - if args.xstat1: - snapshot = eval(args.xstat1) - client.ports[1].get_xstats().reference_stats = snapshot - # Now we can call the official method to get differences. - xstats0 = client.get_xstats(0) - xstats1 = client.get_xstats(1) - - # If STLError happens, let the script fail with stack trace. - finally: - client.disconnect() - - print(u"##### statistics port 0 #####") - print(json.dumps(xstats0, indent=4, separators=(u",", u": "))) - print(u"##### statistics port 1 #####") - print(json.dumps(xstats1, indent=4, separators=(u",", u": "))) - - tx_0, rx_0 = xstats0[u"tx_good_packets"], xstats0[u"rx_good_packets"] - tx_1, rx_1 = xstats1[u"tx_good_packets"], xstats1[u"rx_good_packets"] - lost_a, lost_b = tx_0 - rx_1, tx_1 - rx_0 - - print(f"\npackets lost from 0 --> 1: {lost_a} pkts") - print(f"packets lost from 1 --> 0: {lost_b} pkts") - - total_rcvd, total_sent = rx_0 + rx_1, tx_0 + tx_1 - total_lost = total_sent - total_rcvd - # TODO: Add latency. - print( - f"rate='unknown', totalReceived={total_rcvd}, totalSent={total_sent}, " - f"frameLoss={total_lost}, targetDuration='manual', " - f"approximatedDuration='manual', approximatedRate='unknown', " - f"latencyStream0(usec)=-1/-1/-1, latencyStream1(usec)=-1/-1/-1" - ) - - -if __name__ == u"__main__": - main() diff --git a/resources/traffic_profiles/trex/profile_trex_stateless_base_class.py b/resources/traffic_profiles/trex/profile_trex_stateless_base_class.py deleted file mode 100644 index a3736796eb..0000000000 --- a/resources/traffic_profiles/trex/profile_trex_stateless_base_class.py +++ /dev/null @@ -1,217 +0,0 @@ -# Copyright (c) 2020 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 ascii_letters - -from trex.stl.api import * - - -class TrafficStreamsBaseClass: - """Base class for stream profiles for T-rex traffic generator.""" - - STREAM_TABLE = { - u"IMIX_v4": [ - {u"size": 60, u"pps": 28, u"isg": 0}, - {u"size": 590, u"pps": 20, u"isg": 0.1}, - {u"size": 1514, u"pps": 4, u"isg": 0.2} - ], - 'IMIX_v4_1': [ - {u"size": 64, u"pps": 28, u"isg": 0}, - {u"size": 570, u"pps": 16, u"isg": 0.1}, - {u"size": 1518, u"pps": 4, u"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 = u"" - for _ in range(length): - payload += choice(ascii_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(u"!QQ", ip1) - hi2, lo2 = struct.unpack(u"!QQ", ip2) - - if ((hi1 << 64) | lo1) > ((hi2 << 64) | lo2): - raise ValueError(u"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), vm=vm1 - ) - # Direction 1 --> 0 - pkt_lat_b = STLPktBuilder( - pkt=base_pkt_b / self._gen_payload(payload_len), vm=vm2 - ) - - # 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 = list() - stream2 = list() - - for stream in self.STREAM_TABLE[self.framesize]: - payload_len_a = max(0, stream[u"size"] - len(base_pkt_a) - 4) - payload_len_b = max(0, stream[u"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[u"isg"], - mode=STLTXCont(pps=stream[u"pps"])) - ) - stream2.append(STLStream( - packet=pkt_b, - isg=stream[u"isg"], - mode=STLTXCont(pps=stream[u"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[u"framesize"] - - return self.create_streams() diff --git a/resources/traffic_profiles/trex/trex-sl-2n-dot1qip4asym-ip4src254.py b/resources/traffic_profiles/trex/trex-sl-2n-dot1qip4asym-ip4src254.py deleted file mode 100644 index ae411e233b..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-2n-dot1qip4asym-ip4src254.py +++ /dev/null @@ -1,133 +0,0 @@ -# Copyright (c) 2020 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. - - Direction 0 --> 1: - - Packet: ETH / IP / - - Source IP address range: 10.10.10.1 - 10.10.10.254 - - Destination IP address range: 20.20.20.1 - - Direction 1 --> 0: - - Packet: ETH / DOT1Q / IP / - - Source IP address range: 20.20.20.1 - 20.20.20.254 - - Destination IP address range: 10.10.10.1 -""" - -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__() - - # VLAN ID - self.vlan_id = 10 - - # IPs used in packet headers. - self.p1_src_start_ip = u"10.10.10.1" - self.p1_src_end_ip = u"10.10.10.254" - self.p1_dst_start_ip = u"20.20.20.1" - - self.p2_src_start_ip = u"20.20.20.1" - self.p2_src_end_ip = u"20.20.20.254" - self.p2_dst_start_ip = u"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() / - Dot1Q( - vlan=self.vlan_id - ) / - IP( - src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"src", - min_value=self.p1_src_start_ip, - max_value=self.p1_src_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"src", - pkt_offset=u"IP.src" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"src", - min_value=self.p2_src_start_ip, - max_value=self.p2_src_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"src", - pkt_offset=u"IP.src" - ), - STLVmFixIpv4( - offset=u"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-2n-dot1qip6asym-ip6src253.py b/resources/traffic_profiles/trex/trex-sl-2n-dot1qip6asym-ip6src253.py deleted file mode 100644 index f2e9e81920..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-2n-dot1qip6asym-ip6src253.py +++ /dev/null @@ -1,134 +0,0 @@ -# Copyright (c) 2020 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. - - Direction 0 --> 1: - - Packet: ETH / IPv6 / - - Source IP address range: 2001:1::2 - 2001:1::FE - - Destination IP address range: 2001:2::2 - - Direction 1 --> 0: - - Packet: ETH / DOT1Q / IPv6 / - - Source IP address range: 2001:2::2 - 2001:2::FE - - Destination IP address range: 2001:1::2 -""" - -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__() - - # VLAN ID - self.vlan_id = 10 - - # IPs used in packet headers. - self.p1_src_start_ip = u"2001:1::2" - self.p1_src_end_ip = u"2001:1::FE" - self.p1_dst_start_ip = u"2001:2::2" - - self.p2_src_start_ip = u"2001:2::2" - self.p2_src_end_ip = u"2001:2::FE" - self.p2_dst_start_ip = u"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() / - Dot1Q( - vlan=self.vlan_id - ) / - IPv6( - src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"ipv6_src", - min_value=base_p1, - max_value=base_p1 + count_p1, - size=8, op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"ipv6_src", - pkt_offset=u"IPv6.src", - offset_fixup=8 - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"ipv6_src", - min_value=base_p2, - max_value=base_p2 + count_p2, - size=8, op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"ipv6_src", - pkt_offset=u"IPv6.src", - offset_fixup=8 - ) - ] - ) - - return base_pkt_a, base_pkt_b, vm1, vm2 - - -def register(): - """Register this traffic profile to T-rex. - - Do not change this function. - - :returns: Traffic streams. - :rtype: Object - """ - return TrafficStreams() diff --git a/resources/traffic_profiles/trex/trex-sl-2n-ethip4-ip4dst-rnd10000.py b/resources/traffic_profiles/trex/trex-sl-2n-ethip4-ip4dst-rnd10000.py deleted file mode 100644 index 16627f0884..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-2n-ethip4-ip4dst-rnd10000.py +++ /dev/null @@ -1,127 +0,0 @@ -# Copyright (c) 2020 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.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 = u"10.0.0.1" - self.p1_dst_start_ip = u"20.0.0.0" - self.p1_dst_end_ip = u"20.0.39.15" - - self.p2_src_start_ip = u"20.0.0.1" - self.p2_dst_start_ip = u"10.0.0.0" - self.p2_dst_end_ip = u"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( - [ - STLVmFlowVarRepeatableRandom( - name=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, - limit=10000 - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVarRepeatableRandom( - name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, - limit=10000 - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"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-2n-ethip4-ip4dst-rnd100000.py b/resources/traffic_profiles/trex/trex-sl-2n-ethip4-ip4dst-rnd100000.py deleted file mode 100644 index 751528d10c..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-2n-ethip4-ip4dst-rnd100000.py +++ /dev/null @@ -1,126 +0,0 @@ -# Copyright (c) 2020 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.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 = u"10.0.0.1" - self.p1_dst_start_ip = u"20.0.0.0" - self.p1_dst_end_ip = u"20.1.134.159" - - self.p2_src_start_ip = u"20.0.0.1" - self.p2_dst_start_ip = u"10.0.0.0" - self.p2_dst_end_ip = u"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( - [ - STLVmFlowVarRepeatableRandom( - name=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, - limit=100000 - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVarRepeatableRandom( - name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, - limit=100000 - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"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-2n-ethip4-ip4dst-rnd1000000.py b/resources/traffic_profiles/trex/trex-sl-2n-ethip4-ip4dst-rnd1000000.py deleted file mode 100644 index 58ab03516c..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-2n-ethip4-ip4dst-rnd1000000.py +++ /dev/null @@ -1,126 +0,0 @@ -# Copyright (c) 2020 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.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 = u"10.0.0.1" - self.p1_dst_start_ip = u"20.0.0.0" - self.p1_dst_end_ip = u"20.15.66.63" - - self.p2_src_start_ip = u"20.0.0.1" - self.p2_dst_start_ip = u"10.0.0.0" - self.p2_dst_end_ip = u"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( - [ - STLVmFlowVarRepeatableRandom( - name=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, - limit=1000000 - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVarRepeatableRandom( - name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, - limit=1000000 - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"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-2n-ethip4-ip4dst10000.py b/resources/traffic_profiles/trex/trex-sl-2n-ethip4-ip4dst10000.py deleted file mode 100644 index e9d5fb15f6..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-2n-ethip4-ip4dst10000.py +++ /dev/null @@ -1,125 +0,0 @@ -# Copyright (c) 2020 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.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 = u"10.0.0.1" - self.p1_dst_start_ip = u"20.0.0.0" - self.p1_dst_end_ip = u"20.0.39.15" - - self.p2_src_start_ip = u"20.0.0.1" - self.p2_dst_start_ip = u"10.0.0.0" - self.p2_dst_end_ip = u"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=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"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-2n-ethip4-ip4dst100000.py b/resources/traffic_profiles/trex/trex-sl-2n-ethip4-ip4dst100000.py deleted file mode 100644 index 5977d36b5b..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-2n-ethip4-ip4dst100000.py +++ /dev/null @@ -1,126 +0,0 @@ -# Copyright (c) 2020 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.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 = u"10.0.0.1" - self.p1_dst_start_ip = u"20.0.0.0" - self.p1_dst_end_ip = u"20.1.134.159" - - self.p2_src_start_ip = u"20.0.0.1" - self.p2_dst_start_ip = u"10.0.0.0" - self.p2_dst_end_ip = u"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=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"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-2n-ethip4-ip4dst1000000.py b/resources/traffic_profiles/trex/trex-sl-2n-ethip4-ip4dst1000000.py deleted file mode 100644 index 8b63b82e4f..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-2n-ethip4-ip4dst1000000.py +++ /dev/null @@ -1,126 +0,0 @@ -# Copyright (c) 2020 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.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 = u"10.0.0.1" - self.p1_dst_start_ip = u"20.0.0.0" - self.p1_dst_end_ip = u"20.15.66.63" - - self.p2_src_start_ip = u"20.0.0.1" - self.p2_dst_start_ip = u"10.0.0.0" - self.p2_dst_end_ip = u"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" - ) - ] - ) - # 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-2n-ethip4-ip4src253.py b/resources/traffic_profiles/trex/trex-sl-2n-ethip4-ip4src253.py deleted file mode 100644 index 883883ad18..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-2n-ethip4-ip4src253.py +++ /dev/null @@ -1,126 +0,0 @@ -# Copyright (c) 2020 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.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 = u"10.10.10.2" - self.p1_src_end_ip = u"10.10.10.254" - self.p1_dst_start_ip = u"20.20.20.2" - - self.p2_src_start_ip = u"20.20.20.2" - self.p2_src_end_ip = u"20.20.20.254" - self.p2_dst_start_ip = u"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=u"src", - min_value=self.p1_src_start_ip, - max_value=self.p1_src_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"src", - pkt_offset=u"IP.src" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"src", - min_value=self.p2_src_start_ip, - max_value=self.p2_src_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"src", - pkt_offset=u"IP.src" - ), - STLVmFixIpv4( - offset=u"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-2n-ethip4-ip4src254.py b/resources/traffic_profiles/trex/trex-sl-2n-ethip4-ip4src254.py deleted file mode 100644 index fc6167d126..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-2n-ethip4-ip4src254.py +++ /dev/null @@ -1,126 +0,0 @@ -# Copyright (c) 2020 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.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 = u"10.10.10.1" - self.p1_src_end_ip = u"10.10.10.254" - self.p1_dst_start_ip = u"20.20.20.1" - - self.p2_src_start_ip = u"20.20.20.1" - self.p2_src_end_ip = u"20.20.20.254" - self.p2_dst_start_ip = u"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=u"src", - min_value=self.p1_src_start_ip, - max_value=self.p1_src_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"src", - pkt_offset=u"IP.src" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"src", - min_value=self.p2_src_start_ip, - max_value=self.p2_src_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"src", - pkt_offset=u"IP.src" - ), - STLVmFixIpv4( - offset=u"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-2n-ethip4-macsrc500kdst500k.py b/resources/traffic_profiles/trex/trex-sl-2n-ethip4-macsrc500kdst500k.py deleted file mode 100644 index 9c55482078..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-2n-ethip4-macsrc500kdst500k.py +++ /dev/null @@ -1,215 +0,0 @@ -# Copyright (c) 2020 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 MAC address range: ca:fe:00:00:00:00 - ca:fe:00:07:a1:1f - - Destination MAC address range: fa:ce:00:00:00:00 - fa:ce:00:07:a1:1f - - Source IP address range: 10.0.0.0 - 10.7.161.31 - - Destination IP address range: 20.0.0.0 - 20.7.161.31 - - Direction 1 --> 0: - - Source MAC address range: fa:ce:00:00:00:00 - fa:ce:00:07:a1:1f - - Destination MAC address range: ca:fe:00:00:00:00 - ca:fe:00:07:a1:1f - - Source IP address range: 20.0.0.0 - 20.7.161.31 - - Destination IP address range: 10.0.0.0 - 10.7.161.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__() - - self.clients = 500000 - - # MACs used in packet headers. - self.p1_src_start_mac = u"ca:fe:00:00:00:00" # mask: 00:00:FF:FF:FF:FF - self.p1_dst_start_mac = u"fa:ce:00:00:00:00" # mask: 00:00:FF:FF:FF:FF - - self.p2_src_start_mac = u"fa:ce:00:00:00:00" # mask: 00:00:FF:FF:FF:FF - self.p2_dst_start_mac = u"ca:fe:00:00:00:00" # mask: 00:00:FF:FF:FF:FF - - # IPs used in packet headers. - self.p1_src_start_ip = u"10.0.0.0" - self.p1_src_end_ip = u"10.7.161.31" - - self.p1_dst_start_ip = u"20.0.0.0" - self.p1_dst_end_ip = u"20.7.161.31" - - self.p2_src_start_ip = u"20.0.0.0" - self.p2_src_end_ip = u"20.7.161.31" - - self.p2_dst_start_ip = u"10.0.0.0" - self.p2_dst_end_ip = u"10.7.161.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( - src=self.p1_src_start_mac, - dst=self.p1_dst_start_mac - ) / - IP( - src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61 - ) - ) - # Direction 1 --> 0 - base_pkt_b = ( - Ether( - src=self.p2_src_start_mac, - dst=self.p2_dst_start_mac - ) / - IP( - src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_src", - min_value=0, - max_value=self.clients-1, - size=4, - op=u"inc" - ), - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=self.clients-1, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_src", - pkt_offset= 8 - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset= 2 - ), - STLVmFlowVar( - name=u"ip_src", - min_value=self.p1_src_start_ip, - max_value=self.p1_src_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"ip_src", - pkt_offset=u"IP.src" - ), - STLVmFlowVar( - name=u"ip_dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"ip_dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_src", - min_value=0, - max_value=self.clients-1, - size=4, - op=u"inc" - ), - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=self.clients-1, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_src", - pkt_offset= 8 - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset= 2 - ), - STLVmFlowVar( - name=u"ip_src", - min_value=self.p2_src_start_ip, - max_value=self.p2_src_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"ip_src", - pkt_offset=u"IP.src" - ), - STLVmFlowVar( - name=u"ip_dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"ip_dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"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-2n-ethip4-macsrc50kdst50k.py b/resources/traffic_profiles/trex/trex-sl-2n-ethip4-macsrc50kdst50k.py deleted file mode 100644 index 42e3db6a6f..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-2n-ethip4-macsrc50kdst50k.py +++ /dev/null @@ -1,214 +0,0 @@ -# Copyright (c) 2020 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 MAC address range: ca:fe:00:00:00:00 - ca:fe:00:00:c3:4f - - Destination MAC address range: fa:ce:00:00:00:00 - fa:ce:00:00:c3:4f - - Source IP address range: 10.0.0.0 - 10.0.195.79 - - Destination IP address range: 20.0.0.0 - 20.0.195.79 - - Direction 1 --> 0: - - Source MAC address range: fa:ce:00:00:00:00 - fa:ce:00:00:c3:4f - - Destination MAC address range: ca:fe:00:00:00:00 - ca:fe:00:00:c3:4f - - Source IP address range: 20.0.0.0 - 20.0.195.79 - - Destination IP address range: 10.0.0.0 - 10.0.195.79 -""" - -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__() - - self.clients = 50000 - - # MACs used in packet headers. - self.p1_src_start_mac = u"ca:fe:00:00:00:00" # mask: 00:00:FF:FF:FF:FF - self.p1_dst_start_mac = u"fa:ce:00:00:00:00" # mask: 00:00:FF:FF:FF:FF - - self.p2_src_start_mac = u"fa:ce:00:00:00:00" # mask: 00:00:FF:FF:FF:FF - self.p2_dst_start_mac = u"ca:fe:00:00:00:00" # mask: 00:00:FF:FF:FF:FF - - # IPs used in packet headers. - self.p1_src_start_ip = u"10.0.0.0" - self.p1_src_end_ip = u"10.0.195.79" - - self.p1_dst_start_ip = u"20.0.0.0" - self.p1_dst_end_ip = u"20.0.195.79" - - self.p2_src_start_ip = u"20.0.0.0" - self.p2_src_end_ip = u"20.0.195.79" - - self.p2_dst_start_ip = u"10.0.0.0" - self.p2_dst_end_ip = u"10.0.195.79" - - 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( - src=self.p1_src_start_mac, - dst=self.p1_dst_start_mac - ) / - IP( - src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61 - ) - ) - # Direction 1 --> 0 - base_pkt_b = ( - Ether( - src=self.p2_src_start_mac, - dst=self.p2_dst_start_mac) / - IP( - src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_src", - min_value=0, - max_value=self.clients-1, - size=4, - op=u"inc" - ), - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=self.clients-1, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_src", - pkt_offset= 8 - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset= 2 - ), - STLVmFlowVar( - name=u"ip_src", - min_value=self.p1_src_start_ip, - max_value=self.p1_src_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"ip_src", - pkt_offset=u"IP.src" - ), - STLVmFlowVar( - name=u"ip_dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"ip_dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_src", - min_value=0, - max_value=self.clients-1, - size=4, - op=u"inc" - ), - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=self.clients-1, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_src", - pkt_offset= 8 - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset= 2 - ), - STLVmFlowVar( - name=u"ip_src", - min_value=self.p2_src_start_ip, - max_value=self.p2_src_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"ip_src", - pkt_offset=u"IP.src" - ), - STLVmFlowVar( - name=u"ip_dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"ip_dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"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-2n-ethip4-macsrc5kdst5k.py b/resources/traffic_profiles/trex/trex-sl-2n-ethip4-macsrc5kdst5k.py deleted file mode 100644 index 29df3373d3..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-2n-ethip4-macsrc5kdst5k.py +++ /dev/null @@ -1,215 +0,0 @@ -# Copyright (c) 2020 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 MAC address range: ca:fe:00:00:00:00 - ca:fe:00:00:13:87 - - Destination MAC address range: fa:ce:00:00:00:00 - fa:ce:00:00:13:87 - - Source IP address range: 10.0.0.0 - 10.0.19.135 - - Destination IP address range: 20.0.0.0 - 20.0.19.135 - - Direction 1 --> 0: - - Source MAC address range: fa:ce:00:00:00:00 - fa:ce:00:00:13:87 - - Destination MAC address range: ca:fe:00:00:00:00 - ca:fe:00:00:13:87 - - Source IP address range: 20.0.0.0 - 20.0.19.135 - - Destination IP address range: 10.0.0.0 - 10.0.19.135 -""" - -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__() - - self.clients = 5000 - - # MACs used in packet headers. - self.p1_src_start_mac = u"ca:fe:00:00:00:00" # mask: 00:00:FF:FF:FF:FF - self.p1_dst_start_mac = u"fa:ce:00:00:00:00" # mask: 00:00:FF:FF:FF:FF - - self.p2_src_start_mac = u"fa:ce:00:00:00:00" # mask: 00:00:FF:FF:FF:FF - self.p2_dst_start_mac = u"ca:fe:00:00:00:00" # mask: 00:00:FF:FF:FF:FF - - # IPs used in packet headers. - self.p1_src_start_ip = u"10.0.0.0" - self.p1_src_end_ip = u"10.0.19.135" - - self.p1_dst_start_ip = u"20.0.0.0" - self.p1_dst_end_ip = u"20.0.19.135" - - self.p2_src_start_ip = u"20.0.0.0" - self.p2_src_end_ip = u"20.0.19.135" - - self.p2_dst_start_ip = u"10.0.0.0" - self.p2_dst_end_ip = u"10.0.19.135" - - 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( - src=self.p1_src_start_mac, - dst=self.p1_dst_start_mac - ) / - IP( - src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61 - ) - ) - # Direction 1 --> 0 - base_pkt_b = ( - Ether( - src=self.p2_src_start_mac, - dst=self.p2_dst_start_mac - ) / - IP( - src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_src", - min_value=0, - max_value=self.clients-1, - size=4, - op=u"inc" - ), - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=self.clients-1, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_src", - pkt_offset= 8 - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset= 2 - ), - STLVmFlowVar( - name=u"ip_src", - min_value=self.p1_src_start_ip, - max_value=self.p1_src_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"ip_src", - pkt_offset=u"IP.src" - ), - STLVmFlowVar( - name=u"ip_dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"ip_dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_src", - min_value=0, - max_value=self.clients-1, - size=4, - op=u"inc" - ), - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=self.clients-1, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_src", - pkt_offset= 8 - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset= 2 - ), - STLVmFlowVar( - name=u"ip_src", - min_value=self.p2_src_start_ip, - max_value=self.p2_src_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"ip_src", - pkt_offset=u"IP.src" - ), - STLVmFlowVar( - name=u"ip_dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"ip_dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"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-2n-ethip4udp-1000u15p.py b/resources/traffic_profiles/trex/trex-sl-2n-ethip4udp-1000u15p.py deleted file mode 100644 index 64fe1a705f..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-2n-ethip4udp-1000u15p.py +++ /dev/null @@ -1,146 +0,0 @@ -# Copyright (c) 2020 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.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 = u"20.0.0.0" - self.p1_src_end_ip = u"20.0.3.231" - self.p1_dst_start_ip = u"12.0.0.2" - - self.p2_src_start_ip = u"12.0.0.2" - self.p2_src_end_ip = u"12.0.0.2" - self.p2_dst_start_ip = u"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=u"tuple" - ), - STLVmWrFlowVar( - fv_name=u"tuple.ip", - pkt_offset=u"IP.src" - ), - STLVmFixIpv4(offset=u"IP"), - STLVmWrFlowVar( - fv_name=u"tuple.port", - pkt_offset=u"UDP.sport" - ) - ] - ) - # Direction 0 --> 1 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"dport", - min_value=self.p2_dst_start_udp_port, - max_value=self.p2_dst_end_udp_port, - size=2, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dport", - pkt_offset=u"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/traffic_profiles/trex/trex-sl-2n-ethip4udp-10u1000p-conc.py b/resources/traffic_profiles/trex/trex-sl-2n-ethip4udp-10u1000p-conc.py deleted file mode 100644 index 77f05f8af3..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-2n-ethip4udp-10u1000p-conc.py +++ /dev/null @@ -1,189 +0,0 @@ -# Copyright (c) 2020 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: 10.10.10.2 - 10.10.10.11 - - Destination IP address range: 20.20.20.2 - 20.20.20.11 - - Source UDP port range: 1001 - 2000 - - Destination UDP port range: 2001 - 3000 - - Direction 1 --> 0: - - Source IP address range: 20.20.20.2 - 20.20.20.11 - - Destination IP address range: 10.10.10.2 - 10.10.10.11 - - Source UDP port range: 2001 - 3000 - - Destination UDP port range: 1001 - 2000 -""" - -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 = u"10.10.10.2" - self.p1_src_end_ip = u"10.10.10.11" - self.p1_dst_start_ip = u"20.20.20.2" - self.p1_dst_end_ip = u"20.20.20.11" - - self.p2_src_start_ip = u"20.20.20.2" - self.p2_src_end_ip = u"20.20.20.11" - self.p2_dst_start_ip = u"10.10.10.2" - self.p2_dst_end_ip = u"10.10.10.11" - - # UDP ports used in packet headers. - self.p1_src_start_udp_port = 1001 - self.p1_src_end_udp_port = 2000 - self.p1_dst_start_udp_port = 2001 - self.p1_dst_end_udp_port = 3000 - - self.p2_src_start_udp_port = 2001 - self.p2_src_end_udp_port = 3000 - self.p2_dst_start_udp_port = 1001 - self.p2_dst_end_udp_port = 2000 - - 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=u"tuple1_src" - ), - STLVmTupleGen( - ip_min=self.p1_dst_start_ip, - ip_max=self.p1_dst_end_ip, - port_min=self.p1_dst_start_udp_port, - port_max=self.p1_dst_end_udp_port, - name=u"tuple1_dst" - ), - STLVmWrFlowVar( - fv_name=u"tuple1_src.ip", - pkt_offset=u"IP.src" - ), - STLVmWrFlowVar( - fv_name=u"tuple1_dst.ip", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ), - STLVmWrFlowVar( - fv_name=u"tuple1_src.port", - pkt_offset=u"UDP.sport" - ), - STLVmWrFlowVar( - fv_name=u"tuple1_dst.port", - pkt_offset=u"UDP.dport" - ) - ] - ) - # Direction 0 --> 1 - vm2 = STLScVmRaw( - [ - STLVmTupleGen( - ip_min=self.p2_src_start_ip, - ip_max=self.p2_src_end_ip, - port_min=self.p2_src_start_udp_port, - port_max=self.p2_src_end_udp_port, - name=u"tuple2_src" - ), - STLVmTupleGen( - ip_min=self.p2_dst_start_ip, - ip_max=self.p2_dst_end_ip, - port_min=self.p2_dst_start_udp_port, - port_max=self.p2_dst_end_udp_port, - name=u"tuple2_dst" - ), - STLVmWrFlowVar( - fv_name=u"tuple2_src.ip", - pkt_offset=u"IP.src" - ), - STLVmWrFlowVar( - fv_name=u"tuple2_dst.ip", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ), - STLVmWrFlowVar( - fv_name=u"tuple2_src.port", - pkt_offset=u"UDP.sport" - ), - STLVmWrFlowVar( - fv_name=u"tuple2_dst.port", - pkt_offset=u"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/traffic_profiles/trex/trex-sl-2n-ethip4udp-1u1p.py b/resources/traffic_profiles/trex/trex-sl-2n-ethip4udp-1u1p.py deleted file mode 100644 index a892ec8822..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-2n-ethip4udp-1u1p.py +++ /dev/null @@ -1,104 +0,0 @@ -# Copyright (c) 2020 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.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 = u"20.0.0.0" - self.p1_dst_ip = u"12.0.0.2" - - self.p2_src_ip = u"12.0.0.2" - self.p2_dst_ip = u"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/traffic_profiles/trex/trex-sl-2n-ethip4udp-lb.py b/resources/traffic_profiles/trex/trex-sl-2n-ethip4udp-lb.py deleted file mode 100644 index df05cbff17..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-2n-ethip4udp-lb.py +++ /dev/null @@ -1,150 +0,0 @@ -# Copyright (c) 2020 Intel 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: - - Packet: ETH / IP / UDP - - Direction 0 --> 1: - - Source IP address range: 192.168.50.74 - 192.168.50.79 - - Destination IP address range: 90.1.2.1 - - Direction 1 --> 0: - - Source IP address range: 192.168.60.74 - 192.168.60.79 - - Destination IP address range: 192.168.50.74 - 192.168.50.79 -""" - -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 = u"192.168.50.74" - self.p1_src_end_ip = u"192.168.50.79" - self.p1_dst_start_ip = u"90.1.2.1" - - self.p2_src_start_ip = u"192.168.60.74" - self.p2_src_end_ip = u"192.168.60.79" - self.p2_dst_start_ip = u"192.168.50.74" - self.p2_dst_end_ip = u"192.168.50.79" - - # UDP ports used in packet headers. - self.p1_src_udp_port = 63 - self.p1_dst_udp_port = 20000 - - self.p2_src_udp_port = 3307 - self.p2_dst_udp_port = 63 - - 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_udp_port, - dport=self.p1_dst_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_udp_port, - dport=self.p2_dst_udp_port - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"src", - min_value=self.p1_src_start_ip, - max_value=self.p1_src_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"src", - pkt_offset=u"IP.src" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"src", - min_value=self.p2_src_start_ip, - max_value=self.p2_src_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"src", - pkt_offset=u"IP.src" - ), - STLVmFlowVar( - name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"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-2n-ethip6-ip6dst10000.py b/resources/traffic_profiles/trex/trex-sl-2n-ethip6-ip6dst10000.py deleted file mode 100644 index f1b90350fb..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-2n-ethip6-ip6dst10000.py +++ /dev/null @@ -1,129 +0,0 @@ -# Copyright (c) 2020 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.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 = u"2001:1::1" - self.p1_dst_start_ip = u"2001:2::0" - self.p1_dst_end_ip = u"2001:2::270F" - - self.p2_src_start_ip = u"2001:2::1" - self.p2_dst_start_ip = u"2001:1::0" - self.p2_dst_end_ip = u"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=u"ipv6_dst", - min_value=base_p1, - max_value=base_p1 + count_p1, - size=8, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"ipv6_dst", - pkt_offset=u"IPv6.dst", - offset_fixup=8 - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"ipv6_dst", - min_value=base_p2, - max_value=base_p2 + count_p2, - size=8, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"ipv6_dst", - pkt_offset=u"IPv6.dst", - offset_fixup=8 - ) - ] - ) - - 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-2n-ethip6-ip6dst100000.py b/resources/traffic_profiles/trex/trex-sl-2n-ethip6-ip6dst100000.py deleted file mode 100644 index 87e76726b2..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-2n-ethip6-ip6dst100000.py +++ /dev/null @@ -1,129 +0,0 @@ -# Copyright (c) 2020 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.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 = u"2001:1::1" - self.p1_dst_start_ip = u"2001:2::0" - self.p1_dst_end_ip = u"2001:2::1:869F" - - self.p2_src_start_ip = u"2001:2::1" - self.p2_dst_start_ip = u"2001:1::0" - self.p2_dst_end_ip = u"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=u"ipv6_dst", - min_value=base_p1, - max_value=base_p1 + count_p1, - size=8, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"ipv6_dst", - pkt_offset=u"IPv6.dst", - offset_fixup=8 - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"ipv6_dst", - min_value=base_p2, - max_value=base_p2 + count_p2, - size=8, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"ipv6_dst", - pkt_offset=u"IPv6.dst", - offset_fixup=8 - ) - ] - ) - - 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-2n-ethip6-ip6dst1000000.py b/resources/traffic_profiles/trex/trex-sl-2n-ethip6-ip6dst1000000.py deleted file mode 100644 index 9214b6239d..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-2n-ethip6-ip6dst1000000.py +++ /dev/null @@ -1,129 +0,0 @@ -# Copyright (c) 2020 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.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 = u"2001:1::1" - self.p1_dst_start_ip = u"2001:2::0" - self.p1_dst_end_ip = u"2001:2::F:423F" - - self.p2_src_start_ip = u"2001:2::1" - self.p2_dst_start_ip = u"2001:1::0" - self.p2_dst_end_ip = u"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=u"ipv6_dst", - min_value=base_p1, - max_value=base_p1 + count_p1, - size=8, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"ipv6_dst", - pkt_offset=u"IPv6.dst", - offset_fixup=8 - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"ipv6_dst", - min_value=base_p2, - max_value=base_p2 + count_p2, - size=8, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"ipv6_dst", - pkt_offset=u"IPv6.dst", - offset_fixup=8 - ) - ] - ) - - 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-2n-ethip6-ip6src253.py b/resources/traffic_profiles/trex/trex-sl-2n-ethip6-ip6src253.py deleted file mode 100644 index 7ac5f75bed..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-2n-ethip6-ip6src253.py +++ /dev/null @@ -1,129 +0,0 @@ -# Copyright (c) 2020 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.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 = u"2001:1::2" - self.p1_src_end_ip = u"2001:1::FE" - self.p1_dst_start_ip = u"2001:2::2" - - self.p2_src_start_ip = u"2001:2::2" - self.p2_src_end_ip = u"2001:2::FE" - self.p2_dst_start_ip = u"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=u"ipv6_src", - min_value=base_p1, - max_value=base_p1 + count_p1, - size=8, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"ipv6_src", - pkt_offset=u"IPv6.src", - offset_fixup=8 - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"ipv6_src", - min_value=base_p2, - max_value=base_p2 + count_p2, - size=8, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"ipv6_src", - pkt_offset=u"IPv6.src", - offset_fixup=8 - ) - ] - ) - - 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-2n3n-ethip4-ip4src254-10c1n.py b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-10c1n.py deleted file mode 100644 index 3707ec6b9a..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-10c1n.py +++ /dev/null @@ -1,163 +0,0 @@ -# Copyright (c) 2020 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: - - Destination MAC address: 52:54:00:00:nf_id:01 - - Source IP address range: 10.10.10.1 - 10.10.10.254 - - Destination IP address range: 20.20.20.1 - - Direction 1 --> 0: - - Destination MAC address: 52:54:00:00:nf_id:02 - - Source IP address range: 20.20.20.1 - 20.20.20.254 - - Destination IP address range: 10.10.10.1 -""" - -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__() - - # Service density parameters. - self.nf_chains = 10 - self.nf_nodes = 1 - - # MACs used in packet headers. - self.p1_dst_start_mac = u"52:54:00:00:00:01" - self.p2_dst_start_mac = u"52:54:00:00:00:02" - - # IPs used in packet headers. - self.p1_src_start_ip = u"10.10.10.1" - self.p1_src_end_ip = u"10.10.10.254" - self.p1_dst_start_ip = u"20.20.20.1" - - self.p2_src_start_ip = u"20.20.20.1" - self.p2_src_end_ip = u"20.20.20.254" - self.p2_dst_start_ip = u"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( - dst=self.p1_dst_start_mac - ) / - IP( - src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61 - ) - ) - # Direction 1 --> 0 - base_pkt_b = ( - Ether( - dst=self.p2_dst_start_mac - ) / - IP( - src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=1, - max_value=self.nf_chains*self.nf_nodes, - size=1, - step=self.nf_nodes, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=4 - ), - STLVmFlowVar( - name=u"src", - min_value=self.p1_src_start_ip, - max_value=self.p1_src_end_ip, - size=4, op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"src", - pkt_offset=u"IP.src" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=self.nf_nodes, - max_value=self.nf_chains*self.nf_nodes, - size=1, - step=self.nf_nodes, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=4 - ), - STLVmFlowVar( - name=u"src", - min_value=self.p2_src_start_ip, - max_value=self.p2_src_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"src", - pkt_offset=u"IP.src" - ), - STLVmFixIpv4( - offset=u"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-2n3n-ethip4-ip4src254-10c2n.py b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-10c2n.py deleted file mode 100644 index 52396c3723..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-10c2n.py +++ /dev/null @@ -1,164 +0,0 @@ -# Copyright (c) 2020 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: - - Destination MAC address: 52:54:00:00:nf_id:01 - - Source IP address range: 10.10.10.1 - 10.10.10.254 - - Destination IP address range: 20.20.20.1 - - Direction 1 --> 0: - - Destination MAC address: 52:54:00:00:nf_id:02 - - Source IP address range: 20.20.20.1 - 20.20.20.254 - - Destination IP address range: 10.10.10.1 -""" - -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__() - - # Service density parameters. - self.nf_chains = 10 - self.nf_nodes = 2 - - # MACs used in packet headers. - self.p1_dst_start_mac = u'52:54:00:00:00:01' - self.p2_dst_start_mac = u'52:54:00:00:00:02' - - # IPs used in packet headers. - self.p1_src_start_ip = u'10.10.10.1' - self.p1_src_end_ip = u'10.10.10.254' - self.p1_dst_start_ip = u'20.20.20.1' - - self.p2_src_start_ip = u'20.20.20.1' - self.p2_src_end_ip = u'20.20.20.254' - self.p2_dst_start_ip = u'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( - dst=self.p1_dst_start_mac - ) / - IP( - src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61 - ) - ) - # Direction 1 --> 0 - base_pkt_b = ( - Ether( - dst=self.p2_dst_start_mac - ) / - IP( - src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=1, - max_value=self.nf_chains*self.nf_nodes, - size=1, - step=self.nf_nodes, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=4 - ), - STLVmFlowVar( - name=u"src", - min_value=self.p1_src_start_ip, - max_value=self.p1_src_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"src", - pkt_offset=u"IP.src" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=self.nf_nodes, - max_value=self.nf_chains*self.nf_nodes, - size=1, - step=self.nf_nodes, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=4 - ), - STLVmFlowVar( - name=u"src", - min_value=self.p2_src_start_ip, - max_value=self.p2_src_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"src", - pkt_offset=u"IP.src" - ), - STLVmFixIpv4( - offset=u"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-2n3n-ethip4-ip4src254-1c10n.py b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-1c10n.py deleted file mode 100644 index 8d29f86b49..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-1c10n.py +++ /dev/null @@ -1,164 +0,0 @@ -# Copyright (c) 2020 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: - - Destination MAC address: 52:54:00:00:nf_id:01 - - Source IP address range: 10.10.10.1 - 10.10.10.254 - - Destination IP address range: 20.20.20.1 - - Direction 1 --> 0: - - Destination MAC address: 52:54:00:00:nf_id:02 - - Source IP address range: 20.20.20.1 - 20.20.20.254 - - Destination IP address range: 10.10.10.1 -""" - -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__() - - # Service density parameters. - self.nf_chains = 1 - self.nf_nodes = 10 - - # MACs used in packet headers. - self.p1_dst_start_mac = u"52:54:00:00:00:01" - self.p2_dst_start_mac = u"52:54:00:00:00:02" - - # IPs used in packet headers. - self.p1_src_start_ip = u"10.10.10.1" - self.p1_src_end_ip = u"10.10.10.254" - self.p1_dst_start_ip = u"20.20.20.1" - - self.p2_src_start_ip = u"20.20.20.1" - self.p2_src_end_ip = u"20.20.20.254" - self.p2_dst_start_ip = u"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( - dst=self.p1_dst_start_mac - ) / - IP( - src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61 - ) - ) - # Direction 1 --> 0 - base_pkt_b = ( - Ether( - dst=self.p2_dst_start_mac - ) / - IP( - src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=1, - max_value=self.nf_chains*self.nf_nodes, - size=1, - step=self.nf_nodes, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=4 - ), - STLVmFlowVar( - name=u"src", - min_value=self.p1_src_start_ip, - max_value=self.p1_src_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"src", - pkt_offset=u"IP.src" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=self.nf_nodes, - max_value=self.nf_chains*self.nf_nodes, - size=1, - step=self.nf_nodes, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=4 - ), - STLVmFlowVar( - name=u"src", - min_value=self.p2_src_start_ip, - max_value=self.p2_src_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"src", - pkt_offset=u"IP.src" - ), - STLVmFixIpv4( - offset=u"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-2n3n-ethip4-ip4src254-1c1n.py b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-1c1n.py deleted file mode 100644 index f50e2e6c1d..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-1c1n.py +++ /dev/null @@ -1,166 +0,0 @@ -# Copyright (c) 2020 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: - - Destination MAC address: 52:54:00:00:nf_id:01 - - Source IP address range: 10.10.10.1 - 10.10.10.254 - - Destination IP address range: 20.20.20.1 - - Direction 1 --> 0: - - Destination MAC address: 52:54:00:00:nf_id:02 - - Source IP address range: 20.20.20.1 - 20.20.20.254 - - Destination IP address range: 10.10.10.1 -""" - -from re import finditer - -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__() - - # Service density parameters. - self.nf_chains = 1 - self.nf_nodes = 1 - - # MACs used in packet headers. - self.p1_dst_start_mac = u"52:54:00:00:00:01" - self.p2_dst_start_mac = u"52:54:00:00:00:02" - - # IPs used in packet headers. - self.p1_src_start_ip = u"10.10.10.1" - self.p1_src_end_ip = u"10.10.10.254" - self.p1_dst_start_ip = u"20.20.20.1" - - self.p2_src_start_ip = u"20.20.20.1" - self.p2_src_end_ip = u"20.20.20.254" - self.p2_dst_start_ip = u"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( - dst=self.p1_dst_start_mac - ) / - IP( - src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61 - ) - ) - # Direction 1 --> 0 - base_pkt_b = ( - Ether( - dst=self.p2_dst_start_mac - ) / - IP( - src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=1, - max_value=self.nf_chains*self.nf_nodes, - size=1, - step=self.nf_nodes, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=4 - ), - STLVmFlowVar( - name=u"src", - min_value=self.p1_src_start_ip, - max_value=self.p1_src_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"src", - pkt_offset=u"IP.src" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=self.nf_nodes, - max_value=self.nf_chains*self.nf_nodes, - size=1, - step=self.nf_nodes, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=4 - ), - STLVmFlowVar( - name=u"src", - min_value=self.p2_src_start_ip, - max_value=self.p2_src_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"src", - pkt_offset=u"IP.src" - ), - STLVmFixIpv4( - offset=u"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-2n3n-ethip4-ip4src254-1c2n.py b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-1c2n.py deleted file mode 100644 index 1923f72504..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-1c2n.py +++ /dev/null @@ -1,164 +0,0 @@ -# Copyright (c) 2020 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: - - Destination MAC address: 52:54:00:00:nf_id:01 - - Source IP address range: 10.10.10.1 - 10.10.10.254 - - Destination IP address range: 20.20.20.1 - - Direction 1 --> 0: - - Destination MAC address: 52:54:00:00:nf_id:02 - - Source IP address range: 20.20.20.1 - 20.20.20.254 - - Destination IP address range: 10.10.10.1 -""" - -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__() - - # Service density parameters. - self.nf_chains = 1 - self.nf_nodes = 2 - - # MACs used in packet headers. - self.p1_dst_start_mac = u"52:54:00:00:00:01" - self.p2_dst_start_mac = u"52:54:00:00:00:02" - - # IPs used in packet headers. - self.p1_src_start_ip = u"10.10.10.1" - self.p1_src_end_ip = u"10.10.10.254" - self.p1_dst_start_ip = u"20.20.20.1" - - self.p2_src_start_ip = u"20.20.20.1" - self.p2_src_end_ip = u"20.20.20.254" - self.p2_dst_start_ip = u"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( - dst=self.p1_dst_start_mac - ) / - IP( - src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61 - ) - ) - # Direction 1 --> 0 - base_pkt_b = ( - Ether( - dst=self.p2_dst_start_mac - ) / - IP( - src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=1, - max_value=self.nf_chains*self.nf_nodes, - size=1, - step=self.nf_nodes, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=4 - ), - STLVmFlowVar( - name=u"src", - min_value=self.p1_src_start_ip, - max_value=self.p1_src_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"src", - pkt_offset=u"IP.src" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=self.nf_nodes, - max_value=self.nf_chains*self.nf_nodes, - size=1, - step=self.nf_nodes, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=4 - ), - STLVmFlowVar( - name=u"src", - min_value=self.p2_src_start_ip, - max_value=self.p2_src_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"src", - pkt_offset=u"IP.src" - ), - STLVmFixIpv4( - offset=u"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-2n3n-ethip4-ip4src254-1c4n.py b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-1c4n.py deleted file mode 100644 index a1e55c5253..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-1c4n.py +++ /dev/null @@ -1,164 +0,0 @@ -# Copyright (c) 2020 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: - - Destination MAC address: 52:54:00:00:nf_id:01 - - Source IP address range: 10.10.10.1 - 10.10.10.254 - - Destination IP address range: 20.20.20.1 - - Direction 1 --> 0: - - Destination MAC address: 52:54:00:00:nf_id:02 - - Source IP address range: 20.20.20.1 - 20.20.20.254 - - Destination IP address range: 10.10.10.1 -""" - -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__() - - # Service density parameters. - self.nf_chains = 1 - self.nf_nodes = 4 - - # MACs used in packet headers. - self.p1_dst_start_mac = u"52:54:00:00:00:01" - self.p2_dst_start_mac = u"52:54:00:00:00:02" - - # IPs used in packet headers. - self.p1_src_start_ip = u"10.10.10.1" - self.p1_src_end_ip = u"10.10.10.254" - self.p1_dst_start_ip = u"20.20.20.1" - - self.p2_src_start_ip = u"20.20.20.1" - self.p2_src_end_ip = u"20.20.20.254" - self.p2_dst_start_ip = u"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( - dst=self.p1_dst_start_mac - ) / - IP( - src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61 - ) - ) - # Direction 1 --> 0 - base_pkt_b = ( - Ether( - dst=self.p2_dst_start_mac - ) / - IP( - src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=1, - max_value=self.nf_chains*self.nf_nodes, - size=1, - step=self.nf_nodes, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=4 - ), - STLVmFlowVar( - name=u"src", - min_value=self.p1_src_start_ip, - max_value=self.p1_src_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"src", - pkt_offset=u"IP.src" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=self.nf_nodes, - max_value=self.nf_chains*self.nf_nodes, - size=1, - step=self.nf_nodes, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=4 - ), - STLVmFlowVar( - name=u"src", - min_value=self.p2_src_start_ip, - max_value=self.p2_src_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"src", - pkt_offset=u"IP.src" - ), - STLVmFixIpv4( - offset=u"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-2n3n-ethip4-ip4src254-1c6n.py b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-1c6n.py deleted file mode 100644 index ffc8b428ef..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-1c6n.py +++ /dev/null @@ -1,164 +0,0 @@ -# Copyright (c) 2020 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: - - Destination MAC address: 52:54:00:00:nf_id:01 - - Source IP address range: 10.10.10.1 - 10.10.10.254 - - Destination IP address range: 20.20.20.1 - - Direction 1 --> 0: - - Destination MAC address: 52:54:00:00:nf_id:02 - - Source IP address range: 20.20.20.1 - 20.20.20.254 - - Destination IP address range: 10.10.10.1 -""" - -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__() - - # Service density parameters. - self.nf_chains = 1 - self.nf_nodes = 6 - - # MACs used in packet headers. - self.p1_dst_start_mac = u"52:54:00:00:00:01" - self.p2_dst_start_mac = u"52:54:00:00:00:02" - - # IPs used in packet headers. - self.p1_src_start_ip = u"10.10.10.1" - self.p1_src_end_ip = u"10.10.10.254" - self.p1_dst_start_ip = u"20.20.20.1" - - self.p2_src_start_ip = u"20.20.20.1" - self.p2_src_end_ip = u"20.20.20.254" - self.p2_dst_start_ip = u"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( - dst=self.p1_dst_start_mac - ) / - IP( - src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61 - ) - ) - # Direction 1 --> 0 - base_pkt_b = ( - Ether( - dst=self.p2_dst_start_mac - ) / - IP( - src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=1, - max_value=self.nf_chains*self.nf_nodes, - size=1, - step=self.nf_nodes, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=4 - ), - STLVmFlowVar( - name=u"src", - min_value=self.p1_src_start_ip, - max_value=self.p1_src_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"src", - pkt_offset=u"IP.src" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=self.nf_nodes, - max_value=self.nf_chains*self.nf_nodes, - size=1, - step=self.nf_nodes, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=4 - ), - STLVmFlowVar( - name=u"src", - min_value=self.p2_src_start_ip, - max_value=self.p2_src_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"src", - pkt_offset=u"IP.src" - ), - STLVmFixIpv4( - offset=u"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-2n3n-ethip4-ip4src254-1c8n.py b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-1c8n.py deleted file mode 100644 index 952859b31d..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-1c8n.py +++ /dev/null @@ -1,164 +0,0 @@ -# Copyright (c) 2020 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: - - Destination MAC address: 52:54:00:00:nf_id:01 - - Source IP address range: 10.10.10.1 - 10.10.10.254 - - Destination IP address range: 20.20.20.1 - - Direction 1 --> 0: - - Destination MAC address: 52:54:00:00:nf_id:02 - - Source IP address range: 20.20.20.1 - 20.20.20.254 - - Destination IP address range: 10.10.10.1 -""" - -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__() - - # Service density parameters. - self.nf_chains = 1 - self.nf_nodes = 8 - - # MACs used in packet headers. - self.p1_dst_start_mac = u"52:54:00:00:00:01" - self.p2_dst_start_mac = u"52:54:00:00:00:02" - - # IPs used in packet headers. - self.p1_src_start_ip = u"10.10.10.1" - self.p1_src_end_ip = u"10.10.10.254" - self.p1_dst_start_ip = u"20.20.20.1" - - self.p2_src_start_ip = u"20.20.20.1" - self.p2_src_end_ip = u"20.20.20.254" - self.p2_dst_start_ip = u"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( - dst=self.p1_dst_start_mac - ) / - IP( - src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61 - ) - ) - # Direction 1 --> 0 - base_pkt_b = ( - Ether( - dst=self.p2_dst_start_mac - ) / - IP( - src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=1, - max_value=self.nf_chains*self.nf_nodes, - size=1, - step=self.nf_nodes, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=4 - ), - STLVmFlowVar( - name=u"src", - min_value=self.p1_src_start_ip, - max_value=self.p1_src_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"src", - pkt_offset=u"IP.src" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=self.nf_nodes, - max_value=self.nf_chains*self.nf_nodes, - size=1, - step=self.nf_nodes, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=4 - ), - STLVmFlowVar( - name=u"src", - min_value=self.p2_src_start_ip, - max_value=self.p2_src_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"src", - pkt_offset=u"IP.src" - ), - STLVmFixIpv4( - offset=u"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-2n3n-ethip4-ip4src254-2c10n.py b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-2c10n.py deleted file mode 100644 index 84440af422..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-2c10n.py +++ /dev/null @@ -1,164 +0,0 @@ -# Copyright (c) 2020 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: - - Destination MAC address: 52:54:00:00:nf_id:01 - - Source IP address range: 10.10.10.1 - 10.10.10.254 - - Destination IP address range: 20.20.20.1 - - Direction 1 --> 0: - - Destination MAC address: 52:54:00:00:nf_id:02 - - Source IP address range: 20.20.20.1 - 20.20.20.254 - - Destination IP address range: 10.10.10.1 -""" - -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__() - - # Service density parameters. - self.nf_chains = 2 - self.nf_nodes = 10 - - # MACs used in packet headers. - self.p1_dst_start_mac = u"52:54:00:00:00:01" - self.p2_dst_start_mac = u"52:54:00:00:00:02" - - # IPs used in packet headers. - self.p1_src_start_ip = u"10.10.10.1" - self.p1_src_end_ip = u"10.10.10.254" - self.p1_dst_start_ip = u"20.20.20.1" - - self.p2_src_start_ip = u"20.20.20.1" - self.p2_src_end_ip = u"20.20.20.254" - self.p2_dst_start_ip = u"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( - dst=self.p1_dst_start_mac - ) / - IP( - src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61 - ) - ) - # Direction 1 --> 0 - base_pkt_b = ( - Ether( - dst=self.p2_dst_start_mac - ) / - IP( - src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=1, - max_value=self.nf_chains*self.nf_nodes, - size=1, - step=self.nf_nodes, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=4 - ), - STLVmFlowVar( - name=u"src", - min_value=self.p1_src_start_ip, - max_value=self.p1_src_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"src", - pkt_offset=u"IP.src" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=self.nf_nodes, - max_value=self.nf_chains*self.nf_nodes, - size=1, - step=self.nf_nodes, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=4 - ), - STLVmFlowVar( - name=u"src", - min_value=self.p2_src_start_ip, - max_value=self.p2_src_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"src", - pkt_offset=u"IP.src" - ), - STLVmFixIpv4( - offset=u"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-2n3n-ethip4-ip4src254-2c1n.py b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-2c1n.py deleted file mode 100644 index 91941769a3..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-2c1n.py +++ /dev/null @@ -1,164 +0,0 @@ -# Copyright (c) 2020 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: - - Destination MAC address: 52:54:00:00:nf_id:01 - - Source IP address range: 10.10.10.1 - 10.10.10.254 - - Destination IP address range: 20.20.20.1 - - Direction 1 --> 0: - - Destination MAC address: 52:54:00:00:nf_id:02 - - Source IP address range: 20.20.20.1 - 20.20.20.254 - - Destination IP address range: 10.10.10.1 -""" - -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__() - - # Service density parameters. - self.nf_chains = 2 - self.nf_nodes = 1 - - # MACs used in packet headers. - self.p1_dst_start_mac = u"52:54:00:00:00:01" - self.p2_dst_start_mac = u"52:54:00:00:00:02" - - # IPs used in packet headers. - self.p1_src_start_ip = u"10.10.10.1" - self.p1_src_end_ip = u"10.10.10.254" - self.p1_dst_start_ip = u"20.20.20.1" - - self.p2_src_start_ip = u"20.20.20.1" - self.p2_src_end_ip = u"20.20.20.254" - self.p2_dst_start_ip = u"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( - dst=self.p1_dst_start_mac - ) / - IP( - src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61 - ) - ) - # Direction 1 --> 0 - base_pkt_b = ( - Ether( - dst=self.p2_dst_start_mac - ) / - IP( - src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=1, - max_value=self.nf_chains*self.nf_nodes, - size=1, - step=self.nf_nodes, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=4 - ), - STLVmFlowVar( - name=u"src", - min_value=self.p1_src_start_ip, - max_value=self.p1_src_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"src", - pkt_offset=u"IP.src" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=self.nf_nodes, - max_value=self.nf_chains*self.nf_nodes, - size=1, - step=self.nf_nodes, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=4 - ), - STLVmFlowVar( - name=u"src", - min_value=self.p2_src_start_ip, - max_value=self.p2_src_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"src", - pkt_offset=u"IP.src" - ), - STLVmFixIpv4( - offset=u"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-2n3n-ethip4-ip4src254-2c2n.py b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-2c2n.py deleted file mode 100644 index d66271f076..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-2c2n.py +++ /dev/null @@ -1,164 +0,0 @@ -# Copyright (c) 2020 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: - - Destination MAC address: 52:54:00:00:nf_id:01 - - Source IP address range: 10.10.10.1 - 10.10.10.254 - - Destination IP address range: 20.20.20.1 - - Direction 1 --> 0: - - Destination MAC address: 52:54:00:00:nf_id:02 - - Source IP address range: 20.20.20.1 - 20.20.20.254 - - Destination IP address range: 10.10.10.1 -""" - -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__() - - # Service density parameters. - self.nf_chains = 2 - self.nf_nodes = 2 - - # MACs used in packet headers. - self.p1_dst_start_mac = u"52:54:00:00:00:01" - self.p2_dst_start_mac = u"52:54:00:00:00:02" - - # IPs used in packet headers. - self.p1_src_start_ip = u"10.10.10.1" - self.p1_src_end_ip = u"10.10.10.254" - self.p1_dst_start_ip = u"20.20.20.1" - - self.p2_src_start_ip = u"20.20.20.1" - self.p2_src_end_ip = u"20.20.20.254" - self.p2_dst_start_ip = u"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( - dst=self.p1_dst_start_mac - ) / - IP( - src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61 - ) - ) - # Direction 1 --> 0 - base_pkt_b = ( - Ether( - dst=self.p2_dst_start_mac - ) / - IP( - src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=1, - max_value=self.nf_chains*self.nf_nodes, - size=1, - step=self.nf_nodes, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=4 - ), - STLVmFlowVar( - name=u"src", - min_value=self.p1_src_start_ip, - max_value=self.p1_src_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"src", - pkt_offset=u"IP.src" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=self.nf_nodes, - max_value=self.nf_chains*self.nf_nodes, - size=1, - step=self.nf_nodes, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=4 - ), - STLVmFlowVar( - name=u"src", - min_value=self.p2_src_start_ip, - max_value=self.p2_src_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"src", - pkt_offset=u"IP.src" - ), - STLVmFixIpv4( - offset=u"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-2n3n-ethip4-ip4src254-2c4n.py b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-2c4n.py deleted file mode 100644 index 7eadae361b..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-2c4n.py +++ /dev/null @@ -1,164 +0,0 @@ -# Copyright (c) 2020 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: - - Destination MAC address: 52:54:00:00:nf_id:01 - - Source IP address range: 10.10.10.1 - 10.10.10.254 - - Destination IP address range: 20.20.20.1 - - Direction 1 --> 0: - - Destination MAC address: 52:54:00:00:nf_id:02 - - Source IP address range: 20.20.20.1 - 20.20.20.254 - - Destination IP address range: 10.10.10.1 -""" - -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__() - - # Service density parameters. - self.nf_chains = 2 - self.nf_nodes = 4 - - # MACs used in packet headers. - self.p1_dst_start_mac = u"52:54:00:00:00:01" - self.p2_dst_start_mac = u"52:54:00:00:00:02" - - # IPs used in packet headers. - self.p1_src_start_ip = u"10.10.10.1" - self.p1_src_end_ip = u"10.10.10.254" - self.p1_dst_start_ip = u"20.20.20.1" - - self.p2_src_start_ip = u"20.20.20.1" - self.p2_src_end_ip = u"20.20.20.254" - self.p2_dst_start_ip = u"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( - dst=self.p1_dst_start_mac - ) / - IP( - src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61 - ) - ) - # Direction 1 --> 0 - base_pkt_b = ( - Ether( - dst=self.p2_dst_start_mac - ) / - IP( - src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=1, - max_value=self.nf_chains*self.nf_nodes, - size=1, - step=self.nf_nodes, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=4 - ), - STLVmFlowVar( - name=u"src", - min_value=self.p1_src_start_ip, - max_value=self.p1_src_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"src", - pkt_offset=u"IP.src" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=self.nf_nodes, - max_value=self.nf_chains*self.nf_nodes, - size=1, - step=self.nf_nodes, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=4 - ), - STLVmFlowVar( - name=u"src", - min_value=self.p2_src_start_ip, - max_value=self.p2_src_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"src", - pkt_offset=u"IP.src" - ), - STLVmFixIpv4( - offset=u"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-2n3n-ethip4-ip4src254-2c6n.py b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-2c6n.py deleted file mode 100644 index 3725f75b3e..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-2c6n.py +++ /dev/null @@ -1,164 +0,0 @@ -# Copyright (c) 2020 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: - - Destination MAC address: 52:54:00:00:nf_id:01 - - Source IP address range: 10.10.10.1 - 10.10.10.254 - - Destination IP address range: 20.20.20.1 - - Direction 1 --> 0: - - Destination MAC address: 52:54:00:00:nf_id:02 - - Source IP address range: 20.20.20.1 - 20.20.20.254 - - Destination IP address range: 10.10.10.1 -""" - -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__() - - # Service density parameters. - self.nf_chains = 2 - self.nf_nodes = 6 - - # MACs used in packet headers. - self.p1_dst_start_mac = u"52:54:00:00:00:01" - self.p2_dst_start_mac = u"52:54:00:00:00:02" - - # IPs used in packet headers. - self.p1_src_start_ip = u"10.10.10.1" - self.p1_src_end_ip = u"10.10.10.254" - self.p1_dst_start_ip = u"20.20.20.1" - - self.p2_src_start_ip = u"20.20.20.1" - self.p2_src_end_ip = u"20.20.20.254" - self.p2_dst_start_ip = u"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( - dst=self.p1_dst_start_mac - ) / - IP( - src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61 - ) - ) - # Direction 1 --> 0 - base_pkt_b = ( - Ether( - dst=self.p2_dst_start_mac - ) / - IP( - src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=1, - max_value=self.nf_chains*self.nf_nodes, - size=1, - step=self.nf_nodes, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=4 - ), - STLVmFlowVar( - name=u"src", - min_value=self.p1_src_start_ip, - max_value=self.p1_src_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"src", - pkt_offset=u"IP.src" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=self.nf_nodes, - max_value=self.nf_chains*self.nf_nodes, - size=1, - step=self.nf_nodes, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=4 - ), - STLVmFlowVar( - name=u"src", - min_value=self.p2_src_start_ip, - max_value=self.p2_src_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"src", - pkt_offset=u"IP.src" - ), - STLVmFixIpv4( - offset=u"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-2n3n-ethip4-ip4src254-2c8n.py b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-2c8n.py deleted file mode 100644 index 024cbc34f3..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-2c8n.py +++ /dev/null @@ -1,164 +0,0 @@ -# Copyright (c) 2020 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: - - Destination MAC address: 52:54:00:00:nf_id:01 - - Source IP address range: 10.10.10.1 - 10.10.10.254 - - Destination IP address range: 20.20.20.1 - - Direction 1 --> 0: - - Destination MAC address: 52:54:00:00:nf_id:02 - - Source IP address range: 20.20.20.1 - 20.20.20.254 - - Destination IP address range: 10.10.10.1 -""" - -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__() - - # Service density parameters. - self.nf_chains = 2 - self.nf_nodes = 8 - - # MACs used in packet headers. - self.p1_dst_start_mac = u"52:54:00:00:00:01" - self.p2_dst_start_mac = u"52:54:00:00:00:02" - - # IPs used in packet headers. - self.p1_src_start_ip = u"10.10.10.1" - self.p1_src_end_ip = u"10.10.10.254" - self.p1_dst_start_ip = u"20.20.20.1" - - self.p2_src_start_ip = u"20.20.20.1" - self.p2_src_end_ip = u"20.20.20.254" - self.p2_dst_start_ip = u"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( - dst=self.p1_dst_start_mac - ) / - IP( - src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61 - ) - ) - # Direction 1 --> 0 - base_pkt_b = ( - Ether( - dst=self.p2_dst_start_mac - ) / - IP( - src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=1, - max_value=self.nf_chains*self.nf_nodes, - size=1, - step=self.nf_nodes, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=4 - ), - STLVmFlowVar( - name=u"src", - min_value=self.p1_src_start_ip, - max_value=self.p1_src_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"src", - pkt_offset=u"IP.src" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=self.nf_nodes, - max_value=self.nf_chains*self.nf_nodes, - size=1, - step=self.nf_nodes, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=4 - ), - STLVmFlowVar( - name=u"src", - min_value=self.p2_src_start_ip, - max_value=self.p2_src_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"src", - pkt_offset=u"IP.src" - ), - STLVmFixIpv4( - offset=u"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-2n3n-ethip4-ip4src254-4c1n.py b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-4c1n.py deleted file mode 100644 index e8c62b9c41..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-4c1n.py +++ /dev/null @@ -1,164 +0,0 @@ -# Copyright (c) 2020 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: - - Destination MAC address: 52:54:00:00:nf_id:01 - - Source IP address range: 10.10.10.1 - 10.10.10.254 - - Destination IP address range: 20.20.20.1 - - Direction 1 --> 0: - - Destination MAC address: 52:54:00:00:nf_id:02 - - Source IP address range: 20.20.20.1 - 20.20.20.254 - - Destination IP address range: 10.10.10.1 -""" - -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__() - - # Service density parameters. - self.nf_chains = 4 - self.nf_nodes = 1 - - # MACs used in packet headers. - self.p1_dst_start_mac = u"52:54:00:00:00:01" - self.p2_dst_start_mac = u"52:54:00:00:00:02" - - # IPs used in packet headers. - self.p1_src_start_ip = u"10.10.10.1" - self.p1_src_end_ip = u"10.10.10.254" - self.p1_dst_start_ip = u"20.20.20.1" - - self.p2_src_start_ip = u"20.20.20.1" - self.p2_src_end_ip = u"20.20.20.254" - self.p2_dst_start_ip = u"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( - dst=self.p1_dst_start_mac - ) / - IP( - src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61 - ) - ) - # Direction 1 --> 0 - base_pkt_b = ( - Ether( - dst=self.p2_dst_start_mac - ) / - IP( - src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=1, - max_value=self.nf_chains*self.nf_nodes, - size=1, - step=self.nf_nodes, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=4 - ), - STLVmFlowVar( - name=u"src", - min_value=self.p1_src_start_ip, - max_value=self.p1_src_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"src", - pkt_offset=u"IP.src" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=self.nf_nodes, - max_value=self.nf_chains*self.nf_nodes, - size=1, - step=self.nf_nodes, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=4 - ), - STLVmFlowVar( - name=u"src", - min_value=self.p2_src_start_ip, - max_value=self.p2_src_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"src", - pkt_offset=u"IP.src" - ), - STLVmFixIpv4( - offset=u"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-2n3n-ethip4-ip4src254-4c2n.py b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-4c2n.py deleted file mode 100644 index a6fbe9ea79..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-4c2n.py +++ /dev/null @@ -1,162 +0,0 @@ -# Copyright (c) 2020 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: - - Destination MAC address: 52:54:00:00:nf_id:01 - - Source IP address range: 10.10.10.1 - 10.10.10.254 - - Destination IP address range: 20.20.20.1 - - Direction 1 --> 0: - - Destination MAC address: 52:54:00:00:nf_id:02 - - Source IP address range: 20.20.20.1 - 20.20.20.254 - - Destination IP address range: 10.10.10.1 -""" - -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__() - - # Service density parameters. - self.nf_chains = 4 - self.nf_nodes = 2 - - # MACs used in packet headers. - self.p1_dst_start_mac = u"52:54:00:00:00:01" - self.p2_dst_start_mac = u"52:54:00:00:00:02" - - # IPs used in packet headers. - self.p1_src_start_ip = u"10.10.10.1" - self.p1_src_end_ip = u"10.10.10.254" - self.p1_dst_start_ip = u"20.20.20.1" - - self.p2_src_start_ip = u"20.20.20.1" - self.p2_src_end_ip = u"20.20.20.254" - self.p2_dst_start_ip = u"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( - dst=self.p1_dst_start_mac - ) / - IP( - src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61 - ) - ) - # Direction 1 --> 0 - base_pkt_b = ( - Ether( - dst=self.p2_dst_start_mac - ) / - IP( - src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=1, - max_value=self.nf_chains*self.nf_nodes, - size=1, step=self.nf_nodes, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=4), - STLVmFlowVar( - name=u"src", - min_value=self.p1_src_start_ip, - max_value=self.p1_src_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"src", - pkt_offset=u"IP.src" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=self.nf_nodes, - max_value=self.nf_chains*self.nf_nodes, - size=1, - step=self.nf_nodes, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=4 - ), - STLVmFlowVar( - name=u"src", - min_value=self.p2_src_start_ip, - max_value=self.p2_src_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"src", - pkt_offset=u"IP.src" - ), - STLVmFixIpv4( - offset=u"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-2n3n-ethip4-ip4src254-4c4n.py b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-4c4n.py deleted file mode 100644 index f1477419c3..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-4c4n.py +++ /dev/null @@ -1,164 +0,0 @@ -# Copyright (c) 2020 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: - - Destination MAC address: 52:54:00:00:nf_id:01 - - Source IP address range: 10.10.10.1 - 10.10.10.254 - - Destination IP address range: 20.20.20.1 - - Direction 1 --> 0: - - Destination MAC address: 52:54:00:00:nf_id:02 - - Source IP address range: 20.20.20.1 - 20.20.20.254 - - Destination IP address range: 10.10.10.1 -""" - -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__() - - # Service density parameters. - self.nf_chains = 4 - self.nf_nodes = 4 - - # MACs used in packet headers. - self.p1_dst_start_mac = u"52:54:00:00:00:01" - self.p2_dst_start_mac = u"52:54:00:00:00:02" - - # IPs used in packet headers. - self.p1_src_start_ip = u"10.10.10.1" - self.p1_src_end_ip = u"10.10.10.254" - self.p1_dst_start_ip = u"20.20.20.1" - - self.p2_src_start_ip = u"20.20.20.1" - self.p2_src_end_ip = u"20.20.20.254" - self.p2_dst_start_ip = u"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( - dst=self.p1_dst_start_mac - ) / - IP( - src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61 - ) - ) - # Direction 1 --> 0 - base_pkt_b = ( - Ether( - dst=self.p2_dst_start_mac - ) / - IP( - src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=1, - max_value=self.nf_chains*self.nf_nodes, - size=1, - step=self.nf_nodes, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=4 - ), - STLVmFlowVar( - name=u"src", - min_value=self.p1_src_start_ip, - max_value=self.p1_src_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"src", - pkt_offset=u"IP.src" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=self.nf_nodes, - max_value=self.nf_chains*self.nf_nodes, - size=1, - step=self.nf_nodes, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=4 - ), - STLVmFlowVar( - name=u"src", - min_value=self.p2_src_start_ip, - max_value=self.p2_src_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"src", - pkt_offset=u"IP.src" - ), - STLVmFixIpv4( - offset=u"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-2n3n-ethip4-ip4src254-4c6n.py b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-4c6n.py deleted file mode 100644 index 7e2b79fdac..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-4c6n.py +++ /dev/null @@ -1,164 +0,0 @@ -# Copyright (c) 2020 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: - - Destination MAC address: 52:54:00:00:nf_id:01 - - Source IP address range: 10.10.10.1 - 10.10.10.254 - - Destination IP address range: 20.20.20.1 - - Direction 1 --> 0: - - Destination MAC address: 52:54:00:00:nf_id:02 - - Source IP address range: 20.20.20.1 - 20.20.20.254 - - Destination IP address range: 10.10.10.1 -""" - -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__() - - # Service density parameters. - self.nf_chains = 4 - self.nf_nodes = 6 - - # MACs used in packet headers. - self.p1_dst_start_mac = u"52:54:00:00:00:01" - self.p2_dst_start_mac = u"52:54:00:00:00:02" - - # IPs used in packet headers. - self.p1_src_start_ip = u"10.10.10.1" - self.p1_src_end_ip = u"10.10.10.254" - self.p1_dst_start_ip = u"20.20.20.1" - - self.p2_src_start_ip = u"20.20.20.1" - self.p2_src_end_ip = u"20.20.20.254" - self.p2_dst_start_ip = u"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( - dst=self.p1_dst_start_mac - ) / - IP( - src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61 - ) - ) - # Direction 1 --> 0 - base_pkt_b = ( - Ether( - dst=self.p2_dst_start_mac - ) / - IP( - src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=1, - max_value=self.nf_chains*self.nf_nodes, - size=1, - step=self.nf_nodes, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=4 - ), - STLVmFlowVar( - name=u"src", - min_value=self.p1_src_start_ip, - max_value=self.p1_src_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"src", - pkt_offset=u"IP.src" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=self.nf_nodes, - max_value=self.nf_chains*self.nf_nodes, - size=1, - step=self.nf_nodes, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=4 - ), - STLVmFlowVar( - name=u"src", - min_value=self.p2_src_start_ip, - max_value=self.p2_src_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"src", - pkt_offset=u"IP.src" - ), - STLVmFixIpv4( - offset=u"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-2n3n-ethip4-ip4src254-6c1n.py b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-6c1n.py deleted file mode 100644 index dc8616c6fe..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-6c1n.py +++ /dev/null @@ -1,164 +0,0 @@ -# Copyright (c) 2020 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: - - Destination MAC address: 52:54:00:00:nf_id:01 - - Source IP address range: 10.10.10.1 - 10.10.10.254 - - Destination IP address range: 20.20.20.1 - - Direction 1 --> 0: - - Destination MAC address: 52:54:00:00:nf_id:02 - - Source IP address range: 20.20.20.1 - 20.20.20.254 - - Destination IP address range: 10.10.10.1 -""" - -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__() - - # Service density parameters. - self.nf_chains = 6 - self.nf_nodes = 1 - - # MACs used in packet headers. - self.p1_dst_start_mac = u"52:54:00:00:00:01" - self.p2_dst_start_mac = u"52:54:00:00:00:02" - - # IPs used in packet headers. - self.p1_src_start_ip = u"10.10.10.1" - self.p1_src_end_ip = u"10.10.10.254" - self.p1_dst_start_ip = u"20.20.20.1" - - self.p2_src_start_ip = u"20.20.20.1" - self.p2_src_end_ip = u"20.20.20.254" - self.p2_dst_start_ip = u"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( - dst=self.p1_dst_start_mac - ) / - IP( - src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61 - ) - ) - # Direction 1 --> 0 - base_pkt_b = ( - Ether( - dst=self.p2_dst_start_mac - ) / - IP( - src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=1, - max_value=self.nf_chains*self.nf_nodes, - size=1, - step=self.nf_nodes, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=4 - ), - STLVmFlowVar( - name=u"src", - min_value=self.p1_src_start_ip, - max_value=self.p1_src_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"src", - pkt_offset=u"IP.src" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=self.nf_nodes, - max_value=self.nf_chains*self.nf_nodes, - size=1, - step=self.nf_nodes, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=4 - ), - STLVmFlowVar( - name=u"src", - min_value=self.p2_src_start_ip, - max_value=self.p2_src_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"src", - pkt_offset=u"IP.src" - ), - STLVmFixIpv4( - offset=u"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-2n3n-ethip4-ip4src254-6c2n.py b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-6c2n.py deleted file mode 100644 index 53a83db70b..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-6c2n.py +++ /dev/null @@ -1,164 +0,0 @@ -# Copyright (c) 2020 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: - - Destination MAC address: 52:54:00:00:nf_id:01 - - Source IP address range: 10.10.10.1 - 10.10.10.254 - - Destination IP address range: 20.20.20.1 - - Direction 1 --> 0: - - Destination MAC address: 52:54:00:00:nf_id:02 - - Source IP address range: 20.20.20.1 - 20.20.20.254 - - Destination IP address range: 10.10.10.1 -""" - -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__() - - # Service density parameters. - self.nf_chains = 6 - self.nf_nodes = 2 - - # MACs used in packet headers. - self.p1_dst_start_mac = u"52:54:00:00:00:01" - self.p2_dst_start_mac = u"52:54:00:00:00:02" - - # IPs used in packet headers. - self.p1_src_start_ip = u"10.10.10.1" - self.p1_src_end_ip = u"10.10.10.254" - self.p1_dst_start_ip = u"20.20.20.1" - - self.p2_src_start_ip = u"20.20.20.1" - self.p2_src_end_ip = u"20.20.20.254" - self.p2_dst_start_ip = u"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( - dst=self.p1_dst_start_mac - ) / - IP( - src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61 - ) - ) - # Direction 1 --> 0 - base_pkt_b = ( - Ether( - dst=self.p2_dst_start_mac - ) / - IP( - src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=1, - max_value=self.nf_chains*self.nf_nodes, - size=1, - step=self.nf_nodes, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=4 - ), - STLVmFlowVar( - name=u"src", - min_value=self.p1_src_start_ip, - max_value=self.p1_src_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"src", - pkt_offset=u"IP.src" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=self.nf_nodes, - max_value=self.nf_chains*self.nf_nodes, - size=1, - step=self.nf_nodes, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=4 - ), - STLVmFlowVar( - name=u"src", - min_value=self.p2_src_start_ip, - max_value=self.p2_src_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"src", - pkt_offset=u"IP.src" - ), - STLVmFixIpv4( - offset=u"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-2n3n-ethip4-ip4src254-6c4n.py b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-6c4n.py deleted file mode 100644 index ac697e60ec..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-6c4n.py +++ /dev/null @@ -1,164 +0,0 @@ -# Copyright (c) 2020 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: - - Destination MAC address: 52:54:00:00:nf_id:01 - - Source IP address range: 10.10.10.1 - 10.10.10.254 - - Destination IP address range: 20.20.20.1 - - Direction 1 --> 0: - - Destination MAC address: 52:54:00:00:nf_id:02 - - Source IP address range: 20.20.20.1 - 20.20.20.254 - - Destination IP address range: 10.10.10.1 -""" - -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__() - - # Service density parameters. - self.nf_chains = 6 - self.nf_nodes = 4 - - # MACs used in packet headers. - self.p1_dst_start_mac = u"52:54:00:00:00:01" - self.p2_dst_start_mac = u"52:54:00:00:00:02" - - # IPs used in packet headers. - self.p1_src_start_ip = u"10.10.10.1" - self.p1_src_end_ip = u"10.10.10.254" - self.p1_dst_start_ip = u"20.20.20.1" - - self.p2_src_start_ip = u"20.20.20.1" - self.p2_src_end_ip = u"20.20.20.254" - self.p2_dst_start_ip = u"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( - dst=self.p1_dst_start_mac - ) / - IP( - src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61 - ) - ) - # Direction 1 --> 0 - base_pkt_b = ( - Ether( - dst=self.p2_dst_start_mac - ) / - IP( - src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=1, - max_value=self.nf_chains*self.nf_nodes, - size=1, - step=self.nf_nodes, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=4 - ), - STLVmFlowVar( - name=u"src", - min_value=self.p1_src_start_ip, - max_value=self.p1_src_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"src", - pkt_offset=u"IP.src" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=self.nf_nodes, - max_value=self.nf_chains*self.nf_nodes, - size=1, - step=self.nf_nodes, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=4 - ), - STLVmFlowVar( - name=u"src", - min_value=self.p2_src_start_ip, - max_value=self.p2_src_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"src", - pkt_offset=u"IP.src" - ), - STLVmFixIpv4( - offset=u"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-2n3n-ethip4-ip4src254-8c1n.py b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-8c1n.py deleted file mode 100644 index 587dfc3406..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-8c1n.py +++ /dev/null @@ -1,164 +0,0 @@ -# Copyright (c) 2020 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: - - Destination MAC address: 52:54:00:00:nf_id:01 - - Source IP address range: 10.10.10.1 - 10.10.10.254 - - Destination IP address range: 20.20.20.1 - - Direction 1 --> 0: - - Destination MAC address: 52:54:00:00:nf_id:02 - - Source IP address range: 20.20.20.1 - 20.20.20.254 - - Destination IP address range: 10.10.10.1 -""" - -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__() - - # Service density parameters. - self.nf_chains = 8 - self.nf_nodes = 1 - - # MACs used in packet headers. - self.p1_dst_start_mac = u"52:54:00:00:00:01" - self.p2_dst_start_mac = u"52:54:00:00:00:02" - - # IPs used in packet headers. - self.p1_src_start_ip = u"10.10.10.1" - self.p1_src_end_ip = u"10.10.10.254" - self.p1_dst_start_ip = u"20.20.20.1" - - self.p2_src_start_ip = u"20.20.20.1" - self.p2_src_end_ip = u"20.20.20.254" - self.p2_dst_start_ip = u"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( - dst=self.p1_dst_start_mac - ) / - IP( - src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61 - ) - ) - # Direction 1 --> 0 - base_pkt_b = ( - Ether( - dst=self.p2_dst_start_mac - ) / - IP( - src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=1, - max_value=self.nf_chains*self.nf_nodes, - size=1, - step=self.nf_nodes, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=4 - ), - STLVmFlowVar( - name=u"src", - min_value=self.p1_src_start_ip, - max_value=self.p1_src_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"src", - pkt_offset=u"IP.src" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=self.nf_nodes, - max_value=self.nf_chains*self.nf_nodes, - size=1, - step=self.nf_nodes, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=4 - ), - STLVmFlowVar( - name=u"src", - min_value=self.p2_src_start_ip, - max_value=self.p2_src_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"src", - pkt_offset=u"IP.src" - ), - STLVmFixIpv4( - offset=u"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-2n3n-ethip4-ip4src254-8c2n.py b/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-8c2n.py deleted file mode 100644 index 9123a752b2..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-8c2n.py +++ /dev/null @@ -1,164 +0,0 @@ -# Copyright (c) 2020 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: - - Destination MAC address: 52:54:00:00:nf_id:01 - - Source IP address range: 10.10.10.1 - 10.10.10.254 - - Destination IP address range: 20.20.20.1 - - Direction 1 --> 0: - - Destination MAC address: 52:54:00:00:nf_id:02 - - Source IP address range: 20.20.20.1 - 20.20.20.254 - - Destination IP address range: 10.10.10.1 -""" - -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__() - - # Service density parameters. - self.nf_chains = 8 - self.nf_nodes = 2 - - # MACs used in packet headers. - self.p1_dst_start_mac = u"52:54:00:00:00:01" - self.p2_dst_start_mac = u"52:54:00:00:00:02" - - # IPs used in packet headers. - self.p1_src_start_ip = u"10.10.10.1" - self.p1_src_end_ip = u"10.10.10.254" - self.p1_dst_start_ip = u"20.20.20.1" - - self.p2_src_start_ip = u"20.20.20.1" - self.p2_src_end_ip = u"20.20.20.254" - self.p2_dst_start_ip = u"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( - dst=self.p1_dst_start_mac - ) / - IP( - src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61 - ) - ) - # Direction 1 --> 0 - base_pkt_b = ( - Ether( - dst=self.p2_dst_start_mac - ) / - IP( - src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=1, - max_value=self.nf_chains*self.nf_nodes, - size=1, - step=self.nf_nodes, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=4 - ), - STLVmFlowVar( - name=u"src", - min_value=self.p1_src_start_ip, - max_value=self.p1_src_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"src", - pkt_offset=u"IP.src" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=self.nf_nodes, - max_value=self.nf_chains*self.nf_nodes, - size=1, - step=self.nf_nodes, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=4 - ), - STLVmFlowVar( - name=u"src", - min_value=self.p2_src_start_ip, - max_value=self.p2_src_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"src", - pkt_offset=u"IP.src" - ), - STLVmFixIpv4( - offset=u"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-dot1qip4-vlan100ip4src254ip4dst254.py b/resources/traffic_profiles/trex/trex-sl-3n-dot1qip4-vlan100ip4src254ip4dst254.py deleted file mode 100644 index b414bd1c7a..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-3n-dot1qip4-vlan100ip4src254ip4dst254.py +++ /dev/null @@ -1,191 +0,0 @@ -# Copyright (c) 2020 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 / DOT1Q / IP / - - Direction 0 --> 1: - - VLAN range: 1 - 100 - - Source IP address range: 10.0.0.1 - 10.0.0.254 - - Destination IP address range: 20.0.0.1 - 20.0.0.254 - - Direction 1 --> 0: - - VLAN range: 1 - 100 - - Source IP address range: 20.0.0.1 - 20.0.0.254 - - Destination IP address range: 10.0.0.1 - 10.0.0.254 -""" - -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__() - - # VLAN IDs - self.vlans = 100 - - self.p1_vlan_start = 1 - self.p1_vlan_end = self.p1_vlan_start + self.vlans - 1 - - self.p2_vlan_start = 1 - self.p2_vlan_end = self.p2_vlan_start + self.vlans - 1 - - # IPs used in packet headers. - self.p1_src_start_ip = u"10.0.0.1" - self.p1_src_end_ip = u"10.0.0.254" - - self.p1_dst_start_ip = u"20.0.0.1" - self.p1_dst_end_ip = u"20.0.0.254" - - self.p2_src_start_ip = u"20.0.0.1" - self.p2_src_end_ip = u"20.0.0.254" - - self.p2_dst_start_ip = u"10.0.0.1" - self.p2_dst_end_ip = u"10.0.0.254" - - def define_packets(self): - """Defines the packets to be sent from the traffic generator. - - Packet definition: | ETH | DOT1Q | IP | - - :returns: Packets to be sent from the traffic generator. - :rtype: tuple - """ - - # Direction 0 --> 1 - base_pkt_a = ( - Ether() / - Dot1Q( - vlan=self.p1_vlan_start - ) / - IP( - src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61 - ) - ) - # Direction 1 --> 0 - base_pkt_b = ( - Ether() / - Dot1Q( - vlan=self.p2_vlan_start - ) / - IP( - src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"vlan", - min_value=self.p1_vlan_start, - max_value=self.p1_vlan_end, - size=2, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"vlan", - pkt_offset=u"Dot1Q.vlan" - ), - STLVmFlowVar( - name=u"ip_src", - min_value=self.p1_src_start_ip, - max_value=self.p1_src_end_ip, - size=4, - op=u"random" - ), - STLVmWrFlowVar( - fv_name=u"ip_src", - pkt_offset=u"IP.src" - ), - STLVmFlowVar( - name=u"ip_dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, - op=u"random" - ), - STLVmWrFlowVar( - fv_name=u"ip_dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"vlan", - min_value=self.p2_vlan_start, - max_value=self.p2_vlan_end, - size=2, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"vlan", - pkt_offset=u"Dot1Q.vlan" - ), - STLVmFlowVar( - name=u"ip_src", - min_value=self.p2_src_start_ip, - max_value=self.p2_src_end_ip, - size=4, - op=u"random" - ), - STLVmWrFlowVar( - fv_name=u"ip_src", - pkt_offset=u"IP.src" - ), - STLVmFlowVar( - name=u"ip_dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, - op=u"random" - ), - STLVmWrFlowVar( - fv_name=u"ip_dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - - return base_pkt_a, base_pkt_b, vm1, vm2 - - -def register(): - """Register this traffic profile to T-rex. - - Do not change this function. - - :returns: Traffic streams. - :rtype: Object - """ - return TrafficStreams() diff --git a/resources/traffic_profiles/trex/trex-sl-3n-dot1qip4-vlan10ip4src254ip4dst254.py b/resources/traffic_profiles/trex/trex-sl-3n-dot1qip4-vlan10ip4src254ip4dst254.py deleted file mode 100644 index d878e2d726..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-3n-dot1qip4-vlan10ip4src254ip4dst254.py +++ /dev/null @@ -1,191 +0,0 @@ -# Copyright (c) 2020 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 / DOT1Q / IP / - - Direction 0 --> 1: - - VLAN range: 1 - 10 - - Source IP address range: 10.0.0.1 - 10.0.0.254 - - Destination IP address range: 20.0.0.1 - 20.0.0.254 - - Direction 1 --> 0: - - VLAN range: 1 - 10 - - Source IP address range: 20.0.0.1 - 20.0.0.254 - - Destination IP address range: 10.0.0.1 - 10.0.0.254 -""" - -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__() - - # VLAN IDs - self.vlans = 10 - - self.p1_vlan_start = 1 - self.p1_vlan_end = self.p1_vlan_start + self.vlans - 1 - - self.p2_vlan_start = 1 - self.p2_vlan_end = self.p2_vlan_start + self.vlans - 1 - - - # IPs used in packet headers. - self.p1_src_start_ip = u"10.0.0.1" - self.p1_src_end_ip = u"10.0.0.254" - - self.p1_dst_start_ip = u"20.0.0.1" - self.p1_dst_end_ip = u"20.0.0.254" - - self.p2_src_start_ip = u"20.0.0.1" - self.p2_src_end_ip = u"20.0.0.254" - - self.p2_dst_start_ip = u"10.0.0.1" - self.p2_dst_end_ip = u"10.0.0.254" - - def define_packets(self): - """Defines the packets to be sent from the traffic generator. - - Packet definition: | ETH | DOT1Q | IP | - - :returns: Packets to be sent from the traffic generator. - :rtype: tuple - """ - - # Direction 0 --> 1 - base_pkt_a = ( - Ether() / - Dot1Q( - vlan=self.p1_vlan_start - ) / - IP( - src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61 - ) - ) - # Direction 1 --> 0 - base_pkt_b = ( - Ether() / - Dot1Q( - vlan=self.p2_vlan_start - ) / - IP( - src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"vlan", - min_value=self.p1_vlan_start, - max_value=self.p1_vlan_end, - size=2, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"vlan", - pkt_offset=u"Dot1Q.vlan" - ), - STLVmFlowVar( - name=u"ip_src", - min_value=self.p1_src_start_ip, - max_value=self.p1_src_end_ip, - size=4, - op=u"random" - ), - STLVmWrFlowVar( - fv_name=u"ip_src", - pkt_offset=u"IP.src" - ), - STLVmFlowVar( - name=u"ip_dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, - op=u"random" - ), - STLVmWrFlowVar( - fv_name=u"ip_dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"vlan", - min_value=self.p2_vlan_start, - max_value=self.p2_vlan_end, - size=2, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"vlan", - pkt_offset=u"Dot1Q.vlan" - ), - STLVmFlowVar( - name=u"ip_src", - min_value=self.p2_src_start_ip, - max_value=self.p2_src_end_ip, - size=4, - op=u"random" - ), - STLVmWrFlowVar( - fv_name=u"ip_src", - pkt_offset=u"IP.src" - ), - STLVmFlowVar(name=u"ip_dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, - op=u"random" - ), - STLVmWrFlowVar( - fv_name=u"ip_dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - - return base_pkt_a, base_pkt_b, vm1, vm2 - - -def register(): - """Register this traffic profile to T-rex. - - Do not change this function. - - :returns: Traffic streams. - :rtype: Object - """ - return TrafficStreams() diff --git a/resources/traffic_profiles/trex/trex-sl-3n-dot1qip4-vlan1ip4src254ip4dst254.py b/resources/traffic_profiles/trex/trex-sl-3n-dot1qip4-vlan1ip4src254ip4dst254.py deleted file mode 100644 index c8f279bdb3..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-3n-dot1qip4-vlan1ip4src254ip4dst254.py +++ /dev/null @@ -1,166 +0,0 @@ -# Copyright (c) 2020 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 / DOT1Q / IP / - - Direction 0 --> 1: - - VLAN range: 1 - - Source IP address range: 10.0.0.1 - 10.0.0.254 - - Destination IP address range: 20.0.0.1 - 20.0.0.254 - - Direction 1 --> 0: - - VLAN range: 1 - - Source IP address range: 20.0.0.1 - 20.0.0.254 - - Destination IP address range: 10.0.0.1 - 10.0.0.254 -""" - -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__() - - # VLAN IDs - self.p1_vlan_start = 1 - - self.p2_vlan_start = 1 - - - # IPs used in packet headers. - self.p1_src_start_ip = u"10.0.0.1" - self.p1_src_end_ip = u"10.0.0.254" - - self.p1_dst_start_ip = u"20.0.0.1" - self.p1_dst_end_ip = u"20.0.0.254" - - self.p2_src_start_ip = u"20.0.0.1" - self.p2_src_end_ip = u"20.0.0.254" - - self.p2_dst_start_ip = u"10.0.0.1" - self.p2_dst_end_ip = u"10.0.0.254" - - def define_packets(self): - """Defines the packets to be sent from the traffic generator. - - Packet definition: | ETH | DOT1Q | IP | - - :returns: Packets to be sent from the traffic generator. - :rtype: tuple - """ - - # Direction 0 --> 1 - base_pkt_a = ( - Ether() / - Dot1Q( - vlan=self.p1_vlan_start - ) / - IP( - src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61 - ) - ) - # Direction 1 --> 0 - base_pkt_b = ( - Ether() / - Dot1Q( - vlan=self.p2_vlan_start - ) / - IP( - src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"ip_src", - min_value=self.p1_src_start_ip, - max_value=self.p1_src_end_ip, - size=4, - op=u"random" - ), - STLVmWrFlowVar( - fv_name=u"ip_src", - pkt_offset=u"IP.src" - ), - STLVmFlowVar( - name=u"ip_dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, - op=u"random" - ), - STLVmWrFlowVar( - fv_name=u"ip_dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"ip_src", - min_value=self.p2_src_start_ip, - max_value=self.p2_src_end_ip, - size=4, - op=u"random" - ), - STLVmWrFlowVar( - fv_name=u"ip_src", - pkt_offset=u"IP.src" - ), - STLVmFlowVar( - name=u"ip_dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, - op=u"random" - ), - STLVmWrFlowVar( - fv_name=u"ip_dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - - return base_pkt_a, base_pkt_b, vm1, vm2 - - -def register(): - """Register this traffic profile to T-rex. - - Do not change this function. - - :returns: Traffic streams. - :rtype: Object - """ - return TrafficStreams() diff --git a/resources/traffic_profiles/trex/trex-sl-3n-dot1qip4-vlan1kip4src254ip4dst254.py b/resources/traffic_profiles/trex/trex-sl-3n-dot1qip4-vlan1kip4src254ip4dst254.py deleted file mode 100644 index 02decf4284..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-3n-dot1qip4-vlan1kip4src254ip4dst254.py +++ /dev/null @@ -1,191 +0,0 @@ -# Copyright (c) 2020 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 / DOT1Q / IP / - - Direction 0 --> 1: - - VLAN range: 1 - 1000 - - Source IP address range: 10.0.0.1 - 10.0.0.254 - - Destination IP address range: 20.0.0.1 - 20.0.0.254 - - Direction 1 --> 0: - - VLAN range: 1 - 1000 - - Source IP address range: 20.0.0.1 - 20.0.0.254 - - Destination IP address range: 10.0.0.1 - 10.0.0.254 -""" - -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__() - - # VLAN IDs - self.vlans = 1000 - - self.p1_vlan_start = 1 - self.p1_vlan_end = self.p1_vlan_start + self.vlans - 1 - - self.p2_vlan_start = 1 - self.p2_vlan_end = self.p2_vlan_start + self.vlans - 1 - - # IPs used in packet headers. - self.p1_src_start_ip = u"10.0.0.1" - self.p1_src_end_ip = u"10.0.0.254" - - self.p1_dst_start_ip = u"20.0.0.1" - self.p1_dst_end_ip = u"20.0.0.254" - - self.p2_src_start_ip = u"20.0.0.1" - self.p2_src_end_ip = u"20.0.0.254" - - self.p2_dst_start_ip = u"10.0.0.1" - self.p2_dst_end_ip = u"10.0.0.254" - - def define_packets(self): - """Defines the packets to be sent from the traffic generator. - - Packet definition: | ETH | DOT1Q | IP | - - :returns: Packets to be sent from the traffic generator. - :rtype: tuple - """ - - # Direction 0 --> 1 - base_pkt_a = ( - Ether() / - Dot1Q( - vlan=self.p1_vlan_start - ) / - IP( - src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61 - ) - ) - # Direction 1 --> 0 - base_pkt_b = ( - Ether() / - Dot1Q( - vlan=self.p2_vlan_start - ) / - IP( - src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"vlan", - min_value=self.p1_vlan_start, - max_value=self.p1_vlan_end, - size=2, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"vlan", - pkt_offset=u"Dot1Q.vlan" - ), - STLVmFlowVar( - name=u"ip_src", - min_value=self.p1_src_start_ip, - max_value=self.p1_src_end_ip, - size=4, - op=u"random" - ), - STLVmWrFlowVar( - fv_name=u"ip_src", - pkt_offset=u"IP.src" - ), - STLVmFlowVar( - name=u"ip_dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, - op=u"random" - ), - STLVmWrFlowVar( - fv_name=u"ip_dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"vlan", - min_value=self.p2_vlan_start, - max_value=self.p2_vlan_end, - size=2, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"vlan", - pkt_offset=u"Dot1Q.vlan" - ), - STLVmFlowVar( - name=u"ip_src", - min_value=self.p2_src_start_ip, - max_value=self.p2_src_end_ip, - size=4, - op=u"random" - ), - STLVmWrFlowVar( - fv_name=u"ip_src", - pkt_offset=u"IP.src" - ), - STLVmFlowVar( - name=u"ip_dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, - op=u"random" - ), - STLVmWrFlowVar( - fv_name=u"ip_dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - - return base_pkt_a, base_pkt_b, vm1, vm2 - - -def register(): - """Register this traffic profile to T-rex. - - Do not change this function. - - :returns: Traffic streams. - :rtype: Object - """ - return TrafficStreams() diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst1.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst1.py deleted file mode 100644 index 0d36b7358f..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst1.py +++ /dev/null @@ -1,85 +0,0 @@ -# Copyright (c) 2020 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.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 = u"10.0.0.1" - self.p1_dst_ip = u"20.0.0.0" - - self.p2_src_ip = u"20.0.0.1" - self.p2_dst_ip = u"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/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst100.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst100.py deleted file mode 100644 index 222b127914..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst100.py +++ /dev/null @@ -1,126 +0,0 @@ -# Copyright (c) 2020 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.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 = u"10.0.0.1" - self.p1_dst_start_ip = u"20.0.0.0" - self.p1_dst_end_ip = u"20.0.0.99" - - self.p2_src_start_ip = u"20.0.0.1" - self.p2_dst_start_ip = u"10.0.0.0" - self.p2_dst_end_ip = u"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=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"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-ip4dst1000-1cnf.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst1000-1cnf.py deleted file mode 100644 index 1397ae4828..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst1000-1cnf.py +++ /dev/null @@ -1,157 +0,0 @@ -# Copyright (c) 2020 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.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__() - - self.p1_dst_start_mac = u"02:02:00:00:12:00" - - self.p2_dst_start_mac = u"02:02:00:00:02:00" - - # IPs used in packet headers. - self.p1_src_start_ip = u"10.0.0.1" - self.p1_dst_start_ip = u"20.0.0.0" - self.p1_dst_end_ip = u"20.0.3.231" - - self.p2_src_start_ip = u"20.0.0.1" - self.p2_dst_start_ip = u"10.0.0.0" - self.p2_dst_end_ip = u"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( - dst=self.p1_dst_start_mac - ) / - IP( - src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61 - ) - ) - # Direction 1 --> 0 - base_pkt_b = ( - Ether( - dst=self.p2_dst_start_mac - ) / - IP( - src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=0, - size=1, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=5 - ), - STLVmFlowVar( - name=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=0, - size=1, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=5 - ), - STLVmFlowVar( - name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"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-ip4dst1000-2cnf.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst1000-2cnf.py deleted file mode 100644 index b7f316092a..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst1000-2cnf.py +++ /dev/null @@ -1,156 +0,0 @@ -# Copyright (c) 2020 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.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__() - - self.p1_dst_start_mac = u"02:02:00:00:12:00" - - self.p2_dst_start_mac = u"02:02:00:00:02:00" - - # IPs used in packet headers. - self.p1_src_start_ip = u"10.0.0.1" - self.p1_dst_start_ip = u"20.0.0.0" - self.p1_dst_end_ip = u"20.0.3.231" - - self.p2_src_start_ip = u"20.0.0.1" - self.p2_dst_start_ip = u"10.0.0.0" - self.p2_dst_end_ip = u"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( - dst=self.p1_dst_start_mac - ) / IP( - src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61 - ) - ) - # Direction 1 --> 0 - base_pkt_b = ( - Ether( - dst=self.p2_dst_start_mac - ) / - IP( - src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=1, - size=1, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=5 - ), - STLVmFlowVar( - name=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=1, - size=1, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=5 - ), - STLVmFlowVar( - name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"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-ip4dst1000-4cnf.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst1000-4cnf.py deleted file mode 100644 index a64e4d5a5e..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst1000-4cnf.py +++ /dev/null @@ -1,157 +0,0 @@ -# Copyright (c) 2020 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.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__() - - self.p1_dst_start_mac = u"02:02:00:00:12:00" - - self.p2_dst_start_mac = u"02:02:00:00:02:00" - - # IPs used in packet headers. - self.p1_src_start_ip = u"10.0.0.1" - self.p1_dst_start_ip = u"20.0.0.0" - self.p1_dst_end_ip = u"20.0.3.231" - - self.p2_src_start_ip = u"20.0.0.1" - self.p2_dst_start_ip = u"10.0.0.0" - self.p2_dst_end_ip = u"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( - dst=self.p1_dst_start_mac - ) / - IP( - src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61 - ) - ) - # Direction 1 --> 0 - base_pkt_b = ( - Ether( - dst=self.p2_dst_start_mac - ) / - IP( - src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=3, - size=1, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=5 - ), - STLVmFlowVar( - name=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=3, - size=1, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=5 - ), - STLVmFlowVar( - name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"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-ip4dst1000-8cnf.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst1000-8cnf.py deleted file mode 100644 index a58df6e87b..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst1000-8cnf.py +++ /dev/null @@ -1,157 +0,0 @@ -# Copyright (c) 2020 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.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__() - - self.p1_dst_start_mac = u"02:02:00:00:12:00" - - self.p2_dst_start_mac = u"02:02:00:00:02:00" - - # IPs used in packet headers. - self.p1_src_start_ip = u"10.0.0.1" - self.p1_dst_start_ip = u"20.0.0.0" - self.p1_dst_end_ip = u"20.0.3.231" - - self.p2_src_start_ip = u"20.0.0.1" - self.p2_dst_start_ip = u"10.0.0.0" - self.p2_dst_end_ip = u"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( - dst=self.p1_dst_start_mac - ) / - IP( - src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61 - ) - ) - # Direction 1 --> 0 - base_pkt_b = ( - Ether( - dst=self.p2_dst_start_mac - ) / - IP( - src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=7, - size=1, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=5 - ), - STLVmFlowVar( - name=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=7, - size=1, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=5 - ), - STLVmFlowVar( - name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"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-ip4dst1000.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst1000.py deleted file mode 100644 index 8d9ec21a25..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst1000.py +++ /dev/null @@ -1,126 +0,0 @@ -# Copyright (c) 2020 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.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 = u"10.0.0.1" - self.p1_dst_start_ip = u"20.0.0.0" - self.p1_dst_end_ip = u"20.0.3.231" - - self.p2_src_start_ip = u"20.0.0.1" - self.p2_dst_start_ip = u"10.0.0.0" - self.p2_dst_end_ip = u"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=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"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-ip4dst10000-1cnf.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst10000-1cnf.py deleted file mode 100644 index 53e68de2b9..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst10000-1cnf.py +++ /dev/null @@ -1,157 +0,0 @@ -# Copyright (c) 2020 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.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__() - - self.p1_dst_start_mac = u"02:02:00:00:12:00" - - self.p2_dst_start_mac = u"02:02:00:00:02:00" - - # IPs used in packet headers. - self.p1_src_start_ip = u"10.0.0.1" - self.p1_dst_start_ip = u"20.0.0.0" - self.p1_dst_end_ip = u"20.0.39.15" - - self.p2_src_start_ip = u"20.0.0.1" - self.p2_dst_start_ip = u"10.0.0.0" - self.p2_dst_end_ip = u"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( - dst=self.p1_dst_start_mac - ) / - IP( - src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61 - ) - ) - # Direction 1 --> 0 - base_pkt_b = ( - Ether( - dst=self.p2_dst_start_mac - ) / - IP( - src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=0, - size=1, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=5 - ), - STLVmFlowVar( - name=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=0, - size=1, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=5 - ), - STLVmFlowVar( - name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"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-ip4dst10000-2cnf.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst10000-2cnf.py deleted file mode 100644 index ca3f41a6fb..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst10000-2cnf.py +++ /dev/null @@ -1,157 +0,0 @@ -# Copyright (c) 2020 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.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__() - - self.p1_dst_start_mac = u"02:02:00:00:12:00" - - self.p2_dst_start_mac = u"02:02:00:00:02:00" - - # IPs used in packet headers. - self.p1_src_start_ip = u"10.0.0.1" - self.p1_dst_start_ip = u"20.0.0.0" - self.p1_dst_end_ip = u"20.0.39.15" - - self.p2_src_start_ip = u"20.0.0.1" - self.p2_dst_start_ip = u"10.0.0.0" - self.p2_dst_end_ip = u"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( - dst=self.p1_dst_start_mac - ) / - IP( - src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61 - ) - ) - # Direction 1 --> 0 - base_pkt_b = ( - Ether( - dst=self.p2_dst_start_mac - ) / - IP( - src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=1, - size=1, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=5 - ), - STLVmFlowVar( - name=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=1, - size=1, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=5 - ), - STLVmFlowVar( - name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"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-ip4dst10000-4cnf.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst10000-4cnf.py deleted file mode 100644 index df7572853f..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst10000-4cnf.py +++ /dev/null @@ -1,157 +0,0 @@ -# Copyright (c) 2020 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.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__() - - self.p1_dst_start_mac = u"02:02:00:00:12:00" - - self.p2_dst_start_mac = u"02:02:00:00:02:00" - - # IPs used in packet headers. - self.p1_src_start_ip = u"10.0.0.1" - self.p1_dst_start_ip = u"20.0.0.0" - self.p1_dst_end_ip = u"20.0.39.15" - - self.p2_src_start_ip = u"20.0.0.1" - self.p2_dst_start_ip = u"10.0.0.0" - self.p2_dst_end_ip = u"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( - dst=self.p1_dst_start_mac - ) / - IP( - src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61 - ) - ) - # Direction 1 --> 0 - base_pkt_b = ( - Ether( - dst=self.p2_dst_start_mac - ) / - IP( - src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=3, - size=1, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=5 - ), - STLVmFlowVar( - name=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=3, - size=1, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=5 - ), - STLVmFlowVar( - name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"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-ip4dst10000-8cnf.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst10000-8cnf.py deleted file mode 100644 index 1dbd3feb1a..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst10000-8cnf.py +++ /dev/null @@ -1,157 +0,0 @@ -# Copyright (c) 2020 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.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__() - - self.p1_dst_start_mac = u"02:02:00:00:12:00" - - self.p2_dst_start_mac = u"02:02:00:00:02:00" - - # IPs used in packet headers. - self.p1_src_start_ip = u"10.0.0.1" - self.p1_dst_start_ip = u"20.0.0.0" - self.p1_dst_end_ip = u"20.0.39.15" - - self.p2_src_start_ip = u"20.0.0.1" - self.p2_dst_start_ip = u"10.0.0.0" - self.p2_dst_end_ip = u"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( - dst=self.p1_dst_start_mac - ) / - IP( - src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61 - ) - ) - # Direction 1 --> 0 - base_pkt_b = ( - Ether( - dst=self.p2_dst_start_mac - ) / - IP( - src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=7, - size=1, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=5 - ), - STLVmFlowVar( - name=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=7, - size=1, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=5 - ), - STLVmFlowVar( - name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"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-ip4dst10000.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst10000.py deleted file mode 100644 index 9f55ff71de..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst10000.py +++ /dev/null @@ -1,126 +0,0 @@ -# Copyright (c) 2020 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.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 = u"10.0.0.1" - self.p1_dst_start_ip = u"20.0.0.0" - self.p1_dst_end_ip = u"20.0.39.15" - - self.p2_src_start_ip = u"20.0.0.1" - self.p2_dst_start_ip = u"10.0.0.0" - self.p2_dst_end_ip = u"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=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"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-ip4dst100000.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst100000.py deleted file mode 100644 index ae36cf9995..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst100000.py +++ /dev/null @@ -1,126 +0,0 @@ -# Copyright (c) 2020 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.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 = u"10.0.0.1" - self.p1_dst_start_ip = u"20.0.0.0" - self.p1_dst_end_ip = u"20.1.134.159" - - self.p2_src_start_ip = u"20.0.0.1" - self.p2_dst_start_ip = u"10.0.0.0" - self.p2_dst_end_ip = u"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=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"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-ip4dst1000000.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst1000000.py deleted file mode 100644 index 8f6e5a0836..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst1000000.py +++ /dev/null @@ -1,126 +0,0 @@ -# Copyright (c) 2020 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.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 = u"10.0.0.1" - self.p1_dst_start_ip = u"20.0.0.0" - self.p1_dst_end_ip = u"20.15.66.63" - - self.p2_src_start_ip = u"20.0.0.1" - self.p2_dst_start_ip = u"10.0.0.0" - self.p2_dst_end_ip = u"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=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"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-ip4dst20000-1cnf.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst20000-1cnf.py deleted file mode 100644 index f6f6fada5a..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst20000-1cnf.py +++ /dev/null @@ -1,157 +0,0 @@ -# Copyright (c) 2020 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__() - - self.p1_dst_start_mac = u"02:02:00:00:12:00" - - self.p2_dst_start_mac = u"02:02:00:00:02:00" - - # IPs used in packet headers. - self.p1_src_start_ip = u"10.0.0.1" - self.p1_dst_start_ip = u"20.0.0.0" - self.p1_dst_end_ip = u"20.0.78.31" - - self.p2_src_start_ip = u"20.0.0.1" - self.p2_dst_start_ip = u"10.0.0.0" - self.p2_dst_end_ip = u"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( - dst=self.p1_dst_start_mac - ) / - IP( - src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61 - ) - ) - # Direction 1 --> 0 - base_pkt_b = ( - Ether( - dst=self.p2_dst_start_mac - ) / - IP( - src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=0, - size=1, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=5 - ), - STLVmFlowVar( - name=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=0, - size=1, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=5 - ), - STLVmFlowVar( - name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"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-ip4dst20000-2cnf.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst20000-2cnf.py deleted file mode 100644 index 15cb461624..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst20000-2cnf.py +++ /dev/null @@ -1,157 +0,0 @@ -# Copyright (c) 2020 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__() - - self.p1_dst_start_mac = u"02:02:00:00:12:00" - - self.p2_dst_start_mac = u"02:02:00:00:02:00" - - # IPs used in packet headers. - self.p1_src_start_ip = u"10.0.0.1" - self.p1_dst_start_ip = u"20.0.0.0" - self.p1_dst_end_ip = u"20.0.78.31" - - self.p2_src_start_ip = u"20.0.0.1" - self.p2_dst_start_ip = u"10.0.0.0" - self.p2_dst_end_ip = u"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( - dst=self.p1_dst_start_mac - ) / - IP( - src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61 - ) - ) - # Direction 1 --> 0 - base_pkt_b = ( - Ether( - dst=self.p2_dst_start_mac - ) / - IP( - src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=1, - size=1, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=5 - ), - STLVmFlowVar( - name=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=1, - size=1, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=5 - ), - STLVmFlowVar( - name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"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-ip4dst20000-4cnf.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst20000-4cnf.py deleted file mode 100644 index 62eb1bee78..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst20000-4cnf.py +++ /dev/null @@ -1,157 +0,0 @@ -# Copyright (c) 2020 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__() - - self.p1_dst_start_mac = u"02:02:00:00:12:00" - - self.p2_dst_start_mac = u"02:02:00:00:02:00" - - # IPs used in packet headers. - self.p1_src_start_ip = u"10.0.0.1" - self.p1_dst_start_ip = u"20.0.0.0" - self.p1_dst_end_ip = u"20.0.78.31" - - self.p2_src_start_ip = u"20.0.0.1" - self.p2_dst_start_ip = u"10.0.0.0" - self.p2_dst_end_ip = u"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( - dst=self.p1_dst_start_mac - ) / - IP( - src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61 - ) - ) - # Direction 1 --> 0 - base_pkt_b = ( - Ether( - dst=self.p2_dst_start_mac - ) / - IP( - src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=3, - size=1, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=5 - ), - STLVmFlowVar( - name=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=3, - size=1, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=5 - ), - STLVmFlowVar( - name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"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-ip4dst20000-8cnf.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst20000-8cnf.py deleted file mode 100644 index b6eef29366..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst20000-8cnf.py +++ /dev/null @@ -1,157 +0,0 @@ -# Copyright (c) 2020 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__() - - self.p1_dst_start_mac = u"02:02:00:00:12:00" - - self.p2_dst_start_mac = u"02:02:00:00:02:00" - - # IPs used in packet headers. - self.p1_src_start_ip = u"10.0.0.1" - self.p1_dst_start_ip = u"20.0.0.0" - self.p1_dst_end_ip = u"20.0.78.31" - - self.p2_src_start_ip = u"20.0.0.1" - self.p2_dst_start_ip = u"10.0.0.0" - self.p2_dst_end_ip = u"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( - dst=self.p1_dst_start_mac - ) / - IP( - src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61 - ) - ) - # Direction 1 --> 0 - base_pkt_b = ( - Ether( - dst=self.p2_dst_start_mac - ) / - IP( - src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=7, - size=1, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=5 - ), - STLVmFlowVar( - name=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=7, - size=1, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=5 - ), - STLVmFlowVar( - name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"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-ip4dst20000.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst20000.py deleted file mode 100644 index 877e6cdc66..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst20000.py +++ /dev/null @@ -1,126 +0,0 @@ -# Copyright (c) 2020 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 = u"10.0.0.1" - self.p1_dst_start_ip = u"20.0.0.0" - self.p1_dst_end_ip = u"20.0.78.31" - - self.p2_src_start_ip = u"20.0.0.1" - self.p2_dst_start_ip = u"10.0.0.0" - self.p2_dst_end_ip = u"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=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"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-ip4dst253.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst253.py deleted file mode 100644 index e1e6a89af7..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst253.py +++ /dev/null @@ -1,126 +0,0 @@ -# Copyright (c) 2020 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.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 = u"20.20.20.2" - self.p1_dst_start_ip = u"2.1.1.2" - self.p1_dst_end_ip = u"2.1.1.254" - - self.p2_src_start_ip = u"10.10.10.2" - self.p2_dst_start_ip = u"1.1.1.2" - self.p2_dst_end_ip = u"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=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"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-ip4dst253_l3fwd.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst253_l3fwd.py deleted file mode 100644 index ed4f5b5bd6..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst253_l3fwd.py +++ /dev/null @@ -1,126 +0,0 @@ -# Copyright (c) 2020 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.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 = u"20.20.20.2" - self.p1_dst_start_ip = u"1.1.1.2" - self.p1_dst_end_ip = u"1.1.1.254" - - self.p2_src_start_ip = u"10.10.10.2" - self.p2_dst_start_ip = u"2.1.1.2" - self.p2_dst_end_ip = u"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=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"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-ip4dst4-1cnf.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst4-1cnf.py deleted file mode 100644 index b937d02741..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst4-1cnf.py +++ /dev/null @@ -1,157 +0,0 @@ -# Copyright (c) 2020 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.3 - - Direction 1 --> 0: - - Source IP address range: 20.0.0.1 - - Destination IP address range: 10.0.0.0 - 10.0.0.3 -""" - -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__() - - self.p1_dst_start_mac = u"02:02:00:00:12:00" - - self.p2_dst_start_mac = u"02:02:00:00:02:00" - - # IPs used in packet headers. - self.p1_src_start_ip = u"10.0.0.1" - self.p1_dst_start_ip = u"20.0.0.0" - self.p1_dst_end_ip = u"20.0.0.3" - - self.p2_src_start_ip = u"20.0.0.1" - self.p2_dst_start_ip = u"10.0.0.0" - self.p2_dst_end_ip = u"10.0.0.3" - - 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( - dst=self.p1_dst_start_mac - ) / - IP( - src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61 - ) - ) - # Direction 1 --> 0 - base_pkt_b = ( - Ether( - dst=self.p2_dst_start_mac - ) / - IP( - src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=0, - size=1, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=5 - ), - STLVmFlowVar( - name=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=0, - size=1, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=5 - ), - STLVmFlowVar( - name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"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-ip4dst4-2cnf.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst4-2cnf.py deleted file mode 100644 index b95649a94d..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst4-2cnf.py +++ /dev/null @@ -1,157 +0,0 @@ -# Copyright (c) 2020 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.3 - - Direction 1 --> 0: - - Source IP address range: 20.0.0.1 - - Destination IP address range: 10.0.0.0 - 10.0.0.3 -""" - -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__() - - self.p1_dst_start_mac = u"02:02:00:00:12:00" - - self.p2_dst_start_mac = u"02:02:00:00:02:00" - - # IPs used in packet headers. - self.p1_src_start_ip = u"10.0.0.1" - self.p1_dst_start_ip = u"20.0.0.0" - self.p1_dst_end_ip = u"20.0.0.3" - - self.p2_src_start_ip = u"20.0.0.1" - self.p2_dst_start_ip = u"10.0.0.0" - self.p2_dst_end_ip = u"10.0.0.3" - - 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( - dst=self.p1_dst_start_mac - ) / - IP( - src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61 - ) - ) - # Direction 1 --> 0 - base_pkt_b = ( - Ether( - dst=self.p2_dst_start_mac - ) / - IP( - src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=1, - size=1, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=5 - ), - STLVmFlowVar( - name=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=1, - size=1, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=5 - ), - STLVmFlowVar( - name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"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-ip4dst4-4cnf.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst4-4cnf.py deleted file mode 100644 index fed0d7ef3c..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst4-4cnf.py +++ /dev/null @@ -1,157 +0,0 @@ -# Copyright (c) 2020 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.3 - - Direction 1 --> 0: - - Source IP address range: 20.0.0.1 - - Destination IP address range: 10.0.0.0 - 10.0.0.3 -""" - -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__() - - self.p1_dst_start_mac = u"02:02:00:00:12:00" - - self.p2_dst_start_mac = u"02:02:00:00:02:00" - - # IPs used in packet headers. - self.p1_src_start_ip = u"10.0.0.1" - self.p1_dst_start_ip = u"20.0.0.0" - self.p1_dst_end_ip = u"20.0.0.3" - - self.p2_src_start_ip = u"20.0.0.1" - self.p2_dst_start_ip = u"10.0.0.0" - self.p2_dst_end_ip = u"10.0.0.3" - - 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( - dst=self.p1_dst_start_mac - ) / - IP( - src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61 - ) - ) - # Direction 1 --> 0 - base_pkt_b = ( - Ether( - dst=self.p2_dst_start_mac - ) / - IP( - src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=3, - size=1, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=5 - ), - STLVmFlowVar( - name=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=3, - size=1, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=5 - ), - STLVmFlowVar( - name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"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-ip4dst4.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst4.py deleted file mode 100644 index 9f14d4c929..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst4.py +++ /dev/null @@ -1,126 +0,0 @@ -# Copyright (c) 2020 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.3 - - Direction 1 --> 0: - - Source IP address range: 20.0.0.1 - - Destination IP address range: 10.0.0.0 - 10.0.0.3 -""" - -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 = u"10.0.0.1" - self.p1_dst_start_ip = u"20.0.0.0" - self.p1_dst_end_ip = u"20.0.0.3" - - self.p2_src_start_ip = u"20.0.0.1" - self.p2_dst_start_ip = u"10.0.0.0" - self.p2_dst_end_ip = u"10.0.0.3" - - 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=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"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-ip4dst40-1cnf.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40-1cnf.py deleted file mode 100644 index d321d0ffb2..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40-1cnf.py +++ /dev/null @@ -1,157 +0,0 @@ -# Copyright (c) 2020 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.39 - - Direction 1 --> 0: - - Source IP address range: 20.0.0.1 - - Destination IP address range: 10.0.0.0 - 10.0.0.39 -""" - -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__() - - self.p1_dst_start_mac = u"02:02:00:00:12:00" - - self.p2_dst_start_mac = u"02:02:00:00:02:00" - - # IPs used in packet headers. - self.p1_src_start_ip = u"10.0.0.1" - self.p1_dst_start_ip = u"20.0.0.0" - self.p1_dst_end_ip = u"20.0.0.39" - - self.p2_src_start_ip = u"20.0.0.1" - self.p2_dst_start_ip = u"10.0.0.0" - self.p2_dst_end_ip = u"10.0.0.39" - - 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( - dst=self.p1_dst_start_mac - ) / - IP( - src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61 - ) - ) - # Direction 1 --> 0 - base_pkt_b = ( - Ether( - dst=self.p2_dst_start_mac - ) / - IP( - src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=0, - size=1, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=5 - ), - STLVmFlowVar( - name=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=0, - size=1, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=5 - ), - STLVmFlowVar( - name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"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-ip4dst40-2cnf.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40-2cnf.py deleted file mode 100644 index acc565e776..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40-2cnf.py +++ /dev/null @@ -1,157 +0,0 @@ -# Copyright (c) 2020 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.39 - - Direction 1 --> 0: - - Source IP address range: 20.0.0.1 - - Destination IP address range: 10.0.0.0 - 10.0.0.39 -""" - -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__() - - self.p1_dst_start_mac = u"02:02:00:00:12:00" - - self.p2_dst_start_mac = u"02:02:00:00:02:00" - - # IPs used in packet headers. - self.p1_src_start_ip = u"10.0.0.1" - self.p1_dst_start_ip = u"20.0.0.0" - self.p1_dst_end_ip = u"20.0.0.39" - - self.p2_src_start_ip = u"20.0.0.1" - self.p2_dst_start_ip = u"10.0.0.0" - self.p2_dst_end_ip = u"10.0.0.39" - - 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( - dst=self.p1_dst_start_mac - ) / - IP( - src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61 - ) - ) - # Direction 1 --> 0 - base_pkt_b = ( - Ether( - dst=self.p2_dst_start_mac - ) / - IP( - src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=1, - size=1, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=5 - ), - STLVmFlowVar( - name=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=1, - size=1, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=5 - ), - STLVmFlowVar( - name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"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-ip4dst40-4cnf.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40-4cnf.py deleted file mode 100644 index 629100cb83..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40-4cnf.py +++ /dev/null @@ -1,157 +0,0 @@ -# Copyright (c) 2020 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.39 - - Direction 1 --> 0: - - Source IP address range: 20.0.0.1 - - Destination IP address range: 10.0.0.0 - 10.0.0.39 -""" - -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__() - - self.p1_dst_start_mac = u"02:02:00:00:12:00" - - self.p2_dst_start_mac = u"02:02:00:00:02:00" - - # IPs used in packet headers. - self.p1_src_start_ip = u"10.0.0.1" - self.p1_dst_start_ip = u"20.0.0.0" - self.p1_dst_end_ip = u"20.0.0.39" - - self.p2_src_start_ip = u"20.0.0.1" - self.p2_dst_start_ip = u"10.0.0.0" - self.p2_dst_end_ip = u"10.0.0.39" - - 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( - dst=self.p1_dst_start_mac - ) / - IP( - src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61 - ) - ) - # Direction 1 --> 0 - base_pkt_b = ( - Ether( - dst=self.p2_dst_start_mac - ) / - IP( - src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=3, - size=1, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=5 - ), - STLVmFlowVar( - name=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=3, - size=1, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=5 - ), - STLVmFlowVar( - name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"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-ip4dst40-8cnf.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40-8cnf.py deleted file mode 100644 index b51c98d7aa..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40-8cnf.py +++ /dev/null @@ -1,157 +0,0 @@ -# Copyright (c) 2020 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.39 - - Direction 1 --> 0: - - Source IP address range: 20.0.0.1 - - Destination IP address range: 10.0.0.0 - 10.0.0.39 -""" - -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__() - - self.p1_dst_start_mac = u"02:02:00:00:12:00" - - self.p2_dst_start_mac = u"02:02:00:00:02:00" - - # IPs used in packet headers. - self.p1_src_start_ip = u"10.0.0.1" - self.p1_dst_start_ip = u"20.0.0.0" - self.p1_dst_end_ip = u"20.0.0.39" - - self.p2_src_start_ip = u"20.0.0.1" - self.p2_dst_start_ip = u"10.0.0.0" - self.p2_dst_end_ip = u"10.0.0.39" - - 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( - dst=self.p1_dst_start_mac - ) / - IP( - src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61 - ) - ) - # Direction 1 --> 0 - base_pkt_b = ( - Ether( - dst=self.p2_dst_start_mac - ) / - IP( - src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=7, - size=1, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=5 - ), - STLVmFlowVar( - name=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=7, - size=1, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=5 - ), - STLVmFlowVar( - name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"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-ip4dst40.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40.py deleted file mode 100644 index 5dbc5fc803..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40.py +++ /dev/null @@ -1,126 +0,0 @@ -# Copyright (c) 2020 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.39 - - Direction 1 --> 0: - - Source IP address range: 20.0.0.1 - - Destination IP address range: 10.0.0.0 - 10.0.0.39 -""" - -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 = u"10.0.0.1" - self.p1_dst_start_ip = u"20.0.0.0" - self.p1_dst_end_ip = u"20.0.0.39" - - self.p2_src_start_ip = u"20.0.0.1" - self.p2_dst_start_ip = u"10.0.0.0" - self.p2_dst_end_ip = u"10.0.0.39" - - 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=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"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-ip4dst400-1cnf.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst400-1cnf.py deleted file mode 100644 index 1a004b055f..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst400-1cnf.py +++ /dev/null @@ -1,157 +0,0 @@ -# Copyright (c) 2020 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.1.143 - - Direction 1 --> 0: - - Source IP address range: 20.0.0.1 - - Destination IP address range: 10.0.0.0 - 10.0.1.143 -""" - -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__() - - self.p1_dst_start_mac = u"02:02:00:00:12:00" - - self.p2_dst_start_mac = u"02:02:00:00:02:00" - - # IPs used in packet headers. - self.p1_src_start_ip = u"10.0.0.1" - self.p1_dst_start_ip = u"20.0.0.0" - self.p1_dst_end_ip = u"20.0.1.143" - - self.p2_src_start_ip = u"20.0.0.1" - self.p2_dst_start_ip = u"10.0.0.0" - self.p2_dst_end_ip = u"10.0.1.143" - - 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( - dst=self.p1_dst_start_mac - ) / - IP( - src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61 - ) - ) - # Direction 1 --> 0 - base_pkt_b = ( - Ether( - dst=self.p2_dst_start_mac - ) / - IP( - src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=0, - size=1, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=5 - ), - STLVmFlowVar( - name=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=0, - size=1, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=5 - ), - STLVmFlowVar( - name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"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-ip4dst400-2cnf.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst400-2cnf.py deleted file mode 100644 index b09e79d7dc..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst400-2cnf.py +++ /dev/null @@ -1,157 +0,0 @@ -# Copyright (c) 2020 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.1.143 - - Direction 1 --> 0: - - Source IP address range: 20.0.0.1 - - Destination IP address range: 10.0.0.0 - 10.0.1.143 -""" - -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__() - - self.p1_dst_start_mac = u"02:02:00:00:12:00" - - self.p2_dst_start_mac = u"02:02:00:00:02:00" - - # IPs used in packet headers. - self.p1_src_start_ip = u"10.0.0.1" - self.p1_dst_start_ip = u"20.0.0.0" - self.p1_dst_end_ip = u"20.0.1.143" - - self.p2_src_start_ip = u"20.0.0.1" - self.p2_dst_start_ip = u"10.0.0.0" - self.p2_dst_end_ip = u"10.0.1.143" - - 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( - dst=self.p1_dst_start_mac - ) / - IP( - src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61 - ) - ) - # Direction 1 --> 0 - base_pkt_b = ( - Ether( - dst=self.p2_dst_start_mac - ) / - IP( - src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=1, - size=1, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=5 - ), - STLVmFlowVar( - name=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=1, - size=1, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=5 - ), - STLVmFlowVar( - name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"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-ip4dst400-4cnf.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst400-4cnf.py deleted file mode 100644 index 7081525771..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst400-4cnf.py +++ /dev/null @@ -1,157 +0,0 @@ -# Copyright (c) 2020 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.1.143 - - Direction 1 --> 0: - - Source IP address range: 20.0.0.1 - - Destination IP address range: 10.0.0.0 - 10.0.1.143 -""" - -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__() - - self.p1_dst_start_mac = u"02:02:00:00:12:00" - - self.p2_dst_start_mac = u"02:02:00:00:02:00" - - # IPs used in packet headers. - self.p1_src_start_ip = u"10.0.0.1" - self.p1_dst_start_ip = u"20.0.0.0" - self.p1_dst_end_ip = u"20.0.1.143" - - self.p2_src_start_ip = u"20.0.0.1" - self.p2_dst_start_ip = u"10.0.0.0" - self.p2_dst_end_ip = u"10.0.1.143" - - 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( - dst=self.p1_dst_start_mac - ) / - IP( - src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61 - ) - ) - # Direction 1 --> 0 - base_pkt_b = ( - Ether( - dst=self.p2_dst_start_mac - ) / - IP( - src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=3, - size=1, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=5 - ), - STLVmFlowVar( - name=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=3, - size=1, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=5 - ), - STLVmFlowVar( - name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"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-ip4dst400-8cnf.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst400-8cnf.py deleted file mode 100644 index c5b1d52e04..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst400-8cnf.py +++ /dev/null @@ -1,157 +0,0 @@ -# Copyright (c) 2020 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.1.143 - - Direction 1 --> 0: - - Source IP address range: 20.0.0.1 - - Destination IP address range: 10.0.0.0 - 10.0.1.143 -""" - -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__() - - self.p1_dst_start_mac = u"02:02:00:00:12:00" - - self.p2_dst_start_mac = u"02:02:00:00:02:00" - - # IPs used in packet headers. - self.p1_src_start_ip = u"10.0.0.1" - self.p1_dst_start_ip = u"20.0.0.0" - self.p1_dst_end_ip = u"20.0.1.143" - - self.p2_src_start_ip = u"20.0.0.1" - self.p2_dst_start_ip = u"10.0.0.0" - self.p2_dst_end_ip = u"10.0.1.143" - - 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( - dst=self.p1_dst_start_mac - ) / - IP( - src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61 - ) - ) - # Direction 1 --> 0 - base_pkt_b = ( - Ether( - dst=self.p2_dst_start_mac - ) / - IP( - src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=7, - size=1, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=5 - ), - STLVmFlowVar( - name=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=7, - size=1, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=5 - ), - STLVmFlowVar( - name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"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-ip4dst400.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst400.py deleted file mode 100644 index 44db3ec81c..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst400.py +++ /dev/null @@ -1,126 +0,0 @@ -# Copyright (c) 2020 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.1.143 - - Direction 1 --> 0: - - Source IP address range: 20.0.0.1 - - Destination IP address range: 10.0.0.0 - 10.0.1.143 -""" - -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 = u"10.0.0.1" - self.p1_dst_start_ip = u"20.0.0.0" - self.p1_dst_end_ip = u"20.0.1.143" - - self.p2_src_start_ip = u"20.0.0.1" - self.p2_dst_start_ip = u"10.0.0.0" - self.p2_dst_end_ip = u"10.0.1.143" - - 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=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"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-1cnf.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40000-1cnf.py deleted file mode 100644 index 038b986b65..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40000-1cnf.py +++ /dev/null @@ -1,157 +0,0 @@ -# Copyright (c) 2020 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__() - - self.p1_dst_start_mac = u"02:02:00:00:12:00" - - self.p2_dst_start_mac = u"02:02:00:00:02:00" - - # IPs used in packet headers. - self.p1_src_start_ip = u"10.0.0.1" - self.p1_dst_start_ip = u"20.0.0.0" - self.p1_dst_end_ip = u"20.0.156.63" - - self.p2_src_start_ip = u"20.0.0.1" - self.p2_dst_start_ip = u"10.0.0.0" - self.p2_dst_end_ip = u"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( - dst=self.p1_dst_start_mac - ) / - IP( - src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61 - ) - ) - # Direction 1 --> 0 - base_pkt_b = ( - Ether( - dst=self.p2_dst_start_mac - ) / - IP( - src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=0, - size=1, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=5 - ), - STLVmFlowVar( - name=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=0, - size=1, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=5 - ), - STLVmFlowVar( - name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"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-2cnf.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40000-2cnf.py deleted file mode 100644 index 5933b33d20..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40000-2cnf.py +++ /dev/null @@ -1,157 +0,0 @@ -# Copyright (c) 2020 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__() - - self.p1_dst_start_mac = u"02:02:00:00:12:00" - - self.p2_dst_start_mac = u"02:02:00:00:02:00" - - # IPs used in packet headers. - self.p1_src_start_ip = u"10.0.0.1" - self.p1_dst_start_ip = u"20.0.0.0" - self.p1_dst_end_ip = u"20.0.156.63" - - self.p2_src_start_ip = u"20.0.0.1" - self.p2_dst_start_ip = u"10.0.0.0" - self.p2_dst_end_ip = u"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( - dst=self.p1_dst_start_mac - ) / - IP( - src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61 - ) - ) - # Direction 1 --> 0 - base_pkt_b = ( - Ether( - dst=self.p2_dst_start_mac - ) / - IP( - src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=1, - size=1, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=5 - ), - STLVmFlowVar( - name=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=1, - size=1, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=5 - ), - STLVmFlowVar( - name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"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-4cnf.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40000-4cnf.py deleted file mode 100644 index 851cd7c870..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40000-4cnf.py +++ /dev/null @@ -1,157 +0,0 @@ -# Copyright (c) 2020 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__() - - self.p1_dst_start_mac = u"02:02:00:00:12:00" - - self.p2_dst_start_mac = u"02:02:00:00:02:00" - - # IPs used in packet headers. - self.p1_src_start_ip = u"10.0.0.1" - self.p1_dst_start_ip = u"20.0.0.0" - self.p1_dst_end_ip = u"20.0.156.63" - - self.p2_src_start_ip = u"20.0.0.1" - self.p2_dst_start_ip = u"10.0.0.0" - self.p2_dst_end_ip = u"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( - dst=self.p1_dst_start_mac - ) / - IP( - src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61 - ) - ) - # Direction 1 --> 0 - base_pkt_b = ( - Ether( - dst=self.p2_dst_start_mac - ) / - IP( - src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=3, - size=1, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=5 - ), - STLVmFlowVar( - name=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=3, - size=1, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=5 - ), - STLVmFlowVar( - name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"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-8cnf.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40000-8cnf.py deleted file mode 100644 index 40d57f09dd..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40000-8cnf.py +++ /dev/null @@ -1,157 +0,0 @@ -# Copyright (c) 2020 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__() - - self.p1_dst_start_mac = u"02:02:00:00:12:00" - - self.p2_dst_start_mac = u"02:02:00:00:02:00" - - # IPs used in packet headers. - self.p1_src_start_ip = u"10.0.0.1" - self.p1_dst_start_ip = u"20.0.0.0" - self.p1_dst_end_ip = u"20.0.156.63" - - self.p2_src_start_ip = u"20.0.0.1" - self.p2_dst_start_ip = u"10.0.0.0" - self.p2_dst_end_ip = u"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( - dst=self.p1_dst_start_mac - ) / - IP( - src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61 - ) - ) - # Direction 1 --> 0 - base_pkt_b = ( - Ether( - dst=self.p2_dst_start_mac - ) / - IP( - src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=7, - size=1, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=5 - ), - STLVmFlowVar( - name=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=7, - size=1, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=5 - ), - STLVmFlowVar( - name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"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 deleted file mode 100644 index 570a236fd6..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40000.py +++ /dev/null @@ -1,126 +0,0 @@ -# Copyright (c) 2020 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 = u"10.0.0.1" - self.p1_dst_start_ip = u"20.0.0.0" - self.p1_dst_end_ip = u"20.0.156.63" - - self.p2_src_start_ip = u"20.0.0.1" - self.p2_dst_start_ip = u"10.0.0.0" - self.p2_dst_end_ip = u"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=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"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-ip4dst5000-1cnf.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst5000-1cnf.py deleted file mode 100644 index fb4c61b030..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst5000-1cnf.py +++ /dev/null @@ -1,157 +0,0 @@ -# Copyright (c) 2020 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.19.135 - - Direction 1 --> 0: - - Source IP address range: 20.0.0.1 - - Destination IP address range: 10.0.0.0 - 10.0.19.135 -""" - -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__() - - self.p1_dst_start_mac = u"02:02:00:00:12:00" - - self.p2_dst_start_mac = u"02:02:00:00:02:00" - - # IPs used in packet headers. - self.p1_src_start_ip = u"10.0.0.1" - self.p1_dst_start_ip = u"20.0.0.0" - self.p1_dst_end_ip = u"20.0.19.135" - - self.p2_src_start_ip = u"20.0.0.1" - self.p2_dst_start_ip = u"10.0.0.0" - self.p2_dst_end_ip = u"10.0.19.135" - - 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( - dst=self.p1_dst_start_mac - ) / - IP( - src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61 - ) - ) - # Direction 1 --> 0 - base_pkt_b = ( - Ether( - dst=self.p2_dst_start_mac - ) / - IP( - src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=0, - size=1, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=5 - ), - STLVmFlowVar( - name=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=0, - size=1, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=5 - ), - STLVmFlowVar( - name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"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-ip4dst5000-2cnf.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst5000-2cnf.py deleted file mode 100644 index ca13c337cb..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst5000-2cnf.py +++ /dev/null @@ -1,157 +0,0 @@ -# Copyright (c) 2020 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.19.135 - - Direction 1 --> 0: - - Source IP address range: 20.0.0.1 - - Destination IP address range: 10.0.0.0 - 10.0.19.135 -""" - -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__() - - self.p1_dst_start_mac = u"02:02:00:00:12:00" - - self.p2_dst_start_mac = u"02:02:00:00:02:00" - - # IPs used in packet headers. - self.p1_src_start_ip = u"10.0.0.1" - self.p1_dst_start_ip = u"20.0.0.0" - self.p1_dst_end_ip = u"20.0.19.135" - - self.p2_src_start_ip = u"20.0.0.1" - self.p2_dst_start_ip = u"10.0.0.0" - self.p2_dst_end_ip = u"10.0.19.135" - - 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( - dst=self.p1_dst_start_mac - ) / - IP( - src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61 - ) - ) - # Direction 1 --> 0 - base_pkt_b = ( - Ether( - dst=self.p2_dst_start_mac - ) / - IP( - src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=1, - size=1, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=5 - ), - STLVmFlowVar( - name=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=1, - size=1, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=5 - ), - STLVmFlowVar( - name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"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-ip4dst5000-4cnf.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst5000-4cnf.py deleted file mode 100644 index 1ffd8c8ba5..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst5000-4cnf.py +++ /dev/null @@ -1,157 +0,0 @@ -# Copyright (c) 2020 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.19.135 - - Direction 1 --> 0: - - Source IP address range: 20.0.0.1 - - Destination IP address range: 10.0.0.0 - 10.0.19.135 -""" - -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__() - - self.p1_dst_start_mac = u"02:02:00:00:12:00" - - self.p2_dst_start_mac = u"02:02:00:00:02:00" - - # IPs used in packet headers. - self.p1_src_start_ip = u"10.0.0.1" - self.p1_dst_start_ip = u"20.0.0.0" - self.p1_dst_end_ip = u"20.0.19.135" - - self.p2_src_start_ip = u"20.0.0.1" - self.p2_dst_start_ip = u"10.0.0.0" - self.p2_dst_end_ip = u"10.0.19.135" - - 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( - dst=self.p1_dst_start_mac - ) / - IP( - src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61 - ) - ) - # Direction 1 --> 0 - base_pkt_b = ( - Ether( - dst=self.p2_dst_start_mac - ) / - IP( - src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=3, - size=1, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=5 - ), - STLVmFlowVar( - name=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=3, - size=1, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=5 - ), - STLVmFlowVar( - name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"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-ip4dst5000-8cnf.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst5000-8cnf.py deleted file mode 100644 index 26efc1a438..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst5000-8cnf.py +++ /dev/null @@ -1,157 +0,0 @@ -# Copyright (c) 2020 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.19.135 - - Direction 1 --> 0: - - Source IP address range: 20.0.0.1 - - Destination IP address range: 10.0.0.0 - 10.0.19.135 -""" - -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__() - - self.p1_dst_start_mac = u"02:02:00:00:12:00" - - self.p2_dst_start_mac = u"02:02:00:00:02:00" - - # IPs used in packet headers. - self.p1_src_start_ip = u"10.0.0.1" - self.p1_dst_start_ip = u"20.0.0.0" - self.p1_dst_end_ip = u"20.0.19.135" - - self.p2_src_start_ip = u"20.0.0.1" - self.p2_dst_start_ip = u"10.0.0.0" - self.p2_dst_end_ip = u"10.0.19.135" - - 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( - dst=self.p1_dst_start_mac - ) / - IP( - src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61 - ) - ) - # Direction 1 --> 0 - base_pkt_b = ( - Ether( - dst=self.p2_dst_start_mac - ) / - IP( - src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=7, - size=1, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=5 - ), - STLVmFlowVar( - name=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=7, - size=1, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=5 - ), - STLVmFlowVar( - name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"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-ip4dst5000.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst5000.py deleted file mode 100644 index 95d8380a22..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst5000.py +++ /dev/null @@ -1,126 +0,0 @@ -# Copyright (c) 2020 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.19.135 - - Direction 1 --> 0: - - Source IP address range: 20.0.0.1 - - Destination IP address range: 10.0.0.0 - 10.0.19.135 -""" - -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 = u"10.0.0.1" - self.p1_dst_start_ip = u"20.0.0.0" - self.p1_dst_end_ip = u"20.0.19.135" - - self.p2_src_start_ip = u"20.0.0.1" - self.p2_dst_start_ip = u"10.0.0.0" - self.p2_dst_end_ip = u"10.0.19.135" - - 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=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"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-1cnf.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst60000-1cnf.py deleted file mode 100644 index 251758ddae..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst60000-1cnf.py +++ /dev/null @@ -1,157 +0,0 @@ -# Copyright (c) 2020 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__() - - self.p1_dst_start_mac = u"02:02:00:00:12:00" - - self.p2_dst_start_mac = u"02:02:00:00:02:00" - - # IPs used in packet headers. - self.p1_src_start_ip = u"10.0.0.1" - self.p1_dst_start_ip = u"20.0.0.0" - self.p1_dst_end_ip = u"20.0.234.95" - - self.p2_src_start_ip = u"20.0.0.1" - self.p2_dst_start_ip = u"10.0.0.0" - self.p2_dst_end_ip = u"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( - dst=self.p1_dst_start_mac - ) / - IP( - src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61 - ) - ) - # Direction 1 --> 0 - base_pkt_b = ( - Ether( - dst=self.p2_dst_start_mac - ) / - IP( - src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=0, - size=1, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=5 - ), - STLVmFlowVar( - name=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=0, - size=1, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=5 - ), - STLVmFlowVar( - name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"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-ip4dst60000-2cnf.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst60000-2cnf.py deleted file mode 100644 index acebf6d06d..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst60000-2cnf.py +++ /dev/null @@ -1,157 +0,0 @@ -# Copyright (c) 2020 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__() - - self.p1_dst_start_mac = u"02:02:00:00:12:00" - - self.p2_dst_start_mac = u"02:02:00:00:02:00" - - # IPs used in packet headers. - self.p1_src_start_ip = u"10.0.0.1" - self.p1_dst_start_ip = u"20.0.0.0" - self.p1_dst_end_ip = u"20.0.234.95" - - self.p2_src_start_ip = u"20.0.0.1" - self.p2_dst_start_ip = u"10.0.0.0" - self.p2_dst_end_ip = u"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( - dst=self.p1_dst_start_mac - ) / - IP( - src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61 - ) - ) - # Direction 1 --> 0 - base_pkt_b = ( - Ether( - dst=self.p2_dst_start_mac - ) / - IP( - src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=1, - size=1, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=5 - ), - STLVmFlowVar( - name=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=1, - size=1, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=5 - ), - STLVmFlowVar( - name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"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-ip4dst60000-4cnf.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst60000-4cnf.py deleted file mode 100644 index 3fe3caf128..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst60000-4cnf.py +++ /dev/null @@ -1,157 +0,0 @@ -# Copyright (c) 2020 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__() - - self.p1_dst_start_mac = u"02:02:00:00:12:00" - - self.p2_dst_start_mac = u"02:02:00:00:02:00" - - # IPs used in packet headers. - self.p1_src_start_ip = u"10.0.0.1" - self.p1_dst_start_ip = u"20.0.0.0" - self.p1_dst_end_ip = u"20.0.234.95" - - self.p2_src_start_ip = u"20.0.0.1" - self.p2_dst_start_ip = u"10.0.0.0" - self.p2_dst_end_ip = u"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( - dst=self.p1_dst_start_mac - ) / - IP( - src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61 - ) - ) - # Direction 1 --> 0 - base_pkt_b = ( - Ether( - dst=self.p2_dst_start_mac - ) / - IP( - src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=3, - size=1, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=5 - ), - STLVmFlowVar( - name=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=3, - size=1, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=5 - ), - STLVmFlowVar( - name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"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-ip4dst60000-8cnf.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst60000-8cnf.py deleted file mode 100644 index 84bfb89f0b..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst60000-8cnf.py +++ /dev/null @@ -1,157 +0,0 @@ -# Copyright (c) 2020 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__() - - self.p1_dst_start_mac = u"02:02:00:00:12:00" - - self.p2_dst_start_mac = u"02:02:00:00:02:00" - - # IPs used in packet headers. - self.p1_src_start_ip = u"10.0.0.1" - self.p1_dst_start_ip = u"20.0.0.0" - self.p1_dst_end_ip = u"20.0.234.95" - - self.p2_src_start_ip = u"20.0.0.1" - self.p2_dst_start_ip = u"10.0.0.0" - self.p2_dst_end_ip = u"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( - dst=self.p1_dst_start_mac - ) / - IP( - src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61 - ) - ) - # Direction 1 --> 0 - base_pkt_b = ( - Ether( - dst=self.p2_dst_start_mac - ) / - IP( - src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=7, - size=1, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=5 - ), - STLVmFlowVar( - name=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=7, - size=1, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset=5 - ), - STLVmFlowVar( - name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"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-ip4dst60000.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst60000.py deleted file mode 100644 index 126302d545..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst60000.py +++ /dev/null @@ -1,126 +0,0 @@ -# Copyright (c) 2020 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 = u"10.0.0.1" - self.p1_dst_start_ip = u"20.0.0.0" - self.p1_dst_end_ip = u"20.0.234.95" - - self.p2_src_start_ip = u"20.0.0.1" - self.p2_dst_start_ip = u"10.0.0.0" - self.p2_dst_end_ip = u"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=u"dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"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-ip4src253.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4src253.py deleted file mode 100644 index 883883ad18..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4src253.py +++ /dev/null @@ -1,126 +0,0 @@ -# Copyright (c) 2020 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.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 = u"10.10.10.2" - self.p1_src_end_ip = u"10.10.10.254" - self.p1_dst_start_ip = u"20.20.20.2" - - self.p2_src_start_ip = u"20.20.20.2" - self.p2_src_end_ip = u"20.20.20.254" - self.p2_dst_start_ip = u"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=u"src", - min_value=self.p1_src_start_ip, - max_value=self.p1_src_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"src", - pkt_offset=u"IP.src" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"src", - min_value=self.p2_src_start_ip, - max_value=self.p2_src_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"src", - pkt_offset=u"IP.src" - ), - STLVmFixIpv4( - offset=u"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-ip4src254.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4src254.py deleted file mode 100644 index fc6167d126..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-ip4src254.py +++ /dev/null @@ -1,126 +0,0 @@ -# Copyright (c) 2020 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.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 = u"10.10.10.1" - self.p1_src_end_ip = u"10.10.10.254" - self.p1_dst_start_ip = u"20.20.20.1" - - self.p2_src_start_ip = u"20.20.20.1" - self.p2_src_end_ip = u"20.20.20.254" - self.p2_dst_start_ip = u"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=u"src", - min_value=self.p1_src_start_ip, - max_value=self.p1_src_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"src", - pkt_offset=u"IP.src" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"src", - min_value=self.p2_src_start_ip, - max_value=self.p2_src_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"src", - pkt_offset=u"IP.src" - ), - STLVmFixIpv4( - offset=u"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-macsrc100ip4src100.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-macsrc100ip4src100.py deleted file mode 100644 index b94c56ad6c..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-macsrc100ip4src100.py +++ /dev/null @@ -1,161 +0,0 @@ -# Copyright (c) 2020 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 MAC address range: ca:fe:00:00:00:00 - ca:fe:00:00:00:63 - - Source IP address range: 10.0.0.2 - 10.0.0.101 - - Destination IP address range: 20.0.0.1 - - Direction 1 --> 0: - - Source MAC address range: fa:ce:00:00:00:00 - fa:ce:00:00:00:63 - - Source IP address range: 20.0.0.2 - 20.0.0.101 - - Destination IP address range: 10.0.0.1 -""" - -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__() - - self.clients = 100 - - # MACs used in packet headers. - self.p1_src_start_mac = u"ca:fe:00:00:00:00" # mask: 00:00:FF:FF:FF:FF - - self.p2_src_start_mac = u"fa:ce:00:00:00:00" # mask: 00:00:FF:FF:FF:FF - - # IPs used in packet headers. - self.p1_src_start_ip = u"10.0.0.2" - self.p1_src_end_ip = u"10.0.0.101" - self.p1_dst_start_ip = u"20.0.0.1" - - self.p2_src_start_ip = u"20.0.0.2" - self.p2_src_end_ip = u"20.0.0.101" - self.p2_dst_start_ip = u"10.0.0.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( - src=self.p1_src_start_mac - ) / - IP( - src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61 - ) - ) - # Direction 1 --> 0 - base_pkt_b = ( - Ether( - src=self.p2_src_start_mac - ) / - IP( - src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_src", - min_value=0, - max_value=self.clients-1, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_src", - pkt_offset=8 - ), - STLVmFlowVar( - name=u"src", - min_value=self.p1_src_start_ip, - max_value=self.p1_src_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"src", - pkt_offset=u"IP.src" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_src", - min_value=0, - max_value=self.clients-1, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_src", - pkt_offset=8 - ), - STLVmFlowVar( - name=u"src", - min_value=self.p2_src_start_ip, - max_value=self.p2_src_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"src", - pkt_offset=u"IP.src" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - - return base_pkt_a, base_pkt_b, vm1, vm2 - - -def register(): - """Register this traffic profile to T-rex. - - Do not change this function. - - :returns: Traffic streams. - :rtype: Object - """ - return TrafficStreams() diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-macsrc100kip4src100k.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-macsrc100kip4src100k.py deleted file mode 100644 index 52eb841ab0..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-macsrc100kip4src100k.py +++ /dev/null @@ -1,161 +0,0 @@ -# Copyright (c) 2020 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 MAC address range: ca:fe:00:00:00:00 - ca:fe:00:01:86:9f - - Source IP address range: 10.0.0.2 - 10.1.134.161 - - Destination IP address range: 20.0.0.1 - - Direction 1 --> 0: - - Source MAC address range: fa:ce:00:00:00:00 - fa:ce:00:01:86:9f - - Source IP address range: 20.0.0.2 - 20.1.134.161 - - Destination IP address range: 10.0.0.1 -""" - -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__() - - self.clients = 100000 - - # MACs used in packet headers. - self.p1_src_start_mac = u"ca:fe:00:00:00:00" # mask: 00:00:FF:FF:FF:FF - - self.p2_src_start_mac = u"fa:ce:00:00:00:00" # mask: 00:00:FF:FF:FF:FF - - # IPs used in packet headers. - self.p1_src_start_ip = u"10.0.0.2" - self.p1_src_end_ip = u"10.1.134.161" - self.p1_dst_start_ip = u"20.0.0.1" - - self.p2_src_start_ip = u"20.0.0.2" - self.p2_src_end_ip = u"20.1.134.161" - self.p2_dst_start_ip = u"10.0.0.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( - src=self.p1_src_start_mac - ) / - IP( - src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61 - ) - ) - # Direction 1 --> 0 - base_pkt_b = ( - Ether( - src=self.p2_src_start_mac - ) / - IP( - src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_src", - min_value=0, - max_value=self.clients-1, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_src", - pkt_offset=8 - ), - STLVmFlowVar( - name=u"src", - min_value=self.p1_src_start_ip, - max_value=self.p1_src_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"src", - pkt_offset=u"IP.src" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_src", - min_value=0, - max_value=self.clients-1, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_src", - pkt_offset=8 - ), - STLVmFlowVar( - name=u"src", - min_value=self.p2_src_start_ip, - max_value=self.p2_src_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"src", - pkt_offset=u"IP.src" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - - return base_pkt_a, base_pkt_b, vm1, vm2 - - -def register(): - """Register this traffic profile to T-rex. - - Do not change this function. - - :returns: Traffic streams. - :rtype: Object - """ - return TrafficStreams() diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-macsrc10kip4src10k.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-macsrc10kip4src10k.py deleted file mode 100644 index 8e959c829d..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-macsrc10kip4src10k.py +++ /dev/null @@ -1,161 +0,0 @@ -# Copyright (c) 2020 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 MAC address range: ca:fe:00:00:00:00 - ca:fe:00:00:27:0f - - Source IP address range: 10.0.0.2 - 10.0.39.17 - - Destination IP address range: 20.0.0.1 - - Direction 1 --> 0: - - Source MAC address range: fa:ce:00:00:00:00 - fa:ce:00:00:27:0f - - Source IP address range: 20.0.0.2 - 20.0.39.17 - - Destination IP address range: 10.0.0.1 -""" - -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__() - - self.clients = 10000 - - # MACs used in packet headers. - self.p1_src_start_mac = u"ca:fe:00:00:00:00" # mask: 00:00:FF:FF:FF:FF - - self.p2_src_start_mac = u"fa:ce:00:00:00:00" # mask: 00:00:FF:FF:FF:FF - - # IPs used in packet headers. - self.p1_src_start_ip = u"10.0.0.2" - self.p1_src_end_ip = u"10.0.39.17" - self.p1_dst_start_ip = u"20.0.0.1" - - self.p2_src_start_ip = u"20.0.0.2" - self.p2_src_end_ip = u"20.0.39.17" - self.p2_dst_start_ip = u"10.0.0.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( - src=self.p1_src_start_mac - ) / - IP( - src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61 - ) - ) - # Direction 1 --> 0 - base_pkt_b = ( - Ether( - src=self.p2_src_start_mac - ) / - IP( - src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_src", - min_value=0, - max_value=self.clients-1, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_src", - pkt_offset=8 - ), - STLVmFlowVar( - name=u"src", - min_value=self.p1_src_start_ip, - max_value=self.p1_src_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"src", - pkt_offset=u"IP.src" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_src", - min_value=0, - max_value=self.clients-1, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_src", - pkt_offset=8 - ), - STLVmFlowVar( - name=u"src", - min_value=self.p2_src_start_ip, - max_value=self.p2_src_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"src", - pkt_offset=u"IP.src" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - - return base_pkt_a, base_pkt_b, vm1, vm2 - - -def register(): - """Register this traffic profile to T-rex. - - Do not change this function. - - :returns: Traffic streams. - :rtype: Object - """ - return TrafficStreams() diff --git a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-macsrc500kdst500k.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-macsrc500kdst500k.py deleted file mode 100644 index da4348f2a0..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-macsrc500kdst500k.py +++ /dev/null @@ -1,215 +0,0 @@ -# Copyright (c) 2020 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 MAC address range: ca:fe:00:00:00:00 - ca:fe:00:07:a1:1f - - Destination MAC address range: fa:ce:00:00:00:00 - fa:ce:00:07:a1:1f - - Source IP address range: 10.0.0.0 - 10.7.161.31 - - Destination IP address range: 20.0.0.0 - 20.7.161.31 - - Direction 1 --> 0: - - Source MAC address range: fa:ce:00:00:00:00 - fa:ce:00:07:a1:1f - - Destination MAC address range: ca:fe:00:00:00:00 - ca:fe:00:07:a1:1f - - Source IP address range: 20.0.0.0 - 20.7.161.31 - - Destination IP address range: 10.0.0.0 - 10.7.161.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__() - - self.clients = 500000 - - # MACs used in packet headers. - self.p1_src_start_mac = u"ca:fe:00:00:00:00" # mask: 00:00:FF:FF:FF:FF - self.p1_dst_start_mac = u"fa:ce:00:00:00:00" # mask: 00:00:FF:FF:FF:FF - - self.p2_src_start_mac = u"fa:ce:00:00:00:00" # mask: 00:00:FF:FF:FF:FF - self.p2_dst_start_mac = u"ca:fe:00:00:00:00" # mask: 00:00:FF:FF:FF:FF - - # IPs used in packet headers. - self.p1_src_start_ip = u"10.0.0.0" - self.p1_src_end_ip = u"10.7.161.31" - - self.p1_dst_start_ip = u"20.0.0.0" - self.p1_dst_end_ip = u"20.7.161.31" - - self.p2_src_start_ip = u"20.0.0.0" - self.p2_src_end_ip = u"20.7.161.31" - - self.p2_dst_start_ip = u"10.0.0.0" - self.p2_dst_end_ip = u"10.7.161.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( - src=self.p1_src_start_mac, - dst=self.p1_dst_start_mac - ) / - IP( - src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61 - ) - ) - # Direction 1 --> 0 - base_pkt_b = ( - Ether( - src=self.p2_src_start_mac, - dst=self.p2_dst_start_mac - ) / - IP( - src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_src", - min_value=0, - max_value=self.clients-1, - size=4, - op=u"inc" - ), - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=self.clients-1, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_src", - pkt_offset= 8 - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset= 2 - ), - STLVmFlowVar( - name=u"ip_src", - min_value=self.p1_src_start_ip, - max_value=self.p1_src_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"ip_src", - pkt_offset=u"IP.src" - ), - STLVmFlowVar( - name=u"ip_dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"ip_dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_src", - min_value=0, - max_value=self.clients-1, - size=4, - op=u"inc" - ), - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=self.clients-1, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_src", - pkt_offset= 8 - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset= 2 - ), - STLVmFlowVar( - name=u"ip_src", - min_value=self.p2_src_start_ip, - max_value=self.p2_src_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"ip_src", - pkt_offset=u"IP.src" - ), - STLVmFlowVar( - name=u"ip_dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"ip_dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"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-macsrc50kdst50k.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-macsrc50kdst50k.py deleted file mode 100644 index 6cf066367b..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-macsrc50kdst50k.py +++ /dev/null @@ -1,215 +0,0 @@ -# Copyright (c) 2020 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 MAC address range: ca:fe:00:00:00:00 - ca:fe:00:00:c3:4f - - Destination MAC address range: fa:ce:00:00:00:00 - fa:ce:00:00:c3:4f - - Source IP address range: 10.0.0.0 - 10.0.195.79 - - Destination IP address range: 20.0.0.0 - 20.0.195.79 - - Direction 1 --> 0: - - Source MAC address range: fa:ce:00:00:00:00 - fa:ce:00:00:c3:4f - - Destination MAC address range: ca:fe:00:00:00:00 - ca:fe:00:00:c3:4f - - Source IP address range: 20.0.0.0 - 20.0.195.79 - - Destination IP address range: 10.0.0.0 - 10.0.195.79 -""" - -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__() - - self.clients = 50000 - - # MACs used in packet headers. - self.p1_src_start_mac = u"ca:fe:00:00:00:00" # mask: 00:00:FF:FF:FF:FF - self.p1_dst_start_mac = u"fa:ce:00:00:00:00" # mask: 00:00:FF:FF:FF:FF - - self.p2_src_start_mac = u"fa:ce:00:00:00:00" # mask: 00:00:FF:FF:FF:FF - self.p2_dst_start_mac = u"ca:fe:00:00:00:00" # mask: 00:00:FF:FF:FF:FF - - # IPs used in packet headers. - self.p1_src_start_ip = u"10.0.0.0" - self.p1_src_end_ip = u"10.0.195.79" - - self.p1_dst_start_ip = u"20.0.0.0" - self.p1_dst_end_ip = u"20.0.195.79" - - self.p2_src_start_ip = u"20.0.0.0" - self.p2_src_end_ip = u"20.0.195.79" - - self.p2_dst_start_ip = u"10.0.0.0" - self.p2_dst_end_ip = u"10.0.195.79" - - 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( - src=self.p1_src_start_mac, - dst=self.p1_dst_start_mac - ) / - IP( - src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61 - ) - ) - # Direction 1 --> 0 - base_pkt_b = ( - Ether( - src=self.p2_src_start_mac, - dst=self.p2_dst_start_mac - ) / - IP( - src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_src", - min_value=0, - max_value=self.clients-1, - size=4, - op=u"inc" - ), - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=self.clients-1, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_src", - pkt_offset= 8 - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset= 2 - ), - STLVmFlowVar( - name=u"ip_src", - min_value=self.p1_src_start_ip, - max_value=self.p1_src_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"ip_src", - pkt_offset=u"IP.src" - ), - STLVmFlowVar( - name=u"ip_dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"ip_dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_src", - min_value=0, - max_value=self.clients-1, - size=4, - op=u"inc" - ), - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=self.clients-1, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_src", - pkt_offset= 8 - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset= 2 - ), - STLVmFlowVar( - name=u"ip_src", - min_value=self.p2_src_start_ip, - max_value=self.p2_src_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"ip_src", - pkt_offset=u"IP.src" - ), - STLVmFlowVar( - name=u"ip_dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"ip_dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"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-macsrc5kdst5k.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4-macsrc5kdst5k.py deleted file mode 100644 index 29df3373d3..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4-macsrc5kdst5k.py +++ /dev/null @@ -1,215 +0,0 @@ -# Copyright (c) 2020 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 MAC address range: ca:fe:00:00:00:00 - ca:fe:00:00:13:87 - - Destination MAC address range: fa:ce:00:00:00:00 - fa:ce:00:00:13:87 - - Source IP address range: 10.0.0.0 - 10.0.19.135 - - Destination IP address range: 20.0.0.0 - 20.0.19.135 - - Direction 1 --> 0: - - Source MAC address range: fa:ce:00:00:00:00 - fa:ce:00:00:13:87 - - Destination MAC address range: ca:fe:00:00:00:00 - ca:fe:00:00:13:87 - - Source IP address range: 20.0.0.0 - 20.0.19.135 - - Destination IP address range: 10.0.0.0 - 10.0.19.135 -""" - -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__() - - self.clients = 5000 - - # MACs used in packet headers. - self.p1_src_start_mac = u"ca:fe:00:00:00:00" # mask: 00:00:FF:FF:FF:FF - self.p1_dst_start_mac = u"fa:ce:00:00:00:00" # mask: 00:00:FF:FF:FF:FF - - self.p2_src_start_mac = u"fa:ce:00:00:00:00" # mask: 00:00:FF:FF:FF:FF - self.p2_dst_start_mac = u"ca:fe:00:00:00:00" # mask: 00:00:FF:FF:FF:FF - - # IPs used in packet headers. - self.p1_src_start_ip = u"10.0.0.0" - self.p1_src_end_ip = u"10.0.19.135" - - self.p1_dst_start_ip = u"20.0.0.0" - self.p1_dst_end_ip = u"20.0.19.135" - - self.p2_src_start_ip = u"20.0.0.0" - self.p2_src_end_ip = u"20.0.19.135" - - self.p2_dst_start_ip = u"10.0.0.0" - self.p2_dst_end_ip = u"10.0.19.135" - - 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( - src=self.p1_src_start_mac, - dst=self.p1_dst_start_mac - ) / - IP( - src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61 - ) - ) - # Direction 1 --> 0 - base_pkt_b = ( - Ether( - src=self.p2_src_start_mac, - dst=self.p2_dst_start_mac - ) / - IP( - src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_src", - min_value=0, - max_value=self.clients-1, - size=4, - op=u"inc" - ), - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=self.clients-1, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_src", - pkt_offset= 8 - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset= 2 - ), - STLVmFlowVar( - name=u"ip_src", - min_value=self.p1_src_start_ip, - max_value=self.p1_src_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"ip_src", - pkt_offset=u"IP.src" - ), - STLVmFlowVar( - name=u"ip_dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"ip_dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"mac_src", - min_value=0, - max_value=self.clients-1, - size=4, - op=u"inc" - ), - STLVmFlowVar( - name=u"mac_dst", - min_value=0, - max_value=self.clients-1, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"mac_src", - pkt_offset= 8 - ), - STLVmWrFlowVar( - fv_name=u"mac_dst", - pkt_offset= 2 - ), - STLVmFlowVar( - name=u"ip_src", - min_value=self.p2_src_start_ip, - max_value=self.p2_src_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"ip_src", - pkt_offset=u"IP.src" - ), - STLVmFlowVar( - name=u"ip_dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"ip_dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"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-ethip4udp-1000u15p.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4udp-1000u15p.py deleted file mode 100644 index b7b364f195..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4udp-1000u15p.py +++ /dev/null @@ -1,148 +0,0 @@ -# Copyright (c) 2020 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.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 = u"20.0.0.0" - self.p1_src_end_ip = u"20.0.3.231" - self.p1_dst_start_ip = u"12.0.0.2" - - self.p2_src_start_ip = u"12.0.0.2" - self.p2_src_end_ip = u"12.0.0.2" - self.p2_dst_start_ip = u"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=u"tuple" - ), - STLVmWrFlowVar( - fv_name=u"tuple.ip", - pkt_offset=u"IP.src" - ), - STLVmFixIpv4( - offset=u"IP" - ), - STLVmWrFlowVar( - fv_name=u"tuple.port", - pkt_offset=u"UDP.sport" - ) - ] - ) - # Direction 0 --> 1 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"dport", - min_value=self.p2_dst_start_udp_port, - max_value=self.p2_dst_end_udp_port, - size=2, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dport", - pkt_offset=u"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/traffic_profiles/trex/trex-sl-3n-ethip4udp-100u1000p-conc.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4udp-100u1000p-conc.py deleted file mode 100644 index b93cd645ae..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4udp-100u1000p-conc.py +++ /dev/null @@ -1,189 +0,0 @@ -# Copyright (c) 2020 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: 10.10.10.2 - 10.10.10.101 - - Destination IP address range: 20.20.20.2 - 20.20.20.101 - - Source UDP port range: 1001 - 2000 - - Destination UDP port range: 2001 - 3000 - - Direction 1 --> 0: - - Source IP address range: 20.20.20.2 - 20.20.20.101 - - Destination IP address range: 10.10.10.2 - 10.10.10.101 - - Source UDP port range: 2001 - 3000 - - Destination UDP port range: 1001 - 2000 -""" - -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 = u"10.10.10.2" - self.p1_src_end_ip = u"10.10.10.101" - self.p1_dst_start_ip = u"20.20.20.2" - self.p1_dst_end_ip = u"20.20.20.101" - - self.p2_src_start_ip = u"20.20.20.2" - self.p2_src_end_ip = u"20.20.20.101" - self.p2_dst_start_ip = u"10.10.10.2" - self.p2_dst_end_ip = u"10.10.10.101" - - # UDP ports used in packet headers. - self.p1_src_start_udp_port = 1001 - self.p1_src_end_udp_port = 2000 - self.p1_dst_start_udp_port = 2001 - self.p1_dst_end_udp_port = 3000 - - self.p2_src_start_udp_port = 2001 - self.p2_src_end_udp_port = 3000 - self.p2_dst_start_udp_port = 1001 - self.p2_dst_end_udp_port = 2000 - - 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=u"tuple1_src" - ), - STLVmTupleGen( - ip_min=self.p1_dst_start_ip, - ip_max=self.p1_dst_end_ip, - port_min=self.p1_dst_start_udp_port, - port_max=self.p1_dst_end_udp_port, - name=u"tuple1_dst" - ), - STLVmWrFlowVar( - fv_name=u"tuple1_src.ip", - pkt_offset=u"IP.src" - ), - STLVmWrFlowVar( - fv_name=u"tuple1_dst.ip", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ), - STLVmWrFlowVar( - fv_name=u"tuple1_src.port", - pkt_offset=u"UDP.sport" - ), - STLVmWrFlowVar( - fv_name=u"tuple1_dst.port", - pkt_offset=u"UDP.dport" - ) - ] - ) - # Direction 0 --> 1 - vm2 = STLScVmRaw( - [ - STLVmTupleGen( - ip_min=self.p2_src_start_ip, - ip_max=self.p2_src_end_ip, - port_min=self.p2_src_start_udp_port, - port_max=self.p2_src_end_udp_port, - name=u"tuple2_src" - ), - STLVmTupleGen( - ip_min=self.p2_dst_start_ip, - ip_max=self.p2_dst_end_ip, - port_min=self.p2_dst_start_udp_port, - port_max=self.p2_dst_end_udp_port, - name=u"tuple2_dst" - ), - STLVmWrFlowVar( - fv_name=u"tuple2_src.ip", - pkt_offset=u"IP.src" - ), - STLVmWrFlowVar( - fv_name=u"tuple2_dst.ip", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ), - STLVmWrFlowVar( - fv_name=u"tuple2_src.port", - pkt_offset=u"UDP.sport" - ), - STLVmWrFlowVar( - fv_name=u"tuple2_dst.port", - pkt_offset=u"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/traffic_profiles/trex/trex-sl-3n-ethip4udp-100u15p.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4udp-100u15p.py deleted file mode 100644 index 31cdc5e628..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4udp-100u15p.py +++ /dev/null @@ -1,148 +0,0 @@ -# Copyright (c) 2020 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.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 = u"20.0.0.0" - self.p1_src_end_ip = u"20.0.0.99" - self.p1_dst_start_ip = u"12.0.0.2" - - self.p2_src_start_ip = u"12.0.0.2" - self.p2_src_end_ip = u"12.0.0.2" - self.p2_dst_start_ip = u"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=u"tuple" - ), - STLVmWrFlowVar( - fv_name=u"tuple.ip", - pkt_offset=u"IP.src" - ), - STLVmFixIpv4( - offset=u"IP" - ), - STLVmWrFlowVar( - fv_name=u"tuple.port", - pkt_offset=u"UDP.sport" - ) - ] - ) - # Direction 0 --> 1 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"dport", - min_value=self.p2_dst_start_udp_port, - max_value=self.p2_dst_end_udp_port, - size=2, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dport", - pkt_offset=u"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/traffic_profiles/trex/trex-sl-3n-ethip4udp-10u1000p-conc.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4udp-10u1000p-conc.py deleted file mode 100644 index 9032a8c2f5..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4udp-10u1000p-conc.py +++ /dev/null @@ -1,189 +0,0 @@ -# Copyright (c) 2020 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: 10.10.10.2 - 10.10.10.11 - - Destination IP address range: 20.20.20.2 - 20.20.20.11 - - Source UDP port range: 1001 - 2000 - - Destination UDP port range: 2001 - 3000 - - Direction 1 --> 0: - - Source IP address range: 20.20.20.2 - 20.20.20.11 - - Destination IP address range: 10.10.10.2 - 10.10.10.11 - - Source UDP port range: 2001 - 3000 - - Destination UDP port range: 1001 - 2000 -""" - -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 = u"10.10.10.2" - self.p1_src_end_ip = u"10.10.10.11" - self.p1_dst_start_ip = u"20.20.20.2" - self.p1_dst_end_ip = u"20.20.20.11" - - self.p2_src_start_ip = u"20.20.20.2" - self.p2_src_end_ip = u"20.20.20.11" - self.p2_dst_start_ip = u"10.10.10.2" - self.p2_dst_end_ip = u"10.10.10.11" - - # UDP ports used in packet headers. - self.p1_src_start_udp_port = 1001 - self.p1_src_end_udp_port = 2000 - self.p1_dst_start_udp_port = 2001 - self.p1_dst_end_udp_port = 3000 - - self.p2_src_start_udp_port = 2001 - self.p2_src_end_udp_port = 3000 - self.p2_dst_start_udp_port = 1001 - self.p2_dst_end_udp_port = 2000 - - 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=u"tuple1_src" - ), - STLVmTupleGen( - ip_min=self.p1_dst_start_ip, - ip_max=self.p1_dst_end_ip, - port_min=self.p1_dst_start_udp_port, - port_max=self.p1_dst_end_udp_port, - name=u"tuple1_dst" - ), - STLVmWrFlowVar( - fv_name=u"tuple1_src.ip", - pkt_offset=u"IP.src" - ), - STLVmWrFlowVar( - fv_name=u"tuple1_dst.ip", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ), - STLVmWrFlowVar( - fv_name=u"tuple1_src.port", - pkt_offset=u"UDP.sport" - ), - STLVmWrFlowVar( - fv_name=u"tuple1_dst.port", - pkt_offset=u"UDP.dport" - ) - ] - ) - # Direction 0 --> 1 - vm2 = STLScVmRaw( - [ - STLVmTupleGen( - ip_min=self.p2_src_start_ip, - ip_max=self.p2_src_end_ip, - port_min=self.p2_src_start_udp_port, - port_max=self.p2_src_end_udp_port, - name=u"tuple2_src" - ), - STLVmTupleGen( - ip_min=self.p2_dst_start_ip, - ip_max=self.p2_dst_end_ip, - port_min=self.p2_dst_start_udp_port, - port_max=self.p2_dst_end_udp_port, - name=u"tuple2_dst" - ), - STLVmWrFlowVar( - fv_name=u"tuple2_src.ip", - pkt_offset=u"IP.src" - ), - STLVmWrFlowVar( - fv_name=u"tuple2_dst.ip", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ), - STLVmWrFlowVar( - fv_name=u"tuple2_src.port", - pkt_offset=u"UDP.sport" - ), - STLVmWrFlowVar( - fv_name=u"tuple2_dst.port", - pkt_offset=u"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/traffic_profiles/trex/trex-sl-3n-ethip4udp-10u10p-conc.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4udp-10u10p-conc.py deleted file mode 100644 index 29433b3d27..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4udp-10u10p-conc.py +++ /dev/null @@ -1,189 +0,0 @@ -# Copyright (c) 2020 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: 10.10.10.2 - 10.10.10.11 - - Destination IP address range: 20.20.20.2 - 20.20.2011 - - Source UDP port range: 1001 - 1010 - - Destination UDP port range: 2001 - 2010 - - Direction 1 --> 0: - - Source IP address range: 20.20.20.2 - 20.20.20.11 - - Destination IP address range: 10.10.10.2 - 10.10.10.11 - - Source UDP port range: 2001 - 2010 - - Destination UDP port range: 1001 - 1010 -""" - -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 = u"10.10.10.2" - self.p1_src_end_ip = u"10.10.10.11" - self.p1_dst_start_ip = u"20.20.20.2" - self.p1_dst_end_ip = u"20.20.20.11" - - self.p2_src_start_ip = u"20.20.20.2" - self.p2_src_end_ip = u"20.20.20.11" - self.p2_dst_start_ip = u"10.10.10.2" - self.p2_dst_end_ip = u"10.10.10.11" - - # UDP ports used in packet headers. - self.p1_src_start_udp_port = 1001 - self.p1_src_end_udp_port = 1010 - self.p1_dst_start_udp_port = 2001 - self.p1_dst_end_udp_port = 2010 - - self.p2_src_start_udp_port = 2001 - self.p2_src_end_udp_port = 2010 - self.p2_dst_start_udp_port = 1001 - self.p2_dst_end_udp_port = 1010 - - 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=u"tuple1_src" - ), - STLVmTupleGen( - ip_min=self.p1_dst_start_ip, - ip_max=self.p1_dst_end_ip, - port_min=self.p1_dst_start_udp_port, - port_max=self.p1_dst_end_udp_port, - name=u"tuple1_dst" - ), - STLVmWrFlowVar( - fv_name=u"tuple1_src.ip", - pkt_offset=u"IP.src" - ), - STLVmWrFlowVar( - fv_name=u"tuple1_dst.ip", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ), - STLVmWrFlowVar( - fv_name=u"tuple1_src.port", - pkt_offset=u"UDP.sport" - ), - STLVmWrFlowVar( - fv_name=u"tuple1_dst.port", - pkt_offset=u"UDP.dport" - ) - ] - ) - # Direction 0 --> 1 - vm2 = STLScVmRaw( - [ - STLVmTupleGen( - ip_min=self.p2_src_start_ip, - ip_max=self.p2_src_end_ip, - port_min=self.p2_src_start_udp_port, - port_max=self.p2_src_end_udp_port, - name=u"tuple2_src" - ), - STLVmTupleGen( - ip_min=self.p2_dst_start_ip, - ip_max=self.p2_dst_end_ip, - port_min=self.p2_dst_start_udp_port, - port_max=self.p2_dst_end_udp_port, - name=u"tuple2_dst" - ), - STLVmWrFlowVar( - fv_name=u"tuple2_src.ip", - pkt_offset=u"IP.src" - ), - STLVmWrFlowVar( - fv_name=u"tuple2_dst.ip", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ), - STLVmWrFlowVar( - fv_name=u"tuple2_src.port", - pkt_offset=u"UDP.sport" - ), - STLVmWrFlowVar( - fv_name=u"tuple2_dst.port", - pkt_offset=u"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/traffic_profiles/trex/trex-sl-3n-ethip4udp-10u15p.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4udp-10u15p.py deleted file mode 100644 index 57c5b2dcbc..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4udp-10u15p.py +++ /dev/null @@ -1,148 +0,0 @@ -# Copyright (c) 2020 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.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 = u"20.0.0.0" - self.p1_src_end_ip = u"20.0.0.9" - self.p1_dst_start_ip = u"12.0.0.2" - - self.p2_src_start_ip = u"12.0.0.2" - #self.p2_src_end_ip = u"12.0.0.2" - self.p2_dst_start_ip = u"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=u"tuple" - ), - STLVmWrFlowVar( - fv_name=u"tuple.ip", - pkt_offset=u"IP.src" - ), - STLVmFixIpv4( - offset=u"IP" - ), - STLVmWrFlowVar( - fv_name=u"tuple.port", - pkt_offset=u"UDP.sport" - ) - ] - ) - # Direction 0 --> 1 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"dport", - min_value=self.p2_dst_start_udp_port, - max_value=self.p2_dst_end_udp_port, - size=2, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dport", - pkt_offset=u"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/traffic_profiles/trex/trex-sl-3n-ethip4udp-1u15p.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4udp-1u15p.py deleted file mode 100644 index df9a1642a9..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4udp-1u15p.py +++ /dev/null @@ -1,141 +0,0 @@ -# Copyright (c) 2020 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.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 = u"20.0.0.0" - self.p1_src_end_ip = u"20.0.0.0" - self.p1_dst_start_ip = u"12.0.0.2" - - self.p2_src_start_ip = u"12.0.0.2" - self.p2_src_end_ip = u"12.0.0.2" - self.p2_dst_start_ip = u"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=u"sport", - min_value=self.p1_src_start_udp_port, - max_value=self.p1_src_end_udp_port, - size=2, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"sport", - pkt_offset=u"UDP.sport" - ) - ] - ) - # Direction 0 --> 1 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"dport", - min_value=self.p2_dst_start_udp_port, - max_value=self.p2_dst_end_udp_port, - size=2, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dport", - pkt_offset=u"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/traffic_profiles/trex/trex-sl-3n-ethip4udp-1u1p.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4udp-1u1p.py deleted file mode 100644 index a892ec8822..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4udp-1u1p.py +++ /dev/null @@ -1,104 +0,0 @@ -# Copyright (c) 2020 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.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 = u"20.0.0.0" - self.p1_dst_ip = u"12.0.0.2" - - self.p2_src_ip = u"12.0.0.2" - self.p2_dst_ip = u"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/traffic_profiles/trex/trex-sl-3n-ethip4udp-2000u15p.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4udp-2000u15p.py deleted file mode 100644 index c96f76aaee..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4udp-2000u15p.py +++ /dev/null @@ -1,148 +0,0 @@ -# Copyright (c) 2020 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.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 = u"20.0.0.0" - self.p1_src_end_ip = u"20.0.7.207" - self.p1_dst_start_ip = u"12.0.0.2" - - self.p2_src_start_ip = u"12.0.0.2" - self.p2_src_end_ip = u"12.0.0.2" - self.p2_dst_start_ip = u"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=u"tuple" - ), - STLVmWrFlowVar( - fv_name=u"tuple.ip", - pkt_offset=u"IP.src" - ), - STLVmFixIpv4( - offset=u"IP" - ), - STLVmWrFlowVar( - fv_name=u"tuple.port", - pkt_offset=u"UDP.sport" - ) - ] - ) - # Direction 0 --> 1 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"dport", - min_value=self.p2_dst_start_udp_port, - max_value=self.p2_dst_end_udp_port, - size=2, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dport", - pkt_offset=u"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/traffic_profiles/trex/trex-sl-3n-ethip4udp-4000u15p.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip4udp-4000u15p.py deleted file mode 100644 index c1b3d5ba59..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip4udp-4000u15p.py +++ /dev/null @@ -1,148 +0,0 @@ -# Copyright (c) 2020 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.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 = u"20.0.0.0" - self.p1_src_end_ip = u"20.0.15.159" - self.p1_dst_start_ip = u"12.0.0.2" - - self.p2_src_start_ip = u"12.0.0.2" - self.p2_src_end_ip = u"12.0.0.2" - self.p2_dst_start_ip = u"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=u"tuple" - ), - STLVmWrFlowVar( - fv_name=u"tuple.ip", - pkt_offset=u"IP.src" - ), - STLVmFixIpv4( - offset=u"IP" - ), - STLVmWrFlowVar( - fv_name=u"tuple.port", - pkt_offset=u"UDP.sport" - ) - ] - ) - # Direction 0 --> 1 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"dport", - min_value=self.p2_dst_start_udp_port, - max_value=self.p2_dst_end_udp_port, - size=2, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"dport", - pkt_offset=u"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/traffic_profiles/trex/trex-sl-3n-ethip6-ip6dst10000.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip6-ip6dst10000.py deleted file mode 100644 index f1b90350fb..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip6-ip6dst10000.py +++ /dev/null @@ -1,129 +0,0 @@ -# Copyright (c) 2020 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.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 = u"2001:1::1" - self.p1_dst_start_ip = u"2001:2::0" - self.p1_dst_end_ip = u"2001:2::270F" - - self.p2_src_start_ip = u"2001:2::1" - self.p2_dst_start_ip = u"2001:1::0" - self.p2_dst_end_ip = u"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=u"ipv6_dst", - min_value=base_p1, - max_value=base_p1 + count_p1, - size=8, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"ipv6_dst", - pkt_offset=u"IPv6.dst", - offset_fixup=8 - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"ipv6_dst", - min_value=base_p2, - max_value=base_p2 + count_p2, - size=8, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"ipv6_dst", - pkt_offset=u"IPv6.dst", - offset_fixup=8 - ) - ] - ) - - 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-ethip6-ip6dst100000.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip6-ip6dst100000.py deleted file mode 100644 index 87e76726b2..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip6-ip6dst100000.py +++ /dev/null @@ -1,129 +0,0 @@ -# Copyright (c) 2020 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.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 = u"2001:1::1" - self.p1_dst_start_ip = u"2001:2::0" - self.p1_dst_end_ip = u"2001:2::1:869F" - - self.p2_src_start_ip = u"2001:2::1" - self.p2_dst_start_ip = u"2001:1::0" - self.p2_dst_end_ip = u"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=u"ipv6_dst", - min_value=base_p1, - max_value=base_p1 + count_p1, - size=8, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"ipv6_dst", - pkt_offset=u"IPv6.dst", - offset_fixup=8 - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"ipv6_dst", - min_value=base_p2, - max_value=base_p2 + count_p2, - size=8, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"ipv6_dst", - pkt_offset=u"IPv6.dst", - offset_fixup=8 - ) - ] - ) - - 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-ethip6-ip6dst1000000.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip6-ip6dst1000000.py deleted file mode 100644 index c6870d89fa..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip6-ip6dst1000000.py +++ /dev/null @@ -1,129 +0,0 @@ -# Copyright (c) 2020 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.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 = u"2001:1::1" - self.p1_dst_start_ip = u"2001:2::0" - self.p1_dst_end_ip = u"2001:2::F:423F" - - self.p2_src_start_ip = u"2001:2::1" - self.p2_dst_start_ip = u"2001:1::0" - self.p2_dst_end_ip = u"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=u"ipv6_dst", - min_value=base_p1, - max_value=base_p1 + count_p1, - size=8, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"ipv6_dst", - pkt_offset=u"IPv6.dst", - offset_fixup=8 - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"ipv6_dst", - min_value=base_p2, - max_value=base_p2 + count_p2, - size=8, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"ipv6_dst", - pkt_offset=u"IPv6.dst", - offset_fixup=8 - ) - ] - ) - - 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-ethip6-ip6src253.py b/resources/traffic_profiles/trex/trex-sl-3n-ethip6-ip6src253.py deleted file mode 100644 index fbe8b94ab3..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-3n-ethip6-ip6src253.py +++ /dev/null @@ -1,129 +0,0 @@ -# Copyright (c) 2020 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.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 = u"2001:1::2" - self.p1_src_end_ip = u"2001:1::FE" - self.p1_dst_start_ip = u"2001:2::2" - - self.p2_src_start_ip = u"2001:2::2" - self.p2_src_end_ip = u"2001:2::FE" - self.p2_dst_start_ip = u"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=u"ipv6_src", - min_value=base_p1, - max_value=base_p1 + count_p1, - size=8, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"ipv6_src", - pkt_offset=u"IPv6.src", - offset_fixup=8 - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"ipv6_src", - min_value=base_p2, - max_value=base_p2 + count_p2, - size=8, - op=u"inc" - ), - STLVmWrFlowVar( - fv_name=u"ipv6_src", - pkt_offset=u"IPv6.src", - offset_fixup=8 - ) - ] - ) - - 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-dot1qip4-vlan1ip4src254ip4dst254-bvi.py b/resources/traffic_profiles/trex/trex-sl-dot1qip4-vlan1ip4src254ip4dst254-bvi.py deleted file mode 100644 index 28ec10bf8b..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-dot1qip4-vlan1ip4src254ip4dst254-bvi.py +++ /dev/null @@ -1,170 +0,0 @@ -# Copyright (c) 2020 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 / DOT1Q / IP / - - Direction 0 --> 1: - - Destination MAC address: ba:dc:00:ff:ee:01 - - VLAN range: 100 - - Source IP address range: 10.10.10.1 - 10.10.10.254 - - Destination IP address range: 20.20.20.1 - 20.20.20.254 - - Direction 1 --> 0: - - Destination MAC address: ba:dc:00:ff:ee:01 - - VLAN range: 200 - - Source IP address range: 20.20.20.1 - 20.20.20.254 - - Destination IP address range: 10.10.10.1 - 10.10.10.254 -""" - -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__() - - # VLAN IDs - self.p1_vlan_start = 100 - self.p2_vlan_start = 200 - - # IPs used in packet headers. - self.p1_src_start_ip = u"10.10.10.1" - self.p1_src_end_ip = u"10.10.10.254" - - self.p1_dst_start_ip = u"20.20.20.1" - self.p1_dst_end_ip = u"20.20.20.254" - - self.p2_src_start_ip = u"20.20.20.1" - self.p2_src_end_ip = u"20.20.20.254" - - self.p2_dst_start_ip = u"10.10.10.1" - self.p2_dst_end_ip = u"10.10.10.254" - - def define_packets(self): - """Defines the packets to be sent from the traffic generator. - - Packet definition: | ETH | DOT1Q | IP | - - :returns: Packets to be sent from the traffic generator. - :rtype: tuple - """ - - # Direction 0 --> 1 - base_pkt_a = ( - Ether( - dst=u"ba:dc:00:ff:ee:01" - ) / - Dot1Q( - vlan=self.p1_vlan_start - ) / - IP( - src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61 - ) - ) - # Direction 1 --> 0 - base_pkt_b = ( - Ether( - dst=u"ba:dc:00:ff:ee:01" - ) / - Dot1Q( - vlan=self.p2_vlan_start - ) / - IP( - src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"ip_src", - min_value=self.p1_src_start_ip, - max_value=self.p1_src_end_ip, - size=4, - op=u"random" - ), - STLVmWrFlowVar( - fv_name=u"ip_src", - pkt_offset=u"IP.src" - ), - STLVmFlowVar( - name=u"ip_dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, - op=u"random" - ), - STLVmWrFlowVar( - fv_name=u"ip_dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"ip_src", - min_value=self.p2_src_start_ip, - max_value=self.p2_src_end_ip, - size=4, - op=u"random" - ), - STLVmWrFlowVar( - fv_name=u"ip_src", - pkt_offset=u"IP.src" - ), - STLVmFlowVar( - name=u"ip_dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, - op=u"random" - ), - STLVmWrFlowVar( - fv_name=u"ip_dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - - return base_pkt_a, base_pkt_b, vm1, vm2 - - -def register(): - """Register this traffic profile to T-rex. - - Do not change this function. - - :returns: Traffic streams. - :rtype: Object - """ - return TrafficStreams() diff --git a/resources/traffic_profiles/trex/trex-sl-dot1qip4-vlan1ip4src254ip4dst254.py b/resources/traffic_profiles/trex/trex-sl-dot1qip4-vlan1ip4src254ip4dst254.py deleted file mode 100644 index 6ce351968c..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-dot1qip4-vlan1ip4src254ip4dst254.py +++ /dev/null @@ -1,164 +0,0 @@ -# Copyright (c) 2020 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 / DOT1Q / IP / - - Direction 0 --> 1: - - VLAN range: 100 - - Source IP address range: 10.10.10.1 - 10.10.10.254 - - Destination IP address range: 20.20.20.1 - 20.20.20.254 - - Direction 1 --> 0: - - VLAN range: 200 - - Source IP address range: 20.20.20.1 - 20.20.20.254 - - Destination IP address range: 10.10.10.1 - 10.10.10.254 -""" - -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__() - - # VLAN IDs - self.p1_vlan_start = 100 - self.p2_vlan_start = 200 - - # IPs used in packet headers. - self.p1_src_start_ip = u"10.10.10.1" - self.p1_src_end_ip = u"10.10.10.254" - - self.p1_dst_start_ip = u"20.20.20.1" - self.p1_dst_end_ip = u"20.20.20.254" - - self.p2_src_start_ip = u"20.20.20.1" - self.p2_src_end_ip = u"20.20.20.254" - - self.p2_dst_start_ip = u"10.10.10.1" - self.p2_dst_end_ip = u"10.10.10.254" - - def define_packets(self): - """Defines the packets to be sent from the traffic generator. - - Packet definition: | ETH | DOT1Q | IP | - - :returns: Packets to be sent from the traffic generator. - :rtype: tuple - """ - - # Direction 0 --> 1 - base_pkt_a = ( - Ether() / - Dot1Q( - vlan=self.p1_vlan_start - ) / - IP( - src=self.p1_src_start_ip, - dst=self.p1_dst_start_ip, - proto=61 - ) - ) - # Direction 1 --> 0 - base_pkt_b = ( - Ether() / - Dot1Q( - vlan=self.p2_vlan_start - ) / - IP( - src=self.p2_src_start_ip, - dst=self.p2_dst_start_ip, - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"ip_src", - min_value=self.p1_src_start_ip, - max_value=self.p1_src_end_ip, - size=4, - op=u"random" - ), - STLVmWrFlowVar( - fv_name=u"ip_src", - pkt_offset=u"IP.src" - ), - STLVmFlowVar( - name=u"ip_dst", - min_value=self.p1_dst_start_ip, - max_value=self.p1_dst_end_ip, - size=4, - op=u"random" - ), - STLVmWrFlowVar( - fv_name=u"ip_dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"ip_src", - min_value=self.p2_src_start_ip, - max_value=self.p2_src_end_ip, - size=4, - op=u"random" - ), - STLVmWrFlowVar( - fv_name=u"ip_src", - pkt_offset=u"IP.src" - ), - STLVmFlowVar( - name=u"ip_dst", - min_value=self.p2_dst_start_ip, - max_value=self.p2_dst_end_ip, - size=4, - op=u"random" - ), - STLVmWrFlowVar( - fv_name=u"ip_dst", - pkt_offset=u"IP.dst" - ), - STLVmFixIpv4( - offset=u"IP" - ) - ] - ) - - return base_pkt_a, base_pkt_b, vm1, vm2 - - -def register(): - """Register this traffic profile to T-rex. - - Do not change this function. - - :returns: Traffic streams. - :rtype: Object - """ - return TrafficStreams() diff --git a/resources/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src10udpsrcrnd.py b/resources/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src10udpsrcrnd.py deleted file mode 100644 index 32ca072154..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src10udpsrcrnd.py +++ /dev/null @@ -1,287 +0,0 @@ -# Copyright (c) 2020 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 / DOT1Q / IP / VXLAN / ETH / IP - - Direction 0 --> 1: - - VLAN range: 100 - - Source IP address: 172.17.[0..9].2 - - Destination IP address: 172.16.0.1 - - Source UDP port: random([1024..65535]) - - Destination UDP port: 4789 - - VXLAN VNI: [0..9] - - Payload source MAC address: 00:aa:aa:00:00:[00..ff] - - Payload source IP address: 10.0.[0..255].2 - - Payload destination MAC address: 00:bb:bb:00:00:[00..ff] - - Payload destination IP address: 10.0.[0..255].1 - - Direction 1 --> 0: - - VLAN range: 200 - - Source IP address: 172.27.[0..9].2 - - Destination IP address: 172.26.0.1 - - Source UDP port: random([1024..65535]) - - Destination UDP port: 4789 - - VXLAN VNI: [0..9] - - Payload source MAC address: 00:bb:bb:00:00:[00..ff] - - Payload source IP address: 10.0.[0..255].1 - - Payload destination MAC address: 00:aa:aa:00:00:[00..ff] - - Payload destination IP address: 10.0.[0..255].2 -""" - -from trex.stl.api import * -from profile_trex_stateless_base_class import TrafficStreamsBaseClass - -# RFC 7348 - Virtual eXtensible Local Area Network (VXLAN): -# A Framework for Overlaying Virtualized Layer 2 Networks over Layer 3 Networks -# http://tools.ietf.org/html/rfc7348 -_VXLAN_FLAGS = list(u"R"*24 + u"RRRIRRRRR") - - -class VXLAN(Packet): - name=u"VXLAN" - fields_desc = [ - FlagsField(u"flags", 0x08000000, 32, _VXLAN_FLAGS), - ThreeBytesField(u"vni", 0), - XByteField(u"reserved", 0x00) - ] - - def mysummary(self): - return self.sprintf(u"VXLAN (vni=%VXLAN.vni%)") - - -bind_layers(UDP, VXLAN, dport=4789) -bind_layers(VXLAN, Ether) - - -class TrafficStreams(TrafficStreamsBaseClass): - """Stream profile.""" - - def __init__(self): - """Initialization and setting of streams' parameters.""" - - super(TrafficStreamsBaseClass, self).__init__() - - self.nf_chains = 10 - - def define_packets(self): - """Defines the packets to be sent from the traffic generator. - - Packet definition: | ETH | DOT1Q | IP | VXLAN | ETH | IP - - :returns: Packets to be sent from the traffic generator. - :rtype: tuple - """ - - # Direction 0 --> 1 - base_pkt_a = ( - Ether()/ - Dot1Q( - vlan=100 - ) / - IP( - src=u"172.17.0.2", - dst=u"172.16.0.1" - )/ - UDP( - sport=1024, - dport=4789 - )/ - VXLAN( - vni=0 - )/ - Ether( - src=u"00:aa:aa:00:00:00", - dst=u"00:bb:bb:00:00:00" - )/ - IP( - src=u"10.0.0.2", - dst=u"10.0.0.1", - proto=61 - ) - ) - - # Direction 1 --> 0 - base_pkt_b = ( - Ether()/ - Dot1Q( - vlan=200 - ) / - IP( - src=u"172.27.0.2", - dst=u"172.26.0.1" - )/ - UDP( - sport=1024, - dport=4789 - )/ - VXLAN( - vni=0 - )/ - Ether( - src=u"00:bb:bb:00:00:00", - dst=u"00:aa:aa:00:00:00" - )/ - IP( - src=u"10.0.0.1", - dst=u"10.0.0.2", - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"nf_id", - size=1, - op=u"inc", - min_value=0, - max_value=self.nf_chains - 1 - ), - STLVmFlowVar( - name=u"in_mac", - size=2, - op=u"inc", - min_value=0, - max_value=255 - ), - STLVmFlowVar( - name=u"in_ip", - size=1, - op=u"inc", - min_value=0, - max_value=255 - ), - STLVmFlowVar( - name=u"src_port", - size=2, - op=u"random", - min_value=1024, - max_value=65535 - ), - STLVmWrFlowVar( - fv_name=u"nf_id", - pkt_offset=32 - ), - STLVmWrFlowVar( - fv_name=u"src_port", - pkt_offset=u"UDP.sport" - ), - STLVmWrFlowVar( - fv_name=u"nf_id", - pkt_offset=52 - ), - STLVmWrFlowVar( - fv_name=u"in_mac", - pkt_offset=58 - ), - STLVmWrFlowVar( - fv_name=u"in_mac", - pkt_offset=64 - ), - STLVmWrFlowVar( - fv_name=u"in_ip", - pkt_offset=82 - ), - STLVmWrFlowVar( - fv_name=u"in_ip", - pkt_offset=86 - ), - STLVmFixChecksumHw( - l3_offset="IP:{}".format(0), - l4_offset="UDP:{}".format(0), - l4_type=CTRexVmInsFixHwCs.L4_TYPE_UDP - ) - ] - ) - - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"nf_id", - size=1, - op=u"inc", - min_value=0, - max_value=self.nf_chains - 1 - ), - STLVmFlowVar( - name=u"in_mac", - size=2, op=u"inc", - min_value=0, - max_value=255 - ), - STLVmFlowVar( - name=u"in_ip", - size=1, - op=u"inc", - min_value=0, - max_value=255 - ), - STLVmFlowVar( - name=u"src_port", - size=2, - op=u"random", - min_value=1024, - max_value=65535 - ), - STLVmWrFlowVar( - fv_name=u"nf_id", - pkt_offset=32 - ), - STLVmWrFlowVar( - fv_name=u"src_port", - pkt_offset=u"UDP.sport" - ), - STLVmWrFlowVar( - fv_name=u"nf_id", - pkt_offset=52 - ), - STLVmWrFlowVar( - fv_name=u"in_mac", - pkt_offset=58 - ), - STLVmWrFlowVar( - fv_name=u"in_mac", - pkt_offset=64 - ), - STLVmWrFlowVar( - fv_name=u"in_ip", - pkt_offset=82 - ), - STLVmWrFlowVar( - fv_name=u"in_ip", - pkt_offset=86 - ), - STLVmFixChecksumHw( - l3_offset="IP:{}".format(0), - l4_offset="UDP:{}".format(0), - l4_type=CTRexVmInsFixHwCs.L4_TYPE_UDP - ) - ] - ) - - 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-dot1qip4vxlan-ip4src1udpsrcrnd.py b/resources/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src1udpsrcrnd.py deleted file mode 100644 index 1e78cd3cae..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src1udpsrcrnd.py +++ /dev/null @@ -1,288 +0,0 @@ -# Copyright (c) 2020 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 / DOT1Q / IP / VXLAN / ETH / IP - - Direction 0 --> 1: - - VLAN range: 100 - - Source IP address: 172.17.0.2 - - Destination IP address: 172.16.0.1 - - Source UDP port: random([1024..65535]) - - Destination UDP port: 4789 - - VXLAN VNI: 0 - - Payload source MAC address: 00:aa:aa:00:00:[00..ff] - - Payload source IP address: 10.0.[0..255].2 - - Payload destination MAC address: 00:bb:bb:00:00:[00..ff] - - Payload destination IP address: 10.0.[0..255].1 - - Direction 1 --> 0: - - VLAN range: 200 - - Source IP address: 172.27.0.2 - - Destination IP address: 172.26.0.1 - - Source UDP port: random([1024..65535]) - - Destination UDP port: 4789 - - VXLAN VNI: 0 - - Payload source MAC address: 00:bb:bb:00:00:[00..ff] - - Payload source IP address: 10.0.[0..255].1 - - Payload destination MAC address: 00:aa:aa:00:00:[00..ff] - - Payload destination IP address: 10.0.[0..255].2 -""" - -from trex.stl.api import * -from profile_trex_stateless_base_class import TrafficStreamsBaseClass - -# RFC 7348 - Virtual eXtensible Local Area Network (VXLAN): -# A Framework for Overlaying Virtualized Layer 2 Networks over Layer 3 Networks. -# http://tools.ietf.org/html/rfc7348 -_VXLAN_FLAGS = list(u"R"*24 + u"RRRIRRRRR") - - -class VXLAN(Packet): - name=u"VXLAN" - fields_desc = [ - FlagsField(u"flags", 0x08000000, 32, _VXLAN_FLAGS), - ThreeBytesField(u"vni", 0), - XByteField(u"reserved", 0x00) - ] - - def mysummary(self): - return self.sprintf(u"VXLAN (vni=%VXLAN.vni%)") - - -bind_layers(UDP, VXLAN, dport=4789) -bind_layers(VXLAN, Ether) - - -class TrafficStreams(TrafficStreamsBaseClass): - """Stream profile.""" - - def __init__(self): - """Initialization and setting of streams' parameters.""" - - super(TrafficStreamsBaseClass, self).__init__() - - self.nf_chains = 1 - - def define_packets(self): - """Defines the packets to be sent from the traffic generator. - - Packet definition: | ETH | DOT1Q | IP | VXLAN | ETH | IP - - :returns: Packets to be sent from the traffic generator. - :rtype: tuple - """ - - # Direction 0 --> 1 - base_pkt_a = ( - Ether()/ - Dot1Q( - vlan=100 - ) / - IP( - src=u"172.17.0.2", - dst=u"172.16.0.1" - )/ - UDP( - sport=1024, - dport=4789 - )/ - VXLAN( - vni=0 - )/ - Ether( - src=u"00:aa:aa:00:00:00", - dst=u"00:bb:bb:00:00:00" - )/ - IP( - src=u"10.0.0.2", - dst=u"10.0.0.1", - proto=61 - ) - ) - - # Direction 1 --> 0 - base_pkt_b = ( - Ether()/ - Dot1Q( - vlan=200 - ) / - IP( - src=u"172.27.0.2", - dst=u"172.26.0.1" - )/ - UDP( - sport=1024, - dport=4789 - )/ - VXLAN( - vni=0 - )/ - Ether( - src=u"00:bb:bb:00:00:00", - dst=u"00:aa:aa:00:00:00" - )/ - IP( - src=u"10.0.0.1", - dst=u"10.0.0.2", - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"nf_id", - size=1, - op=u"inc", - min_value=0, - max_value=self.nf_chains - 1 - ), - STLVmFlowVar( - name=u"in_mac", - size=2, - op=u"inc", - min_value=0, - max_value=255 - ), - STLVmFlowVar( - name=u"in_ip", - size=1, - op=u"inc", - min_value=0, - max_value=255 - ), - STLVmFlowVar( - name=u"src_port", - size=2, - op=u"random", - min_value=1024, - max_value=65535 - ), - STLVmWrFlowVar( - fv_name=u"nf_id", - pkt_offset=32 - ), - STLVmWrFlowVar( - fv_name=u"src_port", - pkt_offset=u"UDP.sport" - ), - STLVmWrFlowVar( - fv_name=u"nf_id", - pkt_offset=52 - ), - STLVmWrFlowVar( - fv_name=u"in_mac", - pkt_offset=58 - ), - STLVmWrFlowVar( - fv_name=u"in_mac", - pkt_offset=64 - ), - STLVmWrFlowVar( - fv_name=u"in_ip", - pkt_offset=82 - ), - STLVmWrFlowVar( - fv_name=u"in_ip", - pkt_offset=86 - ), - STLVmFixChecksumHw( - l3_offset="IP:{}".format(0), - l4_offset="UDP:{}".format(0), - l4_type=CTRexVmInsFixHwCs.L4_TYPE_UDP - ) - ] - ) - - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"nf_id", - size=1, - op=u"inc", - min_value=0, - max_value=self.nf_chains - 1 - ), - STLVmFlowVar( - name=u"in_mac", - size=2, - op=u"inc", - min_value=0, - max_value=255 - ), - STLVmFlowVar( - name=u"in_ip", - size=1, - op=u"inc", - min_value=0, - max_value=255 - ), - STLVmFlowVar( - name=u"src_port", - size=2, - op=u"random", - min_value=1024, - max_value=65535 - ), - STLVmWrFlowVar( - fv_name=u"nf_id", - pkt_offset=32 - ), - STLVmWrFlowVar( - fv_name=u"src_port", - pkt_offset=u"UDP.sport" - ), - STLVmWrFlowVar( - fv_name=u"nf_id", - pkt_offset=52 - ), - STLVmWrFlowVar( - fv_name=u"in_mac", - pkt_offset=58 - ), - STLVmWrFlowVar( - fv_name=u"in_mac", - pkt_offset=64 - ), - STLVmWrFlowVar( - fv_name=u"in_ip", - pkt_offset=82 - ), - STLVmWrFlowVar( - fv_name=u"in_ip", - pkt_offset=86 - ), - STLVmFixChecksumHw( - l3_offset="IP:{}".format(0), - l4_offset="UDP:{}".format(0), - l4_type=CTRexVmInsFixHwCs.L4_TYPE_UDP - ) - ] - ) - - 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-dot1qip4vxlan-ip4src2udpsrcrnd.py b/resources/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src2udpsrcrnd.py deleted file mode 100644 index d195bc5b61..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src2udpsrcrnd.py +++ /dev/null @@ -1,288 +0,0 @@ -# Copyright (c) 2020 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 / DOT1Q / IP / VXLAN / ETH / IP - - Direction 0 --> 1: - - VLAN range: 100 - - Source IP address: 172.17.[0..1].2 - - Destination IP address: 172.16.0.1 - - Source UDP port: random([1024..65535]) - - Destination UDP port: 4789 - - VXLAN VNI: [0..1] - - Payload source MAC address: 00:aa:aa:00:00:[00..ff] - - Payload source IP address: 10.0.[0..255].2 - - Payload destination MAC address: 00:bb:bb:00:00:[00..ff] - - Payload destination IP address: 10.0.[0..255].1 - - Direction 1 --> 0: - - VLAN range: 200 - - Source IP address: 172.27.[0..1].2 - - Destination IP address: 172.26.0.1 - - Source UDP port: random([1024..65535]) - - Destination UDP port: 4789 - - VXLAN VNI: [0..1] - - Payload source MAC address: 00:bb:bb:00:00:[00..ff] - - Payload source IP address: 10.0.[0..255].1 - - Payload destination MAC address: 00:aa:aa:00:00:[00..ff] - - Payload destination IP address: 10.0.[0..255].2 -""" - -from trex.stl.api import * -from profile_trex_stateless_base_class import TrafficStreamsBaseClass - -# RFC 7348 - Virtual eXtensible Local Area Network (VXLAN): -# A Framework for Overlaying Virtualized Layer 2 Networks over Layer 3 Networks -# http://tools.ietf.org/html/rfc7348 -_VXLAN_FLAGS = list(u"R"*24 + u"RRRIRRRRR") - - -class VXLAN(Packet): - name=u"VXLAN" - fields_desc = [ - FlagsField(u"flags", 0x08000000, 32, _VXLAN_FLAGS), - ThreeBytesField(u"vni", 0), - XByteField(u"reserved", 0x00) - ] - - def mysummary(self): - return self.sprintf(u"VXLAN (vni=%VXLAN.vni%)") - - -bind_layers(UDP, VXLAN, dport=4789) -bind_layers(VXLAN, Ether) - - -class TrafficStreams(TrafficStreamsBaseClass): - """Stream profile.""" - - def __init__(self): - """Initialization and setting of streams' parameters.""" - - super(TrafficStreamsBaseClass, self).__init__() - - self.nf_chains = 2 - - def define_packets(self): - """Defines the packets to be sent from the traffic generator. - - Packet definition: | ETH | DOT1Q | IP | VXLAN | ETH | IP - - :returns: Packets to be sent from the traffic generator. - :rtype: tuple - """ - - # Direction 0 --> 1 - base_pkt_a = ( - Ether()/ - Dot1Q( - vlan=100 - ) / - IP( - src=u"172.17.0.2", - dst=u"172.16.0.1" - )/ - UDP( - sport=1024, - dport=4789 - )/ - VXLAN( - vni=0 - )/ - Ether( - src=u"00:aa:aa:00:00:00", - dst=u"00:bb:bb:00:00:00" - )/ - IP( - src=u"10.0.0.2", - dst=u"10.0.0.1", - proto=61 - ) - ) - - # Direction 1 --> 0 - base_pkt_b = ( - Ether()/ - Dot1Q( - vlan=200 - ) / - IP( - src=u"172.27.0.2", - dst=u"172.26.0.1" - )/ - UDP( - sport=1024, - dport=4789 - )/ - VXLAN( - vni=0 - )/ - Ether( - src=u"00:bb:bb:00:00:00", - dst=u"00:aa:aa:00:00:00" - )/ - IP( - src=u"10.0.0.1", - dst=u"10.0.0.2", - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"nf_id", - size=1, - op=u"inc", - min_value=0, - max_value=self.nf_chains - 1 - ), - STLVmFlowVar( - name=u"in_mac", - size=2, - op=u"inc", - min_value=0, - max_value=255 - ), - STLVmFlowVar( - name=u"in_ip", - size=1, - op=u"inc", - min_value=0, - max_value=255 - ), - STLVmFlowVar( - name=u"src_port", - size=2, - op=u"random", - min_value=1024, - max_value=65535 - ), - STLVmWrFlowVar( - fv_name=u"nf_id", - pkt_offset=32 - ), - STLVmWrFlowVar( - fv_name=u"src_port", - pkt_offset=u"UDP.sport" - ), - STLVmWrFlowVar( - fv_name=u"nf_id", - pkt_offset=52 - ), - STLVmWrFlowVar( - fv_name=u"in_mac", - pkt_offset=58 - ), - STLVmWrFlowVar( - fv_name=u"in_mac", - pkt_offset=64 - ), - STLVmWrFlowVar( - fv_name=u"in_ip", - pkt_offset=82 - ), - STLVmWrFlowVar( - fv_name=u"in_ip", - pkt_offset=86 - ), - STLVmFixChecksumHw( - l3_offset="IP:{}".format(0), - l4_offset="UDP:{}".format(0), - l4_type=CTRexVmInsFixHwCs.L4_TYPE_UDP - ) - ] - ) - - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"nf_id", - size=1, - op=u"inc", - min_value=0, - max_value=self.nf_chains - 1 - ), - STLVmFlowVar( - name=u"in_mac", - size=2, - op=u"inc", - min_value=0, - max_value=255 - ), - STLVmFlowVar( - name=u"in_ip", - size=1, - op=u"inc", - min_value=0, - max_value=255 - ), - STLVmFlowVar( - name=u"src_port", - size=2, - op=u"random", - min_value=1024, - max_value=65535 - ), - STLVmWrFlowVar( - fv_name=u"nf_id", - pkt_offset=32 - ), - STLVmWrFlowVar( - fv_name=u"src_port", - pkt_offset=u"UDP.sport" - ), - STLVmWrFlowVar( - fv_name=u"nf_id", - pkt_offset=52 - ), - STLVmWrFlowVar( - fv_name=u"in_mac", - pkt_offset=58 - ), - STLVmWrFlowVar( - fv_name=u"in_mac", - pkt_offset=64 - ), - STLVmWrFlowVar( - fv_name=u"in_ip", - pkt_offset=82 - ), - STLVmWrFlowVar( - fv_name=u"in_ip", - pkt_offset=86 - ), - STLVmFixChecksumHw( - l3_offset="IP:{}".format(0), - l4_offset="UDP:{}".format(0), - l4_type=CTRexVmInsFixHwCs.L4_TYPE_UDP - ) - ] - ) - - 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-dot1qip4vxlan-ip4src4udpsrcrnd.py b/resources/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src4udpsrcrnd.py deleted file mode 100644 index 8a7bc08b1b..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src4udpsrcrnd.py +++ /dev/null @@ -1,288 +0,0 @@ -# Copyright (c) 2020 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 / DOT1Q / IP / VXLAN / ETH / IP - - Direction 0 --> 1: - - VLAN range: 100 - - Source IP address: 172.17.[0..3].2 - - Destination IP address: 172.16.0.1 - - Source UDP port: random([1024..65535]) - - Destination UDP port: 4789 - - VXLAN VNI: [0..3] - - Payload source MAC address: 00:aa:aa:00:00:[00..ff] - - Payload source IP address: 10.0.[0..255].2 - - Payload destination MAC address: 00:bb:bb:00:00:[00..ff] - - Payload destination IP address: 10.0.[0..255].1 - - Direction 1 --> 0: - - VLAN range: 200 - - Source IP address: 172.27.[0..3].2 - - Destination IP address: 172.26.0.1 - - Source UDP port: random([1024..65535]) - - Destination UDP port: 4789 - - VXLAN VNI: [0..3] - - Payload source MAC address: 00:bb:bb:00:00:[00..ff] - - Payload source IP address: 10.0.[0..255].1 - - Payload destination MAC address: 00:aa:aa:00:00:[00..ff] - - Payload destination IP address: 10.0.[0..255].2 -""" - -from trex.stl.api import * -from profile_trex_stateless_base_class import TrafficStreamsBaseClass - -# RFC 7348 - Virtual eXtensible Local Area Network (VXLAN): -# A Framework for Overlaying Virtualized Layer 2 Networks over Layer 3 Networks -# http://tools.ietf.org/html/rfc7348 -_VXLAN_FLAGS = list(u"R"*24 + u"RRRIRRRRR") - - -class VXLAN(Packet): - name=u"VXLAN" - fields_desc = [ - FlagsField(u"flags", 0x08000000, 32, _VXLAN_FLAGS), - ThreeBytesField(u"vni", 0), - XByteField(u"reserved", 0x00) - ] - - def mysummary(self): - return self.sprintf(u"VXLAN (vni=%VXLAN.vni%)") - - -bind_layers(UDP, VXLAN, dport=4789) -bind_layers(VXLAN, Ether) - - -class TrafficStreams(TrafficStreamsBaseClass): - """Stream profile.""" - - def __init__(self): - """Initialization and setting of streams' parameters.""" - - super(TrafficStreamsBaseClass, self).__init__() - - self.nf_chains = 4 - - def define_packets(self): - """Defines the packets to be sent from the traffic generator. - - Packet definition: | ETH | DOT1Q | IP | VXLAN | ETH | IP - - :returns: Packets to be sent from the traffic generator. - :rtype: tuple - """ - - # Direction 0 --> 1 - base_pkt_a = ( - Ether()/ - Dot1Q( - vlan=100 - )/ - IP( - src=u"172.17.0.2", - dst=u"172.16.0.1" - )/ - UDP( - sport=1024, - dport=4789 - )/ - VXLAN( - vni=0 - )/ - Ether( - src=u"00:aa:aa:00:00:00", - dst=u"00:bb:bb:00:00:00" - )/ - IP( - src=u"10.0.0.2", - dst=u"10.0.0.1", - proto=61 - ) - ) - - # Direction 1 --> 0 - base_pkt_b = ( - Ether()/ - Dot1Q( - vlan=200 - ) / - IP( - src=u"172.27.0.2", - dst=u"172.26.0.1" - )/ - UDP( - sport=1024, - dport=4789 - )/ - VXLAN( - vni=0 - )/ - Ether( - src=u"00:bb:bb:00:00:00", - dst=u"00:aa:aa:00:00:00" - )/ - IP( - src=u"10.0.0.1", - dst=u"10.0.0.2", - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"nf_id", - size=1, - op=u"inc", - min_value=0, - max_value=self.nf_chains - 1 - ), - STLVmFlowVar( - name=u"in_mac", - size=2, - op=u"inc", - min_value=0, - max_value=255 - ), - STLVmFlowVar( - name=u"in_ip", - size=1, - op=u"inc", - min_value=0, - max_value=255 - ), - STLVmFlowVar( - name=u"src_port", - size=2, - op=u"random", - min_value=1024, - max_value=65535 - ), - STLVmWrFlowVar( - fv_name=u"nf_id", - pkt_offset=32 - ), - STLVmWrFlowVar( - fv_name=u"src_port", - pkt_offset=u"UDP.sport" - ), - STLVmWrFlowVar( - fv_name=u"nf_id", - pkt_offset=52 - ), - STLVmWrFlowVar( - fv_name=u"in_mac", - pkt_offset=58 - ), - STLVmWrFlowVar( - fv_name=u"in_mac", - pkt_offset=64 - ), - STLVmWrFlowVar( - fv_name=u"in_ip", - pkt_offset=82 - ), - STLVmWrFlowVar( - fv_name=u"in_ip", - pkt_offset=86 - ), - STLVmFixChecksumHw( - l3_offset="IP:{}".format(0), - l4_offset="UDP:{}".format(0), - l4_type=CTRexVmInsFixHwCs.L4_TYPE_UDP - ) - ] - ) - - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"nf_id", - size=1, - op=u"inc", - min_value=0, - max_value=self.nf_chains - 1 - ), - STLVmFlowVar( - name=u"in_mac", - size=2, - op=u"inc", - min_value=0, - max_value=255 - ), - STLVmFlowVar( - name=u"in_ip", - size=1, - op=u"inc", - min_value=0, - max_value=255 - ), - STLVmFlowVar( - name=u"src_port", - size=2, - op=u"random", - min_value=1024, - max_value=65535 - ), - STLVmWrFlowVar( - fv_name=u"nf_id", - pkt_offset=32 - ), - STLVmWrFlowVar( - fv_name=u"src_port", - pkt_offset=u"UDP.sport" - ), - STLVmWrFlowVar( - fv_name=u"nf_id", - pkt_offset=52 - ), - STLVmWrFlowVar( - fv_name=u"in_mac", - pkt_offset=58 - ), - STLVmWrFlowVar( - fv_name=u"in_mac", - pkt_offset=64 - ), - STLVmWrFlowVar( - fv_name=u"in_ip", - pkt_offset=82 - ), - STLVmWrFlowVar( - fv_name=u"in_ip", - pkt_offset=86 - ), - STLVmFixChecksumHw( - l3_offset="IP:{}".format(0), - l4_offset="UDP:{}".format(0), - l4_type=CTRexVmInsFixHwCs.L4_TYPE_UDP - ) - ] - ) - - 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-dot1qip4vxlan-ip4src6udpsrcrnd.py b/resources/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src6udpsrcrnd.py deleted file mode 100644 index fe46844571..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src6udpsrcrnd.py +++ /dev/null @@ -1,288 +0,0 @@ -# Copyright (c) 2020 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 / DOT1Q / IP / VXLAN / ETH / IP - - Direction 0 --> 1: - - VLAN range: 100 - - Source IP address: 172.17.[0..5].2 - - Destination IP address: 172.16.0.1 - - Source UDP port: random([1024..65535]) - - Destination UDP port: 4789 - - VXLAN VNI: [0..5] - - Payload source MAC address: 00:aa:aa:00:00:[00..ff] - - Payload source IP address: 10.0.[0..255].2 - - Payload destination MAC address: 00:bb:bb:00:00:[00..ff] - - Payload destination IP address: 10.0.[0..255].1 - - Direction 1 --> 0: - - VLAN range: 200 - - Source IP address: 172.27.[0..5].2 - - Destination IP address: 172.26.0.1 - - Source UDP port: random([1024..65535]) - - Destination UDP port: 4789 - - VXLAN VNI: [0..5] - - Payload source MAC address: 00:bb:bb:00:00:[00..ff] - - Payload source IP address: 10.0.[0..255].1 - - Payload destination MAC address: 00:aa:aa:00:00:[00..ff] - - Payload destination IP address: 10.0.[0..255].2 -""" - -from trex.stl.api import * -from profile_trex_stateless_base_class import TrafficStreamsBaseClass - -# RFC 7348 - Virtual eXtensible Local Area Network (VXLAN): -# A Framework for Overlaying Virtualized Layer 2 Networks over Layer 3 Networks -# http://tools.ietf.org/html/rfc7348 -_VXLAN_FLAGS = list(u"R"*24 + u"RRRIRRRRR") - - -class VXLAN(Packet): - name=u"VXLAN" - fields_desc = [ - FlagsField(u"flags", 0x08000000, 32, _VXLAN_FLAGS), - ThreeBytesField(u"vni", 0), - XByteField(u"reserved", 0x00) - ] - - def mysummary(self): - return self.sprintf(u"VXLAN (vni=%VXLAN.vni%)") - - -bind_layers(UDP, VXLAN, dport=4789) -bind_layers(VXLAN, Ether) - - -class TrafficStreams(TrafficStreamsBaseClass): - """Stream profile.""" - - def __init__(self): - """Initialization and setting of streams' parameters.""" - - super(TrafficStreamsBaseClass, self).__init__() - - self.nf_chains = 6 - - def define_packets(self): - """Defines the packets to be sent from the traffic generator. - - Packet definition: | ETH | DOT1Q | IP | VXLAN | ETH | IP - - :returns: Packets to be sent from the traffic generator. - :rtype: tuple - """ - - # Direction 0 --> 1 - base_pkt_a = ( - Ether()/ - Dot1Q( - vlan=100 - ) / - IP( - src=u"172.17.0.2", - dst=u"172.16.0.1" - )/ - UDP( - sport=1024, - dport=4789 - )/ - VXLAN( - vni=0 - )/ - Ether( - src=u"00:aa:aa:00:00:00", - dst=u"00:bb:bb:00:00:00" - )/ - IP( - src=u"10.0.0.2", - dst=u"10.0.0.1", - proto=61 - ) - ) - - # Direction 1 --> 0 - base_pkt_b = ( - Ether()/ - Dot1Q( - vlan=200 - ) / - IP( - src=u"172.27.0.2", - dst=u"172.26.0.1" - )/ - UDP( - sport=1024, - dport=4789 - )/ - VXLAN( - vni=0 - )/ - Ether( - src=u"00:bb:bb:00:00:00", - dst=u"00:aa:aa:00:00:00" - )/ - IP( - src=u"10.0.0.1", - dst=u"10.0.0.2", - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"nf_id", - size=1, - op=u"inc", - min_value=0, - max_value=self.nf_chains - 1 - ), - STLVmFlowVar( - name=u"in_mac", - size=2, - op=u"inc", - min_value=0, - max_value=255 - ), - STLVmFlowVar( - name=u"in_ip", - size=1, - op=u"inc", - min_value=0, - max_value=255 - ), - STLVmFlowVar( - name=u"src_port", - size=2, - op=u"random", - min_value=1024, - max_value=65535 - ), - STLVmWrFlowVar( - fv_name=u"nf_id", - pkt_offset=32 - ), - STLVmWrFlowVar( - fv_name=u"src_port", - pkt_offset=u"UDP.sport" - ), - STLVmWrFlowVar( - fv_name=u"nf_id", - pkt_offset=52 - ), - STLVmWrFlowVar( - fv_name=u"in_mac", - pkt_offset=58 - ), - STLVmWrFlowVar( - fv_name=u"in_mac", - pkt_offset=64 - ), - STLVmWrFlowVar( - fv_name=u"in_ip", - pkt_offset=82 - ), - STLVmWrFlowVar( - fv_name=u"in_ip", - pkt_offset=86 - ), - STLVmFixChecksumHw( - l3_offset="IP:{}".format(0), - l4_offset="UDP:{}".format(0), - l4_type=CTRexVmInsFixHwCs.L4_TYPE_UDP - ) - ] - ) - - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"nf_id", - size=1, - op=u"inc", - min_value=0, - max_value=self.nf_chains - 1 - ), - STLVmFlowVar( - name=u"in_mac", - size=2, - op=u"inc", - min_value=0, - max_value=255 - ), - STLVmFlowVar( - name=u"in_ip", - size=1, - op=u"inc", - min_value=0, - max_value=255 - ), - STLVmFlowVar( - name=u"src_port", - size=2, - op=u"random", - min_value=1024, - max_value=65535 - ), - STLVmWrFlowVar( - fv_name=u"nf_id", - pkt_offset=32 - ), - STLVmWrFlowVar( - fv_name=u"src_port", - pkt_offset=u"UDP.sport" - ), - STLVmWrFlowVar( - fv_name=u"nf_id", - pkt_offset=52 - ), - STLVmWrFlowVar( - fv_name=u"in_mac", - pkt_offset=58 - ), - STLVmWrFlowVar( - fv_name=u"in_mac", - pkt_offset=64 - ), - STLVmWrFlowVar( - fv_name=u"in_ip", - pkt_offset=82 - ), - STLVmWrFlowVar( - fv_name=u"in_ip", - pkt_offset=86 - ), - STLVmFixChecksumHw( - l3_offset="IP:{}".format(0), - l4_offset="UDP:{}".format(0), - l4_type=CTRexVmInsFixHwCs.L4_TYPE_UDP - ) - ] - ) - - 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-dot1qip4vxlan-ip4src8udpsrcrnd.py b/resources/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src8udpsrcrnd.py deleted file mode 100644 index cf34818781..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src8udpsrcrnd.py +++ /dev/null @@ -1,288 +0,0 @@ -# Copyright (c) 2020 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 / DOT1Q / IP / VXLAN / ETH / IP - - Direction 0 --> 1: - - VLAN range: 100 - - Source IP address: 172.17.[0..7].2 - - Destination IP address: 172.16.0.1 - - Source UDP port: random([1024..65535]) - - Destination UDP port: 4789 - - VXLAN VNI: [0..7] - - Payload source MAC address: 00:aa:aa:00:00:[00..ff] - - Payload source IP address: 10.0.[0..255].2 - - Payload destination MAC address: 00:bb:bb:00:00:[00..ff] - - Payload destination IP address: 10.0.[0..255].1 - - Direction 1 --> 0: - - VLAN range: 200 - - Source IP address: 172.27.[0..7].2 - - Destination IP address: 172.26.0.1 - - Source UDP port: random([1024..65535]) - - Destination UDP port: 4789 - - VXLAN VNI: [0..7] - - Payload source MAC address: 00:bb:bb:00:00:[00..ff] - - Payload source IP address: 10.0.[0..255].1 - - Payload destination MAC address: 00:aa:aa:00:00:[00..ff] - - Payload destination IP address: 10.0.[0..255].2 -""" - -from trex.stl.api import * -from profile_trex_stateless_base_class import TrafficStreamsBaseClass - -# RFC 7348 - Virtual eXtensible Local Area Network (VXLAN): -# A Framework for Overlaying Virtualized Layer 2 Networks over Layer 3 Networks -# http://tools.ietf.org/html/rfc7348 -_VXLAN_FLAGS = list(u"R"*24 + u"RRRIRRRRR") - - -class VXLAN(Packet): - name=u"VXLAN" - fields_desc = [ - FlagsField(u"flags", 0x08000000, 32, _VXLAN_FLAGS), - ThreeBytesField(u"vni", 0), - XByteField(u"reserved", 0x00) - ] - - def mysummary(self): - return self.sprintf(u"VXLAN (vni=%VXLAN.vni%)") - - -bind_layers(UDP, VXLAN, dport=4789) -bind_layers(VXLAN, Ether) - - -class TrafficStreams(TrafficStreamsBaseClass): - """Stream profile.""" - - def __init__(self): - """Initialization and setting of streams' parameters.""" - - super(TrafficStreamsBaseClass, self).__init__() - - self.nf_chains = 8 - - def define_packets(self): - """Defines the packets to be sent from the traffic generator. - - Packet definition: | ETH | DOT1Q | IP | VXLAN | ETH | IP - - :returns: Packets to be sent from the traffic generator. - :rtype: tuple - """ - - # Direction 0 --> 1 - base_pkt_a = ( - Ether()/ - Dot1Q( - vlan=100 - ) / - IP( - src=u"172.17.0.2", - dst=u"172.16.0.1" - )/ - UDP( - sport=1024, - dport=4789 - )/ - VXLAN( - vni=0 - )/ - Ether( - src=u"00:aa:aa:00:00:00", - dst=u"00:bb:bb:00:00:00" - )/ - IP( - src=u"10.0.0.2", - dst=u"10.0.0.1", - proto=61 - ) - ) - - # Direction 1 --> 0 - base_pkt_b = ( - Ether()/ - Dot1Q( - vlan=200 - ) / - IP( - src=u"172.27.0.2", - dst=u"172.26.0.1" - )/ - UDP( - sport=1024, - dport=4789 - )/ - VXLAN( - vni=0 - )/ - Ether( - src=u"00:bb:bb:00:00:00", - dst=u"00:aa:aa:00:00:00" - )/ - IP( - src=u"10.0.0.1", - dst=u"10.0.0.2", - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"nf_id", - size=1, - op=u"inc", - min_value=0, - max_value=self.nf_chains - 1 - ), - STLVmFlowVar( - name=u"in_mac", - size=2, - op=u"inc", - min_value=0, - max_value=255 - ), - STLVmFlowVar( - name=u"in_ip", - size=1, - op=u"inc", - min_value=0, - max_value=255 - ), - STLVmFlowVar( - name=u"src_port", - size=2, - op=u"random", - min_value=1024, - max_value=65535 - ), - STLVmWrFlowVar( - fv_name=u"nf_id", - pkt_offset=32 - ), - STLVmWrFlowVar( - fv_name=u"src_port", - pkt_offset=u"UDP.sport" - ), - STLVmWrFlowVar( - fv_name=u"nf_id", - pkt_offset=52 - ), - STLVmWrFlowVar( - fv_name=u"in_mac", - pkt_offset=58 - ), - STLVmWrFlowVar( - fv_name=u"in_mac", - pkt_offset=64 - ), - STLVmWrFlowVar( - fv_name=u"in_ip", - pkt_offset=82 - ), - STLVmWrFlowVar( - fv_name=u"in_ip", - pkt_offset=86 - ), - STLVmFixChecksumHw( - l3_offset="IP:{}".format(0), - l4_offset="UDP:{}".format(0), - l4_type=CTRexVmInsFixHwCs.L4_TYPE_UDP - ) - ] - ) - - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"nf_id", - size=1, - op=u"inc", - min_value=0, - max_value=self.nf_chains - 1 - ), - STLVmFlowVar( - name=u"in_mac", - size=2, - op=u"inc", - min_value=0, - max_value=255 - ), - STLVmFlowVar( - name=u"in_ip", - size=1, - op=u"inc", - min_value=0, - max_value=255 - ), - STLVmFlowVar( - name=u"src_port", - size=2, - op=u"random", - min_value=1024, - max_value=65535 - ), - STLVmWrFlowVar( - fv_name=u"nf_id", - pkt_offset=32 - ), - STLVmWrFlowVar( - fv_name=u"src_port", - pkt_offset=u"UDP.sport" - ), - STLVmWrFlowVar( - fv_name=u"nf_id", - pkt_offset=52 - ), - STLVmWrFlowVar( - fv_name=u"in_mac", - pkt_offset=58 - ), - STLVmWrFlowVar( - fv_name=u"in_mac", - pkt_offset=64 - ), - STLVmWrFlowVar( - fv_name=u"in_ip", - pkt_offset=82 - ), - STLVmWrFlowVar( - fv_name=u"in_ip", - pkt_offset=86 - ), - STLVmFixChecksumHw( - l3_offset="IP:{}".format(0), - l4_offset="UDP:{}".format(0), - l4_type=CTRexVmInsFixHwCs.L4_TYPE_UDP - ) - ] - ) - - 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-ethip4vxlan-ip4src1udpsrcrnd.py b/resources/traffic_profiles/trex/trex-sl-ethip4vxlan-ip4src1udpsrcrnd.py deleted file mode 100644 index cd1a0a690c..0000000000 --- a/resources/traffic_profiles/trex/trex-sl-ethip4vxlan-ip4src1udpsrcrnd.py +++ /dev/null @@ -1,261 +0,0 @@ -# Copyright (c) 2020 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 / VXLAN / ETH / IP - - Direction 0 --> 1: - - Source IP address: 172.17.0.2 - - Destination IP address: 172.16.0.1 - - Source UDP port: random([1024-65535]) - - Destination UDP port: 4789 - - VXLAN VNI: 0 - - Payload source MAC address: 00:aa:aa:00:00:[00..ff] - - Payload source IP address: 10.0.0.2 - - Payload destination MAC address: 00:bb:bb:00:00:[00..ff] - - Payload destination IP address: 10.0.0.1 - - Direction 1 --> 0: - - Source IP address: 172.27.0.2 - - Destination IP address: 172.26.0.1 - - Source UDP port: random([1024-65535]) - - Destination UDP port: 4789 - - VXLAN VNI: 0 - - Payload source MAC address: 00:bb:bb:00:00:[00..ff] - - Payload source IP address: 10.0.0.1 - - Payload destination MAC address: 00:aa:aa:00:00:[00..ff] - - Payload destination IP address: 10.0.0.2 -""" - -from trex.stl.api import * -from profile_trex_stateless_base_class import TrafficStreamsBaseClass - -# RFC 7348 - Virtual eXtensible Local Area Network (VXLAN): -# A Framework for Overlaying Virtualized Layer 2 Networks over Layer 3 Networks -# http://tools.ietf.org/html/rfc7348 -_VXLAN_FLAGS = list(u"R"*24 + u"RRRIRRRRR") - - -class VXLAN(Packet): - name=u"VXLAN" - fields_desc = [ - FlagsField(u"flags", 0x08000000, 32, _VXLAN_FLAGS), - ThreeBytesField(u"vni", 0), - XByteField(u"reserved", 0x00) - ] - - def mysummary(self): - return self.sprintf(u"VXLAN (vni=%VXLAN.vni%)") - - -bind_layers(UDP, VXLAN, dport=4789) -bind_layers(VXLAN, Ether) - - -class TrafficStreams(TrafficStreamsBaseClass): - """Stream profile.""" - - def __init__(self): - """Initialization and setting of streams' parameters.""" - - super(TrafficStreamsBaseClass, self).__init__() - - self.nf_chains = 1 - - def define_packets(self): - """Defines the packets to be sent from the traffic generator. - - Packet definition: | ETH | IP | VXLAN | ETH | IP - - :returns: Packets to be sent from the traffic generator. - :rtype: tuple - """ - - # Direction 0 --> 1 - base_pkt_a = ( - Ether()/ - IP( - src=u"172.17.0.2", - dst=u"172.16.0.1" - )/ - UDP( - sport=1024, - dport=4789)/ - VXLAN( - vni=0 - )/ - Ether( - src=u"00:aa:aa:00:00:00", - dst=u"00:bb:bb:00:00:00" - )/ - IP( - src=u"10.0.0.2", - dst=u"10.0.0.1", - proto=61 - ) - ) - - # Direction 1 --> 0 - base_pkt_b = ( - Ether()/ - IP( - src=u"172.27.0.2", - dst=u"172.26.0.1" - )/ - UDP( - sport=1024, - dport=4789 - )/ - VXLAN( - vni=0 - )/ - Ether( - src=u"00:bb:bb:00:00:00", - dst=u"00:aa:aa:00:00:00" - )/ - IP( - src=u"10.0.0.1", - dst=u"10.0.0.2", - proto=61 - ) - ) - - # Direction 0 --> 1 - vm1 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"nf_id", - size=1, - op=u"inc", - min_value=0, - max_value=self.nf_chains - 1 - ), - STLVmFlowVar( - name=u"in_mac", - size=2, - op=u"inc", - min_value=0, - max_value=255 - ), - STLVmFlowVar( - name=u"in_ip", - size=1, - op=u"inc", - min_value=0, - max_value=255 - ), - STLVmFlowVar( - name=u"src_port", - size=2, - op=u"random", - min_value=1024, - max_value=65535 - ), - STLVmWrFlowVar( - fv_name=u"nf_id", - pkt_offset=28 - ), - STLVmWrFlowVar( - fv_name=u"src_port", - pkt_offset=u"UDP.sport" - ), - STLVmWrFlowVar( - fv_name=u"nf_id", - pkt_offset=48 - ), - STLVmWrFlowVar( - fv_name=u"in_mac", - pkt_offset=54 - ), - STLVmWrFlowVar( - fv_name=u"in_mac", - pkt_offset=60 - ), - STLVmFixChecksumHw( - l3_offset="IP:{}".format(0), - l4_offset="UDP:{}".format(0), - l4_type=CTRexVmInsFixHwCs.L4_TYPE_UDP - ) - ] - ) - - # Direction 1 --> 0 - vm2 = STLScVmRaw( - [ - STLVmFlowVar( - name=u"nf_id", - size=1, - op=u"inc", - min_value=0, - max_value=self.nf_chains - 1 - ), - STLVmFlowVar( - name=u"in_mac", - size=2, op=u"inc", - min_value=0, - max_value=255 - ), - STLVmFlowVar( - name=u"in_ip", - size=1, op=u"inc", - min_value=0, - max_value=255 - ), - STLVmFlowVar( - name=u"src_port", - size=2, - op=u"random", - min_value=1024, - max_value=65535 - ), - STLVmWrFlowVar( - fv_name=u"nf_id", - pkt_offset=28 - ), - STLVmWrFlowVar( - fv_name=u"src_port", - pkt_offset=u"UDP.sport" - ), - STLVmWrFlowVar( - fv_name=u"nf_id", - pkt_offset=48 - ), - STLVmWrFlowVar( - fv_name=u"in_mac", - pkt_offset=54 - ), - STLVmWrFlowVar( - fv_name=u"in_mac", - pkt_offset=60 - ), - STLVmFixChecksumHw( - l3_offset="IP:{}".format(0), - l4_offset="UDP:{}".format(0), - l4_type=CTRexVmInsFixHwCs.L4_TYPE_UDP - ) - ] - ) - - 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_scripts/ipsec_interface.py b/resources/traffic_scripts/ipsec_interface.py deleted file mode 100755 index d1e07471b4..0000000000 --- a/resources/traffic_scripts/ipsec_interface.py +++ /dev/null @@ -1,271 +0,0 @@ -#!/usr/bin/env python3 - -# Copyright (c) 2020 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. - -"""Traffic script for IPsec verification.""" - -import sys - -from ipaddress import ip_address -from scapy.layers.inet import IP -from scapy.layers.inet6 import IPv6, ICMPv6ND_NS -from scapy.layers.ipsec import SecurityAssociation, ESP -from scapy.layers.l2 import Ether -from scapy.packet import Raw - -from resources.libraries.python.PacketVerifier import RxQueue, TxQueue -from resources.libraries.python.TrafficScriptArg import TrafficScriptArg - - -def check_ipsec( - pkt_recv, ip_layer, src_mac, dst_mac, src_tun, dst_tun, src_ip, dst_ip, - sa_in): - """Check received IPsec packet. - - :param pkt_recv: Received packet to verify. - :param ip_layer: Scapy IP layer. - :param src_mac: Source MAC address. - :param dst_mac: Destination MAC address. - :param src_tun: IPsec tunnel source address. - :param dst_tun: IPsec tunnel destination address. - :param src_ip: Source IP/IPv6 address of original IP/IPv6 packet. - :param dst_ip: Destination IP/IPv6 address of original IP/IPv6 packet. - :param sa_in: IPsec SA for packet decryption. - :type pkt_recv: scapy.Ether - :type ip_layer: scapy.layers.inet.IP or scapy.layers.inet6.IPv6 - :type src_mac: str - :type dst_mac: str - :type src_tun: str - :type dst_tun: str - :type src_ip: str - :type dst_ip: str - :type sa_in: scapy.layers.ipsec.SecurityAssociation - :raises RuntimeError: If received packet is invalid. - """ - if pkt_recv[Ether].src != src_mac: - raise RuntimeError( - f"Received frame has invalid source MAC address: " - f"{pkt_recv[Ether].src} should be: {src_mac}" - ) - - if pkt_recv[Ether].dst != dst_mac: - raise RuntimeError( - f"Received frame has invalid destination MAC address: " - f"{pkt_recv[Ether].dst} should be: {dst_mac}" - ) - - if not pkt_recv.haslayer(ip_layer): - raise RuntimeError( - f"Not an {ip_layer.name} packet received: {pkt_recv!r}" - ) - - if pkt_recv[ip_layer].src != src_tun: - raise RuntimeError( - f"Received packet has invalid source address: " - f"{pkt_recv[ip_layer].src} should be: {src_tun}" - ) - - if pkt_recv[ip_layer].dst != dst_tun: - raise RuntimeError( - f"Received packet has invalid destination address: " - f"{pkt_recv[ip_layer].dst} should be: {dst_tun}" - ) - - if not pkt_recv.haslayer(ESP): - raise RuntimeError(f"Not an ESP packet received: {pkt_recv!r}") - - ip_pkt = pkt_recv[ip_layer] - d_pkt = sa_in.decrypt(ip_pkt) - - if d_pkt[ip_layer].dst != dst_ip: - raise RuntimeError( - f"Decrypted packet has invalid destination address: " - f"{d_pkt[ip_layer].dst} should be: {dst_ip}" - ) - - if d_pkt[ip_layer].src != src_ip: - raise RuntimeError( - f"Decrypted packet has invalid source address: " - f"{d_pkt[ip_layer].src} should be: {src_ip}" - ) - - if ip_layer == IP and d_pkt[ip_layer].proto != 61: - raise RuntimeError( - f"Decrypted packet has invalid IP protocol: " - f"{d_pkt[ip_layer].proto} should be: 61" - ) - - -def check_ip(pkt_recv, ip_layer, src_mac, dst_mac, src_ip, dst_ip): - """Check received IP/IPv6 packet. - - :param pkt_recv: Received packet to verify. - :param ip_layer: Scapy IP layer. - :param src_mac: Source MAC address. - :param dst_mac: Destination MAC address. - :param src_ip: Source IP/IPv6 address. - :param dst_ip: Destination IP/IPv6 address. - :type pkt_recv: scapy.Ether - :type ip_layer: scapy.layers.inet.IP or scapy.layers.inet6.IPv6 - :type src_mac: str - :type dst_mac: str - :type src_ip: str - :type dst_ip: str - :raises RuntimeError: If received packet is invalid. - """ - if pkt_recv[Ether].src != src_mac: - raise RuntimeError( - f"Received frame has invalid source MAC address: " - f"{pkt_recv[Ether].src} should be: {src_mac}" - ) - - if pkt_recv[Ether].dst != dst_mac: - raise RuntimeError( - f"Received frame has invalid destination MAC address: " - f"{pkt_recv[Ether].dst} should be: {dst_mac}" - ) - - if not pkt_recv.haslayer(ip_layer): - raise RuntimeError( - f"Not an {ip_layer.name} packet received: {pkt_recv!r}" - ) - - if pkt_recv[ip_layer].dst != dst_ip: - raise RuntimeError( - f"Received packet has invalid destination address: " - f"{pkt_recv[ip_layer.name].dst} should be: {dst_ip}" - ) - - if pkt_recv[ip_layer].src != src_ip: - raise RuntimeError( - f"Received packet has invalid destination address: " - f"{pkt_recv[ip_layer.name].dst} should be: {src_ip}" - ) - - if ip_layer == IP and pkt_recv[ip_layer].proto != 61: - raise RuntimeError( - f"Received packet has invalid IP protocol: " - f"{pkt_recv[ip_layer].proto} should be: 61" - ) - - -def main(): - """Send and receive IPsec packet.""" - - args = TrafficScriptArg( - [ - u"tx_src_mac", u"tx_dst_mac", u"rx_src_mac", u"rx_dst_mac", - u"src_ip", u"dst_ip", u"src_tun", u"dst_tun", u"crypto_alg", - u"crypto_key", u"integ_alg", u"integ_key", u"l_spi", u"r_spi" - ] - ) - - tx_txq = TxQueue(args.get_arg(u"tx_if")) - tx_rxq = RxQueue(args.get_arg(u"tx_if")) - rx_txq = TxQueue(args.get_arg(u"rx_if")) - rx_rxq = RxQueue(args.get_arg(u"rx_if")) - - tx_src_mac = args.get_arg(u"tx_src_mac") - tx_dst_mac = args.get_arg(u"tx_dst_mac") - rx_src_mac = args.get_arg(u"rx_src_mac") - rx_dst_mac = args.get_arg(u"rx_dst_mac") - src_ip = args.get_arg(u"src_ip") - dst_ip = args.get_arg(u"dst_ip") - src_tun = args.get_arg(u"src_tun") - dst_tun = args.get_arg(u"dst_tun") - crypto_alg = args.get_arg(u"crypto_alg") - crypto_key = args.get_arg(u"crypto_key") - integ_alg = args.get_arg(u"integ_alg") - integ_key = args.get_arg(u"integ_key") - l_spi = int(args.get_arg(u"l_spi")) - r_spi = int(args.get_arg(u"r_spi")) - - ip_layer = IP if ip_address(src_ip).version == 4 else IPv6 - ip_pkt = ip_layer(src=src_ip, dst=dst_ip, proto=61) if ip_layer == IP \ - else ip_layer(src=src_ip, dst=dst_ip) - - tunnel_in = ip_layer(src=src_tun, dst=dst_tun) - tunnel_out = ip_layer(src=dst_tun, dst=src_tun) - - sa_in = SecurityAssociation( - ESP, spi=l_spi, crypt_algo=crypto_alg, - crypt_key=crypto_key.encode(encoding=u"utf-8"), auth_algo=integ_alg, - auth_key=integ_key.encode(encoding=u"utf-8"), - tunnel_header=tunnel_in - ) - - sa_out = SecurityAssociation( - ESP, spi=r_spi, crypt_algo=crypto_alg, - crypt_key=crypto_key.encode(encoding=u"utf-8"), auth_algo=integ_alg, - auth_key=integ_key.encode(encoding=u"utf-8"), - tunnel_header=tunnel_out - ) - - sent_packets = list() - tx_pkt_send = (Ether(src=tx_src_mac, dst=tx_dst_mac) / ip_pkt) - tx_pkt_send /= Raw() - size_limit = 78 if ip_layer == IPv6 else 64 - if len(tx_pkt_send) < size_limit: - tx_pkt_send[Raw].load += (b"\0" * (size_limit - len(tx_pkt_send))) - sent_packets.append(tx_pkt_send) - tx_txq.send(tx_pkt_send) - - while True: - rx_pkt_recv = rx_rxq.recv(2) - - if rx_pkt_recv is None: - raise RuntimeError(f"{ip_layer.name} packet Rx timeout") - - if rx_pkt_recv.haslayer(ICMPv6ND_NS): - # read another packet in the queue if the current one is ICMPv6ND_NS - continue - else: - # otherwise process the current packet - break - - check_ipsec( - rx_pkt_recv, ip_layer, rx_src_mac, rx_dst_mac, src_tun, dst_tun, src_ip, - dst_ip, sa_in - ) - - ip_pkt = ip_layer(src=dst_ip, dst=src_ip, proto=61) if ip_layer == IP \ - else ip_layer(src=dst_ip, dst=src_ip) - ip_pkt /= Raw() - if len(ip_pkt) < (size_limit - 14): - ip_pkt[Raw].load += (b"\0" * (size_limit - 14 - len(ip_pkt))) - e_pkt = sa_out.encrypt(ip_pkt) - rx_pkt_send = (Ether(src=rx_dst_mac, dst=rx_src_mac) / - e_pkt) - rx_txq.send(rx_pkt_send) - - while True: - tx_pkt_recv = tx_rxq.recv(2, ignore=sent_packets) - - if tx_pkt_recv is None: - raise RuntimeError(f"{ip_layer.name} packet Rx timeout") - - if tx_pkt_recv.haslayer(ICMPv6ND_NS): - # read another packet in the queue if the current one is ICMPv6ND_NS - continue - else: - # otherwise process the current packet - break - - check_ip(tx_pkt_recv, ip_layer, tx_dst_mac, tx_src_mac, dst_ip, src_ip) - - sys.exit(0) - - -if __name__ == u"__main__": - main() diff --git a/resources/traffic_scripts/ipsec_policy.py b/resources/traffic_scripts/ipsec_policy.py deleted file mode 100755 index 0dbf2af581..0000000000 --- a/resources/traffic_scripts/ipsec_policy.py +++ /dev/null @@ -1,231 +0,0 @@ -#!/usr/bin/env python3 - -# Copyright (c) 2020 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. - -"""Traffic script for IPsec verification.""" - -import sys - -from ipaddress import ip_address -from scapy.layers.inet import IP -from scapy.layers.inet6 import IPv6, ICMPv6ND_NS -from scapy.layers.ipsec import SecurityAssociation, ESP -from scapy.layers.l2 import Ether -from scapy.packet import Raw - -from resources.libraries.python.PacketVerifier import RxQueue, TxQueue -from resources.libraries.python.TrafficScriptArg import TrafficScriptArg - - -def check_ipsec(pkt_recv, ip_layer, dst_tun, src_ip, dst_ip, sa_in): - """Check received IPsec packet. - - :param pkt_recv: Received packet to verify. - :param ip_layer: Scapy IP layer. - :param dst_tun: IPsec tunnel destination address. - :param src_ip: Source IP/IPv6 address of original IP/IPv6 packet. - :param dst_ip: Destination IP/IPv6 address of original IP/IPv6 packet. - :param sa_in: IPsec SA for packet decryption. - :type pkt_recv: scapy.Ether - :type ip_layer: scapy.layers.inet.IP or scapy.layers.inet6.IPv6 - :type dst_tun: str - :type src_ip: str - :type dst_ip: str - :type sa_in: scapy.layers.ipsec.SecurityAssociation - :raises RuntimeError: If received packet is invalid. - """ - if not pkt_recv.haslayer(ip_layer): - raise RuntimeError( - f"Not an {ip_layer.name} packet received: {pkt_recv!r}" - ) - - if pkt_recv[ip_layer].dst != dst_tun: - raise RuntimeError( - f"Received packet has invalid destination address: " - f"{pkt_recv[ip_layer].dst} should be: {dst_tun}" - ) - - if not pkt_recv.haslayer(ESP): - raise RuntimeError(f"Not an ESP packet received: {pkt_recv!r}") - - ip_pkt = pkt_recv[ip_layer] - d_pkt = sa_in.decrypt(ip_pkt) - - if d_pkt[ip_layer].dst != dst_ip: - raise RuntimeError( - f"Decrypted packet has invalid destination address: " - f"{d_pkt[ip_layer].dst} should be: {dst_ip}" - ) - - if d_pkt[ip_layer].src != src_ip: - raise RuntimeError( - f"Decrypted packet has invalid source address: " - f"{d_pkt[ip_layer].src} should be: {src_ip}" - ) - - if ip_layer == IP and d_pkt[ip_layer].proto != 61: - raise RuntimeError( - f"Decrypted packet has invalid IP protocol: " - f"{d_pkt[ip_layer].proto} should be: 61" - ) - - -def check_ip(pkt_recv, ip_layer, src_ip, dst_ip): - """Check received IP/IPv6 packet. - - :param pkt_recv: Received packet to verify. - :param ip_layer: Scapy IP layer. - :param src_ip: Source IP/IPv6 address. - :param dst_ip: Destination IP/IPv6 address. - :type pkt_recv: scapy.Ether - :type ip_layer: scapy.layers.inet.IP or scapy.layers.inet6.IPv6 - :type src_ip: str - :type dst_ip: str - :raises RuntimeError: If received packet is invalid. - """ - if not pkt_recv.haslayer(ip_layer): - raise RuntimeError( - f"Not an {ip_layer.name} packet received: {pkt_recv!r}" - ) - - if pkt_recv[ip_layer].dst != dst_ip: - raise RuntimeError( - f"Received packet has invalid destination address: " - f"{pkt_recv[ip_layer.name].dst} should be: {dst_ip}" - ) - - if pkt_recv[ip_layer].src != src_ip: - raise RuntimeError( - f"Received packet has invalid destination address: " - f"{pkt_recv[ip_layer.name].dst} should be: {src_ip}" - ) - - if ip_layer == IP and pkt_recv[ip_layer].proto != 61: - raise RuntimeError( - f"Received packet has invalid IP protocol: " - f"{pkt_recv[ip_layer].proto} should be: 61" - ) - - -# TODO: Pylint says too-many-locals and too-many-statements. Refactor! -def main(): - """Send and receive IPsec packet.""" - - args = TrafficScriptArg( - [ - u"tx_src_mac", u"tx_dst_mac", u"rx_src_mac", u"rx_dst_mac", - u"src_ip", u"dst_ip", u"crypto_alg", u"crypto_key", u"integ_alg", - u"integ_key", u"l_spi", u"r_spi" - ], - [u"src_tun", u"dst_tun"] - ) - - tx_txq = TxQueue(args.get_arg(u"tx_if")) - tx_rxq = RxQueue(args.get_arg(u"tx_if")) - rx_txq = TxQueue(args.get_arg(u"rx_if")) - rx_rxq = RxQueue(args.get_arg(u"rx_if")) - - tx_src_mac = args.get_arg(u"tx_src_mac") - tx_dst_mac = args.get_arg(u"tx_dst_mac") - rx_src_mac = args.get_arg(u"rx_src_mac") - rx_dst_mac = args.get_arg(u"rx_dst_mac") - src_ip = args.get_arg(u"src_ip") - dst_ip = args.get_arg(u"dst_ip") - crypto_alg = args.get_arg(u"crypto_alg") - crypto_key = args.get_arg(u"crypto_key") - integ_alg = args.get_arg(u"integ_alg") - integ_key = args.get_arg(u"integ_key") - l_spi = int(args.get_arg(u"l_spi")) - r_spi = int(args.get_arg(u"r_spi")) - src_tun = args.get_arg(u"src_tun") - dst_tun = args.get_arg(u"dst_tun") - - ip_layer = IP if ip_address(src_ip).version == 4 else IPv6 - - tunnel_out = ip_layer(src=src_tun, dst=dst_tun) if src_tun and dst_tun \ - else None - tunnel_in = ip_layer(src=dst_tun, dst=src_tun) if src_tun and dst_tun \ - else None - - if not (src_tun and dst_tun): - src_tun = src_ip - - sa_in = SecurityAssociation( - ESP, spi=r_spi, crypt_algo=crypto_alg, - crypt_key=crypto_key.encode(encoding=u"utf-8"), auth_algo=integ_alg, - auth_key=integ_key.encode(encoding=u"utf-8"), tunnel_header=tunnel_in - ) - - sa_out = SecurityAssociation( - ESP, spi=l_spi, crypt_algo=crypto_alg, - crypt_key=crypto_key.encode(encoding=u"utf-8"), auth_algo=integ_alg, - auth_key=integ_key.encode(encoding=u"utf-8"), tunnel_header=tunnel_out - ) - - ip_pkt = ip_layer(src=src_ip, dst=dst_ip, proto=61) if ip_layer == IP \ - else ip_layer(src=src_ip, dst=dst_ip) - ip_pkt = ip_layer(ip_pkt) - - e_pkt = sa_out.encrypt(ip_pkt) - tx_pkt_send = (Ether(src=tx_src_mac, dst=tx_dst_mac) / - e_pkt) - - sent_packets = list() - tx_pkt_send /= Raw() - sent_packets.append(tx_pkt_send) - tx_txq.send(tx_pkt_send) - - while True: - rx_pkt_recv = rx_rxq.recv(2) - - if rx_pkt_recv is None: - raise RuntimeError(f"{ip_layer.name} packet Rx timeout") - - if rx_pkt_recv.haslayer(ICMPv6ND_NS): - # read another packet in the queue if the current one is ICMPv6ND_NS - continue - else: - # otherwise process the current packet - break - - check_ip(rx_pkt_recv, ip_layer, src_ip, dst_ip) - - rx_ip_pkt = ip_layer(src=dst_ip, dst=src_ip, proto=61) if ip_layer == IP \ - else ip_layer(src=dst_ip, dst=src_ip) - rx_pkt_send = (Ether(src=rx_dst_mac, dst=rx_src_mac) / - rx_ip_pkt) - - rx_pkt_send /= Raw() - rx_txq.send(rx_pkt_send) - - while True: - tx_pkt_recv = tx_rxq.recv(2, sent_packets) - - if tx_pkt_recv is None: - raise RuntimeError(u"ESP packet Rx timeout") - - if tx_pkt_recv.haslayer(ICMPv6ND_NS): - # read another packet in the queue if the current one is ICMPv6ND_NS - continue - else: - # otherwise process the current packet - break - - check_ipsec(tx_pkt_recv, ip_layer, src_tun, dst_ip, src_ip, sa_in) - - sys.exit(0) - - -if __name__ == u"__main__": - main() diff --git a/resources/traffic_scripts/lisp/lisp_check.py b/resources/traffic_scripts/lisp/lisp_check.py deleted file mode 100755 index ebd769fa9d..0000000000 --- a/resources/traffic_scripts/lisp/lisp_check.py +++ /dev/null @@ -1,187 +0,0 @@ -#!/usr/bin/env python3 - -# 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. - -"""Traffic script that sends an ICMP/ICMPv6 packet out one interface, receives -a LISP-encapsulated packet on the other interface and verifies received packet. -""" - -import sys -import ipaddress - -from scapy.all import bind_layers, Packet -from scapy.fields import FlagsField, BitField, IntField -from scapy.layers.inet import ICMP, IP, UDP -from scapy.layers.inet6 import ICMPv6EchoRequest -from scapy.layers.inet6 import IPv6 -from scapy.layers.l2 import Ether -from scapy.packet import Raw - -from resources.libraries.python.PacketVerifier import RxQueue, TxQueue -from resources.libraries.python.TrafficScriptArg import TrafficScriptArg - - -class LispHeader(Packet): - """Scapy header for the LISP Layer.""" - - name = u"Lisp Header" - fields_desc = [ - FlagsField( - u"flags", None, 8, [u"N", u"L", u"E", u"V", u"I", u"", u"", u""] - ), - BitField(u"nonce/map_version", 0, size=24), - IntField(u"instance_id/locator_status_bits", 0)] - - -class LispInnerIP(IP): - """Scapy inner LISP layer for IPv4-in-IPv4.""" - - name = u"Lisp Inner Layer - IPv4" - - -class LispInnerIPv6(IPv6): - """Scapy inner LISP layer for IPv6-in-IPv6.""" - - name = u"Lisp Inner Layer - IPv6" - - -def valid_ipv4(ip): - try: - ipaddress.IPv4Address(ip) - return True - except (AttributeError, ipaddress.AddressValueError): - return False - - -def valid_ipv6(ip): - try: - ipaddress.IPv6Address(ip) - return True - except (AttributeError, ipaddress.AddressValueError): - return False - - -def main(): - """Send IP ICMP packet from one traffic generator interface to the other. - - :raises RuntimeError: If the received packet is not correct.""" - - args = TrafficScriptArg( - [ - u"tg_src_mac", u"tg_dst_mac", u"src_ip", u"dst_ip", u"dut_if1_mac", - u"dut_if2_mac", u"src_rloc", u"dst_rloc" - ], - [u"ot_mode"] - ) - - tx_src_mac = args.get_arg(u"tg_src_mac") - tx_dst_mac = args.get_arg(u"dut_if1_mac") - rx_dst_mac = args.get_arg(u"tg_dst_mac") - rx_src_mac = args.get_arg(u"dut_if2_mac") - src_ip = args.get_arg(u"src_ip") - dst_ip = args.get_arg(u"dst_ip") - src_rloc = args.get_arg(u"src_rloc") - dst_rloc = args.get_arg(u"dst_rloc") - tx_if = args.get_arg(u"tx_if") - rx_if = args.get_arg(u"rx_if") - ot_mode = args.get_arg(u"ot_mode") - - rxq = RxQueue(rx_if) - txq = TxQueue(tx_if) - - pkt_raw = Ether(src=tx_src_mac, dst=tx_dst_mac) - - if valid_ipv4(src_ip) and valid_ipv4(dst_ip): - pkt_raw /= IP(src=src_ip, dst=dst_ip) - pkt_raw /= ICMP() - ip_format = IP - lisp_layer = LispInnerIP - elif valid_ipv6(src_ip) and valid_ipv6(dst_ip): - pkt_raw /= IPv6(src=src_ip, dst=dst_ip) - pkt_raw /= ICMPv6EchoRequest() - ip_format = IPv6 - lisp_layer = LispInnerIPv6 - else: - raise ValueError(u"IP not in correct format") - - bind_layers(UDP, LispHeader, dport=4341) - bind_layers(LispHeader, lisp_layer) - - pkt_raw /= Raw() - sent_packets = list() - sent_packets.append(pkt_raw) - txq.send(pkt_raw) - - if tx_if == rx_if: - ether = rxq.recv(2, ignore=sent_packets) - else: - ether = rxq.recv(2) - - if ether is None: - raise RuntimeError(u"ICMP echo Rx timeout") - - if rx_dst_mac == ether[Ether].dst and rx_src_mac == ether[Ether].src: - print(u"MAC addresses match.") - else: - raise RuntimeError(f"Matching packet unsuccessful: {ether!r}") - - ip = ether.payload - - if ot_mode == u"6to4": - if not isinstance(ip, IP): - raise RuntimeError(f"Not an IP packet received {ip!r}") - elif ot_mode == u"4to6": - if not isinstance(ip, IPv6): - raise RuntimeError(f"Not an IP packet received {ip!r}") - elif not isinstance(ip, ip_format): - raise RuntimeError(f"Not an IP packet received {ip!r}") - - lisp = ether.getlayer(lisp_layer) - if not lisp: - raise RuntimeError("Lisp layer not present or parsing failed.") - - # Compare data from packets - if src_ip == lisp.src: - print(u"Source IP matches source EID.") - else: - raise RuntimeError( - f"Matching Src IP unsuccessful: {src_ip} != {lisp.src}" - ) - - if dst_ip == lisp.dst: - print(u"Destination IP matches destination EID.") - else: - raise RuntimeError( - f"Matching Dst IP unsuccessful: {dst_ip} != {lisp.dst}" - ) - - if src_rloc == ip.src: - print(u"Source RLOC matches configuration.") - else: - raise RuntimeError( - f"Matching Src RLOC unsuccessful: {src_rloc} != {ip.src}" - ) - - if dst_rloc == ip.dst: - print(u"Destination RLOC matches configuration.") - else: - raise RuntimeError( - f"Matching dst RLOC unsuccessful: {dst_rloc} != {ip.dst}" - ) - - sys.exit(0) - - -if __name__ == u"__main__": - main() diff --git a/resources/traffic_scripts/lisp/lispgpe_check.py b/resources/traffic_scripts/lisp/lispgpe_check.py deleted file mode 100755 index 50857c4fe8..0000000000 --- a/resources/traffic_scripts/lisp/lispgpe_check.py +++ /dev/null @@ -1,210 +0,0 @@ -#!/usr/bin/env python3 - -# 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. - -"""Traffic script that sends an ICMP/ICMPv6 packet out one interface, receives -a LISPGPE-encapsulated packet on the other interface and verifies received -packet. -""" - -import sys -import ipaddress - -from scapy.all import bind_layers, Packet -from scapy.fields import FlagsField, BitField, XBitField, IntField -from scapy.layers.inet import ICMP, IP, UDP -from scapy.layers.inet6 import ICMPv6EchoRequest -from scapy.layers.inet6 import IPv6 -from scapy.layers.l2 import Ether -from scapy.packet import Raw - -from resources.libraries.python.PacketVerifier import RxQueue, TxQueue -from resources.libraries.python.TrafficScriptArg import TrafficScriptArg - - -class LispGPEHeader(Packet): - """Scapy header for the Lisp GPE Layer.""" - - name = "Lisp GPE Header" - fields_desc = [ - FlagsField( - u"flags", None, 8, [u"N", u"L", u"E", u"V", u"I", u"P", u"R", u"O"] - ), - BitField(u"version", 0, size=2), - BitField(u"reserved", 0, size=14), - XBitField(u"next_protocol", 0, size=8), - IntField(u"instance_id/locator_status_bits", 0) - ] - - def guess_payload_class(self, payload): - protocol = { - 0x1: LispGPEInnerIP, - 0x2: LispGPEInnerIPv6, - 0x3: LispGPEInnerEther, - 0x4: LispGPEInnerNSH - } - return protocol[self.next_protocol] - - -class LispGPEInnerIP(IP): - """Scapy inner LISP GPE layer for IPv4-in-IPv4.""" - - name = u"Lisp GPE Inner Layer - IPv4" - - -class LispGPEInnerIPv6(IPv6): - """Scapy inner LISP GPE layer for IPv6-in-IPv6.""" - - name = u"Lisp GPE Inner Layer - IPv6" - - -class LispGPEInnerEther(Ether): - """Scapy inner LISP GPE layer for Lisp-L2.""" - - name = u"Lisp GPE Inner Layer - Ethernet" - - -class LispGPEInnerNSH(Packet): - """Scapy inner LISP GPE layer for Lisp-NSH. - - Parsing not implemented. - """ - - -def valid_ipv4(ip): - try: - ipaddress.IPv4Address(ip) - return True - except (AttributeError, ipaddress.AddressValueError): - return False - - -def valid_ipv6(ip): - try: - ipaddress.IPv6Address(ip) - return True - except (AttributeError, ipaddress.AddressValueError): - return False - - -def main(): - """Send IP ICMP packet from one traffic generator interface to the other. - - :raises RuntimeError: If the received packet is not correct.""" - - args = TrafficScriptArg( - [ - u"tg_src_mac", u"tg_dst_mac", u"src_ip", u"dst_ip", u"dut_if1_mac", - u"dut_if2_mac", u"src_rloc", u"dst_rloc" - ], - [u"ot_mode"] - ) - - tx_src_mac = args.get_arg(u"tg_src_mac") - tx_dst_mac = args.get_arg(u"dut_if1_mac") - rx_dst_mac = args.get_arg(u"tg_dst_mac") - rx_src_mac = args.get_arg(u"dut_if2_mac") - src_ip = args.get_arg(u"src_ip") - dst_ip = args.get_arg(u"dst_ip") - src_rloc = args.get_arg(u"src_rloc") - dst_rloc = args.get_arg(u"dst_rloc") - tx_if = args.get_arg(u"tx_if") - rx_if = args.get_arg(u"rx_if") - ot_mode = args.get_arg(u"ot_mode") - - rxq = RxQueue(rx_if) - txq = TxQueue(tx_if) - - pkt_raw = Ether(src=tx_src_mac, dst=tx_dst_mac) - - if valid_ipv4(src_ip) and valid_ipv4(dst_ip): - pkt_raw /= IP(src=src_ip, dst=dst_ip) - pkt_raw /= ICMP() - ip_format = IP - elif valid_ipv6(src_ip) and valid_ipv6(dst_ip): - pkt_raw /= IPv6(src=src_ip, dst=dst_ip) - pkt_raw /= ICMPv6EchoRequest() - ip_format = IPv6 - else: - raise ValueError(u"IP not in correct format") - - bind_layers(UDP, LispGPEHeader, dport=4341) - - pkt_raw /= Raw() - sent_packets = list() - sent_packets.append(pkt_raw) - txq.send(pkt_raw) - - if tx_if == rx_if: - ether = rxq.recv(2, ignore=sent_packets) - else: - ether = rxq.recv(2) - - if ether is None: - raise RuntimeError(u"ICMP echo Rx timeout") - - if rx_dst_mac == ether[Ether].dst and rx_src_mac == ether[Ether].src: - print(u"MAC addresses match.") - else: - raise RuntimeError(f"Matching packet unsuccessful: {ether!r}") - - ip = ether.payload - - if ot_mode == u"6to4": - if not isinstance(ip, IP): - raise RuntimeError(f"Not an IP packet received {ip!r}") - elif ot_mode == u"4to6": - if not isinstance(ip, IPv6): - raise RuntimeError(f"Not an IP packet received {ip!r}") - elif not isinstance(ip, ip_format): - raise RuntimeError(f"Not an IP packet received {ip!r}") - - lisp = ether.getlayer(LispGPEHeader).underlayer - if not lisp: - raise RuntimeError(u"Lisp layer not present or parsing failed.") - - # Compare data from packets - if src_ip == lisp.src: - print(u"Source IP matches source EID.") - else: - raise RuntimeError( - f"Matching Src IP unsuccessful: {src_ip} != {lisp.src}" - ) - - if dst_ip == lisp.dst: - print(u"Destination IP matches destination EID.") - else: - raise RuntimeError( - f"Matching Dst IP unsuccessful: {dst_ip} != {lisp.dst}" - ) - - if src_rloc == ip.src: - print(u"Source RLOC matches configuration.") - else: - raise RuntimeError( - f"Matching Src RLOC unsuccessful: {src_rloc} != {ip.src}" - ) - - if dst_rloc == ip.dst: - print(u"Destination RLOC matches configuration.") - else: - raise RuntimeError( - f"Matching dst RLOC unsuccessful: {dst_rloc} != {ip.dst}" - ) - - sys.exit(0) - - -if __name__ == u"__main__": - main() diff --git a/resources/traffic_scripts/policer.py b/resources/traffic_scripts/policer.py deleted file mode 100755 index 97cad612ac..0000000000 --- a/resources/traffic_scripts/policer.py +++ /dev/null @@ -1,122 +0,0 @@ -#!/usr/bin/env python3 - -# 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. - -"""Traffic script for IPsec verification.""" - -import sys -import logging - -from ipaddress import ip_address -from scapy.layers.l2 import Ether -from scapy.layers.inet import IP, TCP -from scapy.layers.inet6 import IPv6, ICMPv6ND_NS -from scapy.packet import Raw - -from resources.libraries.python.TrafficScriptArg import TrafficScriptArg -from resources.libraries.python.PacketVerifier import RxQueue, TxQueue - - -def check_ipv4(pkt_recv, dscp): - """Check received IPv4 IPsec packet. - - :param pkt_recv: Received packet to verify. - :param dscp: DSCP value to check. - :type pkt_recv: scapy.Ether - :type dscp: int - :raises RuntimeError: If received packet is invalid. - """ - if not pkt_recv.haslayer(IP): - raise RuntimeError(f"Not an IPv4 packet received: {pkt_recv!r}") - - rx_dscp = pkt_recv[IP].tos >> 2 - if rx_dscp != dscp: - raise RuntimeError(f"Invalid DSCP {rx_dscp} should be {dscp}") - - if not pkt_recv.haslayer(TCP): - raise RuntimeError(f"Not a TCP packet received: {pkt_recv!r}") - - -def check_ipv6(pkt_recv, dscp): - """Check received IPv6 IPsec packet. - - :param pkt_recv: Received packet to verify. - :param dscp: DSCP value to check. - :type pkt_recv: scapy.Ether - :type dscp: int - :raises RuntimeError: If received packet is invalid. - """ - if not pkt_recv.haslayer(IPv6): - raise RuntimeError(f"Not an IPv6 packet received: {pkt_recv!r}") - - rx_dscp = pkt_recv[IPv6].tc >> 2 - if rx_dscp != dscp: - raise RuntimeError(f"Invalid DSCP {rx_dscp} should be {dscp}") - - if not pkt_recv.haslayer(TCP): - raise RuntimeError(f"Not a TCP packet received: {pkt_recv!r}") - - -# TODO: Pylint says too-many-locals and too-many-statements. Refactor! -def main(): - """Send and receive TCP packet.""" - args = TrafficScriptArg( - [u"src_mac", u"dst_mac", u"src_ip", u"dst_ip", u"dscp"] - ) - - rxq = RxQueue(args.get_arg(u"rx_if")) - txq = TxQueue(args.get_arg(u"tx_if")) - - src_mac = args.get_arg(u"src_mac") - dst_mac = args.get_arg(u"dst_mac") - src_ip = args.get_arg(u"src_ip") - dst_ip = args.get_arg(u"dst_ip") - dscp = int(args.get_arg(u"dscp")) - - ip_layer = IPv6 if ip_address(src_ip).version == 6 else IP - - sent_packets = list() - pkt_send = (Ether(src=src_mac, dst=dst_mac) / - ip_layer(src=src_ip, dst=dst_ip) / - TCP()) - - pkt_send /= Raw() - sent_packets.append(pkt_send) - txq.send(pkt_send) - - while True: - pkt_recv = rxq.recv(2, sent_packets) - if pkt_recv is None: - raise RuntimeError(u"ICMPv6 echo reply Rx timeout") - - if pkt_recv.haslayer(ICMPv6ND_NS): - # read another packet in the queue if the current one is ICMPv6ND_NS - continue - else: - # otherwise process the current packet - break - - if pkt_recv is None: - raise RuntimeError(u"Rx timeout") - - if ip_layer == IP: - check_ipv4(pkt_recv, dscp) - else: - check_ipv6(pkt_recv, dscp) - - sys.exit(0) - - -if __name__ == u"__main__": - main() diff --git a/resources/traffic_scripts/send_icmp_wait_for_reply.py b/resources/traffic_scripts/send_icmp_wait_for_reply.py deleted file mode 100755 index 2c79ae7136..0000000000 --- a/resources/traffic_scripts/send_icmp_wait_for_reply.py +++ /dev/null @@ -1,136 +0,0 @@ -#!/usr/bin/env python3 - -# Copyright (c) 2016 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. - -"""Traffic script that sends an IP ICMPv4 or ICMPv6.""" - -import sys -import ipaddress - -from scapy.layers.inet import ICMP, IP -from scapy.layers.inet6 import IPv6, ICMPv6EchoRequest, ICMPv6EchoReply,\ - ICMPv6ND_NS -from scapy.layers.l2 import Ether -from scapy.packet import Raw - -from resources.libraries.python.PacketVerifier import RxQueue, TxQueue -from resources.libraries.python.TrafficScriptArg import TrafficScriptArg - - -def valid_ipv4(ip): - """Check if IP address has the correct IPv4 address format. - - :param ip: IP address. - :type ip: str - :return: True in case of correct IPv4 address format, - otherwise return False. - :rtype: bool - """ - try: - ipaddress.IPv4Address(ip) - return True - except (AttributeError, ipaddress.AddressValueError): - return False - - -def valid_ipv6(ip): - """Check if IP address has the correct IPv6 address format. - - :param ip: IP address. - :type ip: str - :return: True in case of correct IPv6 address format, - otherwise return False. - :rtype: bool - """ - try: - ipaddress.IPv6Address(ip) - return True - except (AttributeError, ipaddress.AddressValueError): - return False - - -def main(): - """Send ICMP echo request and wait for ICMP echo reply. It ignores all other - packets.""" - args = TrafficScriptArg( - [u"dst_mac", u"src_mac", u"dst_ip", u"src_ip", u"timeout"] - ) - - dst_mac = args.get_arg(u"dst_mac") - src_mac = args.get_arg(u"src_mac") - dst_ip = args.get_arg(u"dst_ip") - src_ip = args.get_arg(u"src_ip") - tx_if = args.get_arg(u"tx_if") - rx_if = args.get_arg(u"rx_if") - timeout = int(args.get_arg(u"timeout")) - wait_step = 1 - - rxq = RxQueue(rx_if) - txq = TxQueue(tx_if) - sent_packets = [] - - # Create empty ip ICMP packet - if valid_ipv4(src_ip) and valid_ipv4(dst_ip): - ip_layer = IP - icmp_req = ICMP - icmp_resp = ICMP - icmp_type = 0 # echo-reply - elif valid_ipv6(src_ip) and valid_ipv6(dst_ip): - ip_layer = IP - icmp_req = ICMPv6EchoRequest - icmp_resp = ICMPv6EchoReply - icmp_type = 0 # Echo Reply - else: - raise ValueError(u"IP not in correct format") - - icmp_request = ( - Ether(src=src_mac, dst=dst_mac) / - ip_layer(src=src_ip, dst=dst_ip) / - icmp_req() - ) - - # Send created packet on the interface - icmp_request /= Raw() - sent_packets.append(icmp_request) - txq.send(icmp_request) - - for _ in range(1000): - while True: - icmp_reply = rxq.recv(wait_step, ignore=sent_packets) - if icmp_reply is None: - timeout -= wait_step - if timeout < 0: - raise RuntimeError(u"ICMP echo Rx timeout") - - elif icmp_reply.haslayer(ICMPv6ND_NS): - # read another packet in the queue in case of ICMPv6ND_NS packet - continue - else: - # otherwise process the current packet - break - - if icmp_reply[ip_layer][icmp_resp].type == icmp_type: - if icmp_reply[ip_layer].src == dst_ip and \ - icmp_reply[ip_layer].dst == src_ip: - break - else: - raise RuntimeError(u"Max packet count limit reached") - - print(u"ICMP echo reply received.") - - sys.exit(0) - - -if __name__ == u"__main__": - main() diff --git a/resources/traffic_scripts/send_ip_check_headers.py b/resources/traffic_scripts/send_ip_check_headers.py deleted file mode 100755 index f5a55553cf..0000000000 --- a/resources/traffic_scripts/send_ip_check_headers.py +++ /dev/null @@ -1,164 +0,0 @@ -#!/usr/bin/env python3 - -# 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. - -"""Traffic script that sends an IP IPv4/IPv6 packet from one interface -to the other. Source and destination IP addresses and source and destination -MAC addresses are checked in received packet. -""" - -import sys - -import ipaddress - -from robot.api import logger -from scapy.layers.inet import IP -from scapy.layers.inet6 import IPv6, ICMPv6ND_NS -from scapy.layers.l2 import Ether, Dot1Q -from scapy.packet import Raw - -from resources.libraries.python.PacketVerifier import RxQueue, TxQueue -from resources.libraries.python.TrafficScriptArg import TrafficScriptArg - - -def valid_ipv4(ip): - try: - ipaddress.IPv4Address(ip) - return True - except (AttributeError, ipaddress.AddressValueError): - return False - - -def valid_ipv6(ip): - try: - ipaddress.IPv6Address(ip) - return True - except (AttributeError, ipaddress.AddressValueError): - return False - - -def main(): - """Send IP/IPv6 packet from one traffic generator interface to the other.""" - args = TrafficScriptArg( - [ - u"tg_src_mac", u"tg_dst_mac", u"src_ip", u"dst_ip", u"dut_if1_mac", - u"dut_if2_mac" - ], - [ - u"encaps_tx", u"vlan_tx", u"vlan_outer_tx", u"encaps_rx", - u"vlan_rx", u"vlan_outer_rx" - ] - ) - - tx_src_mac = args.get_arg(u"tg_src_mac") - tx_dst_mac = args.get_arg(u"dut_if1_mac") - rx_dst_mac = args.get_arg(u"tg_dst_mac") - rx_src_mac = args.get_arg(u"dut_if2_mac") - src_ip = args.get_arg(u"src_ip") - dst_ip = args.get_arg(u"dst_ip") - tx_if = args.get_arg(u"tx_if") - rx_if = args.get_arg(u"rx_if") - - encaps_tx = args.get_arg(u"encaps_tx") - vlan_tx = args.get_arg(u"vlan_tx") - vlan_outer_tx = args.get_arg(u"vlan_outer_tx") - encaps_rx = args.get_arg(u"encaps_rx") - vlan_rx = args.get_arg(u"vlan_rx") - vlan_outer_rx = args.get_arg(u"vlan_outer_rx") - - rxq = RxQueue(rx_if) - txq = TxQueue(tx_if) - - sent_packets =list() - pkt_raw = Ether(src=tx_src_mac, dst=tx_dst_mac) - - if encaps_tx == u"Dot1q": - pkt_raw /= Dot1Q(vlan=int(vlan_tx)) - elif encaps_tx == u"Dot1ad": - pkt_raw.type = 0x88a8 - pkt_raw /= Dot1Q(vlan=vlan_outer_tx) - pkt_raw /= Dot1Q(vlan=vlan_tx) - - if valid_ipv4(src_ip) and valid_ipv4(dst_ip): - pkt_raw /= IP(src=src_ip, dst=dst_ip, proto=61) - ip_format = IP - elif valid_ipv6(src_ip) and valid_ipv6(dst_ip): - pkt_raw /= IPv6(src=src_ip, dst=dst_ip) - ip_format = IPv6 - else: - raise ValueError(u"IP not in correct format") - - pkt_raw /= Raw() - sent_packets.append(pkt_raw) - txq.send(pkt_raw) - - while True: - if tx_if == rx_if: - ether = rxq.recv(2, ignore=sent_packets) - else: - ether = rxq.recv(2) - - if ether is None: - raise RuntimeError(u"IP packet Rx timeout") - - if ether.haslayer(ICMPv6ND_NS): - # read another packet in the queue if the current one is ICMPv6ND_NS - continue - else: - # otherwise process the current packet - break - - if rx_dst_mac == ether[Ether].dst and rx_src_mac == ether[Ether].src: - logger.trace(u"MAC matched") - else: - raise RuntimeError(f"Matching packet unsuccessful: {ether!r}") - - if encaps_rx == u"Dot1q": - if ether[Dot1Q].vlan == int(vlan_rx): - logger.trace(u"VLAN matched") - else: - raise RuntimeError( - f"Ethernet frame with wrong VLAN tag " - f"({ether[Dot1Q].vlan}-received, " - f"{vlan_rx}-expected):\n{ether!r}" - ) - ip = ether[Dot1Q].payload - elif encaps_rx == u"Dot1ad": - raise NotImplementedError() - else: - ip = ether.payload - - if not isinstance(ip, ip_format): - raise RuntimeError(f"Not an IP packet received {ip!r}") - - # Compare data from packets - if src_ip == ip.src: - logger.trace(u"Src IP matched") - else: - raise RuntimeError( - f"Matching Src IP unsuccessful: {src_ip} != {ip.src}" - ) - - if dst_ip == ip.dst: - logger.trace(u"Dst IP matched") - else: - raise RuntimeError( - f"Matching Dst IP unsuccessful: {dst_ip} != {ip.dst}" - ) - - sys.exit(0) - - -if __name__ == u"__main__": - main() diff --git a/resources/traffic_scripts/send_vxlan_check_vxlan.py b/resources/traffic_scripts/send_vxlan_check_vxlan.py deleted file mode 100755 index 162703d60c..0000000000 --- a/resources/traffic_scripts/send_vxlan_check_vxlan.py +++ /dev/null @@ -1,119 +0,0 @@ -#!/usr/bin/env python3 - -# 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. - -"""Traffic script that sends an IP ICMPv4/ICMPv6 packet from one interface to -the other one. Dot1q or Dot1ad tagging of the ethernet frame can be set. -""" - -import sys - -from scapy.layers.inet import IP, UDP -from scapy.layers.l2 import Ether -from scapy.packet import Raw - -from resources.libraries.python.PacketVerifier import RxQueue, TxQueue -from resources.libraries.python.TrafficScriptArg import TrafficScriptArg -from resources.traffic_scripts import vxlan - - -def main(): - """Send IP ICMPv4/ICMPv6 packet from one traffic generator interface to - the other one. Dot1q or Dot1ad tagging of the ethernet frame can be set. - """ - args = TrafficScriptArg( - [ - u"tx_src_mac", u"tx_dst_mac", u"tx_src_ip", u"tx_dst_ip", u"tx_vni", - u"rx_src_ip", u"rx_dst_ip", u"rx_vni" - ] - ) - - tx_if = args.get_arg(u"tx_if") - rx_if = args.get_arg(u"rx_if") - tx_src_mac = args.get_arg(u"tx_src_mac") - tx_dst_mac = args.get_arg(u"tx_dst_mac") - tx_src_ip = args.get_arg(u"tx_src_ip") - tx_dst_ip = args.get_arg(u"tx_dst_ip") - tx_vni = args.get_arg(u"tx_vni") - rx_src_ip = args.get_arg(u"rx_src_ip") - rx_dst_ip = args.get_arg(u"rx_dst_ip") - rx_vni = args.get_arg(u"rx_vni") - - rxq = RxQueue(rx_if) - txq = TxQueue(tx_if) - - sent_packets = [] - - tx_pkt_p = (Ether(src=u"02:00:00:00:00:01", dst=u"02:00:00:00:00:02") / - IP(src=u"192.168.1.1", dst=u"192.168.1.2") / - UDP(sport=12345, dport=1234) / - Raw(u"raw data")) - - pkt_raw = (Ether(src=tx_src_mac, dst=tx_dst_mac) / - IP(src=tx_src_ip, dst=tx_dst_ip) / - UDP(sport=23456) / - vxlan.VXLAN(vni=int(tx_vni)) / - tx_pkt_p) - - pkt_raw /= Raw() - # Send created packet on one interface and receive on the other - sent_packets.append(pkt_raw) - txq.send(pkt_raw) - - ether = rxq.recv(2, ignore=sent_packets) - - # Check whether received packet contains layers Ether, IP and VXLAN - if ether is None: - raise RuntimeError(u"Packet Rx timeout") - ip = ether.payload - - if ip.src != rx_src_ip: - raise RuntimeError(f"IP src mismatch {ip.src} != {rx_src_ip}") - if ip.dst != rx_dst_ip: - raise RuntimeError(f"IP dst mismatch {ip.dst} != {rx_dst_ip}") - if ip.payload.dport != 4789: - raise RuntimeError( - f"VXLAN UDP port mismatch {ip.payload.dport} != 4789" - ) - vxlan_pkt = ip.payload.payload - - if int(vxlan_pkt.vni) != int(rx_vni): - raise RuntimeError(u"vxlan mismatch") - rx_pkt_p = vxlan_pkt.payload - - if rx_pkt_p.src != tx_pkt_p.src: - raise RuntimeError( - f"RX encapsulated MAC src mismatch {rx_pkt_p.src} != {tx_pkt_p.src}" - ) - if rx_pkt_p.dst != tx_pkt_p.dst: - raise RuntimeError( - f"RX encapsulated MAC dst mismatch {rx_pkt_p.dst} != {tx_pkt_p.dst}" - ) - if rx_pkt_p[IP].src != tx_pkt_p[IP].src: - raise RuntimeError( - f"RX encapsulated IP src mismatch {rx_pkt_p[IP].src} != " - f"{tx_pkt_p[IP].src}" - ) - if rx_pkt_p[IP].dst != tx_pkt_p[IP].dst: - raise RuntimeError( - f"RX encapsulated IP dst mismatch {rx_pkt_p[IP].dst} != " - f"{tx_pkt_p[IP].dst}" - ) - - # TODO: verify inner Ether() - - sys.exit(0) - -if __name__ == u"__main__": - main() diff --git a/resources/traffic_scripts/srv6_encap.py b/resources/traffic_scripts/srv6_encap.py deleted file mode 100755 index 506a245576..0000000000 --- a/resources/traffic_scripts/srv6_encap.py +++ /dev/null @@ -1,306 +0,0 @@ -#!/usr/bin/env python3 - -# Copyright (c) 2020 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. - -"""Traffic script for SRv6 verification.""" - -import sys - -from scapy.layers.inet6 import IPv6, ICMPv6ND_NS, IPv6ExtHdrSegmentRouting,\ - ipv6nh -from scapy.layers.l2 import Ether -from scapy.packet import Raw - -from resources.libraries.python.PacketVerifier import RxQueue, TxQueue -from resources.libraries.python.TrafficScriptArg import TrafficScriptArg - - -def check_srv6( - pkt_recv, src_mac, dst_mac, src_ip, dst_ip, dir_srcsid, dir_dstsid1, - dir_dstsid2, dir_dstsid3, segleft_corr, static_proxy=False): - """Check received SRv6 packet. - - :param pkt_recv: Received packet to verify. - :param src_mac: Source MAC address. - :param dst_mac: Destination MAC address. - :param src_ip: Source IP/IPv6 address of original IP/IPv6 packet. - :param dst_ip: Destination IP/IPv6 address of original IP/IPv6 packet. - :param dir_srcsid: Source SID for SR in desired direction. - :param dir_dstsid1: Destination SID1 in desired direction. - :param dir_dstsid2: Destination SID2 in desired direction. - :param dir_dstsid3: Destination SID3 in desired direction. - :param segleft_corr: Correction for expected segleft value of SRH. - :type pkt_recv: scapy.Ether - :type src_mac: str - :type dst_mac: str - :type src_ip: str - :type dst_ip: str - :type dir_srcsid: str - :type dir_dstsid1: str - :type dir_dstsid2: str - :type dir_dstsid3: str - :type segleft_corr: int - :type static_proxy; bool - :raises RuntimeError: If received packet is invalid. - """ - if pkt_recv[Ether].src != src_mac: - raise RuntimeError( - f"Received frame has invalid source MAC address: " - f"{pkt_recv[Ether].src} should be: {src_mac}" - ) - if pkt_recv[Ether].dst != dst_mac: - raise RuntimeError( - f"Received frame has invalid destination MAC address: " - f"{pkt_recv[Ether].dst} should be: {dst_mac}" - ) - if not pkt_recv.haslayer(IPv6): - raise RuntimeError( - f"Not an IPv6 packet received: {pkt_recv!r}" - ) - ip6_pkt = pkt_recv[IPv6] - if ip6_pkt.src != dir_srcsid: - raise RuntimeError( - f"Outer IPv6 packet has invalid source address: " - f"{ip6_pkt.src} should be: {dir_srcsid}" - ) - dir_dstsids = [dir_dstsid2, dir_dstsid1] if dir_dstsid3 == u"None" \ - else [dir_dstsid3, dir_dstsid2, dir_dstsid1] if not static_proxy \ - else [dir_dstsid3, dir_dstsid2] - segleft = len(dir_dstsids) - segleft_corr if not static_proxy \ - else len(dir_dstsids) - segleft_corr + 1 - if ip6_pkt.dst != dir_dstsids[segleft]: - raise RuntimeError( - f"Outer IPv6 packet has invalid destination address: " - f"{ip6_pkt.dst} should be: {dir_dstsids[segleft]}" - ) - if dir_dstsid2 == u"None": - if ip6_pkt.haslayer(IPv6ExtHdrSegmentRouting): - raise RuntimeError( - f"Segment Routing Header in received packet: {pkt_recv!r}" - ) - if ip6_pkt.nh != 41: # ipv6nh[41] == IPv6 - raise RuntimeError( - f"Outer IPv6 packet has invalid next header: " - f"{ip6_pkt.nh} should be: 41 ({ipv6nh[41]})" - ) - ip6_pkt = ip6_pkt[IPv6][1] - else: - if not pkt_recv.haslayer(IPv6ExtHdrSegmentRouting): - raise RuntimeError( - f"No Segment Routing Header in received packet: {pkt_recv!r}" - ) - if ip6_pkt.nh != 43: # ipv6nh[43] == Routing Header - raise RuntimeError( - f"Outer IPv6 packet has invalid next header: " - f"{pkt_recv[IPv6][0].nh} should be: 43 ({ipv6nh[43]})" - ) - ip6_pkt = ip6_pkt[IPv6ExtHdrSegmentRouting] - if ip6_pkt.addresses != dir_dstsids: - raise RuntimeError( - f"Segment Routing Header has invalid addresses: " - f"{ip6_pkt.addresses} should be: {dir_dstsids}" - ) - if ip6_pkt.segleft != segleft: - raise RuntimeError( - f"Segment Routing Header has invalid segleft value: " - f"{ip6_pkt.segleft} should be: {segleft}" - ) - if ip6_pkt.nh != 41: # ipv6nh[41] == IPv6 - raise RuntimeError( - f"Segment Routing Header has invalid next header: " - f"{ip6_pkt.nh} should be: 41 ({ipv6nh[41]})" - ) - ip6_pkt = ip6_pkt[IPv6] - if ip6_pkt.src != src_ip: - raise RuntimeError( - f"Inner IPv6 packet has invalid source address: " - f"{ip6_pkt.src} should be: {src_ip}" - ) - if ip6_pkt.dst != dst_ip: - raise RuntimeError( - f"Inner IPv6 packet has invalid destination address: " - f"{ip6_pkt.dst} should be: {dst_ip}" - ) - if ip6_pkt.nh != 59: # ipv6nh[59] == No Next Header - raise RuntimeError( - f"Inner IPv6 packet has invalid next header: " - f"{ip6_pkt.nh} should be: 59 ({ipv6nh[59]})" - ) - - -def check_ip(pkt_recv, src_mac, dst_mac, src_ip, dst_ip): - """Check received IPv6 packet. - - :param pkt_recv: Received packet to verify. - :param src_mac: Source MAC address. - :param dst_mac: Destination MAC address. - :param src_ip: Source IP/IPv6 address. - :param dst_ip: Destination IP/IPv6 address. - :type pkt_recv: scapy.Ether - :type src_mac: str - :type dst_mac: str - :type src_ip: str - :type dst_ip: str - :raises RuntimeError: If received packet is invalid. - """ - if pkt_recv[Ether].src != src_mac: - raise RuntimeError( - f"Received frame has invalid source MAC address: " - f"{pkt_recv[Ether].src} should be: {src_mac}" - ) - - if pkt_recv[Ether].dst != dst_mac: - raise RuntimeError( - f"Received frame has invalid destination MAC address: " - f"{pkt_recv[Ether].dst} should be: {dst_mac}" - ) - - if not pkt_recv.haslayer(IPv6): - raise RuntimeError( - f"Not an {IPv6.name} packet received: {pkt_recv!r}" - ) - - if pkt_recv[IPv6].dst != dst_ip: - raise RuntimeError( - f"Received packet has invalid destination address: " - f"{pkt_recv[IPv6.name].dst} should be: {dst_ip}" - ) - - if pkt_recv[IPv6].src != src_ip: - raise RuntimeError( - f"Received packet has invalid destination address: " - f"{pkt_recv[IPv6.name].dst} should be: {src_ip}" - ) - - if pkt_recv[IPv6].nh != 59: # ipv6nh[59] == No Next Header - raise RuntimeError( - f"Received IPv6 packet has invalid next header: " - f"{IPv6.nh} should be: 59 ({ipv6nh[59]})" - ) - - -def main(): - """Send, receive and check IPv6 and IPv6ExtHdrSegmentRouting packets.""" - - args = TrafficScriptArg( - [ - u"tx_src_mac", u"tx_dst_mac", u"rx_src_mac", u"rx_dst_mac", - u"src_ip", u"dst_ip", u"dir0_srcsid", u"dir0_dstsid1", - u"dir0_dstsid2", u"dir1_srcsid", u"dir1_dstsid1", u"dir1_dstsid2", - u"decap", u"dir0_dstsid3", u"dir1_dstsid3", u"static_proxy" - ] - ) - - tx_txq = TxQueue(args.get_arg(u"tx_if")) - tx_rxq = RxQueue(args.get_arg(u"tx_if")) - rx_txq = TxQueue(args.get_arg(u"rx_if")) - rx_rxq = RxQueue(args.get_arg(u"rx_if")) - - tx_src_mac = args.get_arg(u"tx_src_mac") - tx_dst_mac = args.get_arg(u"tx_dst_mac") - rx_src_mac = args.get_arg(u"rx_src_mac") - rx_dst_mac = args.get_arg(u"rx_dst_mac") - src_ip = args.get_arg(u"src_ip") - dst_ip = args.get_arg(u"dst_ip") - - dir0_srcsid = args.get_arg(u"dir0_srcsid") - dir0_dstsid1 = args.get_arg(u"dir0_dstsid1") - dir0_dstsid2 = args.get_arg(u"dir0_dstsid2") - dir1_srcsid = args.get_arg(u"dir1_srcsid") - dir1_dstsid1 = args.get_arg(u"dir1_dstsid1") - dir1_dstsid2 = args.get_arg(u"dir1_dstsid2") - decap = args.get_arg(u"decap") - dir0_dstsid3 = args.get_arg(u"dir0_dstsid3") - dir1_dstsid3 = args.get_arg(u"dir1_dstsid3") - static_proxy = args.get_arg(u"static_proxy") - - ip_pkt = IPv6(src=src_ip, dst=dst_ip) - - sent_packets = list() - tx_pkt_send = (Ether(src=tx_src_mac, dst=tx_dst_mac) / ip_pkt) - tx_pkt_send /= Raw() - size_limit = 78 - if len(tx_pkt_send) < size_limit: - tx_pkt_send[Raw].load += (b"\0" * (size_limit - len(tx_pkt_send))) - sent_packets.append(tx_pkt_send) - tx_txq.send(tx_pkt_send) - - while True: - rx_pkt_recv = rx_rxq.recv(2) - - if rx_pkt_recv is None: - raise RuntimeError(f"{IPv6.name} packet Rx timeout") - - if rx_pkt_recv.haslayer(ICMPv6ND_NS): - # read another packet in the queue if the current one is ICMPv6ND_NS - continue - else: - # otherwise process the current packet - break - - check_srv6( - rx_pkt_recv, rx_src_mac, rx_dst_mac, src_ip, dst_ip, dir0_srcsid, - dir0_dstsid1, dir0_dstsid2, dir0_dstsid3, 1 - ) - - ip_pkt = IPv6(src=dst_ip, dst=src_ip) - ip_pkt /= Raw() - if len(ip_pkt) < (size_limit - 14): - ip_pkt[Raw].load += (b"\0" * (size_limit - 14 - len(ip_pkt))) - - rx_pkt_send = ( - Ether(src=rx_dst_mac, dst=rx_src_mac) / - IPv6(src=dir1_srcsid, dst=dir1_dstsid1) / - IPv6ExtHdrSegmentRouting( - segleft=1 if dir1_dstsid3 == u"None" else 2, - lastentry=1 if dir1_dstsid3 == u"None" else 2, - addresses=[dir1_dstsid2, dir1_dstsid1] - if dir1_dstsid3 == u"None" - else [dir1_dstsid3, dir1_dstsid2, dir1_dstsid1] - ) / - ip_pkt - ) if dir1_dstsid2 != u"None" else ( - Ether(src=rx_dst_mac, dst=rx_src_mac) / - IPv6(src=dir1_srcsid, dst=dir1_dstsid1) / - ip_pkt - ) - rx_txq.send(rx_pkt_send) - - while True: - tx_pkt_recv = tx_rxq.recv(2, ignore=sent_packets) - - if tx_pkt_recv is None: - raise RuntimeError(f"{IPv6.name} packet Rx timeout") - - if tx_pkt_recv.haslayer(ICMPv6ND_NS): - # read another packet in the queue if the current one is ICMPv6ND_NS - continue - else: - # otherwise process the current packet - break - - if decap == u"True": - check_ip(tx_pkt_recv, tx_dst_mac, tx_src_mac, dst_ip, src_ip) - else: - check_srv6( - tx_pkt_recv, tx_dst_mac, tx_src_mac, dst_ip, src_ip, dir1_srcsid, - dir1_dstsid1, dir1_dstsid2, dir1_dstsid3, 2, - bool(static_proxy == u"True") - ) - - sys.exit(0) - - -if __name__ == u"__main__": - main() diff --git a/resources/traffic_scripts/vxlan.py b/resources/traffic_scripts/vxlan.py deleted file mode 100644 index eebfb9056e..0000000000 --- a/resources/traffic_scripts/vxlan.py +++ /dev/null @@ -1,19 +0,0 @@ -from scapy.fields import BitField, XByteField, X3BytesField -from scapy.layers.inet import UDP -from scapy.layers.l2 import Ether -from scapy.packet import Packet, bind_layers - - -class VXLAN(Packet): - name = u"VXLAN" - fields_desc = [ - BitField(u"flags", 0x08000000, 32), - X3BytesField(u"vni", 0), - XByteField(u"reserved", 0x00) - ] - - def mysummary(self): - return self.sprintf(f"VXLAN (vni={VXLAN.vni})") - -bind_layers(UDP, VXLAN, dport=4789) -bind_layers(VXLAN, Ether) |