ConfigFlowRuleProgrammable

- FlowRuleProgrammable implementation which acts as it has accepted any FlowRule request.

-- To be used for a device which exist in-line transparently (e.g., Amplifier ONOS-6067)

Change-Id: Ief09297eb900b804b1c8eb4d6705bbad85a552ad
diff --git a/drivers/optical/src/main/java/org/onosproject/drivers/optical/OpticalDriversLoader.java b/drivers/optical/src/main/java/org/onosproject/drivers/optical/OpticalDriversLoader.java
index 89872e4..4c1dc4f 100644
--- a/drivers/optical/src/main/java/org/onosproject/drivers/optical/OpticalDriversLoader.java
+++ b/drivers/optical/src/main/java/org/onosproject/drivers/optical/OpticalDriversLoader.java
@@ -16,10 +16,24 @@
 
 package org.onosproject.drivers.optical;
 
+import static org.onosproject.net.config.basics.SubjectFactories.DEVICE_SUBJECT_FACTORY;
+
+import java.util.List;
+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.driver.optical.config.FlowTableConfig;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.config.ConfigFactory;
+import org.onosproject.net.config.NetworkConfigRegistry;
+import org.onosproject.net.config.NetworkConfigRegistryAdapter;
 import org.onosproject.net.driver.AbstractDriverLoader;
 import org.onosproject.net.optical.OpticalDevice;
 
+import com.google.common.collect.ImmutableList;
+
 /**
  * Loader for other optical device drivers.
  */
@@ -30,7 +44,40 @@
     @SuppressWarnings("unused")
     private OpticalDevice optical;
 
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected NetworkConfigRegistry registry = new NetworkConfigRegistryAdapter();
+
+
+
+    private final List<ConfigFactory> factories = ImmutableList.of(
+         new ConfigFactory<DeviceId, FlowTableConfig>(DEVICE_SUBJECT_FACTORY,
+                 FlowTableConfig.class,
+                 FlowTableConfig.CONFIG_KEY) {
+             @Override
+             public FlowTableConfig createConfig() {
+                 return new FlowTableConfig();
+             }
+
+         });
+
+
     public OpticalDriversLoader() {
         super("/optical-drivers.xml");
     }
+
+    @Activate
+    @Override
+    protected void activate() {
+        factories.forEach(registry::registerConfigFactory);
+
+        super.activate();
+    }
+
+    @Deactivate
+    @Override
+    protected void deactivate() {
+        factories.forEach(registry::unregisterConfigFactory);
+        super.deactivate();
+    }
+
 }