blob: 64a2df76c6fc4a75a5792ee01a72d924b28f850b [file] [log] [blame]
Srikanth Vavilapallied12ae52015-02-09 14:43:19 -08001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2015-present Open Networking Foundation
Srikanth Vavilapallied12ae52015-02-09 14:43:19 -08003 *
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 Chan0b4e6182015-11-03 10:42:14 -080016package org.onosproject.segmentrouting.config;
Srikanth Vavilapallied12ae52015-02-09 14:43:19 -080017
Pier Ventree0ae7a32016-11-23 09:57:42 -080018import org.onlab.packet.IpAddress;
Pier Ventre10bd8d12016-11-26 21:05:22 -080019import org.onlab.packet.IpPrefix;
Srikanth Vavilapallied12ae52015-02-09 14:43:19 -080020import org.onlab.packet.MacAddress;
21import org.onosproject.net.DeviceId;
Charles Chanc42e84e2015-10-20 16:24:19 -070022import org.onosproject.net.PortNumber;
Srikanth Vavilapallied12ae52015-02-09 14:43:19 -080023
Pier Ventree0ae7a32016-11-23 09:57:42 -080024import java.util.List;
25import java.util.Map;
26
Srikanth Vavilapallied12ae52015-02-09 14:43:19 -080027/**
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 */
32public interface DeviceProperties {
33 /**
Charles Chan0b4e6182015-11-03 10:42:14 -080034 * 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 /**
Pier Ventree0ae7a32016-11-23 09:57:42 -080042 * Returns the IPv4 segment id of a device to be used in group creation.
Srikanth Vavilapallied12ae52015-02-09 14:43:19 -080043 *
44 * @param deviceId device identifier
Charles Chan0b4e6182015-11-03 10:42:14 -080045 * @throws DeviceConfigNotFoundException if the device configuration is not found
Srikanth Vavilapallied12ae52015-02-09 14:43:19 -080046 * @return segment id of a device
47 */
Pier Ventree0ae7a32016-11-23 09:57:42 -080048 int getIPv4SegmentId(DeviceId deviceId) throws DeviceConfigNotFoundException;
49
50 /**
51 * Returns the IPv6 segment id of a device to be used in group creation.
52 *
53 * @param deviceId device identifier
54 * @throws DeviceConfigNotFoundException if the device configuration is not found
55 * @return segment id of a device
56 */
57 int getIPv6SegmentId(DeviceId deviceId) throws DeviceConfigNotFoundException;
Charles Chanc42e84e2015-10-20 16:24:19 -070058
Srikanth Vavilapallied12ae52015-02-09 14:43:19 -080059 /**
60 * Returns the Mac address of a device to be used in group creation.
61 *
62 * @param deviceId device identifier
Charles Chan0b4e6182015-11-03 10:42:14 -080063 * @throws DeviceConfigNotFoundException if the device configuration is not found
Srikanth Vavilapallied12ae52015-02-09 14:43:19 -080064 * @return mac address of a device
65 */
Charles Chan0b4e6182015-11-03 10:42:14 -080066 MacAddress getDeviceMac(DeviceId deviceId) throws DeviceConfigNotFoundException;
67
68 /**
Pier Ventree0ae7a32016-11-23 09:57:42 -080069 * Returns the router ipv4 address of a segment router.
Charles Chan0b4e6182015-11-03 10:42:14 -080070 *
71 * @param deviceId device identifier
72 * @throws DeviceConfigNotFoundException if the device configuration is not found
73 * @return router ip address
74 */
Pier Ventree0ae7a32016-11-23 09:57:42 -080075 IpAddress getRouterIpv4(DeviceId deviceId) throws DeviceConfigNotFoundException;
76
77 /**
78 * Returns the router ipv6 address of a segment router.
79 *
80 * @param deviceId device identifier
81 * @throws DeviceConfigNotFoundException if the device configuration is not found
82 * @return router ip address
83 */
84 IpAddress getRouterIpv6(DeviceId deviceId) throws DeviceConfigNotFoundException;
Charles Chanc42e84e2015-10-20 16:24:19 -070085
Srikanth Vavilapallied12ae52015-02-09 14:43:19 -080086 /**
87 * Indicates whether a device is edge device or transit/core device.
88 *
89 * @param deviceId device identifier
Charles Chan0b4e6182015-11-03 10:42:14 -080090 * @throws DeviceConfigNotFoundException if the device configuration is not found
Srikanth Vavilapallied12ae52015-02-09 14:43:19 -080091 * @return boolean
92 */
Charles Chan0b4e6182015-11-03 10:42:14 -080093 boolean isEdgeDevice(DeviceId deviceId) throws DeviceConfigNotFoundException;
Charles Chanc42e84e2015-10-20 16:24:19 -070094
Srikanth Vavilapallied12ae52015-02-09 14:43:19 -080095 /**
96 * Returns all segment IDs to be considered in building auto
97 *
98 * created groups.
99 * @return list of segment IDs
100 */
101 List<Integer> getAllDeviceSegmentIds();
Charles Chanc42e84e2015-10-20 16:24:19 -0700102
103 /**
104 * Returns subnet-to-ports mapping of given device.
105 *
106 * For each entry of the map
107 * Key: a subnet
108 * Value: a list of ports, which are bound to the subnet
109 *
110 * @param deviceId device identifier
Ray Milkeyd4334db2016-04-05 17:39:44 -0700111 * @throws DeviceConfigNotFoundException if the device configuration is not found
Charles Chanc42e84e2015-10-20 16:24:19 -0700112 * @return a map that contains all subnet-to-ports mapping of given device
113 */
Pier Ventre10bd8d12016-11-26 21:05:22 -0800114 Map<IpPrefix, List<PortNumber>> getSubnetPortsMap(DeviceId deviceId)
Saurav Das7a1ffca2016-03-28 19:00:18 -0700115 throws DeviceConfigNotFoundException;
Srikanth Vavilapallied12ae52015-02-09 14:43:19 -0800116}