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

[Chassis][master][orchagent] : Added test case to verify WRED profile on system ports #2954

Merged
merged 5 commits into from
Nov 28, 2023

Conversation

vmittal-msft
Copy link
Contributor

What I did
Added test case for wred profile on system ports

Why I did it
Added test case for  #2855

How I verified it
Verified on VS testbed.

Details if related

@vmittal-msft vmittal-msft requested a review from gechiang November 3, 2023 23:03
@vmittal-msft vmittal-msft force-pushed the test_wred_profile branch 2 times, most recently from 2b3bc2d to d57a5b7 Compare November 7, 2023 07:26
@vmittal-msft vmittal-msft requested a review from prsunny as a code owner November 7, 2023 07:26
@gechiang
Copy link
Contributor

gechiang commented Nov 7, 2023

@vmittal-msft , please fix this:

2023-11-07T12:35:15.6428743Z =================================== FAILURES ===================================
2023-11-07T12:35:15.6430161Z _________ TestVirtualChassis.test_chassis_wred_profile_on_system_ports _________
2023-11-07T12:35:15.6430897Z 
2023-11-07T12:35:15.6431439Z self = <test_virtual_chassis.TestVirtualChassis object at 0x7f5e22fd4220>
2023-11-07T12:35:15.6432518Z vct = <conftest.DockerVirtualChassisTopology object at 0x7f5e236836d0>
2023-11-07T12:35:15.6433154Z 
2023-11-07T12:35:15.6433568Z     def test_chassis_wred_profile_on_system_ports(self, vct):
2023-11-07T12:35:15.6434506Z         """Test whether wred profile is applied on system ports in VoQ chassis.
2023-11-07T12:35:15.6435298Z         """
2023-11-07T12:35:15.6435576Z         dvss = vct.dvss
2023-11-07T12:35:15.6436243Z         for name in dvss.keys():
2023-11-07T12:35:15.6436687Z             dvs = dvss[name]
2023-11-07T12:35:15.6437061Z     
2023-11-07T12:35:15.6437328Z             config_db = dvs.get_config_db()
2023-11-07T12:35:15.6437876Z             app_db = dvs.get_app_db()
2023-11-07T12:35:15.6438386Z             asic_db = dvs.get_asic_db()
2023-11-07T12:35:15.6439020Z             metatbl = config_db.get_entry("DEVICE_METADATA", "localhost")
2023-11-07T12:35:15.6439858Z             cfg_switch_type = metatbl.get("switch_type")
2023-11-07T12:35:15.6440260Z     
2023-11-07T12:35:15.6440396Z             if cfg_switch_type == "voq":
2023-11-07T12:35:15.6441078Z                 # Get all the keys from SYTEM_PORT table and check whether wred_profile is applied properly
2023-11-07T12:35:15.6442243Z                 system_ports = config_db.get_keys('SYSTEM_PORT')
2023-11-07T12:35:15.6442762Z     
2023-11-07T12:35:15.6443005Z                 for key in system_ports:
2023-11-07T12:35:15.6443519Z                     queue3 = key + '|' + '3'
2023-11-07T12:35:15.6444014Z                     queue_entry = config_db.get_entry('QUEUE', queue3)
2023-11-07T12:35:15.6444673Z                     wred_profile = queue_entry['wred_profile']
2023-11-07T12:35:15.6445151Z                     if wred_profile != 'AZURE_LOSSLESS':
2023-11-07T12:35:15.6445550Z                         print("WRED profile not applied on queue3 on system port %s", key)
2023-11-07T12:35:15.6446045Z                         assert wred_profile == 'AZURE_LOSSLESS'
2023-11-07T12:35:15.6446309Z     
2023-11-07T12:35:15.6446510Z                     queue4 = key + '|' + '4'
2023-11-07T12:35:15.6446896Z                     queue_entry = config_db.get_entry('QUEUE', queue4)
2023-11-07T12:35:15.6447311Z                     wred_profile = queue_entry['wred_profile']
2023-11-07T12:35:15.6447692Z                     if wred_profile != 'AZURE_LOSSLESS':
2023-11-07T12:35:15.6448093Z                         print("WRED profile not applied on queue4 on system port %s", key)
2023-11-07T12:35:15.6448577Z                         assert wred_profile == 'AZURE_LOSSLESS'
2023-11-07T12:35:15.6449009Z                 # Check that we see the logs for applying WRED_PROFILE on all system ports
2023-11-07T12:35:15.6449469Z                 matching_log = "SAI_QUEUE_ATTR_WRED_PROFILE_ID"
2023-11-07T12:35:15.6449791Z                 _, logSeen = dvs.runcmd([ "sh", "-c",
2023-11-07T12:35:15.6450401Z                      "awk STARTFILE/ENDFILE /var/log/swss/sairedis.rec | grep SAI_QUEUE_ATTR_WRED_PROFILE_ID | wc -l"])
2023-11-07T12:35:15.6450923Z     
2023-11-07T12:35:15.6451077Z >               assert logSeen.strip() == len(system_port)
2023-11-07T12:35:15.6451478Z E               NameError: name 'system_port' is not defined
2023-11-07T12:35:15.6451693Z 
2023-11-07T12:35:15.6451852Z test_virtual_chassis.py:979: NameError
2023-11-07T12:35:15.6452406Z ---- generated xml file: /agent/_work/1/s/tests/test_virtual_chassis_tr.xml ----
2023-11-07T12:35:15.6453283Z ===Flaky Test Report===
2023-11-07T12:35:15.6453480Z 
2023-11-07T12:35:15.6453831Z test_connectivity passed 1 out of the required 1 times. Success!
2023-11-07T12:35:15.6454476Z test_voq_switch passed 1 out of the required 1 times. Success!
2023-11-07T12:35:15.6455130Z test_chassis_add_remove_ports passed 1 out of the required 1 times. Success!
2023-11-07T12:35:15.6455837Z test_voq_egress_queue_counter passed 1 out of the required 1 times. Success!
2023-11-07T12:35:15.6456610Z test_chassis_wred_profile_on_system_ports failed (1 runs remaining out of 2).
2023-11-07T12:35:15.6457574Z 	<class 'NameError'>
2023-11-07T12:35:15.6458013Z 	name 'system_port' is not defined
2023-11-07T12:35:15.6458699Z 	[<TracebackEntry /agent/_work/1/s/tests/test_virtual_chassis.py:979>]
2023-11-07T12:35:15.6459818Z test_chassis_wred_profile_on_system_ports failed; it passed 0 out of the required 1 times.
2023-11-07T12:35:15.6460877Z 	<class 'NameError'>
2023-11-07T12:35:15.6461297Z 	name 'system_port' is not defined
2023-11-07T12:35:15.6461921Z 	[<TracebackEntry /agent/_work/1/s/tests/test_virtual_chassis.py:979>]

@vmittal-msft vmittal-msft force-pushed the test_wred_profile branch 2 times, most recently from 22e3457 to 4d74792 Compare November 22, 2023 20:58
@vmittal-msft
Copy link
Contributor Author

@arista-nwolfe Please review.

@arista-nwolfe
Copy link
Contributor

Changes to test_chassis_add_remove_ports look good to me, thanks for fixing this.

@vmittal-msft
Copy link
Contributor Author

@vmittal-msft , please fix this:

2023-11-07T12:35:15.6428743Z =================================== FAILURES ===================================
2023-11-07T12:35:15.6430161Z _________ TestVirtualChassis.test_chassis_wred_profile_on_system_ports _________
2023-11-07T12:35:15.6430897Z 
2023-11-07T12:35:15.6431439Z self = <test_virtual_chassis.TestVirtualChassis object at 0x7f5e22fd4220>
2023-11-07T12:35:15.6432518Z vct = <conftest.DockerVirtualChassisTopology object at 0x7f5e236836d0>
2023-11-07T12:35:15.6433154Z 
2023-11-07T12:35:15.6433568Z     def test_chassis_wred_profile_on_system_ports(self, vct):
2023-11-07T12:35:15.6434506Z         """Test whether wred profile is applied on system ports in VoQ chassis.
2023-11-07T12:35:15.6435298Z         """
2023-11-07T12:35:15.6435576Z         dvss = vct.dvss
2023-11-07T12:35:15.6436243Z         for name in dvss.keys():
2023-11-07T12:35:15.6436687Z             dvs = dvss[name]
2023-11-07T12:35:15.6437061Z     
2023-11-07T12:35:15.6437328Z             config_db = dvs.get_config_db()
2023-11-07T12:35:15.6437876Z             app_db = dvs.get_app_db()
2023-11-07T12:35:15.6438386Z             asic_db = dvs.get_asic_db()
2023-11-07T12:35:15.6439020Z             metatbl = config_db.get_entry("DEVICE_METADATA", "localhost")
2023-11-07T12:35:15.6439858Z             cfg_switch_type = metatbl.get("switch_type")
2023-11-07T12:35:15.6440260Z     
2023-11-07T12:35:15.6440396Z             if cfg_switch_type == "voq":
2023-11-07T12:35:15.6441078Z                 # Get all the keys from SYTEM_PORT table and check whether wred_profile is applied properly
2023-11-07T12:35:15.6442243Z                 system_ports = config_db.get_keys('SYSTEM_PORT')
2023-11-07T12:35:15.6442762Z     
2023-11-07T12:35:15.6443005Z                 for key in system_ports:
2023-11-07T12:35:15.6443519Z                     queue3 = key + '|' + '3'
2023-11-07T12:35:15.6444014Z                     queue_entry = config_db.get_entry('QUEUE', queue3)
2023-11-07T12:35:15.6444673Z                     wred_profile = queue_entry['wred_profile']
2023-11-07T12:35:15.6445151Z                     if wred_profile != 'AZURE_LOSSLESS':
2023-11-07T12:35:15.6445550Z                         print("WRED profile not applied on queue3 on system port %s", key)
2023-11-07T12:35:15.6446045Z                         assert wred_profile == 'AZURE_LOSSLESS'
2023-11-07T12:35:15.6446309Z     
2023-11-07T12:35:15.6446510Z                     queue4 = key + '|' + '4'
2023-11-07T12:35:15.6446896Z                     queue_entry = config_db.get_entry('QUEUE', queue4)
2023-11-07T12:35:15.6447311Z                     wred_profile = queue_entry['wred_profile']
2023-11-07T12:35:15.6447692Z                     if wred_profile != 'AZURE_LOSSLESS':
2023-11-07T12:35:15.6448093Z                         print("WRED profile not applied on queue4 on system port %s", key)
2023-11-07T12:35:15.6448577Z                         assert wred_profile == 'AZURE_LOSSLESS'
2023-11-07T12:35:15.6449009Z                 # Check that we see the logs for applying WRED_PROFILE on all system ports
2023-11-07T12:35:15.6449469Z                 matching_log = "SAI_QUEUE_ATTR_WRED_PROFILE_ID"
2023-11-07T12:35:15.6449791Z                 _, logSeen = dvs.runcmd([ "sh", "-c",
2023-11-07T12:35:15.6450401Z                      "awk STARTFILE/ENDFILE /var/log/swss/sairedis.rec | grep SAI_QUEUE_ATTR_WRED_PROFILE_ID | wc -l"])
2023-11-07T12:35:15.6450923Z     
2023-11-07T12:35:15.6451077Z >               assert logSeen.strip() == len(system_port)
2023-11-07T12:35:15.6451478Z E               NameError: name 'system_port' is not defined
2023-11-07T12:35:15.6451693Z 
2023-11-07T12:35:15.6451852Z test_virtual_chassis.py:979: NameError
2023-11-07T12:35:15.6452406Z ---- generated xml file: /agent/_work/1/s/tests/test_virtual_chassis_tr.xml ----
2023-11-07T12:35:15.6453283Z ===Flaky Test Report===
2023-11-07T12:35:15.6453480Z 
2023-11-07T12:35:15.6453831Z test_connectivity passed 1 out of the required 1 times. Success!
2023-11-07T12:35:15.6454476Z test_voq_switch passed 1 out of the required 1 times. Success!
2023-11-07T12:35:15.6455130Z test_chassis_add_remove_ports passed 1 out of the required 1 times. Success!
2023-11-07T12:35:15.6455837Z test_voq_egress_queue_counter passed 1 out of the required 1 times. Success!
2023-11-07T12:35:15.6456610Z test_chassis_wred_profile_on_system_ports failed (1 runs remaining out of 2).
2023-11-07T12:35:15.6457574Z 	<class 'NameError'>
2023-11-07T12:35:15.6458013Z 	name 'system_port' is not defined
2023-11-07T12:35:15.6458699Z 	[<TracebackEntry /agent/_work/1/s/tests/test_virtual_chassis.py:979>]
2023-11-07T12:35:15.6459818Z test_chassis_wred_profile_on_system_ports failed; it passed 0 out of the required 1 times.
2023-11-07T12:35:15.6460877Z 	<class 'NameError'>
2023-11-07T12:35:15.6461297Z 	name 'system_port' is not defined
2023-11-07T12:35:15.6461921Z 	[<TracebackEntry /agent/_work/1/s/tests/test_virtual_chassis.py:979>]

Fixed

Copy link
Contributor

@arlakshm arlakshm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@gechiang
Copy link
Contributor

gechiang commented Nov 27, 2023

@prsunny , please help review/approve this missing unit testcases for the PR #2855.

Vineet will use a new PR for backport purpose.
Thanks!

@vmittal-msft vmittal-msft changed the title [Chassis] : Added test case to verify WRED profile on system ports [Chassis][master] : Added test case to verify WRED profile on system ports Nov 28, 2023
@vmittal-msft vmittal-msft changed the title [Chassis][master] : Added test case to verify WRED profile on system ports [Chassis][master][orchagent] : Added test case to verify WRED profile on system ports Nov 28, 2023
@vmittal-msft vmittal-msft self-assigned this Nov 28, 2023
@prsunny prsunny merged commit 14408ca into sonic-net:master Nov 28, 2023
@vmittal-msft vmittal-msft deleted the test_wred_profile branch November 28, 2023 18:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

5 participants