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 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 OFActionBsnSetTunnelDstVer11 implements OFActionBsnSetTunnelDst { |
| 34 | private static final Logger logger = LoggerFactory.getLogger(OFActionBsnSetTunnelDstVer11.class); |
| 35 | // version: 1.1 |
| 36 | final static byte WIRE_VERSION = 2; |
| 37 | final static int LENGTH = 16; |
| 38 | |
| 39 | private final static long DEFAULT_DST = 0x0L; |
| 40 | |
| 41 | // OF message fields |
| 42 | private final long dst; |
| 43 | // |
| 44 | // Immutable default instance |
| 45 | final static OFActionBsnSetTunnelDstVer11 DEFAULT = new OFActionBsnSetTunnelDstVer11( |
| 46 | DEFAULT_DST |
| 47 | ); |
| 48 | |
| 49 | // package private constructor - used by readers, builders, and factory |
| 50 | OFActionBsnSetTunnelDstVer11(long dst) { |
| 51 | this.dst = dst; |
| 52 | } |
| 53 | |
| 54 | // Accessors for OF message fields |
| 55 | @Override |
| 56 | public OFActionType getType() { |
| 57 | return OFActionType.EXPERIMENTER; |
| 58 | } |
| 59 | |
| 60 | @Override |
| 61 | public long getExperimenter() { |
| 62 | return 0x5c16c7L; |
| 63 | } |
| 64 | |
| 65 | @Override |
| 66 | public long getSubtype() { |
| 67 | return 0x2L; |
| 68 | } |
| 69 | |
| 70 | @Override |
| 71 | public long getDst() { |
| 72 | return dst; |
| 73 | } |
| 74 | |
| 75 | @Override |
| 76 | public OFVersion getVersion() { |
| 77 | return OFVersion.OF_11; |
| 78 | } |
| 79 | |
| 80 | |
| 81 | |
| 82 | public OFActionBsnSetTunnelDst.Builder createBuilder() { |
| 83 | return new BuilderWithParent(this); |
| 84 | } |
| 85 | |
| 86 | static class BuilderWithParent implements OFActionBsnSetTunnelDst.Builder { |
| 87 | final OFActionBsnSetTunnelDstVer11 parentMessage; |
| 88 | |
| 89 | // OF message fields |
| 90 | private boolean dstSet; |
| 91 | private long dst; |
| 92 | |
| 93 | BuilderWithParent(OFActionBsnSetTunnelDstVer11 parentMessage) { |
| 94 | this.parentMessage = parentMessage; |
| 95 | } |
| 96 | |
| 97 | @Override |
| 98 | public OFActionType getType() { |
| 99 | return OFActionType.EXPERIMENTER; |
| 100 | } |
| 101 | |
| 102 | @Override |
| 103 | public long getExperimenter() { |
| 104 | return 0x5c16c7L; |
| 105 | } |
| 106 | |
| 107 | @Override |
| 108 | public long getSubtype() { |
| 109 | return 0x2L; |
| 110 | } |
| 111 | |
| 112 | @Override |
| 113 | public long getDst() { |
| 114 | return dst; |
| 115 | } |
| 116 | |
| 117 | @Override |
| 118 | public OFActionBsnSetTunnelDst.Builder setDst(long dst) { |
| 119 | this.dst = dst; |
| 120 | this.dstSet = true; |
| 121 | return this; |
| 122 | } |
| 123 | @Override |
| 124 | public OFVersion getVersion() { |
| 125 | return OFVersion.OF_11; |
| 126 | } |
| 127 | |
| 128 | |
| 129 | |
| 130 | @Override |
| 131 | public OFActionBsnSetTunnelDst build() { |
| 132 | long dst = this.dstSet ? this.dst : parentMessage.dst; |
| 133 | |
| 134 | // |
| 135 | return new OFActionBsnSetTunnelDstVer11( |
| 136 | dst |
| 137 | ); |
| 138 | } |
| 139 | |
| 140 | } |
| 141 | |
| 142 | static class Builder implements OFActionBsnSetTunnelDst.Builder { |
| 143 | // OF message fields |
| 144 | private boolean dstSet; |
| 145 | private long dst; |
| 146 | |
| 147 | @Override |
| 148 | public OFActionType getType() { |
| 149 | return OFActionType.EXPERIMENTER; |
| 150 | } |
| 151 | |
| 152 | @Override |
| 153 | public long getExperimenter() { |
| 154 | return 0x5c16c7L; |
| 155 | } |
| 156 | |
| 157 | @Override |
| 158 | public long getSubtype() { |
| 159 | return 0x2L; |
| 160 | } |
| 161 | |
| 162 | @Override |
| 163 | public long getDst() { |
| 164 | return dst; |
| 165 | } |
| 166 | |
| 167 | @Override |
| 168 | public OFActionBsnSetTunnelDst.Builder setDst(long dst) { |
| 169 | this.dst = dst; |
| 170 | this.dstSet = true; |
| 171 | return this; |
| 172 | } |
| 173 | @Override |
| 174 | public OFVersion getVersion() { |
| 175 | return OFVersion.OF_11; |
| 176 | } |
| 177 | |
| 178 | // |
| 179 | @Override |
| 180 | public OFActionBsnSetTunnelDst build() { |
| 181 | long dst = this.dstSet ? this.dst : DEFAULT_DST; |
| 182 | |
| 183 | |
| 184 | return new OFActionBsnSetTunnelDstVer11( |
| 185 | dst |
| 186 | ); |
| 187 | } |
| 188 | |
| 189 | } |
| 190 | |
| 191 | |
| 192 | final static Reader READER = new Reader(); |
| 193 | static class Reader implements OFMessageReader<OFActionBsnSetTunnelDst> { |
| 194 | @Override |
| 195 | public OFActionBsnSetTunnelDst readFrom(ChannelBuffer bb) throws OFParseError { |
| 196 | int start = bb.readerIndex(); |
| 197 | // fixed value property type == 65535 |
| 198 | short type = bb.readShort(); |
| 199 | if(type != (short) 0xffff) |
| 200 | throw new OFParseError("Wrong type: Expected=OFActionType.EXPERIMENTER(65535), got="+type); |
| 201 | int length = U16.f(bb.readShort()); |
| 202 | if(length != 16) |
| 203 | throw new OFParseError("Wrong length: Expected=16(16), got="+length); |
| 204 | if(bb.readableBytes() + (bb.readerIndex() - start) < length) { |
| 205 | // Buffer does not have all data yet |
| 206 | bb.readerIndex(start); |
| 207 | return null; |
| 208 | } |
| 209 | if(logger.isTraceEnabled()) |
| 210 | logger.trace("readFrom - length={}", length); |
| 211 | // fixed value property experimenter == 0x5c16c7L |
| 212 | int experimenter = bb.readInt(); |
| 213 | if(experimenter != 0x5c16c7) |
| 214 | throw new OFParseError("Wrong experimenter: Expected=0x5c16c7L(0x5c16c7L), got="+experimenter); |
| 215 | // fixed value property subtype == 0x2L |
| 216 | int subtype = bb.readInt(); |
| 217 | if(subtype != 0x2) |
| 218 | throw new OFParseError("Wrong subtype: Expected=0x2L(0x2L), got="+subtype); |
| 219 | long dst = U32.f(bb.readInt()); |
| 220 | |
| 221 | OFActionBsnSetTunnelDstVer11 actionBsnSetTunnelDstVer11 = new OFActionBsnSetTunnelDstVer11( |
| 222 | dst |
| 223 | ); |
| 224 | if(logger.isTraceEnabled()) |
| 225 | logger.trace("readFrom - read={}", actionBsnSetTunnelDstVer11); |
| 226 | return actionBsnSetTunnelDstVer11; |
| 227 | } |
| 228 | } |
| 229 | |
| 230 | public void putTo(PrimitiveSink sink) { |
| 231 | FUNNEL.funnel(this, sink); |
| 232 | } |
| 233 | |
| 234 | final static OFActionBsnSetTunnelDstVer11Funnel FUNNEL = new OFActionBsnSetTunnelDstVer11Funnel(); |
| 235 | static class OFActionBsnSetTunnelDstVer11Funnel implements Funnel<OFActionBsnSetTunnelDstVer11> { |
| 236 | private static final long serialVersionUID = 1L; |
| 237 | @Override |
| 238 | public void funnel(OFActionBsnSetTunnelDstVer11 message, PrimitiveSink sink) { |
| 239 | // fixed value property type = 65535 |
| 240 | sink.putShort((short) 0xffff); |
| 241 | // fixed value property length = 16 |
| 242 | sink.putShort((short) 0x10); |
| 243 | // fixed value property experimenter = 0x5c16c7L |
| 244 | sink.putInt(0x5c16c7); |
| 245 | // fixed value property subtype = 0x2L |
| 246 | sink.putInt(0x2); |
| 247 | sink.putLong(message.dst); |
| 248 | } |
| 249 | } |
| 250 | |
| 251 | |
| 252 | public void writeTo(ChannelBuffer bb) { |
| 253 | WRITER.write(bb, this); |
| 254 | } |
| 255 | |
| 256 | final static Writer WRITER = new Writer(); |
| 257 | static class Writer implements OFMessageWriter<OFActionBsnSetTunnelDstVer11> { |
| 258 | @Override |
| 259 | public void write(ChannelBuffer bb, OFActionBsnSetTunnelDstVer11 message) { |
| 260 | // fixed value property type = 65535 |
| 261 | bb.writeShort((short) 0xffff); |
| 262 | // fixed value property length = 16 |
| 263 | bb.writeShort((short) 0x10); |
| 264 | // fixed value property experimenter = 0x5c16c7L |
| 265 | bb.writeInt(0x5c16c7); |
| 266 | // fixed value property subtype = 0x2L |
| 267 | bb.writeInt(0x2); |
| 268 | bb.writeInt(U32.t(message.dst)); |
| 269 | |
| 270 | |
| 271 | } |
| 272 | } |
| 273 | |
| 274 | @Override |
| 275 | public String toString() { |
| 276 | StringBuilder b = new StringBuilder("OFActionBsnSetTunnelDstVer11("); |
| 277 | b.append("dst=").append(dst); |
| 278 | b.append(")"); |
| 279 | return b.toString(); |
| 280 | } |
| 281 | |
| 282 | @Override |
| 283 | public boolean equals(Object obj) { |
| 284 | if (this == obj) |
| 285 | return true; |
| 286 | if (obj == null) |
| 287 | return false; |
| 288 | if (getClass() != obj.getClass()) |
| 289 | return false; |
| 290 | OFActionBsnSetTunnelDstVer11 other = (OFActionBsnSetTunnelDstVer11) obj; |
| 291 | |
| 292 | if( dst != other.dst) |
| 293 | return false; |
| 294 | return true; |
| 295 | } |
| 296 | |
| 297 | @Override |
| 298 | public int hashCode() { |
| 299 | final int prime = 31; |
| 300 | int result = 1; |
| 301 | |
| 302 | result = prime * (int) (dst ^ (dst >>> 32)); |
| 303 | return result; |
| 304 | } |
| 305 | |
| 306 | } |