sangho | 1e57565 | 2015-05-14 00:39:53 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2015-present Open Networking Foundation |
sangho | 1e57565 | 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 | 10bd8d1 | 2016-11-26 21:05:22 -0800 | [diff] [blame] | 18 | import org.onlab.packet.IpPrefix; |
Charles Chan | c81c45b | 2016-10-20 17:02:44 -0700 | [diff] [blame] | 19 | import org.onosproject.net.DeviceId; |
Saurav Das | 9504700 | 2018-01-25 09:49:01 -0800 | [diff] [blame^] | 20 | import org.onosproject.net.Link; |
| 21 | import org.onosproject.net.PortNumber; |
Saurav Das | 7bcbe70 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 22 | import org.onosproject.segmentrouting.grouphandler.NextNeighbors; |
| 23 | import org.onosproject.segmentrouting.storekey.DestinationSetNextObjectiveStoreKey; |
Saurav Das | c88d466 | 2017-05-15 15:34:25 -0700 | [diff] [blame] | 24 | |
| 25 | import com.google.common.collect.ImmutableMap; |
Charles Chan | c81c45b | 2016-10-20 17:02:44 -0700 | [diff] [blame] | 26 | |
sangho | 1e57565 | 2015-05-14 00:39:53 -0700 | [diff] [blame] | 27 | import java.util.List; |
Charles Chan | c81c45b | 2016-10-20 17:02:44 -0700 | [diff] [blame] | 28 | import java.util.Map; |
| 29 | import java.util.Set; |
sangho | 1e57565 | 2015-05-14 00:39:53 -0700 | [diff] [blame] | 30 | |
| 31 | /** |
| 32 | * Segment Routing Service for REST API. |
| 33 | */ |
| 34 | public interface SegmentRoutingService { |
Charles Chan | 5270ed0 | 2016-01-30 23:22:37 -0800 | [diff] [blame] | 35 | /** |
Charles Chan | 5270ed0 | 2016-01-30 23:22:37 -0800 | [diff] [blame] | 36 | * VLAN cross-connect priority. |
| 37 | */ |
| 38 | int XCONNECT_PRIORITY = 1000; |
| 39 | |
| 40 | /** |
| 41 | * Default flow priority. |
| 42 | */ |
| 43 | int DEFAULT_PRIORITY = 100; |
| 44 | |
| 45 | /** |
| 46 | * Minimum IP priority. |
| 47 | * |
Charles Chan | b54e8ba | 2016-02-18 10:43:46 -0800 | [diff] [blame] | 48 | * Should < 0 such that priority of /0 will not conflict with lowest |
Charles Chan | 5270ed0 | 2016-01-30 23:22:37 -0800 | [diff] [blame] | 49 | * priority default entries. |
| 50 | */ |
| 51 | int MIN_IP_PRIORITY = 10; |
| 52 | |
| 53 | /** |
| 54 | * Subnet flooding flow priority. |
| 55 | */ |
| 56 | int FLOOD_PRIORITY = 5; |
| 57 | |
sangho | 1e57565 | 2015-05-14 00:39:53 -0700 | [diff] [blame] | 58 | /** |
| 59 | * Returns all tunnels. |
| 60 | * |
| 61 | * @return list of tunnels |
| 62 | */ |
| 63 | List<Tunnel> getTunnels(); |
| 64 | |
| 65 | /** |
| 66 | * Creates a tunnel. |
| 67 | * |
| 68 | * @param tunnel tunnel reference to create |
sangho | 71abe1b | 2015-06-29 14:58:47 -0700 | [diff] [blame] | 69 | * @return WRONG_PATH if the tunnel path is wrong, ID_EXISTS if the tunnel ID |
| 70 | * exists already, TUNNEL_EXISTS if the same tunnel exists, INTERNAL_ERROR |
| 71 | * if the tunnel creation failed internally, SUCCESS if the tunnel is created |
| 72 | * successfully |
sangho | 1e57565 | 2015-05-14 00:39:53 -0700 | [diff] [blame] | 73 | */ |
sangho | 71abe1b | 2015-06-29 14:58:47 -0700 | [diff] [blame] | 74 | TunnelHandler.Result createTunnel(Tunnel tunnel); |
sangho | 1e57565 | 2015-05-14 00:39:53 -0700 | [diff] [blame] | 75 | |
| 76 | /** |
| 77 | * Returns all policies. |
| 78 | * |
| 79 | * @return list of policy |
| 80 | */ |
| 81 | List<Policy> getPolicies(); |
| 82 | |
| 83 | /** |
| 84 | * Creates a policy. |
| 85 | * |
| 86 | * @param policy policy reference to create |
sangho | 71abe1b | 2015-06-29 14:58:47 -0700 | [diff] [blame] | 87 | * @return ID_EXISTS if the same policy ID exists, |
| 88 | * POLICY_EXISTS if the same policy exists, TUNNEL_NOT_FOUND if the tunnel |
| 89 | * does not exists, UNSUPPORTED_TYPE if the policy type is not supported, |
| 90 | * SUCCESS if the policy is created successfully. |
sangho | 1e57565 | 2015-05-14 00:39:53 -0700 | [diff] [blame] | 91 | */ |
sangho | 71abe1b | 2015-06-29 14:58:47 -0700 | [diff] [blame] | 92 | PolicyHandler.Result createPolicy(Policy policy); |
sangho | 1e57565 | 2015-05-14 00:39:53 -0700 | [diff] [blame] | 93 | |
| 94 | /** |
| 95 | * Removes a tunnel. |
| 96 | * |
| 97 | * @param tunnel tunnel reference to remove |
sangho | 71abe1b | 2015-06-29 14:58:47 -0700 | [diff] [blame] | 98 | * @return TUNNEL_NOT_FOUND if the tunnel to remove does not exists, |
| 99 | * INTERNAL_ERROR if the tunnel creation failed internally, SUCCESS |
| 100 | * if the tunnel is created successfully. |
sangho | 1e57565 | 2015-05-14 00:39:53 -0700 | [diff] [blame] | 101 | */ |
sangho | 71abe1b | 2015-06-29 14:58:47 -0700 | [diff] [blame] | 102 | TunnelHandler.Result removeTunnel(Tunnel tunnel); |
sangho | 1e57565 | 2015-05-14 00:39:53 -0700 | [diff] [blame] | 103 | |
| 104 | /** |
| 105 | * Removes a policy. |
| 106 | * |
| 107 | * @param policy policy reference to remove |
sangho | 71abe1b | 2015-06-29 14:58:47 -0700 | [diff] [blame] | 108 | * @return POLICY_NOT_FOUND if the policy to remove does not exists, |
| 109 | * SUCCESS if it is removed successfully |
sangho | 1e57565 | 2015-05-14 00:39:53 -0700 | [diff] [blame] | 110 | */ |
sangho | 71abe1b | 2015-06-29 14:58:47 -0700 | [diff] [blame] | 111 | PolicyHandler.Result removePolicy(Policy policy); |
Saurav Das | 59232cf | 2016-04-27 18:35:50 -0700 | [diff] [blame] | 112 | |
| 113 | /** |
| 114 | * Use current state of the network to repopulate forwarding rules. |
| 115 | * |
| 116 | */ |
| 117 | void rerouteNetwork(); |
Charles Chan | c81c45b | 2016-10-20 17:02:44 -0700 | [diff] [blame] | 118 | |
| 119 | /** |
| 120 | * Returns device-subnet mapping. |
| 121 | * |
| 122 | * @return device-subnet mapping |
| 123 | */ |
Pier Ventre | 10bd8d1 | 2016-11-26 21:05:22 -0800 | [diff] [blame] | 124 | Map<DeviceId, Set<IpPrefix>> getDeviceSubnetMap(); |
Saurav Das | c88d466 | 2017-05-15 15:34:25 -0700 | [diff] [blame] | 125 | |
| 126 | /** |
| 127 | * Returns the current ECMP shortest path graph in this controller instance. |
| 128 | * |
| 129 | * @return ECMP shortest path graph |
| 130 | */ |
| 131 | ImmutableMap<DeviceId, EcmpShortestPathGraph> getCurrentEcmpSpg(); |
| 132 | |
| 133 | /** |
Saurav Das | 7bcbe70 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 134 | * Returns the destinatiomSet-NextObjective store contents. |
Saurav Das | c88d466 | 2017-05-15 15:34:25 -0700 | [diff] [blame] | 135 | * |
Saurav Das | 7bcbe70 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 136 | * @return current contents of the destinationSetNextObjectiveStore |
Saurav Das | c88d466 | 2017-05-15 15:34:25 -0700 | [diff] [blame] | 137 | */ |
Saurav Das | 7bcbe70 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 138 | ImmutableMap<DestinationSetNextObjectiveStoreKey, NextNeighbors> getDestinationSet(); |
Saurav Das | ceccf24 | 2017-08-03 18:30:35 -0700 | [diff] [blame] | 139 | |
| 140 | /** |
| 141 | * Triggers the verification of all ECMP groups in the specified device. |
| 142 | * Adjusts the group buckets if verification finds that there are more or less |
| 143 | * buckets than what should be there. |
| 144 | * |
| 145 | * @param id the device identifier |
| 146 | */ |
| 147 | void verifyGroups(DeviceId id); |
Saurav Das | 9504700 | 2018-01-25 09:49:01 -0800 | [diff] [blame^] | 148 | |
| 149 | /** |
| 150 | * Returns the internal link state as seen by this instance of the |
| 151 | * controller. |
| 152 | * |
| 153 | * @return the internal link state |
| 154 | */ |
| 155 | ImmutableMap<Link, Boolean> getSeenLinks(); |
| 156 | |
| 157 | /** |
| 158 | * Returns the ports administratively disabled by the controller. |
| 159 | * |
| 160 | * @return a map of devices and port numbers for administratively disabled |
| 161 | * ports. Does not include ports manually disabled by the operator. |
| 162 | */ |
| 163 | ImmutableMap<DeviceId, Set<PortNumber>> getDownedPortState(); |
sangho | 1e57565 | 2015-05-14 00:39:53 -0700 | [diff] [blame] | 164 | } |