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