Srikanth Vavilapalli | 37a461b | 2015-04-07 15:12:32 -0700 | [diff] [blame] | 1 | /* |
Charles Chan | 72f556a | 2015-10-05 17:50:33 -0700 | [diff] [blame] | 2 | * Copyright 2014-2015 Open Networking Laboratory |
Srikanth Vavilapalli | 37a461b | 2015-04-07 15:12:32 -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 | */ |
Charles Chan | 319d1a2 | 2015-11-03 10:42:14 -0800 | [diff] [blame] | 16 | package org.onosproject.segmentrouting.config; |
Srikanth Vavilapalli | 37a461b | 2015-04-07 15:12:32 -0700 | [diff] [blame] | 17 | |
| 18 | import java.util.List; |
Charles Chan | 7727767 | 2015-10-20 16:24:19 -0700 | [diff] [blame] | 19 | import java.util.Map; |
Srikanth Vavilapalli | 37a461b | 2015-04-07 15:12:32 -0700 | [diff] [blame] | 20 | |
Charles Chan | 319d1a2 | 2015-11-03 10:42:14 -0800 | [diff] [blame] | 21 | import org.onlab.packet.Ip4Address; |
Charles Chan | 7727767 | 2015-10-20 16:24:19 -0700 | [diff] [blame] | 22 | import org.onlab.packet.Ip4Prefix; |
Srikanth Vavilapalli | 37a461b | 2015-04-07 15:12:32 -0700 | [diff] [blame] | 23 | import org.onlab.packet.MacAddress; |
Charles Chan | b7f75ac | 2016-01-11 18:28:54 -0800 | [diff] [blame] | 24 | import org.onlab.packet.VlanId; |
| 25 | import org.onosproject.net.ConnectPoint; |
Srikanth Vavilapalli | 37a461b | 2015-04-07 15:12:32 -0700 | [diff] [blame] | 26 | import org.onosproject.net.DeviceId; |
Charles Chan | 7727767 | 2015-10-20 16:24:19 -0700 | [diff] [blame] | 27 | import org.onosproject.net.PortNumber; |
Srikanth Vavilapalli | 37a461b | 2015-04-07 15:12:32 -0700 | [diff] [blame] | 28 | |
| 29 | /** |
| 30 | * Mechanism through which group handler module retrieves |
| 31 | * the device specific attributes such as segment ID, |
| 32 | * Mac address...etc from group handler applications. |
| 33 | */ |
| 34 | public interface DeviceProperties { |
| 35 | /** |
Charles Chan | 319d1a2 | 2015-11-03 10:42:14 -0800 | [diff] [blame] | 36 | * Checks if the device is configured. |
| 37 | * |
| 38 | * @param deviceId device identifier |
| 39 | * @return true if the device is configured |
| 40 | */ |
| 41 | boolean isConfigured(DeviceId deviceId); |
| 42 | |
| 43 | /** |
Srikanth Vavilapalli | 37a461b | 2015-04-07 15:12:32 -0700 | [diff] [blame] | 44 | * Returns the segment id of a device to be used in group creation. |
| 45 | * |
| 46 | * @param deviceId device identifier |
Charles Chan | 319d1a2 | 2015-11-03 10:42:14 -0800 | [diff] [blame] | 47 | * @throws DeviceConfigNotFoundException if the device configuration is not found |
Srikanth Vavilapalli | 37a461b | 2015-04-07 15:12:32 -0700 | [diff] [blame] | 48 | * @return segment id of a device |
| 49 | */ |
Charles Chan | 319d1a2 | 2015-11-03 10:42:14 -0800 | [diff] [blame] | 50 | int getSegmentId(DeviceId deviceId) throws DeviceConfigNotFoundException; |
Charles Chan | 7727767 | 2015-10-20 16:24:19 -0700 | [diff] [blame] | 51 | |
Srikanth Vavilapalli | 37a461b | 2015-04-07 15:12:32 -0700 | [diff] [blame] | 52 | /** |
| 53 | * Returns the Mac address of a device to be used in group creation. |
| 54 | * |
| 55 | * @param deviceId device identifier |
Charles Chan | 319d1a2 | 2015-11-03 10:42:14 -0800 | [diff] [blame] | 56 | * @throws DeviceConfigNotFoundException if the device configuration is not found |
Srikanth Vavilapalli | 37a461b | 2015-04-07 15:12:32 -0700 | [diff] [blame] | 57 | * @return mac address of a device |
| 58 | */ |
Charles Chan | 319d1a2 | 2015-11-03 10:42:14 -0800 | [diff] [blame] | 59 | MacAddress getDeviceMac(DeviceId deviceId) throws DeviceConfigNotFoundException; |
| 60 | |
| 61 | /** |
| 62 | * Returns the router ip address of a segment router. |
| 63 | * |
| 64 | * @param deviceId device identifier |
| 65 | * @throws DeviceConfigNotFoundException if the device configuration is not found |
| 66 | * @return router ip address |
| 67 | */ |
| 68 | Ip4Address getRouterIp(DeviceId deviceId) throws DeviceConfigNotFoundException; |
Charles Chan | 7727767 | 2015-10-20 16:24:19 -0700 | [diff] [blame] | 69 | |
Srikanth Vavilapalli | 37a461b | 2015-04-07 15:12:32 -0700 | [diff] [blame] | 70 | /** |
| 71 | * Indicates whether a device is edge device or transit/core device. |
| 72 | * |
| 73 | * @param deviceId device identifier |
Charles Chan | 319d1a2 | 2015-11-03 10:42:14 -0800 | [diff] [blame] | 74 | * @throws DeviceConfigNotFoundException if the device configuration is not found |
Srikanth Vavilapalli | 37a461b | 2015-04-07 15:12:32 -0700 | [diff] [blame] | 75 | * @return boolean |
| 76 | */ |
Charles Chan | 319d1a2 | 2015-11-03 10:42:14 -0800 | [diff] [blame] | 77 | boolean isEdgeDevice(DeviceId deviceId) throws DeviceConfigNotFoundException; |
Charles Chan | 7727767 | 2015-10-20 16:24:19 -0700 | [diff] [blame] | 78 | |
Srikanth Vavilapalli | 37a461b | 2015-04-07 15:12:32 -0700 | [diff] [blame] | 79 | /** |
| 80 | * Returns all segment IDs to be considered in building auto |
| 81 | * |
| 82 | * created groups. |
| 83 | * @return list of segment IDs |
| 84 | */ |
| 85 | List<Integer> getAllDeviceSegmentIds(); |
Charles Chan | 7727767 | 2015-10-20 16:24:19 -0700 | [diff] [blame] | 86 | |
| 87 | /** |
| 88 | * Returns subnet-to-ports mapping of given device. |
| 89 | * |
| 90 | * For each entry of the map |
| 91 | * Key: a subnet |
| 92 | * Value: a list of ports, which are bound to the subnet |
| 93 | * |
| 94 | * @param deviceId device identifier |
| 95 | * @return a map that contains all subnet-to-ports mapping of given device |
| 96 | */ |
| 97 | Map<Ip4Prefix, List<PortNumber>> getSubnetPortsMap(DeviceId deviceId); |
Charles Chan | b7f75ac | 2016-01-11 18:28:54 -0800 | [diff] [blame] | 98 | |
| 99 | /** |
| 100 | * Returns the VLAN cross-connect configuration. |
| 101 | * |
| 102 | * @return A map of that maps VLAN ID to a list of cross-connect endpoints |
| 103 | */ |
| 104 | Map<VlanId, List<ConnectPoint>> getXConnects(); |
Srikanth Vavilapalli | 37a461b | 2015-04-07 15:12:32 -0700 | [diff] [blame] | 105 | } |