X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=vpnmanager-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fvpnservice%2FVpnserviceProvider.java;h=84b18382729ab885674c994e7216cd2eb427bf80;hb=272200b362c916ee5af9fa07a5dcd34c1b4a10b6;hp=ef4223ff91e7635c4c19ce9ffa0be295cb0208b0;hpb=0a00e953f7ba69a8fce3aee9fc30e39a84999f62;p=vpnservice.git diff --git a/vpnmanager-impl/src/main/java/org/opendaylight/vpnservice/VpnserviceProvider.java b/vpnmanager-impl/src/main/java/org/opendaylight/vpnservice/VpnserviceProvider.java index ef4223ff..84b18382 100644 --- a/vpnmanager-impl/src/main/java/org/opendaylight/vpnservice/VpnserviceProvider.java +++ b/vpnmanager-impl/src/main/java/org/opendaylight/vpnservice/VpnserviceProvider.java @@ -1,29 +1,41 @@ -/* - * Copyright (c) 2015 Ericsson India Global Services Pvt Ltd. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.vpnservice; - -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; - -public class VpnserviceProvider implements BindingAwareProvider, AutoCloseable { - - private static final Logger LOG = LoggerFactory.getLogger(VpnserviceProvider.class); - - @Override - public void onSessionInitiated(ProviderContext session) { - LOG.info("VpnserviceProvider Session Initiated"); - } - - @Override - public void close() throws Exception { - LOG.info("VpnserviceProvider Closed"); - } - -} +/* + * Copyright (c) 2015 Ericsson India Global Services Pvt Ltd. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +package org.opendaylight.vpnservice; + +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; + +public class VpnserviceProvider implements BindingAwareProvider, + AutoCloseable { + + private static final Logger LOG = LoggerFactory.getLogger(VpnserviceProvider.class); + private VpnInterfaceManager vpnInterfaceManager; + private VpnManager vpnManager; + + @Override + public void onSessionInitiated(ProviderContext session) { + LOG.info("VpnserviceProvider Session Initiated"); + try { + final DataBroker dataBroker = session.getSALService(DataBroker.class); + vpnManager = new VpnManager(dataBroker); + vpnInterfaceManager = new VpnInterfaceManager(dataBroker); + } catch (Exception e) { + LOG.error("Error initializing services", e); + } + } + + @Override + public void close() throws Exception { + vpnManager.close(); + vpnInterfaceManager.close(); + } +}