[ONOS-3855] - Implement BGP flow spec provider framework

Change-Id: I356a1f80790d9fa08aea9bcbf635a8b11c7ccac7
diff --git a/providers/bgp/flow/pom.xml b/providers/bgp/flow/pom.xml
new file mode 100755
index 0000000..1d3c5c7
--- /dev/null
+++ b/providers/bgp/flow/pom.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Copyright 2014 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.
+  -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.onosproject</groupId>
+        <artifactId>onos-bgp-providers</artifactId>
+        <version>1.5.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>onos-bgp-provider-flow</artifactId>
+    <packaging>bundle</packaging>
+
+    <description>ONOS BGP protocol flow provider</description>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.compendium</artifactId>
+        </dependency>
+    </dependencies>
+</project>
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;
diff --git a/providers/bgp/pom.xml b/providers/bgp/pom.xml
index 699d560..7f8e6a5 100755
--- a/providers/bgp/pom.xml
+++ b/providers/bgp/pom.xml
@@ -28,6 +28,7 @@
   	<module>topology</module>
         <module>cfg</module>
   	<module>app</module>
+        <module>flow</module>
   </modules>
     <dependencies>