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.NotificationProviderService;
11 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.lldp.discovery.config.rev160511.TopologyLldpDiscoveryConfig;
12 import org.opendaylight.yangtools.concepts.ListenerRegistration;
13 import org.opendaylight.yangtools.yang.binding.NotificationListener;
14 import org.slf4j.Logger;
15 import org.slf4j.LoggerFactory;
17 public class LLDPActivator implements AutoCloseable {
18 private static final Logger LOG = LoggerFactory.getLogger(LLDPActivator.class);
20 private static String lldpSecureKey;
22 private final ListenerRegistration<NotificationListener> lldpNotificationRegistration;
24 public LLDPActivator(NotificationProviderService notificationService, LLDPDiscoveryListener lldpDiscoveryListener,
25 TopologyLldpDiscoveryConfig topologyLldpDiscoveryConfig) {
26 lldpSecureKey = topologyLldpDiscoveryConfig.getLldpSecureKey();
28 LOG.info("Starting LLDPActivator with lldpSecureKey: {}", lldpSecureKey);
30 lldpNotificationRegistration = notificationService.registerNotificationListener(lldpDiscoveryListener);
32 LOG.info("LLDPDiscoveryListener started.");
37 lldpNotificationRegistration.close();
39 LOG.info("LLDPDiscoveryListener stopped.");
42 public static String getLldpSecureKey() {