tom | 0eb04ca | 2014-08-25 14:34:51 -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.ver13; |
| 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 OFOxmBsnVlanXlatePortGroupIdVer13 implements OFOxmBsnVlanXlatePortGroupId { |
| 34 | private static final Logger logger = LoggerFactory.getLogger(OFOxmBsnVlanXlatePortGroupIdVer13.class); |
| 35 | // version: 1.3 |
| 36 | final static byte WIRE_VERSION = 4; |
| 37 | final static int LENGTH = 8; |
| 38 | |
| 39 | private final static ClassId DEFAULT_VALUE = ClassId.NONE; |
| 40 | |
| 41 | // OF message fields |
| 42 | private final ClassId value; |
| 43 | // |
| 44 | // Immutable default instance |
| 45 | final static OFOxmBsnVlanXlatePortGroupIdVer13 DEFAULT = new OFOxmBsnVlanXlatePortGroupIdVer13( |
| 46 | DEFAULT_VALUE |
| 47 | ); |
| 48 | |
| 49 | // package private constructor - used by readers, builders, and factory |
| 50 | OFOxmBsnVlanXlatePortGroupIdVer13(ClassId value) { |
| 51 | this.value = value; |
| 52 | } |
| 53 | |
| 54 | // Accessors for OF message fields |
| 55 | @Override |
| 56 | public long getTypeLen() { |
| 57 | return 0x32204L; |
| 58 | } |
| 59 | |
| 60 | @Override |
| 61 | public ClassId getValue() { |
| 62 | return value; |
| 63 | } |
| 64 | |
| 65 | @Override |
| 66 | public MatchField<ClassId> getMatchField() { |
| 67 | return MatchField.BSN_VLAN_XLATE_PORT_GROUP_ID; |
| 68 | } |
| 69 | |
| 70 | @Override |
| 71 | public boolean isMasked() { |
| 72 | return false; |
| 73 | } |
| 74 | |
| 75 | public OFOxm<ClassId> getCanonical() { |
| 76 | // exact match OXM is always canonical |
| 77 | return this; |
| 78 | } |
| 79 | |
| 80 | @Override |
| 81 | public ClassId getMask()throws UnsupportedOperationException { |
| 82 | throw new UnsupportedOperationException("Property mask not supported in version 1.3"); |
| 83 | } |
| 84 | |
| 85 | @Override |
| 86 | public OFVersion getVersion() { |
| 87 | return OFVersion.OF_13; |
| 88 | } |
| 89 | |
| 90 | |
| 91 | |
| 92 | public OFOxmBsnVlanXlatePortGroupId.Builder createBuilder() { |
| 93 | return new BuilderWithParent(this); |
| 94 | } |
| 95 | |
| 96 | static class BuilderWithParent implements OFOxmBsnVlanXlatePortGroupId.Builder { |
| 97 | final OFOxmBsnVlanXlatePortGroupIdVer13 parentMessage; |
| 98 | |
| 99 | // OF message fields |
| 100 | private boolean valueSet; |
| 101 | private ClassId value; |
| 102 | |
| 103 | BuilderWithParent(OFOxmBsnVlanXlatePortGroupIdVer13 parentMessage) { |
| 104 | this.parentMessage = parentMessage; |
| 105 | } |
| 106 | |
| 107 | @Override |
| 108 | public long getTypeLen() { |
| 109 | return 0x32204L; |
| 110 | } |
| 111 | |
| 112 | @Override |
| 113 | public ClassId getValue() { |
| 114 | return value; |
| 115 | } |
| 116 | |
| 117 | @Override |
| 118 | public OFOxmBsnVlanXlatePortGroupId.Builder setValue(ClassId value) { |
| 119 | this.value = value; |
| 120 | this.valueSet = true; |
| 121 | return this; |
| 122 | } |
| 123 | @Override |
| 124 | public MatchField<ClassId> getMatchField() { |
| 125 | return MatchField.BSN_VLAN_XLATE_PORT_GROUP_ID; |
| 126 | } |
| 127 | |
| 128 | @Override |
| 129 | public boolean isMasked() { |
| 130 | return false; |
| 131 | } |
| 132 | |
| 133 | @Override |
| 134 | public OFOxm<ClassId> getCanonical()throws UnsupportedOperationException { |
| 135 | throw new UnsupportedOperationException("Property canonical not supported in version 1.3"); |
| 136 | } |
| 137 | |
| 138 | @Override |
| 139 | public ClassId getMask()throws UnsupportedOperationException { |
| 140 | throw new UnsupportedOperationException("Property mask not supported in version 1.3"); |
| 141 | } |
| 142 | |
| 143 | @Override |
| 144 | public OFVersion getVersion() { |
| 145 | return OFVersion.OF_13; |
| 146 | } |
| 147 | |
| 148 | |
| 149 | |
| 150 | @Override |
| 151 | public OFOxmBsnVlanXlatePortGroupId build() { |
| 152 | ClassId value = this.valueSet ? this.value : parentMessage.value; |
| 153 | if(value == null) |
| 154 | throw new NullPointerException("Property value must not be null"); |
| 155 | |
| 156 | // |
| 157 | return new OFOxmBsnVlanXlatePortGroupIdVer13( |
| 158 | value |
| 159 | ); |
| 160 | } |
| 161 | |
| 162 | } |
| 163 | |
| 164 | static class Builder implements OFOxmBsnVlanXlatePortGroupId.Builder { |
| 165 | // OF message fields |
| 166 | private boolean valueSet; |
| 167 | private ClassId value; |
| 168 | |
| 169 | @Override |
| 170 | public long getTypeLen() { |
| 171 | return 0x32204L; |
| 172 | } |
| 173 | |
| 174 | @Override |
| 175 | public ClassId getValue() { |
| 176 | return value; |
| 177 | } |
| 178 | |
| 179 | @Override |
| 180 | public OFOxmBsnVlanXlatePortGroupId.Builder setValue(ClassId value) { |
| 181 | this.value = value; |
| 182 | this.valueSet = true; |
| 183 | return this; |
| 184 | } |
| 185 | @Override |
| 186 | public MatchField<ClassId> getMatchField() { |
| 187 | return MatchField.BSN_VLAN_XLATE_PORT_GROUP_ID; |
| 188 | } |
| 189 | |
| 190 | @Override |
| 191 | public boolean isMasked() { |
| 192 | return false; |
| 193 | } |
| 194 | |
| 195 | @Override |
| 196 | public OFOxm<ClassId> getCanonical()throws UnsupportedOperationException { |
| 197 | throw new UnsupportedOperationException("Property canonical not supported in version 1.3"); |
| 198 | } |
| 199 | |
| 200 | @Override |
| 201 | public ClassId getMask()throws UnsupportedOperationException { |
| 202 | throw new UnsupportedOperationException("Property mask not supported in version 1.3"); |
| 203 | } |
| 204 | |
| 205 | @Override |
| 206 | public OFVersion getVersion() { |
| 207 | return OFVersion.OF_13; |
| 208 | } |
| 209 | |
| 210 | // |
| 211 | @Override |
| 212 | public OFOxmBsnVlanXlatePortGroupId build() { |
| 213 | ClassId value = this.valueSet ? this.value : DEFAULT_VALUE; |
| 214 | if(value == null) |
| 215 | throw new NullPointerException("Property value must not be null"); |
| 216 | |
| 217 | |
| 218 | return new OFOxmBsnVlanXlatePortGroupIdVer13( |
| 219 | value |
| 220 | ); |
| 221 | } |
| 222 | |
| 223 | } |
| 224 | |
| 225 | |
| 226 | final static Reader READER = new Reader(); |
| 227 | static class Reader implements OFMessageReader<OFOxmBsnVlanXlatePortGroupId> { |
| 228 | @Override |
| 229 | public OFOxmBsnVlanXlatePortGroupId readFrom(ChannelBuffer bb) throws OFParseError { |
| 230 | // fixed value property typeLen == 0x32204L |
| 231 | int typeLen = bb.readInt(); |
| 232 | if(typeLen != 0x32204) |
| 233 | throw new OFParseError("Wrong typeLen: Expected=0x32204L(0x32204L), got="+typeLen); |
| 234 | ClassId value = ClassId.read4Bytes(bb); |
| 235 | |
| 236 | OFOxmBsnVlanXlatePortGroupIdVer13 oxmBsnVlanXlatePortGroupIdVer13 = new OFOxmBsnVlanXlatePortGroupIdVer13( |
| 237 | value |
| 238 | ); |
| 239 | if(logger.isTraceEnabled()) |
| 240 | logger.trace("readFrom - read={}", oxmBsnVlanXlatePortGroupIdVer13); |
| 241 | return oxmBsnVlanXlatePortGroupIdVer13; |
| 242 | } |
| 243 | } |
| 244 | |
| 245 | public void putTo(PrimitiveSink sink) { |
| 246 | FUNNEL.funnel(this, sink); |
| 247 | } |
| 248 | |
| 249 | final static OFOxmBsnVlanXlatePortGroupIdVer13Funnel FUNNEL = new OFOxmBsnVlanXlatePortGroupIdVer13Funnel(); |
| 250 | static class OFOxmBsnVlanXlatePortGroupIdVer13Funnel implements Funnel<OFOxmBsnVlanXlatePortGroupIdVer13> { |
| 251 | private static final long serialVersionUID = 1L; |
| 252 | @Override |
| 253 | public void funnel(OFOxmBsnVlanXlatePortGroupIdVer13 message, PrimitiveSink sink) { |
| 254 | // fixed value property typeLen = 0x32204L |
| 255 | sink.putInt(0x32204); |
| 256 | message.value.putTo(sink); |
| 257 | } |
| 258 | } |
| 259 | |
| 260 | |
| 261 | public void writeTo(ChannelBuffer bb) { |
| 262 | WRITER.write(bb, this); |
| 263 | } |
| 264 | |
| 265 | final static Writer WRITER = new Writer(); |
| 266 | static class Writer implements OFMessageWriter<OFOxmBsnVlanXlatePortGroupIdVer13> { |
| 267 | @Override |
| 268 | public void write(ChannelBuffer bb, OFOxmBsnVlanXlatePortGroupIdVer13 message) { |
| 269 | // fixed value property typeLen = 0x32204L |
| 270 | bb.writeInt(0x32204); |
| 271 | message.value.write4Bytes(bb); |
| 272 | |
| 273 | |
| 274 | } |
| 275 | } |
| 276 | |
| 277 | @Override |
| 278 | public String toString() { |
| 279 | StringBuilder b = new StringBuilder("OFOxmBsnVlanXlatePortGroupIdVer13("); |
| 280 | b.append("value=").append(value); |
| 281 | b.append(")"); |
| 282 | return b.toString(); |
| 283 | } |
| 284 | |
| 285 | @Override |
| 286 | public boolean equals(Object obj) { |
| 287 | if (this == obj) |
| 288 | return true; |
| 289 | if (obj == null) |
| 290 | return false; |
| 291 | if (getClass() != obj.getClass()) |
| 292 | return false; |
| 293 | OFOxmBsnVlanXlatePortGroupIdVer13 other = (OFOxmBsnVlanXlatePortGroupIdVer13) obj; |
| 294 | |
| 295 | if (value == null) { |
| 296 | if (other.value != null) |
| 297 | return false; |
| 298 | } else if (!value.equals(other.value)) |
| 299 | return false; |
| 300 | return true; |
| 301 | } |
| 302 | |
| 303 | @Override |
| 304 | public int hashCode() { |
| 305 | final int prime = 31; |
| 306 | int result = 1; |
| 307 | |
| 308 | result = prime * result + ((value == null) ? 0 : value.hashCode()); |
| 309 | return result; |
| 310 | } |
| 311 | |
| 312 | } |