Merge "CHanger for interface mgr as provider, new commit."
[vpnservice.git] / interfacemgr / interfacemgr-impl / src / main / java / org / opendaylight / vpnservice / interfacemgr / InterfacemgrProvider.java
index a3d4e7324c880df0d2cd9af45303f30cb6eac75e..ab30a083bf94dd5aa17d389603eb0dbdbbad47cc 100644 (file)
@@ -7,23 +7,38 @@
  */
 package org.opendaylight.vpnservice.interfacemgr;
 
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
 import org.opendaylight.controller.sal.binding.api.BindingAwareProvider;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.opendaylight.vpnservice.interfacemgr.interfaces.IInterfaceManager;
 
-public class InterfacemgrProvider implements BindingAwareProvider, AutoCloseable {
+public class InterfacemgrProvider implements BindingAwareProvider, AutoCloseable, IInterfaceManager {
 
     private static final Logger LOG = LoggerFactory.getLogger(InterfacemgrProvider.class);
 
+    private InterfaceManager interfaceManager;
+
     @Override
     public void onSessionInitiated(ProviderContext session) {
         LOG.info("InterfacemgrProvider Session Initiated");
+        try {
+            final  DataBroker dataBroker = session.getSALService(DataBroker.class);
+            interfaceManager = new InterfaceManager(dataBroker);
+        } catch (Exception e) {
+            LOG.error("Error initializing services", e);
+        }
     }
 
     @Override
     public void close() throws Exception {
         LOG.info("InterfacemgrProvider Closed");
+        interfaceManager.close();
     }
 
-}
+    @Override
+    public void testApi() {
+        LOG.debug("Testing interface mgr api");
+    }
+}
\ No newline at end of file