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 edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
11 import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.lldp.discovery.config.rev160511.TopologyLldpDiscoveryConfig;
13 import org.opendaylight.yangtools.concepts.ListenerRegistration;
14 import org.opendaylight.yangtools.yang.binding.NotificationListener;
15 import org.slf4j.Logger;
16 import org.slf4j.LoggerFactory;
18 public class LLDPActivator implements AutoCloseable {
19 private static final Logger LOG = LoggerFactory.getLogger(LLDPActivator.class);
21 private static String lldpSecureKey;
23 private final ListenerRegistration<NotificationListener> lldpNotificationRegistration;
25 @SuppressFBWarnings("ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD")
26 public LLDPActivator(NotificationProviderService notificationService, LLDPDiscoveryListener lldpDiscoveryListener,
27 TopologyLldpDiscoveryConfig topologyLldpDiscoveryConfig) {
28 lldpSecureKey = topologyLldpDiscoveryConfig.getLldpSecureKey();
30 LOG.info("Starting LLDPActivator with lldpSecureKey: {}", lldpSecureKey);
32 lldpNotificationRegistration = notificationService.registerNotificationListener(lldpDiscoveryListener);
34 LOG.info("LLDPDiscoveryListener started.");
39 lldpNotificationRegistration.close();
41 LOG.info("LLDPDiscoveryListener stopped.");
44 public static String getLldpSecureKey() {