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