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.arputil.internal;
10 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
11 import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
12 import org.opendaylight.controller.md.sal.binding.api.NotificationService;
13 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
14 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
15 import org.opendaylight.controller.sal.binding.api.BindingAwareProvider;
16 import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
17 import org.opendaylight.vpnservice.mdsalutil.interfaces.IMdsalApiManager;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.PacketProcessingService;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.arputil.rev151126.OdlArputilService;
20 import org.slf4j.Logger;
21 import org.slf4j.LoggerFactory;
23 public class ArpUtilProvider implements BindingAwareProvider, AutoCloseable {
25 private static final Logger s_logger = LoggerFactory.getLogger(ArpUtilProvider.class);
27 RpcProviderRegistry rpcProviderRegistry;
29 NotificationService notificationService;
31 NotificationPublishService notificationPublishService;
33 ArpUtilImpl arpManager;
35 IMdsalApiManager mdsalApiManager;
37 BindingAwareBroker.RpcRegistration<OdlArputilService> rpcRegistration;
39 public ArpUtilProvider(RpcProviderRegistry rpcRegistry,
40 NotificationPublishService publishService,
41 NotificationService notificationService,
42 IMdsalApiManager iMdsalApiManager) {
44 this.rpcProviderRegistry = rpcRegistry;
45 this.mdsalApiManager = iMdsalApiManager;
46 this.notificationPublishService = publishService;
47 this.notificationService = notificationService;
50 public ArpUtilProvider() {
54 public void onSessionInitiated(final ProviderContext session){
56 s_logger.info( " Session Initiated for Arp Provider") ;
59 DataBroker dataBroker = session.getSALService(DataBroker.class);
60 PacketProcessingService packetProcessingService =
61 session.getRpcService(PacketProcessingService.class);
63 arpManager = new ArpUtilImpl( dataBroker, packetProcessingService,
64 notificationPublishService, notificationService,
67 rpcRegistration = rpcProviderRegistry.
68 addRpcImplementation(OdlArputilService.class, arpManager);
69 s_logger.info( " Session Initialized for Arp Provider") ;
70 }catch( Exception e) {
71 s_logger.error( "Error initializing Arp " , e );
76 public void close() throws Exception {
77 rpcRegistration.close();
79 s_logger.info("ArpManager Manager Closed");