alshabib | 1cc04f7 | 2014-09-16 16:09:58 -0700 | [diff] [blame^] | 1 | package org.onlab.onos.provider.of.flow.impl; |
| 2 | |
| 3 | import static org.slf4j.LoggerFactory.getLogger; |
| 4 | |
| 5 | import org.apache.felix.scr.annotations.Activate; |
| 6 | import org.apache.felix.scr.annotations.Component; |
| 7 | import org.apache.felix.scr.annotations.Deactivate; |
| 8 | import org.apache.felix.scr.annotations.Reference; |
| 9 | import org.apache.felix.scr.annotations.ReferenceCardinality; |
| 10 | import org.onlab.onos.net.DeviceId; |
| 11 | import org.onlab.onos.net.flow.FlowEntry; |
| 12 | import org.onlab.onos.net.flow.FlowRule; |
| 13 | import org.onlab.onos.net.flow.FlowRuleProvider; |
| 14 | import org.onlab.onos.net.flow.FlowRuleProviderRegistry; |
| 15 | import org.onlab.onos.net.flow.FlowRuleProviderService; |
| 16 | import org.onlab.onos.net.provider.AbstractProvider; |
| 17 | import org.onlab.onos.net.provider.ProviderId; |
| 18 | import org.onlab.onos.net.topology.TopologyService; |
| 19 | import org.onlab.onos.of.controller.OpenFlowController; |
| 20 | import org.slf4j.Logger; |
| 21 | |
| 22 | /** |
| 23 | * Provider which uses an OpenFlow controller to detect network |
| 24 | * end-station hosts. |
| 25 | */ |
| 26 | @Component(immediate = true) |
| 27 | public class OpenFlowRuleProvider extends AbstractProvider implements FlowRuleProvider { |
| 28 | |
| 29 | private final Logger log = getLogger(getClass()); |
| 30 | |
| 31 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 32 | protected FlowRuleProviderRegistry providerRegistry; |
| 33 | |
| 34 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 35 | protected OpenFlowController controller; |
| 36 | |
| 37 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 38 | protected TopologyService topologyService; |
| 39 | |
| 40 | private FlowRuleProviderService providerService; |
| 41 | |
| 42 | /** |
| 43 | * Creates an OpenFlow host provider. |
| 44 | */ |
| 45 | public OpenFlowRuleProvider() { |
| 46 | super(new ProviderId("org.onlab.onos.provider.openflow")); |
| 47 | } |
| 48 | |
| 49 | @Activate |
| 50 | public void activate() { |
| 51 | providerService = providerRegistry.register(this); |
| 52 | log.info("Started"); |
| 53 | } |
| 54 | |
| 55 | @Deactivate |
| 56 | public void deactivate() { |
| 57 | providerRegistry.unregister(this); |
| 58 | providerService = null; |
| 59 | |
| 60 | log.info("Stopped"); |
| 61 | } |
| 62 | @Override |
| 63 | public void applyFlowRule(FlowRule... flowRules) { |
| 64 | // TODO Auto-generated method stub |
| 65 | |
| 66 | } |
| 67 | |
| 68 | @Override |
| 69 | public void removeFlowRule(FlowRule... flowRules) { |
| 70 | // TODO Auto-generated method stub |
| 71 | |
| 72 | } |
| 73 | |
| 74 | @Override |
| 75 | public Iterable<FlowEntry> getFlowMetrics(DeviceId deviceId) { |
| 76 | // TODO Auto-generated method stub |
| 77 | return null; |
| 78 | } |
| 79 | |
| 80 | |
| 81 | //TODO: InternalFlowRuleProvider listening to stats and error and flowremoved. |
| 82 | // possibly barriers as well. May not be internal at all... |
| 83 | |
| 84 | |
| 85 | } |