Lisp processing additional fixes
[groupbasedpolicy.git] / renderers / vpp / src / main / java / org / opendaylight / groupbasedpolicy / renderer / vpp / lisp / info / container / states / VrfHolder.java
1 /*
2  * Copyright (c) 2017 Cisco Systems. All rights reserved.
3  *
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
7  */
8 package org.opendaylight.groupbasedpolicy.renderer.vpp.lisp.info.container.states;
9
10 import java.util.HashMap;
11
12 /**
13  * Created by Shakib Ahmed on 7/17/17.
14  */
15 public class VrfHolder {
16     HashMap<Long, VrfState> vrfIdToVrfStateMapper;
17
18     public VrfHolder() {
19         vrfIdToVrfStateMapper = new HashMap<>();
20     }
21
22     public VrfState getVrfState(Long vrfId) {
23         return vrfIdToVrfStateMapper.get(vrfId);
24     }
25
26     public void initializeVrfState(Long vrfId, String routingProtocolName) {
27         vrfIdToVrfStateMapper.put(vrfId, new VrfState(routingProtocolName));
28     }
29
30     public VrfState removeVrfState(Long vrfId) {
31         return vrfIdToVrfStateMapper.remove(vrfId);
32     }
33
34     public boolean hasVrf(Long vrfId) {
35         return vrfIdToVrfStateMapper.containsKey(vrfId);
36     }
37
38     public int vrfStateCount() {
39         return vrfIdToVrfStateMapper.size();
40     }
41
42     @Override public String toString() {
43         return "VrfHolder{" + "vrfIdToVrfStateMapper=" + vrfIdToVrfStateMapper + '}';
44     }
45 }