blob: 5efd77d0b6ed9fa920283889113457da9f9bbd9a [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
Jian Li0a5d4d22018-06-08 14:06:56 +0900137 interface Builder {
138
139 /**
140 * Sets flow type.
141 *
142 * @param flowType flow type
143 * @return builder instance
144 */
145 Builder withFlowType(byte flowType);
146
147 /**
148 * Sets device identifier.
149 *
150 * @param deviceId device identifier
151 * @return builder instance
152 */
153 Builder withDeviceId(DeviceId deviceId);
154
155 /**
156 * Sets input interface identifier.
157 *
158 * @param inputInterfaceId input interface identifier
159 * @return builder instance
160 */
161 Builder withInputInterfaceId(int inputInterfaceId);
162
163 /**
164 * Sets output interface identifier.
165 *
166 * @param outputInterfaceId output interface identifier
167 * @return builder instance
168 */
169 Builder withOutputInterfaceId(int outputInterfaceId);
170
171 /**
172 * Sets VLAN identifier.
173 *
174 * @param vlanId VLAN identifier
175 * @return builder instance
176 */
177 Builder withVlanId(VlanId vlanId);
178
179 /**
180 * Sets VxLAN identifier.
181 *
182 * @param vxlanId VxLAN identifier
183 * @return builder instance
184 */
185 Builder withVxlanId(short vxlanId);
186
187 /**
188 * Sets source IP address.
189 *
190 * @param srcIp source IP address
191 * @return builder instance
192 */
193 Builder withSrcIp(IpPrefix srcIp);
194
195 /**
196 * Sets destination IP address.
197 *
198 * @param dstIp destination IP address
199 * @return builder instance
200 */
201 Builder withDstIp(IpPrefix dstIp);
202
203 /**
204 * Sets source port number.
205 *
206 * @param srcPort source port number
207 * @return builder instance
208 */
Jian Li6bd35102018-06-09 00:18:47 +0900209 Builder withSrcPort(TpPort srcPort);
Jian Li0a5d4d22018-06-08 14:06:56 +0900210
211 /**
212 * Sets destination port number.
213 *
214 * @param dstPort destination port number
215 * @return builder instance
216 */
Jian Li6bd35102018-06-09 00:18:47 +0900217 Builder withDstPort(TpPort dstPort);
Jian Li0a5d4d22018-06-08 14:06:56 +0900218
219 /**
220 * Sets protocol type.
221 *
222 * @param protocol protocol type
223 * @return builder instance
224 */
225 Builder withProtocol(byte protocol);
226
227 /**
228 * Sets source MAC address.
229 *
230 * @param srcMac source MAC address
231 * @return builder instance
232 */
233 Builder withSrcMac(MacAddress srcMac);
234
235 /**
236 * Sets destination MAC address.
237 *
238 * @param dstMac destination MAC address
239 * @return builder instance
240 */
241 Builder withDstMac(MacAddress dstMac);
242
243 /**
244 * Sets flow level stats info.
245 *
246 * @param statsInfo flow level stats info
247 * @return builder instance
248 */
249 Builder withStatsInfo(StatsInfo statsInfo);
250
251 /**
252 * Creates a FlowInfo instance.
253 *
254 * @return FlowInfo instance
255 */
256 FlowInfo build();
257 }
258}