janani b | f41dec3 | 2017-03-24 18:44:07 +0530 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2017-present Open Networking Foundation |
janani b | f41dec3 | 2017-03-24 18:44:07 +0530 | [diff] [blame] | 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 | |
| 17 | package org.onosproject.l3vpn.netl3vpn; |
| 18 | |
| 19 | import org.onosproject.net.DeviceId; |
| 20 | |
| 21 | import java.util.Map; |
| 22 | |
| 23 | /** |
| 24 | * Abstraction of an entity providing pool of available VPN instances |
| 25 | * its associated devices and interface information. |
| 26 | */ |
| 27 | public 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 b | 9ed76be | 2017-08-29 19:11:33 +0530 | [diff] [blame] | 58 | * 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 b | f41dec3 | 2017-03-24 18:44:07 +0530 | [diff] [blame] | 65 | * 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 b | 36b1d77 | 2017-03-27 15:01:28 +0530 | [diff] [blame] | 81 | * 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 b | f41dec3 | 2017-03-24 18:44:07 +0530 | [diff] [blame] | 89 | * 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 b | 9ed76be | 2017-08-29 19:11:33 +0530 | [diff] [blame] | 105 | * 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 b | f41dec3 | 2017-03-24 18:44:07 +0530 | [diff] [blame] | 113 | * 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 b | 9ed76be | 2017-08-29 19:11:33 +0530 | [diff] [blame] | 145 | |
| 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 b | f41dec3 | 2017-03-24 18:44:07 +0530 | [diff] [blame] | 154 | } |