X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=resources%2Ftools%2Ftrex%2Ftrex_stateless_profile.py;h=e1e56d9ffe5578587fbfb50fea16bbde18dd5e87;hb=6928c2b1620e5d020a19e944f416df6a1f4b85ad;hp=0bbd241f8b083edaf7b2b1b4948acf41497e40e2;hpb=6721e7f09aa95bff6622068332a3f56afad9c87b;p=csit.git diff --git a/resources/tools/trex/trex_stateless_profile.py b/resources/tools/trex/trex_stateless_profile.py index 0bbd241f8b..e1e56d9ffe 100755 --- a/resources/tools/trex/trex_stateless_profile.py +++ b/resources/tools/trex/trex_stateless_profile.py @@ -22,7 +22,7 @@ import sys import argparse import json -sys.path.insert(0, "/opt/trex-core-2.25/scripts/automation/" +sys.path.insert(0, "/opt/trex-core-2.35/scripts/automation/" "trex_control_plane/stl/") from trex_stl_lib.api import * @@ -87,9 +87,9 @@ def simple_burst(profile_file, duration, framesize, rate, warmup_time, port_0, :param async_start: Start the traffic and exit. :type profile_file: str :type framesize: int or str - :type duration: int + :type duration: float :type rate: str - :type warmup_time: int + :type warmup_time: float :type port_0: int :type port_1: int :type latency: boo; @@ -109,11 +109,9 @@ def simple_burst(profile_file, duration, framesize, rate, warmup_time, port_0, print("### Profile file:\n{}".format(profile_file)) profile = STLProfile.load(profile_file, direction=0, port_id=0, framesize=framesize) - print("\n### Profiles ###\n") - print(profile.dump_to_yaml()) streams = profile.get_streams() - except STLError: - print("Error while loading profile '{0}'\n".format(profile_file)) + except STLError as err: + print("Error while loading profile '{0}' {1}".format(profile_file, err)) sys.exit(1) try: @@ -125,6 +123,9 @@ def simple_burst(profile_file, duration, framesize, rate, warmup_time, port_0, client.reset(ports=[port_0, port_1]) client.remove_all_streams(ports=[port_0, port_1]) + if "macsrc" in profile_file: + client.set_port_attr(ports=[port_0, port_1], promiscuous=True, + resolve=False) if isinstance(framesize, int): client.add_streams(streams[0], ports=[port_0]) client.add_streams(streams[1], ports=[port_1]) @@ -246,7 +247,7 @@ def main(): help="Python traffic profile.") parser.add_argument("-d", "--duration", required=True, - type=int, + type=float, help="Duration of traffic run.") parser.add_argument("-s", "--frame_size", required=True, @@ -255,8 +256,8 @@ def main(): required=True, help="Traffic rate with included units (%, pps).") parser.add_argument("-w", "--warmup_time", - type=int, - default=5, + type=float, + default=5.0, help="Traffic warm-up time in seconds, 0 = disable.") parser.add_argument("--port_0", required=True, @@ -282,12 +283,12 @@ def main(): framesize = args.frame_size simple_burst(profile_file=args.profile, - duration=int(args.duration), + duration=args.duration, framesize=framesize, rate=args.rate, - warmup_time=int(args.warmup_time), - port_0=int(args.port_0), - port_1=int(args.port_1), + warmup_time=args.warmup_time, + port_0=args.port_0, + port_1=args.port_1, latency=args.latency, async_start=args.async)