2 * Copyright (c) 2016 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
9 package org.opendaylight.vpnservice.itm.impl;
11 import java.util.Collection;
12 import java.util.HashMap;
14 import java.util.concurrent.ConcurrentHashMap;
16 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.vpnservice.itm.op.rev150701.external.tunnel.list.ExternalTunnel;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.vpnservice.itm.op.rev150701.tunnel.list.InternalTunnel;
20 public class ItmCache {
21 private ConcurrentHashMap<String, Interface> interfaces = null;
22 private ConcurrentHashMap<String, ExternalTunnel> externalTunnels = null;
23 private ConcurrentHashMap<String, InternalTunnel> internalTunnels = null;
26 this.interfaces = new ConcurrentHashMap<>();
27 this.internalTunnels = new ConcurrentHashMap<>();
28 this.externalTunnels = new ConcurrentHashMap<>();
31 public void addInterface(Interface iface) {
32 this.interfaces.put(iface.getName(), iface);
35 public Interface getInterface(String name) {
36 return this.interfaces.get(name);
39 public Interface removeInterface(String name) {
40 return this.interfaces.remove(name);
43 public Collection<Interface> getAllInterfaces() {
44 return this.interfaces.values();
47 public void addExternalTunnel(ExternalTunnel tunnel) {
48 this.externalTunnels.put(tunnel.getTunnelInterfaceName(), tunnel);
51 public ExternalTunnel getExternalTunnel(String name) {
52 return this.externalTunnels.get(name);
55 public ExternalTunnel removeExternalTunnel(String name) {
56 return this.externalTunnels.remove(name);
59 public void addInternalTunnel(InternalTunnel tunnel) {
60 this.internalTunnels.put(tunnel.getTunnelInterfaceName(), tunnel);
63 public InternalTunnel getInternalTunnel(String name) {
64 return this.internalTunnels.get(name);
67 public InternalTunnel removeInternalTunnel(String name) {
68 return this.internalTunnels.remove(name);