All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.opendaylight.netvirt.dhcpservice.DhcpPortCache Maven / Gradle / Ivy

There is a newer version: 0.11.4
Show newest version
/*
 * Copyright © 2015, 2018 Ericsson India Global Services Pvt Ltd. and others.  All rights reserved.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
 * and is available at http://www.eclipse.org/legal/epl-v10.html
 */
package org.opendaylight.netvirt.dhcpservice;

import java.util.concurrent.ConcurrentHashMap;
import javax.annotation.PostConstruct;
import javax.inject.Singleton;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.ports.attributes.ports.Port;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@Singleton
public class DhcpPortCache {

    private static final Logger LOG = LoggerFactory.getLogger(DhcpPortCache.class);
    private final ConcurrentHashMap portMap = new ConcurrentHashMap<>();

    @PostConstruct
    public void init() {
        LOG.trace("Initialize DhcpPortCache. ");
    }

    public  void put(@NonNull  String interfaceName, Port port) {
        portMap.put(interfaceName, port);
        LOG.trace("Added the interface {} to DhcpPortCache",interfaceName);
    }

    @Nullable
    public Port get(@NonNull String interfaceName) {
        return portMap.get(interfaceName);
    }

    public void remove(@NonNull String interfaceName) {
        portMap.remove(interfaceName);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy