Simplify overlay information mappers and managers
[groupbasedpolicy.git] / renderers / vpp / src / main / java / org / opendaylight / groupbasedpolicy / renderer / vpp / lisp / info / container / states / VrfState.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 org.apache.commons.lang3.mutable.MutableLong;
11 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
12
13 /**
14  * Created by Shakib Ahmed on 7/17/17.
15  */
16 public class VrfState {
17     private SubnetHolder subnetHolder;
18     private String protocolName;
19     private MutableLong nextRouteId;
20
21     public VrfState(String routingProtocolName) {
22         this.subnetHolder = new SubnetHolder();
23         this.protocolName = routingProtocolName;
24         this.nextRouteId = new MutableLong(1L);
25     }
26
27     public SubnetHolder getSubnetHolder() {
28         return subnetHolder;
29     }
30
31     public String getProtocolName() {
32         return protocolName;
33     }
34
35     public long getNextRouteId() {
36         return nextRouteId.getValue();
37     }
38
39     public void addNewPortIpInVrf(String portSubnetUuid, Ipv4Address portIp) {
40         subnetHolder.getSubnetState(portSubnetUuid).addNewIp(portIp);
41         nextRouteId.increment();
42     }
43
44     public void removePortIpFromVrf(String portSubnetUuid, Ipv4Address portIp) {
45         subnetHolder.getSubnetState(portSubnetUuid).removeIp(portIp);
46     }
47 }