blob: 3780db7dcf7a283edf268529b8a1cc1e5b4df66a [file] [log] [blame]
Srikanth Vavilapallied12ae52015-02-09 14:43:19 -08001/*
Charles Chand6832882015-10-05 17:50:33 -07002 * Copyright 2014-2015 Open Networking Laboratory
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
18import java.util.List;
Charles Chanc42e84e2015-10-20 16:24:19 -070019import java.util.Map;
Srikanth Vavilapallied12ae52015-02-09 14:43:19 -080020
Charles Chan0b4e6182015-11-03 10:42:14 -080021import org.onlab.packet.Ip4Address;
Charles Chanc42e84e2015-10-20 16:24:19 -070022import org.onlab.packet.Ip4Prefix;
Srikanth Vavilapallied12ae52015-02-09 14:43:19 -080023import org.onlab.packet.MacAddress;
Charles Chane849c192016-01-11 18:28:54 -080024import org.onlab.packet.VlanId;
25import org.onosproject.net.ConnectPoint;
Srikanth Vavilapallied12ae52015-02-09 14:43:19 -080026import org.onosproject.net.DeviceId;
Charles Chanc42e84e2015-10-20 16:24:19 -070027import org.onosproject.net.PortNumber;
Srikanth Vavilapallied12ae52015-02-09 14:43:19 -080028
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 */
34public interface DeviceProperties {
35 /**
Charles Chan0b4e6182015-11-03 10:42:14 -080036 * 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 Vavilapallied12ae52015-02-09 14:43:19 -080044 * Returns the segment id of a device to be used in group creation.
45 *
46 * @param deviceId device identifier
Charles Chan0b4e6182015-11-03 10:42:14 -080047 * @throws DeviceConfigNotFoundException if the device configuration is not found
Srikanth Vavilapallied12ae52015-02-09 14:43:19 -080048 * @return segment id of a device
49 */
Charles Chan0b4e6182015-11-03 10:42:14 -080050 int getSegmentId(DeviceId deviceId) throws DeviceConfigNotFoundException;
Charles Chanc42e84e2015-10-20 16:24:19 -070051
Srikanth Vavilapallied12ae52015-02-09 14:43:19 -080052 /**
53 * Returns the Mac address of a device to be used in group creation.
54 *
55 * @param deviceId device identifier
Charles Chan0b4e6182015-11-03 10:42:14 -080056 * @throws DeviceConfigNotFoundException if the device configuration is not found
Srikanth Vavilapallied12ae52015-02-09 14:43:19 -080057 * @return mac address of a device
58 */
Charles Chan0b4e6182015-11-03 10:42:14 -080059 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 Chanc42e84e2015-10-20 16:24:19 -070069
Srikanth Vavilapallied12ae52015-02-09 14:43:19 -080070 /**
71 * Indicates whether a device is edge device or transit/core device.
72 *
73 * @param deviceId device identifier
Charles Chan0b4e6182015-11-03 10:42:14 -080074 * @throws DeviceConfigNotFoundException if the device configuration is not found
Srikanth Vavilapallied12ae52015-02-09 14:43:19 -080075 * @return boolean
76 */
Charles Chan0b4e6182015-11-03 10:42:14 -080077 boolean isEdgeDevice(DeviceId deviceId) throws DeviceConfigNotFoundException;
Charles Chanc42e84e2015-10-20 16:24:19 -070078
Srikanth Vavilapallied12ae52015-02-09 14:43:19 -080079 /**
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 Chanc42e84e2015-10-20 16:24:19 -070086
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
Ray Milkeyd4334db2016-04-05 17:39:44 -070095 * @throws DeviceConfigNotFoundException if the device configuration is not found
Charles Chanc42e84e2015-10-20 16:24:19 -070096 * @return a map that contains all subnet-to-ports mapping of given device
97 */
Saurav Das7a1ffca2016-03-28 19:00:18 -070098 Map<Ip4Prefix, List<PortNumber>> getSubnetPortsMap(DeviceId deviceId)
99 throws DeviceConfigNotFoundException;
Charles Chane849c192016-01-11 18:28:54 -0800100
101 /**
102 * Returns the VLAN cross-connect configuration.
103 *
104 * @return A map of that maps VLAN ID to a list of cross-connect endpoints
105 */
106 Map<VlanId, List<ConnectPoint>> getXConnects();
Srikanth Vavilapallied12ae52015-02-09 14:43:19 -0800107}