@@ -17,14 +17,17 @@ def test_voq_switch_fabric_capacity(self, vst):
1717 dvs = dvss [name ]
1818 # Get the config information and choose a linecard or fabric card to test.
1919 config_db = dvs .get_config_db ()
20+ adb = dvs .get_app_db ()
2021 metatbl = config_db .get_entry ("DEVICE_METADATA" , "localhost" )
2122
2223 cfg_switch_type = metatbl .get ("switch_type" )
2324 if cfg_switch_type == "fabric" :
2425
2526 max_poll = PollingConfig (polling_interval = 60 , timeout = 600 , strict = True )
27+ config_db .update_entry ("FABRIC_MONITOR" , "FABRIC_MONITOR_DATA" ,{'monState' : 'disable' })
28+ adb .wait_for_field_match ("FABRIC_MONITOR_TABLE" ,"FABRIC_MONITOR_DATA" , {'monState' : 'disable' }, polling_config = max_poll )
29+ # enable monitoring
2630 config_db .update_entry ("FABRIC_MONITOR" , "FABRIC_MONITOR_DATA" ,{'monState' : 'enable' })
27- adb = dvs .get_app_db ()
2831 adb .wait_for_field_match ("FABRIC_MONITOR_TABLE" ,"FABRIC_MONITOR_DATA" , {'monState' : 'enable' }, polling_config = max_poll )
2932
3033 # get state_db infor
@@ -39,8 +42,12 @@ def test_voq_switch_fabric_capacity(self, vst):
3942 sdb .update_entry ("FABRIC_PORT_TABLE" , sdb_port , {"TEST" : "TEST" })
4043
4144 # get current fabric capacity
42- capacity = sdb .get_entry ("FABRIC_CAPACITY_TABLE" , "FABRIC_CAPACITY_DATA" )['operating_links' ]
43- if sdb .get_entry ("FABRIC_PORT_TABLE" , sdb_port )['STATUS' ] == 'up' :
45+ fvs = sdb .wait_for_fields ("FABRIC_CAPACITY_TABLE" , "FABRIC_CAPACITY_DATA" ,['operating_links' ], polling_config = max_poll )
46+ capacity = fvs ['operating_links' ]
47+
48+ fvs = sdb .wait_for_fields ("FABRIC_PORT_TABLE" , sdb_port , ['STATUS' ], polling_config = max_poll )
49+ link_status = fvs ['STATUS' ]
50+ if link_status == 'up' :
4451 try :
4552 # clean up the testing port.
4653 # set TEST_CRC_ERRORS to 0
@@ -57,6 +64,21 @@ def test_voq_switch_fabric_capacity(self, vst):
5764 config_db .update_entry ("FABRIC_PORT" , cdb_port , {"isolateStatus" : "False" })
5865 sdb .wait_for_field_match ("FABRIC_PORT_TABLE" , sdb_port , {"ISOLATED" : "0" }, polling_config = max_poll )
5966 sdb .wait_for_field_match ("FABRIC_CAPACITY_TABLE" , "FABRIC_CAPACITY_DATA" , {'operating_links' : capacity }, polling_config = max_poll )
67+
68+ # now disable fabric link monitor
69+ config_db .update_entry ("FABRIC_MONITOR" , "FABRIC_MONITOR_DATA" ,{'monState' : 'disable' })
70+ adb .wait_for_field_match ("FABRIC_MONITOR_TABLE" ,"FABRIC_MONITOR_DATA" , {'monState' : 'disable' }, polling_config = max_poll )
71+ # isolate the link from config_db
72+ config_db .update_entry ("FABRIC_PORT" , cdb_port , {"isolateStatus" : "True" })
73+ try :
74+ max_poll = PollingConfig (polling_interval = 30 , timeout = 90 , strict = True )
75+ sdb .wait_for_field_match ("FABRIC_PORT_TABLE" , sdb_port , {"ISOLATED" : "1" }, polling_config = max_poll )
76+ # check if capacity reduced
77+ sdb .wait_for_field_negative_match ("FABRIC_CAPACITY_TABLE" , "FABRIC_CAPACITY_DATA" , {'operating_links' : capacity }, polling_config = max_poll )
78+ assert False , "Expecting no change here"
79+ except Exception as e :
80+ # Expect field not change here
81+ pass
6082 finally :
6183 # cleanup
6284 sdb .update_entry ("FABRIC_PORT_TABLE" , sdb_port , {"TEST_CRC_ERRORS" : "0" })
0 commit comments