blob: a66fb708285af1352f037afce076b4fff0f34d12 [file] [log] [blame]
Andreas Wundsam951ada32013-08-01 22:05:38 -07001package org.openflow.protocol.ver12;
Andreas Wundsam40e14f72013-05-06 14:49:08 -07002
3import java.util.List;
4
5import org.jboss.netty.buffer.ChannelBuffer;
Andreas Wundsam27303462013-07-16 12:52:35 -07006import org.openflow.protocol.OFBsnInterface;
7import org.openflow.protocol.OFBsnVportQInQ;
8import org.openflow.protocol.OFBsnVportQInQT;
9import org.openflow.protocol.OFBucket;
10import org.openflow.protocol.OFFlowStatsEntry;
11import org.openflow.protocol.OFGroupDescStatsEntry;
12import org.openflow.protocol.OFGroupStatsEntry;
13import org.openflow.protocol.OFHelloElem;
14import org.openflow.protocol.OFMeterFeatures;
15import org.openflow.protocol.OFMeterStats;
Andreas Wundsam951ada32013-08-01 22:05:38 -070016import org.openflow.protocol.OFObject;
Andreas Wundsam27303462013-07-16 12:52:35 -070017import org.openflow.protocol.OFPacketQueue;
18import org.openflow.protocol.OFPortStatsEntry;
19import org.openflow.protocol.OFQueueStatsEntry;
20import org.openflow.protocol.OFTableFeature;
21import org.openflow.protocol.OFTableFeatures;
22import org.openflow.protocol.OFTableStatsEntry;
23import org.openflow.protocol.action.OFAction;
24import org.openflow.protocol.instruction.OFInstruction;
Andreas Wundsam40e14f72013-05-06 14:49:08 -070025import org.openflow.protocol.match.Match;
Andreas Wundsam5408fb92013-07-30 12:26:04 -070026import org.openflow.protocol.meterband.OFMeterBand;
Andreas Wundsam951ada32013-08-01 22:05:38 -070027import org.openflow.protocol.oxm.OFOxm;
Andreas Wundsam40e14f72013-05-06 14:49:08 -070028import org.openflow.types.OFFlowModCmd;
29import org.openflow.types.OFHelloElement;
Andreas Wundsam40e14f72013-05-06 14:49:08 -070030import org.openflow.types.OFPhysicalPort;
31
Andreas Wundsam27303462013-07-16 12:52:35 -070032import com.google.common.base.Charsets;
33
Andreas Wundsam40e14f72013-05-06 14:49:08 -070034/**
35 * Collection of helper functions for reading and writing into ChannelBuffers
36 *
37 * @author capveg
38 */
39
Andreas Wundsam951ada32013-08-01 22:05:38 -070040public class ChannelUtilsVer12 {
Andreas Wundsam40e14f72013-05-06 14:49:08 -070041
42 static public byte[] readBytes(final ChannelBuffer bb, final int length) {
43 byte byteArray[] = new byte[length];
44 bb.readBytes(byteArray);
45 return byteArray;
46 }
47
Andreas Wundsam5408fb92013-07-30 12:26:04 -070048 static public void writeBytes(final ChannelBuffer bb,
49 final byte byteArray[]) {
Andreas Wundsam40e14f72013-05-06 14:49:08 -070050 bb.writeBytes(byteArray);
51 }
52
Andreas Wundsam5408fb92013-07-30 12:26:04 -070053 public static List<OFPhysicalPort> readPhysicalPortList(
54 final ChannelBuffer bb, final int i) {
Andreas Wundsam40e14f72013-05-06 14:49:08 -070055 // TODO Auto-generated method stub
56 return null;
57 }
58
Andreas Wundsam5408fb92013-07-30 12:26:04 -070059 public static List<OFInstruction> readInstructionsList(
60 final ChannelBuffer bb, final int i) {
Andreas Wundsam40e14f72013-05-06 14:49:08 -070061 // TODO Auto-generated method stub
62 return null;
63 }
64
65 public static Match readOFMatch(final ChannelBuffer bb) {
66 // TODO Auto-generated method stub
67 return null;
68 }
69
70 public static OFFlowModCmd readOFFlowModCmd(final ChannelBuffer bb) {
71 // TODO Auto-generated method stub
72 return null;
73 }
74
Andreas Wundsam5408fb92013-07-30 12:26:04 -070075 public static List<OFAction> readActionsList(final ChannelBuffer bb,
76 final int i) {
Andreas Wundsam40e14f72013-05-06 14:49:08 -070077 // TODO Auto-generated method stub
78 return null;
79 }
80
Andreas Wundsam5408fb92013-07-30 12:26:04 -070081 public static List<OFBsnInterface> readBsnInterfaceList(
Andreas Wundsam951ada32013-08-01 22:05:38 -070082 final ChannelBuffer bb, int length) {
Andreas Wundsam40e14f72013-05-06 14:49:08 -070083 // TODO Auto-generated method stub
84 return null;
85 }
86
87 public static OFPhysicalPort readPhysicalPort(final ChannelBuffer bb) {
88 // TODO Auto-generated method stub
89 return null;
90 }
91
Andreas Wundsam5408fb92013-07-30 12:26:04 -070092 public static List<OFPacketQueue> readPacketQueueList(
93 final ChannelBuffer bb, final int i) {
94 // TODO Auto-generated method stub
95 return null;
96 }
97
98 public static List<OFHelloElement> readHelloElementList(
99 final ChannelBuffer bb) {
100 // TODO Auto-generated method stub
101 return null;
102 }
103
104 public static List<OFBucket> readBucketList(final ChannelBuffer bb,
Andreas Wundsam951ada32013-08-01 22:05:38 -0700105 final int length) {
Andreas Wundsam40e14f72013-05-06 14:49:08 -0700106 // TODO Auto-generated method stub
107 return null;
108 }
109
Andreas Wundsam951ada32013-08-01 22:05:38 -0700110 public static List<OFMeterBand> readMeterBandList(final ChannelBuffer bb, int length) {
Andreas Wundsam40e14f72013-05-06 14:49:08 -0700111 // TODO Auto-generated method stub
112 return null;
113 }
114
Andreas Wundsam27303462013-07-16 12:52:35 -0700115 public static void writeOFMatch(ChannelBuffer bb, Match match) {
116 // TODO Auto-generated method stub
117
118 }
119
Andreas Wundsam951ada32013-08-01 22:05:38 -0700120 public static void writeList(ChannelBuffer bb, List<? extends OFObject> objects) {
121 for(OFObject o : objects) {
122 o.writeTo(bb);
123 }
Andreas Wundsam27303462013-07-16 12:52:35 -0700124 }
125
126 public static void writeOFFlowModCmd(ChannelBuffer bb, OFFlowModCmd command) {
127 // TODO Auto-generated method stub
128
129 }
130
131 public static String readFixedLengthString(ChannelBuffer bb, int length) {
132 byte[] dst = new byte[length];
133 bb.readBytes(dst, 0, length);
134 return new String(dst, Charsets.US_ASCII);
135 }
136
Andreas Wundsam5408fb92013-07-30 12:26:04 -0700137 public static void writeFixedLengthString(ChannelBuffer bb, String string,
138 int length) {
Andreas Wundsam27303462013-07-16 12:52:35 -0700139 int l = string.length();
Andreas Wundsam5408fb92013-07-30 12:26:04 -0700140 if (l > length) {
141 throw new IllegalArgumentException("Error writing string: length="
142 + l + " > max Length=" + length);
Andreas Wundsam27303462013-07-16 12:52:35 -0700143 }
144 bb.writeBytes(string.getBytes(Charsets.US_ASCII));
Andreas Wundsam5408fb92013-07-30 12:26:04 -0700145 if (l < length) {
Andreas Wundsam27303462013-07-16 12:52:35 -0700146 bb.writeZero(length - l);
147 }
148 }
149
Andreas Wundsam5408fb92013-07-30 12:26:04 -0700150 public static void writeBsnInterfaceList(ChannelBuffer bb,
151 List<OFBsnInterface> interfaces) {
Andreas Wundsam27303462013-07-16 12:52:35 -0700152 // TODO Auto-generated method stub
153
154 }
155
156 public static void writeTableFeatureList(ChannelBuffer bb,
157 List<OFTableFeature> entries) {
158 // TODO Auto-generated method stub
159
160 }
161
162 public static void writeBsnInterface(ChannelBuffer bb,
163 List<OFBsnInterface> interfaces) {
164 // TODO Auto-generated method stub
165
166 }
167
168 public static void writeFlowStatsEntry(ChannelBuffer bb,
169 List<OFFlowStatsEntry> entries) {
170 // TODO Auto-generated method stub
171
172 }
173
174 public static List<OFFlowStatsEntry> readFlowStatsEntry(ChannelBuffer bb) {
175 // TODO Auto-generated method stub
176 return null;
177 }
178
179 public static void writeTableStatsEntryList(ChannelBuffer bb,
180 List<OFTableStatsEntry> entries) {
181 // TODO Auto-generated method stub
182
183 }
184
185 public static List<OFTableStatsEntry> readTableStatsEntryList(
Andreas Wundsam951ada32013-08-01 22:05:38 -0700186 ChannelBuffer bb, int length) {
Andreas Wundsam27303462013-07-16 12:52:35 -0700187 // TODO Auto-generated method stub
188 return null;
189 }
190
Andreas Wundsam951ada32013-08-01 22:05:38 -0700191 public static List<OFFlowStatsEntry> readFlowStatsEntryList(ChannelBuffer bb, int length) {
Andreas Wundsam27303462013-07-16 12:52:35 -0700192 // TODO Auto-generated method stub
193 return null;
194 }
195
196 public static void writeFlowStatsEntryList(ChannelBuffer bb,
197 List<OFFlowStatsEntry> entries) {
198 // TODO Auto-generated method stub
199
200 }
201
202 public static void writeGroupDescStatsEntryList(ChannelBuffer bb,
203 List<OFGroupDescStatsEntry> entries) {
204 // TODO Auto-generated method stub
205
206 }
207
208 public static List<OFGroupDescStatsEntry> readGroupDescStatsEntryList(
Andreas Wundsam951ada32013-08-01 22:05:38 -0700209 ChannelBuffer bb, int length) {
Andreas Wundsam27303462013-07-16 12:52:35 -0700210 // TODO Auto-generated method stub
211 return null;
212 }
213
214 public static void writeOFBsnVportQInQT(ChannelBuffer bb,
215 OFBsnVportQInQT vport) {
216 // TODO Auto-generated method stub
217
218 }
219
220 public static void writeMeterBandList(ChannelBuffer bb,
221 List<OFMeterBand> entries) {
222 // TODO Auto-generated method stub
223
224 }
225
226 public static int writeActionsList(ChannelBuffer bb, List<OFAction> actions) {
227 // TODO Auto-generated method stub
228 return 0;
229 }
230
231 public static OFBsnVportQInQ readOFBsnVportQInQ(ChannelBuffer bb) {
232 // TODO Auto-generated method stub
233 return null;
234 }
235
236 public static void writePortStatsEntryList(ChannelBuffer bb,
237 List<OFPortStatsEntry> entries) {
238 // TODO Auto-generated method stub
239
240 }
241
242 public static void write(ChannelBuffer bb, OFPhysicalPort desc) {
243 // TODO Auto-generated method stub
244
245 }
246
Andreas Wundsam951ada32013-08-01 22:05:38 -0700247 public static List<OFPortStatsEntry> readPortStatsEntryList(ChannelBuffer bb, int length) {
Andreas Wundsam27303462013-07-16 12:52:35 -0700248 // TODO Auto-generated method stub
249 return null;
250 }
251
252 public static void writeOFBsnVportQInQ(ChannelBuffer bb,
253 OFBsnVportQInQ vport) {
254 // TODO Auto-generated method stub
255
256 }
257
Andreas Wundsam951ada32013-08-01 22:05:38 -0700258 public static List<OFHelloElem> readHelloElemList(ChannelBuffer bb, int length) {
Andreas Wundsam27303462013-07-16 12:52:35 -0700259 // TODO Auto-generated method stub
260 return null;
261 }
262
263 public static void writeHelloElemList(ChannelBuffer bb,
264 List<OFHelloElem> elements) {
265 // TODO Auto-generated method stub
266
267 }
268
269 public static List<OFGroupStatsEntry> readGroupStatsEntryList(
Andreas Wundsam951ada32013-08-01 22:05:38 -0700270 ChannelBuffer bb, int length) {
Andreas Wundsam27303462013-07-16 12:52:35 -0700271 // TODO Auto-generated method stub
272 return null;
273 }
274
275 public static void writeGroupStatsEntryList(ChannelBuffer bb,
276 List<OFGroupStatsEntry> entries) {
277 // TODO Auto-generated method stub
278
279 }
280
281 public static List<OFQueueStatsEntry> readQueueStatsEntryList(
Andreas Wundsam951ada32013-08-01 22:05:38 -0700282 ChannelBuffer bb, int length) {
Andreas Wundsam27303462013-07-16 12:52:35 -0700283 // TODO Auto-generated method stub
284 return null;
285 }
286
287 public static void writeQueueStatsEntryList(ChannelBuffer bb,
288 List<OFQueueStatsEntry> entries) {
289 // TODO Auto-generated method stub
290
291 }
292
293 public static OFMeterFeatures readOFMeterFeatures(ChannelBuffer bb) {
294 // TODO Auto-generated method stub
295 return null;
296 }
297
298 public static void writeOFMeterFeatures(ChannelBuffer bb,
299 OFMeterFeatures features) {
300 // TODO Auto-generated method stub
301
302 }
303
Andreas Wundsam951ada32013-08-01 22:05:38 -0700304 public static List<OFMeterStats> readMeterStatsList(ChannelBuffer bb, int length) {
Andreas Wundsam27303462013-07-16 12:52:35 -0700305 // TODO Auto-generated method stub
306 return null;
307 }
308
309 public static void writeMeterStatsList(ChannelBuffer bb,
310 List<OFMeterStats> entries) {
311 // TODO Auto-generated method stub
312
313 }
314
Andreas Wundsam951ada32013-08-01 22:05:38 -0700315 public static List<OFTableFeatures> readTableFeaturesList(ChannelBuffer bb, int length) {
Andreas Wundsam27303462013-07-16 12:52:35 -0700316 // TODO Auto-generated method stub
317 return null;
318 }
319
320 public static void writeTableFeaturesList(ChannelBuffer bb,
321 List<OFTableFeatures> entries) {
322 // TODO Auto-generated method stub
323
324 }
325
Andreas Wundsam951ada32013-08-01 22:05:38 -0700326 public static OFOxm readOFOxm(ChannelBuffer bb) {
327 // TODO Auto-generated method stub
328 return null;
329 }
330
331 public static void writeOFOxm(ChannelBuffer bb, OFOxm field) {
332 // TODO Auto-generated method stub
333
334 }
335
336 public static void writeOxmList(ChannelBuffer bb, List<OFOxm> oxmList) {
337 for(OFOxm o: oxmList) {
338 o.writeTo(bb);
339 }
340 }
341
342 public static List<OFOxm> readOxmList(ChannelBuffer bb, int length) {
343 return null;
344 }
345
346 public static void writePhysicalPortList(ChannelBuffer bb,
347 List<OFPhysicalPort> ports) {
348 // TODO Auto-generated method stub
349
350 }
351
Andreas Wundsam40e14f72013-05-06 14:49:08 -0700352}