blob: 2f9d9edb35b8b994af3d27e0a728531e47d0449d [file] [log] [blame]
wei wei89ddc322015-03-22 16:29:04 -05001/*
2 * Copyright 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 */
16package org.onosproject.net.tunnel;
17
18import java.util.Optional;
19
20import org.onosproject.net.Annotated;
21import org.onosproject.net.ElementId;
22import org.onosproject.net.NetworkResource;
23import org.onosproject.net.PortNumber;
24import org.onosproject.net.Provided;
25
26/**
27 * Generic representation of a logical port entity in a consistent way,
28 * it is used to identify e.g., VLAN#, MPLS label#, ODUk timeSlot, WDM lambda, etc.
29 * It supports nested case.
30 */
31public interface Label extends Annotated, Provided, NetworkResource {
32
33 /** Represents coarse Label type classification. */
Sho SHIMIZU3310a342015-05-13 12:14:05 -070034 enum Type {
wei wei89ddc322015-03-22 16:29:04 -050035 /**
36 * Signifies VLAN-based tag.
37 */
38 VLAN,
39
40 /**
41 * Signifies LAG-based label.
42 */
43 LAG,
44
45 /**
46 * Signifies MPLS-based label.
47 */
48 MPLS,
49
50 /**
51 * Signifies IP-based label.
52 */
53 IP,
54
55 /**
56 * Signifies optical data unit-based label.
57 */
58 TIMESLOT,
59
60 /**
61 * Signifies optical wavelength-based label.
62 */
63 LAMBDA,
64
65 /**
66 * Signifies device-based identifier for the label.
67 */
68 DEVICE
69 }
70
71 /**
72 * Returns the identifier to this Label.
73 *
74 * @return identifier
75 */
76 LabelId id();
77
78 /**
79 * Returns the parent network element to which this label belongs.
80 *
81 * @return parent network element
82 */
83 Optional<ElementId> elementId();
84
85 /**
86 * Returns the parent network port to which this label belongs, can not be be null.
87 *
88 * @return port number
89 */
90 Optional<PortNumber> portNumber();
91
92 /**
93 * Returns the parent label to which this label belongs, optional.
94 *
95 * @return parent label, if it is null, the parent is a physical port
96 */
97 Optional<Label> parentLabel();
98
99 /**
100 * Indicates whether or not the port is global significant.
101 *
102 * @return true if the port is global significant
103 */
104 boolean isGlobal();
105
106 /**
107 * Returns the label type.
108 *
109 * @return label type
110 */
111 Type type();
Sho SHIMIZU3310a342015-05-13 12:14:05 -0700112}