Andreas Wundsam | 951ada3 | 2013-08-01 22:05:38 -0700 | [diff] [blame] | 1 | package org.openflow.protocol.ver11; |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 2 | |
| 3 | import java.util.List; |
| 4 | |
| 5 | import org.jboss.netty.buffer.ChannelBuffer; |
Andreas Wundsam | 2730346 | 2013-07-16 12:52:35 -0700 | [diff] [blame] | 6 | import org.openflow.protocol.OFBsnInterface; |
| 7 | import org.openflow.protocol.OFBsnVportQInQ; |
| 8 | import org.openflow.protocol.OFBsnVportQInQT; |
| 9 | import org.openflow.protocol.OFBucket; |
| 10 | import org.openflow.protocol.OFFlowStatsEntry; |
| 11 | import org.openflow.protocol.OFGroupDescStatsEntry; |
| 12 | import org.openflow.protocol.OFGroupStatsEntry; |
| 13 | import org.openflow.protocol.OFHelloElem; |
| 14 | import org.openflow.protocol.OFMeterFeatures; |
| 15 | import org.openflow.protocol.OFMeterStats; |
Andreas Wundsam | 951ada3 | 2013-08-01 22:05:38 -0700 | [diff] [blame] | 16 | import org.openflow.protocol.OFObject; |
Andreas Wundsam | 2730346 | 2013-07-16 12:52:35 -0700 | [diff] [blame] | 17 | import org.openflow.protocol.OFPacketQueue; |
| 18 | import org.openflow.protocol.OFPortStatsEntry; |
| 19 | import org.openflow.protocol.OFQueueStatsEntry; |
| 20 | import org.openflow.protocol.OFTableFeature; |
| 21 | import org.openflow.protocol.OFTableFeatures; |
| 22 | import org.openflow.protocol.OFTableStatsEntry; |
Andreas Wundsam | 951ada3 | 2013-08-01 22:05:38 -0700 | [diff] [blame] | 23 | import org.openflow.protocol.Wildcards; |
Andreas Wundsam | 2730346 | 2013-07-16 12:52:35 -0700 | [diff] [blame] | 24 | import org.openflow.protocol.action.OFAction; |
| 25 | import org.openflow.protocol.instruction.OFInstruction; |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 26 | import org.openflow.protocol.match.Match; |
Andreas Wundsam | 5408fb9 | 2013-07-30 12:26:04 -0700 | [diff] [blame] | 27 | import org.openflow.protocol.meterband.OFMeterBand; |
Andreas Wundsam | 951ada3 | 2013-08-01 22:05:38 -0700 | [diff] [blame] | 28 | import org.openflow.protocol.oxm.OFOxm; |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 29 | import org.openflow.types.OFFlowModCmd; |
| 30 | import org.openflow.types.OFHelloElement; |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 31 | import org.openflow.types.OFPhysicalPort; |
| 32 | |
Andreas Wundsam | 2730346 | 2013-07-16 12:52:35 -0700 | [diff] [blame] | 33 | import com.google.common.base.Charsets; |
| 34 | |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 35 | /** |
| 36 | * Collection of helper functions for reading and writing into ChannelBuffers |
| 37 | * |
| 38 | * @author capveg |
| 39 | */ |
| 40 | |
Andreas Wundsam | 951ada3 | 2013-08-01 22:05:38 -0700 | [diff] [blame] | 41 | public class ChannelUtilsVer11 { |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 42 | |
| 43 | static public byte[] readBytes(final ChannelBuffer bb, final int length) { |
| 44 | byte byteArray[] = new byte[length]; |
| 45 | bb.readBytes(byteArray); |
| 46 | return byteArray; |
| 47 | } |
| 48 | |
Andreas Wundsam | 5408fb9 | 2013-07-30 12:26:04 -0700 | [diff] [blame] | 49 | static public void writeBytes(final ChannelBuffer bb, |
| 50 | final byte byteArray[]) { |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 51 | bb.writeBytes(byteArray); |
| 52 | } |
| 53 | |
Andreas Wundsam | 5408fb9 | 2013-07-30 12:26:04 -0700 | [diff] [blame] | 54 | public static List<OFPhysicalPort> readPhysicalPortList( |
| 55 | final ChannelBuffer bb, final int i) { |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 56 | // TODO Auto-generated method stub |
| 57 | return null; |
| 58 | } |
| 59 | |
Andreas Wundsam | 5408fb9 | 2013-07-30 12:26:04 -0700 | [diff] [blame] | 60 | public static List<OFInstruction> readInstructionsList( |
| 61 | final ChannelBuffer bb, final int i) { |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 62 | // TODO Auto-generated method stub |
| 63 | return null; |
| 64 | } |
| 65 | |
| 66 | public static Match readOFMatch(final ChannelBuffer bb) { |
| 67 | // TODO Auto-generated method stub |
| 68 | return null; |
| 69 | } |
| 70 | |
| 71 | public static OFFlowModCmd readOFFlowModCmd(final ChannelBuffer bb) { |
| 72 | // TODO Auto-generated method stub |
| 73 | return null; |
| 74 | } |
| 75 | |
Andreas Wundsam | 5408fb9 | 2013-07-30 12:26:04 -0700 | [diff] [blame] | 76 | public static List<OFAction> readActionsList(final ChannelBuffer bb, |
| 77 | final int i) { |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 78 | // TODO Auto-generated method stub |
| 79 | return null; |
| 80 | } |
| 81 | |
Andreas Wundsam | 5408fb9 | 2013-07-30 12:26:04 -0700 | [diff] [blame] | 82 | public static List<OFBsnInterface> readBsnInterfaceList( |
Andreas Wundsam | 951ada3 | 2013-08-01 22:05:38 -0700 | [diff] [blame] | 83 | final ChannelBuffer bb, int length) { |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 84 | // TODO Auto-generated method stub |
| 85 | return null; |
| 86 | } |
| 87 | |
| 88 | public static OFPhysicalPort readPhysicalPort(final ChannelBuffer bb) { |
| 89 | // TODO Auto-generated method stub |
| 90 | return null; |
| 91 | } |
| 92 | |
Andreas Wundsam | 5408fb9 | 2013-07-30 12:26:04 -0700 | [diff] [blame] | 93 | public static List<OFPacketQueue> readPacketQueueList( |
| 94 | final ChannelBuffer bb, final int i) { |
| 95 | // TODO Auto-generated method stub |
| 96 | return null; |
| 97 | } |
| 98 | |
| 99 | public static List<OFHelloElement> readHelloElementList( |
| 100 | final ChannelBuffer bb) { |
| 101 | // TODO Auto-generated method stub |
| 102 | return null; |
| 103 | } |
| 104 | |
| 105 | public static List<OFBucket> readBucketList(final ChannelBuffer bb, |
Andreas Wundsam | 951ada3 | 2013-08-01 22:05:38 -0700 | [diff] [blame] | 106 | final int length) { |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 107 | // TODO Auto-generated method stub |
| 108 | return null; |
| 109 | } |
| 110 | |
Andreas Wundsam | 951ada3 | 2013-08-01 22:05:38 -0700 | [diff] [blame] | 111 | public static List<OFMeterBand> readMeterBandList(final ChannelBuffer bb, int length) { |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 112 | // TODO Auto-generated method stub |
| 113 | return null; |
| 114 | } |
| 115 | |
Andreas Wundsam | 2730346 | 2013-07-16 12:52:35 -0700 | [diff] [blame] | 116 | public static void writeOFMatch(ChannelBuffer bb, Match match) { |
| 117 | // TODO Auto-generated method stub |
| 118 | |
| 119 | } |
| 120 | |
Andreas Wundsam | 951ada3 | 2013-08-01 22:05:38 -0700 | [diff] [blame] | 121 | public static void writeList(ChannelBuffer bb, List<? extends OFObject> objects) { |
| 122 | for(OFObject o : objects) { |
| 123 | o.writeTo(bb); |
| 124 | } |
Andreas Wundsam | 2730346 | 2013-07-16 12:52:35 -0700 | [diff] [blame] | 125 | } |
| 126 | |
| 127 | public static void writeOFFlowModCmd(ChannelBuffer bb, OFFlowModCmd command) { |
| 128 | // TODO Auto-generated method stub |
| 129 | |
| 130 | } |
| 131 | |
| 132 | public static String readFixedLengthString(ChannelBuffer bb, int length) { |
| 133 | byte[] dst = new byte[length]; |
| 134 | bb.readBytes(dst, 0, length); |
| 135 | return new String(dst, Charsets.US_ASCII); |
| 136 | } |
| 137 | |
Andreas Wundsam | 5408fb9 | 2013-07-30 12:26:04 -0700 | [diff] [blame] | 138 | public static void writeFixedLengthString(ChannelBuffer bb, String string, |
| 139 | int length) { |
Andreas Wundsam | 2730346 | 2013-07-16 12:52:35 -0700 | [diff] [blame] | 140 | int l = string.length(); |
Andreas Wundsam | 5408fb9 | 2013-07-30 12:26:04 -0700 | [diff] [blame] | 141 | if (l > length) { |
| 142 | throw new IllegalArgumentException("Error writing string: length=" |
| 143 | + l + " > max Length=" + length); |
Andreas Wundsam | 2730346 | 2013-07-16 12:52:35 -0700 | [diff] [blame] | 144 | } |
| 145 | bb.writeBytes(string.getBytes(Charsets.US_ASCII)); |
Andreas Wundsam | 5408fb9 | 2013-07-30 12:26:04 -0700 | [diff] [blame] | 146 | if (l < length) { |
Andreas Wundsam | 2730346 | 2013-07-16 12:52:35 -0700 | [diff] [blame] | 147 | bb.writeZero(length - l); |
| 148 | } |
| 149 | } |
| 150 | |
Andreas Wundsam | 5408fb9 | 2013-07-30 12:26:04 -0700 | [diff] [blame] | 151 | public static void writeBsnInterfaceList(ChannelBuffer bb, |
| 152 | List<OFBsnInterface> interfaces) { |
Andreas Wundsam | 2730346 | 2013-07-16 12:52:35 -0700 | [diff] [blame] | 153 | // TODO Auto-generated method stub |
| 154 | |
| 155 | } |
| 156 | |
| 157 | public static void writeTableFeatureList(ChannelBuffer bb, |
| 158 | List<OFTableFeature> entries) { |
| 159 | // TODO Auto-generated method stub |
| 160 | |
| 161 | } |
| 162 | |
| 163 | public static void writeBsnInterface(ChannelBuffer bb, |
| 164 | List<OFBsnInterface> interfaces) { |
| 165 | // TODO Auto-generated method stub |
| 166 | |
| 167 | } |
| 168 | |
| 169 | public static void writeFlowStatsEntry(ChannelBuffer bb, |
| 170 | List<OFFlowStatsEntry> entries) { |
| 171 | // TODO Auto-generated method stub |
| 172 | |
| 173 | } |
| 174 | |
| 175 | public static List<OFFlowStatsEntry> readFlowStatsEntry(ChannelBuffer bb) { |
| 176 | // TODO Auto-generated method stub |
| 177 | return null; |
| 178 | } |
| 179 | |
| 180 | public static void writeTableStatsEntryList(ChannelBuffer bb, |
| 181 | List<OFTableStatsEntry> entries) { |
| 182 | // TODO Auto-generated method stub |
| 183 | |
| 184 | } |
| 185 | |
| 186 | public static List<OFTableStatsEntry> readTableStatsEntryList( |
Andreas Wundsam | 951ada3 | 2013-08-01 22:05:38 -0700 | [diff] [blame] | 187 | ChannelBuffer bb, int length) { |
Andreas Wundsam | 2730346 | 2013-07-16 12:52:35 -0700 | [diff] [blame] | 188 | // TODO Auto-generated method stub |
| 189 | return null; |
| 190 | } |
| 191 | |
Andreas Wundsam | 951ada3 | 2013-08-01 22:05:38 -0700 | [diff] [blame] | 192 | public static List<OFFlowStatsEntry> readFlowStatsEntryList(ChannelBuffer bb, int length) { |
Andreas Wundsam | 2730346 | 2013-07-16 12:52:35 -0700 | [diff] [blame] | 193 | // TODO Auto-generated method stub |
| 194 | return null; |
| 195 | } |
| 196 | |
| 197 | public static void writeFlowStatsEntryList(ChannelBuffer bb, |
| 198 | List<OFFlowStatsEntry> entries) { |
| 199 | // TODO Auto-generated method stub |
| 200 | |
| 201 | } |
| 202 | |
| 203 | public static void writeGroupDescStatsEntryList(ChannelBuffer bb, |
| 204 | List<OFGroupDescStatsEntry> entries) { |
| 205 | // TODO Auto-generated method stub |
| 206 | |
| 207 | } |
| 208 | |
| 209 | public static List<OFGroupDescStatsEntry> readGroupDescStatsEntryList( |
Andreas Wundsam | 951ada3 | 2013-08-01 22:05:38 -0700 | [diff] [blame] | 210 | ChannelBuffer bb, int length) { |
Andreas Wundsam | 2730346 | 2013-07-16 12:52:35 -0700 | [diff] [blame] | 211 | // TODO Auto-generated method stub |
| 212 | return null; |
| 213 | } |
| 214 | |
| 215 | public static void writeOFBsnVportQInQT(ChannelBuffer bb, |
| 216 | OFBsnVportQInQT vport) { |
| 217 | // TODO Auto-generated method stub |
| 218 | |
| 219 | } |
| 220 | |
| 221 | public static void writeMeterBandList(ChannelBuffer bb, |
| 222 | List<OFMeterBand> entries) { |
| 223 | // TODO Auto-generated method stub |
| 224 | |
| 225 | } |
| 226 | |
| 227 | public static int writeActionsList(ChannelBuffer bb, List<OFAction> actions) { |
| 228 | // TODO Auto-generated method stub |
| 229 | return 0; |
| 230 | } |
| 231 | |
| 232 | public static OFBsnVportQInQ readOFBsnVportQInQ(ChannelBuffer bb) { |
| 233 | // TODO Auto-generated method stub |
| 234 | return null; |
| 235 | } |
| 236 | |
| 237 | public static void writePortStatsEntryList(ChannelBuffer bb, |
| 238 | List<OFPortStatsEntry> entries) { |
| 239 | // TODO Auto-generated method stub |
| 240 | |
| 241 | } |
| 242 | |
| 243 | public static void write(ChannelBuffer bb, OFPhysicalPort desc) { |
| 244 | // TODO Auto-generated method stub |
| 245 | |
| 246 | } |
| 247 | |
Andreas Wundsam | 951ada3 | 2013-08-01 22:05:38 -0700 | [diff] [blame] | 248 | public static List<OFPortStatsEntry> readPortStatsEntryList(ChannelBuffer bb, int length) { |
Andreas Wundsam | 2730346 | 2013-07-16 12:52:35 -0700 | [diff] [blame] | 249 | // TODO Auto-generated method stub |
| 250 | return null; |
| 251 | } |
| 252 | |
| 253 | public static void writeOFBsnVportQInQ(ChannelBuffer bb, |
| 254 | OFBsnVportQInQ vport) { |
| 255 | // TODO Auto-generated method stub |
| 256 | |
| 257 | } |
| 258 | |
Andreas Wundsam | 951ada3 | 2013-08-01 22:05:38 -0700 | [diff] [blame] | 259 | public static List<OFHelloElem> readHelloElemList(ChannelBuffer bb, int length) { |
Andreas Wundsam | 2730346 | 2013-07-16 12:52:35 -0700 | [diff] [blame] | 260 | // TODO Auto-generated method stub |
| 261 | return null; |
| 262 | } |
| 263 | |
| 264 | public static void writeHelloElemList(ChannelBuffer bb, |
| 265 | List<OFHelloElem> elements) { |
| 266 | // TODO Auto-generated method stub |
| 267 | |
| 268 | } |
| 269 | |
| 270 | public static List<OFGroupStatsEntry> readGroupStatsEntryList( |
Andreas Wundsam | 951ada3 | 2013-08-01 22:05:38 -0700 | [diff] [blame] | 271 | ChannelBuffer bb, int length) { |
Andreas Wundsam | 2730346 | 2013-07-16 12:52:35 -0700 | [diff] [blame] | 272 | // TODO Auto-generated method stub |
| 273 | return null; |
| 274 | } |
| 275 | |
| 276 | public static void writeGroupStatsEntryList(ChannelBuffer bb, |
| 277 | List<OFGroupStatsEntry> entries) { |
| 278 | // TODO Auto-generated method stub |
| 279 | |
| 280 | } |
| 281 | |
| 282 | public static List<OFQueueStatsEntry> readQueueStatsEntryList( |
Andreas Wundsam | 951ada3 | 2013-08-01 22:05:38 -0700 | [diff] [blame] | 283 | ChannelBuffer bb, int length) { |
Andreas Wundsam | 2730346 | 2013-07-16 12:52:35 -0700 | [diff] [blame] | 284 | // TODO Auto-generated method stub |
| 285 | return null; |
| 286 | } |
| 287 | |
| 288 | public static void writeQueueStatsEntryList(ChannelBuffer bb, |
| 289 | List<OFQueueStatsEntry> entries) { |
| 290 | // TODO Auto-generated method stub |
| 291 | |
| 292 | } |
| 293 | |
| 294 | public static OFMeterFeatures readOFMeterFeatures(ChannelBuffer bb) { |
| 295 | // TODO Auto-generated method stub |
| 296 | return null; |
| 297 | } |
| 298 | |
| 299 | public static void writeOFMeterFeatures(ChannelBuffer bb, |
| 300 | OFMeterFeatures features) { |
| 301 | // TODO Auto-generated method stub |
| 302 | |
| 303 | } |
| 304 | |
Andreas Wundsam | 951ada3 | 2013-08-01 22:05:38 -0700 | [diff] [blame] | 305 | public static List<OFMeterStats> readMeterStatsList(ChannelBuffer bb, int length) { |
Andreas Wundsam | 2730346 | 2013-07-16 12:52:35 -0700 | [diff] [blame] | 306 | // TODO Auto-generated method stub |
| 307 | return null; |
| 308 | } |
| 309 | |
| 310 | public static void writeMeterStatsList(ChannelBuffer bb, |
| 311 | List<OFMeterStats> entries) { |
| 312 | // TODO Auto-generated method stub |
| 313 | |
| 314 | } |
| 315 | |
Andreas Wundsam | 951ada3 | 2013-08-01 22:05:38 -0700 | [diff] [blame] | 316 | public static List<OFTableFeatures> readTableFeaturesList(ChannelBuffer bb, int length) { |
Andreas Wundsam | 2730346 | 2013-07-16 12:52:35 -0700 | [diff] [blame] | 317 | // TODO Auto-generated method stub |
| 318 | return null; |
| 319 | } |
| 320 | |
| 321 | public static void writeTableFeaturesList(ChannelBuffer bb, |
| 322 | List<OFTableFeatures> entries) { |
| 323 | // TODO Auto-generated method stub |
| 324 | |
| 325 | } |
| 326 | |
Andreas Wundsam | 951ada3 | 2013-08-01 22:05:38 -0700 | [diff] [blame] | 327 | public static OFOxm readOFOxm(ChannelBuffer bb) { |
| 328 | // TODO Auto-generated method stub |
| 329 | return null; |
| 330 | } |
| 331 | |
| 332 | public static void writeOFOxm(ChannelBuffer bb, OFOxm field) { |
| 333 | // TODO Auto-generated method stub |
| 334 | |
| 335 | } |
| 336 | |
| 337 | public static void writeOxmList(ChannelBuffer bb, List<OFOxm> oxmList) { |
| 338 | for(OFOxm o: oxmList) { |
| 339 | o.writeTo(bb); |
| 340 | } |
| 341 | } |
| 342 | |
| 343 | public static List<OFOxm> readOxmList(ChannelBuffer bb, int length) { |
| 344 | return null; |
| 345 | } |
| 346 | |
| 347 | public static void writePhysicalPortList(ChannelBuffer bb, |
| 348 | List<OFPhysicalPort> ports) { |
| 349 | // TODO Auto-generated method stub |
| 350 | |
| 351 | } |
| 352 | |
| 353 | public static Wildcards readWildcards(ChannelBuffer bb) { |
| 354 | // TODO Auto-generated method stub |
| 355 | return null; |
| 356 | } |
| 357 | |
| 358 | public static void writeWildcards(ChannelBuffer bb, Wildcards wildcards) { |
| 359 | // TODO Auto-generated method stub |
| 360 | |
| 361 | } |
| 362 | |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 363 | } |