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.ver11; |
| 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 org.slf4j.Logger; |
| 27 | import org.slf4j.LoggerFactory; |
| 28 | import java.util.Set; |
| 29 | import org.jboss.netty.buffer.ChannelBuffer; |
| 30 | import com.google.common.hash.PrimitiveSink; |
| 31 | import com.google.common.hash.Funnel; |
| 32 | |
| 33 | class OFBsnVportQInQVer11 implements OFBsnVportQInQ { |
| 34 | private static final Logger logger = LoggerFactory.getLogger(OFBsnVportQInQVer11.class); |
| 35 | // version: 1.1 |
| 36 | final static byte WIRE_VERSION = 2; |
| 37 | final static int LENGTH = 32; |
| 38 | |
| 39 | private final static long DEFAULT_PORT_NO = 0x0L; |
| 40 | private final static int DEFAULT_INGRESS_TPID = 0x0; |
| 41 | private final static int DEFAULT_INGRESS_VLAN_ID = 0x0; |
| 42 | private final static int DEFAULT_EGRESS_TPID = 0x0; |
| 43 | private final static int DEFAULT_EGRESS_VLAN_ID = 0x0; |
| 44 | private final static String DEFAULT_IF_NAME = ""; |
| 45 | |
| 46 | // OF message fields |
| 47 | private final long portNo; |
| 48 | private final int ingressTpid; |
| 49 | private final int ingressVlanId; |
| 50 | private final int egressTpid; |
| 51 | private final int egressVlanId; |
| 52 | private final String ifName; |
| 53 | // |
| 54 | // Immutable default instance |
| 55 | final static OFBsnVportQInQVer11 DEFAULT = new OFBsnVportQInQVer11( |
| 56 | DEFAULT_PORT_NO, DEFAULT_INGRESS_TPID, DEFAULT_INGRESS_VLAN_ID, DEFAULT_EGRESS_TPID, DEFAULT_EGRESS_VLAN_ID, DEFAULT_IF_NAME |
| 57 | ); |
| 58 | |
| 59 | // package private constructor - used by readers, builders, and factory |
| 60 | OFBsnVportQInQVer11(long portNo, int ingressTpid, int ingressVlanId, int egressTpid, int egressVlanId, String ifName) { |
| 61 | this.portNo = portNo; |
| 62 | this.ingressTpid = ingressTpid; |
| 63 | this.ingressVlanId = ingressVlanId; |
| 64 | this.egressTpid = egressTpid; |
| 65 | this.egressVlanId = egressVlanId; |
| 66 | this.ifName = ifName; |
| 67 | } |
| 68 | |
| 69 | // Accessors for OF message fields |
| 70 | @Override |
| 71 | public int getType() { |
| 72 | return 0x0; |
| 73 | } |
| 74 | |
| 75 | @Override |
| 76 | public long getPortNo() { |
| 77 | return portNo; |
| 78 | } |
| 79 | |
| 80 | @Override |
| 81 | public int getIngressTpid() { |
| 82 | return ingressTpid; |
| 83 | } |
| 84 | |
| 85 | @Override |
| 86 | public int getIngressVlanId() { |
| 87 | return ingressVlanId; |
| 88 | } |
| 89 | |
| 90 | @Override |
| 91 | public int getEgressTpid() { |
| 92 | return egressTpid; |
| 93 | } |
| 94 | |
| 95 | @Override |
| 96 | public int getEgressVlanId() { |
| 97 | return egressVlanId; |
| 98 | } |
| 99 | |
| 100 | @Override |
| 101 | public String getIfName() { |
| 102 | return ifName; |
| 103 | } |
| 104 | |
| 105 | @Override |
| 106 | public OFVersion getVersion() { |
| 107 | return OFVersion.OF_11; |
| 108 | } |
| 109 | |
| 110 | |
| 111 | |
| 112 | public OFBsnVportQInQ.Builder createBuilder() { |
| 113 | return new BuilderWithParent(this); |
| 114 | } |
| 115 | |
| 116 | static class BuilderWithParent implements OFBsnVportQInQ.Builder { |
| 117 | final OFBsnVportQInQVer11 parentMessage; |
| 118 | |
| 119 | // OF message fields |
| 120 | private boolean portNoSet; |
| 121 | private long portNo; |
| 122 | private boolean ingressTpidSet; |
| 123 | private int ingressTpid; |
| 124 | private boolean ingressVlanIdSet; |
| 125 | private int ingressVlanId; |
| 126 | private boolean egressTpidSet; |
| 127 | private int egressTpid; |
| 128 | private boolean egressVlanIdSet; |
| 129 | private int egressVlanId; |
| 130 | private boolean ifNameSet; |
| 131 | private String ifName; |
| 132 | |
| 133 | BuilderWithParent(OFBsnVportQInQVer11 parentMessage) { |
| 134 | this.parentMessage = parentMessage; |
| 135 | } |
| 136 | |
| 137 | @Override |
| 138 | public int getType() { |
| 139 | return 0x0; |
| 140 | } |
| 141 | |
| 142 | @Override |
| 143 | public long getPortNo() { |
| 144 | return portNo; |
| 145 | } |
| 146 | |
| 147 | @Override |
| 148 | public OFBsnVportQInQ.Builder setPortNo(long portNo) { |
| 149 | this.portNo = portNo; |
| 150 | this.portNoSet = true; |
| 151 | return this; |
| 152 | } |
| 153 | @Override |
| 154 | public int getIngressTpid() { |
| 155 | return ingressTpid; |
| 156 | } |
| 157 | |
| 158 | @Override |
| 159 | public OFBsnVportQInQ.Builder setIngressTpid(int ingressTpid) { |
| 160 | this.ingressTpid = ingressTpid; |
| 161 | this.ingressTpidSet = true; |
| 162 | return this; |
| 163 | } |
| 164 | @Override |
| 165 | public int getIngressVlanId() { |
| 166 | return ingressVlanId; |
| 167 | } |
| 168 | |
| 169 | @Override |
| 170 | public OFBsnVportQInQ.Builder setIngressVlanId(int ingressVlanId) { |
| 171 | this.ingressVlanId = ingressVlanId; |
| 172 | this.ingressVlanIdSet = true; |
| 173 | return this; |
| 174 | } |
| 175 | @Override |
| 176 | public int getEgressTpid() { |
| 177 | return egressTpid; |
| 178 | } |
| 179 | |
| 180 | @Override |
| 181 | public OFBsnVportQInQ.Builder setEgressTpid(int egressTpid) { |
| 182 | this.egressTpid = egressTpid; |
| 183 | this.egressTpidSet = true; |
| 184 | return this; |
| 185 | } |
| 186 | @Override |
| 187 | public int getEgressVlanId() { |
| 188 | return egressVlanId; |
| 189 | } |
| 190 | |
| 191 | @Override |
| 192 | public OFBsnVportQInQ.Builder setEgressVlanId(int egressVlanId) { |
| 193 | this.egressVlanId = egressVlanId; |
| 194 | this.egressVlanIdSet = true; |
| 195 | return this; |
| 196 | } |
| 197 | @Override |
| 198 | public String getIfName() { |
| 199 | return ifName; |
| 200 | } |
| 201 | |
| 202 | @Override |
| 203 | public OFBsnVportQInQ.Builder setIfName(String ifName) { |
| 204 | this.ifName = ifName; |
| 205 | this.ifNameSet = true; |
| 206 | return this; |
| 207 | } |
| 208 | @Override |
| 209 | public OFVersion getVersion() { |
| 210 | return OFVersion.OF_11; |
| 211 | } |
| 212 | |
| 213 | |
| 214 | |
| 215 | @Override |
| 216 | public OFBsnVportQInQ build() { |
| 217 | long portNo = this.portNoSet ? this.portNo : parentMessage.portNo; |
| 218 | int ingressTpid = this.ingressTpidSet ? this.ingressTpid : parentMessage.ingressTpid; |
| 219 | int ingressVlanId = this.ingressVlanIdSet ? this.ingressVlanId : parentMessage.ingressVlanId; |
| 220 | int egressTpid = this.egressTpidSet ? this.egressTpid : parentMessage.egressTpid; |
| 221 | int egressVlanId = this.egressVlanIdSet ? this.egressVlanId : parentMessage.egressVlanId; |
| 222 | String ifName = this.ifNameSet ? this.ifName : parentMessage.ifName; |
| 223 | if(ifName == null) |
| 224 | throw new NullPointerException("Property ifName must not be null"); |
| 225 | |
| 226 | // |
| 227 | return new OFBsnVportQInQVer11( |
| 228 | portNo, |
| 229 | ingressTpid, |
| 230 | ingressVlanId, |
| 231 | egressTpid, |
| 232 | egressVlanId, |
| 233 | ifName |
| 234 | ); |
| 235 | } |
| 236 | |
| 237 | } |
| 238 | |
| 239 | static class Builder implements OFBsnVportQInQ.Builder { |
| 240 | // OF message fields |
| 241 | private boolean portNoSet; |
| 242 | private long portNo; |
| 243 | private boolean ingressTpidSet; |
| 244 | private int ingressTpid; |
| 245 | private boolean ingressVlanIdSet; |
| 246 | private int ingressVlanId; |
| 247 | private boolean egressTpidSet; |
| 248 | private int egressTpid; |
| 249 | private boolean egressVlanIdSet; |
| 250 | private int egressVlanId; |
| 251 | private boolean ifNameSet; |
| 252 | private String ifName; |
| 253 | |
| 254 | @Override |
| 255 | public int getType() { |
| 256 | return 0x0; |
| 257 | } |
| 258 | |
| 259 | @Override |
| 260 | public long getPortNo() { |
| 261 | return portNo; |
| 262 | } |
| 263 | |
| 264 | @Override |
| 265 | public OFBsnVportQInQ.Builder setPortNo(long portNo) { |
| 266 | this.portNo = portNo; |
| 267 | this.portNoSet = true; |
| 268 | return this; |
| 269 | } |
| 270 | @Override |
| 271 | public int getIngressTpid() { |
| 272 | return ingressTpid; |
| 273 | } |
| 274 | |
| 275 | @Override |
| 276 | public OFBsnVportQInQ.Builder setIngressTpid(int ingressTpid) { |
| 277 | this.ingressTpid = ingressTpid; |
| 278 | this.ingressTpidSet = true; |
| 279 | return this; |
| 280 | } |
| 281 | @Override |
| 282 | public int getIngressVlanId() { |
| 283 | return ingressVlanId; |
| 284 | } |
| 285 | |
| 286 | @Override |
| 287 | public OFBsnVportQInQ.Builder setIngressVlanId(int ingressVlanId) { |
| 288 | this.ingressVlanId = ingressVlanId; |
| 289 | this.ingressVlanIdSet = true; |
| 290 | return this; |
| 291 | } |
| 292 | @Override |
| 293 | public int getEgressTpid() { |
| 294 | return egressTpid; |
| 295 | } |
| 296 | |
| 297 | @Override |
| 298 | public OFBsnVportQInQ.Builder setEgressTpid(int egressTpid) { |
| 299 | this.egressTpid = egressTpid; |
| 300 | this.egressTpidSet = true; |
| 301 | return this; |
| 302 | } |
| 303 | @Override |
| 304 | public int getEgressVlanId() { |
| 305 | return egressVlanId; |
| 306 | } |
| 307 | |
| 308 | @Override |
| 309 | public OFBsnVportQInQ.Builder setEgressVlanId(int egressVlanId) { |
| 310 | this.egressVlanId = egressVlanId; |
| 311 | this.egressVlanIdSet = true; |
| 312 | return this; |
| 313 | } |
| 314 | @Override |
| 315 | public String getIfName() { |
| 316 | return ifName; |
| 317 | } |
| 318 | |
| 319 | @Override |
| 320 | public OFBsnVportQInQ.Builder setIfName(String ifName) { |
| 321 | this.ifName = ifName; |
| 322 | this.ifNameSet = true; |
| 323 | return this; |
| 324 | } |
| 325 | @Override |
| 326 | public OFVersion getVersion() { |
| 327 | return OFVersion.OF_11; |
| 328 | } |
| 329 | |
| 330 | // |
| 331 | @Override |
| 332 | public OFBsnVportQInQ build() { |
| 333 | long portNo = this.portNoSet ? this.portNo : DEFAULT_PORT_NO; |
| 334 | int ingressTpid = this.ingressTpidSet ? this.ingressTpid : DEFAULT_INGRESS_TPID; |
| 335 | int ingressVlanId = this.ingressVlanIdSet ? this.ingressVlanId : DEFAULT_INGRESS_VLAN_ID; |
| 336 | int egressTpid = this.egressTpidSet ? this.egressTpid : DEFAULT_EGRESS_TPID; |
| 337 | int egressVlanId = this.egressVlanIdSet ? this.egressVlanId : DEFAULT_EGRESS_VLAN_ID; |
| 338 | String ifName = this.ifNameSet ? this.ifName : DEFAULT_IF_NAME; |
| 339 | if(ifName == null) |
| 340 | throw new NullPointerException("Property ifName must not be null"); |
| 341 | |
| 342 | |
| 343 | return new OFBsnVportQInQVer11( |
| 344 | portNo, |
| 345 | ingressTpid, |
| 346 | ingressVlanId, |
| 347 | egressTpid, |
| 348 | egressVlanId, |
| 349 | ifName |
| 350 | ); |
| 351 | } |
| 352 | |
| 353 | } |
| 354 | |
| 355 | |
| 356 | final static Reader READER = new Reader(); |
| 357 | static class Reader implements OFMessageReader<OFBsnVportQInQ> { |
| 358 | @Override |
| 359 | public OFBsnVportQInQ readFrom(ChannelBuffer bb) throws OFParseError { |
| 360 | int start = bb.readerIndex(); |
| 361 | // fixed value property type == 0x0 |
| 362 | short type = bb.readShort(); |
| 363 | if(type != (short) 0x0) |
| 364 | throw new OFParseError("Wrong type: Expected=0x0(0x0), got="+type); |
| 365 | int length = U16.f(bb.readShort()); |
| 366 | if(length != 32) |
| 367 | throw new OFParseError("Wrong length: Expected=32(32), got="+length); |
| 368 | if(bb.readableBytes() + (bb.readerIndex() - start) < length) { |
| 369 | // Buffer does not have all data yet |
| 370 | bb.readerIndex(start); |
| 371 | return null; |
| 372 | } |
| 373 | if(logger.isTraceEnabled()) |
| 374 | logger.trace("readFrom - length={}", length); |
| 375 | long portNo = U32.f(bb.readInt()); |
| 376 | int ingressTpid = U16.f(bb.readShort()); |
| 377 | int ingressVlanId = U16.f(bb.readShort()); |
| 378 | int egressTpid = U16.f(bb.readShort()); |
| 379 | int egressVlanId = U16.f(bb.readShort()); |
| 380 | String ifName = ChannelUtils.readFixedLengthString(bb, 16); |
| 381 | |
| 382 | OFBsnVportQInQVer11 bsnVportQInQVer11 = new OFBsnVportQInQVer11( |
| 383 | portNo, |
| 384 | ingressTpid, |
| 385 | ingressVlanId, |
| 386 | egressTpid, |
| 387 | egressVlanId, |
| 388 | ifName |
| 389 | ); |
| 390 | if(logger.isTraceEnabled()) |
| 391 | logger.trace("readFrom - read={}", bsnVportQInQVer11); |
| 392 | return bsnVportQInQVer11; |
| 393 | } |
| 394 | } |
| 395 | |
| 396 | public void putTo(PrimitiveSink sink) { |
| 397 | FUNNEL.funnel(this, sink); |
| 398 | } |
| 399 | |
| 400 | final static OFBsnVportQInQVer11Funnel FUNNEL = new OFBsnVportQInQVer11Funnel(); |
| 401 | static class OFBsnVportQInQVer11Funnel implements Funnel<OFBsnVportQInQVer11> { |
| 402 | private static final long serialVersionUID = 1L; |
| 403 | @Override |
| 404 | public void funnel(OFBsnVportQInQVer11 message, PrimitiveSink sink) { |
| 405 | // fixed value property type = 0x0 |
| 406 | sink.putShort((short) 0x0); |
| 407 | // fixed value property length = 32 |
| 408 | sink.putShort((short) 0x20); |
| 409 | sink.putLong(message.portNo); |
| 410 | sink.putInt(message.ingressTpid); |
| 411 | sink.putInt(message.ingressVlanId); |
| 412 | sink.putInt(message.egressTpid); |
| 413 | sink.putInt(message.egressVlanId); |
| 414 | sink.putUnencodedChars(message.ifName); |
| 415 | } |
| 416 | } |
| 417 | |
| 418 | |
| 419 | public void writeTo(ChannelBuffer bb) { |
| 420 | WRITER.write(bb, this); |
| 421 | } |
| 422 | |
| 423 | final static Writer WRITER = new Writer(); |
| 424 | static class Writer implements OFMessageWriter<OFBsnVportQInQVer11> { |
| 425 | @Override |
| 426 | public void write(ChannelBuffer bb, OFBsnVportQInQVer11 message) { |
| 427 | // fixed value property type = 0x0 |
| 428 | bb.writeShort((short) 0x0); |
| 429 | // fixed value property length = 32 |
| 430 | bb.writeShort((short) 0x20); |
| 431 | bb.writeInt(U32.t(message.portNo)); |
| 432 | bb.writeShort(U16.t(message.ingressTpid)); |
| 433 | bb.writeShort(U16.t(message.ingressVlanId)); |
| 434 | bb.writeShort(U16.t(message.egressTpid)); |
| 435 | bb.writeShort(U16.t(message.egressVlanId)); |
| 436 | ChannelUtils.writeFixedLengthString(bb, message.ifName, 16); |
| 437 | |
| 438 | |
| 439 | } |
| 440 | } |
| 441 | |
| 442 | @Override |
| 443 | public String toString() { |
| 444 | StringBuilder b = new StringBuilder("OFBsnVportQInQVer11("); |
| 445 | b.append("portNo=").append(portNo); |
| 446 | b.append(", "); |
| 447 | b.append("ingressTpid=").append(ingressTpid); |
| 448 | b.append(", "); |
| 449 | b.append("ingressVlanId=").append(ingressVlanId); |
| 450 | b.append(", "); |
| 451 | b.append("egressTpid=").append(egressTpid); |
| 452 | b.append(", "); |
| 453 | b.append("egressVlanId=").append(egressVlanId); |
| 454 | b.append(", "); |
| 455 | b.append("ifName=").append(ifName); |
| 456 | b.append(")"); |
| 457 | return b.toString(); |
| 458 | } |
| 459 | |
| 460 | @Override |
| 461 | public boolean equals(Object obj) { |
| 462 | if (this == obj) |
| 463 | return true; |
| 464 | if (obj == null) |
| 465 | return false; |
| 466 | if (getClass() != obj.getClass()) |
| 467 | return false; |
| 468 | OFBsnVportQInQVer11 other = (OFBsnVportQInQVer11) obj; |
| 469 | |
| 470 | if( portNo != other.portNo) |
| 471 | return false; |
| 472 | if( ingressTpid != other.ingressTpid) |
| 473 | return false; |
| 474 | if( ingressVlanId != other.ingressVlanId) |
| 475 | return false; |
| 476 | if( egressTpid != other.egressTpid) |
| 477 | return false; |
| 478 | if( egressVlanId != other.egressVlanId) |
| 479 | return false; |
| 480 | if (ifName == null) { |
| 481 | if (other.ifName != null) |
| 482 | return false; |
| 483 | } else if (!ifName.equals(other.ifName)) |
| 484 | return false; |
| 485 | return true; |
| 486 | } |
| 487 | |
| 488 | @Override |
| 489 | public int hashCode() { |
| 490 | final int prime = 31; |
| 491 | int result = 1; |
| 492 | |
| 493 | result = prime * (int) (portNo ^ (portNo >>> 32)); |
| 494 | result = prime * result + ingressTpid; |
| 495 | result = prime * result + ingressVlanId; |
| 496 | result = prime * result + egressTpid; |
| 497 | result = prime * result + egressVlanId; |
| 498 | result = prime * result + ((ifName == null) ? 0 : ifName.hashCode()); |
| 499 | return result; |
| 500 | } |
| 501 | |
| 502 | } |