Remove sleeps from AclServiceTestBase 69/90169/6
authorRobert Varga <robert.varga@pantheon.tech>
Sun, 31 May 2020 12:21:40 +0000 (14:21 +0200)
committerKarthikeyan Krishnan <karthikeyangceb007@gmail.com>
Mon, 1 Jun 2020 02:43:32 +0000 (02:43 +0000)
This reverts Thread.sleep()s introduced in commit
e693dc312e2b0fa970908e33400db9828eae1819, as the porting damage done
in 2f0569ed75ef8a1fb60f992d19c8bbdf92ff45bf to ACL Service test
harness has been fixed.

asyncEventsWaiter.awaitEventsConsumption() calls introduced
in cf1ea9172b94fc17e45391b62bf4ca24ac5c5fe0 are also removed.

Change-Id: I39cb98135f79ba666705d52ad5f71c0d52e823df
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
aclservice/impl/src/test/java/org/opendaylight/netvirt/aclservice/tests/AclServiceTestBase.java

index c7a34178e115c16023b6a249b81137e38f474bbb..347c8bf248d7590019f75564cc7e7b2e50684a6d 100644 (file)
@@ -147,7 +147,7 @@ public abstract class AclServiceTestBase {
         putNewStateInterface(dataBroker, "port1", PORT_MAC_1);
 
         asyncEventsWaiter.awaitEventsConsumption();
-        Thread.sleep(1000);
+
         // Then
         newInterfaceCheck();
         LOG.info("newInterface - end");
@@ -161,10 +161,8 @@ public abstract class AclServiceTestBase {
 
         newAllowedAddressPair(PORT_1, Collections.singletonList(SG_UUID_1), Collections.singletonList(AAP_PORT_1),
                 Collections.singletonList(SUBNET_INFO_1));
-        asyncEventsWaiter.awaitEventsConsumption();
         newAllowedAddressPair(PORT_2, Collections.singletonList(SG_UUID_1), Collections.singletonList(AAP_PORT_2),
                 Collections.singletonList(SUBNET_INFO_1));
-        asyncEventsWaiter.awaitEventsConsumption();
 
         Matches matches = newMatch(AclConstants.SOURCE_LOWER_PORT_UNSPECIFIED,
                 AclConstants.SOURCE_UPPER_PORT_UNSPECIFIED, AclConstants.DEST_LOWER_PORT_UNSPECIFIED,
@@ -172,7 +170,6 @@ public abstract class AclServiceTestBase {
                 AclConstants.DEST_REMOTE_IP_PREFIX_SPECIFIED, (short) -1);
         dataBrokerUtil.put(new IdentifiedAceBuilder().sgUuid(SG_UUID_1).newRuleName(SR_UUID_1_1)
                 .newMatches(matches).newDirection(DirectionEgress.class).build());
-        asyncEventsWaiter.awaitEventsConsumption();
         matches = newMatch(AclConstants.SOURCE_LOWER_PORT_UNSPECIFIED, AclConstants.SOURCE_UPPER_PORT_UNSPECIFIED,
                 AclConstants.DEST_LOWER_PORT_UNSPECIFIED, AclConstants.DEST_UPPER_PORT_UNSPECIFIED,
                 AclConstants.SOURCE_REMOTE_IP_PREFIX_SPECIFIED, AclConstants.DEST_REMOTE_IP_PREFIX_UNSPECIFIED,
@@ -180,15 +177,12 @@ public abstract class AclServiceTestBase {
         dataBrokerUtil.put(
                 new IdentifiedAceBuilder().sgUuid(SG_UUID_1).newRuleName(SR_UUID_1_2).newMatches(matches)
                         .newDirection(DirectionIngress.class).newRemoteGroupId(new Uuid(SG_UUID_1)).build());
-        asyncEventsWaiter.awaitEventsConsumption();
         // When
         putNewStateInterface(dataBroker, PORT_1, PORT_MAC_1);
-        asyncEventsWaiter.awaitEventsConsumption();
         putNewStateInterface(dataBroker, PORT_2, PORT_MAC_2);
-        asyncEventsWaiter.awaitEventsConsumption();
 
         asyncEventsWaiter.awaitEventsConsumption();
-        Thread.sleep(1000);
+
         // Then
         newInterfaceWithEtherTypeAclCheck();
         LOG.info("newInterfaceWithEtherTypeAcl - end");
@@ -202,10 +196,8 @@ public abstract class AclServiceTestBase {
 
         newAllowedAddressPair(PORT_1, Collections.singletonList(SG_UUID_1), Collections.singletonList(AAP_PORT_1),
                 Collections.singletonList(SUBNET_INFO_1));
-        asyncEventsWaiter.awaitEventsConsumption();
         newAllowedAddressPair(PORT_2, Collections.singletonList(SG_UUID_1), Collections.singletonList(AAP_PORT_2),
                 Collections.singletonList(SUBNET_INFO_1));
-        asyncEventsWaiter.awaitEventsConsumption();
 
         Matches matches = newMatch(AclConstants.SOURCE_LOWER_PORT_UNSPECIFIED,
                 AclConstants.SOURCE_UPPER_PORT_UNSPECIFIED, AclConstants.DEST_LOWER_PORT_UNSPECIFIED,
@@ -213,7 +205,6 @@ public abstract class AclServiceTestBase {
                 AclConstants.DEST_REMOTE_IP_PREFIX_SPECIFIED, (short) -1);
         dataBrokerUtil.put(new IdentifiedAceBuilder().sgUuid(SG_UUID_1).newRuleName(SR_UUID_1_1)
                 .newMatches(matches).newDirection(DirectionEgress.class).build());
-        asyncEventsWaiter.awaitEventsConsumption();
         matches = newMatch(AclConstants.SOURCE_LOWER_PORT_UNSPECIFIED, AclConstants.SOURCE_UPPER_PORT_UNSPECIFIED,
                 AclConstants.DEST_LOWER_PORT_UNSPECIFIED, AclConstants.DEST_UPPER_PORT_UNSPECIFIED,
                 AclConstants.SOURCE_REMOTE_IP_PREFIX_SPECIFIED, AclConstants.DEST_REMOTE_IP_PREFIX_UNSPECIFIED,
@@ -221,15 +212,12 @@ public abstract class AclServiceTestBase {
         dataBrokerUtil.put(
                 new IdentifiedAceBuilder().sgUuid(SG_UUID_1).newRuleName(SR_UUID_1_2).newMatches(matches)
                         .newDirection(DirectionIngress.class).newRemoteGroupId(new Uuid(SG_UUID_1)).build());
-        asyncEventsWaiter.awaitEventsConsumption();
         // When
         putNewStateInterface(dataBroker, PORT_1, PORT_MAC_1);
-        asyncEventsWaiter.awaitEventsConsumption();
         putNewStateInterface(dataBroker, PORT_2, PORT_MAC_2);
-        asyncEventsWaiter.awaitEventsConsumption();
 
         asyncEventsWaiter.awaitEventsConsumption();
-        Thread.sleep(1000);
+
         // Then
         newInterfaceWithEtherTypeAclCheck();
 
@@ -242,7 +230,6 @@ public abstract class AclServiceTestBase {
                 AclConstants.DEST_REMOTE_IP_PREFIX_SPECIFIED, (short) NwConstants.IP_PROT_TCP);
         dataBrokerUtil.put(new IdentifiedAceBuilder().sgUuid(SG_UUID_2).newRuleName(SR_UUID_2_1)
                 .newMatches(matches).newDirection(DirectionEgress.class).newRemoteGroupId(new Uuid(SG_UUID_2)).build());
-        asyncEventsWaiter.awaitEventsConsumption();
         matches = newMatch(AclConstants.SOURCE_LOWER_PORT_UNSPECIFIED, AclConstants.SOURCE_UPPER_PORT_UNSPECIFIED,
                 AclConstants.DEST_LOWER_PORT_HTTP, AclConstants.DEST_UPPER_PORT_HTTP,
                 AclConstants.SOURCE_REMOTE_IP_PREFIX_SPECIFIED, AclConstants.DEST_REMOTE_IP_PREFIX_UNSPECIFIED,
@@ -250,19 +237,15 @@ public abstract class AclServiceTestBase {
 
         dataBrokerUtil.put(new IdentifiedAceBuilder().sgUuid(SG_UUID_2).newRuleName(SR_UUID_2_2)
                 .newMatches(matches).newDirection(DirectionIngress.class).build());
-        asyncEventsWaiter.awaitEventsConsumption();
         List<String> sgList = new ArrayList<>();
         sgList.add(SG_UUID_1);
         sgList.add(SG_UUID_2);
         newAllowedAddressPair(PORT_1, sgList, Collections.singletonList(AAP_PORT_1),
                 Collections.singletonList(SUBNET_INFO_1));
-        asyncEventsWaiter.awaitEventsConsumption();
         newAllowedAddressPair(PORT_2, sgList, Collections.singletonList(AAP_PORT_2),
                 Collections.singletonList(SUBNET_INFO_1));
-        asyncEventsWaiter.awaitEventsConsumption();
 
         asyncEventsWaiter.awaitEventsConsumption();
-        Thread.sleep(1000);
         newInterfaceWithMultipleAclCheck();
     }
 
@@ -274,10 +257,8 @@ public abstract class AclServiceTestBase {
 
         newAllowedAddressPair(PORT_1, Collections.singletonList(SG_UUID_1), Collections.singletonList(AAP_PORT_1),
                 Collections.singletonList(SUBNET_INFO_1));
-        asyncEventsWaiter.awaitEventsConsumption();
         newAllowedAddressPair(PORT_2, Collections.singletonList(SG_UUID_1), Collections.singletonList(AAP_PORT_2),
                 Collections.singletonList(SUBNET_INFO_1));
-        asyncEventsWaiter.awaitEventsConsumption();
 
         // Given
         Matches matches = newMatch(AclConstants.SOURCE_LOWER_PORT_UNSPECIFIED,
@@ -286,7 +267,6 @@ public abstract class AclServiceTestBase {
                 AclConstants.DEST_REMOTE_IP_PREFIX_SPECIFIED, (short) NwConstants.IP_PROT_TCP);
         dataBrokerUtil.put(new IdentifiedAceBuilder().sgUuid(SG_UUID_1).newRuleName(SR_UUID_1_1)
                 .newMatches(matches).newDirection(DirectionEgress.class).newRemoteGroupId(new Uuid(SG_UUID_1)).build());
-        asyncEventsWaiter.awaitEventsConsumption();
         matches = newMatch(AclConstants.SOURCE_LOWER_PORT_UNSPECIFIED, AclConstants.SOURCE_UPPER_PORT_UNSPECIFIED,
                 AclConstants.DEST_LOWER_PORT_HTTP, AclConstants.DEST_UPPER_PORT_HTTP,
                 AclConstants.SOURCE_REMOTE_IP_PREFIX_SPECIFIED, AclConstants.DEST_REMOTE_IP_PREFIX_UNSPECIFIED,
@@ -294,16 +274,13 @@ public abstract class AclServiceTestBase {
 
         dataBrokerUtil.put(new IdentifiedAceBuilder().sgUuid(SG_UUID_1).newRuleName(SR_UUID_1_2)
                 .newMatches(matches).newDirection(DirectionIngress.class).build());
-        asyncEventsWaiter.awaitEventsConsumption();
 
         // When
         putNewStateInterface(dataBroker, PORT_1, PORT_MAC_1);
-        asyncEventsWaiter.awaitEventsConsumption();
         putNewStateInterface(dataBroker, PORT_2, PORT_MAC_2);
-        asyncEventsWaiter.awaitEventsConsumption();
 
         asyncEventsWaiter.awaitEventsConsumption();
-        Thread.sleep(1000);
+
         // Then
         newInterfaceWithTcpDstAclCheck();
         LOG.info("newInterfaceWithTcpDstAcl - end");
@@ -317,10 +294,8 @@ public abstract class AclServiceTestBase {
 
         newAllowedAddressPair(PORT_1, Collections.singletonList(SG_UUID_1), Collections.singletonList(AAP_PORT_1),
                 Collections.singletonList(SUBNET_INFO_1));
-        asyncEventsWaiter.awaitEventsConsumption();
         newAllowedAddressPair(PORT_2, Collections.singletonList(SG_UUID_1), Collections.singletonList(AAP_PORT_2),
                 Collections.singletonList(SUBNET_INFO_1));
-        asyncEventsWaiter.awaitEventsConsumption();
 
         // Given
         Matches matches = newMatch(AclConstants.SOURCE_LOWER_PORT_UNSPECIFIED,
@@ -329,7 +304,6 @@ public abstract class AclServiceTestBase {
                 AclConstants.DEST_REMOTE_IP_PREFIX_SPECIFIED, (short) NwConstants.IP_PROT_UDP);
         dataBrokerUtil.put(new IdentifiedAceBuilder().sgUuid(SG_UUID_1).newRuleName(SR_UUID_1_1)
                 .newMatches(matches).newDirection(DirectionEgress.class).build());
-        asyncEventsWaiter.awaitEventsConsumption();
 
         matches = newMatch(AclConstants.SOURCE_LOWER_PORT_UNSPECIFIED, AclConstants.SOURCE_UPPER_PORT_UNSPECIFIED,
                 AclConstants.DEST_LOWER_PORT_HTTP, AclConstants.DEST_UPPER_PORT_HTTP,
@@ -338,16 +312,13 @@ public abstract class AclServiceTestBase {
         dataBrokerUtil.put(
                 new IdentifiedAceBuilder().sgUuid(SG_UUID_1).newRuleName(SR_UUID_1_2).newMatches(matches)
                         .newDirection(DirectionIngress.class).newRemoteGroupId(new Uuid(SG_UUID_1)).build());
-        asyncEventsWaiter.awaitEventsConsumption();
 
         // When
         putNewStateInterface(dataBroker, PORT_1, PORT_MAC_1);
-        asyncEventsWaiter.awaitEventsConsumption();
         putNewStateInterface(dataBroker, PORT_2, PORT_MAC_2);
-        asyncEventsWaiter.awaitEventsConsumption();
 
         asyncEventsWaiter.awaitEventsConsumption();
-        Thread.sleep(1000);
+
         // Then
         newInterfaceWithUdpDstAclCheck();
         LOG.info("newInterfaceWithUdpDstAcl - end");
@@ -361,21 +332,17 @@ public abstract class AclServiceTestBase {
 
         newAllowedAddressPair(PORT_1, Collections.singletonList(SG_UUID_1), Collections.singletonList(AAP_PORT_1),
                 Collections.singletonList(SUBNET_INFO_1));
-        asyncEventsWaiter.awaitEventsConsumption();
         newAllowedAddressPair(PORT_2, Collections.singletonList(SG_UUID_1), Collections.singletonList(AAP_PORT_2),
                 Collections.singletonList(SUBNET_INFO_1));
-        asyncEventsWaiter.awaitEventsConsumption();
         // Given
         prepareInterfaceWithIcmpAcl();
 
         // When
         putNewStateInterface(dataBroker, PORT_1, PORT_MAC_1);
-        asyncEventsWaiter.awaitEventsConsumption();
         putNewStateInterface(dataBroker, PORT_2, PORT_MAC_2);
-        asyncEventsWaiter.awaitEventsConsumption();
 
         asyncEventsWaiter.awaitEventsConsumption();
-        Thread.sleep(1000);
+
         // Then
         newInterfaceWithIcmpAclCheck();
         LOG.info("newInterfaceWithIcmpAcl - end");
@@ -389,28 +356,24 @@ public abstract class AclServiceTestBase {
 
         newAllowedAddressPair(PORT_1, Collections.singletonList(SG_UUID_1), Collections.singletonList(AAP_PORT_1),
                 Collections.singletonList(SUBNET_INFO_1));
-        asyncEventsWaiter.awaitEventsConsumption();
         // Given
         Matches matches = newMatch(AclConstants.SOURCE_LOWER_PORT_UNSPECIFIED,
                 AclConstants.SOURCE_UPPER_PORT_UNSPECIFIED, 333, 777, AclConstants.SOURCE_REMOTE_IP_PREFIX_UNSPECIFIED,
                 AclConstants.DEST_REMOTE_IP_PREFIX_SPECIFIED, (short) NwConstants.IP_PROT_TCP);
         dataBrokerUtil.put(new IdentifiedAceBuilder().sgUuid(SG_UUID_1).newRuleName(SR_UUID_1_1)
                 .newMatches(matches).newDirection(DirectionEgress.class).build());
-        asyncEventsWaiter.awaitEventsConsumption();
         matches = newMatch(AclConstants.SOURCE_LOWER_PORT_UNSPECIFIED, AclConstants.SOURCE_UPPER_PORT_UNSPECIFIED, 2000,
                 2003, AclConstants.SOURCE_REMOTE_IP_PREFIX_SPECIFIED, AclConstants.DEST_REMOTE_IP_PREFIX_UNSPECIFIED,
                 (short) NwConstants.IP_PROT_UDP);
 
         dataBrokerUtil.put(new IdentifiedAceBuilder().sgUuid(SG_UUID_1).newRuleName(SR_UUID_1_2)
                 .newMatches(matches).newDirection(DirectionIngress.class).build());
-        asyncEventsWaiter.awaitEventsConsumption();
 
         // When
         putNewStateInterface(dataBroker, PORT_1, PORT_MAC_1);
-        asyncEventsWaiter.awaitEventsConsumption();
 
         asyncEventsWaiter.awaitEventsConsumption();
-        Thread.sleep(1000);
+
         // Then
         newInterfaceWithDstPortRangeCheck();
         LOG.info("newInterfaceWithDstPortRange - end");
@@ -424,28 +387,24 @@ public abstract class AclServiceTestBase {
 
         newAllowedAddressPair(PORT_1, Collections.singletonList(SG_UUID_1), Collections.singletonList(AAP_PORT_1),
                 Collections.singletonList(SUBNET_INFO_1));
-        asyncEventsWaiter.awaitEventsConsumption();
         // Given
         Matches matches = newMatch(AclConstants.SOURCE_LOWER_PORT_UNSPECIFIED,
                 AclConstants.SOURCE_UPPER_PORT_UNSPECIFIED, 1, 65535, AclConstants.SOURCE_REMOTE_IP_PREFIX_UNSPECIFIED,
                 AclConstants.DEST_REMOTE_IP_PREFIX_SPECIFIED, (short) NwConstants.IP_PROT_TCP);
         dataBrokerUtil.put(new IdentifiedAceBuilder().sgUuid(SG_UUID_1).newRuleName(SR_UUID_1_1)
                 .newMatches(matches).newDirection(DirectionEgress.class).build());
-        asyncEventsWaiter.awaitEventsConsumption();
         matches = newMatch(AclConstants.SOURCE_LOWER_PORT_UNSPECIFIED, AclConstants.SOURCE_UPPER_PORT_UNSPECIFIED, 1,
                 65535, AclConstants.SOURCE_REMOTE_IP_PREFIX_SPECIFIED, AclConstants.DEST_REMOTE_IP_PREFIX_UNSPECIFIED,
                 (short) NwConstants.IP_PROT_UDP);
 
         dataBrokerUtil.put(new IdentifiedAceBuilder().sgUuid(SG_UUID_1).newRuleName(SR_UUID_1_2)
                 .newMatches(matches).newDirection(DirectionIngress.class).build());
-        asyncEventsWaiter.awaitEventsConsumption();
 
         // When
         putNewStateInterface(dataBroker, PORT_1, PORT_MAC_1);
-        asyncEventsWaiter.awaitEventsConsumption();
 
         asyncEventsWaiter.awaitEventsConsumption();
-        Thread.sleep(1000);
+
         // Then
         newInterfaceWithDstAllPortsCheck();
         LOG.info("newInterfaceWithDstAllPorts - end");
@@ -459,7 +418,6 @@ public abstract class AclServiceTestBase {
 
         newAllowedAddressPair(PORT_3, Arrays.asList(SG_UUID_1, SG_UUID_2), Collections.singletonList(AAP_PORT_3),
                 Collections.singletonList(SUBNET_INFO_1));
-        asyncEventsWaiter.awaitEventsConsumption();
         // Given
         Matches icmpEgressMatches = newMatch(AclConstants.SOURCE_LOWER_PORT_UNSPECIFIED,
                 AclConstants.SOURCE_UPPER_PORT_UNSPECIFIED, AclConstants.DEST_LOWER_PORT_2,
@@ -472,26 +430,21 @@ public abstract class AclServiceTestBase {
 
         dataBrokerUtil.put(new IdentifiedAceBuilder().sgUuid(SG_UUID_1).newRuleName(SR_UUID_1_1)
                 .newMatches(icmpEgressMatches).newDirection(DirectionEgress.class).build());
-        asyncEventsWaiter.awaitEventsConsumption();
 
         dataBrokerUtil.put(new IdentifiedAceBuilder().sgUuid(SG_UUID_1).newRuleName(SR_UUID_1_2)
                 .newMatches(icmpIngressMatches).newDirection(DirectionIngress.class).build());
-        asyncEventsWaiter.awaitEventsConsumption();
 
         dataBrokerUtil.put(new IdentifiedAceBuilder().sgUuid(SG_UUID_2).newRuleName(SR_UUID_2_1)
                 .newMatches(icmpEgressMatches).newDirection(DirectionEgress.class).build());
-        asyncEventsWaiter.awaitEventsConsumption();
 
         dataBrokerUtil.put(new IdentifiedAceBuilder().sgUuid(SG_UUID_2).newRuleName(SR_UUID_2_2)
                 .newMatches(icmpIngressMatches).newDirection(DirectionIngress.class).build());
-        asyncEventsWaiter.awaitEventsConsumption();
 
         // When
         putNewStateInterface(dataBroker, PORT_3, PORT_MAC_3);
-        asyncEventsWaiter.awaitEventsConsumption();
 
         asyncEventsWaiter.awaitEventsConsumption();
-        Thread.sleep(1000);
+
         // Then
         newInterfaceWithTwoAclsHavingSameRulesCheck();
         LOG.info("newInterfaceWithTwoAclsHavingSameRules - end");
@@ -503,21 +456,17 @@ public abstract class AclServiceTestBase {
     public void newInterfaceWithIcmpAclHavingOverlappingMac() throws Exception {
         newAllowedAddressPair(PORT_1, Collections.singletonList(SG_UUID_1), Collections.singletonList(AAP_PORT_1),
                 Collections.singletonList(SUBNET_INFO_1));
-        asyncEventsWaiter.awaitEventsConsumption();
         newAllowedAddressPair(PORT_2, Collections.singletonList(SG_UUID_1), Collections.singletonList(AAP_PORT_2),
                 Collections.singletonList(SUBNET_INFO_1));
-        asyncEventsWaiter.awaitEventsConsumption();
         // Given
         prepareInterfaceWithIcmpAcl();
 
         // When
         putNewStateInterface(dataBroker, PORT_1, PORT_MAC_1);
-        asyncEventsWaiter.awaitEventsConsumption();
         putNewStateInterface(dataBroker, PORT_2, PORT_MAC_1);
-        asyncEventsWaiter.awaitEventsConsumption();
 
         asyncEventsWaiter.awaitEventsConsumption();
-        Thread.sleep(1000);
+
         // Then
         newInterfaceWithIcmpAclCheck();
     }
@@ -527,23 +476,19 @@ public abstract class AclServiceTestBase {
         LOG.info("newInterfaceWithAapIpv4All test - start");
         newAllowedAddressPair(PORT_1, Collections.singletonList(SG_UUID_1), Collections.singletonList(AAP_PORT_1),
                 Collections.singletonList(SUBNET_INFO_1));
-        asyncEventsWaiter.awaitEventsConsumption();
         List<AllowedAddressPairs> aapList = new ArrayList<>();
         aapList.add(AAP_PORT_2);
         aapList.add(buildAap("0.0.0.0/0", PORT_MAC_2));
         newAllowedAddressPair(PORT_2, Collections.singletonList(SG_UUID_1), aapList,
                 Collections.singletonList(SUBNET_INFO_1));
-        asyncEventsWaiter.awaitEventsConsumption();
 
         prepareInterfaceWithIcmpAcl();
         // When
         putNewStateInterface(dataBroker, PORT_1, PORT_MAC_1);
-        asyncEventsWaiter.awaitEventsConsumption();
         putNewStateInterface(dataBroker, PORT_2, PORT_MAC_2);
-        asyncEventsWaiter.awaitEventsConsumption();
 
         asyncEventsWaiter.awaitEventsConsumption();
-        Thread.sleep(1000);
+
         // Then
         newInterfaceWithAapIpv4AllCheck();
         LOG.info("newInterfaceWithAapIpv4All test - end");
@@ -557,20 +502,16 @@ public abstract class AclServiceTestBase {
 
         newAllowedAddressPair(PORT_1, Collections.singletonList(SG_UUID_1), Collections.singletonList(AAP_PORT_1),
                 Collections.singletonList(SUBNET_INFO_1));
-        asyncEventsWaiter.awaitEventsConsumption();
         newAllowedAddressPair(PORT_2, Collections.singletonList(SG_UUID_1),
                 Arrays.asList(AAP_PORT_2, AAP_PORT_100, AAP_PORT_101), Collections.singletonList(SUBNET_INFO_1));
-        asyncEventsWaiter.awaitEventsConsumption();
 
         prepareInterfaceWithIcmpAcl();
         // When
         putNewStateInterface(dataBroker, PORT_1, PORT_MAC_1);
-        asyncEventsWaiter.awaitEventsConsumption();
         putNewStateInterface(dataBroker, PORT_2, PORT_MAC_2);
-        asyncEventsWaiter.awaitEventsConsumption();
 
         asyncEventsWaiter.awaitEventsConsumption();
-        Thread.sleep(1000);
+
         // Then
         newInterfaceWithAapCheck();
         LOG.info("newInterfaceWithAap test - end");
@@ -592,7 +533,6 @@ public abstract class AclServiceTestBase {
                 AclConstants.DEST_REMOTE_IP_PREFIX_SPECIFIED, (short) NwConstants.IP_PROT_ICMP);
         dataBrokerUtil.put(new IdentifiedAceBuilder().sgUuid(SG_UUID_1).newRuleName(SR_UUID_1_1)
                 .newMatches(matches).newDirection(DirectionEgress.class).newRemoteGroupId(new Uuid(SG_UUID_1)).build());
-        asyncEventsWaiter.awaitEventsConsumption();
 
         matches = newMatch(AclConstants.SOURCE_LOWER_PORT_UNSPECIFIED, AclConstants.SOURCE_UPPER_PORT_UNSPECIFIED,
                 AclConstants.DEST_LOWER_PORT_2, AclConstants.DEST_UPPER_PORT_3,
@@ -600,7 +540,6 @@ public abstract class AclServiceTestBase {
                 (short) NwConstants.IP_PROT_ICMP);
         dataBrokerUtil.put(new IdentifiedAceBuilder().sgUuid(SG_UUID_1).newRuleName(SR_UUID_1_2)
                 .newMatches(matches).newDirection(DirectionIngress.class).build());
-        asyncEventsWaiter.awaitEventsConsumption();
     }
 
     protected void newAllowedAddressPair(String portName, List<String> sgUuidList, List<AllowedAddressPairs> aapList,