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

org.opendaylight.lispflowmapping.neutron.mappingmanager.mappers.NeutronTenantToVniMapper Maven / Gradle / Ivy

There is a newer version: 1.13.5
Show newest version
/*
 * Copyright (c) 2017 Cisco Systems, Inc.  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.lispflowmapping.neutron.mappingmanager.mappers;

import java.util.HashMap;

/**
 * Created by Shakib Ahmed on 2/17/17.
 */
public class NeutronTenantToVniMapper {
    private HashMap neutronTenantToVniMapper;
    private long id = 1;

    public NeutronTenantToVniMapper() {
        neutronTenantToVniMapper = new HashMap<>();
    }

    public synchronized long getVni(String tenantUuid) {
        if (neutronTenantToVniMapper.containsKey(tenantUuid)) {
            return neutronTenantToVniMapper.get(tenantUuid);
        }
        neutronTenantToVniMapper.put(tenantUuid, id);
        return id++;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy