[ONOS-3855] - Implement BGP flow spec provider framework
Change-Id: I356a1f80790d9fa08aea9bcbf635a8b11c7ccac7
diff --git a/providers/bgp/flow/src/main/java/org/onosproject/provider/bgp/flow/impl/BgpFlowRuleProvider.java b/providers/bgp/flow/src/main/java/org/onosproject/provider/bgp/flow/impl/BgpFlowRuleProvider.java
new file mode 100755
index 0000000..274669c
--- /dev/null
+++ b/providers/bgp/flow/src/main/java/org/onosproject/provider/bgp/flow/impl/BgpFlowRuleProvider.java
@@ -0,0 +1,110 @@
+/*
+ * Copyright 2016 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.provider.bgp.flow.impl;
+
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Deactivate;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.ReferenceCardinality;
+import org.onosproject.bgp.controller.BgpController;
+import org.onosproject.cfg.ComponentConfigService;
+import org.onosproject.core.ApplicationId;
+import org.onosproject.net.flow.FlowRule;
+import org.onosproject.net.flow.FlowRuleBatchOperation;
+import org.onosproject.net.flow.FlowRuleProvider;
+import org.onosproject.net.flow.FlowRuleProviderRegistry;
+import org.onosproject.net.flow.FlowRuleProviderService;
+import org.onosproject.net.provider.AbstractProvider;
+import org.onosproject.net.provider.ProviderId;
+import org.osgi.service.component.ComponentContext;
+import org.slf4j.Logger;
+
+import static org.slf4j.LoggerFactory.getLogger;
+
+/**
+ * Bgp Flow provider.
+ */
+@Component(immediate = true)
+public class BgpFlowRuleProvider extends AbstractProvider
+ implements FlowRuleProvider {
+
+ private final Logger log = getLogger(getClass());
+
+ @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ protected FlowRuleProviderRegistry providerRegistry;
+
+ @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ protected ComponentConfigService cfgService;
+
+ @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ protected BgpController bgpController;
+
+ private FlowRuleProviderService providerService;
+
+ /**
+ * Creates an BgpFlow host provider.
+ */
+ public BgpFlowRuleProvider() {
+ super(new ProviderId("bgp", "org.onosproject.provider.bgp"));
+ }
+
+ @Activate
+ public void activate(ComponentContext context) {
+ cfgService.registerProperties(getClass());
+ providerService = providerRegistry.register(this);
+ }
+
+ @Deactivate
+ public void deactivate(ComponentContext context) {
+ cfgService.unregisterProperties(getClass(), false);
+ providerRegistry.unregister(this);
+ providerService = null;
+ }
+
+ @Override
+ public void applyFlowRule(FlowRule... flowRules) {
+ for (FlowRule flowRule : flowRules) {
+ applyRule(flowRule);
+ }
+ }
+
+ private void applyRule(FlowRule flowRule) {
+ //TODO
+ }
+
+ @Override
+ public void removeFlowRule(FlowRule... flowRules) {
+ for (FlowRule flowRule : flowRules) {
+ removeRule(flowRule);
+ }
+ }
+
+ private void removeRule(FlowRule flowRule) {
+ //TODO
+ }
+
+ @Override
+ public void removeRulesById(ApplicationId id, FlowRule... flowRules) {
+ // TODO
+ removeFlowRule(flowRules);
+ }
+
+ @Override
+ public void executeBatch(FlowRuleBatchOperation batch) {
+ //TODO
+ }
+}
diff --git a/providers/bgp/flow/src/main/java/org/onosproject/provider/bgp/flow/impl/package-info.java b/providers/bgp/flow/src/main/java/org/onosproject/provider/bgp/flow/impl/package-info.java
new file mode 100755
index 0000000..34f4958
--- /dev/null
+++ b/providers/bgp/flow/src/main/java/org/onosproject/provider/bgp/flow/impl/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2016 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Bgp Flow provider.
+ */
+package org.onosproject.provider.bgp.flow.impl;