#!/usr/bin/python3
-# Copyright (c) 2021 Cisco and/or its affiliates.
+# Copyright (c) 2022 Cisco and/or its affiliates.
#
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
#
import time
sys.path.insert(
- 0, u"/opt/trex-core-2.88/scripts/automation/trex_control_plane/interactive/"
+ 0, u"/opt/trex-core-2.97/scripts/automation/trex_control_plane/interactive/"
)
from trex.astf.api import ASTFClient, ASTFProfile, TRexError
profile_file,
duration,
framesize,
+ n_data_frames,
multiplier,
port_0,
port_1,
:param duration: Expected duration for all transactions to finish,
without any TRex related delays, without even latency.
:param framesize: Frame size.
+ :param n_data_frames: Controls "size" of transaction for TPUT tests.
:param multiplier: Multiplier of profile CPS.
:param port_0: Port 0 on the traffic generator.
:param port_1: Port 1 on the traffic generator.
:type profile_file: str
:type duration: float
:type framesize: int or str
+ :type n_data_frames: int
:type multiplier: int
:type port_0: int
:type port_1: int
# TODO: key-values pairs to the profile file
# - ips ?
print(f"### Profile file:\n{profile_file}")
- profile = ASTFProfile.load(profile_file, framesize=framesize)
+ profile = ASTFProfile.load(
+ profile_file,
+ framesize=framesize,
+ n_data_frames=n_data_frames,
+ )
except TRexError:
print(f"Error while loading profile '{profile_file}'!")
raise
for warning in client.get_warnings():
print(warning)
- # Now finish the complete reset.
- client.reset()
+ # No profile cleanup here, reset will be done in the finally block.
print(u"##### Statistics #####")
print(json.dumps(stats, indent=4, separators=(u",", u": ")))
if async_start:
client.disconnect(stop_traffic=False, release_ports=True)
else:
- client.clear_profile()
+ client.reset()
client.disconnect()
print(
f"multiplier={multiplier!r}; "
u"-s", u"--frame_size", required=True,
help=u"Size of a Frame without padding and IPG."
)
+ parser.add_argument(
+ u"--n_data_frames", type=int, default=5,
+ help=u"Use this many data frames per transaction and direction (TPUT)."
+ )
parser.add_argument(
u"-m", u"--multiplier", required=True, type=float,
help=u"Multiplier of profile CPS."
profile_file=args.profile,
duration=args.duration,
framesize=framesize,
+ n_data_frames=args.n_data_frames,
multiplier=args.multiplier,
port_0=args.port_0,
port_1=args.port_1,