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.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 OFMatchV2Ver11 implements OFMatchV2 { |
| 34 | private static final Logger logger = LoggerFactory.getLogger(OFMatchV2Ver11.class); |
| 35 | // version: 1.1 |
| 36 | final static byte WIRE_VERSION = 2; |
| 37 | final static int LENGTH = 88; |
| 38 | |
| 39 | private final static OFPort DEFAULT_IN_PORT = OFPort.ANY; |
| 40 | private final static int DEFAULT_WILDCARDS = OFFlowWildcardsSerializerVer11.ALL_VAL; |
| 41 | private final static MacAddress DEFAULT_ETH_SRC = MacAddress.NONE; |
| 42 | private final static MacAddress DEFAULT_ETH_SRC_MASK = MacAddress.NONE; |
| 43 | private final static MacAddress DEFAULT_ETH_DST = MacAddress.NONE; |
| 44 | private final static MacAddress DEFAULT_ETH_DST_MASK = MacAddress.NONE; |
| 45 | private final static int DEFAULT_VLAN_VID = 0x0; |
| 46 | private final static short DEFAULT_VLAN_PCP = (short) 0x0; |
| 47 | private final static int DEFAULT_ETH_TYPE = 0x0; |
| 48 | private final static short DEFAULT_IP_DSCP = (short) 0x0; |
| 49 | private final static short DEFAULT_IP_PROTO = (short) 0x0; |
| 50 | private final static IPv4Address DEFAULT_IPV4_SRC = IPv4Address.NONE; |
| 51 | private final static IPv4Address DEFAULT_IPV4_SRC_MASK = IPv4Address.NONE; |
| 52 | private final static IPv4Address DEFAULT_IPV4_DST = IPv4Address.NONE; |
| 53 | private final static IPv4Address DEFAULT_IPV4_DST_MASK = IPv4Address.NONE; |
| 54 | private final static int DEFAULT_TCP_SRC = 0x0; |
| 55 | private final static int DEFAULT_TCP_DST = 0x0; |
| 56 | private final static long DEFAULT_MPLS_LABEL = 0x0L; |
| 57 | private final static short DEFAULT_MPLS_TC = (short) 0x0; |
| 58 | private final static U64 DEFAULT_METADATA = U64.ZERO; |
| 59 | private final static U64 DEFAULT_METADATA_MASK = U64.ZERO; |
| 60 | |
| 61 | // OF message fields |
| 62 | private final OFPort inPort; |
| 63 | private final int wildcards; |
| 64 | private final MacAddress ethSrc; |
| 65 | private final MacAddress ethSrcMask; |
| 66 | private final MacAddress ethDst; |
| 67 | private final MacAddress ethDstMask; |
| 68 | private final int vlanVid; |
| 69 | private final short vlanPcp; |
| 70 | private final int ethType; |
| 71 | private final short ipDscp; |
| 72 | private final short ipProto; |
| 73 | private final IPv4Address ipv4Src; |
| 74 | private final IPv4Address ipv4SrcMask; |
| 75 | private final IPv4Address ipv4Dst; |
| 76 | private final IPv4Address ipv4DstMask; |
| 77 | private final int tcpSrc; |
| 78 | private final int tcpDst; |
| 79 | private final long mplsLabel; |
| 80 | private final short mplsTc; |
| 81 | private final U64 metadata; |
| 82 | private final U64 metadataMask; |
| 83 | // |
| 84 | // Immutable default instance |
| 85 | final static OFMatchV2Ver11 DEFAULT = new OFMatchV2Ver11( |
| 86 | DEFAULT_IN_PORT, DEFAULT_WILDCARDS, DEFAULT_ETH_SRC, DEFAULT_ETH_SRC_MASK, DEFAULT_ETH_DST, DEFAULT_ETH_DST_MASK, DEFAULT_VLAN_VID, DEFAULT_VLAN_PCP, DEFAULT_ETH_TYPE, DEFAULT_IP_DSCP, DEFAULT_IP_PROTO, DEFAULT_IPV4_SRC, DEFAULT_IPV4_SRC_MASK, DEFAULT_IPV4_DST, DEFAULT_IPV4_DST_MASK, DEFAULT_TCP_SRC, DEFAULT_TCP_DST, DEFAULT_MPLS_LABEL, DEFAULT_MPLS_TC, DEFAULT_METADATA, DEFAULT_METADATA_MASK |
| 87 | ); |
| 88 | |
| 89 | // package private constructor - used by readers, builders, and factory |
| 90 | OFMatchV2Ver11(OFPort inPort, int wildcards, MacAddress ethSrc, MacAddress ethSrcMask, MacAddress ethDst, MacAddress ethDstMask, int vlanVid, short vlanPcp, int ethType, short ipDscp, short ipProto, IPv4Address ipv4Src, IPv4Address ipv4SrcMask, IPv4Address ipv4Dst, IPv4Address ipv4DstMask, int tcpSrc, int tcpDst, long mplsLabel, short mplsTc, U64 metadata, U64 metadataMask) { |
| 91 | this.inPort = inPort; |
| 92 | this.wildcards = wildcards; |
| 93 | this.ethSrc = ethSrc; |
| 94 | this.ethSrcMask = ethSrcMask; |
| 95 | this.ethDst = ethDst; |
| 96 | this.ethDstMask = ethDstMask; |
| 97 | this.vlanVid = vlanVid; |
| 98 | this.vlanPcp = vlanPcp; |
| 99 | this.ethType = ethType; |
| 100 | this.ipDscp = ipDscp; |
| 101 | this.ipProto = ipProto; |
| 102 | this.ipv4Src = ipv4Src; |
| 103 | this.ipv4SrcMask = ipv4SrcMask; |
| 104 | this.ipv4Dst = ipv4Dst; |
| 105 | this.ipv4DstMask = ipv4DstMask; |
| 106 | this.tcpSrc = tcpSrc; |
| 107 | this.tcpDst = tcpDst; |
| 108 | this.mplsLabel = mplsLabel; |
| 109 | this.mplsTc = mplsTc; |
| 110 | this.metadata = metadata; |
| 111 | this.metadataMask = metadataMask; |
| 112 | } |
| 113 | |
| 114 | // Accessors for OF message fields |
| 115 | @Override |
| 116 | public int getType() { |
| 117 | return 0x0; |
| 118 | } |
| 119 | |
| 120 | @Override |
| 121 | public OFPort getInPort() { |
| 122 | return inPort; |
| 123 | } |
| 124 | |
| 125 | @Override |
| 126 | public int getWildcards() { |
| 127 | return wildcards; |
| 128 | } |
| 129 | |
| 130 | @Override |
| 131 | public MacAddress getEthSrc() { |
| 132 | return ethSrc; |
| 133 | } |
| 134 | |
| 135 | @Override |
| 136 | public MacAddress getEthSrcMask() { |
| 137 | return ethSrcMask; |
| 138 | } |
| 139 | |
| 140 | @Override |
| 141 | public MacAddress getEthDst() { |
| 142 | return ethDst; |
| 143 | } |
| 144 | |
| 145 | @Override |
| 146 | public MacAddress getEthDstMask() { |
| 147 | return ethDstMask; |
| 148 | } |
| 149 | |
| 150 | @Override |
| 151 | public int getVlanVid() { |
| 152 | return vlanVid; |
| 153 | } |
| 154 | |
| 155 | @Override |
| 156 | public short getVlanPcp() { |
| 157 | return vlanPcp; |
| 158 | } |
| 159 | |
| 160 | @Override |
| 161 | public int getEthType() { |
| 162 | return ethType; |
| 163 | } |
| 164 | |
| 165 | @Override |
| 166 | public short getIpDscp() { |
| 167 | return ipDscp; |
| 168 | } |
| 169 | |
| 170 | @Override |
| 171 | public short getIpProto() { |
| 172 | return ipProto; |
| 173 | } |
| 174 | |
| 175 | @Override |
| 176 | public IPv4Address getIpv4Src() { |
| 177 | return ipv4Src; |
| 178 | } |
| 179 | |
| 180 | @Override |
| 181 | public IPv4Address getIpv4SrcMask() { |
| 182 | return ipv4SrcMask; |
| 183 | } |
| 184 | |
| 185 | @Override |
| 186 | public IPv4Address getIpv4Dst() { |
| 187 | return ipv4Dst; |
| 188 | } |
| 189 | |
| 190 | @Override |
| 191 | public IPv4Address getIpv4DstMask() { |
| 192 | return ipv4DstMask; |
| 193 | } |
| 194 | |
| 195 | @Override |
| 196 | public int getTcpSrc() { |
| 197 | return tcpSrc; |
| 198 | } |
| 199 | |
| 200 | @Override |
| 201 | public int getTcpDst() { |
| 202 | return tcpDst; |
| 203 | } |
| 204 | |
| 205 | @Override |
| 206 | public long getMplsLabel() { |
| 207 | return mplsLabel; |
| 208 | } |
| 209 | |
| 210 | @Override |
| 211 | public short getMplsTc() { |
| 212 | return mplsTc; |
| 213 | } |
| 214 | |
| 215 | @Override |
| 216 | public U64 getMetadata() { |
| 217 | return metadata; |
| 218 | } |
| 219 | |
| 220 | @Override |
| 221 | public U64 getMetadataMask() { |
| 222 | return metadataMask; |
| 223 | } |
| 224 | |
| 225 | @Override |
| 226 | public OFVersion getVersion() { |
| 227 | return OFVersion.OF_11; |
| 228 | } |
| 229 | |
| 230 | |
| 231 | |
| 232 | @Override |
| 233 | public <F extends OFValueType<F>> F get(MatchField<F> field) |
| 234 | throws UnsupportedOperationException { |
| 235 | // FIXME yotam - please replace with real implementation |
| 236 | return null; |
| 237 | } |
| 238 | |
| 239 | @Override |
| 240 | public <F extends OFValueType<F>> Masked<F> getMasked(MatchField<F> field) |
| 241 | throws UnsupportedOperationException { |
| 242 | // FIXME yotam - please replace with real implementation |
| 243 | return null; |
| 244 | } |
| 245 | |
| 246 | @Override |
| 247 | public boolean supports(MatchField<?> field) { |
| 248 | // FIXME yotam - please replace with real implementation |
| 249 | return false; |
| 250 | } |
| 251 | |
| 252 | @Override |
| 253 | public boolean supportsMasked(MatchField<?> field) { |
| 254 | // FIXME yotam - please replace with real implementation |
| 255 | return false; |
| 256 | } |
| 257 | |
| 258 | @Override |
| 259 | public boolean isExact(MatchField<?> field) { |
| 260 | // FIXME yotam - please replace with real implementation |
| 261 | return false; |
| 262 | } |
| 263 | |
| 264 | @Override |
| 265 | public boolean isFullyWildcarded(MatchField<?> field) { |
| 266 | // FIXME yotam - please replace with real implementation |
| 267 | return false; |
| 268 | } |
| 269 | |
| 270 | @Override |
| 271 | public boolean isPartiallyMasked(MatchField<?> field) { |
| 272 | // FIXME yotam - please replace with real implementation |
| 273 | return false; |
| 274 | } |
| 275 | |
| 276 | @Override |
| 277 | public Iterable<MatchField<?>> getMatchFields() { |
| 278 | throw new UnsupportedOperationException(); |
| 279 | } |
| 280 | |
| 281 | public OFMatchV2.Builder createBuilder() { |
| 282 | return new BuilderWithParent(this); |
| 283 | } |
| 284 | |
| 285 | static class BuilderWithParent implements OFMatchV2.Builder { |
| 286 | final OFMatchV2Ver11 parentMessage; |
| 287 | |
| 288 | // OF message fields |
| 289 | private boolean inPortSet; |
| 290 | private OFPort inPort; |
| 291 | private boolean wildcardsSet; |
| 292 | private int wildcards; |
| 293 | private boolean ethSrcSet; |
| 294 | private MacAddress ethSrc; |
| 295 | private boolean ethSrcMaskSet; |
| 296 | private MacAddress ethSrcMask; |
| 297 | private boolean ethDstSet; |
| 298 | private MacAddress ethDst; |
| 299 | private boolean ethDstMaskSet; |
| 300 | private MacAddress ethDstMask; |
| 301 | private boolean vlanVidSet; |
| 302 | private int vlanVid; |
| 303 | private boolean vlanPcpSet; |
| 304 | private short vlanPcp; |
| 305 | private boolean ethTypeSet; |
| 306 | private int ethType; |
| 307 | private boolean ipDscpSet; |
| 308 | private short ipDscp; |
| 309 | private boolean ipProtoSet; |
| 310 | private short ipProto; |
| 311 | private boolean ipv4SrcSet; |
| 312 | private IPv4Address ipv4Src; |
| 313 | private boolean ipv4SrcMaskSet; |
| 314 | private IPv4Address ipv4SrcMask; |
| 315 | private boolean ipv4DstSet; |
| 316 | private IPv4Address ipv4Dst; |
| 317 | private boolean ipv4DstMaskSet; |
| 318 | private IPv4Address ipv4DstMask; |
| 319 | private boolean tcpSrcSet; |
| 320 | private int tcpSrc; |
| 321 | private boolean tcpDstSet; |
| 322 | private int tcpDst; |
| 323 | private boolean mplsLabelSet; |
| 324 | private long mplsLabel; |
| 325 | private boolean mplsTcSet; |
| 326 | private short mplsTc; |
| 327 | private boolean metadataSet; |
| 328 | private U64 metadata; |
| 329 | private boolean metadataMaskSet; |
| 330 | private U64 metadataMask; |
| 331 | |
| 332 | BuilderWithParent(OFMatchV2Ver11 parentMessage) { |
| 333 | this.parentMessage = parentMessage; |
| 334 | } |
| 335 | |
| 336 | @Override |
| 337 | public int getType() { |
| 338 | return 0x0; |
| 339 | } |
| 340 | |
| 341 | @Override |
| 342 | public OFPort getInPort() { |
| 343 | return inPort; |
| 344 | } |
| 345 | |
| 346 | @Override |
| 347 | public OFMatchV2.Builder setInPort(OFPort inPort) { |
| 348 | this.inPort = inPort; |
| 349 | this.inPortSet = true; |
| 350 | return this; |
| 351 | } |
| 352 | @Override |
| 353 | public int getWildcards() { |
| 354 | return wildcards; |
| 355 | } |
| 356 | |
| 357 | @Override |
| 358 | public OFMatchV2.Builder setWildcards(int wildcards) { |
| 359 | this.wildcards = wildcards; |
| 360 | this.wildcardsSet = true; |
| 361 | return this; |
| 362 | } |
| 363 | @Override |
| 364 | public MacAddress getEthSrc() { |
| 365 | return ethSrc; |
| 366 | } |
| 367 | |
| 368 | @Override |
| 369 | public OFMatchV2.Builder setEthSrc(MacAddress ethSrc) { |
| 370 | this.ethSrc = ethSrc; |
| 371 | this.ethSrcSet = true; |
| 372 | return this; |
| 373 | } |
| 374 | @Override |
| 375 | public MacAddress getEthSrcMask() { |
| 376 | return ethSrcMask; |
| 377 | } |
| 378 | |
| 379 | @Override |
| 380 | public OFMatchV2.Builder setEthSrcMask(MacAddress ethSrcMask) { |
| 381 | this.ethSrcMask = ethSrcMask; |
| 382 | this.ethSrcMaskSet = true; |
| 383 | return this; |
| 384 | } |
| 385 | @Override |
| 386 | public MacAddress getEthDst() { |
| 387 | return ethDst; |
| 388 | } |
| 389 | |
| 390 | @Override |
| 391 | public OFMatchV2.Builder setEthDst(MacAddress ethDst) { |
| 392 | this.ethDst = ethDst; |
| 393 | this.ethDstSet = true; |
| 394 | return this; |
| 395 | } |
| 396 | @Override |
| 397 | public MacAddress getEthDstMask() { |
| 398 | return ethDstMask; |
| 399 | } |
| 400 | |
| 401 | @Override |
| 402 | public OFMatchV2.Builder setEthDstMask(MacAddress ethDstMask) { |
| 403 | this.ethDstMask = ethDstMask; |
| 404 | this.ethDstMaskSet = true; |
| 405 | return this; |
| 406 | } |
| 407 | @Override |
| 408 | public int getVlanVid() { |
| 409 | return vlanVid; |
| 410 | } |
| 411 | |
| 412 | @Override |
| 413 | public OFMatchV2.Builder setVlanVid(int vlanVid) { |
| 414 | this.vlanVid = vlanVid; |
| 415 | this.vlanVidSet = true; |
| 416 | return this; |
| 417 | } |
| 418 | @Override |
| 419 | public short getVlanPcp() { |
| 420 | return vlanPcp; |
| 421 | } |
| 422 | |
| 423 | @Override |
| 424 | public OFMatchV2.Builder setVlanPcp(short vlanPcp) { |
| 425 | this.vlanPcp = vlanPcp; |
| 426 | this.vlanPcpSet = true; |
| 427 | return this; |
| 428 | } |
| 429 | @Override |
| 430 | public int getEthType() { |
| 431 | return ethType; |
| 432 | } |
| 433 | |
| 434 | @Override |
| 435 | public OFMatchV2.Builder setEthType(int ethType) { |
| 436 | this.ethType = ethType; |
| 437 | this.ethTypeSet = true; |
| 438 | return this; |
| 439 | } |
| 440 | @Override |
| 441 | public short getIpDscp() { |
| 442 | return ipDscp; |
| 443 | } |
| 444 | |
| 445 | @Override |
| 446 | public OFMatchV2.Builder setIpDscp(short ipDscp) { |
| 447 | this.ipDscp = ipDscp; |
| 448 | this.ipDscpSet = true; |
| 449 | return this; |
| 450 | } |
| 451 | @Override |
| 452 | public short getIpProto() { |
| 453 | return ipProto; |
| 454 | } |
| 455 | |
| 456 | @Override |
| 457 | public OFMatchV2.Builder setIpProto(short ipProto) { |
| 458 | this.ipProto = ipProto; |
| 459 | this.ipProtoSet = true; |
| 460 | return this; |
| 461 | } |
| 462 | @Override |
| 463 | public IPv4Address getIpv4Src() { |
| 464 | return ipv4Src; |
| 465 | } |
| 466 | |
| 467 | @Override |
| 468 | public OFMatchV2.Builder setIpv4Src(IPv4Address ipv4Src) { |
| 469 | this.ipv4Src = ipv4Src; |
| 470 | this.ipv4SrcSet = true; |
| 471 | return this; |
| 472 | } |
| 473 | @Override |
| 474 | public IPv4Address getIpv4SrcMask() { |
| 475 | return ipv4SrcMask; |
| 476 | } |
| 477 | |
| 478 | @Override |
| 479 | public OFMatchV2.Builder setIpv4SrcMask(IPv4Address ipv4SrcMask) { |
| 480 | this.ipv4SrcMask = ipv4SrcMask; |
| 481 | this.ipv4SrcMaskSet = true; |
| 482 | return this; |
| 483 | } |
| 484 | @Override |
| 485 | public IPv4Address getIpv4Dst() { |
| 486 | return ipv4Dst; |
| 487 | } |
| 488 | |
| 489 | @Override |
| 490 | public OFMatchV2.Builder setIpv4Dst(IPv4Address ipv4Dst) { |
| 491 | this.ipv4Dst = ipv4Dst; |
| 492 | this.ipv4DstSet = true; |
| 493 | return this; |
| 494 | } |
| 495 | @Override |
| 496 | public IPv4Address getIpv4DstMask() { |
| 497 | return ipv4DstMask; |
| 498 | } |
| 499 | |
| 500 | @Override |
| 501 | public OFMatchV2.Builder setIpv4DstMask(IPv4Address ipv4DstMask) { |
| 502 | this.ipv4DstMask = ipv4DstMask; |
| 503 | this.ipv4DstMaskSet = true; |
| 504 | return this; |
| 505 | } |
| 506 | @Override |
| 507 | public int getTcpSrc() { |
| 508 | return tcpSrc; |
| 509 | } |
| 510 | |
| 511 | @Override |
| 512 | public OFMatchV2.Builder setTcpSrc(int tcpSrc) { |
| 513 | this.tcpSrc = tcpSrc; |
| 514 | this.tcpSrcSet = true; |
| 515 | return this; |
| 516 | } |
| 517 | @Override |
| 518 | public int getTcpDst() { |
| 519 | return tcpDst; |
| 520 | } |
| 521 | |
| 522 | @Override |
| 523 | public OFMatchV2.Builder setTcpDst(int tcpDst) { |
| 524 | this.tcpDst = tcpDst; |
| 525 | this.tcpDstSet = true; |
| 526 | return this; |
| 527 | } |
| 528 | @Override |
| 529 | public long getMplsLabel() { |
| 530 | return mplsLabel; |
| 531 | } |
| 532 | |
| 533 | @Override |
| 534 | public OFMatchV2.Builder setMplsLabel(long mplsLabel) { |
| 535 | this.mplsLabel = mplsLabel; |
| 536 | this.mplsLabelSet = true; |
| 537 | return this; |
| 538 | } |
| 539 | @Override |
| 540 | public short getMplsTc() { |
| 541 | return mplsTc; |
| 542 | } |
| 543 | |
| 544 | @Override |
| 545 | public OFMatchV2.Builder setMplsTc(short mplsTc) { |
| 546 | this.mplsTc = mplsTc; |
| 547 | this.mplsTcSet = true; |
| 548 | return this; |
| 549 | } |
| 550 | @Override |
| 551 | public U64 getMetadata() { |
| 552 | return metadata; |
| 553 | } |
| 554 | |
| 555 | @Override |
| 556 | public OFMatchV2.Builder setMetadata(U64 metadata) { |
| 557 | this.metadata = metadata; |
| 558 | this.metadataSet = true; |
| 559 | return this; |
| 560 | } |
| 561 | @Override |
| 562 | public U64 getMetadataMask() { |
| 563 | return metadataMask; |
| 564 | } |
| 565 | |
| 566 | @Override |
| 567 | public OFMatchV2.Builder setMetadataMask(U64 metadataMask) { |
| 568 | this.metadataMask = metadataMask; |
| 569 | this.metadataMaskSet = true; |
| 570 | return this; |
| 571 | } |
| 572 | @Override |
| 573 | public OFVersion getVersion() { |
| 574 | return OFVersion.OF_11; |
| 575 | } |
| 576 | |
| 577 | |
| 578 | |
| 579 | @Override |
| 580 | public OFMatchV2 build() { |
| 581 | OFPort inPort = this.inPortSet ? this.inPort : parentMessage.inPort; |
| 582 | if(inPort == null) |
| 583 | throw new NullPointerException("Property inPort must not be null"); |
| 584 | int wildcards = this.wildcardsSet ? this.wildcards : parentMessage.wildcards; |
| 585 | MacAddress ethSrc = this.ethSrcSet ? this.ethSrc : parentMessage.ethSrc; |
| 586 | if(ethSrc == null) |
| 587 | throw new NullPointerException("Property ethSrc must not be null"); |
| 588 | MacAddress ethSrcMask = this.ethSrcMaskSet ? this.ethSrcMask : parentMessage.ethSrcMask; |
| 589 | if(ethSrcMask == null) |
| 590 | throw new NullPointerException("Property ethSrcMask must not be null"); |
| 591 | MacAddress ethDst = this.ethDstSet ? this.ethDst : parentMessage.ethDst; |
| 592 | if(ethDst == null) |
| 593 | throw new NullPointerException("Property ethDst must not be null"); |
| 594 | MacAddress ethDstMask = this.ethDstMaskSet ? this.ethDstMask : parentMessage.ethDstMask; |
| 595 | if(ethDstMask == null) |
| 596 | throw new NullPointerException("Property ethDstMask must not be null"); |
| 597 | int vlanVid = this.vlanVidSet ? this.vlanVid : parentMessage.vlanVid; |
| 598 | short vlanPcp = this.vlanPcpSet ? this.vlanPcp : parentMessage.vlanPcp; |
| 599 | int ethType = this.ethTypeSet ? this.ethType : parentMessage.ethType; |
| 600 | short ipDscp = this.ipDscpSet ? this.ipDscp : parentMessage.ipDscp; |
| 601 | short ipProto = this.ipProtoSet ? this.ipProto : parentMessage.ipProto; |
| 602 | IPv4Address ipv4Src = this.ipv4SrcSet ? this.ipv4Src : parentMessage.ipv4Src; |
| 603 | if(ipv4Src == null) |
| 604 | throw new NullPointerException("Property ipv4Src must not be null"); |
| 605 | IPv4Address ipv4SrcMask = this.ipv4SrcMaskSet ? this.ipv4SrcMask : parentMessage.ipv4SrcMask; |
| 606 | if(ipv4SrcMask == null) |
| 607 | throw new NullPointerException("Property ipv4SrcMask must not be null"); |
| 608 | IPv4Address ipv4Dst = this.ipv4DstSet ? this.ipv4Dst : parentMessage.ipv4Dst; |
| 609 | if(ipv4Dst == null) |
| 610 | throw new NullPointerException("Property ipv4Dst must not be null"); |
| 611 | IPv4Address ipv4DstMask = this.ipv4DstMaskSet ? this.ipv4DstMask : parentMessage.ipv4DstMask; |
| 612 | if(ipv4DstMask == null) |
| 613 | throw new NullPointerException("Property ipv4DstMask must not be null"); |
| 614 | int tcpSrc = this.tcpSrcSet ? this.tcpSrc : parentMessage.tcpSrc; |
| 615 | int tcpDst = this.tcpDstSet ? this.tcpDst : parentMessage.tcpDst; |
| 616 | long mplsLabel = this.mplsLabelSet ? this.mplsLabel : parentMessage.mplsLabel; |
| 617 | short mplsTc = this.mplsTcSet ? this.mplsTc : parentMessage.mplsTc; |
| 618 | U64 metadata = this.metadataSet ? this.metadata : parentMessage.metadata; |
| 619 | if(metadata == null) |
| 620 | throw new NullPointerException("Property metadata must not be null"); |
| 621 | U64 metadataMask = this.metadataMaskSet ? this.metadataMask : parentMessage.metadataMask; |
| 622 | if(metadataMask == null) |
| 623 | throw new NullPointerException("Property metadataMask must not be null"); |
| 624 | |
| 625 | // |
| 626 | return new OFMatchV2Ver11( |
| 627 | inPort, |
| 628 | wildcards, |
| 629 | ethSrc, |
| 630 | ethSrcMask, |
| 631 | ethDst, |
| 632 | ethDstMask, |
| 633 | vlanVid, |
| 634 | vlanPcp, |
| 635 | ethType, |
| 636 | ipDscp, |
| 637 | ipProto, |
| 638 | ipv4Src, |
| 639 | ipv4SrcMask, |
| 640 | ipv4Dst, |
| 641 | ipv4DstMask, |
| 642 | tcpSrc, |
| 643 | tcpDst, |
| 644 | mplsLabel, |
| 645 | mplsTc, |
| 646 | metadata, |
| 647 | metadataMask |
| 648 | ); |
| 649 | } |
| 650 | |
| 651 | @Override |
| 652 | public <F extends OFValueType<F>> F get(MatchField<F> field) |
| 653 | throws UnsupportedOperationException { |
| 654 | // FIXME yotam - please replace with real implementation |
| 655 | return null; |
| 656 | } |
| 657 | |
| 658 | @Override |
| 659 | public <F extends OFValueType<F>> Masked<F> getMasked(MatchField<F> field) |
| 660 | throws UnsupportedOperationException { |
| 661 | // FIXME yotam - please replace with real implementation |
| 662 | return null; |
| 663 | } |
| 664 | |
| 665 | @Override |
| 666 | public boolean supports(MatchField<?> field) { |
| 667 | // FIXME yotam - please replace with real implementation |
| 668 | return false; |
| 669 | } |
| 670 | |
| 671 | @Override |
| 672 | public boolean supportsMasked(MatchField<?> field) { |
| 673 | // FIXME yotam - please replace with real implementation |
| 674 | return false; |
| 675 | } |
| 676 | |
| 677 | @Override |
| 678 | public boolean isExact(MatchField<?> field) { |
| 679 | // FIXME yotam - please replace with real implementation |
| 680 | return false; |
| 681 | } |
| 682 | |
| 683 | @Override |
| 684 | public boolean isFullyWildcarded(MatchField<?> field) { |
| 685 | // FIXME yotam - please replace with real implementation |
| 686 | return false; |
| 687 | } |
| 688 | |
| 689 | @Override |
| 690 | public boolean isPartiallyMasked(MatchField<?> field) { |
| 691 | // FIXME yotam - please replace with real implementation |
| 692 | return false; |
| 693 | } |
| 694 | |
| 695 | @Override |
| 696 | public <F extends OFValueType<F>> Match.Builder setExact( |
| 697 | MatchField<F> field, F value) { |
| 698 | // FIXME yotam - please replace with real implementation |
| 699 | return null; |
| 700 | } |
| 701 | |
| 702 | @Override |
| 703 | public <F extends OFValueType<F>> Match.Builder setMasked( |
| 704 | MatchField<F> field, F value, F mask) { |
| 705 | // FIXME yotam - please replace with real implementation |
| 706 | return null; |
| 707 | } |
| 708 | |
| 709 | @Override |
| 710 | public <F extends OFValueType<F>> Match.Builder setMasked( |
| 711 | MatchField<F> field, Masked<F> valueWithMask) { |
| 712 | // FIXME yotam - please replace with real implementation |
| 713 | return null; |
| 714 | } |
| 715 | |
| 716 | @Override |
| 717 | public <F extends OFValueType<F>> Match.Builder wildcard(MatchField<F> field) { |
| 718 | // FIXME yotam - please replace with real implementation |
| 719 | return null; |
| 720 | } |
| 721 | |
| 722 | } |
| 723 | |
| 724 | static class Builder implements OFMatchV2.Builder { |
| 725 | // OF message fields |
| 726 | private boolean inPortSet; |
| 727 | private OFPort inPort; |
| 728 | private boolean wildcardsSet; |
| 729 | private int wildcards; |
| 730 | private boolean ethSrcSet; |
| 731 | private MacAddress ethSrc; |
| 732 | private boolean ethSrcMaskSet; |
| 733 | private MacAddress ethSrcMask; |
| 734 | private boolean ethDstSet; |
| 735 | private MacAddress ethDst; |
| 736 | private boolean ethDstMaskSet; |
| 737 | private MacAddress ethDstMask; |
| 738 | private boolean vlanVidSet; |
| 739 | private int vlanVid; |
| 740 | private boolean vlanPcpSet; |
| 741 | private short vlanPcp; |
| 742 | private boolean ethTypeSet; |
| 743 | private int ethType; |
| 744 | private boolean ipDscpSet; |
| 745 | private short ipDscp; |
| 746 | private boolean ipProtoSet; |
| 747 | private short ipProto; |
| 748 | private boolean ipv4SrcSet; |
| 749 | private IPv4Address ipv4Src; |
| 750 | private boolean ipv4SrcMaskSet; |
| 751 | private IPv4Address ipv4SrcMask; |
| 752 | private boolean ipv4DstSet; |
| 753 | private IPv4Address ipv4Dst; |
| 754 | private boolean ipv4DstMaskSet; |
| 755 | private IPv4Address ipv4DstMask; |
| 756 | private boolean tcpSrcSet; |
| 757 | private int tcpSrc; |
| 758 | private boolean tcpDstSet; |
| 759 | private int tcpDst; |
| 760 | private boolean mplsLabelSet; |
| 761 | private long mplsLabel; |
| 762 | private boolean mplsTcSet; |
| 763 | private short mplsTc; |
| 764 | private boolean metadataSet; |
| 765 | private U64 metadata; |
| 766 | private boolean metadataMaskSet; |
| 767 | private U64 metadataMask; |
| 768 | |
| 769 | @Override |
| 770 | public int getType() { |
| 771 | return 0x0; |
| 772 | } |
| 773 | |
| 774 | @Override |
| 775 | public OFPort getInPort() { |
| 776 | return inPort; |
| 777 | } |
| 778 | |
| 779 | @Override |
| 780 | public OFMatchV2.Builder setInPort(OFPort inPort) { |
| 781 | this.inPort = inPort; |
| 782 | this.inPortSet = true; |
| 783 | return this; |
| 784 | } |
| 785 | @Override |
| 786 | public int getWildcards() { |
| 787 | return wildcards; |
| 788 | } |
| 789 | |
| 790 | @Override |
| 791 | public OFMatchV2.Builder setWildcards(int wildcards) { |
| 792 | this.wildcards = wildcards; |
| 793 | this.wildcardsSet = true; |
| 794 | return this; |
| 795 | } |
| 796 | @Override |
| 797 | public MacAddress getEthSrc() { |
| 798 | return ethSrc; |
| 799 | } |
| 800 | |
| 801 | @Override |
| 802 | public OFMatchV2.Builder setEthSrc(MacAddress ethSrc) { |
| 803 | this.ethSrc = ethSrc; |
| 804 | this.ethSrcSet = true; |
| 805 | return this; |
| 806 | } |
| 807 | @Override |
| 808 | public MacAddress getEthSrcMask() { |
| 809 | return ethSrcMask; |
| 810 | } |
| 811 | |
| 812 | @Override |
| 813 | public OFMatchV2.Builder setEthSrcMask(MacAddress ethSrcMask) { |
| 814 | this.ethSrcMask = ethSrcMask; |
| 815 | this.ethSrcMaskSet = true; |
| 816 | return this; |
| 817 | } |
| 818 | @Override |
| 819 | public MacAddress getEthDst() { |
| 820 | return ethDst; |
| 821 | } |
| 822 | |
| 823 | @Override |
| 824 | public OFMatchV2.Builder setEthDst(MacAddress ethDst) { |
| 825 | this.ethDst = ethDst; |
| 826 | this.ethDstSet = true; |
| 827 | return this; |
| 828 | } |
| 829 | @Override |
| 830 | public MacAddress getEthDstMask() { |
| 831 | return ethDstMask; |
| 832 | } |
| 833 | |
| 834 | @Override |
| 835 | public OFMatchV2.Builder setEthDstMask(MacAddress ethDstMask) { |
| 836 | this.ethDstMask = ethDstMask; |
| 837 | this.ethDstMaskSet = true; |
| 838 | return this; |
| 839 | } |
| 840 | @Override |
| 841 | public int getVlanVid() { |
| 842 | return vlanVid; |
| 843 | } |
| 844 | |
| 845 | @Override |
| 846 | public OFMatchV2.Builder setVlanVid(int vlanVid) { |
| 847 | this.vlanVid = vlanVid; |
| 848 | this.vlanVidSet = true; |
| 849 | return this; |
| 850 | } |
| 851 | @Override |
| 852 | public short getVlanPcp() { |
| 853 | return vlanPcp; |
| 854 | } |
| 855 | |
| 856 | @Override |
| 857 | public OFMatchV2.Builder setVlanPcp(short vlanPcp) { |
| 858 | this.vlanPcp = vlanPcp; |
| 859 | this.vlanPcpSet = true; |
| 860 | return this; |
| 861 | } |
| 862 | @Override |
| 863 | public int getEthType() { |
| 864 | return ethType; |
| 865 | } |
| 866 | |
| 867 | @Override |
| 868 | public OFMatchV2.Builder setEthType(int ethType) { |
| 869 | this.ethType = ethType; |
| 870 | this.ethTypeSet = true; |
| 871 | return this; |
| 872 | } |
| 873 | @Override |
| 874 | public short getIpDscp() { |
| 875 | return ipDscp; |
| 876 | } |
| 877 | |
| 878 | @Override |
| 879 | public OFMatchV2.Builder setIpDscp(short ipDscp) { |
| 880 | this.ipDscp = ipDscp; |
| 881 | this.ipDscpSet = true; |
| 882 | return this; |
| 883 | } |
| 884 | @Override |
| 885 | public short getIpProto() { |
| 886 | return ipProto; |
| 887 | } |
| 888 | |
| 889 | @Override |
| 890 | public OFMatchV2.Builder setIpProto(short ipProto) { |
| 891 | this.ipProto = ipProto; |
| 892 | this.ipProtoSet = true; |
| 893 | return this; |
| 894 | } |
| 895 | @Override |
| 896 | public IPv4Address getIpv4Src() { |
| 897 | return ipv4Src; |
| 898 | } |
| 899 | |
| 900 | @Override |
| 901 | public OFMatchV2.Builder setIpv4Src(IPv4Address ipv4Src) { |
| 902 | this.ipv4Src = ipv4Src; |
| 903 | this.ipv4SrcSet = true; |
| 904 | return this; |
| 905 | } |
| 906 | @Override |
| 907 | public IPv4Address getIpv4SrcMask() { |
| 908 | return ipv4SrcMask; |
| 909 | } |
| 910 | |
| 911 | @Override |
| 912 | public OFMatchV2.Builder setIpv4SrcMask(IPv4Address ipv4SrcMask) { |
| 913 | this.ipv4SrcMask = ipv4SrcMask; |
| 914 | this.ipv4SrcMaskSet = true; |
| 915 | return this; |
| 916 | } |
| 917 | @Override |
| 918 | public IPv4Address getIpv4Dst() { |
| 919 | return ipv4Dst; |
| 920 | } |
| 921 | |
| 922 | @Override |
| 923 | public OFMatchV2.Builder setIpv4Dst(IPv4Address ipv4Dst) { |
| 924 | this.ipv4Dst = ipv4Dst; |
| 925 | this.ipv4DstSet = true; |
| 926 | return this; |
| 927 | } |
| 928 | @Override |
| 929 | public IPv4Address getIpv4DstMask() { |
| 930 | return ipv4DstMask; |
| 931 | } |
| 932 | |
| 933 | @Override |
| 934 | public OFMatchV2.Builder setIpv4DstMask(IPv4Address ipv4DstMask) { |
| 935 | this.ipv4DstMask = ipv4DstMask; |
| 936 | this.ipv4DstMaskSet = true; |
| 937 | return this; |
| 938 | } |
| 939 | @Override |
| 940 | public int getTcpSrc() { |
| 941 | return tcpSrc; |
| 942 | } |
| 943 | |
| 944 | @Override |
| 945 | public OFMatchV2.Builder setTcpSrc(int tcpSrc) { |
| 946 | this.tcpSrc = tcpSrc; |
| 947 | this.tcpSrcSet = true; |
| 948 | return this; |
| 949 | } |
| 950 | @Override |
| 951 | public int getTcpDst() { |
| 952 | return tcpDst; |
| 953 | } |
| 954 | |
| 955 | @Override |
| 956 | public OFMatchV2.Builder setTcpDst(int tcpDst) { |
| 957 | this.tcpDst = tcpDst; |
| 958 | this.tcpDstSet = true; |
| 959 | return this; |
| 960 | } |
| 961 | @Override |
| 962 | public long getMplsLabel() { |
| 963 | return mplsLabel; |
| 964 | } |
| 965 | |
| 966 | @Override |
| 967 | public OFMatchV2.Builder setMplsLabel(long mplsLabel) { |
| 968 | this.mplsLabel = mplsLabel; |
| 969 | this.mplsLabelSet = true; |
| 970 | return this; |
| 971 | } |
| 972 | @Override |
| 973 | public short getMplsTc() { |
| 974 | return mplsTc; |
| 975 | } |
| 976 | |
| 977 | @Override |
| 978 | public OFMatchV2.Builder setMplsTc(short mplsTc) { |
| 979 | this.mplsTc = mplsTc; |
| 980 | this.mplsTcSet = true; |
| 981 | return this; |
| 982 | } |
| 983 | @Override |
| 984 | public U64 getMetadata() { |
| 985 | return metadata; |
| 986 | } |
| 987 | |
| 988 | @Override |
| 989 | public OFMatchV2.Builder setMetadata(U64 metadata) { |
| 990 | this.metadata = metadata; |
| 991 | this.metadataSet = true; |
| 992 | return this; |
| 993 | } |
| 994 | @Override |
| 995 | public U64 getMetadataMask() { |
| 996 | return metadataMask; |
| 997 | } |
| 998 | |
| 999 | @Override |
| 1000 | public OFMatchV2.Builder setMetadataMask(U64 metadataMask) { |
| 1001 | this.metadataMask = metadataMask; |
| 1002 | this.metadataMaskSet = true; |
| 1003 | return this; |
| 1004 | } |
| 1005 | @Override |
| 1006 | public OFVersion getVersion() { |
| 1007 | return OFVersion.OF_11; |
| 1008 | } |
| 1009 | |
| 1010 | // |
| 1011 | @Override |
| 1012 | public OFMatchV2 build() { |
| 1013 | OFPort inPort = this.inPortSet ? this.inPort : DEFAULT_IN_PORT; |
| 1014 | if(inPort == null) |
| 1015 | throw new NullPointerException("Property inPort must not be null"); |
| 1016 | int wildcards = this.wildcardsSet ? this.wildcards : DEFAULT_WILDCARDS; |
| 1017 | MacAddress ethSrc = this.ethSrcSet ? this.ethSrc : DEFAULT_ETH_SRC; |
| 1018 | if(ethSrc == null) |
| 1019 | throw new NullPointerException("Property ethSrc must not be null"); |
| 1020 | MacAddress ethSrcMask = this.ethSrcMaskSet ? this.ethSrcMask : DEFAULT_ETH_SRC_MASK; |
| 1021 | if(ethSrcMask == null) |
| 1022 | throw new NullPointerException("Property ethSrcMask must not be null"); |
| 1023 | MacAddress ethDst = this.ethDstSet ? this.ethDst : DEFAULT_ETH_DST; |
| 1024 | if(ethDst == null) |
| 1025 | throw new NullPointerException("Property ethDst must not be null"); |
| 1026 | MacAddress ethDstMask = this.ethDstMaskSet ? this.ethDstMask : DEFAULT_ETH_DST_MASK; |
| 1027 | if(ethDstMask == null) |
| 1028 | throw new NullPointerException("Property ethDstMask must not be null"); |
| 1029 | int vlanVid = this.vlanVidSet ? this.vlanVid : DEFAULT_VLAN_VID; |
| 1030 | short vlanPcp = this.vlanPcpSet ? this.vlanPcp : DEFAULT_VLAN_PCP; |
| 1031 | int ethType = this.ethTypeSet ? this.ethType : DEFAULT_ETH_TYPE; |
| 1032 | short ipDscp = this.ipDscpSet ? this.ipDscp : DEFAULT_IP_DSCP; |
| 1033 | short ipProto = this.ipProtoSet ? this.ipProto : DEFAULT_IP_PROTO; |
| 1034 | IPv4Address ipv4Src = this.ipv4SrcSet ? this.ipv4Src : DEFAULT_IPV4_SRC; |
| 1035 | if(ipv4Src == null) |
| 1036 | throw new NullPointerException("Property ipv4Src must not be null"); |
| 1037 | IPv4Address ipv4SrcMask = this.ipv4SrcMaskSet ? this.ipv4SrcMask : DEFAULT_IPV4_SRC_MASK; |
| 1038 | if(ipv4SrcMask == null) |
| 1039 | throw new NullPointerException("Property ipv4SrcMask must not be null"); |
| 1040 | IPv4Address ipv4Dst = this.ipv4DstSet ? this.ipv4Dst : DEFAULT_IPV4_DST; |
| 1041 | if(ipv4Dst == null) |
| 1042 | throw new NullPointerException("Property ipv4Dst must not be null"); |
| 1043 | IPv4Address ipv4DstMask = this.ipv4DstMaskSet ? this.ipv4DstMask : DEFAULT_IPV4_DST_MASK; |
| 1044 | if(ipv4DstMask == null) |
| 1045 | throw new NullPointerException("Property ipv4DstMask must not be null"); |
| 1046 | int tcpSrc = this.tcpSrcSet ? this.tcpSrc : DEFAULT_TCP_SRC; |
| 1047 | int tcpDst = this.tcpDstSet ? this.tcpDst : DEFAULT_TCP_DST; |
| 1048 | long mplsLabel = this.mplsLabelSet ? this.mplsLabel : DEFAULT_MPLS_LABEL; |
| 1049 | short mplsTc = this.mplsTcSet ? this.mplsTc : DEFAULT_MPLS_TC; |
| 1050 | U64 metadata = this.metadataSet ? this.metadata : DEFAULT_METADATA; |
| 1051 | if(metadata == null) |
| 1052 | throw new NullPointerException("Property metadata must not be null"); |
| 1053 | U64 metadataMask = this.metadataMaskSet ? this.metadataMask : DEFAULT_METADATA_MASK; |
| 1054 | if(metadataMask == null) |
| 1055 | throw new NullPointerException("Property metadataMask must not be null"); |
| 1056 | |
| 1057 | |
| 1058 | return new OFMatchV2Ver11( |
| 1059 | inPort, |
| 1060 | wildcards, |
| 1061 | ethSrc, |
| 1062 | ethSrcMask, |
| 1063 | ethDst, |
| 1064 | ethDstMask, |
| 1065 | vlanVid, |
| 1066 | vlanPcp, |
| 1067 | ethType, |
| 1068 | ipDscp, |
| 1069 | ipProto, |
| 1070 | ipv4Src, |
| 1071 | ipv4SrcMask, |
| 1072 | ipv4Dst, |
| 1073 | ipv4DstMask, |
| 1074 | tcpSrc, |
| 1075 | tcpDst, |
| 1076 | mplsLabel, |
| 1077 | mplsTc, |
| 1078 | metadata, |
| 1079 | metadataMask |
| 1080 | ); |
| 1081 | } |
| 1082 | |
| 1083 | @Override |
| 1084 | public <F extends OFValueType<F>> F get(MatchField<F> field) |
| 1085 | throws UnsupportedOperationException { |
| 1086 | // FIXME yotam - please replace with real implementation |
| 1087 | return null; |
| 1088 | } |
| 1089 | |
| 1090 | @Override |
| 1091 | public <F extends OFValueType<F>> Masked<F> getMasked(MatchField<F> field) |
| 1092 | throws UnsupportedOperationException { |
| 1093 | // FIXME yotam - please replace with real implementation |
| 1094 | return null; |
| 1095 | } |
| 1096 | |
| 1097 | @Override |
| 1098 | public boolean supports(MatchField<?> field) { |
| 1099 | // FIXME yotam - please replace with real implementation |
| 1100 | return false; |
| 1101 | } |
| 1102 | |
| 1103 | @Override |
| 1104 | public boolean supportsMasked(MatchField<?> field) { |
| 1105 | // FIXME yotam - please replace with real implementation |
| 1106 | return false; |
| 1107 | } |
| 1108 | |
| 1109 | @Override |
| 1110 | public boolean isExact(MatchField<?> field) { |
| 1111 | // FIXME yotam - please replace with real implementation |
| 1112 | return false; |
| 1113 | } |
| 1114 | |
| 1115 | @Override |
| 1116 | public boolean isFullyWildcarded(MatchField<?> field) { |
| 1117 | // FIXME yotam - please replace with real implementation |
| 1118 | return false; |
| 1119 | } |
| 1120 | |
| 1121 | @Override |
| 1122 | public boolean isPartiallyMasked(MatchField<?> field) { |
| 1123 | // FIXME yotam - please replace with real implementation |
| 1124 | return false; |
| 1125 | } |
| 1126 | |
| 1127 | @Override |
| 1128 | public <F extends OFValueType<F>> Match.Builder setExact( |
| 1129 | MatchField<F> field, F value) { |
| 1130 | // FIXME yotam - please replace with real implementation |
| 1131 | return null; |
| 1132 | } |
| 1133 | |
| 1134 | @Override |
| 1135 | public <F extends OFValueType<F>> Match.Builder setMasked( |
| 1136 | MatchField<F> field, F value, F mask) { |
| 1137 | // FIXME yotam - please replace with real implementation |
| 1138 | return null; |
| 1139 | } |
| 1140 | |
| 1141 | @Override |
| 1142 | public <F extends OFValueType<F>> Match.Builder setMasked( |
| 1143 | MatchField<F> field, Masked<F> valueWithMask) { |
| 1144 | // FIXME yotam - please replace with real implementation |
| 1145 | return null; |
| 1146 | } |
| 1147 | |
| 1148 | @Override |
| 1149 | public <F extends OFValueType<F>> Match.Builder wildcard(MatchField<F> field) { |
| 1150 | // FIXME yotam - please replace with real implementation |
| 1151 | return null; |
| 1152 | } |
| 1153 | |
| 1154 | } |
| 1155 | |
| 1156 | |
| 1157 | final static Reader READER = new Reader(); |
| 1158 | static class Reader implements OFMessageReader<OFMatchV2> { |
| 1159 | @Override |
| 1160 | public OFMatchV2 readFrom(ChannelBuffer bb) throws OFParseError { |
| 1161 | int start = bb.readerIndex(); |
| 1162 | // fixed value property type == 0x0 |
| 1163 | short type = bb.readShort(); |
| 1164 | if(type != (short) 0x0) |
| 1165 | throw new OFParseError("Wrong type: Expected=0x0(0x0), got="+type); |
| 1166 | int length = U16.f(bb.readShort()); |
| 1167 | if(length != 88) |
| 1168 | throw new OFParseError("Wrong length: Expected=88(88), got="+length); |
| 1169 | if(bb.readableBytes() + (bb.readerIndex() - start) < length) { |
| 1170 | // Buffer does not have all data yet |
| 1171 | bb.readerIndex(start); |
| 1172 | return null; |
| 1173 | } |
| 1174 | if(logger.isTraceEnabled()) |
| 1175 | logger.trace("readFrom - length={}", length); |
| 1176 | OFPort inPort = OFPort.read4Bytes(bb); |
| 1177 | int wildcards = bb.readInt(); |
| 1178 | MacAddress ethSrc = MacAddress.read6Bytes(bb); |
| 1179 | MacAddress ethSrcMask = MacAddress.read6Bytes(bb); |
| 1180 | MacAddress ethDst = MacAddress.read6Bytes(bb); |
| 1181 | MacAddress ethDstMask = MacAddress.read6Bytes(bb); |
| 1182 | int vlanVid = U16.f(bb.readShort()); |
| 1183 | short vlanPcp = U8.f(bb.readByte()); |
| 1184 | // pad: 1 bytes |
| 1185 | bb.skipBytes(1); |
| 1186 | int ethType = U16.f(bb.readShort()); |
| 1187 | short ipDscp = U8.f(bb.readByte()); |
| 1188 | short ipProto = U8.f(bb.readByte()); |
| 1189 | IPv4Address ipv4Src = IPv4Address.read4Bytes(bb); |
| 1190 | IPv4Address ipv4SrcMask = IPv4Address.read4Bytes(bb); |
| 1191 | IPv4Address ipv4Dst = IPv4Address.read4Bytes(bb); |
| 1192 | IPv4Address ipv4DstMask = IPv4Address.read4Bytes(bb); |
| 1193 | int tcpSrc = U16.f(bb.readShort()); |
| 1194 | int tcpDst = U16.f(bb.readShort()); |
| 1195 | long mplsLabel = U32.f(bb.readInt()); |
| 1196 | short mplsTc = U8.f(bb.readByte()); |
| 1197 | // pad: 3 bytes |
| 1198 | bb.skipBytes(3); |
| 1199 | U64 metadata = U64.ofRaw(bb.readLong()); |
| 1200 | U64 metadataMask = U64.ofRaw(bb.readLong()); |
| 1201 | |
| 1202 | OFMatchV2Ver11 matchV2Ver11 = new OFMatchV2Ver11( |
| 1203 | inPort, |
| 1204 | wildcards, |
| 1205 | ethSrc, |
| 1206 | ethSrcMask, |
| 1207 | ethDst, |
| 1208 | ethDstMask, |
| 1209 | vlanVid, |
| 1210 | vlanPcp, |
| 1211 | ethType, |
| 1212 | ipDscp, |
| 1213 | ipProto, |
| 1214 | ipv4Src, |
| 1215 | ipv4SrcMask, |
| 1216 | ipv4Dst, |
| 1217 | ipv4DstMask, |
| 1218 | tcpSrc, |
| 1219 | tcpDst, |
| 1220 | mplsLabel, |
| 1221 | mplsTc, |
| 1222 | metadata, |
| 1223 | metadataMask |
| 1224 | ); |
| 1225 | if(logger.isTraceEnabled()) |
| 1226 | logger.trace("readFrom - read={}", matchV2Ver11); |
| 1227 | return matchV2Ver11; |
| 1228 | } |
| 1229 | } |
| 1230 | |
| 1231 | public void putTo(PrimitiveSink sink) { |
| 1232 | FUNNEL.funnel(this, sink); |
| 1233 | } |
| 1234 | |
| 1235 | final static OFMatchV2Ver11Funnel FUNNEL = new OFMatchV2Ver11Funnel(); |
| 1236 | static class OFMatchV2Ver11Funnel implements Funnel<OFMatchV2Ver11> { |
| 1237 | private static final long serialVersionUID = 1L; |
| 1238 | @Override |
| 1239 | public void funnel(OFMatchV2Ver11 message, PrimitiveSink sink) { |
| 1240 | // fixed value property type = 0x0 |
| 1241 | sink.putShort((short) 0x0); |
| 1242 | // fixed value property length = 88 |
| 1243 | sink.putShort((short) 0x58); |
| 1244 | message.inPort.putTo(sink); |
| 1245 | sink.putInt(message.wildcards); |
| 1246 | message.ethSrc.putTo(sink); |
| 1247 | message.ethSrcMask.putTo(sink); |
| 1248 | message.ethDst.putTo(sink); |
| 1249 | message.ethDstMask.putTo(sink); |
| 1250 | sink.putInt(message.vlanVid); |
| 1251 | sink.putShort(message.vlanPcp); |
| 1252 | // skip pad (1 bytes) |
| 1253 | sink.putInt(message.ethType); |
| 1254 | sink.putShort(message.ipDscp); |
| 1255 | sink.putShort(message.ipProto); |
| 1256 | message.ipv4Src.putTo(sink); |
| 1257 | message.ipv4SrcMask.putTo(sink); |
| 1258 | message.ipv4Dst.putTo(sink); |
| 1259 | message.ipv4DstMask.putTo(sink); |
| 1260 | sink.putInt(message.tcpSrc); |
| 1261 | sink.putInt(message.tcpDst); |
| 1262 | sink.putLong(message.mplsLabel); |
| 1263 | sink.putShort(message.mplsTc); |
| 1264 | // skip pad (3 bytes) |
| 1265 | message.metadata.putTo(sink); |
| 1266 | message.metadataMask.putTo(sink); |
| 1267 | } |
| 1268 | } |
| 1269 | |
| 1270 | |
| 1271 | public void writeTo(ChannelBuffer bb) { |
| 1272 | WRITER.write(bb, this); |
| 1273 | } |
| 1274 | |
| 1275 | final static Writer WRITER = new Writer(); |
| 1276 | static class Writer implements OFMessageWriter<OFMatchV2Ver11> { |
| 1277 | @Override |
| 1278 | public void write(ChannelBuffer bb, OFMatchV2Ver11 message) { |
| 1279 | // fixed value property type = 0x0 |
| 1280 | bb.writeShort((short) 0x0); |
| 1281 | // fixed value property length = 88 |
| 1282 | bb.writeShort((short) 0x58); |
| 1283 | message.inPort.write4Bytes(bb); |
| 1284 | bb.writeInt(message.wildcards); |
| 1285 | message.ethSrc.write6Bytes(bb); |
| 1286 | message.ethSrcMask.write6Bytes(bb); |
| 1287 | message.ethDst.write6Bytes(bb); |
| 1288 | message.ethDstMask.write6Bytes(bb); |
| 1289 | bb.writeShort(U16.t(message.vlanVid)); |
| 1290 | bb.writeByte(U8.t(message.vlanPcp)); |
| 1291 | // pad: 1 bytes |
| 1292 | bb.writeZero(1); |
| 1293 | bb.writeShort(U16.t(message.ethType)); |
| 1294 | bb.writeByte(U8.t(message.ipDscp)); |
| 1295 | bb.writeByte(U8.t(message.ipProto)); |
| 1296 | message.ipv4Src.write4Bytes(bb); |
| 1297 | message.ipv4SrcMask.write4Bytes(bb); |
| 1298 | message.ipv4Dst.write4Bytes(bb); |
| 1299 | message.ipv4DstMask.write4Bytes(bb); |
| 1300 | bb.writeShort(U16.t(message.tcpSrc)); |
| 1301 | bb.writeShort(U16.t(message.tcpDst)); |
| 1302 | bb.writeInt(U32.t(message.mplsLabel)); |
| 1303 | bb.writeByte(U8.t(message.mplsTc)); |
| 1304 | // pad: 3 bytes |
| 1305 | bb.writeZero(3); |
| 1306 | bb.writeLong(message.metadata.getValue()); |
| 1307 | bb.writeLong(message.metadataMask.getValue()); |
| 1308 | |
| 1309 | |
| 1310 | } |
| 1311 | } |
| 1312 | |
| 1313 | @Override |
| 1314 | public String toString() { |
| 1315 | StringBuilder b = new StringBuilder("OFMatchV2Ver11("); |
| 1316 | b.append("inPort=").append(inPort); |
| 1317 | b.append(", "); |
| 1318 | b.append("wildcards=").append(wildcards); |
| 1319 | b.append(", "); |
| 1320 | b.append("ethSrc=").append(ethSrc); |
| 1321 | b.append(", "); |
| 1322 | b.append("ethSrcMask=").append(ethSrcMask); |
| 1323 | b.append(", "); |
| 1324 | b.append("ethDst=").append(ethDst); |
| 1325 | b.append(", "); |
| 1326 | b.append("ethDstMask=").append(ethDstMask); |
| 1327 | b.append(", "); |
| 1328 | b.append("vlanVid=").append(vlanVid); |
| 1329 | b.append(", "); |
| 1330 | b.append("vlanPcp=").append(vlanPcp); |
| 1331 | b.append(", "); |
| 1332 | b.append("ethType=").append(ethType); |
| 1333 | b.append(", "); |
| 1334 | b.append("ipDscp=").append(ipDscp); |
| 1335 | b.append(", "); |
| 1336 | b.append("ipProto=").append(ipProto); |
| 1337 | b.append(", "); |
| 1338 | b.append("ipv4Src=").append(ipv4Src); |
| 1339 | b.append(", "); |
| 1340 | b.append("ipv4SrcMask=").append(ipv4SrcMask); |
| 1341 | b.append(", "); |
| 1342 | b.append("ipv4Dst=").append(ipv4Dst); |
| 1343 | b.append(", "); |
| 1344 | b.append("ipv4DstMask=").append(ipv4DstMask); |
| 1345 | b.append(", "); |
| 1346 | b.append("tcpSrc=").append(tcpSrc); |
| 1347 | b.append(", "); |
| 1348 | b.append("tcpDst=").append(tcpDst); |
| 1349 | b.append(", "); |
| 1350 | b.append("mplsLabel=").append(mplsLabel); |
| 1351 | b.append(", "); |
| 1352 | b.append("mplsTc=").append(mplsTc); |
| 1353 | b.append(", "); |
| 1354 | b.append("metadata=").append(metadata); |
| 1355 | b.append(", "); |
| 1356 | b.append("metadataMask=").append(metadataMask); |
| 1357 | b.append(")"); |
| 1358 | return b.toString(); |
| 1359 | } |
| 1360 | |
| 1361 | @Override |
| 1362 | public boolean equals(Object obj) { |
| 1363 | if (this == obj) |
| 1364 | return true; |
| 1365 | if (obj == null) |
| 1366 | return false; |
| 1367 | if (getClass() != obj.getClass()) |
| 1368 | return false; |
| 1369 | OFMatchV2Ver11 other = (OFMatchV2Ver11) obj; |
| 1370 | |
| 1371 | if (inPort == null) { |
| 1372 | if (other.inPort != null) |
| 1373 | return false; |
| 1374 | } else if (!inPort.equals(other.inPort)) |
| 1375 | return false; |
| 1376 | if( wildcards != other.wildcards) |
| 1377 | return false; |
| 1378 | if (ethSrc == null) { |
| 1379 | if (other.ethSrc != null) |
| 1380 | return false; |
| 1381 | } else if (!ethSrc.equals(other.ethSrc)) |
| 1382 | return false; |
| 1383 | if (ethSrcMask == null) { |
| 1384 | if (other.ethSrcMask != null) |
| 1385 | return false; |
| 1386 | } else if (!ethSrcMask.equals(other.ethSrcMask)) |
| 1387 | return false; |
| 1388 | if (ethDst == null) { |
| 1389 | if (other.ethDst != null) |
| 1390 | return false; |
| 1391 | } else if (!ethDst.equals(other.ethDst)) |
| 1392 | return false; |
| 1393 | if (ethDstMask == null) { |
| 1394 | if (other.ethDstMask != null) |
| 1395 | return false; |
| 1396 | } else if (!ethDstMask.equals(other.ethDstMask)) |
| 1397 | return false; |
| 1398 | if( vlanVid != other.vlanVid) |
| 1399 | return false; |
| 1400 | if( vlanPcp != other.vlanPcp) |
| 1401 | return false; |
| 1402 | if( ethType != other.ethType) |
| 1403 | return false; |
| 1404 | if( ipDscp != other.ipDscp) |
| 1405 | return false; |
| 1406 | if( ipProto != other.ipProto) |
| 1407 | return false; |
| 1408 | if (ipv4Src == null) { |
| 1409 | if (other.ipv4Src != null) |
| 1410 | return false; |
| 1411 | } else if (!ipv4Src.equals(other.ipv4Src)) |
| 1412 | return false; |
| 1413 | if (ipv4SrcMask == null) { |
| 1414 | if (other.ipv4SrcMask != null) |
| 1415 | return false; |
| 1416 | } else if (!ipv4SrcMask.equals(other.ipv4SrcMask)) |
| 1417 | return false; |
| 1418 | if (ipv4Dst == null) { |
| 1419 | if (other.ipv4Dst != null) |
| 1420 | return false; |
| 1421 | } else if (!ipv4Dst.equals(other.ipv4Dst)) |
| 1422 | return false; |
| 1423 | if (ipv4DstMask == null) { |
| 1424 | if (other.ipv4DstMask != null) |
| 1425 | return false; |
| 1426 | } else if (!ipv4DstMask.equals(other.ipv4DstMask)) |
| 1427 | return false; |
| 1428 | if( tcpSrc != other.tcpSrc) |
| 1429 | return false; |
| 1430 | if( tcpDst != other.tcpDst) |
| 1431 | return false; |
| 1432 | if( mplsLabel != other.mplsLabel) |
| 1433 | return false; |
| 1434 | if( mplsTc != other.mplsTc) |
| 1435 | return false; |
| 1436 | if (metadata == null) { |
| 1437 | if (other.metadata != null) |
| 1438 | return false; |
| 1439 | } else if (!metadata.equals(other.metadata)) |
| 1440 | return false; |
| 1441 | if (metadataMask == null) { |
| 1442 | if (other.metadataMask != null) |
| 1443 | return false; |
| 1444 | } else if (!metadataMask.equals(other.metadataMask)) |
| 1445 | return false; |
| 1446 | return true; |
| 1447 | } |
| 1448 | |
| 1449 | @Override |
| 1450 | public int hashCode() { |
| 1451 | final int prime = 31; |
| 1452 | int result = 1; |
| 1453 | |
| 1454 | result = prime * result + ((inPort == null) ? 0 : inPort.hashCode()); |
| 1455 | result = prime * result + wildcards; |
| 1456 | result = prime * result + ((ethSrc == null) ? 0 : ethSrc.hashCode()); |
| 1457 | result = prime * result + ((ethSrcMask == null) ? 0 : ethSrcMask.hashCode()); |
| 1458 | result = prime * result + ((ethDst == null) ? 0 : ethDst.hashCode()); |
| 1459 | result = prime * result + ((ethDstMask == null) ? 0 : ethDstMask.hashCode()); |
| 1460 | result = prime * result + vlanVid; |
| 1461 | result = prime * result + vlanPcp; |
| 1462 | result = prime * result + ethType; |
| 1463 | result = prime * result + ipDscp; |
| 1464 | result = prime * result + ipProto; |
| 1465 | result = prime * result + ((ipv4Src == null) ? 0 : ipv4Src.hashCode()); |
| 1466 | result = prime * result + ((ipv4SrcMask == null) ? 0 : ipv4SrcMask.hashCode()); |
| 1467 | result = prime * result + ((ipv4Dst == null) ? 0 : ipv4Dst.hashCode()); |
| 1468 | result = prime * result + ((ipv4DstMask == null) ? 0 : ipv4DstMask.hashCode()); |
| 1469 | result = prime * result + tcpSrc; |
| 1470 | result = prime * result + tcpDst; |
| 1471 | result = prime * (int) (mplsLabel ^ (mplsLabel >>> 32)); |
| 1472 | result = prime * result + mplsTc; |
| 1473 | result = prime * result + ((metadata == null) ? 0 : metadata.hashCode()); |
| 1474 | result = prime * result + ((metadataMask == null) ? 0 : metadataMask.hashCode()); |
| 1475 | return result; |
| 1476 | } |
| 1477 | |
| 1478 | } |