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