alshabib | 86ac11c | 2014-08-14 16:14:41 -0700 | [diff] [blame^] | 1 | // Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University |
| 2 | // Copyright (c) 2011, 2012 Open Networking Foundation |
| 3 | // Copyright (c) 2012, 2013 Big Switch Networks, Inc. |
| 4 | // This library was generated by the LoxiGen Compiler. |
| 5 | // See the file LICENSE.txt which should have been included in the source distribution |
| 6 | |
| 7 | // Automatically generated by LOXI from template of_class.java |
| 8 | // Do not modify |
| 9 | |
| 10 | package org.projectfloodlight.openflow.protocol.ver10; |
| 11 | |
| 12 | import org.projectfloodlight.openflow.protocol.*; |
| 13 | import org.projectfloodlight.openflow.protocol.action.*; |
| 14 | import org.projectfloodlight.openflow.protocol.actionid.*; |
| 15 | import org.projectfloodlight.openflow.protocol.bsntlv.*; |
| 16 | import org.projectfloodlight.openflow.protocol.errormsg.*; |
| 17 | import org.projectfloodlight.openflow.protocol.meterband.*; |
| 18 | import org.projectfloodlight.openflow.protocol.instruction.*; |
| 19 | import org.projectfloodlight.openflow.protocol.instructionid.*; |
| 20 | import org.projectfloodlight.openflow.protocol.match.*; |
| 21 | import org.projectfloodlight.openflow.protocol.oxm.*; |
| 22 | import org.projectfloodlight.openflow.protocol.queueprop.*; |
| 23 | import org.projectfloodlight.openflow.types.*; |
| 24 | import org.projectfloodlight.openflow.util.*; |
| 25 | import org.projectfloodlight.openflow.exceptions.*; |
| 26 | import java.util.Set; |
| 27 | import org.slf4j.Logger; |
| 28 | import org.slf4j.LoggerFactory; |
| 29 | import org.jboss.netty.buffer.ChannelBuffer; |
| 30 | import com.google.common.hash.PrimitiveSink; |
| 31 | import com.google.common.hash.Funnel; |
| 32 | |
| 33 | class OFBsnSetL2TableReplyVer10 implements OFBsnSetL2TableReply { |
| 34 | private static final Logger logger = LoggerFactory.getLogger(OFBsnSetL2TableReplyVer10.class); |
| 35 | // version: 1.0 |
| 36 | final static byte WIRE_VERSION = 1; |
| 37 | final static int LENGTH = 24; |
| 38 | |
| 39 | private final static long DEFAULT_XID = 0x0L; |
| 40 | private final static boolean DEFAULT_L2_TABLE_ENABLE = false; |
| 41 | private final static int DEFAULT_L2_TABLE_PRIORITY = 0x0; |
| 42 | private final static long DEFAULT_STATUS = 0x0L; |
| 43 | |
| 44 | // OF message fields |
| 45 | private final long xid; |
| 46 | private final boolean l2TableEnable; |
| 47 | private final int l2TablePriority; |
| 48 | private final long status; |
| 49 | // |
| 50 | // Immutable default instance |
| 51 | final static OFBsnSetL2TableReplyVer10 DEFAULT = new OFBsnSetL2TableReplyVer10( |
| 52 | DEFAULT_XID, DEFAULT_L2_TABLE_ENABLE, DEFAULT_L2_TABLE_PRIORITY, DEFAULT_STATUS |
| 53 | ); |
| 54 | |
| 55 | // package private constructor - used by readers, builders, and factory |
| 56 | OFBsnSetL2TableReplyVer10(long xid, boolean l2TableEnable, int l2TablePriority, long status) { |
| 57 | this.xid = xid; |
| 58 | this.l2TableEnable = l2TableEnable; |
| 59 | this.l2TablePriority = l2TablePriority; |
| 60 | this.status = status; |
| 61 | } |
| 62 | |
| 63 | // Accessors for OF message fields |
| 64 | @Override |
| 65 | public OFVersion getVersion() { |
| 66 | return OFVersion.OF_10; |
| 67 | } |
| 68 | |
| 69 | @Override |
| 70 | public OFType getType() { |
| 71 | return OFType.EXPERIMENTER; |
| 72 | } |
| 73 | |
| 74 | @Override |
| 75 | public long getXid() { |
| 76 | return xid; |
| 77 | } |
| 78 | |
| 79 | @Override |
| 80 | public long getExperimenter() { |
| 81 | return 0x5c16c7L; |
| 82 | } |
| 83 | |
| 84 | @Override |
| 85 | public long getSubtype() { |
| 86 | return 0x18L; |
| 87 | } |
| 88 | |
| 89 | @Override |
| 90 | public boolean isL2TableEnable() { |
| 91 | return l2TableEnable; |
| 92 | } |
| 93 | |
| 94 | @Override |
| 95 | public int getL2TablePriority() { |
| 96 | return l2TablePriority; |
| 97 | } |
| 98 | |
| 99 | @Override |
| 100 | public long getStatus() { |
| 101 | return status; |
| 102 | } |
| 103 | |
| 104 | |
| 105 | |
| 106 | public OFBsnSetL2TableReply.Builder createBuilder() { |
| 107 | return new BuilderWithParent(this); |
| 108 | } |
| 109 | |
| 110 | static class BuilderWithParent implements OFBsnSetL2TableReply.Builder { |
| 111 | final OFBsnSetL2TableReplyVer10 parentMessage; |
| 112 | |
| 113 | // OF message fields |
| 114 | private boolean xidSet; |
| 115 | private long xid; |
| 116 | private boolean l2TableEnableSet; |
| 117 | private boolean l2TableEnable; |
| 118 | private boolean l2TablePrioritySet; |
| 119 | private int l2TablePriority; |
| 120 | private boolean statusSet; |
| 121 | private long status; |
| 122 | |
| 123 | BuilderWithParent(OFBsnSetL2TableReplyVer10 parentMessage) { |
| 124 | this.parentMessage = parentMessage; |
| 125 | } |
| 126 | |
| 127 | @Override |
| 128 | public OFVersion getVersion() { |
| 129 | return OFVersion.OF_10; |
| 130 | } |
| 131 | |
| 132 | @Override |
| 133 | public OFType getType() { |
| 134 | return OFType.EXPERIMENTER; |
| 135 | } |
| 136 | |
| 137 | @Override |
| 138 | public long getXid() { |
| 139 | return xid; |
| 140 | } |
| 141 | |
| 142 | @Override |
| 143 | public OFBsnSetL2TableReply.Builder setXid(long xid) { |
| 144 | this.xid = xid; |
| 145 | this.xidSet = true; |
| 146 | return this; |
| 147 | } |
| 148 | @Override |
| 149 | public long getExperimenter() { |
| 150 | return 0x5c16c7L; |
| 151 | } |
| 152 | |
| 153 | @Override |
| 154 | public long getSubtype() { |
| 155 | return 0x18L; |
| 156 | } |
| 157 | |
| 158 | @Override |
| 159 | public boolean isL2TableEnable() { |
| 160 | return l2TableEnable; |
| 161 | } |
| 162 | |
| 163 | @Override |
| 164 | public OFBsnSetL2TableReply.Builder setL2TableEnable(boolean l2TableEnable) { |
| 165 | this.l2TableEnable = l2TableEnable; |
| 166 | this.l2TableEnableSet = true; |
| 167 | return this; |
| 168 | } |
| 169 | @Override |
| 170 | public int getL2TablePriority() { |
| 171 | return l2TablePriority; |
| 172 | } |
| 173 | |
| 174 | @Override |
| 175 | public OFBsnSetL2TableReply.Builder setL2TablePriority(int l2TablePriority) { |
| 176 | this.l2TablePriority = l2TablePriority; |
| 177 | this.l2TablePrioritySet = true; |
| 178 | return this; |
| 179 | } |
| 180 | @Override |
| 181 | public long getStatus() { |
| 182 | return status; |
| 183 | } |
| 184 | |
| 185 | @Override |
| 186 | public OFBsnSetL2TableReply.Builder setStatus(long status) { |
| 187 | this.status = status; |
| 188 | this.statusSet = true; |
| 189 | return this; |
| 190 | } |
| 191 | |
| 192 | |
| 193 | @Override |
| 194 | public OFBsnSetL2TableReply build() { |
| 195 | long xid = this.xidSet ? this.xid : parentMessage.xid; |
| 196 | boolean l2TableEnable = this.l2TableEnableSet ? this.l2TableEnable : parentMessage.l2TableEnable; |
| 197 | int l2TablePriority = this.l2TablePrioritySet ? this.l2TablePriority : parentMessage.l2TablePriority; |
| 198 | long status = this.statusSet ? this.status : parentMessage.status; |
| 199 | |
| 200 | // |
| 201 | return new OFBsnSetL2TableReplyVer10( |
| 202 | xid, |
| 203 | l2TableEnable, |
| 204 | l2TablePriority, |
| 205 | status |
| 206 | ); |
| 207 | } |
| 208 | |
| 209 | } |
| 210 | |
| 211 | static class Builder implements OFBsnSetL2TableReply.Builder { |
| 212 | // OF message fields |
| 213 | private boolean xidSet; |
| 214 | private long xid; |
| 215 | private boolean l2TableEnableSet; |
| 216 | private boolean l2TableEnable; |
| 217 | private boolean l2TablePrioritySet; |
| 218 | private int l2TablePriority; |
| 219 | private boolean statusSet; |
| 220 | private long status; |
| 221 | |
| 222 | @Override |
| 223 | public OFVersion getVersion() { |
| 224 | return OFVersion.OF_10; |
| 225 | } |
| 226 | |
| 227 | @Override |
| 228 | public OFType getType() { |
| 229 | return OFType.EXPERIMENTER; |
| 230 | } |
| 231 | |
| 232 | @Override |
| 233 | public long getXid() { |
| 234 | return xid; |
| 235 | } |
| 236 | |
| 237 | @Override |
| 238 | public OFBsnSetL2TableReply.Builder setXid(long xid) { |
| 239 | this.xid = xid; |
| 240 | this.xidSet = true; |
| 241 | return this; |
| 242 | } |
| 243 | @Override |
| 244 | public long getExperimenter() { |
| 245 | return 0x5c16c7L; |
| 246 | } |
| 247 | |
| 248 | @Override |
| 249 | public long getSubtype() { |
| 250 | return 0x18L; |
| 251 | } |
| 252 | |
| 253 | @Override |
| 254 | public boolean isL2TableEnable() { |
| 255 | return l2TableEnable; |
| 256 | } |
| 257 | |
| 258 | @Override |
| 259 | public OFBsnSetL2TableReply.Builder setL2TableEnable(boolean l2TableEnable) { |
| 260 | this.l2TableEnable = l2TableEnable; |
| 261 | this.l2TableEnableSet = true; |
| 262 | return this; |
| 263 | } |
| 264 | @Override |
| 265 | public int getL2TablePriority() { |
| 266 | return l2TablePriority; |
| 267 | } |
| 268 | |
| 269 | @Override |
| 270 | public OFBsnSetL2TableReply.Builder setL2TablePriority(int l2TablePriority) { |
| 271 | this.l2TablePriority = l2TablePriority; |
| 272 | this.l2TablePrioritySet = true; |
| 273 | return this; |
| 274 | } |
| 275 | @Override |
| 276 | public long getStatus() { |
| 277 | return status; |
| 278 | } |
| 279 | |
| 280 | @Override |
| 281 | public OFBsnSetL2TableReply.Builder setStatus(long status) { |
| 282 | this.status = status; |
| 283 | this.statusSet = true; |
| 284 | return this; |
| 285 | } |
| 286 | // |
| 287 | @Override |
| 288 | public OFBsnSetL2TableReply build() { |
| 289 | long xid = this.xidSet ? this.xid : DEFAULT_XID; |
| 290 | boolean l2TableEnable = this.l2TableEnableSet ? this.l2TableEnable : DEFAULT_L2_TABLE_ENABLE; |
| 291 | int l2TablePriority = this.l2TablePrioritySet ? this.l2TablePriority : DEFAULT_L2_TABLE_PRIORITY; |
| 292 | long status = this.statusSet ? this.status : DEFAULT_STATUS; |
| 293 | |
| 294 | |
| 295 | return new OFBsnSetL2TableReplyVer10( |
| 296 | xid, |
| 297 | l2TableEnable, |
| 298 | l2TablePriority, |
| 299 | status |
| 300 | ); |
| 301 | } |
| 302 | |
| 303 | } |
| 304 | |
| 305 | |
| 306 | final static Reader READER = new Reader(); |
| 307 | static class Reader implements OFMessageReader<OFBsnSetL2TableReply> { |
| 308 | @Override |
| 309 | public OFBsnSetL2TableReply readFrom(ChannelBuffer bb) throws OFParseError { |
| 310 | int start = bb.readerIndex(); |
| 311 | // fixed value property version == 1 |
| 312 | byte version = bb.readByte(); |
| 313 | if(version != (byte) 0x1) |
| 314 | throw new OFParseError("Wrong version: Expected=OFVersion.OF_10(1), got="+version); |
| 315 | // fixed value property type == 4 |
| 316 | byte type = bb.readByte(); |
| 317 | if(type != (byte) 0x4) |
| 318 | throw new OFParseError("Wrong type: Expected=OFType.EXPERIMENTER(4), got="+type); |
| 319 | int length = U16.f(bb.readShort()); |
| 320 | if(length != 24) |
| 321 | throw new OFParseError("Wrong length: Expected=24(24), got="+length); |
| 322 | if(bb.readableBytes() + (bb.readerIndex() - start) < length) { |
| 323 | // Buffer does not have all data yet |
| 324 | bb.readerIndex(start); |
| 325 | return null; |
| 326 | } |
| 327 | if(logger.isTraceEnabled()) |
| 328 | logger.trace("readFrom - length={}", length); |
| 329 | long xid = U32.f(bb.readInt()); |
| 330 | // fixed value property experimenter == 0x5c16c7L |
| 331 | int experimenter = bb.readInt(); |
| 332 | if(experimenter != 0x5c16c7) |
| 333 | throw new OFParseError("Wrong experimenter: Expected=0x5c16c7L(0x5c16c7L), got="+experimenter); |
| 334 | // fixed value property subtype == 0x18L |
| 335 | int subtype = bb.readInt(); |
| 336 | if(subtype != 0x18) |
| 337 | throw new OFParseError("Wrong subtype: Expected=0x18L(0x18L), got="+subtype); |
| 338 | boolean l2TableEnable = (bb.readByte() != 0); |
| 339 | // pad: 1 bytes |
| 340 | bb.skipBytes(1); |
| 341 | int l2TablePriority = U16.f(bb.readShort()); |
| 342 | long status = U32.f(bb.readInt()); |
| 343 | |
| 344 | OFBsnSetL2TableReplyVer10 bsnSetL2TableReplyVer10 = new OFBsnSetL2TableReplyVer10( |
| 345 | xid, |
| 346 | l2TableEnable, |
| 347 | l2TablePriority, |
| 348 | status |
| 349 | ); |
| 350 | if(logger.isTraceEnabled()) |
| 351 | logger.trace("readFrom - read={}", bsnSetL2TableReplyVer10); |
| 352 | return bsnSetL2TableReplyVer10; |
| 353 | } |
| 354 | } |
| 355 | |
| 356 | public void putTo(PrimitiveSink sink) { |
| 357 | FUNNEL.funnel(this, sink); |
| 358 | } |
| 359 | |
| 360 | final static OFBsnSetL2TableReplyVer10Funnel FUNNEL = new OFBsnSetL2TableReplyVer10Funnel(); |
| 361 | static class OFBsnSetL2TableReplyVer10Funnel implements Funnel<OFBsnSetL2TableReplyVer10> { |
| 362 | private static final long serialVersionUID = 1L; |
| 363 | @Override |
| 364 | public void funnel(OFBsnSetL2TableReplyVer10 message, PrimitiveSink sink) { |
| 365 | // fixed value property version = 1 |
| 366 | sink.putByte((byte) 0x1); |
| 367 | // fixed value property type = 4 |
| 368 | sink.putByte((byte) 0x4); |
| 369 | // fixed value property length = 24 |
| 370 | sink.putShort((short) 0x18); |
| 371 | sink.putLong(message.xid); |
| 372 | // fixed value property experimenter = 0x5c16c7L |
| 373 | sink.putInt(0x5c16c7); |
| 374 | // fixed value property subtype = 0x18L |
| 375 | sink.putInt(0x18); |
| 376 | sink.putBoolean(message.l2TableEnable); |
| 377 | // skip pad (1 bytes) |
| 378 | sink.putInt(message.l2TablePriority); |
| 379 | sink.putLong(message.status); |
| 380 | } |
| 381 | } |
| 382 | |
| 383 | |
| 384 | public void writeTo(ChannelBuffer bb) { |
| 385 | WRITER.write(bb, this); |
| 386 | } |
| 387 | |
| 388 | final static Writer WRITER = new Writer(); |
| 389 | static class Writer implements OFMessageWriter<OFBsnSetL2TableReplyVer10> { |
| 390 | @Override |
| 391 | public void write(ChannelBuffer bb, OFBsnSetL2TableReplyVer10 message) { |
| 392 | // fixed value property version = 1 |
| 393 | bb.writeByte((byte) 0x1); |
| 394 | // fixed value property type = 4 |
| 395 | bb.writeByte((byte) 0x4); |
| 396 | // fixed value property length = 24 |
| 397 | bb.writeShort((short) 0x18); |
| 398 | bb.writeInt(U32.t(message.xid)); |
| 399 | // fixed value property experimenter = 0x5c16c7L |
| 400 | bb.writeInt(0x5c16c7); |
| 401 | // fixed value property subtype = 0x18L |
| 402 | bb.writeInt(0x18); |
| 403 | bb.writeByte(message.l2TableEnable ? 1 : 0); |
| 404 | // pad: 1 bytes |
| 405 | bb.writeZero(1); |
| 406 | bb.writeShort(U16.t(message.l2TablePriority)); |
| 407 | bb.writeInt(U32.t(message.status)); |
| 408 | |
| 409 | |
| 410 | } |
| 411 | } |
| 412 | |
| 413 | @Override |
| 414 | public String toString() { |
| 415 | StringBuilder b = new StringBuilder("OFBsnSetL2TableReplyVer10("); |
| 416 | b.append("xid=").append(xid); |
| 417 | b.append(", "); |
| 418 | b.append("l2TableEnable=").append(l2TableEnable); |
| 419 | b.append(", "); |
| 420 | b.append("l2TablePriority=").append(l2TablePriority); |
| 421 | b.append(", "); |
| 422 | b.append("status=").append(status); |
| 423 | b.append(")"); |
| 424 | return b.toString(); |
| 425 | } |
| 426 | |
| 427 | @Override |
| 428 | public boolean equals(Object obj) { |
| 429 | if (this == obj) |
| 430 | return true; |
| 431 | if (obj == null) |
| 432 | return false; |
| 433 | if (getClass() != obj.getClass()) |
| 434 | return false; |
| 435 | OFBsnSetL2TableReplyVer10 other = (OFBsnSetL2TableReplyVer10) obj; |
| 436 | |
| 437 | if( xid != other.xid) |
| 438 | return false; |
| 439 | if( l2TableEnable != other.l2TableEnable) |
| 440 | return false; |
| 441 | if( l2TablePriority != other.l2TablePriority) |
| 442 | return false; |
| 443 | if( status != other.status) |
| 444 | return false; |
| 445 | return true; |
| 446 | } |
| 447 | |
| 448 | @Override |
| 449 | public int hashCode() { |
| 450 | final int prime = 31; |
| 451 | int result = 1; |
| 452 | |
| 453 | result = prime * (int) (xid ^ (xid >>> 32)); |
| 454 | result = prime * result + (l2TableEnable ? 1231 : 1237); |
| 455 | result = prime * result + l2TablePriority; |
| 456 | result = prime * (int) (status ^ (status >>> 32)); |
| 457 | return result; |
| 458 | } |
| 459 | |
| 460 | } |