@@ -805,12 +805,11 @@ def test_AclBindMirrorPerStage(self, dvs, testlog):
805805 self .remove_ip_address ("Ethernet32" , "20.0.0.0/31" )
806806 self .set_interface_status (dvs , "Ethernet32" , "down" )
807807
808- def test_AclBindMirror (self , dvs , testlog ):
808+ def _test_AclBindMirror (self , dvs , testlog , create_seq_test = False ):
809809 """
810810 This test tests ACL associated with mirror session with DSCP value
811811 The DSCP value is tested on both with mask and without mask
812812 """
813- self .setup_db (dvs )
814813
815814 session = "MIRROR_SESSION"
816815 acl_table = "MIRROR_TABLE"
@@ -820,27 +819,44 @@ def test_AclBindMirror(self, dvs, testlog):
820819 self .set_interface_status (dvs , "Ethernet32" , "up" )
821820 self .add_ip_address ("Ethernet32" , "20.0.0.0/31" )
822821 self .add_neighbor ("Ethernet32" , "20.0.0.1" , "02:04:06:08:10:12" )
823- self .add_route (dvs , "4.4.4.4" , "20.0.0.1" )
822+ if create_seq_test == False :
823+ self .add_route (dvs , "4.4.4.4" , "20.0.0.1" )
824824
825825 # create mirror session
826826 self .create_mirror_session (session , "3.3.3.3" , "4.4.4.4" , "0x6558" , "8" , "100" , "0" )
827- assert self .get_mirror_session_state (session )["status" ] == "active"
827+ assert self .get_mirror_session_state (session )["status" ] == ( "active" if create_seq_test == False else "inactive" )
828828
829- # assert mirror session in asic database
829+ # check mirror session in asic database
830830 tbl = swsscommon .Table (self .adb , "ASIC_STATE:SAI_OBJECT_TYPE_MIRROR_SESSION" )
831- assert len (tbl .getKeys ()) == 1
832- mirror_session_oid = tbl .getKeys ()[0 ]
831+ assert len (tbl .getKeys ()) == (1 if create_seq_test == False else 0 )
832+ if create_seq_test == False :
833+ mirror_session_oid = tbl .getKeys ()[0 ]
833834
834835 # create acl table
835836 self .create_acl_table (acl_table , ["Ethernet0" , "Ethernet4" ])
836837
837838 # create acl rule with dscp value 48
838839 self .create_mirror_acl_dscp_rule (acl_table , acl_rule , "48" , session )
839840
840- # assert acl rule is created
841+ # acl rule creation check
841842 tbl = swsscommon .Table (self .adb , "ASIC_STATE:SAI_OBJECT_TYPE_ACL_ENTRY" )
842843 rule_entries = [k for k in tbl .getKeys () if k not in dvs .asicdb .default_acl_entries ]
843- assert len (rule_entries ) == 1
844+ assert len (rule_entries ) == (1 if create_seq_test == False else 0 )
845+
846+ if create_seq_test == True :
847+ self .add_route (dvs , "4.4.4.4" , "20.0.0.1" )
848+
849+ assert self .get_mirror_session_state (session )["status" ] == "active"
850+
851+ # assert mirror session in asic database
852+ tbl = swsscommon .Table (self .adb , "ASIC_STATE:SAI_OBJECT_TYPE_MIRROR_SESSION" )
853+ assert len (tbl .getKeys ()) == 1
854+ mirror_session_oid = tbl .getKeys ()[0 ]
855+
856+ # assert acl rule is created
857+ tbl = swsscommon .Table (self .adb , "ASIC_STATE:SAI_OBJECT_TYPE_ACL_ENTRY" )
858+ rule_entries = [k for k in tbl .getKeys () if k not in dvs .asicdb .default_acl_entries ]
859+ assert len (rule_entries ) == 1
844860
845861 (status , fvs ) = tbl .get (rule_entries [0 ])
846862 assert status == True
@@ -888,6 +904,12 @@ def test_AclBindMirror(self, dvs, testlog):
888904 self .remove_ip_address ("Ethernet32" , "20.0.0.0/31" )
889905 self .set_interface_status (dvs , "Ethernet32" , "down" )
890906
907+ def test_AclBindMirror (self , dvs , testlog ):
908+ self .setup_db (dvs )
909+
910+ self ._test_AclBindMirror (dvs , testlog )
911+ self ._test_AclBindMirror (dvs , testlog , create_seq_test = True )
912+
891913
892914# Add Dummy always-pass test at end as workaroud
893915# for issue when Flaky fail on final test it invokes module tear-down before retrying
0 commit comments