Jian Li | 7ccc3a8 | 2016-12-09 01:30:56 +0900 | [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.lisp.ctl; |
| 17 | |
| 18 | import org.onosproject.lisp.msg.protocols.LispMessage; |
| 19 | |
| 20 | /** |
| 21 | * Responsible for keeping track of the current set of |
| 22 | * routers connected to the system. |
| 23 | */ |
| 24 | public interface LispRouterAgent { |
| 25 | |
| 26 | /** |
| 27 | * Adds a router that has just connected to the system. |
| 28 | * We try to add the router into connectedRouter pool when the router is |
| 29 | * initially sending Map-Register message to the controller. |
| 30 | * |
| 31 | * @param routerId the routerId to add |
| 32 | * @param router the actual router object |
| 33 | * @return true if added, false otherwise |
| 34 | */ |
| 35 | boolean addConnectedRouter(LispRouterId routerId, LispRouter router); |
| 36 | |
| 37 | /** |
| 38 | * Clears all state in controller router maps for a router that has |
| 39 | * disconnected from the local controller. Also release control for that |
| 40 | * router from the global repository. Notify router listener. |
| 41 | * |
| 42 | * @param routerId the routerId to rmove |
| 43 | */ |
| 44 | void removeConnectedRouter(LispRouterId routerId); |
| 45 | |
| 46 | /** |
| 47 | * Processes a message coming from a router. Notifies message listeners on |
| 48 | * all incoming message event. |
| 49 | * |
| 50 | * @param routerId the routerId of a router where the message comes from |
| 51 | * @param message the message to process |
| 52 | */ |
| 53 | void processUpstreamMessage(LispRouterId routerId, LispMessage message); |
| 54 | |
| 55 | /** |
| 56 | * Processes a message going to a router. Notifies message listeners on |
| 57 | * all outgoing message event. |
| 58 | * |
| 59 | * @param routerId the routerId of a router where the message goes to |
| 60 | * @param message the message to process |
| 61 | */ |
| 62 | void processDownstreamMessage(LispRouterId routerId, LispMessage message); |
| 63 | } |