sangho | 27462c6 | 2015-05-14 00:39:53 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | 43b5354 | 2016-04-09 01:19:45 -0700 | [diff] [blame] | 2 | * Copyright 2015-present Open Networking Laboratory |
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 | 62ae679 | 2017-05-15 15:34:25 -0700 | [diff] [blame^] | 20 | import org.onosproject.segmentrouting.storekey.NeighborSetNextObjectiveStoreKey; |
| 21 | |
| 22 | import com.google.common.collect.ImmutableMap; |
Charles Chan | d7844e5 | 2016-10-20 17:02:44 -0700 | [diff] [blame] | 23 | |
sangho | 27462c6 | 2015-05-14 00:39:53 -0700 | [diff] [blame] | 24 | import java.util.List; |
Charles Chan | d7844e5 | 2016-10-20 17:02:44 -0700 | [diff] [blame] | 25 | import java.util.Map; |
| 26 | import java.util.Set; |
sangho | 27462c6 | 2015-05-14 00:39:53 -0700 | [diff] [blame] | 27 | |
| 28 | /** |
| 29 | * Segment Routing Service for REST API. |
| 30 | */ |
| 31 | public interface SegmentRoutingService { |
Charles Chan | 82ab193 | 2016-01-30 23:22:37 -0800 | [diff] [blame] | 32 | /** |
Charles Chan | 82ab193 | 2016-01-30 23:22:37 -0800 | [diff] [blame] | 33 | * VLAN cross-connect priority. |
| 34 | */ |
| 35 | int XCONNECT_PRIORITY = 1000; |
| 36 | |
| 37 | /** |
| 38 | * Default flow priority. |
| 39 | */ |
| 40 | int DEFAULT_PRIORITY = 100; |
| 41 | |
| 42 | /** |
| 43 | * Minimum IP priority. |
| 44 | * |
Charles Chan | d86904c | 2016-02-18 10:43:46 -0800 | [diff] [blame] | 45 | * Should < 0 such that priority of /0 will not conflict with lowest |
Charles Chan | 82ab193 | 2016-01-30 23:22:37 -0800 | [diff] [blame] | 46 | * priority default entries. |
| 47 | */ |
| 48 | int MIN_IP_PRIORITY = 10; |
| 49 | |
| 50 | /** |
| 51 | * Subnet flooding flow priority. |
| 52 | */ |
| 53 | int FLOOD_PRIORITY = 5; |
| 54 | |
sangho | 27462c6 | 2015-05-14 00:39:53 -0700 | [diff] [blame] | 55 | /** |
| 56 | * Returns all tunnels. |
| 57 | * |
| 58 | * @return list of tunnels |
| 59 | */ |
| 60 | List<Tunnel> getTunnels(); |
| 61 | |
| 62 | /** |
| 63 | * Creates a tunnel. |
| 64 | * |
| 65 | * @param tunnel tunnel reference to create |
sangho | bd812f8 | 2015-06-29 14:58:47 -0700 | [diff] [blame] | 66 | * @return WRONG_PATH if the tunnel path is wrong, ID_EXISTS if the tunnel ID |
| 67 | * exists already, TUNNEL_EXISTS if the same tunnel exists, INTERNAL_ERROR |
| 68 | * if the tunnel creation failed internally, SUCCESS if the tunnel is created |
| 69 | * successfully |
sangho | 27462c6 | 2015-05-14 00:39:53 -0700 | [diff] [blame] | 70 | */ |
sangho | bd812f8 | 2015-06-29 14:58:47 -0700 | [diff] [blame] | 71 | TunnelHandler.Result createTunnel(Tunnel tunnel); |
sangho | 27462c6 | 2015-05-14 00:39:53 -0700 | [diff] [blame] | 72 | |
| 73 | /** |
| 74 | * Returns all policies. |
| 75 | * |
| 76 | * @return list of policy |
| 77 | */ |
| 78 | List<Policy> getPolicies(); |
| 79 | |
| 80 | /** |
| 81 | * Creates a policy. |
| 82 | * |
| 83 | * @param policy policy reference to create |
sangho | bd812f8 | 2015-06-29 14:58:47 -0700 | [diff] [blame] | 84 | * @return ID_EXISTS if the same policy ID exists, |
| 85 | * POLICY_EXISTS if the same policy exists, TUNNEL_NOT_FOUND if the tunnel |
| 86 | * does not exists, UNSUPPORTED_TYPE if the policy type is not supported, |
| 87 | * SUCCESS if the policy is created successfully. |
sangho | 27462c6 | 2015-05-14 00:39:53 -0700 | [diff] [blame] | 88 | */ |
sangho | bd812f8 | 2015-06-29 14:58:47 -0700 | [diff] [blame] | 89 | PolicyHandler.Result createPolicy(Policy policy); |
sangho | 27462c6 | 2015-05-14 00:39:53 -0700 | [diff] [blame] | 90 | |
| 91 | /** |
| 92 | * Removes a tunnel. |
| 93 | * |
| 94 | * @param tunnel tunnel reference to remove |
sangho | bd812f8 | 2015-06-29 14:58:47 -0700 | [diff] [blame] | 95 | * @return TUNNEL_NOT_FOUND if the tunnel to remove does not exists, |
| 96 | * INTERNAL_ERROR if the tunnel creation failed internally, SUCCESS |
| 97 | * if the tunnel is created successfully. |
sangho | 27462c6 | 2015-05-14 00:39:53 -0700 | [diff] [blame] | 98 | */ |
sangho | bd812f8 | 2015-06-29 14:58:47 -0700 | [diff] [blame] | 99 | TunnelHandler.Result removeTunnel(Tunnel tunnel); |
sangho | 27462c6 | 2015-05-14 00:39:53 -0700 | [diff] [blame] | 100 | |
| 101 | /** |
| 102 | * Removes a policy. |
| 103 | * |
| 104 | * @param policy policy reference to remove |
sangho | bd812f8 | 2015-06-29 14:58:47 -0700 | [diff] [blame] | 105 | * @return POLICY_NOT_FOUND if the policy to remove does not exists, |
| 106 | * SUCCESS if it is removed successfully |
sangho | 27462c6 | 2015-05-14 00:39:53 -0700 | [diff] [blame] | 107 | */ |
sangho | bd812f8 | 2015-06-29 14:58:47 -0700 | [diff] [blame] | 108 | PolicyHandler.Result removePolicy(Policy policy); |
Saurav Das | 07c7460 | 2016-04-27 18:35:50 -0700 | [diff] [blame] | 109 | |
| 110 | /** |
| 111 | * Use current state of the network to repopulate forwarding rules. |
| 112 | * |
| 113 | */ |
| 114 | void rerouteNetwork(); |
Charles Chan | d7844e5 | 2016-10-20 17:02:44 -0700 | [diff] [blame] | 115 | |
| 116 | /** |
| 117 | * Returns device-subnet mapping. |
| 118 | * |
| 119 | * @return device-subnet mapping |
| 120 | */ |
Pier Ventre | b6a7f34 | 2016-11-26 21:05:22 -0800 | [diff] [blame] | 121 | Map<DeviceId, Set<IpPrefix>> getDeviceSubnetMap(); |
Saurav Das | 62ae679 | 2017-05-15 15:34:25 -0700 | [diff] [blame^] | 122 | |
| 123 | /** |
| 124 | * Returns the current ECMP shortest path graph in this controller instance. |
| 125 | * |
| 126 | * @return ECMP shortest path graph |
| 127 | */ |
| 128 | ImmutableMap<DeviceId, EcmpShortestPathGraph> getCurrentEcmpSpg(); |
| 129 | |
| 130 | /** |
| 131 | * Returns the neighborSet-NextObjective store contents. |
| 132 | * |
| 133 | * @return current contents of the neighborSetNextObjectiveStore |
| 134 | */ |
| 135 | ImmutableMap<NeighborSetNextObjectiveStoreKey, Integer> getNeighborSet(); |
sangho | 27462c6 | 2015-05-14 00:39:53 -0700 | [diff] [blame] | 136 | } |