From 0c019db9d850bda5c0cf6ab45004324a33780e0b Mon Sep 17 00:00:00 2001 From: Kostiantyn Stavruk Date: Fri, 28 Apr 2023 16:58:50 +0300 Subject: [PATCH 1/2] Refactor storm_control tests Signed-off-by: Kostiantyn Stavruk --- .../storm_control/storm_control_utils.py | 20 ++++ ...ntrol_br_and_mc_lag_and_vlan_membership.py | 86 +++++++-------- ...ntrol_br_and_unk_un_and_vlan_membership.py | 88 +++++++-------- .../test_storm_control_broadcast_traffic.py | 31 +++--- ...torm_control_mc_lag_and_vlan_membership.py | 100 ++++++++---------- ..._control_rule_set_for_br_and_mc_traffic.py | 69 ++++++++---- ...trol_rule_set_for_br_and_unk_uc_traffic.py | 68 ++++++++---- ..._control_unk_un_lag_and_vlan_membership.py | 98 ++++++++--------- ...t_storm_control_unknown_unicast_traffic.py | 31 +++--- ..._control_unregistered_multicast_traffic.py | 31 +++--- ...st_storm_negative_known_unicast_traffic.py | 78 ++++++++------ 11 files changed, 382 insertions(+), 318 deletions(-) diff --git a/DentOS_Framework/DentOsTestbed/src/dent_os_testbed/test/test_suite/functional/storm_control/storm_control_utils.py b/DentOS_Framework/DentOsTestbed/src/dent_os_testbed/test/test_suite/functional/storm_control/storm_control_utils.py index eaae0a5f1..3253d0a9d 100644 --- a/DentOS_Framework/DentOsTestbed/src/dent_os_testbed/test/test_suite/functional/storm_control/storm_control_utils.py +++ b/DentOS_Framework/DentOsTestbed/src/dent_os_testbed/test/test_suite/functional/storm_control/storm_control_utils.py @@ -1,3 +1,4 @@ +import math from dent_os_testbed.lib.devlink.devlink_port import DevlinkPort @@ -13,3 +14,22 @@ async def devlink_rate_value(dev, name, value, cmode=False, device_host_name=Tru devlink_info = out[0][device_host_name]['parsed_output'] kbyte_value = devlink_info['param'][dev][0]['values'][0]['value'] assert kbyte_value == value, f"Verify that storm control rate configured is '{value}' kbps.\n" + + +async def verify_expected_rx_rate(kbyte_value, stats, rx_ports, deviation=0.10): + """ + Verify expected rx_rate in bytes on ports + Args: + kbyte_value (int): Kbyte per sec rate + stats (stats_object): Output of tgen_utils_get_traffic_stats + rx_ports (list): list of Rx ports which rate should be verified + deviation (int): Permissible deviation percentage + """ + collected = {row['Port Name']: + {'tx_rate': row['Bytes Tx. Rate'], 'rx_rate': row['Bytes Rx. Rate']} for row in stats.Rows} + exp_rate = kbyte_value*1000 + for port in rx_ports: + rx_name = port.split('_')[0] + res = math.isclose(exp_rate, float(collected[rx_name]['rx_rate']), rel_tol=deviation) + assert res, f"The rate is not limited by storm control, \ + actual rate {float(collected[rx_name]['rx_rate'])} istead of {exp_rate}." diff --git a/DentOS_Framework/DentOsTestbed/src/dent_os_testbed/test/test_suite/functional/storm_control/test_storm_control_br_and_mc_lag_and_vlan_membership.py b/DentOS_Framework/DentOsTestbed/src/dent_os_testbed/test/test_suite/functional/storm_control/test_storm_control_br_and_mc_lag_and_vlan_membership.py index ffdd88311..65370542a 100644 --- a/DentOS_Framework/DentOsTestbed/src/dent_os_testbed/test/test_suite/functional/storm_control/test_storm_control_br_and_mc_lag_and_vlan_membership.py +++ b/DentOS_Framework/DentOsTestbed/src/dent_os_testbed/test/test_suite/functional/storm_control/test_storm_control_br_and_mc_lag_and_vlan_membership.py @@ -1,11 +1,12 @@ import pytest -import random import asyncio +from dent_os_testbed.test.test_suite.functional.storm_control.storm_control_utils import verify_expected_rx_rate from dent_os_testbed.test.test_suite.functional.storm_control.storm_control_utils import devlink_rate_value from dent_os_testbed.utils.test_utils.cleanup_utils import cleanup_kbyte_per_sec_rate_value from dent_os_testbed.lib.bridge.bridge_vlan import BridgeVlan from dent_os_testbed.lib.ip.ip_link import IpLink +from random import randrange from dent_os_testbed.utils.test_utils.tgen_utils import ( tgen_utils_get_dent_devices_with_tgen, @@ -14,7 +15,7 @@ tgen_utils_get_traffic_stats, tgen_utils_setup_streams, tgen_utils_start_traffic, - tgen_utils_get_loss + tgen_utils_stop_traffic ) pytestmark = [ @@ -38,10 +39,11 @@ async def test_storm_control_br_and_mc_lag_and_vlan_membership(testbed): 5. Set bridge br0 admin state UP. 6. Set ports swp2, swp4 master br0. 7. Set bonds bond1, bond2 master br0. - 8. Set up the following streams: + 8. Set storm control rate limit rule for all TG port. + 9. Set up the following streams: - Ixia port 2: broadcast and multicast streams with random generated size of packet. - 9. Transmit continues traffic by TG. - 10. Verify the RX rate on the RX port is as expected - the rate is limited by storm control. + 10. Transmit continues traffic by TG. + 11. Verify the RX rate on the RX port is as expected - the rate is limited by storm control. """ bridge = 'br0' @@ -52,8 +54,9 @@ async def test_storm_control_br_and_mc_lag_and_vlan_membership(testbed): device_host_name = dent_dev.host_name tg_ports = tgen_dev.links_dict[device_host_name][0] ports = tgen_dev.links_dict[device_host_name][1] + kbyte_value_mc = 42099 + kbyte_value_bc = 12010 traffic_duration = 15 - pps_value = 1000 for x in range(2): out = await IpLink.add( @@ -117,27 +120,19 @@ async def test_storm_control_br_and_mc_lag_and_vlan_membership(testbed): for x in range(2)]}]) assert out[0][device_host_name]['rc'] == 0, f"Verify that entities added to vid '1' and '2'.\n{out}" - await devlink_rate_value(dev=f'pci/0000:01:00.0/{ports[0].replace("swp","")}', - name='unk_uc_kbyte_per_sec_rate', value=94404, - cmode='runtime', device_host_name=device_host_name, set=True, verify=True) - await devlink_rate_value(dev=f'pci/0000:01:00.0/{ports[1].replace("swp","")}', - name='bc_kbyte_per_sec_rate', value=1210, - cmode='runtime', device_host_name=device_host_name, set=True, verify=True) - await devlink_rate_value(dev=f'pci/0000:01:00.0/{ports[1].replace("swp","")}', - name='unreg_mc_kbyte_per_sec_rate', value=35099, - cmode='runtime', device_host_name=device_host_name, set=True, verify=True) - await devlink_rate_value(dev=f'pci/0000:01:00.0/{ports[1].replace("swp","")}', - name='unk_uc_kbyte_per_sec_rate', value=37519, - cmode='runtime', device_host_name=device_host_name, set=True, verify=True) - await devlink_rate_value(dev=f'pci/0000:01:00.0/{ports[2].replace("swp","")}', - name='bc_kbyte_per_sec_rate', value=32678, - cmode='runtime', device_host_name=device_host_name, set=True, verify=True) - await devlink_rate_value(dev=f'pci/0000:01:00.0/{ports[2].replace("swp","")}', - name='unk_uc_kbyte_per_sec_rate', value=36309, - cmode='runtime', device_host_name=device_host_name, set=True, verify=True) - await devlink_rate_value(dev=f'pci/0000:01:00.0/{ports[3].replace("swp","")}', - name='unreg_mc_kbyte_per_sec_rate', value=83511, - cmode='runtime', device_host_name=device_host_name, set=True, verify=True) + params = [ + {'port': ports[0], 'name': 'unk_uc_kbyte_per_sec_rate', 'value': 94404}, + {'port': ports[1], 'name': 'bc_kbyte_per_sec_rate', 'value': kbyte_value_bc}, + {'port': ports[1], 'name': 'unreg_mc_kbyte_per_sec_rate', 'value': kbyte_value_mc}, + {'port': ports[1], 'name': 'unk_uc_kbyte_per_sec_rate', 'value': 37519}, + {'port': ports[2], 'name': 'bc_kbyte_per_sec_rate', 'value': 32678}, + {'port': ports[2], 'name': 'unk_uc_kbyte_per_sec_rate', 'value': 36309}, + {'port': ports[3], 'name': 'unreg_mc_kbyte_per_sec_rate', 'value': 83511} + ] + for value in params: + await devlink_rate_value(dev=f'pci/0000:01:00.0/{value["port"].replace("swp","")}', + name=value['name'], value=value['value'], + cmode='runtime', device_host_name=device_host_name, set=True, verify=True) try: address_map = ( @@ -167,8 +162,9 @@ async def test_storm_control_br_and_mc_lag_and_vlan_membership(testbed): 'ip_destination': dev_groups[tg_ports[0]][0]['name'], 'srcMac': 'b4:87:2a:9f:73:d5', 'dstMac': 'ff:ff:ff:ff:ff:ff', - 'frameSize': random.randint(128, 1000), - 'rate': pps_value, + 'frameSize': randrange(100, 1500), + 'frame_rate_type': 'line_rate', + 'rate': 30, 'protocol': '0x0800', 'type': 'raw' }, @@ -179,8 +175,9 @@ async def test_storm_control_br_and_mc_lag_and_vlan_membership(testbed): 'dstIp': '227.82.186.172', 'srcMac': 'da:db:ce:9c:11:6f', 'dstMac': '01:00:5E:51:ba:ac', - 'frameSize': random.randint(128, 1000), - 'rate': pps_value, + 'frameSize': randrange(100, 1500), + 'frame_rate_type': 'line_rate', + 'rate': 30, 'protocol': '0x0800', 'type': 'raw' }, @@ -191,8 +188,9 @@ async def test_storm_control_br_and_mc_lag_and_vlan_membership(testbed): 'dstIp': '227.83.186.172', 'srcMac': 'da:db:ce:9c:12:6f', 'dstMac': '01:00:5E:53:ba:ac', - 'frameSize': random.randint(128, 1000), - 'rate': pps_value, + 'frameSize': randrange(100, 1500), + 'frame_rate_type': 'line_rate', + 'rate': 30, 'protocol': '0x0800', 'type': 'raw' }, @@ -203,8 +201,9 @@ async def test_storm_control_br_and_mc_lag_and_vlan_membership(testbed): 'dstIp': '227.84.186.172', 'srcMac': 'da:db:ce:9c:13:6f', 'dstMac': '01:00:5E:55:ba:ac', - 'frameSize': random.randint(128, 1000), - 'rate': pps_value, + 'frameSize': randrange(100, 1500), + 'frame_rate_type': 'line_rate', + 'rate': 30, 'protocol': '0x0800', 'type': 'raw' } @@ -215,15 +214,10 @@ async def test_storm_control_br_and_mc_lag_and_vlan_membership(testbed): await asyncio.sleep(traffic_duration) # check the traffic stats - stats = await tgen_utils_get_traffic_stats(tgen_dev, 'Flow Statistics') - expected_loss = { - 'stream_br': 0, - 'stream_1_mc': 0, - 'stream_2_mc': 100, - 'stream_3_mc': 100 - } - for row in stats.Rows: - assert tgen_utils_get_loss(row) == expected_loss[row['Traffic Item']], \ - 'Verify that traffic forwarded/not forwarded in accordance.' + stats = await tgen_utils_get_traffic_stats(tgen_dev, 'Port Statistics') + kbyte_value = kbyte_value_bc+kbyte_value_mc + await verify_expected_rx_rate(kbyte_value, stats, rx_ports=[streams['stream_br']['ip_destination']], + deviation=0.10) finally: - await cleanup_kbyte_per_sec_rate_value(dent_dev, all_values=True) + await tgen_utils_stop_traffic(tgen_dev) + await cleanup_kbyte_per_sec_rate_value(dent_dev, tgen_dev, all_values=True) diff --git a/DentOS_Framework/DentOsTestbed/src/dent_os_testbed/test/test_suite/functional/storm_control/test_storm_control_br_and_unk_un_and_vlan_membership.py b/DentOS_Framework/DentOsTestbed/src/dent_os_testbed/test/test_suite/functional/storm_control/test_storm_control_br_and_unk_un_and_vlan_membership.py index 7c23dfe48..5afde7df2 100644 --- a/DentOS_Framework/DentOsTestbed/src/dent_os_testbed/test/test_suite/functional/storm_control/test_storm_control_br_and_unk_un_and_vlan_membership.py +++ b/DentOS_Framework/DentOsTestbed/src/dent_os_testbed/test/test_suite/functional/storm_control/test_storm_control_br_and_unk_un_and_vlan_membership.py @@ -1,11 +1,12 @@ import pytest -import random import asyncio +from dent_os_testbed.test.test_suite.functional.storm_control.storm_control_utils import verify_expected_rx_rate from dent_os_testbed.test.test_suite.functional.storm_control.storm_control_utils import devlink_rate_value from dent_os_testbed.utils.test_utils.cleanup_utils import cleanup_kbyte_per_sec_rate_value from dent_os_testbed.lib.bridge.bridge_vlan import BridgeVlan from dent_os_testbed.lib.ip.ip_link import IpLink +from random import randrange from dent_os_testbed.utils.test_utils.tgen_utils import ( tgen_utils_get_dent_devices_with_tgen, @@ -14,7 +15,7 @@ tgen_utils_get_traffic_stats, tgen_utils_setup_streams, tgen_utils_start_traffic, - tgen_utils_get_loss + tgen_utils_stop_traffic ) pytestmark = [ @@ -38,10 +39,11 @@ async def test_storm_control_br_and_unk_un_and_vlan_membership(testbed): 5. Set bridge br0 admin state UP. 6. Set ports swp2, swp4 master br0. 7. Set bonds bond1, bond2 master br0. - 8. Set up the following streams: + 8. Set storm control rate limit rule for all TG port. + 9. Set up the following streams: - Ixia port 3: broadcast and unknown unicast streams with random generated size of packet. - 9. Transmit continues traffic by TG. - 10. Verify the RX rate on the RX port is as expected - the rate is limited by storm control. + 10. Transmit continues traffic by TG. + 11. Verify the RX rate on the RX port is as expected - the rate is limited by storm control. """ bridge = 'br0' @@ -52,8 +54,9 @@ async def test_storm_control_br_and_unk_un_and_vlan_membership(testbed): device_host_name = dent_dev.host_name tg_ports = tgen_dev.links_dict[device_host_name][0] ports = tgen_dev.links_dict[device_host_name][1] + kbyte_value_unk_uc = 20511 + kbyte_value_bc = 32678 traffic_duration = 15 - pps_value = 1000 for x in range(2): out = await IpLink.add( @@ -117,27 +120,19 @@ async def test_storm_control_br_and_unk_un_and_vlan_membership(testbed): for x in range(2)]}]) assert out[0][device_host_name]['rc'] == 0, f"Verify that entities added to vid '1' and '2'.\n{out}" - await devlink_rate_value(dev=f'pci/0000:01:00.0/{ports[0].replace("swp","")}', - name='unk_uc_kbyte_per_sec_rate', value=94404, - cmode='runtime', device_host_name=device_host_name, set=True, verify=True) - await devlink_rate_value(dev=f'pci/0000:01:00.0/{ports[1].replace("swp","")}', - name='bc_kbyte_per_sec_rate', value=1210, - cmode='runtime', device_host_name=device_host_name, set=True, verify=True) - await devlink_rate_value(dev=f'pci/0000:01:00.0/{ports[1].replace("swp","")}', - name='unreg_mc_kbyte_per_sec_rate', value=35099, - cmode='runtime', device_host_name=device_host_name, set=True, verify=True) - await devlink_rate_value(dev=f'pci/0000:01:00.0/{ports[1].replace("swp","")}', - name='unk_uc_kbyte_per_sec_rate', value=37519, - cmode='runtime', device_host_name=device_host_name, set=True, verify=True) - await devlink_rate_value(dev=f'pci/0000:01:00.0/{ports[2].replace("swp","")}', - name='bc_kbyte_per_sec_rate', value=32678, - cmode='runtime', device_host_name=device_host_name, set=True, verify=True) - await devlink_rate_value(dev=f'pci/0000:01:00.0/{ports[2].replace("swp","")}', - name='unk_uc_kbyte_per_sec_rate', value=36309, - cmode='runtime', device_host_name=device_host_name, set=True, verify=True) - await devlink_rate_value(dev=f'pci/0000:01:00.0/{ports[3].replace("swp","")}', - name='unreg_mc_kbyte_per_sec_rate', value=83511, - cmode='runtime', device_host_name=device_host_name, set=True, verify=True) + params = [ + {'port': ports[0], 'name': 'unk_uc_kbyte_per_sec_rate', 'value': 94404}, + {'port': ports[1], 'name': 'bc_kbyte_per_sec_rate', 'value': 1210}, + {'port': ports[1], 'name': 'unreg_mc_kbyte_per_sec_rate', 'value': 35099}, + {'port': ports[1], 'name': 'unk_uc_kbyte_per_sec_rate', 'value': 37519}, + {'port': ports[2], 'name': 'bc_kbyte_per_sec_rate', 'value': kbyte_value_bc}, + {'port': ports[2], 'name': 'unk_uc_kbyte_per_sec_rate', 'value': kbyte_value_unk_uc}, + {'port': ports[3], 'name': 'unreg_mc_kbyte_per_sec_rate', 'value': 83511} + ] + for value in params: + await devlink_rate_value(dev=f'pci/0000:01:00.0/{value["port"].replace("swp","")}', + name=value['name'], value=value['value'], + cmode='runtime', device_host_name=device_host_name, set=True, verify=True) try: address_map = ( @@ -164,11 +159,12 @@ async def test_storm_control_br_and_unk_un_and_vlan_membership(testbed): streams = { 'stream_br': { 'ip_source': dev_groups[tg_ports[2]][0]['name'], - 'ip_destination': dev_groups[tg_ports[3]][0]['name'], + 'ip_destination': dev_groups[tg_ports[0]][0]['name'], 'srcMac': 'b4:87:2a:9f:75:d5', 'dstMac': 'ff:ff:ff:ff:ff:ff', - 'frameSize': random.randint(128, 1000), - 'rate': pps_value, + 'frameSize': randrange(100, 1500), + 'frame_rate_type': 'line_rate', + 'rate': 30, 'protocol': '0x0800', 'type': 'raw' }, @@ -177,8 +173,9 @@ async def test_storm_control_br_and_unk_un_and_vlan_membership(testbed): 'ip_destination': dev_groups[tg_ports[0]][0]['name'], 'srcMac': '1c:30:27:a1:3c:bc', 'dstMac': '4a:4c:30:4e:9d:1e', - 'frameSize': random.randint(128, 1000), - 'rate': pps_value, + 'frameSize': randrange(100, 1500), + 'frame_rate_type': 'line_rate', + 'rate': 30, 'protocol': '0x0800', 'type': 'raw' }, @@ -189,8 +186,9 @@ async def test_storm_control_br_and_unk_un_and_vlan_membership(testbed): 'dstIp': '0.0.0.0', 'srcMac': '8:d4:6b:50:c9:f9', 'dstMac': 'b6:ee:e2:ef:d7:68', - 'frameSize': random.randint(128, 1000), - 'rate': pps_value, + 'frameSize': randrange(100, 1500), + 'frame_rate_type': 'line_rate', + 'rate': 30, 'protocol': '0x0800', 'type': 'raw' }, @@ -199,8 +197,9 @@ async def test_storm_control_br_and_unk_un_and_vlan_membership(testbed): 'ip_destination': dev_groups[tg_ports[3]][0]['name'], 'srcMac': 'ae:8a:1d:f3:1d:a5', 'dstMac': '6e:f8:5a:c0:66:84', - 'frameSize': random.randint(128, 1000), - 'rate': pps_value, + 'frameSize': randrange(100, 1500), + 'frame_rate_type': 'line_rate', + 'rate': 30, 'protocol': '0x0800', 'type': 'raw' } @@ -211,15 +210,10 @@ async def test_storm_control_br_and_unk_un_and_vlan_membership(testbed): await asyncio.sleep(traffic_duration) # check the traffic stats - stats = await tgen_utils_get_traffic_stats(tgen_dev, 'Flow Statistics') - expected_loss = { - 'stream_br': 0, - 'stream_1_unk_un': 100, - 'stream_2_unk_un': 100, - 'stream_3_unk_un': 0 - } - for row in stats.Rows: - assert tgen_utils_get_loss(row) == expected_loss[row['Traffic Item']], \ - 'Verify that traffic forwarded/not forwarded in accordance.' + stats = await tgen_utils_get_traffic_stats(tgen_dev, 'Port Statistics') + kbyte_value = kbyte_value_bc+kbyte_value_unk_uc + await verify_expected_rx_rate(kbyte_value, stats, rx_ports=[streams['stream_3_unk_un']['ip_destination']], + deviation=0.10) finally: - await cleanup_kbyte_per_sec_rate_value(dent_dev, all_values=True) + await tgen_utils_stop_traffic(tgen_dev) + await cleanup_kbyte_per_sec_rate_value(dent_dev, tgen_dev, all_values=True) diff --git a/DentOS_Framework/DentOsTestbed/src/dent_os_testbed/test/test_suite/functional/storm_control/test_storm_control_broadcast_traffic.py b/DentOS_Framework/DentOsTestbed/src/dent_os_testbed/test/test_suite/functional/storm_control/test_storm_control_broadcast_traffic.py index 591482080..bed85941e 100644 --- a/DentOS_Framework/DentOsTestbed/src/dent_os_testbed/test/test_suite/functional/storm_control/test_storm_control_broadcast_traffic.py +++ b/DentOS_Framework/DentOsTestbed/src/dent_os_testbed/test/test_suite/functional/storm_control/test_storm_control_broadcast_traffic.py @@ -1,6 +1,7 @@ import pytest import asyncio +from dent_os_testbed.test.test_suite.functional.storm_control.storm_control_utils import verify_expected_rx_rate from dent_os_testbed.test.test_suite.functional.storm_control.storm_control_utils import devlink_rate_value from dent_os_testbed.utils.test_utils.cleanup_utils import cleanup_kbyte_per_sec_rate_value from dent_os_testbed.lib.ip.ip_link import IpLink @@ -13,7 +14,7 @@ tgen_utils_get_traffic_stats, tgen_utils_setup_streams, tgen_utils_start_traffic, - tgen_utils_get_loss + tgen_utils_stop_traffic ) pytestmark = [ @@ -35,11 +36,12 @@ async def test_storm_control_broadcast_traffic(testbed): 3. Set entities swp1, swp2 UP state. 4. Set bridge br0 admin state UP. 5. Verify that storm control is disabled by default for broadcast traffic - by setting the storm control rate limit to broadcast traffic on the TX port. - 6. Set up the following stream: + by setting the storm control rate limit. + 6. Set storm control rate limit rule for broadcast traffic on TX port (on the first TG port). + 7. Set up the following stream: - broadcast traffic stream with random generated packet size on TX port. - 7. Transmit continues traffic by TG. - 8. Verify the RX rate on the RX port is as expected - the rate is limited by storm control. + 8. Transmit continues traffic by TG. + 9. Verify the RX rate on the RX port is as expected - the rate is limited by storm control. """ bridge = 'br0' @@ -50,8 +52,8 @@ async def test_storm_control_broadcast_traffic(testbed): device_host_name = dent_dev.host_name tg_ports = tgen_dev.links_dict[device_host_name][0] ports = tgen_dev.links_dict[device_host_name][1] - traffic_duration = 10 - pps_value = 1000 + traffic_duration = 15 + kbyte_value = 118227 out = await IpLink.add( input_data=[{device_host_name: [ @@ -74,7 +76,7 @@ async def test_storm_control_broadcast_traffic(testbed): name='bc_kbyte_per_sec_rate', value=0, device_host_name=device_host_name, verify=True) await devlink_rate_value(dev=f'pci/0000:01:00.0/{ports[0].replace("swp","")}', - name='bc_kbyte_per_sec_rate', value=118227, + name='bc_kbyte_per_sec_rate', value=kbyte_value, cmode='runtime', device_host_name=device_host_name, set=True, verify=True) try: @@ -106,7 +108,8 @@ async def test_storm_control_broadcast_traffic(testbed): 'srcMac': '92:cc:23:09:37:ca', 'dstMac': 'ff:ff:ff:ff:ff:ff', 'frameSize': randrange(100, 1500), - 'rate': pps_value, + 'frame_rate_type': 'line_rate', + 'rate': 100, 'protocol': '0x0800', 'type': 'raw' } @@ -117,9 +120,9 @@ async def test_storm_control_broadcast_traffic(testbed): await asyncio.sleep(traffic_duration) # check the traffic stats - stats = await tgen_utils_get_traffic_stats(tgen_dev, 'Flow Statistics') - for row in stats.Rows: - loss = tgen_utils_get_loss(row) - assert loss == 0, f'Expected loss: 0%, actual: {loss}%' + stats = await tgen_utils_get_traffic_stats(tgen_dev, 'Port Statistics') + await verify_expected_rx_rate(kbyte_value, stats, rx_ports=[streams['stream_A']['ip_destination']], + deviation=0.10) finally: - await cleanup_kbyte_per_sec_rate_value(dent_dev, bc=True) + await tgen_utils_stop_traffic(tgen_dev) + await cleanup_kbyte_per_sec_rate_value(dent_dev, tgen_dev, bc=True) diff --git a/DentOS_Framework/DentOsTestbed/src/dent_os_testbed/test/test_suite/functional/storm_control/test_storm_control_mc_lag_and_vlan_membership.py b/DentOS_Framework/DentOsTestbed/src/dent_os_testbed/test/test_suite/functional/storm_control/test_storm_control_mc_lag_and_vlan_membership.py index 88565f013..b8f54221d 100644 --- a/DentOS_Framework/DentOsTestbed/src/dent_os_testbed/test/test_suite/functional/storm_control/test_storm_control_mc_lag_and_vlan_membership.py +++ b/DentOS_Framework/DentOsTestbed/src/dent_os_testbed/test/test_suite/functional/storm_control/test_storm_control_mc_lag_and_vlan_membership.py @@ -1,11 +1,12 @@ import pytest -import random import asyncio +from dent_os_testbed.test.test_suite.functional.storm_control.storm_control_utils import verify_expected_rx_rate from dent_os_testbed.test.test_suite.functional.storm_control.storm_control_utils import devlink_rate_value from dent_os_testbed.utils.test_utils.cleanup_utils import cleanup_kbyte_per_sec_rate_value from dent_os_testbed.lib.bridge.bridge_vlan import BridgeVlan from dent_os_testbed.lib.ip.ip_link import IpLink +from random import randrange from dent_os_testbed.utils.test_utils.tgen_utils import ( tgen_utils_get_dent_devices_with_tgen, @@ -14,7 +15,7 @@ tgen_utils_get_traffic_stats, tgen_utils_setup_streams, tgen_utils_start_traffic, - tgen_utils_get_loss + tgen_utils_stop_traffic ) pytestmark = [ @@ -38,10 +39,11 @@ async def test_storm_control_mc_lag_and_vlan_membership(testbed): 5. Set bridge br0 admin state UP. 6. Set ports swp2, swp4 master br0. 7. Set bonds bond1, bond2 master br0. - 8. Set up the following streams: + 8. Set storm control rate limit rule for all TG port. + 9. Set up the following streams: - Ixia port 4: multicast streams with random generated size of packet. - 9. Transmit continues traffic by TG. - 10. Verify the RX rate on the RX port is as expected - the rate is limited by storm control. + 10. Transmit continues traffic by TG. + 11. Verify the RX rate on the RX port is as expected - the rate is limited by storm control. """ bridge = 'br0' @@ -53,7 +55,7 @@ async def test_storm_control_mc_lag_and_vlan_membership(testbed): tg_ports = tgen_dev.links_dict[device_host_name][0] ports = tgen_dev.links_dict[device_host_name][1] traffic_duration = 15 - pps_value = 1000 + kbyte_value = 83511 for x in range(2): out = await IpLink.add( @@ -117,27 +119,19 @@ async def test_storm_control_mc_lag_and_vlan_membership(testbed): for x in range(2)]}]) assert out[0][device_host_name]['rc'] == 0, f"Verify that entities added to vid '1' and '2'.\n{out}" - await devlink_rate_value(dev=f'pci/0000:01:00.0/{ports[0].replace("swp","")}', - name='unk_uc_kbyte_per_sec_rate', value=94404, - cmode='runtime', device_host_name=device_host_name, set=True, verify=True) - await devlink_rate_value(dev=f'pci/0000:01:00.0/{ports[1].replace("swp","")}', - name='bc_kbyte_per_sec_rate', value=1210, - cmode='runtime', device_host_name=device_host_name, set=True, verify=True) - await devlink_rate_value(dev=f'pci/0000:01:00.0/{ports[1].replace("swp","")}', - name='unreg_mc_kbyte_per_sec_rate', value=35099, - cmode='runtime', device_host_name=device_host_name, set=True, verify=True) - await devlink_rate_value(dev=f'pci/0000:01:00.0/{ports[1].replace("swp","")}', - name='unk_uc_kbyte_per_sec_rate', value=37519, - cmode='runtime', device_host_name=device_host_name, set=True, verify=True) - await devlink_rate_value(dev=f'pci/0000:01:00.0/{ports[2].replace("swp","")}', - name='bc_kbyte_per_sec_rate', value=32678, - cmode='runtime', device_host_name=device_host_name, set=True, verify=True) - await devlink_rate_value(dev=f'pci/0000:01:00.0/{ports[2].replace("swp","")}', - name='unk_uc_kbyte_per_sec_rate', value=36309, - cmode='runtime', device_host_name=device_host_name, set=True, verify=True) - await devlink_rate_value(dev=f'pci/0000:01:00.0/{ports[3].replace("swp","")}', - name='unreg_mc_kbyte_per_sec_rate', value=83511, - cmode='runtime', device_host_name=device_host_name, set=True, verify=True) + params = [ + {'port': ports[0], 'name': 'unk_uc_kbyte_per_sec_rate', 'value': 94404}, + {'port': ports[1], 'name': 'bc_kbyte_per_sec_rate', 'value': 1210}, + {'port': ports[1], 'name': 'unreg_mc_kbyte_per_sec_rate', 'value': 35099}, + {'port': ports[1], 'name': 'unk_uc_kbyte_per_sec_rate', 'value': 37519}, + {'port': ports[2], 'name': 'bc_kbyte_per_sec_rate', 'value': 32678}, + {'port': ports[2], 'name': 'unk_uc_kbyte_per_sec_rate', 'value': 36309}, + {'port': ports[3], 'name': 'unreg_mc_kbyte_per_sec_rate', 'value': kbyte_value} + ] + for value in params: + await devlink_rate_value(dev=f'pci/0000:01:00.0/{value["port"].replace("swp","")}', + name=value['name'], value=value['value'], + cmode='runtime', device_host_name=device_host_name, set=True, verify=True) try: address_map = ( @@ -158,36 +152,32 @@ async def test_storm_control_mc_lag_and_vlan_membership(testbed): """ Set up the following streams: — stream_1 — | — stream_2 — | — stream_3 — - swp4 -> swp1 | swp4 -> swp2 | swp1 -> swp3 + swp4 -> swp1 | swp4 -> swp2 | swp4 -> swp3 """ - for x in range(3): - streams = { - f'stream_{x+1}_mc_swp4->swp{x+1}': { - 'ip_source': dev_groups[tg_ports[3]][0]['name'], - 'ip_destination': dev_groups[tg_ports[x]][0]['name'], - 'srcMac': f'74:c9:fe:eb:d5:8{x+1}', - 'dstMac': f'01:00:5E:3{x+1}:2e:7f', - 'frameSize': random.randint(128, 512), - 'rate': pps_value, - 'protocol': '0x0800', - 'type': 'raw' - } - } - - await tgen_utils_setup_streams(tgen_dev, config_file_name=None, streams=streams) - await tgen_utils_start_traffic(tgen_dev) - await asyncio.sleep(traffic_duration) + streams = { + f'stream_{x+1}_mc_swp4->swp{x+1}': { + 'ip_source': dev_groups[tg_ports[3]][0]['name'], + 'ip_destination': dev_groups[tg_ports[x]][0]['name'], + 'srcMac': f'74:c9:fe:eb:d5:8{x+1}', + 'dstMac': f'01:00:5E:3{x+1}:2e:7f', + 'frameSize': randrange(100, 1500), + 'frame_rate_type': 'line_rate', + 'rate': 30, + 'protocol': '0x0800', + 'type': 'raw' + } for x in range(3) + } + + await tgen_utils_setup_streams(tgen_dev, config_file_name=None, streams=streams) + await tgen_utils_start_traffic(tgen_dev) + await asyncio.sleep(traffic_duration) # check the traffic stats - stats = await tgen_utils_get_traffic_stats(tgen_dev, 'Flow Statistics') - expected_loss = { - 'stream_1_mc_swp4->swp1': 100, - 'stream_2_mc_swp4->swp2': 100, - 'stream_3_mc_swp4->swp3': 0 - } - for row in stats.Rows: - assert tgen_utils_get_loss(row) == expected_loss[row['Traffic Item']], \ - 'Verify that traffic forwarded/not forwarded in accordance.' + stats = await tgen_utils_get_traffic_stats(tgen_dev, 'Port Statistics') + await verify_expected_rx_rate(kbyte_value, stats, + rx_ports=[streams['stream_3_mc_swp4->swp3']['ip_destination']], + deviation=0.10) finally: - await cleanup_kbyte_per_sec_rate_value(dent_dev, all_values=True) + await tgen_utils_stop_traffic(tgen_dev) + await cleanup_kbyte_per_sec_rate_value(dent_dev, tgen_dev, all_values=True) diff --git a/DentOS_Framework/DentOsTestbed/src/dent_os_testbed/test/test_suite/functional/storm_control/test_storm_control_rule_set_for_br_and_mc_traffic.py b/DentOS_Framework/DentOsTestbed/src/dent_os_testbed/test/test_suite/functional/storm_control/test_storm_control_rule_set_for_br_and_mc_traffic.py index f46d02fb9..98c8c3acc 100644 --- a/DentOS_Framework/DentOsTestbed/src/dent_os_testbed/test/test_suite/functional/storm_control/test_storm_control_rule_set_for_br_and_mc_traffic.py +++ b/DentOS_Framework/DentOsTestbed/src/dent_os_testbed/test/test_suite/functional/storm_control/test_storm_control_rule_set_for_br_and_mc_traffic.py @@ -1,3 +1,4 @@ +import math import pytest import asyncio @@ -13,7 +14,7 @@ tgen_utils_get_traffic_stats, tgen_utils_setup_streams, tgen_utils_start_traffic, - tgen_utils_get_loss + tgen_utils_stop_traffic ) pytestmark = [ @@ -47,15 +48,17 @@ async def test_storm_control_rule_set_for_br_and_mc_traffic(testbed): """ bridge = 'br0' - tgen_dev, dent_devices = await tgen_utils_get_dent_devices_with_tgen(testbed, [], 2) + tgen_dev, dent_devices = await tgen_utils_get_dent_devices_with_tgen(testbed, [], 4) if not tgen_dev or not dent_devices: pytest.skip('The testbed does not have enough dent with tgen connections') dent_dev = dent_devices[0] device_host_name = dent_dev.host_name tg_ports = tgen_dev.links_dict[device_host_name][0] ports = tgen_dev.links_dict[device_host_name][1] - traffic_duration = 10 - pps_value = 1000 + kbyte_value_bc = 15689 + kbyte_value_mc = 27713 + traffic_duration = 15 + deviation = 0.10 out = await IpLink.add( input_data=[{device_host_name: [ @@ -75,14 +78,16 @@ async def test_storm_control_rule_set_for_br_and_mc_traffic(testbed): assert out[0][device_host_name]['rc'] == 0, err_msg await devlink_rate_value(dev=f'pci/0000:01:00.0/{ports[0].replace("swp","")}', - name='bc_kbyte_per_sec_rate', value=21689, + name='bc_kbyte_per_sec_rate', value=kbyte_value_bc, cmode='runtime', device_host_name=device_host_name, set=True, verify=True) try: address_map = ( # swp port, tg port, tg ip, gw, plen (ports[0], tg_ports[0], '1.1.1.2', '1.1.1.1', 24), - (ports[1], tg_ports[1], '1.1.1.3', '1.1.1.1', 24) + (ports[1], tg_ports[1], '1.1.1.3', '1.1.1.1', 24), + (ports[2], tg_ports[2], '1.1.1.4', '1.1.1.1', 24), + (ports[3], tg_ports[3], '1.1.1.5', '1.1.1.1', 24) ) dev_groups = tgen_utils_dev_groups_from_config( @@ -95,31 +100,33 @@ async def test_storm_control_rule_set_for_br_and_mc_traffic(testbed): """ Set up the following streams: — stream_1 — | — stream_2 — | — stream_3 — - swp1 -> swp2 | swp1 -> swp2 | swp1 -> swp2 + swp1 -> swp4 | swp1 -> swp3 | swp1 -> swp2 """ streams = { 'stream_1': { 'ip_source': dev_groups[tg_ports[0]][0]['name'], - 'ip_destination': dev_groups[tg_ports[1]][0]['name'], + 'ip_destination': dev_groups[tg_ports[3]][0]['name'], 'srcIp': '147.126.111.32', 'dstIp': '255.255.255.255', 'srcMac': 'b2:ac:8f:b3:fb:2c', 'dstMac': 'ff:ff:ff:ff:ff:ff', 'frameSize': randrange(100, 1500), - 'rate': pps_value, + 'frame_rate_type': 'line_rate', + 'rate': 30, 'protocol': '0x0800', 'type': 'raw' }, 'stream_2': { 'ip_source': dev_groups[tg_ports[0]][0]['name'], - 'ip_destination': dev_groups[tg_ports[1]][0]['name'], + 'ip_destination': dev_groups[tg_ports[2]][0]['name'], 'srcIp': '109.51.220.173', 'dstIp': '224.33.57.130', 'srcMac': '76:07:44:b7:38:07', 'dstMac': '01:00:5E:21:39:82', 'frameSize': randrange(100, 1500), - 'rate': pps_value, + 'frame_rate_type': 'line_rate', + 'rate': 30, 'protocol': '0x0800', 'type': 'raw' }, @@ -129,7 +136,8 @@ async def test_storm_control_rule_set_for_br_and_mc_traffic(testbed): 'srcMac': '98:ba:45:33:c7:ee', 'dstMac': 'd2:15:8d:45:e1:1e', 'frameSize': randrange(100, 1500), - 'rate': pps_value, + 'frame_rate_type': 'line_rate', + 'rate': 30, 'protocol': '0x0800', 'type': 'raw' } @@ -140,24 +148,41 @@ async def test_storm_control_rule_set_for_br_and_mc_traffic(testbed): await asyncio.sleep(traffic_duration) # check the traffic stats - stats = await tgen_utils_get_traffic_stats(tgen_dev, 'Flow Statistics') - for row in stats.Rows: - loss = tgen_utils_get_loss(row) - assert loss == 0, f'Expected loss: 0%, actual: {loss}%' + stats = await tgen_utils_get_traffic_stats(tgen_dev, 'Traffic Item Statistics') + collected = {row['Traffic Item']: + {'tx_rate': row['Tx Rate (Bps)'], 'rx_rate': row['Rx Rate (Bps)']} for row in stats.Rows} + assert math.isclose(kbyte_value_bc*1000, + float(collected['stream_1']['rx_rate']), rel_tol=deviation), \ + f"The rate is not limited by storm control, \ + actual rate {kbyte_value_bc*1000} istead of {float(collected['stream_1']['rx_rate'])}." + for x in range(2): + assert math.isclose(float(collected[f'stream_{x+2}']['tx_rate']), + float(collected[f'stream_{x+2}']['rx_rate']), rel_tol=deviation), \ + f"The rate is limited by storm control, actual rate {float(collected[f'stream_{x+2}']['tx_rate'])} \ + istead of {float(collected[f'stream_{x+2}']['rx_rate'])}." await devlink_rate_value(dev=f'pci/0000:01:00.0/{ports[0].replace("swp","")}', name='bc_kbyte_per_sec_rate', value=0, cmode='runtime', device_host_name=device_host_name, set=True, verify=True) await devlink_rate_value(dev=f'pci/0000:01:00.0/{ports[0].replace("swp","")}', - name='unreg_mc_kbyte_per_sec_rate', value=27713, + name='unreg_mc_kbyte_per_sec_rate', value=kbyte_value_mc, cmode='runtime', device_host_name=device_host_name, set=True, verify=True) await asyncio.sleep(traffic_duration) # check the traffic stats - stats = await tgen_utils_get_traffic_stats(tgen_dev, 'Flow Statistics') - for row in stats.Rows: - loss = tgen_utils_get_loss(row) - assert loss == 0, f'Expected loss: 0%, actual: {loss}%' + stats = await tgen_utils_get_traffic_stats(tgen_dev, 'Traffic Item Statistics') + collected = {row['Traffic Item']: + {'tx_rate': row['Tx Rate (Bps)'], 'rx_rate': row['Rx Rate (Bps)']} for row in stats.Rows} + for x in range(2): + assert math.isclose(float(collected[f'stream_{1 if x==0 else 3}']['tx_rate']), + float(collected[f'stream_{1 if x==0 else 3}']['rx_rate']), rel_tol=deviation), \ + f"The rate is limited by storm control, actual rate \ + {float(collected[f'stream_{1 if x==0 else 3}']['tx_rate'])} \ + istead of {float(collected[f'stream_{1 if x==0 else 3}']['rx_rate'])}." + assert math.isclose(kbyte_value_mc*1000, float(collected['stream_2']['rx_rate']), rel_tol=deviation), \ + f"The rate is not limited by storm control, \ + actual rate {kbyte_value_mc*1000} istead of {float(collected['stream_2']['rx_rate'])}." finally: - await cleanup_kbyte_per_sec_rate_value(dent_dev, all_values=True) + await tgen_utils_stop_traffic(tgen_dev) + await cleanup_kbyte_per_sec_rate_value(dent_dev, tgen_dev, all_values=True) diff --git a/DentOS_Framework/DentOsTestbed/src/dent_os_testbed/test/test_suite/functional/storm_control/test_storm_control_rule_set_for_br_and_unk_uc_traffic.py b/DentOS_Framework/DentOsTestbed/src/dent_os_testbed/test/test_suite/functional/storm_control/test_storm_control_rule_set_for_br_and_unk_uc_traffic.py index ce4290308..4ac320429 100644 --- a/DentOS_Framework/DentOsTestbed/src/dent_os_testbed/test/test_suite/functional/storm_control/test_storm_control_rule_set_for_br_and_unk_uc_traffic.py +++ b/DentOS_Framework/DentOsTestbed/src/dent_os_testbed/test/test_suite/functional/storm_control/test_storm_control_rule_set_for_br_and_unk_uc_traffic.py @@ -1,3 +1,4 @@ +import math import pytest import asyncio @@ -13,7 +14,7 @@ tgen_utils_get_traffic_stats, tgen_utils_setup_streams, tgen_utils_start_traffic, - tgen_utils_get_loss + tgen_utils_stop_traffic ) pytestmark = [ @@ -47,15 +48,17 @@ async def test_storm_control_rule_set_for_br_and_unk_uc_traffic(testbed): """ bridge = 'br0' - tgen_dev, dent_devices = await tgen_utils_get_dent_devices_with_tgen(testbed, [], 2) + tgen_dev, dent_devices = await tgen_utils_get_dent_devices_with_tgen(testbed, [], 4) if not tgen_dev or not dent_devices: pytest.skip('The testbed does not have enough dent with tgen connections') dent_dev = dent_devices[0] device_host_name = dent_dev.host_name tg_ports = tgen_dev.links_dict[device_host_name][0] ports = tgen_dev.links_dict[device_host_name][1] - traffic_duration = 10 - pps_value = 1000 + kbyte_value_unk_uc = 7229 + kbyte_value_bc = 21689 + traffic_duration = 15 + deviation = 0.10 out = await IpLink.add( input_data=[{device_host_name: [ @@ -75,14 +78,16 @@ async def test_storm_control_rule_set_for_br_and_unk_uc_traffic(testbed): assert out[0][device_host_name]['rc'] == 0, err_msg await devlink_rate_value(dev=f'pci/0000:01:00.0/{ports[0].replace("swp","")}', - name='bc_kbyte_per_sec_rate', value=21689, + name='bc_kbyte_per_sec_rate', value=kbyte_value_bc, cmode='runtime', device_host_name=device_host_name, set=True, verify=True) try: address_map = ( # swp port, tg port, tg ip, gw, plen (ports[0], tg_ports[0], '1.1.1.2', '1.1.1.1', 24), - (ports[1], tg_ports[1], '1.1.1.3', '1.1.1.1', 24) + (ports[1], tg_ports[1], '1.1.1.3', '1.1.1.1', 24), + (ports[2], tg_ports[2], '1.1.1.4', '1.1.1.1', 24), + (ports[3], tg_ports[3], '1.1.1.5', '1.1.1.1', 24) ) dev_groups = tgen_utils_dev_groups_from_config( @@ -95,31 +100,33 @@ async def test_storm_control_rule_set_for_br_and_unk_uc_traffic(testbed): """ Set up the following streams: — stream_1 — | — stream_2 — | — stream_3 — - swp1 -> swp2 | swp1 -> swp2 | swp1 -> swp2 + swp1 -> swp4 | swp1 -> swp3 | swp1 -> swp2 """ streams = { 'stream_1': { 'ip_source': dev_groups[tg_ports[0]][0]['name'], - 'ip_destination': dev_groups[tg_ports[1]][0]['name'], + 'ip_destination': dev_groups[tg_ports[3]][0]['name'], 'srcIp': '147.126.111.32', 'dstIp': '255.255.255.255', 'srcMac': 'b2:ac:8f:b3:fb:2c', 'dstMac': 'ff:ff:ff:ff:ff:ff', 'frameSize': randrange(100, 1500), - 'rate': pps_value, + 'frame_rate_type': 'line_rate', + 'rate': 30, 'protocol': '0x0800', 'type': 'raw' }, 'stream_2': { 'ip_source': dev_groups[tg_ports[0]][0]['name'], - 'ip_destination': dev_groups[tg_ports[1]][0]['name'], + 'ip_destination': dev_groups[tg_ports[2]][0]['name'], 'srcIp': '109.51.220.173', 'dstIp': '224.33.57.130', 'srcMac': '76:07:44:b7:38:07', 'dstMac': '01:00:5E:21:39:82', 'frameSize': randrange(100, 1500), - 'rate': pps_value, + 'frame_rate_type': 'line_rate', + 'rate': 30, 'protocol': '0x0800', 'type': 'raw' }, @@ -129,7 +136,8 @@ async def test_storm_control_rule_set_for_br_and_unk_uc_traffic(testbed): 'srcMac': '98:ba:45:33:c7:ee', 'dstMac': 'd2:15:8d:45:e1:1e', 'frameSize': randrange(100, 1500), - 'rate': pps_value, + 'frame_rate_type': 'line_rate', + 'rate': 30, 'protocol': '0x0800', 'type': 'raw' } @@ -140,24 +148,40 @@ async def test_storm_control_rule_set_for_br_and_unk_uc_traffic(testbed): await asyncio.sleep(traffic_duration) # check the traffic stats - stats = await tgen_utils_get_traffic_stats(tgen_dev, 'Flow Statistics') - for row in stats.Rows: - loss = tgen_utils_get_loss(row) - assert loss == 0, f'Expected loss: 0%, actual: {loss}%' + stats = await tgen_utils_get_traffic_stats(tgen_dev, 'Traffic Item Statistics') + collected = {row['Traffic Item']: + {'tx_rate': row['Tx Rate (Bps)'], 'rx_rate': row['Rx Rate (Bps)']} for row in stats.Rows} + assert math.isclose(kbyte_value_bc*1000, + float(collected['stream_1']['rx_rate']), rel_tol=deviation), \ + f"The rate is not limited by storm control, \ + actual rate {kbyte_value_bc*1000} istead of {float(collected['stream_1']['rx_rate'])}." + for x in range(2): + assert math.isclose(float(collected[f'stream_{x+2}']['tx_rate']), + float(collected[f'stream_{x+2}']['rx_rate']), rel_tol=deviation), \ + f"The rate is limited by storm control, actual rate {float(collected[f'stream_{x+2}']['tx_rate'])} \ + istead of {float(collected[f'stream_{x+2}']['rx_rate'])}." await devlink_rate_value(dev=f'pci/0000:01:00.0/{ports[0].replace("swp","")}', name='bc_kbyte_per_sec_rate', value=0, cmode='runtime', device_host_name=device_host_name, set=True, verify=True) await devlink_rate_value(dev=f'pci/0000:01:00.0/{ports[0].replace("swp","")}', - name='unk_uc_kbyte_per_sec_rate', value=7229, + name='unk_uc_kbyte_per_sec_rate', value=kbyte_value_unk_uc, cmode='runtime', device_host_name=device_host_name, set=True, verify=True) await asyncio.sleep(traffic_duration) # check the traffic stats - stats = await tgen_utils_get_traffic_stats(tgen_dev, 'Flow Statistics') - for row in stats.Rows: - loss = tgen_utils_get_loss(row) - assert loss == 0, f'Expected loss: 0%, actual: {loss}%' + stats = await tgen_utils_get_traffic_stats(tgen_dev, 'Traffic Item Statistics') + collected = {row['Traffic Item']: + {'tx_rate': row['Tx Rate (Bps)'], 'rx_rate': row['Rx Rate (Bps)']} for row in stats.Rows} + for x in range(2): + assert math.isclose(float(collected[f'stream_{x+1}']['tx_rate']), + float(collected[f'stream_{x+1}']['rx_rate']), rel_tol=deviation), \ + f"The rate is limited by storm control, actual rate {float(collected[f'stream_{x+1}']['tx_rate'])} \ + istead of {float(collected[f'stream_{x+1}']['rx_rate'])}." + assert math.isclose(kbyte_value_unk_uc*1000, float(collected['stream_3']['rx_rate']), rel_tol=deviation), \ + f"The rate is not limited by storm control, \ + actual rate {kbyte_value_unk_uc*1000} istead of {float(collected['stream_3']['rx_rate'])}." finally: - await cleanup_kbyte_per_sec_rate_value(dent_dev, all_values=True) + await tgen_utils_stop_traffic(tgen_dev) + await cleanup_kbyte_per_sec_rate_value(dent_dev, tgen_dev, bc=True, unk_uc=True) diff --git a/DentOS_Framework/DentOsTestbed/src/dent_os_testbed/test/test_suite/functional/storm_control/test_storm_control_unk_un_lag_and_vlan_membership.py b/DentOS_Framework/DentOsTestbed/src/dent_os_testbed/test/test_suite/functional/storm_control/test_storm_control_unk_un_lag_and_vlan_membership.py index ecbd4f442..d1753f2ae 100644 --- a/DentOS_Framework/DentOsTestbed/src/dent_os_testbed/test/test_suite/functional/storm_control/test_storm_control_unk_un_lag_and_vlan_membership.py +++ b/DentOS_Framework/DentOsTestbed/src/dent_os_testbed/test/test_suite/functional/storm_control/test_storm_control_unk_un_lag_and_vlan_membership.py @@ -1,11 +1,12 @@ import pytest -import random import asyncio +from dent_os_testbed.test.test_suite.functional.storm_control.storm_control_utils import verify_expected_rx_rate from dent_os_testbed.test.test_suite.functional.storm_control.storm_control_utils import devlink_rate_value from dent_os_testbed.utils.test_utils.cleanup_utils import cleanup_kbyte_per_sec_rate_value from dent_os_testbed.lib.bridge.bridge_vlan import BridgeVlan from dent_os_testbed.lib.ip.ip_link import IpLink +from random import randrange from dent_os_testbed.utils.test_utils.tgen_utils import ( tgen_utils_get_dent_devices_with_tgen, @@ -14,7 +15,7 @@ tgen_utils_get_traffic_stats, tgen_utils_setup_streams, tgen_utils_start_traffic, - tgen_utils_get_loss + tgen_utils_stop_traffic ) pytestmark = [ @@ -38,10 +39,11 @@ async def test_storm_control_unk_un_lag_and_vlan_membership(testbed): 5. Set bridge br0 admin state UP. 6. Set ports swp2, swp4 master br0. 7. Set bonds bond1, bond2 master br0. - 8. Set up the following streams: + 8. Set storm control rate limit rule for all TG port. + 9. Set up the following streams: - Ixia port 1: unknown unicast streams with random generated size of packet. - 9. Transmit continues traffic by TG. - 10. Verify the RX rate on the RX port is as expected - the rate is limited by storm control. + 10. Transmit continues traffic by TG. + 11. Verify the RX rate on the RX port is as expected - the rate is limited by storm control. """ bridge = 'br0' @@ -53,7 +55,7 @@ async def test_storm_control_unk_un_lag_and_vlan_membership(testbed): tg_ports = tgen_dev.links_dict[device_host_name][0] ports = tgen_dev.links_dict[device_host_name][1] traffic_duration = 15 - pps_value = 1000 + kbyte_value = 94404 for x in range(2): out = await IpLink.add( @@ -117,27 +119,19 @@ async def test_storm_control_unk_un_lag_and_vlan_membership(testbed): for x in range(2)]}]) assert out[0][device_host_name]['rc'] == 0, f"Verify that entities added to vid '1' and '2'.\n{out}" - await devlink_rate_value(dev=f'pci/0000:01:00.0/{ports[0].replace("swp","")}', - name='unk_uc_kbyte_per_sec_rate', value=94404, - cmode='runtime', device_host_name=device_host_name, set=True, verify=True) - await devlink_rate_value(dev=f'pci/0000:01:00.0/{ports[1].replace("swp","")}', - name='bc_kbyte_per_sec_rate', value=1210, - cmode='runtime', device_host_name=device_host_name, set=True, verify=True) - await devlink_rate_value(dev=f'pci/0000:01:00.0/{ports[1].replace("swp","")}', - name='unreg_mc_kbyte_per_sec_rate', value=35099, - cmode='runtime', device_host_name=device_host_name, set=True, verify=True) - await devlink_rate_value(dev=f'pci/0000:01:00.0/{ports[1].replace("swp","")}', - name='unk_uc_kbyte_per_sec_rate', value=37519, - cmode='runtime', device_host_name=device_host_name, set=True, verify=True) - await devlink_rate_value(dev=f'pci/0000:01:00.0/{ports[2].replace("swp","")}', - name='bc_kbyte_per_sec_rate', value=32678, - cmode='runtime', device_host_name=device_host_name, set=True, verify=True) - await devlink_rate_value(dev=f'pci/0000:01:00.0/{ports[2].replace("swp","")}', - name='unk_uc_kbyte_per_sec_rate', value=36309, - cmode='runtime', device_host_name=device_host_name, set=True, verify=True) - await devlink_rate_value(dev=f'pci/0000:01:00.0/{ports[3].replace("swp","")}', - name='unreg_mc_kbyte_per_sec_rate', value=83511, - cmode='runtime', device_host_name=device_host_name, set=True, verify=True) + params = [ + {'port': ports[0], 'name': 'unk_uc_kbyte_per_sec_rate', 'value': kbyte_value}, + {'port': ports[1], 'name': 'bc_kbyte_per_sec_rate', 'value': 1210}, + {'port': ports[1], 'name': 'unreg_mc_kbyte_per_sec_rate', 'value': 35099}, + {'port': ports[1], 'name': 'unk_uc_kbyte_per_sec_rate', 'value': 37519}, + {'port': ports[2], 'name': 'bc_kbyte_per_sec_rate', 'value': 32678}, + {'port': ports[2], 'name': 'unk_uc_kbyte_per_sec_rate', 'value': 36309}, + {'port': ports[3], 'name': 'unreg_mc_kbyte_per_sec_rate', 'value': 83511} + ] + for value in params: + await devlink_rate_value(dev=f'pci/0000:01:00.0/{value["port"].replace("swp","")}', + name=value['name'], value=value['value'], + cmode='runtime', device_host_name=device_host_name, set=True, verify=True) try: address_map = ( @@ -161,33 +155,29 @@ async def test_storm_control_unk_un_lag_and_vlan_membership(testbed): swp1 -> swp2 | swp1 -> swp3 | swp1 -> swp4 """ - for x in range(3): - streams = { - f'stream_{x+1}_unk_un_swp1->swp{x+2}': { - 'ip_source': dev_groups[tg_ports[0]][0]['name'], - 'ip_destination': dev_groups[tg_ports[x+1]][0]['name'], - 'srcMac': f'f8:d4:6b:50:c9:f{x+7}', - 'dstMac': f'b6:ee:e2:ef:d7:6{x+6}', - 'frameSize': random.randint(128, 1400), - 'rate': pps_value, - 'protocol': '0x0800', - 'type': 'raw' - } - } - - await tgen_utils_setup_streams(tgen_dev, config_file_name=None, streams=streams) - await tgen_utils_start_traffic(tgen_dev) - await asyncio.sleep(traffic_duration) + streams = { + f'stream_{x+1}_unk_un_swp1->swp{x+2}': { + 'ip_source': dev_groups[tg_ports[0]][0]['name'], + 'ip_destination': dev_groups[tg_ports[x+1]][0]['name'], + 'srcMac': f'f8:d4:6b:50:c9:f{x+7}', + 'dstMac': f'b6:ee:e2:ef:d7:6{x+6}', + 'frameSize': randrange(100, 1500), + 'frame_rate_type': 'line_rate', + 'rate': 30, + 'protocol': '0x0800', + 'type': 'raw' + } for x in range(3) + } + + await tgen_utils_setup_streams(tgen_dev, config_file_name=None, streams=streams) + await tgen_utils_start_traffic(tgen_dev) + await asyncio.sleep(traffic_duration) # check the traffic stats - stats = await tgen_utils_get_traffic_stats(tgen_dev, 'Flow Statistics') - expected_loss = { - 'stream_1_unk_un_swp1->swp2': 0, - 'stream_2_unk_un_swp1->swp3': 100, - 'stream_3_unk_un_swp1->swp4': 100 - } - for row in stats.Rows: - assert tgen_utils_get_loss(row) == expected_loss[row['Traffic Item']], \ - 'Verify that traffic forwarded/not forwarded in accordance.' + stats = await tgen_utils_get_traffic_stats(tgen_dev, 'Port Statistics') + await verify_expected_rx_rate(kbyte_value, stats, + rx_ports=[streams['stream_1_unk_un_swp1->swp2']['ip_destination']], + deviation=0.10) finally: - await cleanup_kbyte_per_sec_rate_value(dent_dev, all_values=True) + await tgen_utils_stop_traffic(tgen_dev) + await cleanup_kbyte_per_sec_rate_value(dent_dev, tgen_dev, all_values=True) diff --git a/DentOS_Framework/DentOsTestbed/src/dent_os_testbed/test/test_suite/functional/storm_control/test_storm_control_unknown_unicast_traffic.py b/DentOS_Framework/DentOsTestbed/src/dent_os_testbed/test/test_suite/functional/storm_control/test_storm_control_unknown_unicast_traffic.py index 322733a22..87f61c335 100644 --- a/DentOS_Framework/DentOsTestbed/src/dent_os_testbed/test/test_suite/functional/storm_control/test_storm_control_unknown_unicast_traffic.py +++ b/DentOS_Framework/DentOsTestbed/src/dent_os_testbed/test/test_suite/functional/storm_control/test_storm_control_unknown_unicast_traffic.py @@ -1,6 +1,7 @@ import pytest import asyncio +from dent_os_testbed.test.test_suite.functional.storm_control.storm_control_utils import verify_expected_rx_rate from dent_os_testbed.test.test_suite.functional.storm_control.storm_control_utils import devlink_rate_value from dent_os_testbed.utils.test_utils.cleanup_utils import cleanup_kbyte_per_sec_rate_value from dent_os_testbed.lib.ip.ip_link import IpLink @@ -13,7 +14,7 @@ tgen_utils_get_traffic_stats, tgen_utils_setup_streams, tgen_utils_start_traffic, - tgen_utils_get_loss + tgen_utils_stop_traffic ) pytestmark = [ @@ -35,11 +36,12 @@ async def test_storm_control_unknown_unicast_traffic(testbed): 3. Set entities swp1, swp2 UP state. 4. Set bridge br0 admin state UP. 5. Verify that storm control is disabled by default for unknown unicast traffic - by setting the storm control rate limit to unknown unicast traffic on the TX port. - 6. Set up the following stream: + by setting the storm control rate limit. + 6. Set storm control rate limit rule for unicast traffic on TX port (on the first TG port). + 7. Set up the following stream: - unknown unicast traffic stream with random generated packet size on TX port. - 7. Transmit continues traffic by TG. - 8. Verify the RX rate on the RX port is as expected - the rate is limited by storm control. + 8. Transmit continues traffic by TG. + 9. Verify the RX rate on the RX port is as expected - the rate is limited by storm control. """ bridge = 'br0' @@ -50,8 +52,8 @@ async def test_storm_control_unknown_unicast_traffic(testbed): device_host_name = dent_dev.host_name tg_ports = tgen_dev.links_dict[device_host_name][0] ports = tgen_dev.links_dict[device_host_name][1] - traffic_duration = 10 - pps_value = 1000 + traffic_duration = 15 + kbyte_value = 23093 out = await IpLink.add( input_data=[{device_host_name: [ @@ -74,7 +76,7 @@ async def test_storm_control_unknown_unicast_traffic(testbed): name='unk_uc_kbyte_per_sec_rate', value=0, device_host_name=device_host_name, verify=True) await devlink_rate_value(dev=f'pci/0000:01:00.0/{ports[0].replace("swp","")}', - name='unk_uc_kbyte_per_sec_rate', value=23093, + name='unk_uc_kbyte_per_sec_rate', value=kbyte_value, cmode='runtime', device_host_name=device_host_name, set=True, verify=True) try: @@ -104,7 +106,8 @@ async def test_storm_control_unknown_unicast_traffic(testbed): 'srcMac': 'b2:f1:46:1d:97:ba', 'dstMac': '3e:f4:7a:e8:10:34', 'frameSize': randrange(100, 1500), - 'rate': pps_value, + 'frame_rate_type': 'line_rate', + 'rate': 100, 'protocol': '0x0800', 'type': 'raw' } @@ -115,9 +118,9 @@ async def test_storm_control_unknown_unicast_traffic(testbed): await asyncio.sleep(traffic_duration) # check the traffic stats - stats = await tgen_utils_get_traffic_stats(tgen_dev, 'Flow Statistics') - for row in stats.Rows: - loss = tgen_utils_get_loss(row) - assert loss == 0, f'Expected loss: 0%, actual: {loss}%' + stats = await tgen_utils_get_traffic_stats(tgen_dev, 'Port Statistics') + await verify_expected_rx_rate(kbyte_value, stats, rx_ports=[streams['stream_A']['ip_destination']], + deviation=0.10) finally: - await cleanup_kbyte_per_sec_rate_value(dent_dev, unk_uc=True) + await tgen_utils_stop_traffic(tgen_dev) + await cleanup_kbyte_per_sec_rate_value(dent_dev, tgen_dev, unk_uc=True) diff --git a/DentOS_Framework/DentOsTestbed/src/dent_os_testbed/test/test_suite/functional/storm_control/test_storm_control_unregistered_multicast_traffic.py b/DentOS_Framework/DentOsTestbed/src/dent_os_testbed/test/test_suite/functional/storm_control/test_storm_control_unregistered_multicast_traffic.py index 847dc47c6..7efed29a9 100644 --- a/DentOS_Framework/DentOsTestbed/src/dent_os_testbed/test/test_suite/functional/storm_control/test_storm_control_unregistered_multicast_traffic.py +++ b/DentOS_Framework/DentOsTestbed/src/dent_os_testbed/test/test_suite/functional/storm_control/test_storm_control_unregistered_multicast_traffic.py @@ -1,6 +1,7 @@ import pytest import asyncio +from dent_os_testbed.test.test_suite.functional.storm_control.storm_control_utils import verify_expected_rx_rate from dent_os_testbed.test.test_suite.functional.storm_control.storm_control_utils import devlink_rate_value from dent_os_testbed.utils.test_utils.cleanup_utils import cleanup_kbyte_per_sec_rate_value from dent_os_testbed.lib.ip.ip_link import IpLink @@ -13,7 +14,7 @@ tgen_utils_get_traffic_stats, tgen_utils_setup_streams, tgen_utils_start_traffic, - tgen_utils_get_loss + tgen_utils_stop_traffic ) pytestmark = [ @@ -35,11 +36,12 @@ async def test_storm_control_unregistered_multicast_traffic(testbed): 3. Set entities swp1, swp2 UP state. 4. Set bridge br0 admin state UP. 5. Verify that storm control is disabled by default for unregistered multicast traffic - by setting the storm control rate limit to unregistered multicast traffic on the TX port. - 6. Set up the following stream: + by setting the storm control rate limit. + 6. Set storm control rate limit rule for unicast traffic on TX port (on the first TG port). + 7. Set up the following stream: - unregistered multicast traffic stream with random generated packet size on TX port. - 6. Transmit continues traffic by TG. - 7. Verify the RX rate on the RX port is as expected - the rate is limited by storm control. + 8. Transmit continues traffic by TG. + 9. Verify the RX rate on the RX port is as expected - the rate is limited by storm control. """ bridge = 'br0' @@ -50,8 +52,8 @@ async def test_storm_control_unregistered_multicast_traffic(testbed): device_host_name = dent_dev.host_name tg_ports = tgen_dev.links_dict[device_host_name][0] ports = tgen_dev.links_dict[device_host_name][1] - traffic_duration = 10 - pps_value = 1000 + traffic_duration = 15 + kbyte_value = 118689 out = await IpLink.add( input_data=[{device_host_name: [ @@ -74,7 +76,7 @@ async def test_storm_control_unregistered_multicast_traffic(testbed): name='unreg_mc_kbyte_per_sec_rate', value=0, device_host_name=device_host_name, verify=True) await devlink_rate_value(dev=f'pci/0000:01:00.0/{ports[0].replace("swp","")}', - name='unreg_mc_kbyte_per_sec_rate', value=118689, + name='unreg_mc_kbyte_per_sec_rate', value=kbyte_value, cmode='runtime', device_host_name=device_host_name, set=True, verify=True) try: @@ -104,7 +106,8 @@ async def test_storm_control_unregistered_multicast_traffic(testbed): 'srcMac': 'e6:15:12:fc:c8:83', 'dstMac': '01:00:5E:46:98:bc', 'frameSize': randrange(100, 1500), - 'rate': pps_value, + 'frame_rate_type': 'line_rate', + 'rate': 100, 'protocol': '0x0800', 'type': 'raw' } @@ -115,9 +118,9 @@ async def test_storm_control_unregistered_multicast_traffic(testbed): await asyncio.sleep(traffic_duration) # check the traffic stats - stats = await tgen_utils_get_traffic_stats(tgen_dev, 'Flow Statistics') - for row in stats.Rows: - loss = tgen_utils_get_loss(row) - assert loss == 0, f'Expected loss: 0%, actual: {loss}%' + stats = await tgen_utils_get_traffic_stats(tgen_dev, 'Port Statistics') + await verify_expected_rx_rate(kbyte_value, stats, rx_ports=[streams['stream_A']['ip_destination']], + deviation=0.10) finally: - await cleanup_kbyte_per_sec_rate_value(dent_dev, unreg_mc=True) + await tgen_utils_stop_traffic(tgen_dev) + await cleanup_kbyte_per_sec_rate_value(dent_dev, tgen_dev, unreg_mc=True) diff --git a/DentOS_Framework/DentOsTestbed/src/dent_os_testbed/test/test_suite/functional/storm_control/test_storm_negative_known_unicast_traffic.py b/DentOS_Framework/DentOsTestbed/src/dent_os_testbed/test/test_suite/functional/storm_control/test_storm_negative_known_unicast_traffic.py index a9d6160c4..75cb27628 100644 --- a/DentOS_Framework/DentOsTestbed/src/dent_os_testbed/test/test_suite/functional/storm_control/test_storm_negative_known_unicast_traffic.py +++ b/DentOS_Framework/DentOsTestbed/src/dent_os_testbed/test/test_suite/functional/storm_control/test_storm_negative_known_unicast_traffic.py @@ -1,20 +1,22 @@ +import math import pytest import asyncio +from dent_os_testbed.test.test_suite.functional.storm_control.storm_control_utils import verify_expected_rx_rate from dent_os_testbed.test.test_suite.functional.storm_control.storm_control_utils import devlink_rate_value from dent_os_testbed.utils.test_utils.cleanup_utils import cleanup_kbyte_per_sec_rate_value from dent_os_testbed.lib.bridge.bridge_fdb import BridgeFdb from dent_os_testbed.lib.ip.ip_link import IpLink +from random import randrange from dent_os_testbed.utils.test_utils.tgen_utils import ( tgen_utils_get_dent_devices_with_tgen, tgen_utils_traffic_generator_connect, tgen_utils_dev_groups_from_config, - tgen_utils_clear_traffic_stats, tgen_utils_get_traffic_stats, tgen_utils_setup_streams, tgen_utils_start_traffic, - tgen_utils_get_loss + tgen_utils_stop_traffic ) pytestmark = [ @@ -36,13 +38,15 @@ async def test_storm_negative_known_unicast_traffic(testbed): 3. Set entities swp1, swp2 UP state. 4. Set bridge br0 admin state UP. 5. Add static mac entry (on the first TG port) to the bridge. - 6. Set up the following stream: + 6. Verify that storm control is disabled by default for unicast traffic + by setting the storm control rate limit. + 7. Set storm control rate limit rule for unicast traffic on TX port (on the second TG port). + 8. Set up the following stream: - unicast stream from the second TG port to the first TG port. - 7. Set storm control rate limit rule for unicast traffic on TX port (first TG port) - 8. Transmit traffic by TG. - 9. Verify the RX rate on the RX port is as expected - the rate is not limited by storm control. - 10. Flush FDB. - 11. Verify the RX rate on the RX port is as expected - the rate is limited by storm control. + 9. Transmit traffic by TG. + 10. Verify the RX rate on the RX port is as expected - the rate is not limited by storm control. + 11. Flush FDB. + 12. Verify the RX rate on the RX port is as expected - the rate is limited by storm control. """ bridge = 'br0' @@ -54,7 +58,8 @@ async def test_storm_negative_known_unicast_traffic(testbed): tg_ports = tgen_dev.links_dict[device_host_name][0] ports = tgen_dev.links_dict[device_host_name][1] traffic_duration = 15 - pps_value = 1000 + kbyte_value = 50420 + deviation = 0.10 out = await IpLink.add( input_data=[{device_host_name: [ @@ -78,11 +83,11 @@ async def test_storm_negative_known_unicast_traffic(testbed): {'device': ports[0], 'lladdr': '68:16:3d:2e:b4:c8', 'master': True, 'static': True}]}]) assert out[0][device_host_name]['rc'] == 0, f'Verify that FDB static entry added.\n{out}' - await devlink_rate_value(dev=f'pci/0000:01:00.0/{ports[0].replace("swp","")}', + await devlink_rate_value(dev=f'pci/0000:01:00.0/{ports[1].replace("swp","")}', name='unk_uc_kbyte_per_sec_rate', value=0, device_host_name=device_host_name, verify=True) - await devlink_rate_value(dev=f'pci/0000:01:00.0/{ports[0].replace("swp","")}', - name='unk_uc_kbyte_per_sec_rate', value=93420, + await devlink_rate_value(dev=f'pci/0000:01:00.0/{ports[1].replace("swp","")}', + name='unk_uc_kbyte_per_sec_rate', value=kbyte_value, cmode='runtime', device_host_name=device_host_name, set=True, verify=True) try: @@ -113,8 +118,9 @@ async def test_storm_negative_known_unicast_traffic(testbed): 'dstIp': '155.99.214.26', 'srcMac': '6c:d5:aa:6f:2c:b7', 'dstMac': '68:16:3d:2e:b4:c8', - 'frameSize': 458, - 'rate': pps_value, + 'frameSize': randrange(100, 1500), + 'frame_rate_type': 'line_rate', + 'rate': 100, 'protocol': '0x0800', 'type': 'raw' } @@ -122,20 +128,32 @@ async def test_storm_negative_known_unicast_traffic(testbed): await tgen_utils_setup_streams(tgen_dev, config_file_name=None, streams=streams) await tgen_utils_start_traffic(tgen_dev) - - for x in range(2): - await asyncio.sleep(traffic_duration) - - # check the traffic stats - stats = await tgen_utils_get_traffic_stats(tgen_dev, 'Flow Statistics') - for row in stats.Rows: - loss = tgen_utils_get_loss(row) - assert loss == 0, f'Expected loss: 0%, actual: {loss}%' - if x == 0: - out = await BridgeFdb.delete( - input_data=[{device_host_name: [ - {'device': ports[0], 'lladdr': '68:16:3d:2e:b4:c8', 'master': True, 'static': True}]}]) - assert out[0][device_host_name]['rc'] == 0, f'Verify that FDB static entry deleted.\n{out}' - await tgen_utils_clear_traffic_stats(tgen_dev) + await asyncio.sleep(traffic_duration) + + # check the traffic stats + stats = await tgen_utils_get_traffic_stats(tgen_dev, 'Port Statistics') + collected = {row['Port Name']: + {'tx_rate': row['Bytes Tx. Rate'], 'rx_rate': row['Bytes Rx. Rate']} for row in stats.Rows} + for key in collected: + if 'rx_rate' in collected[key] and key.endswith(':1'): + rx_rate = collected[key]['rx_rate'] + if 'tx_rate' in collected[key] and key.endswith(':2'): + tx_rate = collected[key]['tx_rate'] + res = math.isclose(float(tx_rate), float(rx_rate), rel_tol=deviation) + assert res, f'The rate is limited by storm control, \ + actual rate {float(rx_rate)} istead of {float(tx_rate)}.' + + out = await BridgeFdb.delete( + input_data=[{device_host_name: [ + {'device': ports[0], 'lladdr': '68:16:3d:2e:b4:c8', 'master': True, 'static': True}]}]) + assert out[0][device_host_name]['rc'] == 0, f'Verify that FDB static entry deleted.\n{out}' + + await asyncio.sleep(traffic_duration) + + # check the traffic stats + stats = await tgen_utils_get_traffic_stats(tgen_dev, 'Port Statistics') + await verify_expected_rx_rate(kbyte_value, stats, rx_ports=[streams['stream_A']['ip_destination']], + deviation=deviation) finally: - await cleanup_kbyte_per_sec_rate_value(dent_dev, unk_uc=True) + await tgen_utils_stop_traffic(tgen_dev) + await cleanup_kbyte_per_sec_rate_value(dent_dev, tgen_dev, unk_uc=True) From 31370ba20b02ce2cefe373acc8c5e7156a22af22 Mon Sep 17 00:00:00 2001 From: Kostiantyn Stavruk Date: Fri, 5 May 2023 10:13:04 +0300 Subject: [PATCH 2/2] Resolve conflict Signed-off-by: Kostiantyn Stavruk <119867993+stavrukPLV@users.noreply.github.com> Signed-off-by: Kostiantyn Stavruk --- .../test_suite/functional/storm_control/storm_control_utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/DentOS_Framework/DentOsTestbed/src/dent_os_testbed/test/test_suite/functional/storm_control/storm_control_utils.py b/DentOS_Framework/DentOsTestbed/src/dent_os_testbed/test/test_suite/functional/storm_control/storm_control_utils.py index 45698c914..18dd77553 100644 --- a/DentOS_Framework/DentOsTestbed/src/dent_os_testbed/test/test_suite/functional/storm_control/storm_control_utils.py +++ b/DentOS_Framework/DentOsTestbed/src/dent_os_testbed/test/test_suite/functional/storm_control/storm_control_utils.py @@ -1,4 +1,5 @@ import math + from dent_os_testbed.lib.devlink.devlink_port import DevlinkPort from dent_os_testbed.lib.tc.tc_filter import TcFilter @@ -65,4 +66,4 @@ async def tc_filter_add(dev, vlan_id, src_mac, dst_mac, rate, burst, device_host } ] ) - assert out[0][device_host_name]['rc'] == 0, f'Failed to create tc rules.\n{out} \ No newline at end of file + assert out[0][device_host_name]['rc'] == 0, f'Failed to create tc rules.\n{out}'