Ray Milkey | 26921af | 2014-06-30 16:27:40 -0700 | [diff] [blame] | 1 | package net.onrc.onos.core.metrics; |
| 2 | |
| 3 | import net.floodlightcontroller.core.module.FloodlightModuleContext; |
| 4 | import net.floodlightcontroller.core.module.FloodlightModuleException; |
| 5 | import net.floodlightcontroller.core.module.IFloodlightModule; |
| 6 | import net.floodlightcontroller.core.module.IFloodlightService; |
| 7 | import net.floodlightcontroller.restserver.IRestApiService; |
Ray Milkey | a34ed04 | 2014-07-17 16:19:52 -0700 | [diff] [blame] | 8 | import net.onrc.onos.core.metrics.web.MetricsWebRoutable; |
Ray Milkey | 26921af | 2014-06-30 16:27:40 -0700 | [diff] [blame] | 9 | import net.onrc.onos.core.registry.IControllerRegistryService; |
| 10 | |
| 11 | import java.util.ArrayList; |
| 12 | import java.util.Collection; |
| 13 | import java.util.List; |
| 14 | import java.util.Map; |
| 15 | |
| 16 | /** |
| 17 | * Floodlight module to add the REST APIs for Metrics. |
| 18 | */ |
| 19 | public class OnosMetricsModule implements IFloodlightModule { |
| 20 | |
| 21 | private IRestApiService restApi; |
| 22 | |
| 23 | @Override |
| 24 | public Collection<Class<? extends IFloodlightService>> getModuleServices() { |
| 25 | return null; |
| 26 | } |
| 27 | |
| 28 | @Override |
| 29 | public Map<Class<? extends IFloodlightService>, IFloodlightService> |
| 30 | getServiceImpls() { |
| 31 | return null; |
| 32 | } |
| 33 | |
| 34 | @Override |
| 35 | public Collection<Class<? extends IFloodlightService>> getModuleDependencies() { |
| 36 | List<Class<? extends IFloodlightService>> dependencies = |
| 37 | new ArrayList<>(); |
| 38 | dependencies.add(IControllerRegistryService.class); |
| 39 | dependencies.add(IRestApiService.class); |
| 40 | return dependencies; |
| 41 | } |
| 42 | |
| 43 | @Override |
| 44 | public void init(FloodlightModuleContext context) |
| 45 | throws FloodlightModuleException { |
| 46 | restApi = context.getServiceImpl(IRestApiService.class); |
| 47 | } |
| 48 | |
| 49 | @Override |
| 50 | public void startUp(FloodlightModuleContext context) { |
| 51 | restApi.addRestletRoutable(new MetricsWebRoutable()); |
| 52 | } |
| 53 | } |
| 54 | |