aboutsummaryrefslogtreecommitdiffstats
path: root/resources/tools/t-rex/t-rex-stateless-stop.py
diff options
context:
space:
mode:
authorTibor Frank <tifrank@cisco.com>2017-04-04 10:06:00 +0200
committerTibor Frank <tifrank@cisco.com>2017-06-05 07:40:28 +0200
commitb92b5be7d4bbbf523812f774bb2e539ab2081cf6 (patch)
tree61d967364e6eb9952616434b913648742e70fbc9 /resources/tools/t-rex/t-rex-stateless-stop.py
parent78e999f1203dc8b7c29c24b0178bb8c23edf4c52 (diff)
CSIT-524: Traffic generator using python profiles
Profile name structure: [trex|ixia]-[sl|sf]-[topo]-[packet structure]-[scale] - Traffic generator - T-rex (trex) or Ixia (ixia) - Stateless (sl) or statefull (sf) - Topology - 2-node topology (2n) or 3-node topology (3n) - Packet structure - eth | ip4/6 | udp - Scale - e.g. ip4dst1, ip6dst10000, 4000u15p Traffic types changed to stream profiles: - From: 2-node-bridge To: trex-sl-2n-ethip4-ip4src253 - From: 3-node-bridge To: trex-sl-3n-ethip4-ip4src254 - From: 3-node-IPv4-dst-1000000 To: trex-sl-3n-ethip4-ip4dst1000000 - From: 3-node-IPv4-dst-100000 To: trex-sl-3n-ethip4-ip4dst100000 - From: 3-node-IPv4-dst-10000 To: trex-sl-3n-ethip4-ip4dst10000 - From: 3-node-IPv4-dst-1000 To: trex-sl-3n-ethip4-ip4dst1000 - From: 3-node-IPv4-dst-100 To: trex-sl-3n-ethip4-ip4dst100 - From: 3-node-IPv4-dst-1 To: trex-sl-3n-ethip4-ip4dst1 - From: 3-node-IPv4 To: trex-sl-3n-ethip4-ip4src253 - From: 3-node-IPv6-dst-1000000 To: trex-sl-3n-ethip6-ip6dst1000000 - From: 3-node-IPv6-dst-100000 To: trex-sl-3n-ethip6-ip6dst100000 - From: 3-node-IPv6-dst-10000 To: trex-sl-3n-ethip6-ip6dst10000 - From: 3-node-IPv6 To: trex-sl-3n-ethip6-ip6src253 - From: 3-node-xconnect To: trex-sl-3n-ethip4-ip4src254 - From: 3-node-IPv4-SNAT-1000u-15p To: trex-sl-3n-ethip4udp-1000u15p - From: 3-node-IPv4-SNAT-100u-15p To: trex-sl-3n-ethip4udp-100u15p - From: 3-node-IPv4-SNAT-10u-15p To: trex-sl-3n-ethip4udp-10u15p - From: 3-node-IPv4-SNAT-1u-15p To: trex-sl-3n-ethip4udp-1u15p - From: 3-node-IPv4-SNAT-1u-1p To: trex-sl-3n-ethip4udp-1u1p - From: 3-node-IPv4-SNAT-2000u-15p To: trex-sl-3n-ethip4udp-2000u15p - From: 3-node-IPv4-SNAT-4000u-15p To: trex-sl-3n-ethip4udp-4000u15p Change-Id: If6a3cf204c93ff9f2cdccc5fd395e26b05483b58 Signed-off-by: Tibor Frank <tifrank@cisco.com>
Diffstat (limited to 'resources/tools/t-rex/t-rex-stateless-stop.py')
-rwxr-xr-xresources/tools/t-rex/t-rex-stateless-stop.py20
1 files changed, 7 insertions, 13 deletions
diff --git a/resources/tools/t-rex/t-rex-stateless-stop.py b/resources/tools/t-rex/t-rex-stateless-stop.py
index 0eee3e8cd5..cc008461e6 100755
--- a/resources/tools/t-rex/t-rex-stateless-stop.py
+++ b/resources/tools/t-rex/t-rex-stateless-stop.py
@@ -27,6 +27,7 @@ Functionality:
"""
import sys
+import json
sys.path.insert(0, "/opt/trex-core-2.25/scripts/automation/"+\
"trex_control_plane/stl/")
@@ -40,12 +41,9 @@ def stop_all_traffic_streams():
"""
# create client
- client = STLClient()
+ client = STLClient(verbose_level=LoggerApi.VERBOSE_QUIET)
try:
- # turn this off if too many logs
- #client.set_verbose("high")
-
# connect to server
client.connect()
@@ -55,18 +53,15 @@ def stop_all_traffic_streams():
# read the stats after the test
stats = client.get_stats()
- print "#####statistics (approx.)#####"
- print json.dumps(stats, indent=4,
- separators=(',', ': '), sort_keys=True)
+ print("#####statistics (approx.)#####")
+ print(json.dumps(stats, indent=4,
+ separators=(',', ': '), sort_keys=True))
lost_a = stats[0]["opackets"] - stats[1]["ipackets"]
lost_b = stats[1]["opackets"] - stats[0]["ipackets"]
- total_sent = stats[0]["opackets"] + stats[1]["opackets"]
- total_rcvd = stats[0]["ipackets"] + stats[1]["ipackets"]
-
- print "\npackets lost from 0 --> 1: {0} pkts".format(lost_a)
- print "packets lost from 1 --> 0: {0} pkts".format(lost_b)
+ print("\npackets lost from 0 --> 1: {0} pkts".format(lost_a))
+ print("packets lost from 1 --> 0: {0} pkts".format(lost_b))
except STLError as ex_error:
print_error(str(ex_error))
@@ -76,7 +71,6 @@ def stop_all_traffic_streams():
client.disconnect()
-
def print_error(msg):
"""Print error message on stderr.