blob: 83117eeaa7d680f771e5f959aebf9080723f257a [file] [log] [blame]
Hyunsun Moon395542a2016-09-01 13:53:08 -07001/*
Hyunsun Moon187bf532017-01-19 10:57:40 +09002 * Copyright 2017-present Open Networking Laboratory
Hyunsun Moon395542a2016-09-01 13:53:08 -07003 *
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 */
Hyunsun Moonfd5a24e2016-10-19 19:15:48 -070016package org.opencord.cordvtn.api.net;
Hyunsun Moon395542a2016-09-01 13:53:08 -070017
Hyunsun Moon187bf532017-01-19 10:57:40 +090018import org.onlab.packet.IpAddress;
19import org.onlab.packet.MacAddress;
Hyunsun Moon395542a2016-09-01 13:53:08 -070020import org.onlab.packet.VlanId;
21
Hyunsun Moon187bf532017-01-19 10:57:40 +090022import java.util.Comparator;
Hyunsun Moon395542a2016-09-01 13:53:08 -070023import java.util.Set;
24
Hyunsun Moon395542a2016-09-01 13:53:08 -070025/**
Hyunsun Moon5c143952016-10-19 18:34:46 -070026 * Representation of a service port which holds service specific port information,
27 * like vlan tag or additional addresses, to the common network port.
Hyunsun Moon395542a2016-09-01 13:53:08 -070028 */
Hyunsun Moon187bf532017-01-19 10:57:40 +090029public interface ServicePort {
Hyunsun Moon395542a2016-09-01 13:53:08 -070030
Hyunsun Moon187bf532017-01-19 10:57:40 +090031 Comparator<ServicePort> SERVICE_PORT_COMPARATOR =
32 (port1, port2) -> port1.networkId().id().compareTo(port2.networkId().id());
Hyunsun Moon395542a2016-09-01 13:53:08 -070033
34 /**
Hyunsun Moon187bf532017-01-19 10:57:40 +090035 * Returns the port identifier.
Hyunsun Moon395542a2016-09-01 13:53:08 -070036 *
37 * @return port id
38 */
Hyunsun Moon187bf532017-01-19 10:57:40 +090039 PortId id();
Hyunsun Moon395542a2016-09-01 13:53:08 -070040
41 /**
Hyunsun Moon187bf532017-01-19 10:57:40 +090042 * Returns the port name.
43 *
44 * @return port name
45 */
46 String name();
47
48 /**
49 * Returns associated network identifier of the service port.
50 *
51 * @return network id
52 */
53 NetworkId networkId();
54
55 /**
56 * Returns the MAC address of the service port.
57 *
58 * @return mac address
59 */
60 MacAddress mac();
61
62 /**
63 * Returns the fixed IP address of the service port.
64 *
65 * @return ip address
66 */
67 IpAddress ip();
68
69 /**
70 * Returns VLAN of service the port.
Hyunsun Moon395542a2016-09-01 13:53:08 -070071 *
72 * @return vlan id
73 */
Hyunsun Moon187bf532017-01-19 10:57:40 +090074 VlanId vlanId();
Hyunsun Moon395542a2016-09-01 13:53:08 -070075
76 /**
Hyunsun Moon187bf532017-01-19 10:57:40 +090077 * Returns additional floating address pairs of the service port.
Hyunsun Moon395542a2016-09-01 13:53:08 -070078 *
Hyunsun Moon187bf532017-01-19 10:57:40 +090079 * @return set of mac and ip address pair
Hyunsun Moon395542a2016-09-01 13:53:08 -070080 */
Hyunsun Moon187bf532017-01-19 10:57:40 +090081 Set<AddressPair> addressPairs();
Hyunsun Moon395542a2016-09-01 13:53:08 -070082
Hyunsun Moon187bf532017-01-19 10:57:40 +090083 /**
84 * Builder of new service port entities.
85 */
86 interface Builder {
Hyunsun Moon395542a2016-09-01 13:53:08 -070087
Hyunsun Moon187bf532017-01-19 10:57:40 +090088 /**
89 * Builds an immutable service port instance.
90 *
91 * @return service port
92 */
93 ServicePort build();
Hyunsun Moon395542a2016-09-01 13:53:08 -070094
Hyunsun Moon187bf532017-01-19 10:57:40 +090095 /**
96 * Returns service port builder with the supplied identifier.
97 *
98 * @param id port id
99 * @return service port builder
100 */
101 Builder id(PortId id);
Hyunsun Moon395542a2016-09-01 13:53:08 -0700102
Hyunsun Moon187bf532017-01-19 10:57:40 +0900103 /**
104 * Returns service port builder with the supplied name.
105 *
106 * @param name port name
107 * @return service port builder
108 */
109 Builder name(String name);
110
111 /**
112 * Returns service port builder with the supplied network identifier.
113 *
114 * @param networkId network id
115 * @return service port builder
116 */
117 Builder networkId(NetworkId networkId);
118
119 /**
120 * Returns service port builder with the supplied MAC address.
121 *
122 * @param mac mac address
123 * @return service port builder
124 */
125 Builder mac(MacAddress mac);
126
127 /**
128 * Returns service port builder with the supplied IP address.
129 *
130 * @param ip ip address
131 * @return service port builder
132 */
133 Builder ip(IpAddress ip);
134
135 /**
136 * Returns service port builder with the supplied VLAN.
137 *
138 * @param vlanId vlan id
139 * @return service port builder
140 */
141 Builder vlanId(VlanId vlanId);
142
143 /**
144 * Returns service port builder with the supplied address pairs.
145 *
146 * @param addressPairs set of address pair
147 * @return service port builder
148 */
149 Builder addressPairs(Set<AddressPair> addressPairs);
Hyunsun Moon395542a2016-09-01 13:53:08 -0700150 }
Hyunsun Moon395542a2016-09-01 13:53:08 -0700151}