blob: c0b096a404b94bd64fabdef9fe6ff3ef1ad3685f [file] [log] [blame]
sangho27462c62015-05-14 00:39:53 -07001/*
Brian O'Connor43b53542016-04-09 01:19:45 -07002 * Copyright 2015-present Open Networking Laboratory
sangho27462c62015-05-14 00:39:53 -07003 *
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 */
16package org.onosproject.segmentrouting;
17
Pier Ventreb6a7f342016-11-26 21:05:22 -080018import org.onlab.packet.IpPrefix;
Charles Chand7844e52016-10-20 17:02:44 -070019import org.onosproject.net.DeviceId;
Saurav Das62ae6792017-05-15 15:34:25 -070020import org.onosproject.segmentrouting.storekey.NeighborSetNextObjectiveStoreKey;
21
22import com.google.common.collect.ImmutableMap;
Charles Chand7844e52016-10-20 17:02:44 -070023
sangho27462c62015-05-14 00:39:53 -070024import java.util.List;
Charles Chand7844e52016-10-20 17:02:44 -070025import java.util.Map;
26import java.util.Set;
sangho27462c62015-05-14 00:39:53 -070027
28/**
29 * Segment Routing Service for REST API.
30 */
31public interface SegmentRoutingService {
Charles Chan82ab1932016-01-30 23:22:37 -080032 /**
Charles Chan82ab1932016-01-30 23:22:37 -080033 * 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 Chand86904c2016-02-18 10:43:46 -080045 * Should < 0 such that priority of /0 will not conflict with lowest
Charles Chan82ab1932016-01-30 23:22:37 -080046 * priority default entries.
47 */
48 int MIN_IP_PRIORITY = 10;
49
50 /**
51 * Subnet flooding flow priority.
52 */
53 int FLOOD_PRIORITY = 5;
54
sangho27462c62015-05-14 00:39:53 -070055 /**
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
sanghobd812f82015-06-29 14:58:47 -070066 * @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
sangho27462c62015-05-14 00:39:53 -070070 */
sanghobd812f82015-06-29 14:58:47 -070071 TunnelHandler.Result createTunnel(Tunnel tunnel);
sangho27462c62015-05-14 00:39:53 -070072
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
sanghobd812f82015-06-29 14:58:47 -070084 * @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.
sangho27462c62015-05-14 00:39:53 -070088 */
sanghobd812f82015-06-29 14:58:47 -070089 PolicyHandler.Result createPolicy(Policy policy);
sangho27462c62015-05-14 00:39:53 -070090
91 /**
92 * Removes a tunnel.
93 *
94 * @param tunnel tunnel reference to remove
sanghobd812f82015-06-29 14:58:47 -070095 * @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.
sangho27462c62015-05-14 00:39:53 -070098 */
sanghobd812f82015-06-29 14:58:47 -070099 TunnelHandler.Result removeTunnel(Tunnel tunnel);
sangho27462c62015-05-14 00:39:53 -0700100
101 /**
102 * Removes a policy.
103 *
104 * @param policy policy reference to remove
sanghobd812f82015-06-29 14:58:47 -0700105 * @return POLICY_NOT_FOUND if the policy to remove does not exists,
106 * SUCCESS if it is removed successfully
sangho27462c62015-05-14 00:39:53 -0700107 */
sanghobd812f82015-06-29 14:58:47 -0700108 PolicyHandler.Result removePolicy(Policy policy);
Saurav Das07c74602016-04-27 18:35:50 -0700109
110 /**
111 * Use current state of the network to repopulate forwarding rules.
112 *
113 */
114 void rerouteNetwork();
Charles Chand7844e52016-10-20 17:02:44 -0700115
116 /**
117 * Returns device-subnet mapping.
118 *
119 * @return device-subnet mapping
120 */
Pier Ventreb6a7f342016-11-26 21:05:22 -0800121 Map<DeviceId, Set<IpPrefix>> getDeviceSubnetMap();
Saurav Das62ae6792017-05-15 15:34:25 -0700122
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();
sangho27462c62015-05-14 00:39:53 -0700136}