2 * Copyright (c) 2015 Ericsson India Global Services Pvt Ltd. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.vpnservice.interfacemgr;
10 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
11 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
12 import org.opendaylight.controller.sal.binding.api.BindingAwareProvider;
13 import org.slf4j.Logger;
14 import org.slf4j.LoggerFactory;
15 import org.opendaylight.vpnservice.interfacemgr.interfaces.IInterfaceManager;
17 public class InterfacemgrProvider implements BindingAwareProvider, AutoCloseable, IInterfaceManager {
19 private static final Logger LOG = LoggerFactory.getLogger(InterfacemgrProvider.class);
21 private InterfaceManager interfaceManager;
22 private IfmNodeConnectorListener ifmNcListener;
25 public void onSessionInitiated(ProviderContext session) {
26 LOG.info("InterfacemgrProvider Session Initiated");
28 final DataBroker dataBroker = session.getSALService(DataBroker.class);
29 interfaceManager = new InterfaceManager(dataBroker);
30 ifmNcListener = new IfmNodeConnectorListener(dataBroker, interfaceManager);
31 } catch (Exception e) {
32 LOG.error("Error initializing services", e);
34 //TODO: Make this debug
35 LOG.info("Interfacemgr services initiated");
39 public void close() throws Exception {
40 LOG.info("InterfacemgrProvider Closed");
41 interfaceManager.close();
42 ifmNcListener.close();
46 public void testApi() {
47 LOG.debug("Testing interface mgr api");