janani b | f41dec3 | 2017-03-24 18:44:07 +0530 | [diff] [blame] | 1 | /* |
| 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 | |
| 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 | /** |
| 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 | /** |
janani b | 36b1d77 | 2017-03-27 15:01:28 +0530 | [diff] [blame] | 74 | * Adds the VPN name and the VPN instance to the map. |
| 75 | * |
| 76 | * @param name VPN name |
| 77 | * @param instance VPN instance |
| 78 | */ |
| 79 | void addVpnIns(String name, VpnInstance instance); |
| 80 | |
| 81 | /** |
janani b | f41dec3 | 2017-03-24 18:44:07 +0530 | [diff] [blame] | 82 | * Adds the access info and the interface info to the map in store. |
| 83 | * |
| 84 | * @param accessInfo access info |
| 85 | * @param intInfo interface info |
| 86 | */ |
| 87 | void addInterfaceInfo(AccessInfo accessInfo, InterfaceInfo intInfo); |
| 88 | |
| 89 | /** |
| 90 | * Adds the BGP info and the device id to the map in store. |
| 91 | * |
| 92 | * @param bgpInfo BGP info |
| 93 | * @param devId device id |
| 94 | */ |
| 95 | void addBgpInfo(BgpInfo bgpInfo, DeviceId devId); |
| 96 | |
| 97 | /** |
| 98 | * Removes the interface info with the key access info from the store. |
| 99 | * |
| 100 | * @param accessInfo access info |
| 101 | * @return true if removed; false otherwise |
| 102 | */ |
| 103 | boolean removeInterfaceInfo(AccessInfo accessInfo); |
| 104 | |
| 105 | /** |
| 106 | * Removes the VPN instance from the store with the key VPN name from the |
| 107 | * store. |
| 108 | * |
| 109 | * @param vpnName VPN name |
| 110 | * @return true if removed; false otherwise |
| 111 | */ |
| 112 | boolean removeVpnInstance(String vpnName); |
| 113 | |
| 114 | /** |
| 115 | * Removes the mentioned id from the freed list. |
| 116 | * |
| 117 | * @param id id |
| 118 | * @return true if removed; false otherwise |
| 119 | */ |
| 120 | boolean removeIdFromFreeList(Long id); |
| 121 | |
| 122 | /** |
| 123 | * Removes the device id from the store with the key BGP info from the |
| 124 | * store. |
| 125 | * |
| 126 | * @param bgpInfo BGP info |
| 127 | * @return true if removed; false otherwise |
| 128 | */ |
| 129 | boolean removeBgpInfo(BgpInfo bgpInfo); |
| 130 | } |