aboutsummaryrefslogtreecommitdiffstats
path: root/GPL
diff options
context:
space:
mode:
authorVratko Polak <vrpolak@cisco.com>2020-05-04 13:05:26 +0200
committerVratko Polak <vrpolak@cisco.com>2020-05-06 14:03:21 +0000
commit79f5ba9bf7656972dd988508eff9465562dde42c (patch)
treea84714e81d65bfc4f0454fa8e327d4129f58ac79 /GPL
parent16ef90a2415aa3b65341fdb6517cf58721bfff7a (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 'GPL')
-rw-r--r--GPL/README.txt11
-rw-r--r--GPL/tools/trex/trex_server_info.py54
-rw-r--r--GPL/tools/trex/trex_stateless_profile.py345
-rw-r--r--GPL/tools/trex/trex_stateless_stop.py104
-rw-r--r--GPL/traffic_profiles/trex/profile_trex_stateless_base_class.py217
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-2n-dot1qip4asym-ip4src254.py133
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-2n-dot1qip6asym-ip6src253.py134
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-2n-ethip4-ip4dst-rnd10000.py127
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-2n-ethip4-ip4dst-rnd100000.py126
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-2n-ethip4-ip4dst-rnd1000000.py126
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-2n-ethip4-ip4dst10000.py125
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-2n-ethip4-ip4dst100000.py126
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-2n-ethip4-ip4dst1000000.py126
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-2n-ethip4-ip4src253.py126
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-2n-ethip4-ip4src254.py126
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-2n-ethip4-macsrc500kdst500k.py215
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-2n-ethip4-macsrc50kdst50k.py214
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-2n-ethip4-macsrc5kdst5k.py215
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-2n-ethip4udp-1000u15p.py146
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-2n-ethip4udp-10u1000p-conc.py189
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-2n-ethip4udp-1u1p.py104
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-2n-ethip4udp-lb.py150
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-2n-ethip6-ip6dst10000.py129
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-2n-ethip6-ip6dst100000.py129
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-2n-ethip6-ip6dst1000000.py129
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-2n-ethip6-ip6src253.py129
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-10c1n.py163
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-10c2n.py164
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-1c10n.py164
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-1c1n.py166
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-1c2n.py164
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-1c4n.py164
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-1c6n.py164
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-1c8n.py164
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-2c10n.py164
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-2c1n.py164
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-2c2n.py164
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-2c4n.py164
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-2c6n.py164
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-2c8n.py164
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-4c1n.py164
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-4c2n.py162
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-4c4n.py164
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-4c6n.py164
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-6c1n.py164
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-6c2n.py164
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-6c4n.py164
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-8c1n.py164
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-8c2n.py164
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-3n-dot1qip4-vlan100ip4src254ip4dst254.py191
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-3n-dot1qip4-vlan10ip4src254ip4dst254.py191
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-3n-dot1qip4-vlan1ip4src254ip4dst254.py166
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-3n-dot1qip4-vlan1kip4src254ip4dst254.py191
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst1.py85
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst100.py126
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst1000-1cnf.py157
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst1000-2cnf.py156
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst1000-4cnf.py157
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst1000-8cnf.py157
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst1000.py126
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst10000-1cnf.py157
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst10000-2cnf.py157
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst10000-4cnf.py157
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst10000-8cnf.py157
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst10000.py126
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst100000.py126
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst1000000.py126
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst20000-1cnf.py157
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst20000-2cnf.py157
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst20000-4cnf.py157
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst20000-8cnf.py157
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst20000.py126
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst253.py126
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst253_l3fwd.py126
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst4-1cnf.py157
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst4-2cnf.py157
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst4-4cnf.py157
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst4.py126
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40-1cnf.py157
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40-2cnf.py157
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40-4cnf.py157
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40-8cnf.py157
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40.py126
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst400-1cnf.py157
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst400-2cnf.py157
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst400-4cnf.py157
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst400-8cnf.py157
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst400.py126
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40000-1cnf.py157
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40000-2cnf.py157
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40000-4cnf.py157
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40000-8cnf.py157
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40000.py126
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst5000-1cnf.py157
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst5000-2cnf.py157
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst5000-4cnf.py157
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst5000-8cnf.py157
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst5000.py126
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst60000-1cnf.py157
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst60000-2cnf.py157
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst60000-4cnf.py157
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst60000-8cnf.py157
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst60000.py126
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4src253.py126
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4src254.py126
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-3n-ethip4-macsrc100ip4src100.py161
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-3n-ethip4-macsrc100kip4src100k.py161
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-3n-ethip4-macsrc10kip4src10k.py161
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-3n-ethip4-macsrc500kdst500k.py215
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-3n-ethip4-macsrc50kdst50k.py215
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-3n-ethip4-macsrc5kdst5k.py215
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-3n-ethip4udp-1000u15p.py148
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-3n-ethip4udp-100u1000p-conc.py189
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-3n-ethip4udp-100u15p.py148
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-3n-ethip4udp-10u1000p-conc.py189
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-3n-ethip4udp-10u10p-conc.py189
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-3n-ethip4udp-10u15p.py148
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-3n-ethip4udp-1u15p.py141
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-3n-ethip4udp-1u1p.py104
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-3n-ethip4udp-2000u15p.py148
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-3n-ethip4udp-4000u15p.py148
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-3n-ethip6-ip6dst10000.py129
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-3n-ethip6-ip6dst100000.py129
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-3n-ethip6-ip6dst1000000.py129
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-3n-ethip6-ip6src253.py129
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-dot1qip4-vlan1ip4src254ip4dst254-bvi.py170
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-dot1qip4-vlan1ip4src254ip4dst254.py164
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src10udpsrcrnd.py287
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src1udpsrcrnd.py288
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src2udpsrcrnd.py288
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src4udpsrcrnd.py288
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src6udpsrcrnd.py288
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src8udpsrcrnd.py288
-rw-r--r--GPL/traffic_profiles/trex/trex-sl-ethip4vxlan-ip4src1udpsrcrnd.py261
-rw-r--r--GPL/traffic_scripts/PacketVerifier.py344
-rw-r--r--GPL/traffic_scripts/TrafficScriptArg.py68
-rw-r--r--GPL/traffic_scripts/__init__.py16
-rw-r--r--GPL/traffic_scripts/ipsec_interface.py271
-rw-r--r--GPL/traffic_scripts/ipsec_policy.py231
-rw-r--r--GPL/traffic_scripts/lisp/__init__.py16
-rw-r--r--GPL/traffic_scripts/lisp/lisp_check.py187
-rw-r--r--GPL/traffic_scripts/lisp/lispgpe_check.py210
-rw-r--r--GPL/traffic_scripts/policer.py122
-rw-r--r--GPL/traffic_scripts/send_icmp_wait_for_reply.py136
-rw-r--r--GPL/traffic_scripts/send_ip_check_headers.py164
-rw-r--r--GPL/traffic_scripts/send_vxlan_check_vxlan.py119
-rw-r--r--GPL/traffic_scripts/srv6_encap.py306
-rw-r--r--GPL/traffic_scripts/vxlan.py32
148 files changed, 23600 insertions, 0 deletions
diff --git a/GPL/README.txt b/GPL/README.txt
new file mode 100644
index 0000000000..36de320ab5
--- /dev/null
+++ b/GPL/README.txt
@@ -0,0 +1,11 @@
+This directory (and its subdirectories)
+contain files that have to be distributed under GPL license,
+mostly because of linking with scapy.
+
+When migrating more files here, make sure to migrate
+also everything linking with them.
+
+Currently the license listed is still Apache 2.0,
+we are waiting for sign-offs as described in
+https://wiki.fd.io/view/TSC/Relicensing_Procedure
+before we switch the licenses.
diff --git a/GPL/tools/trex/trex_server_info.py b/GPL/tools/trex/trex_server_info.py
new file mode 100644
index 0000000000..8423801285
--- /dev/null
+++ b/GPL/tools/trex/trex_server_info.py
@@ -0,0 +1,54 @@
+#!/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. 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/GPL/tools/trex/trex_stateless_profile.py b/GPL/tools/trex/trex_stateless_profile.py
new file mode 100644
index 0000000000..a0de5c0cd3
--- /dev/null
+++ b/GPL/tools/trex/trex_stateless_profile.py
@@ -0,0 +1,345 @@
+#!/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/GPL/tools/trex/trex_stateless_stop.py b/GPL/tools/trex/trex_stateless_stop.py
new file mode 100644
index 0000000000..5e8721d28c
--- /dev/null
+++ b/GPL/tools/trex/trex_stateless_stop.py
@@ -0,0 +1,104 @@
+#!/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/GPL/traffic_profiles/trex/profile_trex_stateless_base_class.py b/GPL/traffic_profiles/trex/profile_trex_stateless_base_class.py
new file mode 100644
index 0000000000..a3736796eb
--- /dev/null
+++ b/GPL/traffic_profiles/trex/profile_trex_stateless_base_class.py
@@ -0,0 +1,217 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-2n-dot1qip4asym-ip4src254.py b/GPL/traffic_profiles/trex/trex-sl-2n-dot1qip4asym-ip4src254.py
new file mode 100644
index 0000000000..ae411e233b
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-2n-dot1qip4asym-ip4src254.py
@@ -0,0 +1,133 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-2n-dot1qip6asym-ip6src253.py b/GPL/traffic_profiles/trex/trex-sl-2n-dot1qip6asym-ip6src253.py
new file mode 100644
index 0000000000..f2e9e81920
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-2n-dot1qip6asym-ip6src253.py
@@ -0,0 +1,134 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-2n-ethip4-ip4dst-rnd10000.py b/GPL/traffic_profiles/trex/trex-sl-2n-ethip4-ip4dst-rnd10000.py
new file mode 100644
index 0000000000..16627f0884
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-2n-ethip4-ip4dst-rnd10000.py
@@ -0,0 +1,127 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-2n-ethip4-ip4dst-rnd100000.py b/GPL/traffic_profiles/trex/trex-sl-2n-ethip4-ip4dst-rnd100000.py
new file mode 100644
index 0000000000..751528d10c
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-2n-ethip4-ip4dst-rnd100000.py
@@ -0,0 +1,126 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-2n-ethip4-ip4dst-rnd1000000.py b/GPL/traffic_profiles/trex/trex-sl-2n-ethip4-ip4dst-rnd1000000.py
new file mode 100644
index 0000000000..58ab03516c
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-2n-ethip4-ip4dst-rnd1000000.py
@@ -0,0 +1,126 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-2n-ethip4-ip4dst10000.py b/GPL/traffic_profiles/trex/trex-sl-2n-ethip4-ip4dst10000.py
new file mode 100644
index 0000000000..e9d5fb15f6
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-2n-ethip4-ip4dst10000.py
@@ -0,0 +1,125 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-2n-ethip4-ip4dst100000.py b/GPL/traffic_profiles/trex/trex-sl-2n-ethip4-ip4dst100000.py
new file mode 100644
index 0000000000..5977d36b5b
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-2n-ethip4-ip4dst100000.py
@@ -0,0 +1,126 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-2n-ethip4-ip4dst1000000.py b/GPL/traffic_profiles/trex/trex-sl-2n-ethip4-ip4dst1000000.py
new file mode 100644
index 0000000000..8b63b82e4f
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-2n-ethip4-ip4dst1000000.py
@@ -0,0 +1,126 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-2n-ethip4-ip4src253.py b/GPL/traffic_profiles/trex/trex-sl-2n-ethip4-ip4src253.py
new file mode 100644
index 0000000000..883883ad18
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-2n-ethip4-ip4src253.py
@@ -0,0 +1,126 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-2n-ethip4-ip4src254.py b/GPL/traffic_profiles/trex/trex-sl-2n-ethip4-ip4src254.py
new file mode 100644
index 0000000000..fc6167d126
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-2n-ethip4-ip4src254.py
@@ -0,0 +1,126 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-2n-ethip4-macsrc500kdst500k.py b/GPL/traffic_profiles/trex/trex-sl-2n-ethip4-macsrc500kdst500k.py
new file mode 100644
index 0000000000..9c55482078
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-2n-ethip4-macsrc500kdst500k.py
@@ -0,0 +1,215 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-2n-ethip4-macsrc50kdst50k.py b/GPL/traffic_profiles/trex/trex-sl-2n-ethip4-macsrc50kdst50k.py
new file mode 100644
index 0000000000..42e3db6a6f
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-2n-ethip4-macsrc50kdst50k.py
@@ -0,0 +1,214 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-2n-ethip4-macsrc5kdst5k.py b/GPL/traffic_profiles/trex/trex-sl-2n-ethip4-macsrc5kdst5k.py
new file mode 100644
index 0000000000..29df3373d3
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-2n-ethip4-macsrc5kdst5k.py
@@ -0,0 +1,215 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-2n-ethip4udp-1000u15p.py b/GPL/traffic_profiles/trex/trex-sl-2n-ethip4udp-1000u15p.py
new file mode 100644
index 0000000000..64fe1a705f
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-2n-ethip4udp-1000u15p.py
@@ -0,0 +1,146 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-2n-ethip4udp-10u1000p-conc.py b/GPL/traffic_profiles/trex/trex-sl-2n-ethip4udp-10u1000p-conc.py
new file mode 100644
index 0000000000..77f05f8af3
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-2n-ethip4udp-10u1000p-conc.py
@@ -0,0 +1,189 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-2n-ethip4udp-1u1p.py b/GPL/traffic_profiles/trex/trex-sl-2n-ethip4udp-1u1p.py
new file mode 100644
index 0000000000..a892ec8822
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-2n-ethip4udp-1u1p.py
@@ -0,0 +1,104 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-2n-ethip4udp-lb.py b/GPL/traffic_profiles/trex/trex-sl-2n-ethip4udp-lb.py
new file mode 100644
index 0000000000..df05cbff17
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-2n-ethip4udp-lb.py
@@ -0,0 +1,150 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-2n-ethip6-ip6dst10000.py b/GPL/traffic_profiles/trex/trex-sl-2n-ethip6-ip6dst10000.py
new file mode 100644
index 0000000000..f1b90350fb
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-2n-ethip6-ip6dst10000.py
@@ -0,0 +1,129 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-2n-ethip6-ip6dst100000.py b/GPL/traffic_profiles/trex/trex-sl-2n-ethip6-ip6dst100000.py
new file mode 100644
index 0000000000..87e76726b2
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-2n-ethip6-ip6dst100000.py
@@ -0,0 +1,129 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-2n-ethip6-ip6dst1000000.py b/GPL/traffic_profiles/trex/trex-sl-2n-ethip6-ip6dst1000000.py
new file mode 100644
index 0000000000..9214b6239d
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-2n-ethip6-ip6dst1000000.py
@@ -0,0 +1,129 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-2n-ethip6-ip6src253.py b/GPL/traffic_profiles/trex/trex-sl-2n-ethip6-ip6src253.py
new file mode 100644
index 0000000000..7ac5f75bed
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-2n-ethip6-ip6src253.py
@@ -0,0 +1,129 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-10c1n.py b/GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-10c1n.py
new file mode 100644
index 0000000000..3707ec6b9a
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-10c1n.py
@@ -0,0 +1,163 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-10c2n.py b/GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-10c2n.py
new file mode 100644
index 0000000000..52396c3723
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-10c2n.py
@@ -0,0 +1,164 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-1c10n.py b/GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-1c10n.py
new file mode 100644
index 0000000000..8d29f86b49
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-1c10n.py
@@ -0,0 +1,164 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-1c1n.py b/GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-1c1n.py
new file mode 100644
index 0000000000..f50e2e6c1d
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-1c1n.py
@@ -0,0 +1,166 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-1c2n.py b/GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-1c2n.py
new file mode 100644
index 0000000000..1923f72504
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-1c2n.py
@@ -0,0 +1,164 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-1c4n.py b/GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-1c4n.py
new file mode 100644
index 0000000000..a1e55c5253
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-1c4n.py
@@ -0,0 +1,164 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-1c6n.py b/GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-1c6n.py
new file mode 100644
index 0000000000..ffc8b428ef
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-1c6n.py
@@ -0,0 +1,164 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-1c8n.py b/GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-1c8n.py
new file mode 100644
index 0000000000..952859b31d
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-1c8n.py
@@ -0,0 +1,164 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-2c10n.py b/GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-2c10n.py
new file mode 100644
index 0000000000..84440af422
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-2c10n.py
@@ -0,0 +1,164 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-2c1n.py b/GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-2c1n.py
new file mode 100644
index 0000000000..91941769a3
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-2c1n.py
@@ -0,0 +1,164 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-2c2n.py b/GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-2c2n.py
new file mode 100644
index 0000000000..d66271f076
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-2c2n.py
@@ -0,0 +1,164 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-2c4n.py b/GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-2c4n.py
new file mode 100644
index 0000000000..7eadae361b
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-2c4n.py
@@ -0,0 +1,164 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-2c6n.py b/GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-2c6n.py
new file mode 100644
index 0000000000..3725f75b3e
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-2c6n.py
@@ -0,0 +1,164 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-2c8n.py b/GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-2c8n.py
new file mode 100644
index 0000000000..024cbc34f3
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-2c8n.py
@@ -0,0 +1,164 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-4c1n.py b/GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-4c1n.py
new file mode 100644
index 0000000000..e8c62b9c41
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-4c1n.py
@@ -0,0 +1,164 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-4c2n.py b/GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-4c2n.py
new file mode 100644
index 0000000000..a6fbe9ea79
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-4c2n.py
@@ -0,0 +1,162 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-4c4n.py b/GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-4c4n.py
new file mode 100644
index 0000000000..f1477419c3
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-4c4n.py
@@ -0,0 +1,164 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-4c6n.py b/GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-4c6n.py
new file mode 100644
index 0000000000..7e2b79fdac
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-4c6n.py
@@ -0,0 +1,164 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-6c1n.py b/GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-6c1n.py
new file mode 100644
index 0000000000..dc8616c6fe
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-6c1n.py
@@ -0,0 +1,164 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-6c2n.py b/GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-6c2n.py
new file mode 100644
index 0000000000..53a83db70b
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-6c2n.py
@@ -0,0 +1,164 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-6c4n.py b/GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-6c4n.py
new file mode 100644
index 0000000000..ac697e60ec
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-6c4n.py
@@ -0,0 +1,164 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-8c1n.py b/GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-8c1n.py
new file mode 100644
index 0000000000..587dfc3406
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-8c1n.py
@@ -0,0 +1,164 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-8c2n.py b/GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-8c2n.py
new file mode 100644
index 0000000000..9123a752b2
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-2n3n-ethip4-ip4src254-8c2n.py
@@ -0,0 +1,164 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-3n-dot1qip4-vlan100ip4src254ip4dst254.py b/GPL/traffic_profiles/trex/trex-sl-3n-dot1qip4-vlan100ip4src254ip4dst254.py
new file mode 100644
index 0000000000..b414bd1c7a
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-3n-dot1qip4-vlan100ip4src254ip4dst254.py
@@ -0,0 +1,191 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-3n-dot1qip4-vlan10ip4src254ip4dst254.py b/GPL/traffic_profiles/trex/trex-sl-3n-dot1qip4-vlan10ip4src254ip4dst254.py
new file mode 100644
index 0000000000..d878e2d726
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-3n-dot1qip4-vlan10ip4src254ip4dst254.py
@@ -0,0 +1,191 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-3n-dot1qip4-vlan1ip4src254ip4dst254.py b/GPL/traffic_profiles/trex/trex-sl-3n-dot1qip4-vlan1ip4src254ip4dst254.py
new file mode 100644
index 0000000000..c8f279bdb3
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-3n-dot1qip4-vlan1ip4src254ip4dst254.py
@@ -0,0 +1,166 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-3n-dot1qip4-vlan1kip4src254ip4dst254.py b/GPL/traffic_profiles/trex/trex-sl-3n-dot1qip4-vlan1kip4src254ip4dst254.py
new file mode 100644
index 0000000000..02decf4284
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-3n-dot1qip4-vlan1kip4src254ip4dst254.py
@@ -0,0 +1,191 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst1.py b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst1.py
new file mode 100644
index 0000000000..0d36b7358f
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst1.py
@@ -0,0 +1,85 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst100.py b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst100.py
new file mode 100644
index 0000000000..222b127914
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst100.py
@@ -0,0 +1,126 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst1000-1cnf.py b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst1000-1cnf.py
new file mode 100644
index 0000000000..1397ae4828
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst1000-1cnf.py
@@ -0,0 +1,157 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst1000-2cnf.py b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst1000-2cnf.py
new file mode 100644
index 0000000000..b7f316092a
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst1000-2cnf.py
@@ -0,0 +1,156 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst1000-4cnf.py b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst1000-4cnf.py
new file mode 100644
index 0000000000..a64e4d5a5e
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst1000-4cnf.py
@@ -0,0 +1,157 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst1000-8cnf.py b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst1000-8cnf.py
new file mode 100644
index 0000000000..a58df6e87b
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst1000-8cnf.py
@@ -0,0 +1,157 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst1000.py b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst1000.py
new file mode 100644
index 0000000000..8d9ec21a25
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst1000.py
@@ -0,0 +1,126 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst10000-1cnf.py b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst10000-1cnf.py
new file mode 100644
index 0000000000..53e68de2b9
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst10000-1cnf.py
@@ -0,0 +1,157 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst10000-2cnf.py b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst10000-2cnf.py
new file mode 100644
index 0000000000..ca3f41a6fb
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst10000-2cnf.py
@@ -0,0 +1,157 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst10000-4cnf.py b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst10000-4cnf.py
new file mode 100644
index 0000000000..df7572853f
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst10000-4cnf.py
@@ -0,0 +1,157 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst10000-8cnf.py b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst10000-8cnf.py
new file mode 100644
index 0000000000..1dbd3feb1a
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst10000-8cnf.py
@@ -0,0 +1,157 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst10000.py b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst10000.py
new file mode 100644
index 0000000000..9f55ff71de
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst10000.py
@@ -0,0 +1,126 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst100000.py b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst100000.py
new file mode 100644
index 0000000000..ae36cf9995
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst100000.py
@@ -0,0 +1,126 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst1000000.py b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst1000000.py
new file mode 100644
index 0000000000..8f6e5a0836
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst1000000.py
@@ -0,0 +1,126 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst20000-1cnf.py b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst20000-1cnf.py
new file mode 100644
index 0000000000..f6f6fada5a
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst20000-1cnf.py
@@ -0,0 +1,157 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst20000-2cnf.py b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst20000-2cnf.py
new file mode 100644
index 0000000000..15cb461624
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst20000-2cnf.py
@@ -0,0 +1,157 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst20000-4cnf.py b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst20000-4cnf.py
new file mode 100644
index 0000000000..62eb1bee78
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst20000-4cnf.py
@@ -0,0 +1,157 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst20000-8cnf.py b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst20000-8cnf.py
new file mode 100644
index 0000000000..b6eef29366
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst20000-8cnf.py
@@ -0,0 +1,157 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst20000.py b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst20000.py
new file mode 100644
index 0000000000..877e6cdc66
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst20000.py
@@ -0,0 +1,126 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst253.py b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst253.py
new file mode 100644
index 0000000000..e1e6a89af7
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst253.py
@@ -0,0 +1,126 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst253_l3fwd.py b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst253_l3fwd.py
new file mode 100644
index 0000000000..ed4f5b5bd6
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst253_l3fwd.py
@@ -0,0 +1,126 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst4-1cnf.py b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst4-1cnf.py
new file mode 100644
index 0000000000..b937d02741
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst4-1cnf.py
@@ -0,0 +1,157 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst4-2cnf.py b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst4-2cnf.py
new file mode 100644
index 0000000000..b95649a94d
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst4-2cnf.py
@@ -0,0 +1,157 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst4-4cnf.py b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst4-4cnf.py
new file mode 100644
index 0000000000..fed0d7ef3c
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst4-4cnf.py
@@ -0,0 +1,157 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst4.py b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst4.py
new file mode 100644
index 0000000000..9f14d4c929
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst4.py
@@ -0,0 +1,126 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40-1cnf.py b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40-1cnf.py
new file mode 100644
index 0000000000..d321d0ffb2
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40-1cnf.py
@@ -0,0 +1,157 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40-2cnf.py b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40-2cnf.py
new file mode 100644
index 0000000000..acc565e776
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40-2cnf.py
@@ -0,0 +1,157 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40-4cnf.py b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40-4cnf.py
new file mode 100644
index 0000000000..629100cb83
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40-4cnf.py
@@ -0,0 +1,157 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40-8cnf.py b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40-8cnf.py
new file mode 100644
index 0000000000..b51c98d7aa
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40-8cnf.py
@@ -0,0 +1,157 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40.py b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40.py
new file mode 100644
index 0000000000..5dbc5fc803
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40.py
@@ -0,0 +1,126 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst400-1cnf.py b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst400-1cnf.py
new file mode 100644
index 0000000000..1a004b055f
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst400-1cnf.py
@@ -0,0 +1,157 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst400-2cnf.py b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst400-2cnf.py
new file mode 100644
index 0000000000..b09e79d7dc
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst400-2cnf.py
@@ -0,0 +1,157 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst400-4cnf.py b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst400-4cnf.py
new file mode 100644
index 0000000000..7081525771
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst400-4cnf.py
@@ -0,0 +1,157 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst400-8cnf.py b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst400-8cnf.py
new file mode 100644
index 0000000000..c5b1d52e04
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst400-8cnf.py
@@ -0,0 +1,157 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst400.py b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst400.py
new file mode 100644
index 0000000000..44db3ec81c
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst400.py
@@ -0,0 +1,126 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40000-1cnf.py b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40000-1cnf.py
new file mode 100644
index 0000000000..038b986b65
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40000-1cnf.py
@@ -0,0 +1,157 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40000-2cnf.py b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40000-2cnf.py
new file mode 100644
index 0000000000..5933b33d20
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40000-2cnf.py
@@ -0,0 +1,157 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40000-4cnf.py b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40000-4cnf.py
new file mode 100644
index 0000000000..851cd7c870
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40000-4cnf.py
@@ -0,0 +1,157 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40000-8cnf.py b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40000-8cnf.py
new file mode 100644
index 0000000000..40d57f09dd
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40000-8cnf.py
@@ -0,0 +1,157 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40000.py b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40000.py
new file mode 100644
index 0000000000..570a236fd6
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst40000.py
@@ -0,0 +1,126 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst5000-1cnf.py b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst5000-1cnf.py
new file mode 100644
index 0000000000..fb4c61b030
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst5000-1cnf.py
@@ -0,0 +1,157 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst5000-2cnf.py b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst5000-2cnf.py
new file mode 100644
index 0000000000..ca13c337cb
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst5000-2cnf.py
@@ -0,0 +1,157 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst5000-4cnf.py b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst5000-4cnf.py
new file mode 100644
index 0000000000..1ffd8c8ba5
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst5000-4cnf.py
@@ -0,0 +1,157 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst5000-8cnf.py b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst5000-8cnf.py
new file mode 100644
index 0000000000..26efc1a438
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst5000-8cnf.py
@@ -0,0 +1,157 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst5000.py b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst5000.py
new file mode 100644
index 0000000000..95d8380a22
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst5000.py
@@ -0,0 +1,126 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst60000-1cnf.py b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst60000-1cnf.py
new file mode 100644
index 0000000000..251758ddae
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst60000-1cnf.py
@@ -0,0 +1,157 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst60000-2cnf.py b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst60000-2cnf.py
new file mode 100644
index 0000000000..acebf6d06d
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst60000-2cnf.py
@@ -0,0 +1,157 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst60000-4cnf.py b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst60000-4cnf.py
new file mode 100644
index 0000000000..3fe3caf128
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst60000-4cnf.py
@@ -0,0 +1,157 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst60000-8cnf.py b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst60000-8cnf.py
new file mode 100644
index 0000000000..84bfb89f0b
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst60000-8cnf.py
@@ -0,0 +1,157 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst60000.py b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst60000.py
new file mode 100644
index 0000000000..126302d545
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4dst60000.py
@@ -0,0 +1,126 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4src253.py b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4src253.py
new file mode 100644
index 0000000000..883883ad18
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4src253.py
@@ -0,0 +1,126 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4src254.py b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4src254.py
new file mode 100644
index 0000000000..fc6167d126
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-ip4src254.py
@@ -0,0 +1,126 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-macsrc100ip4src100.py b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-macsrc100ip4src100.py
new file mode 100644
index 0000000000..b94c56ad6c
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-macsrc100ip4src100.py
@@ -0,0 +1,161 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-macsrc100kip4src100k.py b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-macsrc100kip4src100k.py
new file mode 100644
index 0000000000..52eb841ab0
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-macsrc100kip4src100k.py
@@ -0,0 +1,161 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-macsrc10kip4src10k.py b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-macsrc10kip4src10k.py
new file mode 100644
index 0000000000..8e959c829d
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-macsrc10kip4src10k.py
@@ -0,0 +1,161 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-macsrc500kdst500k.py b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-macsrc500kdst500k.py
new file mode 100644
index 0000000000..da4348f2a0
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-macsrc500kdst500k.py
@@ -0,0 +1,215 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-macsrc50kdst50k.py b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-macsrc50kdst50k.py
new file mode 100644
index 0000000000..6cf066367b
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-macsrc50kdst50k.py
@@ -0,0 +1,215 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-macsrc5kdst5k.py b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-macsrc5kdst5k.py
new file mode 100644
index 0000000000..29df3373d3
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4-macsrc5kdst5k.py
@@ -0,0 +1,215 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-3n-ethip4udp-1000u15p.py b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4udp-1000u15p.py
new file mode 100644
index 0000000000..b7b364f195
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4udp-1000u15p.py
@@ -0,0 +1,148 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-3n-ethip4udp-100u1000p-conc.py b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4udp-100u1000p-conc.py
new file mode 100644
index 0000000000..b93cd645ae
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4udp-100u1000p-conc.py
@@ -0,0 +1,189 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-3n-ethip4udp-100u15p.py b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4udp-100u15p.py
new file mode 100644
index 0000000000..31cdc5e628
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4udp-100u15p.py
@@ -0,0 +1,148 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-3n-ethip4udp-10u1000p-conc.py b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4udp-10u1000p-conc.py
new file mode 100644
index 0000000000..9032a8c2f5
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4udp-10u1000p-conc.py
@@ -0,0 +1,189 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-3n-ethip4udp-10u10p-conc.py b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4udp-10u10p-conc.py
new file mode 100644
index 0000000000..29433b3d27
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4udp-10u10p-conc.py
@@ -0,0 +1,189 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-3n-ethip4udp-10u15p.py b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4udp-10u15p.py
new file mode 100644
index 0000000000..57c5b2dcbc
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4udp-10u15p.py
@@ -0,0 +1,148 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-3n-ethip4udp-1u15p.py b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4udp-1u15p.py
new file mode 100644
index 0000000000..df9a1642a9
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4udp-1u15p.py
@@ -0,0 +1,141 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-3n-ethip4udp-1u1p.py b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4udp-1u1p.py
new file mode 100644
index 0000000000..a892ec8822
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4udp-1u1p.py
@@ -0,0 +1,104 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-3n-ethip4udp-2000u15p.py b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4udp-2000u15p.py
new file mode 100644
index 0000000000..c96f76aaee
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4udp-2000u15p.py
@@ -0,0 +1,148 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-3n-ethip4udp-4000u15p.py b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4udp-4000u15p.py
new file mode 100644
index 0000000000..c1b3d5ba59
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-3n-ethip4udp-4000u15p.py
@@ -0,0 +1,148 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-3n-ethip6-ip6dst10000.py b/GPL/traffic_profiles/trex/trex-sl-3n-ethip6-ip6dst10000.py
new file mode 100644
index 0000000000..f1b90350fb
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-3n-ethip6-ip6dst10000.py
@@ -0,0 +1,129 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-3n-ethip6-ip6dst100000.py b/GPL/traffic_profiles/trex/trex-sl-3n-ethip6-ip6dst100000.py
new file mode 100644
index 0000000000..87e76726b2
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-3n-ethip6-ip6dst100000.py
@@ -0,0 +1,129 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-3n-ethip6-ip6dst1000000.py b/GPL/traffic_profiles/trex/trex-sl-3n-ethip6-ip6dst1000000.py
new file mode 100644
index 0000000000..c6870d89fa
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-3n-ethip6-ip6dst1000000.py
@@ -0,0 +1,129 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-3n-ethip6-ip6src253.py b/GPL/traffic_profiles/trex/trex-sl-3n-ethip6-ip6src253.py
new file mode 100644
index 0000000000..fbe8b94ab3
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-3n-ethip6-ip6src253.py
@@ -0,0 +1,129 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-dot1qip4-vlan1ip4src254ip4dst254-bvi.py b/GPL/traffic_profiles/trex/trex-sl-dot1qip4-vlan1ip4src254ip4dst254-bvi.py
new file mode 100644
index 0000000000..28ec10bf8b
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-dot1qip4-vlan1ip4src254ip4dst254-bvi.py
@@ -0,0 +1,170 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-dot1qip4-vlan1ip4src254ip4dst254.py b/GPL/traffic_profiles/trex/trex-sl-dot1qip4-vlan1ip4src254ip4dst254.py
new file mode 100644
index 0000000000..6ce351968c
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-dot1qip4-vlan1ip4src254ip4dst254.py
@@ -0,0 +1,164 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src10udpsrcrnd.py b/GPL/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src10udpsrcrnd.py
new file mode 100644
index 0000000000..32ca072154
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src10udpsrcrnd.py
@@ -0,0 +1,287 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src1udpsrcrnd.py b/GPL/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src1udpsrcrnd.py
new file mode 100644
index 0000000000..1e78cd3cae
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src1udpsrcrnd.py
@@ -0,0 +1,288 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src2udpsrcrnd.py b/GPL/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src2udpsrcrnd.py
new file mode 100644
index 0000000000..d195bc5b61
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src2udpsrcrnd.py
@@ -0,0 +1,288 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src4udpsrcrnd.py b/GPL/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src4udpsrcrnd.py
new file mode 100644
index 0000000000..8a7bc08b1b
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src4udpsrcrnd.py
@@ -0,0 +1,288 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src6udpsrcrnd.py b/GPL/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src6udpsrcrnd.py
new file mode 100644
index 0000000000..fe46844571
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src6udpsrcrnd.py
@@ -0,0 +1,288 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src8udpsrcrnd.py b/GPL/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src8udpsrcrnd.py
new file mode 100644
index 0000000000..cf34818781
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-dot1qip4vxlan-ip4src8udpsrcrnd.py
@@ -0,0 +1,288 @@
+# 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/GPL/traffic_profiles/trex/trex-sl-ethip4vxlan-ip4src1udpsrcrnd.py b/GPL/traffic_profiles/trex/trex-sl-ethip4vxlan-ip4src1udpsrcrnd.py
new file mode 100644
index 0000000000..cd1a0a690c
--- /dev/null
+++ b/GPL/traffic_profiles/trex/trex-sl-ethip4vxlan-ip4src1udpsrcrnd.py
@@ -0,0 +1,261 @@
+# 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/GPL/traffic_scripts/PacketVerifier.py b/GPL/traffic_scripts/PacketVerifier.py
new file mode 100644
index 0000000000..20e9af603b
--- /dev/null
+++ b/GPL/traffic_scripts/PacketVerifier.py
@@ -0,0 +1,344 @@
+# 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.
+
+"""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/GPL/traffic_scripts/TrafficScriptArg.py b/GPL/traffic_scripts/TrafficScriptArg.py
new file mode 100644
index 0000000000..b2f7055412
--- /dev/null
+++ b/GPL/traffic_scripts/TrafficScriptArg.py
@@ -0,0 +1,68 @@
+# 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 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/GPL/traffic_scripts/__init__.py b/GPL/traffic_scripts/__init__.py
new file mode 100644
index 0000000000..a946304019
--- /dev/null
+++ b/GPL/traffic_scripts/__init__.py
@@ -0,0 +1,16 @@
+# 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.
+
+"""
+__init__ file for directory traffic_scripts
+"""
diff --git a/GPL/traffic_scripts/ipsec_interface.py b/GPL/traffic_scripts/ipsec_interface.py
new file mode 100644
index 0000000000..4b7d758be5
--- /dev/null
+++ b/GPL/traffic_scripts/ipsec_interface.py
@@ -0,0 +1,271 @@
+#!/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 .PacketVerifier import RxQueue, TxQueue
+from .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/GPL/traffic_scripts/ipsec_policy.py b/GPL/traffic_scripts/ipsec_policy.py
new file mode 100644
index 0000000000..9e168ee938
--- /dev/null
+++ b/GPL/traffic_scripts/ipsec_policy.py
@@ -0,0 +1,231 @@
+#!/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 .PacketVerifier import RxQueue, TxQueue
+from .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/GPL/traffic_scripts/lisp/__init__.py b/GPL/traffic_scripts/lisp/__init__.py
new file mode 100644
index 0000000000..eef4a31bb0
--- /dev/null
+++ b/GPL/traffic_scripts/lisp/__init__.py
@@ -0,0 +1,16 @@
+# 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.
+
+"""
+__init__ file for directory lisp
+"""
diff --git a/GPL/traffic_scripts/lisp/lisp_check.py b/GPL/traffic_scripts/lisp/lisp_check.py
new file mode 100644
index 0000000000..1bdafb799a
--- /dev/null
+++ b/GPL/traffic_scripts/lisp/lisp_check.py
@@ -0,0 +1,187 @@
+#!/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 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 ..PacketVerifier import RxQueue, TxQueue
+from ..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/GPL/traffic_scripts/lisp/lispgpe_check.py b/GPL/traffic_scripts/lisp/lispgpe_check.py
new file mode 100644
index 0000000000..27a83f5701
--- /dev/null
+++ b/GPL/traffic_scripts/lisp/lispgpe_check.py
@@ -0,0 +1,210 @@
+#!/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 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 ..PacketVerifier import RxQueue, TxQueue
+from ..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/GPL/traffic_scripts/policer.py b/GPL/traffic_scripts/policer.py
new file mode 100644
index 0000000000..db90bb21f3
--- /dev/null
+++ b/GPL/traffic_scripts/policer.py
@@ -0,0 +1,122 @@
+#!/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
+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 .TrafficScriptArg import TrafficScriptArg
+from .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/GPL/traffic_scripts/send_icmp_wait_for_reply.py b/GPL/traffic_scripts/send_icmp_wait_for_reply.py
new file mode 100644
index 0000000000..78554634af
--- /dev/null
+++ b/GPL/traffic_scripts/send_icmp_wait_for_reply.py
@@ -0,0 +1,136 @@
+#!/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 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 .PacketVerifier import RxQueue, TxQueue
+from .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/GPL/traffic_scripts/send_ip_check_headers.py b/GPL/traffic_scripts/send_ip_check_headers.py
new file mode 100644
index 0000000000..ff43563025
--- /dev/null
+++ b/GPL/traffic_scripts/send_ip_check_headers.py
@@ -0,0 +1,164 @@
+#!/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 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 .PacketVerifier import RxQueue, TxQueue
+from .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/GPL/traffic_scripts/send_vxlan_check_vxlan.py b/GPL/traffic_scripts/send_vxlan_check_vxlan.py
new file mode 100644
index 0000000000..0b1da81f18
--- /dev/null
+++ b/GPL/traffic_scripts/send_vxlan_check_vxlan.py
@@ -0,0 +1,119 @@
+#!/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 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 .PacketVerifier import RxQueue, TxQueue
+from .TrafficScriptArg import TrafficScriptArg
+from . 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/GPL/traffic_scripts/srv6_encap.py b/GPL/traffic_scripts/srv6_encap.py
new file mode 100644
index 0000000000..9db9538659
--- /dev/null
+++ b/GPL/traffic_scripts/srv6_encap.py
@@ -0,0 +1,306 @@
+#!/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 .PacketVerifier import RxQueue, TxQueue
+from .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/GPL/traffic_scripts/vxlan.py b/GPL/traffic_scripts/vxlan.py
new file mode 100644
index 0000000000..b39b419acc
--- /dev/null
+++ b/GPL/traffic_scripts/vxlan.py
@@ -0,0 +1,32 @@
+# 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.
+
+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)