blob: eaf7a3983e6d92b787e8d57b08becb67ede7fd3c [file] [log] [blame]
Toshio Koidea03915e2014-07-01 18:39:52 -07001package net.onrc.onos.core.matchaction;
2
Ray Milkey18b44ac2014-08-22 08:29:47 -07003import net.floodlightcontroller.core.IFloodlightProviderService;
4import net.floodlightcontroller.core.module.FloodlightModuleContext;
5import net.floodlightcontroller.core.module.FloodlightModuleException;
6import net.floodlightcontroller.core.module.IFloodlightModule;
7import net.floodlightcontroller.core.module.IFloodlightService;
8import net.onrc.onos.api.flowmanager.ConflictDetectionPolicy;
9import net.onrc.onos.core.datagrid.IDatagridService;
10import net.onrc.onos.core.flowprogrammer.IFlowPusherService;
11import net.onrc.onos.core.util.IdGenerator;
12import org.slf4j.Logger;
13import org.slf4j.LoggerFactory;
14
15import java.util.ArrayList;
16import java.util.Collection;
Toshio Koidea03915e2014-07-01 18:39:52 -070017import java.util.EventListener;
Ray Milkey18b44ac2014-08-22 08:29:47 -070018import java.util.HashMap;
Ray Milkeyc127a5a2014-08-20 11:22:12 -070019import java.util.HashSet;
20import java.util.List;
Ray Milkey18b44ac2014-08-22 08:29:47 -070021import java.util.Map;
Brian O'Connordee2e6b2014-08-12 11:34:51 -070022import java.util.Set;
Toshio Koide77ec9982014-08-27 16:57:43 -070023
Toshio Koidea03915e2014-07-01 18:39:52 -070024/**
Ray Milkey18b44ac2014-08-22 08:29:47 -070025 * Floodlight module for Match Action service.
Toshio Koidea03915e2014-07-01 18:39:52 -070026 */
Ray Milkey18b44ac2014-08-22 08:29:47 -070027
28public class MatchActionModule implements MatchActionFloodlightService, IFloodlightModule {
Toshio Koidea03915e2014-07-01 18:39:52 -070029
Ray Milkeyc127a5a2014-08-20 11:22:12 -070030 private final HashSet<MatchAction> currentOperations = new HashSet<>();
Ray Milkey18b44ac2014-08-22 08:29:47 -070031 private static final Logger log = LoggerFactory
32 .getLogger(MatchActionModule.class);
33 private MatchActionComponent matchActionComponent;
Ray Milkeyc127a5a2014-08-20 11:22:12 -070034
Ray Milkey18b44ac2014-08-22 08:29:47 -070035
36
37
38
39 @Override
40 public Collection<Class<? extends IFloodlightService>> getModuleServices() {
41 List<Class<? extends IFloodlightService>> services = new ArrayList<>();
42 log.info("get module services");
43 services.add(MatchActionFloodlightService.class);
44 return services;
45 }
46
47 @Override
48 public Map<Class<? extends IFloodlightService>, IFloodlightService> getServiceImpls() {
49 Map<Class<? extends IFloodlightService>, IFloodlightService> impls =
50 new HashMap<>();
51 impls.put(MatchActionFloodlightService.class, this);
52 return impls;
53 }
54
55 @Override
56 public Collection<Class<? extends IFloodlightService>> getModuleDependencies() {
57 List<Class<? extends IFloodlightService>> dependencies = new ArrayList<>();
58 dependencies.add(IDatagridService.class);
59 dependencies.add(IFlowPusherService.class);
60 dependencies.add(IFloodlightProviderService.class);
61 return dependencies;
62 }
63
64 @Override
65 public void init(FloodlightModuleContext context) throws FloodlightModuleException {
66
67 }
68
69 @Override
70 public void startUp(FloodlightModuleContext context) throws FloodlightModuleException {
71 final IDatagridService datagrid = context.getServiceImpl(IDatagridService.class);
72 final IFlowPusherService pusher = context.getServiceImpl(IFlowPusherService.class);
73 final IFloodlightProviderService provider = context.getServiceImpl(IFloodlightProviderService.class);
74
75 matchActionComponent = new MatchActionComponent(datagrid, pusher, provider);
76 log.info("match action component created");
77 matchActionComponent.start();
Ray Milkeyc127a5a2014-08-20 11:22:12 -070078 }
79
Toshio Koidea03915e2014-07-01 18:39:52 -070080 @Override
81 public boolean addMatchAction(MatchAction matchAction) {
Ray Milkey18b44ac2014-08-22 08:29:47 -070082 return matchActionComponent.addMatchAction(matchAction);
Toshio Koidea03915e2014-07-01 18:39:52 -070083 }
84
85 @Override
Brian O'Connordee2e6b2014-08-12 11:34:51 -070086 public Set<MatchAction> getMatchActions() {
Ray Milkey18b44ac2014-08-22 08:29:47 -070087 return null;
Toshio Koidea03915e2014-07-01 18:39:52 -070088 }
89
90 @Override
Ray Milkey18b44ac2014-08-22 08:29:47 -070091 public boolean executeOperations(MatchActionOperations operations) {
92 return false;
Toshio Koidea03915e2014-07-01 18:39:52 -070093 }
94
95 @Override
96 public void setConflictDetectionPolicy(ConflictDetectionPolicy policy) {
Toshio Koidea03915e2014-07-01 18:39:52 -070097
98 }
99
100 @Override
101 public ConflictDetectionPolicy getConflictDetectionPolicy() {
Toshio Koidea03915e2014-07-01 18:39:52 -0700102 return null;
103 }
104
105 @Override
Sho SHIMIZU7cd8a422014-08-27 16:05:21 -0700106 public IdGenerator<MatchActionId> getMatchActionIdGenerator() {
Toshio Koide77ec9982014-08-27 16:57:43 -0700107 // TODO Auto-generated method stub
108 // use MatchActionIdGeneratorWithIdBlockAllocator.
109 return null;
110 }
111
112 @Override
Sho SHIMIZU7cd8a422014-08-27 16:05:21 -0700113 public IdGenerator<MatchActionOperationsId> getMatchActionOperationsIdGenerator() {
Toshio Koide77ec9982014-08-27 16:57:43 -0700114 // TODO Auto-generated method stub
115 // use MatchActionOperationsIdGeneratorWithIdBlockAllocator.
116 return null;
117 }
118
119 @Override
Toshio Koidea03915e2014-07-01 18:39:52 -0700120 public void addEventListener(EventListener listener) {
Toshio Koidea03915e2014-07-01 18:39:52 -0700121
122 }
123
124 @Override
125 public void removeEventListener(EventListener listener) {
Toshio Koidea03915e2014-07-01 18:39:52 -0700126
127 }
128}