From 7991c5190ce31ae99533938eccad541181d49370 Mon Sep 17 00:00:00 2001
From: Yaroslav Brustinov <ybrustin@cisco.com>
Date: Thu, 10 Mar 2016 10:51:26 +0200
Subject: stl map: send initial streams to calm down switches, send x3 traffic
 to filter noises

---
 .../stl/trex_stl_lib/trex_stl_std.py                  | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

(limited to 'scripts/automation/trex_control_plane/stl/trex_stl_lib')

diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_std.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_std.py
index c4cb5d01..d582b499 100644
--- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_std.py
+++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_std.py
@@ -13,21 +13,30 @@ def stl_map_ports (client, ports = None):
 
     # generate streams
     base_pkt = CScapyTRexPktBuilder(pkt = Ether()/IP())
-    
+
+    # send something initial to calm down switches with arps etc.
+    stream = STLStream(packet = base_pkt,
+                       mode = STLTXSingleBurst(pps = 100000, total_pkts = 1))
+    client.add_streams(stream, ports)
+
+    client.start(ports, mult = "50%")
+    client.wait_on_traffic(ports)
+    client.reset(ports)
+
     tx_pkts = {}
     pkts = 1
     for port in ports:
         tx_pkts[pkts] = port
         stream = STLStream(packet = base_pkt,
-                           mode = STLTXSingleBurst(pps = 100000, total_pkts = pkts))
+                           mode = STLTXSingleBurst(pps = 100000, total_pkts = pkts * 3))
 
         client.add_streams(stream, [port])
         
-        pkts = pkts * 2
+        pkts *= 2
 
     # inject
     client.clear_stats()
-    client.start(ports, mult = "1mpps")
+    client.start(ports, mult = "50%")
     client.wait_on_traffic(ports)
     
     stats = client.get_stats()
@@ -40,7 +49,7 @@ def stl_map_ports (client, ports = None):
     # actual mapping
     for port in ports:
 
-        ipackets = stats[port]["ipackets"]
+        ipackets = int(round(stats[port]["ipackets"] / 3.0)) # majority out of 3 to clean random noises
         table['map'][port] = None
 
         for pkts in tx_pkts.keys():
-- 
cgit