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