Andreas Wundsam | 951ada3 | 2013-08-01 22:05:38 -0700 | [diff] [blame] | 1 | package org.openflow.protocol.ver12; |
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; |
| 23 | import org.openflow.protocol.action.OFAction; |
| 24 | import org.openflow.protocol.instruction.OFInstruction; |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 25 | import org.openflow.protocol.match.Match; |
Andreas Wundsam | 5408fb9 | 2013-07-30 12:26:04 -0700 | [diff] [blame] | 26 | import org.openflow.protocol.meterband.OFMeterBand; |
Andreas Wundsam | 951ada3 | 2013-08-01 22:05:38 -0700 | [diff] [blame] | 27 | import org.openflow.protocol.oxm.OFOxm; |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 28 | import org.openflow.types.OFFlowModCmd; |
| 29 | import org.openflow.types.OFHelloElement; |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 30 | import org.openflow.types.OFPhysicalPort; |
| 31 | |
Andreas Wundsam | 2730346 | 2013-07-16 12:52:35 -0700 | [diff] [blame] | 32 | import com.google.common.base.Charsets; |
| 33 | |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 34 | /** |
| 35 | * Collection of helper functions for reading and writing into ChannelBuffers |
| 36 | * |
| 37 | * @author capveg |
| 38 | */ |
| 39 | |
Andreas Wundsam | 951ada3 | 2013-08-01 22:05:38 -0700 | [diff] [blame] | 40 | public class ChannelUtilsVer12 { |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 41 | |
| 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 Wundsam | 5408fb9 | 2013-07-30 12:26:04 -0700 | [diff] [blame] | 48 | static public void writeBytes(final ChannelBuffer bb, |
| 49 | final byte byteArray[]) { |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 50 | bb.writeBytes(byteArray); |
| 51 | } |
| 52 | |
Andreas Wundsam | 5408fb9 | 2013-07-30 12:26:04 -0700 | [diff] [blame] | 53 | public static List<OFPhysicalPort> readPhysicalPortList( |
| 54 | final ChannelBuffer bb, final int i) { |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 55 | // TODO Auto-generated method stub |
| 56 | return null; |
| 57 | } |
| 58 | |
Andreas Wundsam | 5408fb9 | 2013-07-30 12:26:04 -0700 | [diff] [blame] | 59 | public static List<OFInstruction> readInstructionsList( |
| 60 | final ChannelBuffer bb, final int i) { |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 61 | // 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 Wundsam | 5408fb9 | 2013-07-30 12:26:04 -0700 | [diff] [blame] | 75 | public static List<OFAction> readActionsList(final ChannelBuffer bb, |
| 76 | final int i) { |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 77 | // TODO Auto-generated method stub |
| 78 | return null; |
| 79 | } |
| 80 | |
Andreas Wundsam | 5408fb9 | 2013-07-30 12:26:04 -0700 | [diff] [blame] | 81 | public static List<OFBsnInterface> readBsnInterfaceList( |
Andreas Wundsam | 951ada3 | 2013-08-01 22:05:38 -0700 | [diff] [blame] | 82 | final ChannelBuffer bb, int length) { |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 83 | // 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 Wundsam | 5408fb9 | 2013-07-30 12:26:04 -0700 | [diff] [blame] | 92 | 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 Wundsam | 951ada3 | 2013-08-01 22:05:38 -0700 | [diff] [blame] | 105 | final int length) { |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 106 | // TODO Auto-generated method stub |
| 107 | return null; |
| 108 | } |
| 109 | |
Andreas Wundsam | 951ada3 | 2013-08-01 22:05:38 -0700 | [diff] [blame] | 110 | public static List<OFMeterBand> readMeterBandList(final ChannelBuffer bb, int length) { |
Andreas Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 111 | // TODO Auto-generated method stub |
| 112 | return null; |
| 113 | } |
| 114 | |
Andreas Wundsam | 2730346 | 2013-07-16 12:52:35 -0700 | [diff] [blame] | 115 | public static void writeOFMatch(ChannelBuffer bb, Match match) { |
| 116 | // TODO Auto-generated method stub |
| 117 | |
| 118 | } |
| 119 | |
Andreas Wundsam | 951ada3 | 2013-08-01 22:05:38 -0700 | [diff] [blame] | 120 | public static void writeList(ChannelBuffer bb, List<? extends OFObject> objects) { |
| 121 | for(OFObject o : objects) { |
| 122 | o.writeTo(bb); |
| 123 | } |
Andreas Wundsam | 2730346 | 2013-07-16 12:52:35 -0700 | [diff] [blame] | 124 | } |
| 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 Wundsam | 5408fb9 | 2013-07-30 12:26:04 -0700 | [diff] [blame] | 137 | public static void writeFixedLengthString(ChannelBuffer bb, String string, |
| 138 | int length) { |
Andreas Wundsam | 2730346 | 2013-07-16 12:52:35 -0700 | [diff] [blame] | 139 | int l = string.length(); |
Andreas Wundsam | 5408fb9 | 2013-07-30 12:26:04 -0700 | [diff] [blame] | 140 | if (l > length) { |
| 141 | throw new IllegalArgumentException("Error writing string: length=" |
| 142 | + l + " > max Length=" + length); |
Andreas Wundsam | 2730346 | 2013-07-16 12:52:35 -0700 | [diff] [blame] | 143 | } |
| 144 | bb.writeBytes(string.getBytes(Charsets.US_ASCII)); |
Andreas Wundsam | 5408fb9 | 2013-07-30 12:26:04 -0700 | [diff] [blame] | 145 | if (l < length) { |
Andreas Wundsam | 2730346 | 2013-07-16 12:52:35 -0700 | [diff] [blame] | 146 | bb.writeZero(length - l); |
| 147 | } |
| 148 | } |
| 149 | |
Andreas Wundsam | 5408fb9 | 2013-07-30 12:26:04 -0700 | [diff] [blame] | 150 | public static void writeBsnInterfaceList(ChannelBuffer bb, |
| 151 | List<OFBsnInterface> interfaces) { |
Andreas Wundsam | 2730346 | 2013-07-16 12:52:35 -0700 | [diff] [blame] | 152 | // 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 Wundsam | 951ada3 | 2013-08-01 22:05:38 -0700 | [diff] [blame] | 186 | ChannelBuffer bb, int length) { |
Andreas Wundsam | 2730346 | 2013-07-16 12:52:35 -0700 | [diff] [blame] | 187 | // TODO Auto-generated method stub |
| 188 | return null; |
| 189 | } |
| 190 | |
Andreas Wundsam | 951ada3 | 2013-08-01 22:05:38 -0700 | [diff] [blame] | 191 | public static List<OFFlowStatsEntry> readFlowStatsEntryList(ChannelBuffer bb, int length) { |
Andreas Wundsam | 2730346 | 2013-07-16 12:52:35 -0700 | [diff] [blame] | 192 | // 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 Wundsam | 951ada3 | 2013-08-01 22:05:38 -0700 | [diff] [blame] | 209 | ChannelBuffer bb, int length) { |
Andreas Wundsam | 2730346 | 2013-07-16 12:52:35 -0700 | [diff] [blame] | 210 | // 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 Wundsam | 951ada3 | 2013-08-01 22:05:38 -0700 | [diff] [blame] | 247 | public static List<OFPortStatsEntry> readPortStatsEntryList(ChannelBuffer bb, int length) { |
Andreas Wundsam | 2730346 | 2013-07-16 12:52:35 -0700 | [diff] [blame] | 248 | // 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 Wundsam | 951ada3 | 2013-08-01 22:05:38 -0700 | [diff] [blame] | 258 | public static List<OFHelloElem> readHelloElemList(ChannelBuffer bb, int length) { |
Andreas Wundsam | 2730346 | 2013-07-16 12:52:35 -0700 | [diff] [blame] | 259 | // 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 Wundsam | 951ada3 | 2013-08-01 22:05:38 -0700 | [diff] [blame] | 270 | ChannelBuffer bb, int length) { |
Andreas Wundsam | 2730346 | 2013-07-16 12:52:35 -0700 | [diff] [blame] | 271 | // 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 Wundsam | 951ada3 | 2013-08-01 22:05:38 -0700 | [diff] [blame] | 282 | ChannelBuffer bb, int length) { |
Andreas Wundsam | 2730346 | 2013-07-16 12:52:35 -0700 | [diff] [blame] | 283 | // 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 Wundsam | 951ada3 | 2013-08-01 22:05:38 -0700 | [diff] [blame] | 304 | public static List<OFMeterStats> readMeterStatsList(ChannelBuffer bb, int length) { |
Andreas Wundsam | 2730346 | 2013-07-16 12:52:35 -0700 | [diff] [blame] | 305 | // 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 Wundsam | 951ada3 | 2013-08-01 22:05:38 -0700 | [diff] [blame] | 315 | public static List<OFTableFeatures> readTableFeaturesList(ChannelBuffer bb, int length) { |
Andreas Wundsam | 2730346 | 2013-07-16 12:52:35 -0700 | [diff] [blame] | 316 | // 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 Wundsam | 951ada3 | 2013-08-01 22:05:38 -0700 | [diff] [blame] | 326 | 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 Wundsam | 40e14f7 | 2013-05-06 14:49:08 -0700 | [diff] [blame] | 352 | } |