2 * Copyright (c) 2017 Cisco Systems. 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.groupbasedpolicy.renderer.vpp.lisp.info.container.states;
10 import java.util.ArrayList;
11 import java.util.HashMap;
12 import java.util.List;
14 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
17 * Created by Shakib Ahmed on 7/17/17.
19 public class RouteState {
20 private HashMap<Ipv4Address, Long> ipToRouteIdMapper;
23 ipToRouteIdMapper = new HashMap<>();
26 public boolean ipExists(Ipv4Address ip) {
27 return ipToRouteIdMapper.containsKey(ip);
30 public void addIpToRouteIdInfo(Ipv4Address ip, Long routeId) {
31 ipToRouteIdMapper.put(ip, routeId);
34 public long getRouteId(Ipv4Address ip) {
35 return ipToRouteIdMapper.get(ip);
38 public void removeIp(Ipv4Address ip) {
39 ipToRouteIdMapper.remove(ip);
42 public boolean hasNoIpRoutes() {
43 return ipToRouteIdMapper.isEmpty();
46 public List<Ipv4Address> getAllIps() {
47 return new ArrayList<>(ipToRouteIdMapper.keySet());
50 @Override public String toString() {
51 return "RouteState{" + "ipToRouteIdMapper=" + ipToRouteIdMapper + '}';