X-Git-Url: https://gerrit.fd.io/r/gitweb?p=csit.git;a=blobdiff_plain;f=resources%2Ftools%2Ftrex%2Ftrex_stateless_profile.py;h=e77c1365a42a7981c19cdd5a36a4439a22ea62ea;hp=61b244e21ac7a083de8add4851e7d1f33f4e67fd;hb=66d62a7020a69f7a7c4d274b7bdd9e91de41aa1a;hpb=3a066cb1f1b79c6fb14cb1e9c7871d0b19bb06a2 diff --git a/resources/tools/trex/trex_stateless_profile.py b/resources/tools/trex/trex_stateless_profile.py index 61b244e21a..e77c1365a4 100755 --- a/resources/tools/trex/trex_stateless_profile.py +++ b/resources/tools/trex/trex_stateless_profile.py @@ -22,10 +22,9 @@ import sys import argparse import json -sys.path.insert(0, "/opt/trex-core-2.35/scripts/automation/" - "trex_control_plane/stl/") - -from trex_stl_lib.api import * +sys.path.insert(0, "/opt/trex-core-2.54/scripts/automation/" + "trex_control_plane/interactive/") +from trex.stl.api import * def fmt_latency(lat_min, lat_avg, lat_max): @@ -118,7 +117,7 @@ def simple_burst(profile_file, duration, framesize, rate, warmup_time, port_0, try: # Create the client: - client = STLClient(verbose_level=LoggerApi.VERBOSE_QUIET) + client = STLClient() # Connect to server: client.connect() # Prepare our ports (the machine has 0 <--> 1 with static route): @@ -126,8 +125,7 @@ def simple_burst(profile_file, duration, framesize, rate, warmup_time, port_0, 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) + client.set_port_attr(ports=[port_0, port_1], promiscuous=True) if isinstance(framesize, int): client.add_streams(streams[0], ports=[port_0]) if not unidirection: @@ -245,11 +243,15 @@ def simple_burst(profile_file, duration, framesize, rate, warmup_time, port_0, else: if client: client.disconnect() - print("rate={0}, totalReceived={1}, totalSent={2}, " + if isinstance(rate, unicode): + rate = rate.encode("utf-8") + if isinstance(duration, unicode): + duration = duration.encode("utf-8") + print("rate={0!r}, totalReceived={1}, totalSent={2}, " "frameLoss={3}, latencyStream0(usec)={4}, " - "latencyStream1(usec)={5}". + "latencyStream1(usec)={5}, targetDuration={d!r}". format(rate, total_rcvd, total_sent, lost_a + lost_b, - lat_a, lat_b)) + lat_a, lat_b, d=duration)) def main():