blob: b5f8681b6fc53cd973b5169bebf55b078e19cf8f [file] [log] [blame]
janani bf41dec32017-03-24 18:44:07 +05301/*
2 * Copyright 2017-present Open Networking Laboratory
3 *
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 /**
58 * Adds freed id to the freed list in the store.
59 *
60 * @param id id
61 */
62 void addIdToFreeList(Long id);
63
64 /**
65 * Adds the VPN name and the VPN instance, if the map does'nt have the
66 * value with it.
67 *
68 * @param name VPN name
69 * @param instance VPN instance
70 */
71 void addVpnInsIfAbsent(String name, VpnInstance instance);
72
73 /**
74 * Adds the access info and the interface info to the map in store.
75 *
76 * @param accessInfo access info
77 * @param intInfo interface info
78 */
79 void addInterfaceInfo(AccessInfo accessInfo, InterfaceInfo intInfo);
80
81 /**
82 * Adds the BGP info and the device id to the map in store.
83 *
84 * @param bgpInfo BGP info
85 * @param devId device id
86 */
87 void addBgpInfo(BgpInfo bgpInfo, DeviceId devId);
88
89 /**
90 * Removes the interface info with the key access info from the store.
91 *
92 * @param accessInfo access info
93 * @return true if removed; false otherwise
94 */
95 boolean removeInterfaceInfo(AccessInfo accessInfo);
96
97 /**
98 * Removes the VPN instance from the store with the key VPN name from the
99 * store.
100 *
101 * @param vpnName VPN name
102 * @return true if removed; false otherwise
103 */
104 boolean removeVpnInstance(String vpnName);
105
106 /**
107 * Removes the mentioned id from the freed list.
108 *
109 * @param id id
110 * @return true if removed; false otherwise
111 */
112 boolean removeIdFromFreeList(Long id);
113
114 /**
115 * Removes the device id from the store with the key BGP info from the
116 * store.
117 *
118 * @param bgpInfo BGP info
119 * @return true if removed; false otherwise
120 */
121 boolean removeBgpInfo(BgpInfo bgpInfo);
122}