blob: ea4bf070f8fc6a33ff0d6255c15f44e75589445b [file] [log] [blame]
Thomas Vachuska84922b32016-02-18 13:52:11 -08001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2016-present Open Networking Foundation
Thomas Vachuska84922b32016-02-18 13:52:11 -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 */
16
17package org.onosproject.net.device;
18
19import org.onosproject.net.driver.HandlerBehaviour;
20
21import java.util.List;
DongRyeol Cha5f6f04a2020-01-13 17:06:34 +090022import java.util.function.Consumer;
Thomas Vachuska84922b32016-02-18 13:52:11 -080023
24/**
25 * Handler behaviour capable of creating device and port descriptions.
26 * These descriptions should be appropriately annotated to support downstream
27 * projections of the respective devices and their ports.
28 */
29public interface DeviceDescriptionDiscovery extends HandlerBehaviour {
30
31 /**
Andrea Campanella6c71a052016-04-22 11:56:31 -070032 * Returns a device description appropriately annotated to support
Thomas Vachuska84922b32016-02-18 13:52:11 -080033 * downstream model extension via projections of the resulting device,
34 * as in the following example.
35 * <pre>
36 * MicrowaveDevice device = deviceService.get(id).as(MicrowaveDevice.class);
37 * </pre>
38 *
39 * @return annotated device description
40 */
41 DeviceDescription discoverDeviceDetails();
42
43 /**
Andrea Campanella6c71a052016-04-22 11:56:31 -070044 * Returns a list of port descriptions appropriately annotated to support
Thomas Vachuska84922b32016-02-18 13:52:11 -080045 * downstream model extension via projections of their parent device,
46 * as in the following example.
47 * <pre>
48 * MicrowaveDevice device = deviceService.get(id).as(MicrowaveDevice.class);
49 * List&lt;MicrowavePort&gt; ports = device.microwavePorts(deviceService.getPorts(id));
50 * </pre>
51 *
52 * @return annotated device description
53 */
54 List<PortDescription> discoverPortDetails();
55
DongRyeol Cha5f6f04a2020-01-13 17:06:34 +090056 /**
57 * Invoke given lamda function when port descriptions are discovered.
58 *
59 * @param consumer consumer to process port description
60 */
61 default void discoverPortDetails(Consumer<PortDescription> consumer) {
62 throw new UnsupportedOperationException("Need to be implemented by subclass");
63 }
Thomas Vachuska84922b32016-02-18 13:52:11 -080064}