Preperation for the FloodlightModule implementaion of MatchActionModule.
- Marked MatchActionFloodlightService interface as IFloodlightService.
- MatchActionFloodlightService extends MatchActionService and IFloodlightService.
- Added methods for getting ID generators to MatchActionService.
- Updated to use the MatchActionService in FlowManagerModule.
- This task is a part of ONOS-1730.
Change-Id: I86726939a2af905c378af57a9337c49a2a2425d5
diff --git a/src/main/java/net/onrc/onos/core/flowmanager/FlowManagerModule.java b/src/main/java/net/onrc/onos/core/flowmanager/FlowManagerModule.java
index 1a3523b..ccf6081 100644
--- a/src/main/java/net/onrc/onos/core/flowmanager/FlowManagerModule.java
+++ b/src/main/java/net/onrc/onos/core/flowmanager/FlowManagerModule.java
@@ -26,10 +26,12 @@
import net.onrc.onos.api.flowmanager.FlowManagerFloodlightService;
import net.onrc.onos.api.flowmanager.FlowManagerListener;
import net.onrc.onos.core.datagrid.ISharedCollectionsService;
-import net.onrc.onos.core.matchaction.MatchActionIdGeneratorWithIdBlockAllocator;
+import net.onrc.onos.core.matchaction.MatchActionFloodlightService;
+import net.onrc.onos.core.matchaction.MatchActionIdGenerator;
import net.onrc.onos.core.matchaction.MatchActionOperationEntry;
import net.onrc.onos.core.matchaction.MatchActionOperations;
-import net.onrc.onos.core.matchaction.MatchActionOperationsIdGeneratorWithIdBlockAllocator;
+import net.onrc.onos.core.matchaction.MatchActionOperationsIdGenerator;
+import net.onrc.onos.core.matchaction.MatchActionService;
import net.onrc.onos.core.registry.IControllerRegistryService;
import net.onrc.onos.core.util.IdBlockAllocator;
@@ -43,8 +45,9 @@
private ConflictDetectionPolicy conflictDetectionPolicy;
private FlowIdGeneratorWithIdBlockAllocator flowIdGenerator;
private FlowBatchIdGeneratorWithIdBlockAllocator flowBatchIdGenerator;
- private MatchActionIdGeneratorWithIdBlockAllocator maIdGenerator;
- private MatchActionOperationsIdGeneratorWithIdBlockAllocator maoIdGenerator;
+ private MatchActionIdGenerator maIdGenerator;
+ private MatchActionOperationsIdGenerator maoIdGenerator;
+ private MatchActionService matchActionService;
private IControllerRegistryService registryService;
private ISharedCollectionsService sharedCollectionService;
private FlowMap flowMap;
@@ -69,33 +72,27 @@
@Override
public Collection<Class<? extends IFloodlightService>> getModuleDependencies() {
return Arrays.asList(
- // TODO: Add MatchActionService.class.
- // The class has to be an instance of IFloodlightService.
+ MatchActionFloodlightService.class,
ISharedCollectionsService.class,
IControllerRegistryService.class);
}
@Override
public void init(FloodlightModuleContext context) throws FloodlightModuleException {
+ matchActionService = context.getServiceImpl(MatchActionFloodlightService.class);
registryService = context.getServiceImpl(IControllerRegistryService.class);
sharedCollectionService = context.getServiceImpl(ISharedCollectionsService.class);
}
@Override
public void startUp(FloodlightModuleContext context) throws FloodlightModuleException {
-
IdBlockAllocator idBlockAllocator = registryService;
flowIdGenerator =
new FlowIdGeneratorWithIdBlockAllocator(idBlockAllocator);
flowBatchIdGenerator =
new FlowBatchIdGeneratorWithIdBlockAllocator(idBlockAllocator);
-
- // TODO: MatchAction related ID generator should be retrieved from
- // MatchAction Module.
- maIdGenerator =
- new MatchActionIdGeneratorWithIdBlockAllocator(idBlockAllocator);
- maoIdGenerator =
- new MatchActionOperationsIdGeneratorWithIdBlockAllocator(idBlockAllocator);
+ maIdGenerator = matchActionService.getMatchActionIdGenerator();
+ maoIdGenerator = matchActionService.getMatchActionOperationsIdGenerator();
flowMap = new SharedFlowMap(sharedCollectionService);
flowBatchMap = new SharedFlowBatchMap(sharedCollectionService);
diff --git a/src/main/java/net/onrc/onos/core/matchaction/MatchActionFloodlightService.java b/src/main/java/net/onrc/onos/core/matchaction/MatchActionFloodlightService.java
new file mode 100644
index 0000000..73c9e87
--- /dev/null
+++ b/src/main/java/net/onrc/onos/core/matchaction/MatchActionFloodlightService.java
@@ -0,0 +1,10 @@
+package net.onrc.onos.core.matchaction;
+
+import net.floodlightcontroller.core.module.IFloodlightService;
+
+/**
+ * A match action service interface as {@link IFloodlightService} service.
+ */
+public interface MatchActionFloodlightService extends MatchActionService,
+ IFloodlightService {
+}
diff --git a/src/main/java/net/onrc/onos/core/matchaction/MatchActionModule.java b/src/main/java/net/onrc/onos/core/matchaction/MatchActionModule.java
index 9ed031c..78e528c 100644
--- a/src/main/java/net/onrc/onos/core/matchaction/MatchActionModule.java
+++ b/src/main/java/net/onrc/onos/core/matchaction/MatchActionModule.java
@@ -5,6 +5,7 @@
import java.util.HashSet;
import java.util.List;
import java.util.Set;
+
import net.onrc.onos.api.flowmanager.ConflictDetectionPolicy;
/**
@@ -12,7 +13,7 @@
* <p>
* TODO: Make all methods thread-safe
*/
-public class MatchActionModule implements MatchActionService {
+public class MatchActionModule implements MatchActionFloodlightService {
private final HashSet<MatchAction> currentOperations = new HashSet<>();
@@ -55,6 +56,20 @@
}
@Override
+ public MatchActionIdGenerator getMatchActionIdGenerator() {
+ // TODO Auto-generated method stub
+ // use MatchActionIdGeneratorWithIdBlockAllocator.
+ return null;
+ }
+
+ @Override
+ public MatchActionOperationsIdGenerator getMatchActionOperationsIdGenerator() {
+ // TODO Auto-generated method stub
+ // use MatchActionOperationsIdGeneratorWithIdBlockAllocator.
+ return null;
+ }
+
+ @Override
public void addEventListener(EventListener listener) {
// TODO Auto-generated method stub
diff --git a/src/main/java/net/onrc/onos/core/matchaction/MatchActionService.java b/src/main/java/net/onrc/onos/core/matchaction/MatchActionService.java
index a905e09..161ed91 100644
--- a/src/main/java/net/onrc/onos/core/matchaction/MatchActionService.java
+++ b/src/main/java/net/onrc/onos/core/matchaction/MatchActionService.java
@@ -47,6 +47,20 @@
ConflictDetectionPolicy getConflictDetectionPolicy();
/**
+ * Gets the ID generator for MatchActionId.
+ *
+ * @return the ID generator for MatchActionId
+ */
+ MatchActionIdGenerator getMatchActionIdGenerator();
+
+ /**
+ * Gets the ID generator for MatchActionOperationsId.
+ *
+ * @return the ID generator for MatchActionOperationsId
+ */
+ MatchActionOperationsIdGenerator getMatchActionOperationsIdGenerator();
+
+ /**
* Adds event listener to this service.
*
* @param listener EventListener to be added.