2 * Copyright (c) 2013 Cisco Systems, Inc. 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.openflowplugin.applications.topology.lldp;
10 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
11 import org.opendaylight.controller.sal.binding.api.BindingAwareProvider;
12 import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
13 import org.opendaylight.controller.sal.binding.api.data.DataProviderService;
14 import org.slf4j.Logger;
15 import org.slf4j.LoggerFactory;
17 public class LLDPActivator implements BindingAwareProvider, AutoCloseable {
18 private static final Logger LOG = LoggerFactory.getLogger(LLDPActivator.class);
19 private static LLDPDiscoveryProvider provider = new LLDPDiscoveryProvider();
20 private static String lldpSecureKey;
22 public LLDPActivator(String secureKey) {
23 lldpSecureKey = secureKey;
26 public void onSessionInitiated(final ProviderContext session) {
27 DataProviderService dataService = session.<DataProviderService>getSALService(DataProviderService.class);
28 provider.setDataService(dataService);
29 NotificationProviderService notificationService = session.<NotificationProviderService>getSALService(NotificationProviderService.class);
30 provider.setNotificationService(notificationService);
35 public void close() throws Exception {
36 if(provider != null) {
39 } catch (Exception e) {
40 LOG.warn("Exception when closing down topology-lldp-discovery",e);
45 public static String getLldpSecureKey() {