Himal Kumar | b43724d | 2016-04-29 14:15:57 +1000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2016-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 | package org.onosproject.castor; |
| 17 | |
| 18 | import org.onlab.packet.IpAddress; |
| 19 | import org.onlab.packet.MacAddress; |
| 20 | import org.onosproject.net.intent.Key; |
| 21 | import org.onosproject.net.intent.MultiPointToSinglePointIntent; |
| 22 | import org.onosproject.net.intent.PointToPointIntent; |
| 23 | |
| 24 | import java.util.Map; |
| 25 | import java.util.Set; |
| 26 | |
| 27 | /** |
| 28 | * Interface to access Castor Distributed Store. |
| 29 | */ |
| 30 | public interface CastorStore { |
| 31 | |
| 32 | /** |
| 33 | *Returns list of all peers including the route servers. |
| 34 | * |
| 35 | * @return list of Peer |
| 36 | */ |
| 37 | Set<Peer> getAllPeers(); |
| 38 | |
| 39 | /** |
| 40 | * Store a Peer. |
| 41 | * |
| 42 | * @param peer The Peer to store |
| 43 | */ |
| 44 | void storePeer(Peer peer); |
| 45 | |
| 46 | /** |
| 47 | * Get the Route Servers. |
| 48 | * |
| 49 | * @return List of Servers |
| 50 | */ |
| 51 | Set<Peer> getServers(); |
| 52 | |
| 53 | /** |
| 54 | * Store a Route Server. |
| 55 | * |
| 56 | * @param peer The Server |
| 57 | */ |
| 58 | void storeServer(Peer peer); |
| 59 | |
| 60 | /** |
| 61 | * Returns the list of added BGP Peers. |
| 62 | * |
| 63 | * @return List of Peer |
| 64 | */ |
| 65 | Set<Peer> getCustomers(); |
| 66 | |
| 67 | /** |
| 68 | * Store a Customer. |
| 69 | * |
| 70 | * @param peer The Customer to be stored |
| 71 | */ |
| 72 | void storeCustomer(Peer peer); |
| 73 | |
| 74 | /** |
| 75 | * Returns the map of currently known mac addresses from ARP. |
| 76 | * |
| 77 | * @return map of IP address to Mac |
| 78 | */ |
| 79 | Map<IpAddress, MacAddress> getAddressMap(); |
| 80 | |
| 81 | /** |
| 82 | * Sets the mapping from IP address to Mac. |
| 83 | * |
| 84 | * @param ip IP Address |
| 85 | * @param mac MAC Address |
| 86 | */ |
| 87 | void setAddressMap(IpAddress ip, MacAddress mac); |
| 88 | |
| 89 | /** |
| 90 | * Returns all the peer intents. |
| 91 | * |
| 92 | * @return PointToPointIntent |
| 93 | */ |
| 94 | Map<Key, PointToPointIntent> getPeerIntents(); |
| 95 | |
| 96 | /** |
| 97 | * Stores a Peer Intent. |
| 98 | * |
| 99 | * @param key The intent |
| 100 | * @param intent Key |
| 101 | */ |
| 102 | void storePeerIntent(Key key, PointToPointIntent intent); |
| 103 | |
| 104 | /** |
| 105 | * Returns layer2 intents. |
| 106 | * |
| 107 | * @return MultiPointToSinglePointIntent |
| 108 | */ |
| 109 | Map<String, MultiPointToSinglePointIntent> getLayer2Intents(); |
| 110 | |
| 111 | /** |
| 112 | * Stores a layer2 intent. |
| 113 | * |
| 114 | * @param key Key |
| 115 | * @param intent The intent |
| 116 | */ |
| 117 | void storeLayer2Intent(String key, MultiPointToSinglePointIntent intent); |
| 118 | |
| 119 | /** |
| 120 | * Returns the mapping of Customer names to their IP address. |
| 121 | * |
| 122 | * @return HashMap |
| 123 | */ |
| 124 | Map<String, String> getCustomersMap(); |
| 125 | |
| 126 | /** |
| 127 | * Removes a customer and its associated flows from the network. |
| 128 | * |
| 129 | * @param peer The Customer |
| 130 | */ |
| 131 | void removeCustomer(Peer peer); |
| 132 | |
| 133 | /** |
| 134 | * Removes a peer intent from the store. |
| 135 | * |
| 136 | * @param key Key for the intent |
| 137 | */ |
| 138 | void removePeerIntent(Key key); |
| 139 | |
| 140 | /** |
| 141 | * Removes the layer2 intent from the store. |
| 142 | * |
| 143 | * @param key Key for intent |
| 144 | */ |
| 145 | void removeLayer2Intent(String key); |
| 146 | } |