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.mappers;
10 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
12 import java.util.HashMap;
13 import java.util.List;
14 import java.util.stream.Collectors;
17 * Created by Shakib Ahmed on 5/26/17.
19 public class StaticRouteInfoMapper {
20 HashMap<Ipv4Address, Long> interfaceIpToRouteIdMapper;
22 public StaticRouteInfoMapper() {
23 interfaceIpToRouteIdMapper = new HashMap<>();
26 public void addIpRouteForInterface(Ipv4Address ip, Long routingId) {
27 interfaceIpToRouteIdMapper.put(ip, routingId);
30 public boolean routeWithIpExists(Ipv4Address ip) {
31 return interfaceIpToRouteIdMapper.containsKey(ip);
34 public Long getRouteIdForIp(Ipv4Address ip) {
35 return interfaceIpToRouteIdMapper.get(ip);
38 public List<Long> getAllRoutingIds() {
39 return interfaceIpToRouteIdMapper.entrySet()
41 .map(ipv4AddressLongEntry -> ipv4AddressLongEntry.getValue())
42 .collect(Collectors.toList());