2 * Copyright © 2015, 2018 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.netvirt.dhcpservice;
10 import java.util.concurrent.ConcurrentHashMap;
11 import javax.annotation.Nonnull;
12 import javax.annotation.Nullable;
13 import javax.annotation.PostConstruct;
14 import javax.inject.Singleton;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.ports.attributes.ports.Port;
17 import org.slf4j.Logger;
18 import org.slf4j.LoggerFactory;
21 public class DhcpPortCache {
23 private static final Logger LOG = LoggerFactory.getLogger(DhcpPortCache.class);
24 private final ConcurrentHashMap<String, Port> portMap = new ConcurrentHashMap<>();
28 LOG.trace("Initialize DhcpPortCache. ");
31 public void put(@Nonnull String interfaceName, Port port) {
32 portMap.put(interfaceName, port);
33 LOG.trace("Added the interface {} to DhcpPortCache",interfaceName);
37 public Port get(@Nonnull String interfaceName) {
38 return portMap.get(interfaceName);
41 public void remove(@Nonnull String interfaceName) {
42 portMap.remove(interfaceName);