sangho | 27462c6 | 2015-05-14 00:39:53 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | 0947d7e | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2015-present Open Networking Foundation |
sangho | 27462c6 | 2015-05-14 00:39:53 -0700 | [diff] [blame] | 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.segmentrouting; |
| 17 | |
Pier Luigi | 0f9635b | 2018-01-15 18:06:43 +0100 | [diff] [blame] | 18 | import org.onlab.packet.IpAddress; |
Pier Ventre | b6a7f34 | 2016-11-26 21:05:22 -0800 | [diff] [blame] | 19 | import org.onlab.packet.IpPrefix; |
Pier Luigi | 0f9635b | 2018-01-15 18:06:43 +0100 | [diff] [blame] | 20 | import org.onosproject.net.ConnectPoint; |
Charles Chan | d7844e5 | 2016-10-20 17:02:44 -0700 | [diff] [blame] | 21 | import org.onosproject.net.DeviceId; |
Saurav Das | 6430f41 | 2018-01-25 09:49:01 -0800 | [diff] [blame] | 22 | import org.onosproject.net.Link; |
| 23 | import org.onosproject.net.PortNumber; |
Saurav Das | 261c300 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 24 | import org.onosproject.segmentrouting.grouphandler.NextNeighbors; |
Pier Luigi | 69f774d | 2018-02-28 12:10:50 +0100 | [diff] [blame] | 25 | import org.onosproject.segmentrouting.mcast.McastRole; |
Andreas Pantelopoulos | fc4bc2a | 2018-03-12 16:30:20 -0700 | [diff] [blame] | 26 | import org.onosproject.segmentrouting.pwaas.DefaultL2TunnelDescription; |
Andreas Pantelopoulos | 4c7de13 | 2018-02-22 12:32:42 -0800 | [diff] [blame] | 27 | import org.onosproject.segmentrouting.pwaas.L2Tunnel; |
Andreas Pantelopoulos | 5e7be3d | 2017-10-23 12:18:25 -0700 | [diff] [blame] | 28 | import org.onosproject.segmentrouting.pwaas.L2TunnelHandler; |
Andreas Pantelopoulos | 4c7de13 | 2018-02-22 12:32:42 -0800 | [diff] [blame] | 29 | import org.onosproject.segmentrouting.pwaas.L2TunnelPolicy; |
Andreas Pantelopoulos | cdbb22c | 2018-02-23 14:18:00 -0800 | [diff] [blame] | 30 | import org.onosproject.segmentrouting.pwaas.L2TunnelDescription; |
Saurav Das | 261c300 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 31 | import org.onosproject.segmentrouting.storekey.DestinationSetNextObjectiveStoreKey; |
Saurav Das | 62ae679 | 2017-05-15 15:34:25 -0700 | [diff] [blame] | 32 | |
| 33 | import com.google.common.collect.ImmutableMap; |
Pier Luigi | 0f9635b | 2018-01-15 18:06:43 +0100 | [diff] [blame] | 34 | import org.onosproject.segmentrouting.storekey.McastStoreKey; |
Charles Chan | d7844e5 | 2016-10-20 17:02:44 -0700 | [diff] [blame] | 35 | |
sangho | 27462c6 | 2015-05-14 00:39:53 -0700 | [diff] [blame] | 36 | import java.util.List; |
Charles Chan | d7844e5 | 2016-10-20 17:02:44 -0700 | [diff] [blame] | 37 | import java.util.Map; |
| 38 | import java.util.Set; |
sangho | 27462c6 | 2015-05-14 00:39:53 -0700 | [diff] [blame] | 39 | |
| 40 | /** |
| 41 | * Segment Routing Service for REST API. |
| 42 | */ |
| 43 | public interface SegmentRoutingService { |
Charles Chan | 82ab193 | 2016-01-30 23:22:37 -0800 | [diff] [blame] | 44 | /** |
Charles Chan | 82ab193 | 2016-01-30 23:22:37 -0800 | [diff] [blame] | 45 | * VLAN cross-connect priority. |
| 46 | */ |
| 47 | int XCONNECT_PRIORITY = 1000; |
| 48 | |
| 49 | /** |
| 50 | * Default flow priority. |
| 51 | */ |
| 52 | int DEFAULT_PRIORITY = 100; |
| 53 | |
| 54 | /** |
| 55 | * Minimum IP priority. |
| 56 | * |
Charles Chan | d86904c | 2016-02-18 10:43:46 -0800 | [diff] [blame] | 57 | * Should < 0 such that priority of /0 will not conflict with lowest |
Charles Chan | 82ab193 | 2016-01-30 23:22:37 -0800 | [diff] [blame] | 58 | * priority default entries. |
| 59 | */ |
| 60 | int MIN_IP_PRIORITY = 10; |
| 61 | |
| 62 | /** |
| 63 | * Subnet flooding flow priority. |
| 64 | */ |
| 65 | int FLOOD_PRIORITY = 5; |
| 66 | |
sangho | 27462c6 | 2015-05-14 00:39:53 -0700 | [diff] [blame] | 67 | /** |
| 68 | * Returns all tunnels. |
| 69 | * |
| 70 | * @return list of tunnels |
| 71 | */ |
| 72 | List<Tunnel> getTunnels(); |
| 73 | |
| 74 | /** |
| 75 | * Creates a tunnel. |
| 76 | * |
| 77 | * @param tunnel tunnel reference to create |
sangho | bd812f8 | 2015-06-29 14:58:47 -0700 | [diff] [blame] | 78 | * @return WRONG_PATH if the tunnel path is wrong, ID_EXISTS if the tunnel ID |
| 79 | * exists already, TUNNEL_EXISTS if the same tunnel exists, INTERNAL_ERROR |
| 80 | * if the tunnel creation failed internally, SUCCESS if the tunnel is created |
| 81 | * successfully |
sangho | 27462c6 | 2015-05-14 00:39:53 -0700 | [diff] [blame] | 82 | */ |
sangho | bd812f8 | 2015-06-29 14:58:47 -0700 | [diff] [blame] | 83 | TunnelHandler.Result createTunnel(Tunnel tunnel); |
sangho | 27462c6 | 2015-05-14 00:39:53 -0700 | [diff] [blame] | 84 | |
| 85 | /** |
| 86 | * Returns all policies. |
| 87 | * |
| 88 | * @return list of policy |
| 89 | */ |
| 90 | List<Policy> getPolicies(); |
| 91 | |
| 92 | /** |
Andreas Pantelopoulos | fc4bc2a | 2018-03-12 16:30:20 -0700 | [diff] [blame] | 93 | * Returns the l2 tunnel descriptions. |
| 94 | * |
Andreas Pantelopoulos | d988c1a | 2018-03-15 16:56:09 -0700 | [diff] [blame] | 95 | * @param pending if true fetch pending pseudowires, else fetch installed |
Andreas Pantelopoulos | fc4bc2a | 2018-03-12 16:30:20 -0700 | [diff] [blame] | 96 | * @return set of l2 tunnel descriptions. |
| 97 | */ |
Andreas Pantelopoulos | d988c1a | 2018-03-15 16:56:09 -0700 | [diff] [blame] | 98 | Set<L2TunnelDescription> getL2TunnelDescriptions(boolean pending); |
Andreas Pantelopoulos | fc4bc2a | 2018-03-12 16:30:20 -0700 | [diff] [blame] | 99 | |
| 100 | /** |
Andreas Pantelopoulos | 5e7be3d | 2017-10-23 12:18:25 -0700 | [diff] [blame] | 101 | * Returns all l2 tunnels of pseudowires. |
| 102 | * |
| 103 | * @return list of l2 tunnels |
| 104 | */ |
Andreas Pantelopoulos | 4c7de13 | 2018-02-22 12:32:42 -0800 | [diff] [blame] | 105 | List<L2Tunnel> getL2Tunnels(); |
Andreas Pantelopoulos | 5e7be3d | 2017-10-23 12:18:25 -0700 | [diff] [blame] | 106 | |
| 107 | /** |
| 108 | * Returns all l2 policie of pseudowires. |
| 109 | * |
| 110 | * @return list of l2 policies. |
| 111 | */ |
Andreas Pantelopoulos | 4c7de13 | 2018-02-22 12:32:42 -0800 | [diff] [blame] | 112 | List<L2TunnelPolicy> getL2Policies(); |
Andreas Pantelopoulos | 5e7be3d | 2017-10-23 12:18:25 -0700 | [diff] [blame] | 113 | |
| 114 | /** |
Andreas Pantelopoulos | fc4bc2a | 2018-03-12 16:30:20 -0700 | [diff] [blame] | 115 | * Removes pseudowire. |
Andreas Pantelopoulos | 5e7be3d | 2017-10-23 12:18:25 -0700 | [diff] [blame] | 116 | * |
Andreas Pantelopoulos | cdbb22c | 2018-02-23 14:18:00 -0800 | [diff] [blame] | 117 | * @param pwId The id of the pseudowire. |
Andreas Pantelopoulos | 5e7be3d | 2017-10-23 12:18:25 -0700 | [diff] [blame] | 118 | * @return SUCCESS if operation successful or a descriptive error otherwise. |
| 119 | */ |
Andreas Pantelopoulos | cdbb22c | 2018-02-23 14:18:00 -0800 | [diff] [blame] | 120 | L2TunnelHandler.Result removePseudowire(Integer pwId); |
Andreas Pantelopoulos | 5e7be3d | 2017-10-23 12:18:25 -0700 | [diff] [blame] | 121 | |
| 122 | /** |
Andreas Pantelopoulos | fc4bc2a | 2018-03-12 16:30:20 -0700 | [diff] [blame] | 123 | * Adds a Pseudowire to the system. |
Andreas Pantelopoulos | 5e7be3d | 2017-10-23 12:18:25 -0700 | [diff] [blame] | 124 | * |
Andreas Pantelopoulos | cdbb22c | 2018-02-23 14:18:00 -0800 | [diff] [blame] | 125 | * @param tunnel The pseudowire tunnel. |
Andreas Pantelopoulos | 5e7be3d | 2017-10-23 12:18:25 -0700 | [diff] [blame] | 126 | * @return SUCCESS if operation is successful or a descriptive error otherwise. |
| 127 | */ |
Andreas Pantelopoulos | cdbb22c | 2018-02-23 14:18:00 -0800 | [diff] [blame] | 128 | L2TunnelHandler.Result addPseudowire(L2TunnelDescription tunnel); |
Andreas Pantelopoulos | 5e7be3d | 2017-10-23 12:18:25 -0700 | [diff] [blame] | 129 | |
| 130 | /** |
Andreas Pantelopoulos | 9685125 | 2018-03-20 13:58:49 -0700 | [diff] [blame] | 131 | * Adds a set of pseudowires. |
| 132 | * |
| 133 | * |
Andreas Pantelopoulos | fc4bc2a | 2018-03-12 16:30:20 -0700 | [diff] [blame] | 134 | * @param l2TunnelDescriptions The pseudowires to add. |
| 135 | * @return SUCCESS if ALL pseudowires can be instantiated and are deployed, or a |
| 136 | * a descriptive error otherwise, without deploying any pseudowire. |
Andreas Pantelopoulos | 9685125 | 2018-03-20 13:58:49 -0700 | [diff] [blame] | 137 | * @deprecated onos-1.12 use addPseudowire instead |
Andreas Pantelopoulos | fc4bc2a | 2018-03-12 16:30:20 -0700 | [diff] [blame] | 138 | */ |
Andreas Pantelopoulos | 9685125 | 2018-03-20 13:58:49 -0700 | [diff] [blame] | 139 | @Deprecated |
Andreas Pantelopoulos | fc4bc2a | 2018-03-12 16:30:20 -0700 | [diff] [blame] | 140 | L2TunnelHandler.Result addPseudowiresBulk(List<DefaultL2TunnelDescription> l2TunnelDescriptions); |
| 141 | |
| 142 | /** |
sangho | 27462c6 | 2015-05-14 00:39:53 -0700 | [diff] [blame] | 143 | * Creates a policy. |
| 144 | * |
| 145 | * @param policy policy reference to create |
sangho | bd812f8 | 2015-06-29 14:58:47 -0700 | [diff] [blame] | 146 | * @return ID_EXISTS if the same policy ID exists, |
| 147 | * POLICY_EXISTS if the same policy exists, TUNNEL_NOT_FOUND if the tunnel |
| 148 | * does not exists, UNSUPPORTED_TYPE if the policy type is not supported, |
| 149 | * SUCCESS if the policy is created successfully. |
sangho | 27462c6 | 2015-05-14 00:39:53 -0700 | [diff] [blame] | 150 | */ |
sangho | bd812f8 | 2015-06-29 14:58:47 -0700 | [diff] [blame] | 151 | PolicyHandler.Result createPolicy(Policy policy); |
sangho | 27462c6 | 2015-05-14 00:39:53 -0700 | [diff] [blame] | 152 | |
| 153 | /** |
| 154 | * Removes a tunnel. |
| 155 | * |
| 156 | * @param tunnel tunnel reference to remove |
sangho | bd812f8 | 2015-06-29 14:58:47 -0700 | [diff] [blame] | 157 | * @return TUNNEL_NOT_FOUND if the tunnel to remove does not exists, |
| 158 | * INTERNAL_ERROR if the tunnel creation failed internally, SUCCESS |
| 159 | * if the tunnel is created successfully. |
sangho | 27462c6 | 2015-05-14 00:39:53 -0700 | [diff] [blame] | 160 | */ |
sangho | bd812f8 | 2015-06-29 14:58:47 -0700 | [diff] [blame] | 161 | TunnelHandler.Result removeTunnel(Tunnel tunnel); |
sangho | 27462c6 | 2015-05-14 00:39:53 -0700 | [diff] [blame] | 162 | |
| 163 | /** |
| 164 | * Removes a policy. |
| 165 | * |
| 166 | * @param policy policy reference to remove |
sangho | bd812f8 | 2015-06-29 14:58:47 -0700 | [diff] [blame] | 167 | * @return POLICY_NOT_FOUND if the policy to remove does not exists, |
| 168 | * SUCCESS if it is removed successfully |
sangho | 27462c6 | 2015-05-14 00:39:53 -0700 | [diff] [blame] | 169 | */ |
sangho | bd812f8 | 2015-06-29 14:58:47 -0700 | [diff] [blame] | 170 | PolicyHandler.Result removePolicy(Policy policy); |
Saurav Das | 07c7460 | 2016-04-27 18:35:50 -0700 | [diff] [blame] | 171 | |
| 172 | /** |
| 173 | * Use current state of the network to repopulate forwarding rules. |
| 174 | * |
| 175 | */ |
| 176 | void rerouteNetwork(); |
Charles Chan | d7844e5 | 2016-10-20 17:02:44 -0700 | [diff] [blame] | 177 | |
| 178 | /** |
| 179 | * Returns device-subnet mapping. |
| 180 | * |
| 181 | * @return device-subnet mapping |
| 182 | */ |
Pier Ventre | b6a7f34 | 2016-11-26 21:05:22 -0800 | [diff] [blame] | 183 | Map<DeviceId, Set<IpPrefix>> getDeviceSubnetMap(); |
Saurav Das | 62ae679 | 2017-05-15 15:34:25 -0700 | [diff] [blame] | 184 | |
| 185 | /** |
| 186 | * Returns the current ECMP shortest path graph in this controller instance. |
| 187 | * |
| 188 | * @return ECMP shortest path graph |
| 189 | */ |
| 190 | ImmutableMap<DeviceId, EcmpShortestPathGraph> getCurrentEcmpSpg(); |
| 191 | |
| 192 | /** |
Saurav Das | 261c300 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 193 | * Returns the destinatiomSet-NextObjective store contents. |
Saurav Das | 62ae679 | 2017-05-15 15:34:25 -0700 | [diff] [blame] | 194 | * |
Saurav Das | 261c300 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 195 | * @return current contents of the destinationSetNextObjectiveStore |
Saurav Das | 62ae679 | 2017-05-15 15:34:25 -0700 | [diff] [blame] | 196 | */ |
Saurav Das | 261c300 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 197 | ImmutableMap<DestinationSetNextObjectiveStoreKey, NextNeighbors> getDestinationSet(); |
Saurav Das | fbe7457 | 2017-08-03 18:30:35 -0700 | [diff] [blame] | 198 | |
| 199 | /** |
| 200 | * Triggers the verification of all ECMP groups in the specified device. |
| 201 | * Adjusts the group buckets if verification finds that there are more or less |
| 202 | * buckets than what should be there. |
| 203 | * |
| 204 | * @param id the device identifier |
| 205 | */ |
| 206 | void verifyGroups(DeviceId id); |
Saurav Das | 6430f41 | 2018-01-25 09:49:01 -0800 | [diff] [blame] | 207 | |
| 208 | /** |
| 209 | * Returns the internal link state as seen by this instance of the |
| 210 | * controller. |
| 211 | * |
| 212 | * @return the internal link state |
| 213 | */ |
| 214 | ImmutableMap<Link, Boolean> getSeenLinks(); |
| 215 | |
| 216 | /** |
| 217 | * Returns the ports administratively disabled by the controller. |
| 218 | * |
| 219 | * @return a map of devices and port numbers for administratively disabled |
| 220 | * ports. Does not include ports manually disabled by the operator. |
| 221 | */ |
| 222 | ImmutableMap<DeviceId, Set<PortNumber>> getDownedPortState(); |
Pier Luigi | 0f9635b | 2018-01-15 18:06:43 +0100 | [diff] [blame] | 223 | |
| 224 | /** |
| 225 | * Returns the associated next ids to the mcast groups or to the single |
| 226 | * group if mcastIp is present. |
| 227 | * |
| 228 | * @param mcastIp the group ip |
| 229 | * @return the mapping mcastIp-device to next id |
| 230 | */ |
| 231 | Map<McastStoreKey, Integer> getMcastNextIds(IpAddress mcastIp); |
| 232 | |
| 233 | /** |
| 234 | * Returns the associated roles to the mcast groups or to the single |
| 235 | * group if mcastIp is present. |
| 236 | * |
| 237 | * @param mcastIp the group ip |
| 238 | * @return the mapping mcastIp-device to mcast role |
| 239 | */ |
Pier Luigi | 69f774d | 2018-02-28 12:10:50 +0100 | [diff] [blame] | 240 | Map<McastStoreKey, McastRole> getMcastRoles(IpAddress mcastIp); |
Pier Luigi | 0f9635b | 2018-01-15 18:06:43 +0100 | [diff] [blame] | 241 | |
| 242 | /** |
| 243 | * Returns the associated paths to the mcast group. |
| 244 | * |
| 245 | * @param mcastIp the group ip |
| 246 | * @return the mapping egress point to mcast path |
| 247 | */ |
| 248 | Map<ConnectPoint, List<ConnectPoint>> getMcastPaths(IpAddress mcastIp); |
| 249 | |
sangho | 27462c6 | 2015-05-14 00:39:53 -0700 | [diff] [blame] | 250 | } |