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;
10 import java.util.Collections;
12 import org.opendaylight.bgpmanager.api.IBgpManager;
13 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
14 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
15 import org.opendaylight.controller.sal.binding.api.BindingAwareProvider;
16 import org.opendaylight.vpnservice.interfacemgr.interfaces.IInterfaceManager;
17 import org.opendaylight.vpnservice.mdsalutil.interfaces.IMdsalApiManager;
18 import org.slf4j.Logger;
19 import org.slf4j.LoggerFactory;
21 public class VpnserviceProvider implements BindingAwareProvider,
24 private static final Logger LOG = LoggerFactory.getLogger(VpnserviceProvider.class);
25 private VpnInterfaceManager vpnInterfaceManager;
26 private VpnManager vpnManager;
27 private IBgpManager bgpManager;
28 private IMdsalApiManager mdsalManager;
29 private IInterfaceManager interfaceManager;
32 public void onSessionInitiated(ProviderContext session) {
33 LOG.info("VpnserviceProvider Session Initiated");
35 final DataBroker dataBroker = session.getSALService(DataBroker.class);
36 vpnManager = new VpnManager(dataBroker, bgpManager);
37 vpnInterfaceManager = new VpnInterfaceManager(dataBroker, bgpManager);
38 vpnInterfaceManager.setMdsalManager(mdsalManager);
39 } catch (Exception e) {
40 LOG.error("Error initializing services", e);
44 public void setBgpManager(IBgpManager bgpManager) {
45 LOG.debug("BGP Manager reference initialized");
46 this.bgpManager = bgpManager;
49 public void setMdsalManager(IMdsalApiManager mdsalManager) {
50 this.mdsalManager = mdsalManager;
53 public void setInterfaceManager(IInterfaceManager interfaceManager) {
54 this.interfaceManager = interfaceManager;
58 public void close() throws Exception {
60 vpnInterfaceManager.close();