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