d28d38d5ca3cf612d9e82a7f8b6b7655535b5c78
[onosfw.git] /
1 /*
2  * Copyright 2014-2015 Open Networking Laboratory
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.grouphandler;
17
18 import java.util.List;
19 import java.util.Map;
20
21 import org.onlab.packet.Ip4Prefix;
22 import org.onlab.packet.MacAddress;
23 import org.onosproject.net.DeviceId;
24 import org.onosproject.net.PortNumber;
25
26 /**
27  * Mechanism through which group handler module retrieves
28  * the device specific attributes such as segment ID,
29  * Mac address...etc from group handler applications.
30  */
31 public interface DeviceProperties {
32     /**
33      * Returns the segment id of a device to be used in group creation.
34      *
35      * @param deviceId device identifier
36      * @return segment id of a device
37      */
38     int getSegmentId(DeviceId deviceId);
39
40     /**
41      * Returns the Mac address of a device to be used in group creation.
42      *
43      * @param deviceId device identifier
44      * @return mac address of a device
45      */
46     MacAddress getDeviceMac(DeviceId deviceId);
47
48     /**
49      * Indicates whether a device is edge device or transit/core device.
50      *
51      * @param deviceId device identifier
52      * @return boolean
53      */
54     boolean isEdgeDevice(DeviceId deviceId);
55
56     /**
57      * Returns all segment IDs to be considered in building auto
58      *
59      * created groups.
60      * @return list of segment IDs
61      */
62     List<Integer> getAllDeviceSegmentIds();
63
64     /**
65      * Returns subnet-to-ports mapping of given device.
66      *
67      * For each entry of the map
68      * Key: a subnet
69      * Value: a list of ports, which are bound to the subnet
70      *
71      * @param deviceId device identifier
72      * @return a map that contains all subnet-to-ports mapping of given device
73      */
74     Map<Ip4Prefix, List<PortNumber>> getSubnetPortsMap(DeviceId deviceId);
75 }