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 | 71c5577 | 2018-04-17 17:25:22 +0200 | [diff] [blame] | 18 | import com.google.common.collect.Multimap; |
Charles Chan | 8d31633 | 2018-06-19 20:31:57 -0700 | [diff] [blame] | 19 | import org.apache.commons.lang3.NotImplementedException; |
Pier Luigi | 0f9635b | 2018-01-15 18:06:43 +0100 | [diff] [blame] | 20 | import org.onlab.packet.IpAddress; |
Pier Ventre | b6a7f34 | 2016-11-26 21:05:22 -0800 | [diff] [blame] | 21 | import org.onlab.packet.IpPrefix; |
pierventre | 4f68ffa | 2021-03-09 22:52:14 +0100 | [diff] [blame] | 22 | import org.onlab.packet.MacAddress; |
Charles Chan | 8d31633 | 2018-06-19 20:31:57 -0700 | [diff] [blame] | 23 | import org.onlab.packet.VlanId; |
Pier | db27b8d | 2018-04-17 16:29:56 +0200 | [diff] [blame] | 24 | import org.onosproject.cluster.NodeId; |
Charles Chan | 8d31633 | 2018-06-19 20:31:57 -0700 | [diff] [blame] | 25 | import org.onosproject.core.ApplicationId; |
Pier Luigi | 0f9635b | 2018-01-15 18:06:43 +0100 | [diff] [blame] | 26 | import org.onosproject.net.ConnectPoint; |
Charles Chan | d7844e5 | 2016-10-20 17:02:44 -0700 | [diff] [blame] | 27 | import org.onosproject.net.DeviceId; |
Saurav Das | 6430f41 | 2018-01-25 09:49:01 -0800 | [diff] [blame] | 28 | import org.onosproject.net.Link; |
| 29 | import org.onosproject.net.PortNumber; |
Charles Chan | 0b1dd7e | 2018-08-19 19:21:46 -0700 | [diff] [blame] | 30 | import org.onosproject.net.flowobjective.NextObjective; |
pierventre | 4f68ffa | 2021-03-09 22:52:14 +0100 | [diff] [blame] | 31 | import org.onosproject.segmentrouting.config.DeviceConfigNotFoundException; |
Saurav Das | 261c300 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 32 | import org.onosproject.segmentrouting.grouphandler.NextNeighbors; |
Harshada Chaundkar | 9204f31 | 2019-07-02 16:01:24 +0000 | [diff] [blame] | 33 | import org.onosproject.segmentrouting.mcast.McastFilteringObjStoreKey; |
Pier Luigi | 69f774d | 2018-02-28 12:10:50 +0100 | [diff] [blame] | 34 | import org.onosproject.segmentrouting.mcast.McastRole; |
Pier | e99511d | 2018-04-19 16:47:06 +0200 | [diff] [blame] | 35 | import org.onosproject.segmentrouting.mcast.McastRoleStoreKey; |
Andreas Pantelopoulos | fc4bc2a | 2018-03-12 16:30:20 -0700 | [diff] [blame] | 36 | import org.onosproject.segmentrouting.pwaas.DefaultL2TunnelDescription; |
Andreas Pantelopoulos | 4c7de13 | 2018-02-22 12:32:42 -0800 | [diff] [blame] | 37 | import org.onosproject.segmentrouting.pwaas.L2Tunnel; |
Andreas Pantelopoulos | 5e7be3d | 2017-10-23 12:18:25 -0700 | [diff] [blame] | 38 | import org.onosproject.segmentrouting.pwaas.L2TunnelHandler; |
Andreas Pantelopoulos | 4c7de13 | 2018-02-22 12:32:42 -0800 | [diff] [blame] | 39 | import org.onosproject.segmentrouting.pwaas.L2TunnelPolicy; |
Andreas Pantelopoulos | cdbb22c | 2018-02-23 14:18:00 -0800 | [diff] [blame] | 40 | import org.onosproject.segmentrouting.pwaas.L2TunnelDescription; |
Saurav Das | 261c300 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 41 | import org.onosproject.segmentrouting.storekey.DestinationSetNextObjectiveStoreKey; |
Saurav Das | 62ae679 | 2017-05-15 15:34:25 -0700 | [diff] [blame] | 42 | |
| 43 | import com.google.common.collect.ImmutableMap; |
Pier | e99511d | 2018-04-19 16:47:06 +0200 | [diff] [blame] | 44 | import org.onosproject.segmentrouting.mcast.McastStoreKey; |
Charles Chan | 0b1dd7e | 2018-08-19 19:21:46 -0700 | [diff] [blame] | 45 | import org.onosproject.segmentrouting.storekey.PortNextObjectiveStoreKey; |
| 46 | import org.onosproject.segmentrouting.storekey.VlanNextObjectiveStoreKey; |
Ruchi Sahota | 71bcb4e | 2019-01-28 01:08:18 +0000 | [diff] [blame] | 47 | import org.onosproject.segmentrouting.storekey.MacVlanNextObjectiveStoreKey; |
Charles Chan | d7844e5 | 2016-10-20 17:02:44 -0700 | [diff] [blame] | 48 | |
sangho | 27462c6 | 2015-05-14 00:39:53 -0700 | [diff] [blame] | 49 | import java.util.List; |
Charles Chan | d7844e5 | 2016-10-20 17:02:44 -0700 | [diff] [blame] | 50 | import java.util.Map; |
Charles Chan | 8d31633 | 2018-06-19 20:31:57 -0700 | [diff] [blame] | 51 | import java.util.Optional; |
Charles Chan | d7844e5 | 2016-10-20 17:02:44 -0700 | [diff] [blame] | 52 | import java.util.Set; |
sangho | 27462c6 | 2015-05-14 00:39:53 -0700 | [diff] [blame] | 53 | |
| 54 | /** |
| 55 | * Segment Routing Service for REST API. |
| 56 | */ |
| 57 | public interface SegmentRoutingService { |
Charles Chan | 82ab193 | 2016-01-30 23:22:37 -0800 | [diff] [blame] | 58 | /** |
Charles Chan | 868c957 | 2018-06-15 18:54:18 -0700 | [diff] [blame] | 59 | * VLAN cross-connect ACL priority. |
Charles Chan | 8d31633 | 2018-06-19 20:31:57 -0700 | [diff] [blame] | 60 | * |
| 61 | * @deprecated in ONOS 1.12. Replaced by {@link org.onosproject.segmentrouting.xconnect.api.XconnectService} |
Charles Chan | 868c957 | 2018-06-15 18:54:18 -0700 | [diff] [blame] | 62 | */ |
Charles Chan | 8d31633 | 2018-06-19 20:31:57 -0700 | [diff] [blame] | 63 | @Deprecated |
Charles Chan | 868c957 | 2018-06-15 18:54:18 -0700 | [diff] [blame] | 64 | int XCONNECT_ACL_PRIORITY = 60000; |
| 65 | |
| 66 | /** |
| 67 | * VLAN cross-connect Bridging priority. |
Charles Chan | 8d31633 | 2018-06-19 20:31:57 -0700 | [diff] [blame] | 68 | * |
| 69 | * @deprecated in ONOS 1.12. Replaced by {@link org.onosproject.segmentrouting.xconnect.api.XconnectService} |
Charles Chan | 82ab193 | 2016-01-30 23:22:37 -0800 | [diff] [blame] | 70 | */ |
Charles Chan | 8d31633 | 2018-06-19 20:31:57 -0700 | [diff] [blame] | 71 | @Deprecated |
Charles Chan | 82ab193 | 2016-01-30 23:22:37 -0800 | [diff] [blame] | 72 | int XCONNECT_PRIORITY = 1000; |
| 73 | |
| 74 | /** |
| 75 | * Default flow priority. |
| 76 | */ |
| 77 | int DEFAULT_PRIORITY = 100; |
| 78 | |
| 79 | /** |
| 80 | * Minimum IP priority. |
| 81 | * |
Charles Chan | d86904c | 2016-02-18 10:43:46 -0800 | [diff] [blame] | 82 | * Should < 0 such that priority of /0 will not conflict with lowest |
Charles Chan | 82ab193 | 2016-01-30 23:22:37 -0800 | [diff] [blame] | 83 | * priority default entries. |
| 84 | */ |
| 85 | int MIN_IP_PRIORITY = 10; |
| 86 | |
| 87 | /** |
| 88 | * Subnet flooding flow priority. |
| 89 | */ |
| 90 | int FLOOD_PRIORITY = 5; |
| 91 | |
sangho | 27462c6 | 2015-05-14 00:39:53 -0700 | [diff] [blame] | 92 | /** |
| 93 | * Returns all tunnels. |
| 94 | * |
| 95 | * @return list of tunnels |
| 96 | */ |
| 97 | List<Tunnel> getTunnels(); |
| 98 | |
| 99 | /** |
| 100 | * Creates a tunnel. |
| 101 | * |
| 102 | * @param tunnel tunnel reference to create |
sangho | bd812f8 | 2015-06-29 14:58:47 -0700 | [diff] [blame] | 103 | * @return WRONG_PATH if the tunnel path is wrong, ID_EXISTS if the tunnel ID |
| 104 | * exists already, TUNNEL_EXISTS if the same tunnel exists, INTERNAL_ERROR |
| 105 | * if the tunnel creation failed internally, SUCCESS if the tunnel is created |
| 106 | * 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 | TunnelHandler.Result createTunnel(Tunnel tunnel); |
sangho | 27462c6 | 2015-05-14 00:39:53 -0700 | [diff] [blame] | 109 | |
| 110 | /** |
| 111 | * Returns all policies. |
| 112 | * |
| 113 | * @return list of policy |
| 114 | */ |
| 115 | List<Policy> getPolicies(); |
| 116 | |
| 117 | /** |
Andreas Pantelopoulos | fc4bc2a | 2018-03-12 16:30:20 -0700 | [diff] [blame] | 118 | * Returns the l2 tunnel descriptions. |
| 119 | * |
Andreas Pantelopoulos | d988c1a | 2018-03-15 16:56:09 -0700 | [diff] [blame] | 120 | * @param pending if true fetch pending pseudowires, else fetch installed |
Andreas Pantelopoulos | fc4bc2a | 2018-03-12 16:30:20 -0700 | [diff] [blame] | 121 | * @return set of l2 tunnel descriptions. |
| 122 | */ |
Andreas Pantelopoulos | d988c1a | 2018-03-15 16:56:09 -0700 | [diff] [blame] | 123 | Set<L2TunnelDescription> getL2TunnelDescriptions(boolean pending); |
Andreas Pantelopoulos | fc4bc2a | 2018-03-12 16:30:20 -0700 | [diff] [blame] | 124 | |
| 125 | /** |
Andreas Pantelopoulos | 5e7be3d | 2017-10-23 12:18:25 -0700 | [diff] [blame] | 126 | * Returns all l2 tunnels of pseudowires. |
| 127 | * |
| 128 | * @return list of l2 tunnels |
| 129 | */ |
Andreas Pantelopoulos | 4c7de13 | 2018-02-22 12:32:42 -0800 | [diff] [blame] | 130 | List<L2Tunnel> getL2Tunnels(); |
Andreas Pantelopoulos | 5e7be3d | 2017-10-23 12:18:25 -0700 | [diff] [blame] | 131 | |
| 132 | /** |
| 133 | * Returns all l2 policie of pseudowires. |
| 134 | * |
| 135 | * @return list of l2 policies. |
| 136 | */ |
Andreas Pantelopoulos | 4c7de13 | 2018-02-22 12:32:42 -0800 | [diff] [blame] | 137 | List<L2TunnelPolicy> getL2Policies(); |
Andreas Pantelopoulos | 5e7be3d | 2017-10-23 12:18:25 -0700 | [diff] [blame] | 138 | |
| 139 | /** |
Andreas Pantelopoulos | fc4bc2a | 2018-03-12 16:30:20 -0700 | [diff] [blame] | 140 | * Removes pseudowire. |
Andreas Pantelopoulos | 5e7be3d | 2017-10-23 12:18:25 -0700 | [diff] [blame] | 141 | * |
Andreas Pantelopoulos | cdbb22c | 2018-02-23 14:18:00 -0800 | [diff] [blame] | 142 | * @param pwId The id of the pseudowire. |
Andreas Pantelopoulos | 5e7be3d | 2017-10-23 12:18:25 -0700 | [diff] [blame] | 143 | * @return SUCCESS if operation successful or a descriptive error otherwise. |
| 144 | */ |
Andreas Pantelopoulos | cdbb22c | 2018-02-23 14:18:00 -0800 | [diff] [blame] | 145 | L2TunnelHandler.Result removePseudowire(Integer pwId); |
Andreas Pantelopoulos | 5e7be3d | 2017-10-23 12:18:25 -0700 | [diff] [blame] | 146 | |
| 147 | /** |
Andreas Pantelopoulos | fc4bc2a | 2018-03-12 16:30:20 -0700 | [diff] [blame] | 148 | * Adds a Pseudowire to the system. |
Andreas Pantelopoulos | 5e7be3d | 2017-10-23 12:18:25 -0700 | [diff] [blame] | 149 | * |
Andreas Pantelopoulos | cdbb22c | 2018-02-23 14:18:00 -0800 | [diff] [blame] | 150 | * @param tunnel The pseudowire tunnel. |
Andreas Pantelopoulos | 5e7be3d | 2017-10-23 12:18:25 -0700 | [diff] [blame] | 151 | * @return SUCCESS if operation is successful or a descriptive error otherwise. |
| 152 | */ |
Andreas Pantelopoulos | cdbb22c | 2018-02-23 14:18:00 -0800 | [diff] [blame] | 153 | L2TunnelHandler.Result addPseudowire(L2TunnelDescription tunnel); |
Andreas Pantelopoulos | 5e7be3d | 2017-10-23 12:18:25 -0700 | [diff] [blame] | 154 | |
| 155 | /** |
Andreas Pantelopoulos | 9685125 | 2018-03-20 13:58:49 -0700 | [diff] [blame] | 156 | * Adds a set of pseudowires. |
| 157 | * |
| 158 | * |
Andreas Pantelopoulos | fc4bc2a | 2018-03-12 16:30:20 -0700 | [diff] [blame] | 159 | * @param l2TunnelDescriptions The pseudowires to add. |
| 160 | * @return SUCCESS if ALL pseudowires can be instantiated and are deployed, or a |
| 161 | * a descriptive error otherwise, without deploying any pseudowire. |
Andreas Pantelopoulos | 9685125 | 2018-03-20 13:58:49 -0700 | [diff] [blame] | 162 | * @deprecated onos-1.12 use addPseudowire instead |
Andreas Pantelopoulos | fc4bc2a | 2018-03-12 16:30:20 -0700 | [diff] [blame] | 163 | */ |
Andreas Pantelopoulos | 9685125 | 2018-03-20 13:58:49 -0700 | [diff] [blame] | 164 | @Deprecated |
Andreas Pantelopoulos | fc4bc2a | 2018-03-12 16:30:20 -0700 | [diff] [blame] | 165 | L2TunnelHandler.Result addPseudowiresBulk(List<DefaultL2TunnelDescription> l2TunnelDescriptions); |
| 166 | |
| 167 | /** |
sangho | 27462c6 | 2015-05-14 00:39:53 -0700 | [diff] [blame] | 168 | * Creates a policy. |
| 169 | * |
| 170 | * @param policy policy reference to create |
sangho | bd812f8 | 2015-06-29 14:58:47 -0700 | [diff] [blame] | 171 | * @return ID_EXISTS if the same policy ID exists, |
| 172 | * POLICY_EXISTS if the same policy exists, TUNNEL_NOT_FOUND if the tunnel |
| 173 | * does not exists, UNSUPPORTED_TYPE if the policy type is not supported, |
| 174 | * SUCCESS if the policy is created successfully. |
sangho | 27462c6 | 2015-05-14 00:39:53 -0700 | [diff] [blame] | 175 | */ |
sangho | bd812f8 | 2015-06-29 14:58:47 -0700 | [diff] [blame] | 176 | PolicyHandler.Result createPolicy(Policy policy); |
sangho | 27462c6 | 2015-05-14 00:39:53 -0700 | [diff] [blame] | 177 | |
| 178 | /** |
| 179 | * Removes a tunnel. |
| 180 | * |
| 181 | * @param tunnel tunnel reference to remove |
sangho | bd812f8 | 2015-06-29 14:58:47 -0700 | [diff] [blame] | 182 | * @return TUNNEL_NOT_FOUND if the tunnel to remove does not exists, |
| 183 | * INTERNAL_ERROR if the tunnel creation failed internally, SUCCESS |
| 184 | * if the tunnel is created successfully. |
sangho | 27462c6 | 2015-05-14 00:39:53 -0700 | [diff] [blame] | 185 | */ |
sangho | bd812f8 | 2015-06-29 14:58:47 -0700 | [diff] [blame] | 186 | TunnelHandler.Result removeTunnel(Tunnel tunnel); |
sangho | 27462c6 | 2015-05-14 00:39:53 -0700 | [diff] [blame] | 187 | |
| 188 | /** |
| 189 | * Removes a policy. |
| 190 | * |
| 191 | * @param policy policy reference to remove |
sangho | bd812f8 | 2015-06-29 14:58:47 -0700 | [diff] [blame] | 192 | * @return POLICY_NOT_FOUND if the policy to remove does not exists, |
| 193 | * SUCCESS if it is removed successfully |
sangho | 27462c6 | 2015-05-14 00:39:53 -0700 | [diff] [blame] | 194 | */ |
sangho | bd812f8 | 2015-06-29 14:58:47 -0700 | [diff] [blame] | 195 | PolicyHandler.Result removePolicy(Policy policy); |
Saurav Das | 07c7460 | 2016-04-27 18:35:50 -0700 | [diff] [blame] | 196 | |
| 197 | /** |
| 198 | * Use current state of the network to repopulate forwarding rules. |
| 199 | * |
| 200 | */ |
| 201 | void rerouteNetwork(); |
Charles Chan | d7844e5 | 2016-10-20 17:02:44 -0700 | [diff] [blame] | 202 | |
| 203 | /** |
| 204 | * Returns device-subnet mapping. |
| 205 | * |
| 206 | * @return device-subnet mapping |
| 207 | */ |
Pier Ventre | b6a7f34 | 2016-11-26 21:05:22 -0800 | [diff] [blame] | 208 | Map<DeviceId, Set<IpPrefix>> getDeviceSubnetMap(); |
Saurav Das | 62ae679 | 2017-05-15 15:34:25 -0700 | [diff] [blame] | 209 | |
| 210 | /** |
| 211 | * Returns the current ECMP shortest path graph in this controller instance. |
| 212 | * |
| 213 | * @return ECMP shortest path graph |
| 214 | */ |
| 215 | ImmutableMap<DeviceId, EcmpShortestPathGraph> getCurrentEcmpSpg(); |
| 216 | |
| 217 | /** |
Saurav Das | 261c300 | 2017-06-13 15:35:54 -0700 | [diff] [blame] | 218 | * Returns the destinatiomSet-NextObjective store contents. |
Saurav Das | 62ae679 | 2017-05-15 15:34:25 -0700 | [diff] [blame] | 219 | * |
Charles Chan | 0b1dd7e | 2018-08-19 19:21:46 -0700 | [diff] [blame] | 220 | * @return current contents of the dstNextObjStore |
Saurav Das | 62ae679 | 2017-05-15 15:34:25 -0700 | [diff] [blame] | 221 | */ |
Charles Chan | 0b1dd7e | 2018-08-19 19:21:46 -0700 | [diff] [blame] | 222 | ImmutableMap<DestinationSetNextObjectiveStoreKey, NextNeighbors> getDstNextObjStore(); |
| 223 | |
| 224 | /** |
| 225 | * Returns the VLAN next objective store. |
| 226 | * |
| 227 | * @return current contents of the vlanNextObjStore |
| 228 | */ |
| 229 | ImmutableMap<VlanNextObjectiveStoreKey, Integer> getVlanNextObjStore(); |
| 230 | |
| 231 | /** |
Ruchi Sahota | 71bcb4e | 2019-01-28 01:08:18 +0000 | [diff] [blame] | 232 | * Returns the Mac Vlan next objective store. |
| 233 | * |
| 234 | * @return current contents of the macVlanNextObjStore |
| 235 | */ |
| 236 | ImmutableMap<MacVlanNextObjectiveStoreKey, Integer> getMacVlanNextObjStore(); |
| 237 | |
| 238 | /** |
Charles Chan | 0b1dd7e | 2018-08-19 19:21:46 -0700 | [diff] [blame] | 239 | * Returns the port next objective store. |
| 240 | * |
| 241 | * @return current contents of the portNextObjStore |
| 242 | */ |
| 243 | ImmutableMap<PortNextObjectiveStoreKey, Integer> getPortNextObjStore(); |
| 244 | |
| 245 | /** |
| 246 | * Returns the associated next ids to the mcast groups or to the single |
| 247 | * group if mcastIp is present. |
| 248 | * |
| 249 | * @param mcastIp the group ip |
| 250 | * @return the mapping mcastIp-device to next id |
| 251 | */ |
| 252 | Map<McastStoreKey, Integer> getMcastNextIds(IpAddress mcastIp); |
| 253 | |
| 254 | /** |
| 255 | * Returns the PW init next objective store. |
| 256 | * |
| 257 | * @return current contents of the l2InitiationNextObjStore |
| 258 | */ |
| 259 | ImmutableMap<String, NextObjective> getPwInitNext(); |
| 260 | |
| 261 | /** |
| 262 | * Returns the PW termination next objective store. |
| 263 | * |
| 264 | * @return current contents of the l2TerminationNextObjStore |
| 265 | */ |
| 266 | ImmutableMap<String, NextObjective> getPwTermNext(); |
| 267 | |
| 268 | /** |
| 269 | * Removes all entries in dst/vlan/port/mcast NextObjectiveStore that are associated with the given nextId. |
| 270 | * |
| 271 | * @param nextId nextId |
| 272 | */ |
| 273 | void invalidateNextObj(int nextId); |
Saurav Das | fbe7457 | 2017-08-03 18:30:35 -0700 | [diff] [blame] | 274 | |
| 275 | /** |
| 276 | * Triggers the verification of all ECMP groups in the specified device. |
| 277 | * Adjusts the group buckets if verification finds that there are more or less |
| 278 | * buckets than what should be there. |
| 279 | * |
| 280 | * @param id the device identifier |
| 281 | */ |
| 282 | void verifyGroups(DeviceId id); |
Saurav Das | 6430f41 | 2018-01-25 09:49:01 -0800 | [diff] [blame] | 283 | |
| 284 | /** |
| 285 | * Returns the internal link state as seen by this instance of the |
| 286 | * controller. |
| 287 | * |
| 288 | * @return the internal link state |
| 289 | */ |
| 290 | ImmutableMap<Link, Boolean> getSeenLinks(); |
| 291 | |
| 292 | /** |
| 293 | * Returns the ports administratively disabled by the controller. |
| 294 | * |
| 295 | * @return a map of devices and port numbers for administratively disabled |
| 296 | * ports. Does not include ports manually disabled by the operator. |
| 297 | */ |
| 298 | ImmutableMap<DeviceId, Set<PortNumber>> getDownedPortState(); |
Pier Luigi | 0f9635b | 2018-01-15 18:06:43 +0100 | [diff] [blame] | 299 | |
Pier | e99511d | 2018-04-19 16:47:06 +0200 | [diff] [blame] | 300 | /** |
Pier | e99511d | 2018-04-19 16:47:06 +0200 | [diff] [blame] | 301 | * Returns the associated roles to the mcast groups. |
| 302 | * |
| 303 | * @param mcastIp the group ip |
| 304 | * @param sourcecp the source connect point |
| 305 | * @return the mapping mcastIp-device to mcast role |
| 306 | */ |
| 307 | Map<McastRoleStoreKey, McastRole> getMcastRoles(IpAddress mcastIp, |
| 308 | ConnectPoint sourcecp); |
| 309 | |
| 310 | /** |
Pier | 71c5577 | 2018-04-17 17:25:22 +0200 | [diff] [blame] | 311 | * Returns the associated trees to the mcast group. |
| 312 | * |
| 313 | * @param mcastIp the group ip |
| 314 | * @param sourcecp the source connect point |
| 315 | * @return the mapping egress point to mcast path |
| 316 | */ |
| 317 | Multimap<ConnectPoint, List<ConnectPoint>> getMcastTrees(IpAddress mcastIp, |
| 318 | ConnectPoint sourcecp); |
| 319 | |
Pier | db27b8d | 2018-04-17 16:29:56 +0200 | [diff] [blame] | 320 | /** |
| 321 | * Return the leaders of the mcast groups. |
| 322 | * |
| 323 | * @param mcastIp the group ip |
| 324 | * @return the mapping group-node |
| 325 | */ |
| 326 | Map<IpAddress, NodeId> getMcastLeaders(IpAddress mcastIp); |
Charles Chan | b13e070 | 2018-04-17 18:56:53 -0700 | [diff] [blame] | 327 | |
| 328 | /** |
| 329 | * Returns shouldProgram map. |
| 330 | * |
| 331 | * @return shouldProgram map |
| 332 | */ |
| 333 | Map<Set<DeviceId>, NodeId> getShouldProgram(); |
| 334 | |
| 335 | /** |
| 336 | * Returns shouldProgram local cache. |
| 337 | * |
| 338 | * @return shouldProgram local cache |
| 339 | */ |
| 340 | Map<DeviceId, Boolean> getShouldProgramCache(); |
Charles Chan | 8d31633 | 2018-06-19 20:31:57 -0700 | [diff] [blame] | 341 | |
| 342 | /** |
jayakumarthazhath | 66c9ec1 | 2018-10-01 00:51:54 +0530 | [diff] [blame] | 343 | * Returns whether instance should program device or not. |
| 344 | * |
| 345 | * @param deviceId . |
| 346 | * @return boolean status saying instance should program device or not. |
| 347 | */ |
| 348 | boolean shouldProgram(DeviceId deviceId); |
| 349 | |
| 350 | /** |
Harshada Chaundkar | 9204f31 | 2019-07-02 16:01:24 +0000 | [diff] [blame] | 351 | * Returns the mcast filtering obj. |
| 352 | * |
| 353 | * @return the mapping group-node |
| 354 | */ |
| 355 | Map<DeviceId, List<McastFilteringObjStoreKey>> getMcastFilters(); |
| 356 | |
| 357 | /** |
Charles Chan | 12a8a84 | 2020-02-14 13:23:57 -0800 | [diff] [blame] | 358 | * Determines if routing in the network has been stable in the last |
| 359 | * STABILITY_THRESHOLD seconds, by comparing the current time to the last |
| 360 | * routing change timestamp. |
| 361 | * |
| 362 | * @return true if stable |
| 363 | */ |
| 364 | boolean isRoutingStable(); |
| 365 | |
| 366 | /** |
| 367 | * Invoke hostHandler.init() for given device. |
| 368 | * |
| 369 | * @param deviceId device ID |
| 370 | */ |
| 371 | void initHost(DeviceId deviceId); |
| 372 | |
| 373 | /** |
| 374 | * Invoke routeHandler.init() for given device. |
| 375 | * |
| 376 | * @param deviceId device ID |
| 377 | */ |
| 378 | void initRoute(DeviceId deviceId); |
| 379 | |
| 380 | /** |
Charles Chan | 8d31633 | 2018-06-19 20:31:57 -0700 | [diff] [blame] | 381 | * Gets application id. |
| 382 | * |
| 383 | * @return application id |
| 384 | */ |
| 385 | default ApplicationId appId() { |
| 386 | throw new NotImplementedException("appId not implemented"); |
| 387 | } |
| 388 | |
| 389 | /** |
| 390 | * Returns internal VLAN for untagged hosts on given connect point. |
| 391 | * <p> |
| 392 | * The internal VLAN is either vlan-untagged for an access port, |
| 393 | * or vlan-native for a trunk port. |
| 394 | * |
| 395 | * @param connectPoint connect point |
| 396 | * @return internal VLAN or null if both vlan-untagged and vlan-native are undefined |
| 397 | */ |
Charles Chan | 8d31633 | 2018-06-19 20:31:57 -0700 | [diff] [blame] | 398 | default VlanId getInternalVlanId(ConnectPoint connectPoint) { |
| 399 | throw new NotImplementedException("getInternalVlanId not implemented"); |
| 400 | } |
| 401 | |
Charles Chan | 8d31633 | 2018-06-19 20:31:57 -0700 | [diff] [blame] | 402 | /** |
| 403 | * Returns optional pair device ID of given device. |
| 404 | * |
| 405 | * @param deviceId device ID |
| 406 | * @return optional pair device ID. Might be empty if pair device is not configured |
| 407 | */ |
Charles Chan | 8d31633 | 2018-06-19 20:31:57 -0700 | [diff] [blame] | 408 | default Optional<DeviceId> getPairDeviceId(DeviceId deviceId) { |
| 409 | throw new NotImplementedException("getPairDeviceId not implemented"); |
| 410 | } |
| 411 | |
Charles Chan | 8d31633 | 2018-06-19 20:31:57 -0700 | [diff] [blame] | 412 | /** |
| 413 | * Returns optional pair device local port of given device. |
| 414 | * |
| 415 | * @param deviceId device ID |
| 416 | * @return optional pair device ID. Might be empty if pair device is not configured |
| 417 | */ |
Charles Chan | 8d31633 | 2018-06-19 20:31:57 -0700 | [diff] [blame] | 418 | default Optional<PortNumber> getPairLocalPort(DeviceId deviceId) { |
| 419 | throw new NotImplementedException("getPairLocalPort not implemented"); |
| 420 | } |
Harshada Chaundkar | 9204f31 | 2019-07-02 16:01:24 +0000 | [diff] [blame] | 421 | |
Charles Chan | 12a8a84 | 2020-02-14 13:23:57 -0800 | [diff] [blame] | 422 | /** |
| 423 | * Returns a set of infrastructure ports on the given device. |
| 424 | * |
| 425 | * @param deviceId device ID |
| 426 | * @return a set of ports that does not have interface configuration |
| 427 | */ |
| 428 | default Set<PortNumber> getInfraPorts(DeviceId deviceId) { |
| 429 | throw new NotImplementedException("getInfraPorts not implemented"); |
| 430 | } |
| 431 | |
| 432 | /** |
| 433 | * Returns a set of edge ports on the given device. |
| 434 | * |
| 435 | * @param deviceId device ID |
| 436 | * @return a set of ports that has interface configuration |
| 437 | */ |
| 438 | default Set<PortNumber> getEdgePorts(DeviceId deviceId) { |
| 439 | throw new NotImplementedException("getEdgePorts not implemented"); |
| 440 | } |
pierventre | 30368ab | 2021-02-24 23:23:22 +0100 | [diff] [blame] | 441 | |
| 442 | /** |
| 443 | * Returns a list of edge devices. |
| 444 | * |
| 445 | * @return list of the edge device ids |
| 446 | */ |
| 447 | List<DeviceId> getEdgeDeviceIds(); |
pierventre | 4f68ffa | 2021-03-09 22:52:14 +0100 | [diff] [blame] | 448 | |
| 449 | /** |
Charles Chan | a240145 | 2021-06-03 15:57:48 -0700 | [diff] [blame^] | 450 | * Returns a list of infra devices. |
| 451 | * |
| 452 | * @return list of the infra device ids |
| 453 | */ |
| 454 | List<DeviceId> getInfraDeviceIds(); |
| 455 | |
| 456 | /** |
pierventre | 4f68ffa | 2021-03-09 22:52:14 +0100 | [diff] [blame] | 457 | * Returns the configured mac address of the device. |
| 458 | * |
| 459 | * @param deviceId the device id |
| 460 | * @return the configured mac address |
| 461 | * @throws DeviceConfigNotFoundException if config is not present |
| 462 | */ |
| 463 | MacAddress getDeviceMacAddress(DeviceId deviceId) throws DeviceConfigNotFoundException; |
| 464 | |
| 465 | /** |
| 466 | * Returns the VlanId assigned internally by default to unconfigured ports. |
| 467 | * |
| 468 | * @return the default internal vlan id |
| 469 | */ |
| 470 | VlanId getDefaultInternalVlan(); |
sangho | 27462c6 | 2015-05-14 00:39:53 -0700 | [diff] [blame] | 471 | } |