blob: 48ccc0b96b9d4b6fa19d8717dd5e9e25b34536ec [file] [log] [blame]
Jian Li0a5d4d22018-06-08 14:06:56 +09001/*
2 * Copyright 2018-present Open Networking Foundation
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.openstacktelemetry.api;
17
18import org.onlab.packet.IpPrefix;
19import org.onlab.packet.MacAddress;
Jian Li6bd35102018-06-09 00:18:47 +090020import org.onlab.packet.TpPort;
Jian Li0a5d4d22018-06-08 14:06:56 +090021import org.onlab.packet.VlanId;
22import org.onosproject.net.DeviceId;
Jian Li0a5d4d22018-06-08 14:06:56 +090023
24/**
25 * Flow info interface.
26 */
27public interface FlowInfo {
28
29 /**
30 * Obtains flow type.
31 *
32 * @return flow type
33 */
34 byte flowType();
35
36 /**
37 * Obtains device identifier.
38 *
39 * @return device identifier
40 */
41 DeviceId deviceId();
42
43 /**
44 * Obtains input interface identifier.
45 *
46 * @return input interface identifier
47 */
48 int inputInterfaceId();
49
50 /**
51 * Obtains output interface identifier.
52 *
53 * @return output interface identifier
54 */
55 int outputInterfaceId();
56
57 /**
58 * Obtains VLAN identifier.
59 *
60 * @return VLAN identifier
61 */
62 VlanId vlanId();
63
64 /**
65 * Obtains VxLAN identifier.
66 *
67 * @return VxLAN identifier
68 */
69 short vxlanId();
70
71 /**
72 * Obtains source IP address.
73 *
74 * @return source IP address
75 */
76 IpPrefix srcIp();
77
78 /**
79 * Obtains destination IP address.
80 *
81 * @return destination IP address
82 */
83 IpPrefix dstIp();
84
85 /**
86 * Obtains source port.
87 *
88 * @return source port
89 */
Jian Li6bd35102018-06-09 00:18:47 +090090 TpPort srcPort();
Jian Li0a5d4d22018-06-08 14:06:56 +090091
92 /**
93 * Obtains destination port.
94 *
95 * @return destination port
96 */
Jian Li6bd35102018-06-09 00:18:47 +090097 TpPort dstPort();
Jian Li0a5d4d22018-06-08 14:06:56 +090098
99 /**
100 * Obtains protocol type.
101 *
102 * @return protocol type
103 */
104 byte protocol();
105
106 /**
107 * Obtains source MAC address.
108 *
109 * @return source MAC address
110 */
111 MacAddress srcMac();
112
113 /**
114 * Obtains destination MAC address.
115 *
116 * @return destination MAC address
117 */
118 MacAddress dstMac();
119
120 /**
121 * Obtains flow level stats information.
122 *
123 * @return flow level stats information
124 */
125 StatsInfo statsInfo();
126
Jian Li0bbbb1c2018-06-22 22:01:17 +0900127 /**
128 * Checks the rough equality of old flow info and new flow info.
129 * Note that we only test the equality for deviceId, srcIp, dstIP, srcPort,
130 * dstPort, protocol
131 *
132 * @param flowInfo flow info object ot be compared
133 * @return true if the two objects are identical, false otherwise
134 */
135 boolean roughEquals(FlowInfo flowInfo);
136
Boyoung Jeong1cca5e82018-08-01 21:00:08 +0900137 /**
138 * Make a key with IP Address and Transport Port information.
139 *
140 * @return unique flow info key in String
141 */
142 String uniqueFlowInfoKey();
143
Jian Li0a5d4d22018-06-08 14:06:56 +0900144 interface Builder {
145
146 /**
147 * Sets flow type.
148 *
149 * @param flowType flow type
150 * @return builder instance
151 */
152 Builder withFlowType(byte flowType);
153
154 /**
155 * Sets device identifier.
156 *
157 * @param deviceId device identifier
158 * @return builder instance
159 */
160 Builder withDeviceId(DeviceId deviceId);
161
162 /**
163 * Sets input interface identifier.
164 *
165 * @param inputInterfaceId input interface identifier
166 * @return builder instance
167 */
168 Builder withInputInterfaceId(int inputInterfaceId);
169
170 /**
171 * Sets output interface identifier.
172 *
173 * @param outputInterfaceId output interface identifier
174 * @return builder instance
175 */
176 Builder withOutputInterfaceId(int outputInterfaceId);
177
178 /**
179 * Sets VLAN identifier.
180 *
181 * @param vlanId VLAN identifier
182 * @return builder instance
183 */
184 Builder withVlanId(VlanId vlanId);
185
186 /**
187 * Sets VxLAN identifier.
188 *
189 * @param vxlanId VxLAN identifier
190 * @return builder instance
191 */
192 Builder withVxlanId(short vxlanId);
193
194 /**
195 * Sets source IP address.
196 *
197 * @param srcIp source IP address
198 * @return builder instance
199 */
200 Builder withSrcIp(IpPrefix srcIp);
201
202 /**
203 * Sets destination IP address.
204 *
205 * @param dstIp destination IP address
206 * @return builder instance
207 */
208 Builder withDstIp(IpPrefix dstIp);
209
210 /**
211 * Sets source port number.
212 *
213 * @param srcPort source port number
214 * @return builder instance
215 */
Jian Li6bd35102018-06-09 00:18:47 +0900216 Builder withSrcPort(TpPort srcPort);
Jian Li0a5d4d22018-06-08 14:06:56 +0900217
218 /**
219 * Sets destination port number.
220 *
221 * @param dstPort destination port number
222 * @return builder instance
223 */
Jian Li6bd35102018-06-09 00:18:47 +0900224 Builder withDstPort(TpPort dstPort);
Jian Li0a5d4d22018-06-08 14:06:56 +0900225
226 /**
227 * Sets protocol type.
228 *
229 * @param protocol protocol type
230 * @return builder instance
231 */
232 Builder withProtocol(byte protocol);
233
234 /**
235 * Sets source MAC address.
236 *
237 * @param srcMac source MAC address
238 * @return builder instance
239 */
240 Builder withSrcMac(MacAddress srcMac);
241
242 /**
243 * Sets destination MAC address.
244 *
245 * @param dstMac destination MAC address
246 * @return builder instance
247 */
248 Builder withDstMac(MacAddress dstMac);
249
250 /**
251 * Sets flow level stats info.
252 *
253 * @param statsInfo flow level stats info
254 * @return builder instance
255 */
256 Builder withStatsInfo(StatsInfo statsInfo);
257
258 /**
259 * Creates a FlowInfo instance.
260 *
261 * @return FlowInfo instance
262 */
263 FlowInfo build();
264 }
265}