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; |
| 8 | import net.onrc.onos.core.registry.IControllerRegistryService; |
| 9 | |
| 10 | import java.util.ArrayList; |
| 11 | import java.util.Collection; |
| 12 | import java.util.List; |
| 13 | import java.util.Map; |
| 14 | |
| 15 | /** |
| 16 | * Floodlight module to add the REST APIs for Metrics. |
| 17 | */ |
| 18 | public class OnosMetricsModule implements IFloodlightModule { |
| 19 | |
| 20 | private IRestApiService restApi; |
| 21 | |
| 22 | @Override |
| 23 | public Collection<Class<? extends IFloodlightService>> getModuleServices() { |
| 24 | return null; |
| 25 | } |
| 26 | |
| 27 | @Override |
| 28 | public Map<Class<? extends IFloodlightService>, IFloodlightService> |
| 29 | getServiceImpls() { |
| 30 | return null; |
| 31 | } |
| 32 | |
| 33 | @Override |
| 34 | public Collection<Class<? extends IFloodlightService>> getModuleDependencies() { |
| 35 | List<Class<? extends IFloodlightService>> dependencies = |
| 36 | new ArrayList<>(); |
| 37 | dependencies.add(IControllerRegistryService.class); |
| 38 | dependencies.add(IRestApiService.class); |
| 39 | return dependencies; |
| 40 | } |
| 41 | |
| 42 | @Override |
| 43 | public void init(FloodlightModuleContext context) |
| 44 | throws FloodlightModuleException { |
| 45 | restApi = context.getServiceImpl(IRestApiService.class); |
| 46 | } |
| 47 | |
| 48 | @Override |
| 49 | public void startUp(FloodlightModuleContext context) { |
| 50 | restApi.addRestletRoutable(new MetricsWebRoutable()); |
| 51 | } |
| 52 | } |
| 53 | |