AbstractConfigTest - exposed BundleContext and ServiceRegistration mock.
[controller.git] / opendaylight / md-sal / sal-zeromq-connector / src / main / java / org / opendaylight / controller / sal / connector / remoterpc / api / RoutingTable.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.controller.sal.connector.remoterpc.api;
9
10 import java.util.Set;
11
12 public interface RoutingTable<I,R> {
13
14   /**
15    * Adds a network address for the route. If address for route
16    * exists, appends the address to the list
17    *
18    * @param routeId route identifier
19    * @param route network address
20    */
21   public void addRoute(I routeId, R route);
22
23   /**
24    * Adds a network address for the route. If the route already exists,
25    * it throws. This method would be used when registering a global service.
26    *
27    * @param routeId route identifier
28    * @param route network address
29    * @throws DuplicateRouteException
30    */
31   public void addGlobalRoute(I routeId, R route) throws DuplicateRouteException;
32
33   /**
34    * Removes the network address for the route from routing table. If only
35    * one network address existed, remove the route as well.
36    * @param routeId
37    * @param route
38    */
39   public void removeRoute(I routeId, R route);
40
41   /**
42    * Returns a set of network addresses associated with this route
43    * @param routeId
44    * @return
45    */
46   public Set<R> getRoutes(I routeId);
47
48   /**
49    * Returns only one address from the list of network addresses
50    * associated with the route. The algorithm to determine that
51    * one address is upto the implementer
52    * @param route
53    * @return
54    */
55   public R getARoute(I routeId);
56
57   public void registerRouteChangeListener(RouteChangeListener listener);
58
59   public class DuplicateRouteException extends Exception {}
60 }