Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Test case to verify metering #17

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
72c4f12
In this PR, the FLiRT test case is added to verify the port shaping r…
ersuneetsingh Jan 29, 2021
48474c8
In this PR, the FLiRT test case is added to verify the port shaping r…
ersuneetsingh Jan 29, 2021
3935bb7
In this PR, the FLiRT test case is added to verify priority scheduling.
ersuneetsingh Feb 1, 2021
a965c3e
Merge branch 'master' of https://github.com/ersuneetsingh/fabric-line…
ersuneetsingh Feb 1, 2021
af29617
add license
ersuneetsingh Feb 2, 2021
a5e2a11
add assert statement and clean
ersuneetsingh Feb 2, 2021
7101580
fix the class name
ersuneetsingh Feb 2, 2021
5d65ffd
fix mult
ersuneetsingh Feb 2, 2021
d4997b1
fix constants and vaiables representation
ersuneetsingh Feb 3, 2021
7d43cb8
add assert statement
ersuneetsingh Feb 3, 2021
0225513
fix the indent and max burst bytes
ersuneetsingh Feb 3, 2021
222da98
assure flow priortization by adding one more delay critical flow with…
ersuneetsingh Feb 7, 2021
b2873f6
fix the representation and comments, and clean
ersuneetsingh Feb 7, 2021
b54a66c
Update stratum/chassis_config.pb_with_PortShaping.txt
ersuneetsingh Feb 7, 2021
b649b28
fix some minor representations and notations
ersuneetsingh Feb 10, 2021
aa41cd1
fix error
ersuneetsingh Feb 11, 2021
d41999b
fix and place license text inline at the top of the chassis config; r…
ersuneetsingh Feb 12, 2021
aad6dc7
fix the file name.
ersuneetsingh Feb 12, 2021
b630bbd
fix the file name.
ersuneetsingh Feb 12, 2021
3e47d25
Test case to verify metering
ersuneetsingh Feb 15, 2021
1027c2f
Merge branch 'master' of https://github.com/stratum/fabric-line-rate-…
ersuneetsingh Feb 18, 2021
e00fb65
Merge branch 'master' into meter_tc
ccascone Apr 29, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
assure flow priortization by adding one more delay critical flow with…
…out prioritization.
ersuneetsingh committed Feb 7, 2021

Verified

This commit was signed with the committer’s verified signature.
gmega Giuliano Mega
commit 222da981ebaa0f14442cc67333346117dbe1b941
92 changes: 62 additions & 30 deletions trex-scripts/tests/priority_scheduling.py
Original file line number Diff line number Diff line change
@@ -21,7 +21,11 @@
RECEIVER_PORT = [1]

# assume maximum latency for delay critical flows
LATENCY_DC_MAX_uSEC = 100 # in mircoseconds
LATENCY_DC_MAX_uSEC = 1000 # in mircoseconds
# assume maximum latency for low priority flows during congestion
LATENCY_LP_MAX_uSEC = 25500 # in mircoseconds
# assume average latency for low priority flows during congestion
LATENCY_LP_AVG_uSEC = 15000 # in mircoseconds


class PriorityScheduling(StatelessTest):
@@ -42,15 +46,18 @@ def start(self, args: dict) -> None:
# create packets
pkt1 = Ether(dst=DEST_MAC) / IP(src="16.0.0.1",dst="48.0.0.1") / UDP(dport=12,sport=1025) / ("*" * 1500)
pkt2 = Ether(dst=DEST_MAC) / IP(src="16.0.0.2",dst="48.0.0.2") / UDP(dport=12,sport=1025) / ("*" * 1500)
pkt3 = Ether(dst=DEST_MAC) / IP(src="16.0.0.3",dst="48.0.0.3") / UDP(dport=12,sport=1025) / ("*" * 1500)

#stream list
streams = []

# Create a traffic stream
# assume s1 is a delay critical stream
s1 = STLStream( packet=STLPktBuilder(pkt=pkt1), mode=STLTXCont(bps_L2 = 200000), flow_stats = STLFlowLatencyStats(pg_id = 5))
# assume s2 is a lower priority stream
s2 = STLStream( packet=STLPktBuilder(pkt=pkt2), mode=STLTXCont(bps_L2 = 35000000000), flow_stats = STLFlowLatencyStats(pg_id = 10))
# assume s1 is a delay critical stream with QoS
s1 = STLStream( packet=STLPktBuilder(pkt=pkt1), mode=STLTXCont(percentage = 1), flow_stats = STLFlowLatencyStats(pg_id = 5))
# assume s2 is a delay critical stream without QoS
s2 = STLStream( packet=STLPktBuilder(pkt=pkt2), mode=STLTXCont(percentage = 1), flow_stats = STLFlowLatencyStats(pg_id = 10))
# assume s3 is a lower priority stream
s3 = STLStream( packet=STLPktBuilder(pkt=pkt3), mode=STLTXCont(percentage = 98), flow_stats = STLFlowLatencyStats(pg_id = 15))


# prepare ports
@@ -59,6 +66,7 @@ def start(self, args: dict) -> None:
# add sterams
streams.append(s1)
streams.append(s2)
streams.append(s3)
self.client.add_streams(streams, ports=[0])


@@ -74,46 +82,70 @@ def start(self, args: dict) -> None:
logging.info("Waiting until all traffic stop")
self.client.wait_on_traffic(ports=SENDER_PORT)

# stats for pg_id 5
stats = self.client.get_pgid_stats(pgids['latency'])
flow_stats = stats['flow_stats'].get(5)
global_lat_stats = stats['latency']
lat_stats = global_lat_stats.get(5)

tx_pkts = flow_stats['tx_pkts'].get(0, 0)
tx_bytes = flow_stats['tx_bytes'].get(0, 0)
tx_pps = flow_stats['tx_pps'].get(0, 0)
rx_pkts = flow_stats['rx_pkts'].get(1, 0)
drops = lat_stats['err_cntrs']['dropped']
# stats for pg_id 5 and 15
stats = self.client.get_pgid_stats(pgids['latency'])
flow_stats_5 = stats['flow_stats'].get(5)
flow_stats_10 = stats['flow_stats'].get(10)
global_lat_stats = stats['latency']
lat_stats_5 = global_lat_stats.get(5)
lat_stats_10 = global_lat_stats.get(10)

tx_pkts_5 = flow_stats_5['tx_pkts'].get(0, 0)
rx_pkts_5 = flow_stats_5['rx_pkts'].get(1, 0)
drops_5 = lat_stats_5['err_cntrs']['dropped']

tx_pkts_10 = flow_stats_10['tx_pkts'].get(0, 0)
rx_pkts_10 = flow_stats_10['rx_pkts'].get(1, 0)
drops_10 = lat_stats_10['err_cntrs']['dropped']

print(" \n TX and RX flow stats and packet dopped for pg id 5 (i.e., delay critical): ")
print(" tx packets: {0}".format(tx_pkts))
print(" tx bytes : {0}".format(tx_pps))
print(" rx packets : {0}".format(rx_pkts))
print(" drops: {0}".format(drops))
print(" tx packets: {0}".format(tx_pkts_5))
print(" tx bytes : {0}".format(tx_pps_5))
print(" rx packets : {0}".format(rx_pkts_5))
print(" drops: {0}".format(drops_5))

print(" \n TX and RX flow stats and packet dopped for pg id 10 (i.e., delay critical): ")
print(" tx packets: {0}".format(tx_pkts_10))
print(" tx bytes : {0}".format(tx_pps_10))
print(" rx packets : {0}".format(rx_pkts_10))
print(" drops: {0}".format(drops_10))

# latency info for pg_id 5
lat = lat_stats['latency']
jitter = lat['jitter']
avg = lat['average']
tot_max = lat['total_max']
tot_min = lat['total_min']
print('\n Latency info for pg id 5 (ie., delay critical):')
print(" Maximum latency(usec): {0}".format(tot_max))
print(" Minimum latency(usec): {0}".format(tot_min))
print(" Average latency(usec): {0}".format(avg))
lat_5 = lat_stats_5['latency']
avg_5 = lat_5['average']
tot_max_5 = lat_5['total_max']
tot_min_5 = lat_5['total_min']

# latency info for pg_id 10
lat_10 = lat_stats_10['latency']
avg_10 = lat_10['average']
tot_max_10 = lat_10['total_max']
tot_min_10 = lat_10['total_min']

print('\n Latency info for pg id 5 (ie., delay critical with QoS):')
print(" Maximum latency(usec): {0}".format(tot_max_5))
print(" Minimum latency(usec): {0}".format(tot_min_5))
print(" Average latency(usec): {0}".format(avg_5))

print('\n Latency info for pg id 10 (ie., delay critical without QoS):')
print(" Maximum latency(usec): {0}".format(tot_max_10))
print(" Minimum latency(usec): {0}".format(tot_min_10))
print(" Average latency(usec): {0}".format(avg_10))

# max latency difference between delay critcal flows with gp id 5 and 15
dc_max_lat_diff = tot_max_10 - tot_max_5

assert (avg <= LATENCY_DC_MAX_uSEC), \
"The avg latency is greater than the max latency for delay critcial flow"
assert ((LATENCY_LP_AVG_uSEC <= dc_max_lat_diff <= LATENCY_LP_MAX_uSEC) & (tot_max_5 <= LATENCY_DC_MAX_uSEC)), \
"Priority scheduling test failed."


# Get statistics for TX and RX ports
stats = self.client.get_stats()
readable_stats_0 = get_readable_port_stats(stats[0])
readable_stats_1 = get_readable_port_stats(stats[1])

logging.info("Priority scheduling test successfully executed.")
print ("\n Overall Statistics for TX port: \n")
print (readable_stats_0)
print ("\n Overall Statistics for RX port: \n")