blob: a1498ab81da71ba9262397b7f1335c91005f3227 [file] [log] [blame]
HIGUCHI Yuta34a3f692016-01-09 21:08:57 -08001/*
2 * Copyright 2016 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 */
16package org.onosproject.net.optical;
17
18import java.util.Optional;
19
20import org.onosproject.net.Device;
21import org.onosproject.net.Port;
22import org.onosproject.net.driver.Behaviour;
23
24import com.google.common.annotations.Beta;
25
26
27// TODO consider more fine grained device type. e.g., Transponder, WSS, ROADM
28/**
29 * Representation of a optical network infrastructure device.
30 */
31@Beta
32public interface OpticalDevice extends Device, Behaviour {
33
34 /**
35 * Returns true if {@code port} is capable of being projected as the
36 * specified class.
37 *
38 * @param port Port instance to test
39 * @param portClass requested projection class
40 * @param <T> type of Port
41 * @return true if the requested projection is supported
42 */
43 <T extends Port> boolean portIs(Port port, Class<T> portClass);
44
45 /**
46 * Returns the specified projection of the {@code port} if such projection
47 * is supported.
48 *
49 * @param port Port instance to project
50 * @param portClass requested projection class
51 * @param <T> type of Port
52 * @return projection instance or empty if not supported.
53 */
54 <T extends Port> Optional<T> portAs(Port port, Class<T> portClass);
55
56 /**
57 * Returns most specific projection of the {@code port} or the {@code port}
58 * itself.
59 *
60 * @param port Port instance
61 * @return projection instance or {@code port} itself
62 */
63 Port port(Port port);
64
65}