blob: db926a208ee21ee44f669e4b6c744e977fce6a00 [file] [log] [blame]
janani bf41dec32017-03-24 18:44:07 +05301/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2017-present Open Networking Foundation
janani bf41dec32017-03-24 18:44:07 +05303 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package org.onosproject.l3vpn.netl3vpn;
18
19import org.onosproject.net.DeviceId;
20
21import java.util.Map;
22
23/**
24 * Abstraction of an entity providing pool of available VPN instances
25 * its associated devices and interface information.
26 */
27public interface NetL3VpnStore {
28
29 /**
30 * Returns the freed ids that can be re-used for RD and RT generation.
31 *
32 * @return collection of freed ids
33 */
34 Iterable<Long> getFreedIdList();
35
36 /**
37 * Returns the VPN instance map available in the store.
38 *
39 * @return VPN instance map
40 */
41 Map<String, VpnInstance> getVpnInstances();
42
43 /**
44 * Returns the BGP info map available in the store.
45 *
46 * @return BGP info map
47 */
48 Map<BgpInfo, DeviceId> getBgpInfo();
49
50 /**
51 * Returns the interface information map available in the store.
52 *
53 * @return interface info map
54 */
55 Map<AccessInfo, InterfaceInfo> getInterfaceInfo();
56
57 /**
janani b9ed76be2017-08-29 19:11:33 +053058 * Returns the tunnel information map available in the store, for a device.
59 *
60 * @return tunnel info map
61 */
62 Map<DeviceId, Integer> getTunnelInfo();
63
64 /**
janani bf41dec32017-03-24 18:44:07 +053065 * Adds freed id to the freed list in the store.
66 *
67 * @param id id
68 */
69 void addIdToFreeList(Long id);
70
71 /**
72 * Adds the VPN name and the VPN instance, if the map does'nt have the
73 * value with it.
74 *
75 * @param name VPN name
76 * @param instance VPN instance
77 */
78 void addVpnInsIfAbsent(String name, VpnInstance instance);
79
80 /**
janani b36b1d772017-03-27 15:01:28 +053081 * Adds the VPN name and the VPN instance to the map.
82 *
83 * @param name VPN name
84 * @param instance VPN instance
85 */
86 void addVpnIns(String name, VpnInstance instance);
87
88 /**
janani bf41dec32017-03-24 18:44:07 +053089 * Adds the access info and the interface info to the map in store.
90 *
91 * @param accessInfo access info
92 * @param intInfo interface info
93 */
94 void addInterfaceInfo(AccessInfo accessInfo, InterfaceInfo intInfo);
95
96 /**
97 * Adds the BGP info and the device id to the map in store.
98 *
99 * @param bgpInfo BGP info
100 * @param devId device id
101 */
102 void addBgpInfo(BgpInfo bgpInfo, DeviceId devId);
103
104 /**
janani b9ed76be2017-08-29 19:11:33 +0530105 * Adds the device id and the number of tunnels created for that device.
106 *
107 * @param devId device id
108 * @param count number of tunnels
109 */
110 void addTunnelInfo(DeviceId devId, Integer count);
111
112 /**
janani bf41dec32017-03-24 18:44:07 +0530113 * Removes the interface info with the key access info from the store.
114 *
115 * @param accessInfo access info
116 * @return true if removed; false otherwise
117 */
118 boolean removeInterfaceInfo(AccessInfo accessInfo);
119
120 /**
121 * Removes the VPN instance from the store with the key VPN name from the
122 * store.
123 *
124 * @param vpnName VPN name
125 * @return true if removed; false otherwise
126 */
127 boolean removeVpnInstance(String vpnName);
128
129 /**
130 * Removes the mentioned id from the freed list.
131 *
132 * @param id id
133 * @return true if removed; false otherwise
134 */
135 boolean removeIdFromFreeList(Long id);
136
137 /**
138 * Removes the device id from the store with the key BGP info from the
139 * store.
140 *
141 * @param bgpInfo BGP info
142 * @return true if removed; false otherwise
143 */
144 boolean removeBgpInfo(BgpInfo bgpInfo);
janani b9ed76be2017-08-29 19:11:33 +0530145
146 /**
147 * Removes the device id from the store with the value count of number of
148 * tunnels.
149 *
150 * @param id device id
151 * @return true if removed; false otherwise
152 */
153 boolean removeTunnelInfo(DeviceId id);
janani bf41dec32017-03-24 18:44:07 +0530154}