wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2015 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.net.tunnel; |
| 17 | |
| 18 | import org.onosproject.net.ConnectPoint; |
| 19 | import org.onosproject.net.DeviceId; |
| 20 | import org.onosproject.net.provider.ProviderId; |
| 21 | import org.onosproject.store.Store; |
| 22 | |
| 23 | /** |
| 24 | * Manages inventory of tunnels. |
| 25 | */ |
| 26 | public interface TunnelStore extends Store<TunnelEvent, TunnelStoreDelegate> { |
| 27 | |
| 28 | /** |
| 29 | * Returns the number of tunnels in the store. |
| 30 | * |
| 31 | * @return number of tunnels |
| 32 | */ |
| 33 | int getTunnelCount(); |
| 34 | |
| 35 | /** |
| 36 | * Returns an iterable collection of all tunnel in the inventory. |
| 37 | * |
| 38 | * @return collection of all tunnels |
| 39 | */ |
| 40 | Iterable<Tunnel> getTunnels(); |
| 41 | |
| 42 | /** |
| 43 | * Returns all tunnels egressing from the specified device. |
| 44 | * |
| 45 | * @param deviceId device identifier |
| 46 | * @return set of device tunnels |
| 47 | */ |
| 48 | Iterable<Tunnel> getDeviceEgressTunnels(DeviceId deviceId); |
| 49 | |
| 50 | /** |
| 51 | * Returns all tunnels ingressing from the specified device. |
| 52 | * |
| 53 | * @param deviceId device identifier |
| 54 | * @return set of device tunnels |
| 55 | */ |
| 56 | Iterable<Tunnel> getDeviceIngressTunnels(DeviceId deviceId); |
| 57 | |
| 58 | /** |
| 59 | * Returns the tunnel between the two end-points and the tunnel type. |
| 60 | * |
| 61 | * @param src source connection point |
| 62 | * @param dst destination connection point |
| 63 | * @param type tunnel type |
| 64 | * @return tunnels or null if one not found between the end-points |
| 65 | */ |
| 66 | Iterable<Tunnel> getTunnel(ConnectPoint src, ConnectPoint dst, Tunnel.Type type); |
| 67 | |
| 68 | /** |
| 69 | * Returns all tunnels egressing from the specified connection point. |
| 70 | * |
| 71 | * @param src source connection point |
| 72 | * @return set of connection point tunnels |
| 73 | */ |
| 74 | Iterable<Tunnel> getEgressTunnels(ConnectPoint src); |
| 75 | |
| 76 | /** |
| 77 | * Returns all tunnels ingressing to the specified connection point. |
| 78 | * |
| 79 | * @param dst destination connection point |
| 80 | * @return set of connection point tunnels |
| 81 | */ |
| 82 | Iterable<Tunnel> getIngressTunnels(ConnectPoint dst); |
| 83 | |
| 84 | /** |
| 85 | * Creates a new tunnel based on the given information. |
| 86 | * |
| 87 | * @param providerId provider identity (e.g., PCEP provider) |
| 88 | * @param tunnel tunnel information |
| 89 | * @return create tunnel event |
| 90 | */ |
| 91 | public TunnelEvent addTunnel(ProviderId providerId, |
| 92 | Tunnel tunnel); |
| 93 | |
| 94 | /** |
| 95 | * Updates a new tunnel based on the given information. |
| 96 | * |
| 97 | * @param providerId provider identity (e.g., PCEP provider) |
| 98 | * @param tunnel tunnel |
| 99 | * @return update tunnel event |
| 100 | */ |
| 101 | public TunnelEvent updateTunnel(ProviderId providerId, |
| 102 | Tunnel tunnel); |
| 103 | |
| 104 | /** |
| 105 | * Removes a new tunnel based on the given information. |
| 106 | * |
| 107 | * @param providerId provider identity (e.g., PCEP provider) |
| 108 | * @param tunnel tunnel |
| 109 | * @return remove tunnel event |
| 110 | */ |
| 111 | TunnelEvent removeTunnel(ProviderId providerId, |
| 112 | Tunnel tunnel); |
| 113 | |
| 114 | } |