X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=GPL%2Ftools%2Ftrex%2Ftrex_astf_profile.py;h=a4f03bee3a98ee6c48788a0d825b79df2de3467a;hb=refs%2Fchanges%2F52%2F36152%2F13;hp=193ff21185831a7c1d0be8588629164f6216a57c;hpb=7829fea4a2c8936513fa95215b7d84997f814a69;p=csit.git diff --git a/GPL/tools/trex/trex_astf_profile.py b/GPL/tools/trex/trex_astf_profile.py index 193ff21185..a4f03bee3a 100644 --- a/GPL/tools/trex/trex_astf_profile.py +++ b/GPL/tools/trex/trex_astf_profile.py @@ -1,6 +1,6 @@ #!/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 # @@ -34,7 +34,7 @@ import sys 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 @@ -73,6 +73,7 @@ def simple_burst( profile_file, duration, framesize, + n_data_frames, multiplier, port_0, port_1, @@ -115,6 +116,7 @@ def simple_burst( :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. @@ -125,6 +127,7 @@ def simple_burst( :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 @@ -151,7 +154,11 @@ def simple_burst( # 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 @@ -213,8 +220,7 @@ def simple_burst( 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": "))) @@ -378,7 +384,7 @@ def simple_burst( if async_start: client.disconnect(stop_traffic=False, release_ports=True) else: - client.clear_profile() + client.reset() client.disconnect() print( f"multiplier={multiplier!r}; " @@ -415,6 +421,10 @@ def main(): 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." @@ -455,6 +465,7 @@ def main(): 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,