import java.math.BigInteger;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.genius.datastoreutils.DataStoreJobCoordinator;
import org.opendaylight.genius.mdsalutil.ActionInfo;
import org.opendaylight.genius.mdsalutil.FlowEntity;
import org.opendaylight.genius.mdsalutil.InstructionInfo;
protected void syncFlow(BigInteger dpId, short tableId, String flowId, int priority, String flowName,
int idleTimeOut, int hardTimeOut, BigInteger cookie, List<? extends MatchInfoBase> matches,
List<InstructionInfo> instructions, int addOrRemove) {
+ DataStoreJobCoordinator dataStoreCoordinator = DataStoreJobCoordinator.getInstance();
if (addOrRemove == NwConstants.DEL_FLOW) {
FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, tableId, flowId, priority, flowName, idleTimeOut,
hardTimeOut, cookie, matches, null);
LOG.trace("Removing Acl Flow DpnId {}, flowId {}", dpId, flowId);
- mdsalManager.removeFlow(flowEntity);
+ dataStoreCoordinator.enqueueJob(dpId.toString(),
+ () -> {
+ return Arrays.asList(mdsalManager.removeFlow(dpId, flowEntity));
+ });
} else {
FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, tableId, flowId, priority, flowName, idleTimeOut,
hardTimeOut, cookie, matches, instructions);
LOG.trace("Installing DpnId {}, flowId {}", dpId, flowId);
- mdsalManager.installFlow(flowEntity);
+ dataStoreCoordinator.enqueueJob(dpId.toString(),
+ () -> {
+ return Arrays.asList(mdsalManager.installFlow(dpId, flowEntity));
+ });
}
}
*/
package org.opendaylight.netvirt.aclservice.listeners;
+import com.google.common.util.concurrent.Futures;
+
+import java.util.Arrays;
import java.util.List;
import javax.annotation.PostConstruct;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.genius.datastoreutils.AsyncDataTreeChangeListenerBase;
+import org.opendaylight.genius.datastoreutils.DataStoreJobCoordinator;
import org.opendaylight.netvirt.aclservice.api.AclServiceManager;
import org.opendaylight.netvirt.aclservice.api.AclServiceManager.Action;
import org.opendaylight.netvirt.aclservice.api.utils.AclInterface;
@Override
protected void remove(InstanceIdentifier<Interface> key, Interface dataObjectModification) {
String interfaceId = dataObjectModification.getName();
- AclInterface aclInterface = AclInterfaceCacheUtil.getAclInterfaceFromCache(interfaceId);
- if (AclServiceUtils.isOfInterest(aclInterface)) {
- AclInterfaceCacheUtil.removeAclInterfaceFromCache(interfaceId);
- if (aclClusterUtil.isEntityOwner()) {
- aclServiceManger.notify(aclInterface, null, Action.REMOVE);
- }
- List<Uuid> aclList = aclInterface.getSecurityGroups();
- if (aclList != null) {
- aclDataUtil.removeAclInterfaceMap(aclList, aclInterface);
- }
- }
+ DataStoreJobCoordinator dataStoreCoordinator = DataStoreJobCoordinator.getInstance();
+ dataStoreCoordinator.enqueueJob(interfaceId,
+ () -> {
+ AclInterface aclInterface = AclInterfaceCacheUtil.getAclInterfaceFromCache(interfaceId);
+ if (AclServiceUtils.isOfInterest(aclInterface)) {
+ AclInterfaceCacheUtil.removeAclInterfaceFromCache(interfaceId);
+ if (aclClusterUtil.isEntityOwner()) {
+ aclServiceManger.notify(aclInterface, null, Action.REMOVE);
+ }
+ List<Uuid> aclList = aclInterface.getSecurityGroups();
+ if (aclList != null) {
+ aclDataUtil.removeAclInterfaceMap(aclList, aclInterface);
+ }
+ }
+ return Arrays.asList(Futures.immediateCheckedFuture(null));
+ });
}
@Override
@Override
protected void add(InstanceIdentifier<Interface> key, Interface dataObjectModification) {
- AclInterface aclInterface = updateAclInterfaceCache(dataObjectModification);
- if (AclServiceUtils.isOfInterest(aclInterface)) {
- List<Uuid> aclList = aclInterface.getSecurityGroups();
- if (aclList != null) {
- aclDataUtil.addAclInterfaceMap(aclList, aclInterface);
- }
- if (aclClusterUtil.isEntityOwner()) {
- aclServiceManger.notify(aclInterface, null, Action.ADD);
- }
- }
+ DataStoreJobCoordinator dataStoreCoordinator = DataStoreJobCoordinator.getInstance();
+ dataStoreCoordinator.enqueueJob(dataObjectModification.getName(),
+ () -> {
+ AclInterface aclInterface = updateAclInterfaceCache(dataObjectModification);
+ if (AclServiceUtils.isOfInterest(aclInterface)) {
+ List<Uuid> aclList = aclInterface.getSecurityGroups();
+ if (aclList != null) {
+ aclDataUtil.addAclInterfaceMap(aclList, aclInterface);
+ }
+ if (aclClusterUtil.isEntityOwner()) {
+ aclServiceManger.notify(aclInterface, null, Action.ADD);
+ }
+ }
+ return Arrays.asList(Futures.immediateCheckedFuture(null));
+ });
}
@Override
import static org.mockito.Mockito.when;
import com.google.common.base.Optional;
+import com.google.common.util.concurrent.CheckedFuture;
import com.google.common.util.concurrent.Futures;
import java.math.BigInteger;
import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
import org.opendaylight.genius.mdsalutil.FlowEntity;
import org.opendaylight.genius.mdsalutil.NwConstants;
import org.opendaylight.genius.mdsalutil.NxMatchFieldType;
@Mock AclserviceConfig config;
@Mock IdManagerService idManager;
- MethodInvocationParamSaver<Void> installFlowValueSaver = null;
- MethodInvocationParamSaver<Void> removeFlowValueSaver = null;
+ MethodInvocationParamSaver<CheckedFuture<Void, TransactionCommitFailedException>> installFlowValueSaver = null;
+ MethodInvocationParamSaver<CheckedFuture<Void, TransactionCommitFailedException>> removeFlowValueSaver = null;
final Integer tcpFinIdleTimeoutValue = 60;
doReturn(Futures.immediateCheckedFuture(null)).when(mockWriteTx).submit();
doReturn(mockReadTx).when(dataBroker).newReadOnlyTransaction();
doReturn(mockWriteTx).when(dataBroker).newWriteOnlyTransaction();
- installFlowValueSaver = new MethodInvocationParamSaver<>(null);
- doAnswer(installFlowValueSaver).when(mdsalManager).installFlow(any(FlowEntity.class));
- removeFlowValueSaver = new MethodInvocationParamSaver<>(null);
- doAnswer(installFlowValueSaver).when(mdsalManager).removeFlow(any(FlowEntity.class));
+ installFlowValueSaver = new MethodInvocationParamSaver<>(Futures.immediateCheckedFuture(null));
+ doAnswer(installFlowValueSaver).when(mdsalManager).installFlow(any(BigInteger.class), any(FlowEntity.class));
+ removeFlowValueSaver = new MethodInvocationParamSaver<>(Futures.immediateCheckedFuture(null));
+ doAnswer(installFlowValueSaver).when(mdsalManager).removeFlow(any(BigInteger.class), any(FlowEntity.class));
doReturn(tcpFinIdleTimeoutValue).when(config).getSecurityGroupTcpFinIdleTimeout();
}
Uuid sgUuid = new Uuid("12345678-1234-1234-1234-123456789012");
AclInterface ai = stubTcpAclInterface(sgUuid, "if_name", "1.1.1.1/32", 80, 80);
assertEquals(true, testedService.applyAcl(ai));
+ Thread.sleep(1000);
assertEquals(10, installFlowValueSaver.getNumOfInvocations());
- FlowEntity flow = (FlowEntity) installFlowValueSaver.getInvocationParams(9).get(0);
+ FlowEntity flow = (FlowEntity) installFlowValueSaver.getInvocationParams(9).get(1);
AclServiceTestUtils.verifyMatchInfo(flow.getMatchInfoList(),
NxMatchFieldType.nx_tcp_dst_with_mask, "80", "65535");
AclServiceTestUtils.verifyActionTypeExist(flow.getInstructionInfoList().get(0), ActionLearn.class);
Uuid sgUuid = new Uuid("12345678-1234-1234-1234-123456789012");
AclInterface ai = stubAllowAllInterface(sgUuid, "if_name");
assertEquals(true, testedService.applyAcl(ai));
+ Thread.sleep(1000);
assertEquals(10, installFlowValueSaver.getNumOfInvocations());
- FlowEntity flow = (FlowEntity) installFlowValueSaver.getInvocationParams(9).get(0);
+ FlowEntity flow = (FlowEntity) installFlowValueSaver.getInvocationParams(9).get(1);
AclServiceTestUtils.verifyActionTypeExist(flow.getInstructionInfoList().get(0), ActionLearn.class);
}
Uuid sgUuid = new Uuid("12345678-1234-1234-1234-123456789012");
AclInterface ai = stubTcpAclInterface(sgUuid, "if_name", "1.1.1.1/32", 80, 84);
assertEquals(true, testedService.applyAcl(ai));
+ Thread.sleep(1000);
assertEquals(11, installFlowValueSaver.getNumOfInvocations());
- FlowEntity firstRangeFlow = (FlowEntity) installFlowValueSaver.getInvocationParams(9).get(0);
+ FlowEntity firstRangeFlow = (FlowEntity) installFlowValueSaver.getInvocationParams(9).get(1);
AclServiceTestUtils.verifyMatchInfo(firstRangeFlow.getMatchInfoList(),
NxMatchFieldType.nx_tcp_dst_with_mask, "80", "65532");
- FlowEntity secondRangeFlow = (FlowEntity) installFlowValueSaver.getInvocationParams(10).get(0);
+ FlowEntity secondRangeFlow = (FlowEntity) installFlowValueSaver.getInvocationParams(10).get(1);
AclServiceTestUtils.verifyMatchInfo(secondRangeFlow.getMatchInfoList(),
NxMatchFieldType.nx_tcp_dst_with_mask, "84", "65535");
}
Uuid sgUuid = new Uuid("12345678-1234-1234-1234-123456789012");
AclInterface ai = stubUdpAclInterface(sgUuid, "if_name", "1.1.1.1/32", 80, 80);
assertEquals(true, testedService.applyAcl(ai));
+ Thread.sleep(1000);
assertEquals(10, installFlowValueSaver.getNumOfInvocations());
- FlowEntity flow = (FlowEntity) installFlowValueSaver.getInvocationParams(9).get(0);
+ FlowEntity flow = (FlowEntity) installFlowValueSaver.getInvocationParams(9).get(1);
AclServiceTestUtils.verifyMatchInfo(flow.getMatchInfoList(),
NxMatchFieldType.nx_udp_dst_with_mask, "80", "65535");
AclServiceTestUtils.verifyActionTypeExist(flow.getInstructionInfoList().get(0), ActionLearn.class);
Uuid sgUuid = new Uuid("12345678-1234-1234-1234-123456789012");
AclInterface ai = stubTcpAclInterface(sgUuid, "if_name", "1.1.1.1/32", 80, 80);
assertEquals(true, testedService.removeAcl(ai));
+ Thread.sleep(1000);
assertEquals(5, removeFlowValueSaver.getNumOfInvocations());
FlowEntity firstRangeFlow = (FlowEntity) removeFlowValueSaver.getInvocationParams(4).get(0);
assertTrue(firstRangeFlow.getMatchInfoList().contains(new MatchTcpFlags(2)));
import static org.mockito.Mockito.when;
import com.google.common.base.Optional;
+import com.google.common.util.concurrent.CheckedFuture;
import com.google.common.util.concurrent.Futures;
import java.math.BigInteger;
import java.util.Collections;
import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
import org.opendaylight.genius.mdsalutil.FlowEntity;
import org.opendaylight.genius.mdsalutil.NwConstants;
import org.opendaylight.genius.mdsalutil.NxMatchFieldType;
@Mock AclserviceConfig config;
@Mock IdManagerService idManager;
- MethodInvocationParamSaver<Void> installFlowValueSaver = null;
- MethodInvocationParamSaver<Void> removeFlowValueSaver = null;
+ MethodInvocationParamSaver<CheckedFuture<Void, TransactionCommitFailedException>> installFlowValueSaver = null;
+ MethodInvocationParamSaver<CheckedFuture<Void, TransactionCommitFailedException>> removeFlowValueSaver = null;
@Before
public void setUp() {
doReturn(Futures.immediateCheckedFuture(null)).when(mockWriteTx).submit();
doReturn(mockReadTx).when(dataBroker).newReadOnlyTransaction();
doReturn(mockWriteTx).when(dataBroker).newWriteOnlyTransaction();
- installFlowValueSaver = new MethodInvocationParamSaver<>(null);
- doAnswer(installFlowValueSaver).when(mdsalManager).installFlow(any(FlowEntity.class));
- removeFlowValueSaver = new MethodInvocationParamSaver<>(null);
- doAnswer(removeFlowValueSaver).when(mdsalManager).removeFlow(any(FlowEntity.class));
+ installFlowValueSaver = new MethodInvocationParamSaver<>(Futures.immediateCheckedFuture(null));
+ removeFlowValueSaver = new MethodInvocationParamSaver<>(Futures.immediateCheckedFuture(null));
+ doAnswer(removeFlowValueSaver).when(mdsalManager).removeFlow(any(BigInteger.class), any(FlowEntity.class));
+ doAnswer(installFlowValueSaver).when(mdsalManager).installFlow(any(BigInteger.class), any(FlowEntity.class));
}
@Test
Uuid sgUuid = new Uuid("12345678-1234-1234-1234-123456789012");
AclInterface ai = stubTcpAclInterface(sgUuid, "if_name", "1.1.1.1/32", 80, 80);
assertEquals(true, testedService.applyAcl(ai));
+ Thread.sleep(1000);
assertEquals(10, installFlowValueSaver.getNumOfInvocations());
- FlowEntity firstRangeFlow = (FlowEntity) installFlowValueSaver.getInvocationParams(9).get(0);
+ FlowEntity firstRangeFlow = (FlowEntity) installFlowValueSaver.getInvocationParams(9).get(1);
AclServiceTestUtils.verifyMatchInfo(firstRangeFlow.getMatchInfoList(),
NxMatchFieldType.nx_tcp_dst_with_mask, "80", "65535");
assertTrue(firstRangeFlow.getMatchInfoList().contains(new MatchTcpFlags(2)));
AclServiceTestUtils.verifyActionInfo(firstRangeFlow.getInstructionInfoList().get(0),
new ActionNxResubmit(NwConstants.LPORT_DISPATCHER_TABLE));
-
}
@Test
Uuid sgUuid = new Uuid("12345678-1234-1234-1234-123456789012");
AclInterface ai = stubAllowAllInterface(sgUuid, "if_name");
assertEquals(true, testedService.applyAcl(ai));
+ Thread.sleep(1000);
assertEquals(10, installFlowValueSaver.getNumOfInvocations());
- FlowEntity firstRangeFlow = (FlowEntity) installFlowValueSaver.getInvocationParams(9).get(0);
+ FlowEntity firstRangeFlow = (FlowEntity) installFlowValueSaver.getInvocationParams(9).get(1);
AclServiceTestUtils.verifyActionInfo(firstRangeFlow.getInstructionInfoList().get(0),
new ActionNxResubmit(NwConstants.LPORT_DISPATCHER_TABLE));
}
Uuid sgUuid = new Uuid("12345678-1234-1234-1234-123456789012");
AclInterface ai = stubTcpAclInterface(sgUuid, "if_name", "1.1.1.1/32", 80, 84);
assertEquals(true, testedService.applyAcl(ai));
+ Thread.sleep(1000);
assertEquals(11, installFlowValueSaver.getNumOfInvocations());
- FlowEntity firstRangeFlow = (FlowEntity) installFlowValueSaver.getInvocationParams(9).get(0);
+ FlowEntity firstRangeFlow = (FlowEntity) installFlowValueSaver.getInvocationParams(9).get(1);
AclServiceTestUtils.verifyMatchInfo(firstRangeFlow.getMatchInfoList(),
NxMatchFieldType.nx_tcp_dst_with_mask, "80", "65532");
assertTrue(firstRangeFlow.getMatchInfoList().contains(new MatchTcpFlags(2)));
- FlowEntity secondRangeFlow = (FlowEntity) installFlowValueSaver.getInvocationParams(10).get(0);
+ FlowEntity secondRangeFlow = (FlowEntity) installFlowValueSaver.getInvocationParams(10).get(1);
AclServiceTestUtils.verifyMatchInfo(secondRangeFlow.getMatchInfoList(),
NxMatchFieldType.nx_tcp_dst_with_mask, "84", "65535");
assertTrue(secondRangeFlow.getMatchInfoList().contains(new MatchTcpFlags(2)));
Uuid sgUuid = new Uuid("12345678-1234-1234-1234-123456789012");
AclInterface ai = stubUdpAclInterface(sgUuid, "if_name", "1.1.1.1/32", 80, 80);
assertEquals(true, testedService.applyAcl(ai));
+ Thread.sleep(1000);
assertEquals(9, installFlowValueSaver.getNumOfInvocations());
}
Uuid sgUuid = new Uuid("12345678-1234-1234-1234-123456789012");
AclInterface ai = stubTcpAclInterface(sgUuid, "if_name", "1.1.1.1/32", 80, 80);
assertEquals(true, testedService.removeAcl(ai));
+ Thread.sleep(1000);
+
assertEquals(10, removeFlowValueSaver.getNumOfInvocations());
- FlowEntity firstRangeFlow = (FlowEntity) removeFlowValueSaver.getInvocationParams(9).get(0);
+ FlowEntity firstRangeFlow = (FlowEntity) removeFlowValueSaver.getInvocationParams(9).get(1);
assertTrue(firstRangeFlow.getMatchInfoList().contains(new MatchTcpFlags(2)));
AclServiceTestUtils.verifyMatchInfo(firstRangeFlow.getMatchInfoList(),
NxMatchFieldType.nx_tcp_dst_with_mask, "80", "65535");
import static org.mockito.Mockito.when;
import com.google.common.base.Optional;
+import com.google.common.util.concurrent.CheckedFuture;
import com.google.common.util.concurrent.Futures;
import java.math.BigInteger;
import java.util.Collections;
import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
import org.opendaylight.genius.mdsalutil.FlowEntity;
import org.opendaylight.genius.mdsalutil.NwConstants;
import org.opendaylight.genius.mdsalutil.NxMatchFieldType;
@Mock AclserviceConfig config;
@Mock IdManagerService idManager;
- MethodInvocationParamSaver<Void> installFlowValueSaver = null;
- MethodInvocationParamSaver<Void> removeFlowValueSaver = null;
+ MethodInvocationParamSaver<CheckedFuture<Void, TransactionCommitFailedException>> installFlowValueSaver = null;
+ MethodInvocationParamSaver<CheckedFuture<Void, TransactionCommitFailedException>> removeFlowValueSaver = null;
@Before
public void setUp() {
doReturn(Futures.immediateCheckedFuture(null)).when(mockWriteTx).submit();
doReturn(mockReadTx).when(dataBroker).newReadOnlyTransaction();
doReturn(mockWriteTx).when(dataBroker).newWriteOnlyTransaction();
- installFlowValueSaver = new MethodInvocationParamSaver<>(null);
- doAnswer(installFlowValueSaver).when(mdsalManager).installFlow(any(FlowEntity.class));
- removeFlowValueSaver = new MethodInvocationParamSaver<>(null);
- doAnswer(removeFlowValueSaver).when(mdsalManager).removeFlow(any(FlowEntity.class));
+ installFlowValueSaver = new MethodInvocationParamSaver<>(Futures.immediateCheckedFuture(null));
+ doAnswer(installFlowValueSaver).when(mdsalManager).installFlow(any(BigInteger.class), any(FlowEntity.class));
+ removeFlowValueSaver = new MethodInvocationParamSaver<>(Futures.immediateCheckedFuture(null));
+ doAnswer(removeFlowValueSaver).when(mdsalManager).removeFlow(any(BigInteger.class), any(FlowEntity.class));
}
@Test
Uuid sgUuid = new Uuid("12345678-1234-1234-1234-123456789012");
AclInterface ai = stubTcpAclInterface(sgUuid, "if_name", "1.1.1.1/32", 80, 80);
assertEquals(true, testedService.applyAcl(ai));
+ Thread.sleep(1000);
assertEquals(7, installFlowValueSaver.getNumOfInvocations());
- FlowEntity firstRangeFlow = (FlowEntity) installFlowValueSaver.getInvocationParams(6).get(0);
+ FlowEntity firstRangeFlow = (FlowEntity) installFlowValueSaver.getInvocationParams(6).get(1);
AclServiceTestUtils.verifyMatchInfo(firstRangeFlow.getMatchInfoList(),
NxMatchFieldType.nx_tcp_dst_with_mask, "80", "65535");
assertTrue(firstRangeFlow.getMatchInfoList().contains(new MatchTcpFlags(2)));
Uuid sgUuid = new Uuid("12345678-1234-1234-1234-123456789012");
AclInterface ai = stubAllowAllInterface(sgUuid, "if_name");
assertEquals(true, testedService.applyAcl(ai));
+ Thread.sleep(1000);
assertEquals(7, installFlowValueSaver.getNumOfInvocations());
- FlowEntity firstRangeFlow = (FlowEntity) installFlowValueSaver.getInvocationParams(6).get(0);
+ FlowEntity firstRangeFlow = (FlowEntity) installFlowValueSaver.getInvocationParams(6).get(1);
AclServiceTestUtils.verifyActionInfo(firstRangeFlow.getInstructionInfoList().get(0),
new ActionNxResubmit(NwConstants.EGRESS_LPORT_DISPATCHER_TABLE));
}
Uuid sgUuid = new Uuid("12345678-1234-1234-1234-123456789012");
AclInterface ai = stubTcpAclInterface(sgUuid, "if_name", "1.1.1.1/32", 80, 84);
assertEquals(true, testedService.applyAcl(ai));
+ Thread.sleep(1000);
assertEquals(8, installFlowValueSaver.getNumOfInvocations());
- FlowEntity firstRangeFlow = (FlowEntity) installFlowValueSaver.getInvocationParams(6).get(0);
+ FlowEntity firstRangeFlow = (FlowEntity) installFlowValueSaver.getInvocationParams(6).get(1);
// should have been 80-83 will be fixed as part of the port range support
// https://bugs.opendaylight.org/show_bug.cgi?id=6200
AclServiceTestUtils.verifyMatchInfo(firstRangeFlow.getMatchInfoList(),
NxMatchFieldType.nx_tcp_dst_with_mask, "80", "65532");
assertTrue(firstRangeFlow.getMatchInfoList().contains(new MatchTcpFlags(2)));
- FlowEntity secondRangeFlow = (FlowEntity) installFlowValueSaver.getInvocationParams(7).get(0);
+ FlowEntity secondRangeFlow = (FlowEntity) installFlowValueSaver.getInvocationParams(7).get(1);
AclServiceTestUtils.verifyMatchInfo(secondRangeFlow.getMatchInfoList(),
NxMatchFieldType.nx_tcp_dst_with_mask, "84", "65535");
assertTrue(secondRangeFlow.getMatchInfoList().contains(new MatchTcpFlags(2)));
Uuid sgUuid = new Uuid("12345678-1234-1234-1234-123456789012");
AclInterface ai = stubUdpAclInterface(sgUuid, "if_name", "1.1.1.1/32", 80, 80);
assertEquals(true, testedService.applyAcl(ai));
+ Thread.sleep(1000);
assertEquals(6, installFlowValueSaver.getNumOfInvocations());
}
Uuid sgUuid = new Uuid("12345678-1234-1234-1234-123456789012");
AclInterface ai = stubTcpAclInterface(sgUuid, "if_name", "1.1.1.1/32", 80, 80);
assertEquals(true, testedService.removeAcl(ai));
+ Thread.sleep(1000);
assertEquals(7, removeFlowValueSaver.getNumOfInvocations());
- FlowEntity firstSynFlow = (FlowEntity) removeFlowValueSaver.getInvocationParams(6).get(0);
+ FlowEntity firstSynFlow = (FlowEntity) removeFlowValueSaver.getInvocationParams(6).get(1);
AclServiceTestUtils.verifyMatchInfo(firstSynFlow.getMatchInfoList(),
NxMatchFieldType.nx_tcp_dst_with_mask, "80", "65535");
assertTrue(firstSynFlow.getMatchInfoList().contains(MatchTcpFlags.SYN));
import java.util.List;
import java.util.stream.Collectors;
import javax.inject.Inject;
+
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
import org.opendaylight.genius.datastoreutils.SingleTransactionDataBroker;
import org.opendaylight.genius.datastoreutils.testutils.AsyncEventsWaiter;
+import org.opendaylight.genius.datastoreutils.testutils.JobCoordinatorEventsWaiter;
import org.opendaylight.genius.mdsalutil.FlowEntity;
import org.opendaylight.genius.mdsalutil.NwConstants;
import org.opendaylight.genius.mdsalutil.interfaces.testutils.TestIMdsalApiManager;
SingleTransactionDataBroker singleTransactionDataBroker;
@Inject TestIMdsalApiManager mdsalApiManager;
@Inject AsyncEventsWaiter asyncEventsWaiter;
+ @Inject JobCoordinatorEventsWaiter coordinatorEventsWaiter;
@Before
public void beforeEachTest() throws Exception {
abstract void newInterfaceWithAapIpv4AllCheck();
protected void assertFlowsInAnyOrder(Iterable<FlowEntity> expectedFlows) {
+ coordinatorEventsWaiter.awaitEventsConsumption();
mdsalApiManager.assertFlowsInAnyOrder(expectedFlows);
}
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
import org.opendaylight.controller.md.sal.binding.test.DataBrokerTestModule;
+import org.opendaylight.genius.datastoreutils.testutils.JobCoordinatorEventsWaiter;
+import org.opendaylight.genius.datastoreutils.testutils.TestableJobCoordinatorEventsWaiter;
import org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager;
import org.opendaylight.genius.mdsalutil.interfaces.testutils.TestIMdsalApiManager;
import org.opendaylight.netvirt.aclservice.stats.TestOdlDirectStatisticsService;
bind(IdManagerService.class).toInstance(Mockito.mock(TestIdManagerService.class, realOrException()));
bind(OpendaylightDirectStatisticsService.class)
.toInstance(Mockito.mock(TestOdlDirectStatisticsService.class, realOrException()));
+ bind(JobCoordinatorEventsWaiter.class).toInstance(new TestableJobCoordinatorEventsWaiter());
}
private AclserviceConfig aclServiceConfig() {
import java.util.concurrent.ConcurrentMap;
import java.util.stream.Collectors;
import java.util.stream.Stream;
+
import org.junit.Assert;
import org.opendaylight.genius.mdsalutil.ActionInfo;
import org.opendaylight.genius.mdsalutil.InstructionInfo;
if (entityOwnerCache != null) {
entityOwnerCache.put(entityName, true);
}
-
}
-
}