Pavlin Radoslavov

Fix toward ONOS-960 - Signed/unsigned value mismatch for OpenFlow-related

match/action conditions

Fixed the signed/unsigned issue for the match conditions

Also:
  * Reordered some of the code in CriterionCodec.java so the order
    of handling various Criterion types follows the order as defined in
    Criterion.java
    - In the process, removed a duplicated entry for Type.MPLS_LABE
    - Fixed an issue with TCP/UDP/SCTP ports being accessed as 8-bit integers
      instead of 16-bit integers

  * Updated some of the unit tests in CriterionCodecTest.java to use
    larger integer values that could expose better potential bugs in
    the tested code.

Change-Id: I531d13bd258ebc559ce6be716863c01613427a98
...@@ -59,7 +59,7 @@ public final class Criteria { ...@@ -59,7 +59,7 @@ public final class Criteria {
59 /** 59 /**
60 * Creates a match on METADATA field using the specified value. 60 * Creates a match on METADATA field using the specified value.
61 * 61 *
62 - * @param metadata metadata value 62 + * @param metadata metadata value (64 bits data)
63 * @return match criterion 63 * @return match criterion
64 */ 64 */
65 public static Criterion matchMetadata(Long metadata) { 65 public static Criterion matchMetadata(Long metadata) {
...@@ -91,10 +91,10 @@ public final class Criteria { ...@@ -91,10 +91,10 @@ public final class Criteria {
91 /** 91 /**
92 * Creates a match on ETH_TYPE field using the specified value. 92 * Creates a match on ETH_TYPE field using the specified value.
93 * 93 *
94 - * @param ethType eth type value 94 + * @param ethType eth type value (16 bits unsigned integer)
95 * @return match criterion 95 * @return match criterion
96 */ 96 */
97 - public static Criterion matchEthType(Short ethType) { 97 + public static Criterion matchEthType(int ethType) {
98 return new EthTypeCriterion(ethType); 98 return new EthTypeCriterion(ethType);
99 } 99 }
100 100
...@@ -111,40 +111,40 @@ public final class Criteria { ...@@ -111,40 +111,40 @@ public final class Criteria {
111 /** 111 /**
112 * Creates a match on VLAN PCP field using the specified value. 112 * Creates a match on VLAN PCP field using the specified value.
113 * 113 *
114 - * @param vlanPcp vlan pcp value 114 + * @param vlanPcp vlan pcp value (3 bits)
115 * @return match criterion 115 * @return match criterion
116 */ 116 */
117 - public static Criterion matchVlanPcp(Byte vlanPcp) { 117 + public static Criterion matchVlanPcp(byte vlanPcp) {
118 return new VlanPcpCriterion(vlanPcp); 118 return new VlanPcpCriterion(vlanPcp);
119 } 119 }
120 120
121 /** 121 /**
122 * Creates a match on IP DSCP field using the specified value. 122 * Creates a match on IP DSCP field using the specified value.
123 * 123 *
124 - * @param ipDscp ip dscp value 124 + * @param ipDscp ip dscp value (6 bits)
125 * @return match criterion 125 * @return match criterion
126 */ 126 */
127 - public static Criterion matchIPDscp(Byte ipDscp) { 127 + public static Criterion matchIPDscp(byte ipDscp) {
128 return new IPDscpCriterion(ipDscp); 128 return new IPDscpCriterion(ipDscp);
129 } 129 }
130 130
131 /** 131 /**
132 * Creates a match on IP ECN field using the specified value. 132 * Creates a match on IP ECN field using the specified value.
133 * 133 *
134 - * @param ipEcn ip ecn value 134 + * @param ipEcn ip ecn value (3 bits)
135 * @return match criterion 135 * @return match criterion
136 */ 136 */
137 - public static Criterion matchIPEcn(Byte ipEcn) { 137 + public static Criterion matchIPEcn(byte ipEcn) {
138 return new IPEcnCriterion(ipEcn); 138 return new IPEcnCriterion(ipEcn);
139 } 139 }
140 140
141 /** 141 /**
142 * Creates a match on IP proto field using the specified value. 142 * Creates a match on IP proto field using the specified value.
143 * 143 *
144 - * @param proto ip protocol value 144 + * @param proto ip protocol value (8 bits unsigned integer)
145 * @return match criterion 145 * @return match criterion
146 */ 146 */
147 - public static Criterion matchIPProtocol(Byte proto) { 147 + public static Criterion matchIPProtocol(short proto) {
148 return new IPProtocolCriterion(proto); 148 return new IPProtocolCriterion(proto);
149 } 149 }
150 150
...@@ -171,50 +171,50 @@ public final class Criteria { ...@@ -171,50 +171,50 @@ public final class Criteria {
171 /** 171 /**
172 * Creates a match on TCP source port field using the specified value. 172 * Creates a match on TCP source port field using the specified value.
173 * 173 *
174 - * @param tcpPort TCP source port 174 + * @param tcpPort TCP source port (16 bits unsigned integer)
175 * @return match criterion 175 * @return match criterion
176 */ 176 */
177 - public static Criterion matchTcpSrc(Short tcpPort) { 177 + public static Criterion matchTcpSrc(int tcpPort) {
178 return new TcpPortCriterion(tcpPort, Type.TCP_SRC); 178 return new TcpPortCriterion(tcpPort, Type.TCP_SRC);
179 } 179 }
180 180
181 /** 181 /**
182 * Creates a match on TCP destination port field using the specified value. 182 * Creates a match on TCP destination port field using the specified value.
183 * 183 *
184 - * @param tcpPort TCP destination port 184 + * @param tcpPort TCP destination port (16 bits unsigned integer)
185 * @return match criterion 185 * @return match criterion
186 */ 186 */
187 - public static Criterion matchTcpDst(Short tcpPort) { 187 + public static Criterion matchTcpDst(int tcpPort) {
188 return new TcpPortCriterion(tcpPort, Type.TCP_DST); 188 return new TcpPortCriterion(tcpPort, Type.TCP_DST);
189 } 189 }
190 190
191 /** 191 /**
192 * Creates a match on UDP source port field using the specified value. 192 * Creates a match on UDP source port field using the specified value.
193 * 193 *
194 - * @param udpPort UDP source port 194 + * @param udpPort UDP source port (16 bits unsigned integer)
195 * @return match criterion 195 * @return match criterion
196 */ 196 */
197 - public static Criterion matchUdpSrc(Short udpPort) { 197 + public static Criterion matchUdpSrc(int udpPort) {
198 return new UdpPortCriterion(udpPort, Type.UDP_SRC); 198 return new UdpPortCriterion(udpPort, Type.UDP_SRC);
199 } 199 }
200 200
201 /** 201 /**
202 * Creates a match on UDP destination port field using the specified value. 202 * Creates a match on UDP destination port field using the specified value.
203 * 203 *
204 - * @param udpPort UDP destination port 204 + * @param udpPort UDP destination port (16 bits unsigned integer)
205 * @return match criterion 205 * @return match criterion
206 */ 206 */
207 - public static Criterion matchUdpDst(Short udpPort) { 207 + public static Criterion matchUdpDst(int udpPort) {
208 return new UdpPortCriterion(udpPort, Type.UDP_DST); 208 return new UdpPortCriterion(udpPort, Type.UDP_DST);
209 } 209 }
210 210
211 /** 211 /**
212 * Creates a match on SCTP source port field using the specified value. 212 * Creates a match on SCTP source port field using the specified value.
213 * 213 *
214 - * @param sctpPort SCTP source port 214 + * @param sctpPort SCTP source port (16 bits unsigned integer)
215 * @return match criterion 215 * @return match criterion
216 */ 216 */
217 - public static Criterion matchSctpSrc(Short sctpPort) { 217 + public static Criterion matchSctpSrc(int sctpPort) {
218 return new SctpPortCriterion(sctpPort, Type.SCTP_SRC); 218 return new SctpPortCriterion(sctpPort, Type.SCTP_SRC);
219 } 219 }
220 220
...@@ -222,30 +222,30 @@ public final class Criteria { ...@@ -222,30 +222,30 @@ public final class Criteria {
222 * Creates a match on SCTP destination port field using the specified 222 * Creates a match on SCTP destination port field using the specified
223 * value. 223 * value.
224 * 224 *
225 - * @param sctpPort SCTP destination port 225 + * @param sctpPort SCTP destination port (16 bits unsigned integer)
226 * @return match criterion 226 * @return match criterion
227 */ 227 */
228 - public static Criterion matchSctpDst(Short sctpPort) { 228 + public static Criterion matchSctpDst(int sctpPort) {
229 return new SctpPortCriterion(sctpPort, Type.SCTP_DST); 229 return new SctpPortCriterion(sctpPort, Type.SCTP_DST);
230 } 230 }
231 231
232 /** 232 /**
233 * Creates a match on ICMP type field using the specified value. 233 * Creates a match on ICMP type field using the specified value.
234 * 234 *
235 - * @param icmpType ICMP type 235 + * @param icmpType ICMP type (8 bits unsigned integer)
236 * @return match criterion 236 * @return match criterion
237 */ 237 */
238 - public static Criterion matchIcmpType(Byte icmpType) { 238 + public static Criterion matchIcmpType(short icmpType) {
239 return new IcmpTypeCriterion(icmpType); 239 return new IcmpTypeCriterion(icmpType);
240 } 240 }
241 241
242 /** 242 /**
243 * Creates a match on ICMP code field using the specified value. 243 * Creates a match on ICMP code field using the specified value.
244 * 244 *
245 - * @param icmpCode ICMP code 245 + * @param icmpCode ICMP code (8 bits unsigned integer)
246 * @return match criterion 246 * @return match criterion
247 */ 247 */
248 - public static Criterion matchIcmpCode(Byte icmpCode) { 248 + public static Criterion matchIcmpCode(short icmpCode) {
249 return new IcmpCodeCriterion(icmpCode); 249 return new IcmpCodeCriterion(icmpCode);
250 } 250 }
251 251
...@@ -272,30 +272,30 @@ public final class Criteria { ...@@ -272,30 +272,30 @@ public final class Criteria {
272 /** 272 /**
273 * Creates a match on IPv6 flow label field using the specified value. 273 * Creates a match on IPv6 flow label field using the specified value.
274 * 274 *
275 - * @param flowLabel IPv6 flow label 275 + * @param flowLabel IPv6 flow label (20 bits)
276 * @return match criterion 276 * @return match criterion
277 */ 277 */
278 - public static Criterion matchIPv6FlowLabel(Integer flowLabel) { 278 + public static Criterion matchIPv6FlowLabel(int flowLabel) {
279 return new IPv6FlowLabelCriterion(flowLabel); 279 return new IPv6FlowLabelCriterion(flowLabel);
280 } 280 }
281 281
282 /** 282 /**
283 * Creates a match on ICMPv6 type field using the specified value. 283 * Creates a match on ICMPv6 type field using the specified value.
284 * 284 *
285 - * @param icmpv6Type ICMPv6 type 285 + * @param icmpv6Type ICMPv6 type (8 bits unsigned integer)
286 * @return match criterion 286 * @return match criterion
287 */ 287 */
288 - public static Criterion matchIcmpv6Type(Byte icmpv6Type) { 288 + public static Criterion matchIcmpv6Type(short icmpv6Type) {
289 return new Icmpv6TypeCriterion(icmpv6Type); 289 return new Icmpv6TypeCriterion(icmpv6Type);
290 } 290 }
291 291
292 /** 292 /**
293 * Creates a match on ICMPv6 code field using the specified value. 293 * Creates a match on ICMPv6 code field using the specified value.
294 * 294 *
295 - * @param icmpv6Code ICMPv6 code 295 + * @param icmpv6Code ICMPv6 code (8 bits unsigned integer)
296 * @return match criterion 296 * @return match criterion
297 */ 297 */
298 - public static Criterion matchIcmpv6Code(Byte icmpv6Code) { 298 + public static Criterion matchIcmpv6Code(short icmpv6Code) {
299 return new Icmpv6CodeCriterion(icmpv6Code); 299 return new Icmpv6CodeCriterion(icmpv6Code);
300 } 300 }
301 301
...@@ -335,7 +335,7 @@ public final class Criteria { ...@@ -335,7 +335,7 @@ public final class Criteria {
335 /** 335 /**
336 * Creates a match on MPLS label. 336 * Creates a match on MPLS label.
337 * 337 *
338 - * @param mplsLabel MPLS label 338 + * @param mplsLabel MPLS label (20 bits)
339 * @return match criterion 339 * @return match criterion
340 */ 340 */
341 public static Criterion matchMplsLabel(Integer mplsLabel) { 341 public static Criterion matchMplsLabel(Integer mplsLabel) {
...@@ -345,20 +345,20 @@ public final class Criteria { ...@@ -345,20 +345,20 @@ public final class Criteria {
345 /** 345 /**
346 * Creates a match on lambda field using the specified value. 346 * Creates a match on lambda field using the specified value.
347 * 347 *
348 - * @param lambda lambda to match on 348 + * @param lambda lambda to match on (16 bits unsigned integer)
349 * @return match criterion 349 * @return match criterion
350 */ 350 */
351 - public static Criterion matchLambda(Short lambda) { 351 + public static Criterion matchLambda(int lambda) {
352 return new LambdaCriterion(lambda, Type.OCH_SIGID); 352 return new LambdaCriterion(lambda, Type.OCH_SIGID);
353 } 353 }
354 354
355 /** 355 /**
356 * Creates a match on optical signal type using the specified value. 356 * Creates a match on optical signal type using the specified value.
357 * 357 *
358 - * @param sigType optical signal type 358 + * @param sigType optical signal type (16 bits unsigned integer)
359 * @return match criterion 359 * @return match criterion
360 */ 360 */
361 - public static Criterion matchOpticalSignalType(Short sigType) { 361 + public static Criterion matchOpticalSignalType(int sigType) {
362 return new OpticalSignalTypeCriterion(sigType, Type.OCH_SIGTYPE); 362 return new OpticalSignalTypeCriterion(sigType, Type.OCH_SIGTYPE);
363 } 363 }
364 364
...@@ -424,14 +424,14 @@ public final class Criteria { ...@@ -424,14 +424,14 @@ public final class Criteria {
424 * Implementation of Metadata criterion. 424 * Implementation of Metadata criterion.
425 */ 425 */
426 public static final class MetadataCriterion implements Criterion { 426 public static final class MetadataCriterion implements Criterion {
427 - private final Long metadata; 427 + private final long metadata;
428 428
429 /** 429 /**
430 * Constructor. 430 * Constructor.
431 * 431 *
432 - * @param metadata the metadata to match 432 + * @param metadata the metadata to match (64 bits data)
433 */ 433 */
434 - public MetadataCriterion(Long metadata) { 434 + public MetadataCriterion(long metadata) {
435 this.metadata = metadata; 435 this.metadata = metadata;
436 } 436 }
437 437
...@@ -443,9 +443,9 @@ public final class Criteria { ...@@ -443,9 +443,9 @@ public final class Criteria {
443 /** 443 /**
444 * Gets the metadata to match. 444 * Gets the metadata to match.
445 * 445 *
446 - * @return the metadata to match 446 + * @return the metadata to match (64 bits data)
447 */ 447 */
448 - public Long metadata() { 448 + public long metadata() {
449 return metadata; 449 return metadata;
450 } 450 }
451 451
...@@ -534,18 +534,20 @@ public final class Criteria { ...@@ -534,18 +534,20 @@ public final class Criteria {
534 } 534 }
535 535
536 /** 536 /**
537 - * Implementation of Ethernet type criterion. 537 + * Implementation of Ethernet type criterion (16 bits unsigned integer).
538 */ 538 */
539 public static final class EthTypeCriterion implements Criterion { 539 public static final class EthTypeCriterion implements Criterion {
540 - private final Short ethType; 540 + private static final int MASK = 0xffff;
541 + private final int ethType; // Ethernet type value: 16 bits
541 542
542 /** 543 /**
543 * Constructor. 544 * Constructor.
544 * 545 *
545 - * @param ethType the Ethernet frame type to match 546 + * @param ethType the Ethernet frame type to match (16 bits unsigned
547 + * integer)
546 */ 548 */
547 - public EthTypeCriterion(Short ethType) { 549 + public EthTypeCriterion(int ethType) {
548 - this.ethType = ethType; 550 + this.ethType = ethType & MASK;
549 } 551 }
550 552
551 @Override 553 @Override
...@@ -556,16 +558,16 @@ public final class Criteria { ...@@ -556,16 +558,16 @@ public final class Criteria {
556 /** 558 /**
557 * Gets the Ethernet frame type to match. 559 * Gets the Ethernet frame type to match.
558 * 560 *
559 - * @return the Ethernet frame type to match 561 + * @return the Ethernet frame type to match (16 bits unsigned integer)
560 */ 562 */
561 - public Short ethType() { 563 + public int ethType() {
562 return ethType; 564 return ethType;
563 } 565 }
564 566
565 @Override 567 @Override
566 public String toString() { 568 public String toString() {
567 return toStringHelper(type().toString()) 569 return toStringHelper(type().toString())
568 - .add("ethType", Long.toHexString(ethType & 0xffff)) 570 + .add("ethType", Long.toHexString(ethType))
569 .toString(); 571 .toString();
570 } 572 }
571 573
...@@ -583,8 +585,6 @@ public final class Criteria { ...@@ -583,8 +585,6 @@ public final class Criteria {
583 EthTypeCriterion that = (EthTypeCriterion) obj; 585 EthTypeCriterion that = (EthTypeCriterion) obj;
584 return Objects.equals(ethType, that.ethType) && 586 return Objects.equals(ethType, that.ethType) &&
585 Objects.equals(this.type(), that.type()); 587 Objects.equals(this.type(), that.type());
586 -
587 -
588 } 588 }
589 return false; 589 return false;
590 } 590 }
...@@ -645,18 +645,19 @@ public final class Criteria { ...@@ -645,18 +645,19 @@ public final class Criteria {
645 } 645 }
646 646
647 /** 647 /**
648 - * Implementation of VLAN priority criterion. 648 + * Implementation of VLAN priority criterion (3 bits).
649 */ 649 */
650 public static final class VlanPcpCriterion implements Criterion { 650 public static final class VlanPcpCriterion implements Criterion {
651 - private final Byte vlanPcp; 651 + private static final byte MASK = 0x7;
652 + private final byte vlanPcp; // VLAN pcp value: 3 bits
652 653
653 /** 654 /**
654 * Constructor. 655 * Constructor.
655 * 656 *
656 - * @param vlanPcp the VLAN priority to match 657 + * @param vlanPcp the VLAN priority to match (3 bits)
657 */ 658 */
658 - public VlanPcpCriterion(Byte vlanPcp) { 659 + public VlanPcpCriterion(byte vlanPcp) {
659 - this.vlanPcp = vlanPcp; 660 + this.vlanPcp = (byte) (vlanPcp & MASK);
660 } 661 }
661 662
662 @Override 663 @Override
...@@ -667,16 +668,16 @@ public final class Criteria { ...@@ -667,16 +668,16 @@ public final class Criteria {
667 /** 668 /**
668 * Gets the VLAN priority to match. 669 * Gets the VLAN priority to match.
669 * 670 *
670 - * @return the VLAN priority to match 671 + * @return the VLAN priority to match (3 bits)
671 */ 672 */
672 - public Byte priority() { 673 + public byte priority() {
673 return vlanPcp; 674 return vlanPcp;
674 } 675 }
675 676
676 @Override 677 @Override
677 public String toString() { 678 public String toString() {
678 return toStringHelper(type().toString()) 679 return toStringHelper(type().toString())
679 - .add("priority", Long.toHexString(vlanPcp)).toString(); 680 + .add("priority", Long.toHexString(vlanPcp)).toString();
680 } 681 }
681 682
682 @Override 683 @Override
...@@ -699,20 +700,20 @@ public final class Criteria { ...@@ -699,20 +700,20 @@ public final class Criteria {
699 } 700 }
700 701
701 /** 702 /**
702 - * Implementation of IP DSCP criterion (6-bit Differentiated Services 703 + * Implementation of IP DSCP (Differentiated Services Code Point)
703 - * Code Point). 704 + * criterion (6 bits).
704 */ 705 */
705 public static final class IPDscpCriterion implements Criterion { 706 public static final class IPDscpCriterion implements Criterion {
706 - private static final byte DSCP_MASK = 0x3f; 707 + private static final byte MASK = 0x3f;
707 - private final Byte ipDscp; // IP DSCP value: 6 bits 708 + private final byte ipDscp; // IP DSCP value: 6 bits
708 709
709 /** 710 /**
710 * Constructor. 711 * Constructor.
711 * 712 *
712 * @param ipDscp the IP DSCP value to match 713 * @param ipDscp the IP DSCP value to match
713 */ 714 */
714 - public IPDscpCriterion(Byte ipDscp) { 715 + public IPDscpCriterion(byte ipDscp) {
715 - this.ipDscp = (byte) (ipDscp & DSCP_MASK); 716 + this.ipDscp = (byte) (ipDscp & MASK);
716 } 717 }
717 718
718 @Override 719 @Override
...@@ -725,14 +726,14 @@ public final class Criteria { ...@@ -725,14 +726,14 @@ public final class Criteria {
725 * 726 *
726 * @return the IP DSCP value to match 727 * @return the IP DSCP value to match
727 */ 728 */
728 - public Byte ipDscp() { 729 + public byte ipDscp() {
729 return ipDscp; 730 return ipDscp;
730 } 731 }
731 732
732 @Override 733 @Override
733 public String toString() { 734 public String toString() {
734 return toStringHelper(type().toString()) 735 return toStringHelper(type().toString())
735 - .add("ipDscp", ipDscp).toString(); 736 + .add("ipDscp", Long.toHexString(ipDscp)).toString();
736 } 737 }
737 738
738 @Override 739 @Override
...@@ -755,20 +756,20 @@ public final class Criteria { ...@@ -755,20 +756,20 @@ public final class Criteria {
755 } 756 }
756 757
757 /** 758 /**
758 - * Implementation of IP ECN criterion (3-bit Explicit Congestion 759 + * Implementation of IP ECN (Explicit Congestion Notification) criterion
759 - * Notification). 760 + * (3 bits).
760 */ 761 */
761 public static final class IPEcnCriterion implements Criterion { 762 public static final class IPEcnCriterion implements Criterion {
762 - private static final byte ECN_MASK = 0x3; 763 + private static final byte MASK = 0x7;
763 - private final Byte ipEcn; // IP ECN value: 3 bits 764 + private final byte ipEcn; // IP ECN value: 3 bits
764 765
765 /** 766 /**
766 * Constructor. 767 * Constructor.
767 * 768 *
768 - * @param ipEcn the IP ECN value to match 769 + * @param ipEcn the IP ECN value to match (3 bits)
769 */ 770 */
770 - public IPEcnCriterion(Byte ipEcn) { 771 + public IPEcnCriterion(byte ipEcn) {
771 - this.ipEcn = (byte) (ipEcn & ECN_MASK); 772 + this.ipEcn = (byte) (ipEcn & MASK);
772 } 773 }
773 774
774 @Override 775 @Override
...@@ -779,16 +780,16 @@ public final class Criteria { ...@@ -779,16 +780,16 @@ public final class Criteria {
779 /** 780 /**
780 * Gets the IP ECN value to match. 781 * Gets the IP ECN value to match.
781 * 782 *
782 - * @return the IP ECN value to match 783 + * @return the IP ECN value to match (3 bits)
783 */ 784 */
784 - public Byte ipEcn() { 785 + public byte ipEcn() {
785 return ipEcn; 786 return ipEcn;
786 } 787 }
787 788
788 @Override 789 @Override
789 public String toString() { 790 public String toString() {
790 return toStringHelper(type().toString()) 791 return toStringHelper(type().toString())
791 - .add("ipEcn", ipEcn).toString(); 792 + .add("ipEcn", Long.toHexString(ipEcn)).toString();
792 } 793 }
793 794
794 @Override 795 @Override
...@@ -811,18 +812,21 @@ public final class Criteria { ...@@ -811,18 +812,21 @@ public final class Criteria {
811 } 812 }
812 813
813 /** 814 /**
814 - * Implementation of Internet Protocol Number criterion. 815 + * Implementation of Internet Protocol Number criterion (8 bits unsigned)
816 + * integer.
815 */ 817 */
816 public static final class IPProtocolCriterion implements Criterion { 818 public static final class IPProtocolCriterion implements Criterion {
817 - private final Byte proto; 819 + private static final short MASK = 0xff;
820 + private final short proto; // IP protocol number: 8 bits
818 821
819 /** 822 /**
820 * Constructor. 823 * Constructor.
821 * 824 *
822 - * @param protocol the IP protocol to match (e.g., TCP=6, UDP=17). 825 + * @param protocol the IP protocol (e.g., TCP=6, UDP=17) to match
826 + * (8 bits unsigned integer)
823 */ 827 */
824 - public IPProtocolCriterion(Byte protocol) { 828 + public IPProtocolCriterion(short protocol) {
825 - this.proto = protocol; 829 + this.proto = (short) (protocol & MASK);
826 } 830 }
827 831
828 @Override 832 @Override
...@@ -833,17 +837,16 @@ public final class Criteria { ...@@ -833,17 +837,16 @@ public final class Criteria {
833 /** 837 /**
834 * Gets the IP protocol to match. 838 * Gets the IP protocol to match.
835 * 839 *
836 - * @return the IP protocol to match 840 + * @return the IP protocol to match (8 bits unsigned integer)
837 */ 841 */
838 - public Byte protocol() { 842 + public short protocol() {
839 return proto; 843 return proto;
840 } 844 }
841 845
842 @Override 846 @Override
843 public String toString() { 847 public String toString() {
844 return toStringHelper(type().toString()) 848 return toStringHelper(type().toString())
845 - .add("protocol", Long.toHexString(proto & 0xff)) 849 + .add("protocol", proto).toString();
846 - .toString();
847 } 850 }
848 851
849 @Override 852 @Override
...@@ -923,21 +926,22 @@ public final class Criteria { ...@@ -923,21 +926,22 @@ public final class Criteria {
923 } 926 }
924 927
925 /** 928 /**
926 - * Implementation of TCP port criterion. 929 + * Implementation of TCP port criterion (16 bits unsigned integer).
927 */ 930 */
928 public static final class TcpPortCriterion implements Criterion { 931 public static final class TcpPortCriterion implements Criterion {
929 - private final Short tcpPort; 932 + private static final int MASK = 0xffff;
933 + private final int tcpPort; // Port value: 16 bits
930 private final Type type; 934 private final Type type;
931 935
932 /** 936 /**
933 * Constructor. 937 * Constructor.
934 * 938 *
935 - * @param tcpPort the TCP port to match 939 + * @param tcpPort the TCP port to match (16 bits unsigned integer)
936 * @param type the match type. Should be either Type.TCP_SRC or 940 * @param type the match type. Should be either Type.TCP_SRC or
937 * Type.TCP_DST 941 * Type.TCP_DST
938 */ 942 */
939 - public TcpPortCriterion(Short tcpPort, Type type) { 943 + public TcpPortCriterion(int tcpPort, Type type) {
940 - this.tcpPort = tcpPort; 944 + this.tcpPort = tcpPort & MASK;
941 this.type = type; 945 this.type = type;
942 } 946 }
943 947
...@@ -949,16 +953,16 @@ public final class Criteria { ...@@ -949,16 +953,16 @@ public final class Criteria {
949 /** 953 /**
950 * Gets the TCP port to match. 954 * Gets the TCP port to match.
951 * 955 *
952 - * @return the TCP port to match 956 + * @return the TCP port to match (16 bits unsigned integer)
953 */ 957 */
954 - public Short tcpPort() { 958 + public int tcpPort() {
955 return this.tcpPort; 959 return this.tcpPort;
956 } 960 }
957 961
958 @Override 962 @Override
959 public String toString() { 963 public String toString() {
960 return toStringHelper(type().toString()) 964 return toStringHelper(type().toString())
961 - .add("tcpPort", tcpPort & 0xffff).toString(); 965 + .add("tcpPort", tcpPort).toString();
962 } 966 }
963 967
964 @Override 968 @Override
...@@ -981,21 +985,22 @@ public final class Criteria { ...@@ -981,21 +985,22 @@ public final class Criteria {
981 } 985 }
982 986
983 /** 987 /**
984 - * Implementation of UDP port criterion. 988 + * Implementation of UDP port criterion (16 bits unsigned integer).
985 */ 989 */
986 public static final class UdpPortCriterion implements Criterion { 990 public static final class UdpPortCriterion implements Criterion {
987 - private final Short udpPort; 991 + private static final int MASK = 0xffff;
992 + private final int udpPort; // Port value: 16 bits
988 private final Type type; 993 private final Type type;
989 994
990 /** 995 /**
991 * Constructor. 996 * Constructor.
992 * 997 *
993 - * @param udpPort the UDP port to match 998 + * @param udpPort the UDP port to match (16 bits unsigned integer)
994 * @param type the match type. Should be either Type.UDP_SRC or 999 * @param type the match type. Should be either Type.UDP_SRC or
995 * Type.UDP_DST 1000 * Type.UDP_DST
996 */ 1001 */
997 - public UdpPortCriterion(Short udpPort, Type type) { 1002 + public UdpPortCriterion(int udpPort, Type type) {
998 - this.udpPort = udpPort; 1003 + this.udpPort = udpPort & MASK;
999 this.type = type; 1004 this.type = type;
1000 } 1005 }
1001 1006
...@@ -1007,16 +1012,16 @@ public final class Criteria { ...@@ -1007,16 +1012,16 @@ public final class Criteria {
1007 /** 1012 /**
1008 * Gets the UDP port to match. 1013 * Gets the UDP port to match.
1009 * 1014 *
1010 - * @return the UDP port to match 1015 + * @return the UDP port to match (16 bits unsigned integer)
1011 */ 1016 */
1012 - public Short udpPort() { 1017 + public int udpPort() {
1013 return this.udpPort; 1018 return this.udpPort;
1014 } 1019 }
1015 1020
1016 @Override 1021 @Override
1017 public String toString() { 1022 public String toString() {
1018 return toStringHelper(type().toString()) 1023 return toStringHelper(type().toString())
1019 - .add("udpPort", udpPort & 0xffff).toString(); 1024 + .add("udpPort", udpPort).toString();
1020 } 1025 }
1021 1026
1022 @Override 1027 @Override
...@@ -1039,21 +1044,22 @@ public final class Criteria { ...@@ -1039,21 +1044,22 @@ public final class Criteria {
1039 } 1044 }
1040 1045
1041 /** 1046 /**
1042 - * Implementation of SCTP port criterion. 1047 + * Implementation of SCTP port criterion (16 bits unsigned integer).
1043 */ 1048 */
1044 public static final class SctpPortCriterion implements Criterion { 1049 public static final class SctpPortCriterion implements Criterion {
1045 - private final Short sctpPort; 1050 + private static final int MASK = 0xffff;
1051 + private final int sctpPort; // Port value: 16 bits
1046 private final Type type; 1052 private final Type type;
1047 1053
1048 /** 1054 /**
1049 * Constructor. 1055 * Constructor.
1050 * 1056 *
1051 - * @param sctpPort the SCTP port to match 1057 + * @param sctpPort the SCTP port to match (16 bits unsigned integer)
1052 * @param type the match type. Should be either Type.SCTP_SRC or 1058 * @param type the match type. Should be either Type.SCTP_SRC or
1053 * Type.SCTP_DST 1059 * Type.SCTP_DST
1054 */ 1060 */
1055 - public SctpPortCriterion(Short sctpPort, Type type) { 1061 + public SctpPortCriterion(int sctpPort, Type type) {
1056 - this.sctpPort = sctpPort; 1062 + this.sctpPort = sctpPort & MASK;
1057 this.type = type; 1063 this.type = type;
1058 } 1064 }
1059 1065
...@@ -1065,16 +1071,16 @@ public final class Criteria { ...@@ -1065,16 +1071,16 @@ public final class Criteria {
1065 /** 1071 /**
1066 * Gets the SCTP port to match. 1072 * Gets the SCTP port to match.
1067 * 1073 *
1068 - * @return the SCTP port to match 1074 + * @return the SCTP port to match (16 bits unsigned integer)
1069 */ 1075 */
1070 - public Short sctpPort() { 1076 + public int sctpPort() {
1071 return this.sctpPort; 1077 return this.sctpPort;
1072 } 1078 }
1073 1079
1074 @Override 1080 @Override
1075 public String toString() { 1081 public String toString() {
1076 return toStringHelper(type().toString()) 1082 return toStringHelper(type().toString())
1077 - .add("sctpPort", sctpPort & 0xffff).toString(); 1083 + .add("sctpPort", sctpPort).toString();
1078 } 1084 }
1079 1085
1080 @Override 1086 @Override
...@@ -1097,18 +1103,19 @@ public final class Criteria { ...@@ -1097,18 +1103,19 @@ public final class Criteria {
1097 } 1103 }
1098 1104
1099 /** 1105 /**
1100 - * Implementation of ICMP type criterion. 1106 + * Implementation of ICMP type criterion (8 bits unsigned integer).
1101 */ 1107 */
1102 public static final class IcmpTypeCriterion implements Criterion { 1108 public static final class IcmpTypeCriterion implements Criterion {
1103 - private final Byte icmpType; 1109 + private static final short MASK = 0xff;
1110 + private final short icmpType; // The ICMP type: 8 bits
1104 1111
1105 /** 1112 /**
1106 * Constructor. 1113 * Constructor.
1107 * 1114 *
1108 - * @param icmpType the ICMP type to match 1115 + * @param icmpType the ICMP type to match (8 bits unsigned integer)
1109 */ 1116 */
1110 - public IcmpTypeCriterion(Byte icmpType) { 1117 + public IcmpTypeCriterion(short icmpType) {
1111 - this.icmpType = icmpType; 1118 + this.icmpType = (short) (icmpType & MASK);
1112 } 1119 }
1113 1120
1114 @Override 1121 @Override
...@@ -1119,16 +1126,16 @@ public final class Criteria { ...@@ -1119,16 +1126,16 @@ public final class Criteria {
1119 /** 1126 /**
1120 * Gets the ICMP type to match. 1127 * Gets the ICMP type to match.
1121 * 1128 *
1122 - * @return the ICMP type to match 1129 + * @return the ICMP type to match (8 bits unsigned integer)
1123 */ 1130 */
1124 - public Byte icmpType() { 1131 + public short icmpType() {
1125 return icmpType; 1132 return icmpType;
1126 } 1133 }
1127 1134
1128 @Override 1135 @Override
1129 public String toString() { 1136 public String toString() {
1130 return toStringHelper(type().toString()) 1137 return toStringHelper(type().toString())
1131 - .add("icmpType", icmpType & 0xff).toString(); 1138 + .add("icmpType", icmpType).toString();
1132 } 1139 }
1133 1140
1134 @Override 1141 @Override
...@@ -1151,18 +1158,19 @@ public final class Criteria { ...@@ -1151,18 +1158,19 @@ public final class Criteria {
1151 } 1158 }
1152 1159
1153 /** 1160 /**
1154 - * Implementation of ICMP code criterion. 1161 + * Implementation of ICMP code criterion (8 bits unsigned integer).
1155 */ 1162 */
1156 public static final class IcmpCodeCriterion implements Criterion { 1163 public static final class IcmpCodeCriterion implements Criterion {
1157 - private final Byte icmpCode; 1164 + private static final short MASK = 0xff;
1165 + private final short icmpCode; // The ICMP code: 8 bits
1158 1166
1159 /** 1167 /**
1160 * Constructor. 1168 * Constructor.
1161 * 1169 *
1162 - * @param icmpCode the ICMP code to match 1170 + * @param icmpCode the ICMP code to match (8 bits unsigned integer)
1163 */ 1171 */
1164 - public IcmpCodeCriterion(Byte icmpCode) { 1172 + public IcmpCodeCriterion(short icmpCode) {
1165 - this.icmpCode = icmpCode; 1173 + this.icmpCode = (short) (icmpCode & MASK);
1166 } 1174 }
1167 1175
1168 @Override 1176 @Override
...@@ -1173,16 +1181,16 @@ public final class Criteria { ...@@ -1173,16 +1181,16 @@ public final class Criteria {
1173 /** 1181 /**
1174 * Gets the ICMP code to match. 1182 * Gets the ICMP code to match.
1175 * 1183 *
1176 - * @return the ICMP code to match 1184 + * @return the ICMP code to match (8 bits unsigned integer)
1177 */ 1185 */
1178 - public Byte icmpCode() { 1186 + public short icmpCode() {
1179 return icmpCode; 1187 return icmpCode;
1180 } 1188 }
1181 1189
1182 @Override 1190 @Override
1183 public String toString() { 1191 public String toString() {
1184 return toStringHelper(type().toString()) 1192 return toStringHelper(type().toString())
1185 - .add("icmpCode", icmpCode & 0xff).toString(); 1193 + .add("icmpCode", icmpCode).toString();
1186 } 1194 }
1187 1195
1188 @Override 1196 @Override
...@@ -1205,19 +1213,20 @@ public final class Criteria { ...@@ -1205,19 +1213,20 @@ public final class Criteria {
1205 } 1213 }
1206 1214
1207 /** 1215 /**
1208 - * Implementation of IPv6 Flow Label criterion (RFC 6437). 1216 + * Implementation of IPv6 Flow Label (RFC 6437) criterion (20 bits unsigned
1217 + * integer).
1209 */ 1218 */
1210 public static final class IPv6FlowLabelCriterion implements Criterion { 1219 public static final class IPv6FlowLabelCriterion implements Criterion {
1211 - private static final int FLOW_LABEL_MASK = 0xfffff; 1220 + private static final int MASK = 0xfffff;
1212 - private final Integer flowLabel; // IPv6 flow label: 20 bits 1221 + private final int flowLabel; // IPv6 flow label: 20 bits
1213 1222
1214 /** 1223 /**
1215 * Constructor. 1224 * Constructor.
1216 * 1225 *
1217 - * @param flowLabel the IPv6 flow label to match 1226 + * @param flowLabel the IPv6 flow label to match (20 bits)
1218 */ 1227 */
1219 - public IPv6FlowLabelCriterion(Integer flowLabel) { 1228 + public IPv6FlowLabelCriterion(int flowLabel) {
1220 - this.flowLabel = flowLabel & FLOW_LABEL_MASK; 1229 + this.flowLabel = flowLabel & MASK;
1221 } 1230 }
1222 1231
1223 @Override 1232 @Override
...@@ -1228,16 +1237,16 @@ public final class Criteria { ...@@ -1228,16 +1237,16 @@ public final class Criteria {
1228 /** 1237 /**
1229 * Gets the IPv6 flow label to match. 1238 * Gets the IPv6 flow label to match.
1230 * 1239 *
1231 - * @return the IPv6 flow label to match 1240 + * @return the IPv6 flow label to match (20 bits)
1232 */ 1241 */
1233 - public Integer flowLabel() { 1242 + public int flowLabel() {
1234 return flowLabel; 1243 return flowLabel;
1235 } 1244 }
1236 1245
1237 @Override 1246 @Override
1238 public String toString() { 1247 public String toString() {
1239 return toStringHelper(type().toString()) 1248 return toStringHelper(type().toString())
1240 - .add("flowLabel", flowLabel).toString(); 1249 + .add("flowLabel", Long.toHexString(flowLabel)).toString();
1241 } 1250 }
1242 1251
1243 @Override 1252 @Override
...@@ -1260,18 +1269,19 @@ public final class Criteria { ...@@ -1260,18 +1269,19 @@ public final class Criteria {
1260 } 1269 }
1261 1270
1262 /** 1271 /**
1263 - * Implementation of ICMPv6 type criterion. 1272 + * Implementation of ICMPv6 type criterion (8 bits unsigned integer).
1264 */ 1273 */
1265 public static final class Icmpv6TypeCriterion implements Criterion { 1274 public static final class Icmpv6TypeCriterion implements Criterion {
1266 - private final Byte icmpv6Type; 1275 + private static final short MASK = 0xff;
1276 + private final short icmpv6Type; // ICMPv6 type: 8 bits
1267 1277
1268 /** 1278 /**
1269 * Constructor. 1279 * Constructor.
1270 * 1280 *
1271 - * @param icmpv6Type the ICMPv6 type to match 1281 + * @param icmpv6Type the ICMPv6 type to match (8 bits unsigned integer)
1272 */ 1282 */
1273 - public Icmpv6TypeCriterion(Byte icmpv6Type) { 1283 + public Icmpv6TypeCriterion(short icmpv6Type) {
1274 - this.icmpv6Type = icmpv6Type; 1284 + this.icmpv6Type = (short) (icmpv6Type & MASK);
1275 } 1285 }
1276 1286
1277 @Override 1287 @Override
...@@ -1282,16 +1292,16 @@ public final class Criteria { ...@@ -1282,16 +1292,16 @@ public final class Criteria {
1282 /** 1292 /**
1283 * Gets the ICMPv6 type to match. 1293 * Gets the ICMPv6 type to match.
1284 * 1294 *
1285 - * @return the ICMPv6 type to match 1295 + * @return the ICMPv6 type to match (8 bits unsigned integer)
1286 */ 1296 */
1287 - public Byte icmpv6Type() { 1297 + public short icmpv6Type() {
1288 return icmpv6Type; 1298 return icmpv6Type;
1289 } 1299 }
1290 1300
1291 @Override 1301 @Override
1292 public String toString() { 1302 public String toString() {
1293 return toStringHelper(type().toString()) 1303 return toStringHelper(type().toString())
1294 - .add("icmpv6Type", icmpv6Type & 0xff).toString(); 1304 + .add("icmpv6Type", icmpv6Type).toString();
1295 } 1305 }
1296 1306
1297 @Override 1307 @Override
...@@ -1314,18 +1324,19 @@ public final class Criteria { ...@@ -1314,18 +1324,19 @@ public final class Criteria {
1314 } 1324 }
1315 1325
1316 /** 1326 /**
1317 - * Implementation of ICMPv6 code criterion. 1327 + * Implementation of ICMPv6 code criterion (8 bits unsigned integer).
1318 */ 1328 */
1319 public static final class Icmpv6CodeCriterion implements Criterion { 1329 public static final class Icmpv6CodeCriterion implements Criterion {
1320 - private final Byte icmpv6Code; 1330 + private static final short MASK = 0xff;
1331 + private final short icmpv6Code; // ICMPv6 code: 8 bits
1321 1332
1322 /** 1333 /**
1323 * Constructor. 1334 * Constructor.
1324 * 1335 *
1325 - * @param icmpv6Code the ICMPv6 code to match 1336 + * @param icmpv6Code the ICMPv6 code to match (8 bits unsigned integer)
1326 */ 1337 */
1327 - public Icmpv6CodeCriterion(Byte icmpv6Code) { 1338 + public Icmpv6CodeCriterion(short icmpv6Code) {
1328 - this.icmpv6Code = icmpv6Code; 1339 + this.icmpv6Code = (short) (icmpv6Code & MASK);
1329 } 1340 }
1330 1341
1331 @Override 1342 @Override
...@@ -1336,16 +1347,16 @@ public final class Criteria { ...@@ -1336,16 +1347,16 @@ public final class Criteria {
1336 /** 1347 /**
1337 * Gets the ICMPv6 code to match. 1348 * Gets the ICMPv6 code to match.
1338 * 1349 *
1339 - * @return the ICMPv6 code to match 1350 + * @return the ICMPv6 code to match (8 bits unsigned integer)
1340 */ 1351 */
1341 - public Byte icmpv6Code() { 1352 + public short icmpv6Code() {
1342 return icmpv6Code; 1353 return icmpv6Code;
1343 } 1354 }
1344 1355
1345 @Override 1356 @Override
1346 public String toString() { 1357 public String toString() {
1347 return toStringHelper(type().toString()) 1358 return toStringHelper(type().toString())
1348 - .add("icmpv6Code", icmpv6Code & 0xff).toString(); 1359 + .add("icmpv6Code", icmpv6Code).toString();
1349 } 1360 }
1350 1361
1351 @Override 1362 @Override
...@@ -1484,18 +1495,19 @@ public final class Criteria { ...@@ -1484,18 +1495,19 @@ public final class Criteria {
1484 } 1495 }
1485 1496
1486 /** 1497 /**
1487 - * Implementation of MPLS tag criterion. 1498 + * Implementation of MPLS tag criterion (20 bits).
1488 */ 1499 */
1489 public static final class MplsCriterion implements Criterion { 1500 public static final class MplsCriterion implements Criterion {
1490 - private final Integer mplsLabel; 1501 + private static final int MASK = 0xfffff;
1502 + private final int mplsLabel; // MPLS label: 20 bits
1491 1503
1492 /** 1504 /**
1493 * Constructor. 1505 * Constructor.
1494 * 1506 *
1495 - * @param mplsLabel the MPLS label to match 1507 + * @param mplsLabel the MPLS label to match (20 bits)
1496 */ 1508 */
1497 - public MplsCriterion(Integer mplsLabel) { 1509 + public MplsCriterion(int mplsLabel) {
1498 - this.mplsLabel = mplsLabel; 1510 + this.mplsLabel = mplsLabel & MASK;
1499 } 1511 }
1500 1512
1501 @Override 1513 @Override
...@@ -1506,16 +1518,16 @@ public final class Criteria { ...@@ -1506,16 +1518,16 @@ public final class Criteria {
1506 /** 1518 /**
1507 * Gets the MPLS label to match. 1519 * Gets the MPLS label to match.
1508 * 1520 *
1509 - * @return the MPLS label to match 1521 + * @return the MPLS label to match (20 bits)
1510 */ 1522 */
1511 - public Integer label() { 1523 + public int label() {
1512 return mplsLabel; 1524 return mplsLabel;
1513 } 1525 }
1514 1526
1515 @Override 1527 @Override
1516 public String toString() { 1528 public String toString() {
1517 return toStringHelper(type().toString()) 1529 return toStringHelper(type().toString())
1518 - .add("label", mplsLabel & 0xffffffffL).toString(); 1530 + .add("label", Long.toHexString(mplsLabel)).toString();
1519 } 1531 }
1520 1532
1521 @Override 1533 @Override
...@@ -1535,24 +1547,26 @@ public final class Criteria { ...@@ -1535,24 +1547,26 @@ public final class Criteria {
1535 } 1547 }
1536 return false; 1548 return false;
1537 } 1549 }
1538 -
1539 } 1550 }
1540 1551
1541 /** 1552 /**
1542 - * Implementation of lambda (wavelength) criterion. 1553 + * Implementation of lambda (wavelength) criterion (16 bits unsigned
1554 + * integer).
1543 */ 1555 */
1544 public static final class LambdaCriterion implements Criterion { 1556 public static final class LambdaCriterion implements Criterion {
1545 - private final short lambda; 1557 + private static final int MASK = 0xffff;
1558 + private final int lambda; // Lambda value: 16 bits
1546 private final Type type; 1559 private final Type type;
1547 1560
1548 /** 1561 /**
1549 * Constructor. 1562 * Constructor.
1550 * 1563 *
1551 - * @param lambda the lambda (wavelength) to match 1564 + * @param lambda the lambda (wavelength) to match (16 bits unsigned
1565 + * integer)
1552 * @param type the match type. Should be Type.OCH_SIGID 1566 * @param type the match type. Should be Type.OCH_SIGID
1553 */ 1567 */
1554 - public LambdaCriterion(short lambda, Type type) { 1568 + public LambdaCriterion(int lambda, Type type) {
1555 - this.lambda = lambda; 1569 + this.lambda = lambda & MASK;
1556 this.type = type; 1570 this.type = type;
1557 } 1571 }
1558 1572
...@@ -1564,16 +1578,16 @@ public final class Criteria { ...@@ -1564,16 +1578,16 @@ public final class Criteria {
1564 /** 1578 /**
1565 * Gets the lambda (wavelength) to match. 1579 * Gets the lambda (wavelength) to match.
1566 * 1580 *
1567 - * @return the lambda (wavelength) to match. 1581 + * @return the lambda (wavelength) to match (16 bits unsigned integer)
1568 */ 1582 */
1569 - public Short lambda() { 1583 + public int lambda() {
1570 - return this.lambda; 1584 + return lambda;
1571 } 1585 }
1572 1586
1573 @Override 1587 @Override
1574 public String toString() { 1588 public String toString() {
1575 return toStringHelper(type().toString()) 1589 return toStringHelper(type().toString())
1576 - .add("lambda", lambda & 0xffff).toString(); 1590 + .add("lambda", lambda).toString();
1577 } 1591 }
1578 1592
1579 @Override 1593 @Override
...@@ -1596,20 +1610,23 @@ public final class Criteria { ...@@ -1596,20 +1610,23 @@ public final class Criteria {
1596 } 1610 }
1597 1611
1598 /** 1612 /**
1599 - * Implementation of optical signal type criterion. 1613 + * Implementation of optical signal type criterion (16 bits unsigned
1614 + * integer).
1600 */ 1615 */
1601 public static final class OpticalSignalTypeCriterion implements Criterion { 1616 public static final class OpticalSignalTypeCriterion implements Criterion {
1602 - private final Short signalType; 1617 + private static final int MASK = 0xffff;
1618 + private final int signalType; // Signal type value: 16 bits
1603 private final Type type; 1619 private final Type type;
1604 1620
1605 /** 1621 /**
1606 * Constructor. 1622 * Constructor.
1607 * 1623 *
1608 - * @param signalType the optical signal type to match 1624 + * @param signalType the optical signal type to match (16 bits unsigned
1625 + * integer)
1609 * @param type the match type. Should be Type.OCH_SIGTYPE 1626 * @param type the match type. Should be Type.OCH_SIGTYPE
1610 */ 1627 */
1611 - public OpticalSignalTypeCriterion(Short signalType, Type type) { 1628 + public OpticalSignalTypeCriterion(int signalType, Type type) {
1612 - this.signalType = signalType; 1629 + this.signalType = signalType & MASK;
1613 this.type = type; 1630 this.type = type;
1614 } 1631 }
1615 1632
...@@ -1623,14 +1640,14 @@ public final class Criteria { ...@@ -1623,14 +1640,14 @@ public final class Criteria {
1623 * 1640 *
1624 * @return the optical signal type to match 1641 * @return the optical signal type to match
1625 */ 1642 */
1626 - public Short signalType() { 1643 + public int signalType() {
1627 - return this.signalType; 1644 + return signalType;
1628 } 1645 }
1629 1646
1630 @Override 1647 @Override
1631 public String toString() { 1648 public String toString() {
1632 return toStringHelper(type().toString()) 1649 return toStringHelper(type().toString())
1633 - .add("signalType", signalType & 0xffff).toString(); 1650 + .add("signalType", signalType).toString();
1634 } 1651 }
1635 1652
1636 @Override 1653 @Override
......
...@@ -63,8 +63,8 @@ public class CriteriaTest { ...@@ -63,8 +63,8 @@ public class CriteriaTest {
63 Criterion sameAsMatchEth1 = Criteria.matchEthSrc(mac1); 63 Criterion sameAsMatchEth1 = Criteria.matchEthSrc(mac1);
64 Criterion matchEth2 = Criteria.matchEthDst(mac2); 64 Criterion matchEth2 = Criteria.matchEthDst(mac2);
65 65
66 - short ethType1 = 1; 66 + int ethType1 = 1;
67 - short ethType2 = 2; 67 + int ethType2 = 2;
68 Criterion matchEthType1 = Criteria.matchEthType(ethType1); 68 Criterion matchEthType1 = Criteria.matchEthType(ethType1);
69 Criterion sameAsMatchEthType1 = Criteria.matchEthType(ethType1); 69 Criterion sameAsMatchEthType1 = Criteria.matchEthType(ethType1);
70 Criterion matchEthType2 = Criteria.matchEthType(ethType2); 70 Criterion matchEthType2 = Criteria.matchEthType(ethType2);
...@@ -95,8 +95,8 @@ public class CriteriaTest { ...@@ -95,8 +95,8 @@ public class CriteriaTest {
95 Criterion sameAsMatchIpEcn1 = Criteria.matchIPEcn(ipEcn1); 95 Criterion sameAsMatchIpEcn1 = Criteria.matchIPEcn(ipEcn1);
96 Criterion matchIpEcn2 = Criteria.matchIPEcn(ipEcn2); 96 Criterion matchIpEcn2 = Criteria.matchIPEcn(ipEcn2);
97 97
98 - byte protocol1 = 1; 98 + short protocol1 = 1;
99 - byte protocol2 = 2; 99 + short protocol2 = 2;
100 Criterion matchIpProtocol1 = Criteria.matchIPProtocol(protocol1); 100 Criterion matchIpProtocol1 = Criteria.matchIPProtocol(protocol1);
101 Criterion sameAsMatchIpProtocol1 = Criteria.matchIPProtocol(protocol1); 101 Criterion sameAsMatchIpProtocol1 = Criteria.matchIPProtocol(protocol1);
102 Criterion matchIpProtocol2 = Criteria.matchIPProtocol(protocol2); 102 Criterion matchIpProtocol2 = Criteria.matchIPProtocol(protocol2);
...@@ -116,26 +116,26 @@ public class CriteriaTest { ...@@ -116,26 +116,26 @@ public class CriteriaTest {
116 Criterion sameAsMatchIpv61 = Criteria.matchIPSrc(ipv61); 116 Criterion sameAsMatchIpv61 = Criteria.matchIPSrc(ipv61);
117 Criterion matchIpv62 = Criteria.matchIPSrc(ipv62); 117 Criterion matchIpv62 = Criteria.matchIPSrc(ipv62);
118 118
119 - Criterion matchTcpPort1 = Criteria.matchTcpSrc((short) 1); 119 + Criterion matchTcpPort1 = Criteria.matchTcpSrc(1);
120 - Criterion sameAsMatchTcpPort1 = Criteria.matchTcpSrc((short) 1); 120 + Criterion sameAsMatchTcpPort1 = Criteria.matchTcpSrc(1);
121 - Criterion matchTcpPort2 = Criteria.matchTcpDst((short) 2); 121 + Criterion matchTcpPort2 = Criteria.matchTcpDst(2);
122 122
123 - Criterion matchUdpPort1 = Criteria.matchUdpSrc((short) 1); 123 + Criterion matchUdpPort1 = Criteria.matchUdpSrc(1);
124 - Criterion sameAsMatchUdpPort1 = Criteria.matchUdpSrc((short) 1); 124 + Criterion sameAsMatchUdpPort1 = Criteria.matchUdpSrc(1);
125 - Criterion matchUdpPort2 = Criteria.matchUdpDst((short) 2); 125 + Criterion matchUdpPort2 = Criteria.matchUdpDst(2);
126 126
127 - Criterion matchSctpPort1 = Criteria.matchSctpSrc((short) 1); 127 + Criterion matchSctpPort1 = Criteria.matchSctpSrc(1);
128 - Criterion sameAsMatchSctpPort1 = Criteria.matchSctpSrc((short) 1); 128 + Criterion sameAsMatchSctpPort1 = Criteria.matchSctpSrc(1);
129 - Criterion matchSctpPort2 = Criteria.matchSctpDst((short) 2); 129 + Criterion matchSctpPort2 = Criteria.matchSctpDst(2);
130 130
131 - byte icmpType1 = 1; 131 + short icmpType1 = 1;
132 - byte icmpType2 = 2; 132 + short icmpType2 = 2;
133 Criterion matchIcmpType1 = Criteria.matchIcmpType(icmpType1); 133 Criterion matchIcmpType1 = Criteria.matchIcmpType(icmpType1);
134 Criterion sameAsMatchIcmpType1 = Criteria.matchIcmpType(icmpType1); 134 Criterion sameAsMatchIcmpType1 = Criteria.matchIcmpType(icmpType1);
135 Criterion matchIcmpType2 = Criteria.matchIcmpType(icmpType2); 135 Criterion matchIcmpType2 = Criteria.matchIcmpType(icmpType2);
136 136
137 - byte icmpCode1 = 1; 137 + short icmpCode1 = 1;
138 - byte icmpCode2 = 2; 138 + short icmpCode2 = 2;
139 Criterion matchIcmpCode1 = Criteria.matchIcmpCode(icmpCode1); 139 Criterion matchIcmpCode1 = Criteria.matchIcmpCode(icmpCode1);
140 Criterion sameAsMatchIcmpCode1 = Criteria.matchIcmpCode(icmpCode1); 140 Criterion sameAsMatchIcmpCode1 = Criteria.matchIcmpCode(icmpCode1);
141 Criterion matchIcmpCode2 = Criteria.matchIcmpCode(icmpCode2); 141 Criterion matchIcmpCode2 = Criteria.matchIcmpCode(icmpCode2);
...@@ -146,14 +146,14 @@ public class CriteriaTest { ...@@ -146,14 +146,14 @@ public class CriteriaTest {
146 Criterion sameAsMatchFlowLabel1 = Criteria.matchIPv6FlowLabel(flowLabel1); 146 Criterion sameAsMatchFlowLabel1 = Criteria.matchIPv6FlowLabel(flowLabel1);
147 Criterion matchFlowLabel2 = Criteria.matchIPv6FlowLabel(flowLabel2); 147 Criterion matchFlowLabel2 = Criteria.matchIPv6FlowLabel(flowLabel2);
148 148
149 - byte icmpv6Type1 = 1; 149 + short icmpv6Type1 = 1;
150 - byte icmpv6Type2 = 2; 150 + short icmpv6Type2 = 2;
151 Criterion matchIcmpv6Type1 = Criteria.matchIcmpv6Type(icmpv6Type1); 151 Criterion matchIcmpv6Type1 = Criteria.matchIcmpv6Type(icmpv6Type1);
152 Criterion sameAsMatchIcmpv6Type1 = Criteria.matchIcmpv6Type(icmpv6Type1); 152 Criterion sameAsMatchIcmpv6Type1 = Criteria.matchIcmpv6Type(icmpv6Type1);
153 Criterion matchIcmpv6Type2 = Criteria.matchIcmpv6Type(icmpv6Type2); 153 Criterion matchIcmpv6Type2 = Criteria.matchIcmpv6Type(icmpv6Type2);
154 154
155 - byte icmpv6Code1 = 1; 155 + short icmpv6Code1 = 1;
156 - byte icmpv6Code2 = 2; 156 + short icmpv6Code2 = 2;
157 Criterion matchIcmpv6Code1 = Criteria.matchIcmpv6Code(icmpv6Code1); 157 Criterion matchIcmpv6Code1 = Criteria.matchIcmpv6Code(icmpv6Code1);
158 Criterion sameAsMatchIcmpv6Code1 = Criteria.matchIcmpv6Code(icmpv6Code1); 158 Criterion sameAsMatchIcmpv6Code1 = Criteria.matchIcmpv6Code(icmpv6Code1);
159 Criterion matchIcmpv6Code2 = Criteria.matchIcmpv6Code(icmpv6Code2); 159 Criterion matchIcmpv6Code2 = Criteria.matchIcmpv6Code(icmpv6Code2);
...@@ -192,14 +192,14 @@ public class CriteriaTest { ...@@ -192,14 +192,14 @@ public class CriteriaTest {
192 Criterion sameAsMatchMpls1 = Criteria.matchMplsLabel(mpls1); 192 Criterion sameAsMatchMpls1 = Criteria.matchMplsLabel(mpls1);
193 Criterion matchMpls2 = Criteria.matchMplsLabel(mpls2); 193 Criterion matchMpls2 = Criteria.matchMplsLabel(mpls2);
194 194
195 - short lambda1 = 1; 195 + int lambda1 = 1;
196 - short lambda2 = 2; 196 + int lambda2 = 2;
197 Criterion matchLambda1 = Criteria.matchLambda(lambda1); 197 Criterion matchLambda1 = Criteria.matchLambda(lambda1);
198 Criterion sameAsMatchLambda1 = Criteria.matchLambda(lambda1); 198 Criterion sameAsMatchLambda1 = Criteria.matchLambda(lambda1);
199 Criterion matchLambda2 = Criteria.matchLambda(lambda2); 199 Criterion matchLambda2 = Criteria.matchLambda(lambda2);
200 200
201 - short signalLambda1 = 1; 201 + int signalLambda1 = 1;
202 - short signalLambda2 = 2; 202 + int signalLambda2 = 2;
203 Criterion matchSignalLambda1 = Criteria.matchOpticalSignalType(signalLambda1); 203 Criterion matchSignalLambda1 = Criteria.matchOpticalSignalType(signalLambda1);
204 Criterion sameAsMatchSignalLambda1 = Criteria.matchOpticalSignalType(signalLambda1); 204 Criterion sameAsMatchSignalLambda1 = Criteria.matchOpticalSignalType(signalLambda1);
205 Criterion matchSignalLambda2 = Criteria.matchOpticalSignalType(signalLambda2); 205 Criterion matchSignalLambda2 = Criteria.matchOpticalSignalType(signalLambda2);
...@@ -379,7 +379,7 @@ public class CriteriaTest { ...@@ -379,7 +379,7 @@ public class CriteriaTest {
379 */ 379 */
380 @Test 380 @Test
381 public void testMatchEthTypeMethod() { 381 public void testMatchEthTypeMethod() {
382 - Short ethType = 12; 382 + int ethType = 12;
383 Criterion matchEthType = Criteria.matchEthType(ethType); 383 Criterion matchEthType = Criteria.matchEthType(ethType);
384 Criteria.EthTypeCriterion ethTypeCriterion = 384 Criteria.EthTypeCriterion ethTypeCriterion =
385 checkAndConvert(matchEthType, 385 checkAndConvert(matchEthType,
...@@ -606,12 +606,12 @@ public class CriteriaTest { ...@@ -606,12 +606,12 @@ public class CriteriaTest {
606 */ 606 */
607 @Test 607 @Test
608 public void testMatchTcpSrcMethod() { 608 public void testMatchTcpSrcMethod() {
609 - Criterion matchTcpSrc = Criteria.matchTcpSrc((short) 1); 609 + Criterion matchTcpSrc = Criteria.matchTcpSrc(1);
610 Criteria.TcpPortCriterion tcpPortCriterion = 610 Criteria.TcpPortCriterion tcpPortCriterion =
611 checkAndConvert(matchTcpSrc, 611 checkAndConvert(matchTcpSrc,
612 Criterion.Type.TCP_SRC, 612 Criterion.Type.TCP_SRC,
613 Criteria.TcpPortCriterion.class); 613 Criteria.TcpPortCriterion.class);
614 - assertThat(tcpPortCriterion.tcpPort(), is(equalTo((short) 1))); 614 + assertThat(tcpPortCriterion.tcpPort(), is(equalTo(1)));
615 } 615 }
616 616
617 /** 617 /**
...@@ -619,12 +619,12 @@ public class CriteriaTest { ...@@ -619,12 +619,12 @@ public class CriteriaTest {
619 */ 619 */
620 @Test 620 @Test
621 public void testMatchTcpDstMethod() { 621 public void testMatchTcpDstMethod() {
622 - Criterion matchTcpDst = Criteria.matchTcpDst((short) 1); 622 + Criterion matchTcpDst = Criteria.matchTcpDst(1);
623 Criteria.TcpPortCriterion tcpPortCriterion = 623 Criteria.TcpPortCriterion tcpPortCriterion =
624 checkAndConvert(matchTcpDst, 624 checkAndConvert(matchTcpDst,
625 Criterion.Type.TCP_DST, 625 Criterion.Type.TCP_DST,
626 Criteria.TcpPortCriterion.class); 626 Criteria.TcpPortCriterion.class);
627 - assertThat(tcpPortCriterion.tcpPort(), is(equalTo((short) 1))); 627 + assertThat(tcpPortCriterion.tcpPort(), is(equalTo(1)));
628 } 628 }
629 629
630 /** 630 /**
...@@ -645,12 +645,12 @@ public class CriteriaTest { ...@@ -645,12 +645,12 @@ public class CriteriaTest {
645 */ 645 */
646 @Test 646 @Test
647 public void testMatchUdpSrcMethod() { 647 public void testMatchUdpSrcMethod() {
648 - Criterion matchUdpSrc = Criteria.matchUdpSrc((short) 1); 648 + Criterion matchUdpSrc = Criteria.matchUdpSrc(1);
649 Criteria.UdpPortCriterion udpPortCriterion = 649 Criteria.UdpPortCriterion udpPortCriterion =
650 checkAndConvert(matchUdpSrc, 650 checkAndConvert(matchUdpSrc,
651 Criterion.Type.UDP_SRC, 651 Criterion.Type.UDP_SRC,
652 Criteria.UdpPortCriterion.class); 652 Criteria.UdpPortCriterion.class);
653 - assertThat(udpPortCriterion.udpPort(), is(equalTo((short) 1))); 653 + assertThat(udpPortCriterion.udpPort(), is(equalTo(1)));
654 } 654 }
655 655
656 /** 656 /**
...@@ -658,12 +658,12 @@ public class CriteriaTest { ...@@ -658,12 +658,12 @@ public class CriteriaTest {
658 */ 658 */
659 @Test 659 @Test
660 public void testMatchUdpDstMethod() { 660 public void testMatchUdpDstMethod() {
661 - Criterion matchUdpDst = Criteria.matchUdpDst((short) 1); 661 + Criterion matchUdpDst = Criteria.matchUdpDst(1);
662 Criteria.UdpPortCriterion udpPortCriterion = 662 Criteria.UdpPortCriterion udpPortCriterion =
663 checkAndConvert(matchUdpDst, 663 checkAndConvert(matchUdpDst,
664 Criterion.Type.UDP_DST, 664 Criterion.Type.UDP_DST,
665 Criteria.UdpPortCriterion.class); 665 Criteria.UdpPortCriterion.class);
666 - assertThat(udpPortCriterion.udpPort(), is(equalTo((short) 1))); 666 + assertThat(udpPortCriterion.udpPort(), is(equalTo(1)));
667 } 667 }
668 668
669 /** 669 /**
...@@ -684,12 +684,12 @@ public class CriteriaTest { ...@@ -684,12 +684,12 @@ public class CriteriaTest {
684 */ 684 */
685 @Test 685 @Test
686 public void testMatchSctpSrcMethod() { 686 public void testMatchSctpSrcMethod() {
687 - Criterion matchSctpSrc = Criteria.matchSctpSrc((short) 1); 687 + Criterion matchSctpSrc = Criteria.matchSctpSrc(1);
688 Criteria.SctpPortCriterion sctpPortCriterion = 688 Criteria.SctpPortCriterion sctpPortCriterion =
689 checkAndConvert(matchSctpSrc, 689 checkAndConvert(matchSctpSrc,
690 Criterion.Type.SCTP_SRC, 690 Criterion.Type.SCTP_SRC,
691 Criteria.SctpPortCriterion.class); 691 Criteria.SctpPortCriterion.class);
692 - assertThat(sctpPortCriterion.sctpPort(), is(equalTo((short) 1))); 692 + assertThat(sctpPortCriterion.sctpPort(), is(equalTo(1)));
693 } 693 }
694 694
695 /** 695 /**
...@@ -697,12 +697,12 @@ public class CriteriaTest { ...@@ -697,12 +697,12 @@ public class CriteriaTest {
697 */ 697 */
698 @Test 698 @Test
699 public void testMatchSctpDstMethod() { 699 public void testMatchSctpDstMethod() {
700 - Criterion matchSctpDst = Criteria.matchSctpDst((short) 1); 700 + Criterion matchSctpDst = Criteria.matchSctpDst(1);
701 Criteria.SctpPortCriterion sctpPortCriterion = 701 Criteria.SctpPortCriterion sctpPortCriterion =
702 checkAndConvert(matchSctpDst, 702 checkAndConvert(matchSctpDst,
703 Criterion.Type.SCTP_DST, 703 Criterion.Type.SCTP_DST,
704 Criteria.SctpPortCriterion.class); 704 Criteria.SctpPortCriterion.class);
705 - assertThat(sctpPortCriterion.sctpPort(), is(equalTo((short) 1))); 705 + assertThat(sctpPortCriterion.sctpPort(), is(equalTo(1)));
706 } 706 }
707 707
708 /** 708 /**
...@@ -723,7 +723,7 @@ public class CriteriaTest { ...@@ -723,7 +723,7 @@ public class CriteriaTest {
723 */ 723 */
724 @Test 724 @Test
725 public void testMatchIcmpTypeMethod() { 725 public void testMatchIcmpTypeMethod() {
726 - Byte icmpType = 12; 726 + short icmpType = 12;
727 Criterion matchIcmpType = Criteria.matchIcmpType(icmpType); 727 Criterion matchIcmpType = Criteria.matchIcmpType(icmpType);
728 Criteria.IcmpTypeCriterion icmpTypeCriterion = 728 Criteria.IcmpTypeCriterion icmpTypeCriterion =
729 checkAndConvert(matchIcmpType, 729 checkAndConvert(matchIcmpType,
...@@ -750,7 +750,7 @@ public class CriteriaTest { ...@@ -750,7 +750,7 @@ public class CriteriaTest {
750 */ 750 */
751 @Test 751 @Test
752 public void testMatchIcmpCodeMethod() { 752 public void testMatchIcmpCodeMethod() {
753 - Byte icmpCode = 12; 753 + short icmpCode = 12;
754 Criterion matchIcmpCode = Criteria.matchIcmpCode(icmpCode); 754 Criterion matchIcmpCode = Criteria.matchIcmpCode(icmpCode);
755 Criteria.IcmpCodeCriterion icmpCodeCriterion = 755 Criteria.IcmpCodeCriterion icmpCodeCriterion =
756 checkAndConvert(matchIcmpCode, 756 checkAndConvert(matchIcmpCode,
...@@ -777,7 +777,7 @@ public class CriteriaTest { ...@@ -777,7 +777,7 @@ public class CriteriaTest {
777 */ 777 */
778 @Test 778 @Test
779 public void testMatchIPv6FlowLabelMethod() { 779 public void testMatchIPv6FlowLabelMethod() {
780 - Integer flowLabel = 12; 780 + int flowLabel = 12;
781 Criterion matchFlowLabel = Criteria.matchIPv6FlowLabel(flowLabel); 781 Criterion matchFlowLabel = Criteria.matchIPv6FlowLabel(flowLabel);
782 Criteria.IPv6FlowLabelCriterion flowLabelCriterion = 782 Criteria.IPv6FlowLabelCriterion flowLabelCriterion =
783 checkAndConvert(matchFlowLabel, 783 checkAndConvert(matchFlowLabel,
...@@ -804,7 +804,7 @@ public class CriteriaTest { ...@@ -804,7 +804,7 @@ public class CriteriaTest {
804 */ 804 */
805 @Test 805 @Test
806 public void testMatchIcmpv6TypeMethod() { 806 public void testMatchIcmpv6TypeMethod() {
807 - Byte icmpv6Type = 12; 807 + short icmpv6Type = 12;
808 Criterion matchIcmpv6Type = Criteria.matchIcmpv6Type(icmpv6Type); 808 Criterion matchIcmpv6Type = Criteria.matchIcmpv6Type(icmpv6Type);
809 Criteria.Icmpv6TypeCriterion icmpv6TypeCriterion = 809 Criteria.Icmpv6TypeCriterion icmpv6TypeCriterion =
810 checkAndConvert(matchIcmpv6Type, 810 checkAndConvert(matchIcmpv6Type,
...@@ -831,7 +831,7 @@ public class CriteriaTest { ...@@ -831,7 +831,7 @@ public class CriteriaTest {
831 */ 831 */
832 @Test 832 @Test
833 public void testMatchIcmpv6CodeMethod() { 833 public void testMatchIcmpv6CodeMethod() {
834 - Byte icmpv6Code = 12; 834 + short icmpv6Code = 12;
835 Criterion matchIcmpv6Code = Criteria.matchIcmpv6Code(icmpv6Code); 835 Criterion matchIcmpv6Code = Criteria.matchIcmpv6Code(icmpv6Code);
836 Criteria.Icmpv6CodeCriterion icmpv6CodeCriterion = 836 Criteria.Icmpv6CodeCriterion icmpv6CodeCriterion =
837 checkAndConvert(matchIcmpv6Code, 837 checkAndConvert(matchIcmpv6Code,
......
...@@ -333,12 +333,12 @@ public abstract class FlowModBuilder { ...@@ -333,12 +333,12 @@ public abstract class FlowModBuilder {
333 case ICMPV6_TYPE: 333 case ICMPV6_TYPE:
334 Icmpv6TypeCriterion icmpv6Type = (Icmpv6TypeCriterion) c; 334 Icmpv6TypeCriterion icmpv6Type = (Icmpv6TypeCriterion) c;
335 mBuilder.setExact(MatchField.ICMPV6_TYPE, 335 mBuilder.setExact(MatchField.ICMPV6_TYPE,
336 - U8.of(icmpv6Type.icmpv6Type().byteValue())); 336 + U8.of(icmpv6Type.icmpv6Type()));
337 break; 337 break;
338 case ICMPV6_CODE: 338 case ICMPV6_CODE:
339 Icmpv6CodeCriterion icmpv6Code = (Icmpv6CodeCriterion) c; 339 Icmpv6CodeCriterion icmpv6Code = (Icmpv6CodeCriterion) c;
340 mBuilder.setExact(MatchField.ICMPV6_CODE, 340 mBuilder.setExact(MatchField.ICMPV6_CODE,
341 - U8.of(icmpv6Code.icmpv6Code().byteValue())); 341 + U8.of(icmpv6Code.icmpv6Code()));
342 break; 342 break;
343 case IPV6_ND_TARGET: 343 case IPV6_ND_TARGET:
344 IPv6NDTargetAddressCriterion targetAddressCriterion = 344 IPv6NDTargetAddressCriterion targetAddressCriterion =
...@@ -361,19 +361,19 @@ public abstract class FlowModBuilder { ...@@ -361,19 +361,19 @@ public abstract class FlowModBuilder {
361 break; 361 break;
362 case MPLS_LABEL: 362 case MPLS_LABEL:
363 Criteria.MplsCriterion mp = (Criteria.MplsCriterion) c; 363 Criteria.MplsCriterion mp = (Criteria.MplsCriterion) c;
364 - mBuilder.setExact(MatchField.MPLS_LABEL, 364 + mBuilder.setExact(MatchField.MPLS_LABEL, U32.of(mp.label()));
365 - U32.of(mp.label().intValue()));
366 break; 365 break;
367 case OCH_SIGID: 366 case OCH_SIGID:
368 LambdaCriterion lc = (LambdaCriterion) c; 367 LambdaCriterion lc = (LambdaCriterion) c;
369 mBuilder.setExact(MatchField.OCH_SIGID, 368 mBuilder.setExact(MatchField.OCH_SIGID,
370 - new CircuitSignalID((byte) 1, (byte) 2, lc.lambda(), (short) 1)); 369 + new CircuitSignalID((byte) 1, (byte) 2,
370 + (short) lc.lambda(), (short) 1));
371 break; 371 break;
372 case OCH_SIGTYPE: 372 case OCH_SIGTYPE:
373 Criteria.OpticalSignalTypeCriterion sc = 373 Criteria.OpticalSignalTypeCriterion sc =
374 (Criteria.OpticalSignalTypeCriterion) c; 374 (Criteria.OpticalSignalTypeCriterion) c;
375 mBuilder.setExact(MatchField.OCH_SIGTYPE, 375 mBuilder.setExact(MatchField.OCH_SIGTYPE,
376 - U8.of(sc.signalType())); 376 + U8.of((short) sc.signalType()));
377 break; 377 break;
378 case ARP_OP: 378 case ARP_OP:
379 case ARP_SHA: 379 case ARP_SHA:
......
...@@ -43,19 +43,17 @@ public final class CriterionCodec extends JsonCodec<Criterion> { ...@@ -43,19 +43,17 @@ public final class CriterionCodec extends JsonCodec<Criterion> {
43 43
44 formatMap.put(Criterion.Type.IN_PORT, new FormatInPort()); 44 formatMap.put(Criterion.Type.IN_PORT, new FormatInPort());
45 formatMap.put(Criterion.Type.IN_PHY_PORT, new FormatInPort()); 45 formatMap.put(Criterion.Type.IN_PHY_PORT, new FormatInPort());
46 + formatMap.put(Criterion.Type.METADATA, new FormatMetadata());
46 formatMap.put(Criterion.Type.ETH_DST, new FormatEth()); 47 formatMap.put(Criterion.Type.ETH_DST, new FormatEth());
47 formatMap.put(Criterion.Type.ETH_SRC, new FormatEth()); 48 formatMap.put(Criterion.Type.ETH_SRC, new FormatEth());
48 - formatMap.put(Criterion.Type.IP_PROTO, new FormatIpProto());
49 formatMap.put(Criterion.Type.ETH_TYPE, new FormatEthType()); 49 formatMap.put(Criterion.Type.ETH_TYPE, new FormatEthType());
50 - formatMap.put(Criterion.Type.METADATA, new FormatMetadata());
51 formatMap.put(Criterion.Type.VLAN_VID, new FormatVlanVid()); 50 formatMap.put(Criterion.Type.VLAN_VID, new FormatVlanVid());
52 formatMap.put(Criterion.Type.VLAN_PCP, new FormatVlanPcp()); 51 formatMap.put(Criterion.Type.VLAN_PCP, new FormatVlanPcp());
53 formatMap.put(Criterion.Type.IP_DSCP, new FormatIpDscp()); 52 formatMap.put(Criterion.Type.IP_DSCP, new FormatIpDscp());
54 formatMap.put(Criterion.Type.IP_ECN, new FormatIpEcn()); 53 formatMap.put(Criterion.Type.IP_ECN, new FormatIpEcn());
54 + formatMap.put(Criterion.Type.IP_PROTO, new FormatIpProto());
55 formatMap.put(Criterion.Type.IPV4_SRC, new FormatIp()); 55 formatMap.put(Criterion.Type.IPV4_SRC, new FormatIp());
56 formatMap.put(Criterion.Type.IPV4_DST, new FormatIp()); 56 formatMap.put(Criterion.Type.IPV4_DST, new FormatIp());
57 - formatMap.put(Criterion.Type.IPV6_SRC, new FormatIp());
58 - formatMap.put(Criterion.Type.IPV6_DST, new FormatIp());
59 formatMap.put(Criterion.Type.TCP_SRC, new FormatTcp()); 57 formatMap.put(Criterion.Type.TCP_SRC, new FormatTcp());
60 formatMap.put(Criterion.Type.TCP_DST, new FormatTcp()); 58 formatMap.put(Criterion.Type.TCP_DST, new FormatTcp());
61 formatMap.put(Criterion.Type.UDP_SRC, new FormatUdp()); 59 formatMap.put(Criterion.Type.UDP_SRC, new FormatUdp());
...@@ -64,6 +62,8 @@ public final class CriterionCodec extends JsonCodec<Criterion> { ...@@ -64,6 +62,8 @@ public final class CriterionCodec extends JsonCodec<Criterion> {
64 formatMap.put(Criterion.Type.SCTP_DST, new FormatSctp()); 62 formatMap.put(Criterion.Type.SCTP_DST, new FormatSctp());
65 formatMap.put(Criterion.Type.ICMPV4_TYPE, new FormatIcmpV4Type()); 63 formatMap.put(Criterion.Type.ICMPV4_TYPE, new FormatIcmpV4Type());
66 formatMap.put(Criterion.Type.ICMPV4_CODE, new FormatIcmpV4Code()); 64 formatMap.put(Criterion.Type.ICMPV4_CODE, new FormatIcmpV4Code());
65 + formatMap.put(Criterion.Type.IPV6_SRC, new FormatIp());
66 + formatMap.put(Criterion.Type.IPV6_DST, new FormatIp());
67 formatMap.put(Criterion.Type.IPV6_FLABEL, new FormatIpV6FLabel()); 67 formatMap.put(Criterion.Type.IPV6_FLABEL, new FormatIpV6FLabel());
68 formatMap.put(Criterion.Type.ICMPV6_TYPE, new FormatIcmpV6Type()); 68 formatMap.put(Criterion.Type.ICMPV6_TYPE, new FormatIcmpV6Type());
69 formatMap.put(Criterion.Type.ICMPV6_CODE, new FormatIcmpV6Code()); 69 formatMap.put(Criterion.Type.ICMPV6_CODE, new FormatIcmpV6Code());
...@@ -73,21 +73,20 @@ public final class CriterionCodec extends JsonCodec<Criterion> { ...@@ -73,21 +73,20 @@ public final class CriterionCodec extends JsonCodec<Criterion> {
73 formatMap.put(Criterion.Type.MPLS_LABEL, new FormatMplsLabel()); 73 formatMap.put(Criterion.Type.MPLS_LABEL, new FormatMplsLabel());
74 formatMap.put(Criterion.Type.OCH_SIGID, new FormatOchSigId()); 74 formatMap.put(Criterion.Type.OCH_SIGID, new FormatOchSigId());
75 formatMap.put(Criterion.Type.OCH_SIGTYPE, new FormatOchSigType()); 75 formatMap.put(Criterion.Type.OCH_SIGTYPE, new FormatOchSigType());
76 - formatMap.put(Criterion.Type.MPLS_LABEL, new FormatMplsLabel());
77 76
78 // Currently unimplemented 77 // Currently unimplemented
79 formatMap.put(Criterion.Type.ARP_OP, new FormatUnknown()); 78 formatMap.put(Criterion.Type.ARP_OP, new FormatUnknown());
80 - formatMap.put(Criterion.Type.ARP_SHA, new FormatUnknown());
81 formatMap.put(Criterion.Type.ARP_SPA, new FormatUnknown()); 79 formatMap.put(Criterion.Type.ARP_SPA, new FormatUnknown());
82 - formatMap.put(Criterion.Type.ARP_THA, new FormatUnknown());
83 formatMap.put(Criterion.Type.ARP_TPA, new FormatUnknown()); 80 formatMap.put(Criterion.Type.ARP_TPA, new FormatUnknown());
81 + formatMap.put(Criterion.Type.ARP_SHA, new FormatUnknown());
82 + formatMap.put(Criterion.Type.ARP_THA, new FormatUnknown());
84 formatMap.put(Criterion.Type.MPLS_TC, new FormatUnknown()); 83 formatMap.put(Criterion.Type.MPLS_TC, new FormatUnknown());
85 formatMap.put(Criterion.Type.MPLS_BOS, new FormatUnknown()); 84 formatMap.put(Criterion.Type.MPLS_BOS, new FormatUnknown());
86 formatMap.put(Criterion.Type.PBB_ISID, new FormatUnknown()); 85 formatMap.put(Criterion.Type.PBB_ISID, new FormatUnknown());
87 - formatMap.put(Criterion.Type.PBB_UCA, new FormatUnknown());
88 formatMap.put(Criterion.Type.TUNNEL_ID, new FormatUnknown()); 86 formatMap.put(Criterion.Type.TUNNEL_ID, new FormatUnknown());
89 formatMap.put(Criterion.Type.IPV6_EXTHDR, new FormatUnknown()); 87 formatMap.put(Criterion.Type.IPV6_EXTHDR, new FormatUnknown());
90 formatMap.put(Criterion.Type.UNASSIGNED_40, new FormatUnknown()); 88 formatMap.put(Criterion.Type.UNASSIGNED_40, new FormatUnknown());
89 + formatMap.put(Criterion.Type.PBB_UCA, new FormatUnknown());
91 formatMap.put(Criterion.Type.TCP_FLAGS, new FormatUnknown()); 90 formatMap.put(Criterion.Type.TCP_FLAGS, new FormatUnknown());
92 formatMap.put(Criterion.Type.ACTSET_OUTPUT, new FormatUnknown()); 91 formatMap.put(Criterion.Type.ACTSET_OUTPUT, new FormatUnknown());
93 formatMap.put(Criterion.Type.PACKET_TYPE, new FormatUnknown()); 92 formatMap.put(Criterion.Type.PACKET_TYPE, new FormatUnknown());
...@@ -112,20 +111,20 @@ public final class CriterionCodec extends JsonCodec<Criterion> { ...@@ -112,20 +111,20 @@ public final class CriterionCodec extends JsonCodec<Criterion> {
112 } 111 }
113 } 112 }
114 113
115 - private static class FormatEth implements CriterionTypeFormatter { 114 + private static class FormatMetadata implements CriterionTypeFormatter {
116 @Override 115 @Override
117 public ObjectNode formatCriterion(ObjectNode root, Criterion criterion) { 116 public ObjectNode formatCriterion(ObjectNode root, Criterion criterion) {
118 - final Criteria.EthCriterion ethCriterion = (Criteria.EthCriterion) criterion; 117 + final Criteria.MetadataCriterion metadataCriterion =
119 - return root.put("mac", ethCriterion.mac().toString()); 118 + (Criteria.MetadataCriterion) criterion;
119 + return root.put("metadata", metadataCriterion.metadata());
120 } 120 }
121 } 121 }
122 122
123 - private static class FormatIpProto implements CriterionTypeFormatter { 123 + private static class FormatEth implements CriterionTypeFormatter {
124 @Override 124 @Override
125 public ObjectNode formatCriterion(ObjectNode root, Criterion criterion) { 125 public ObjectNode formatCriterion(ObjectNode root, Criterion criterion) {
126 - final Criteria.IPProtocolCriterion iPProtocolCriterion = 126 + final Criteria.EthCriterion ethCriterion = (Criteria.EthCriterion) criterion;
127 - (Criteria.IPProtocolCriterion) criterion; 127 + return root.put("mac", ethCriterion.mac().toString());
128 - return root.put("protocol", iPProtocolCriterion.protocol());
129 } 128 }
130 } 129 }
131 130
...@@ -138,15 +137,6 @@ public final class CriterionCodec extends JsonCodec<Criterion> { ...@@ -138,15 +137,6 @@ public final class CriterionCodec extends JsonCodec<Criterion> {
138 } 137 }
139 } 138 }
140 139
141 - private static class FormatMetadata implements CriterionTypeFormatter {
142 - @Override
143 - public ObjectNode formatCriterion(ObjectNode root, Criterion criterion) {
144 - final Criteria.MetadataCriterion metadataCriterion =
145 - (Criteria.MetadataCriterion) criterion;
146 - return root.put("metadata", metadataCriterion.metadata());
147 - }
148 - }
149 -
150 private static class FormatVlanVid implements CriterionTypeFormatter { 140 private static class FormatVlanVid implements CriterionTypeFormatter {
151 @Override 141 @Override
152 public ObjectNode formatCriterion(ObjectNode root, Criterion criterion) { 142 public ObjectNode formatCriterion(ObjectNode root, Criterion criterion) {
...@@ -183,6 +173,15 @@ public final class CriterionCodec extends JsonCodec<Criterion> { ...@@ -183,6 +173,15 @@ public final class CriterionCodec extends JsonCodec<Criterion> {
183 } 173 }
184 } 174 }
185 175
176 + private static class FormatIpProto implements CriterionTypeFormatter {
177 + @Override
178 + public ObjectNode formatCriterion(ObjectNode root, Criterion criterion) {
179 + final Criteria.IPProtocolCriterion iPProtocolCriterion =
180 + (Criteria.IPProtocolCriterion) criterion;
181 + return root.put("protocol", iPProtocolCriterion.protocol());
182 + }
183 + }
184 +
186 private static class FormatIp implements CriterionTypeFormatter { 185 private static class FormatIp implements CriterionTypeFormatter {
187 @Override 186 @Override
188 public ObjectNode formatCriterion(ObjectNode root, Criterion criterion) { 187 public ObjectNode formatCriterion(ObjectNode root, Criterion criterion) {
...@@ -196,7 +195,7 @@ public final class CriterionCodec extends JsonCodec<Criterion> { ...@@ -196,7 +195,7 @@ public final class CriterionCodec extends JsonCodec<Criterion> {
196 public ObjectNode formatCriterion(ObjectNode root, Criterion criterion) { 195 public ObjectNode formatCriterion(ObjectNode root, Criterion criterion) {
197 final Criteria.TcpPortCriterion tcpPortCriterion = 196 final Criteria.TcpPortCriterion tcpPortCriterion =
198 (Criteria.TcpPortCriterion) criterion; 197 (Criteria.TcpPortCriterion) criterion;
199 - return root.put("tcpPort", tcpPortCriterion.tcpPort().byteValue()); 198 + return root.put("tcpPort", tcpPortCriterion.tcpPort());
200 } 199 }
201 } 200 }
202 201
...@@ -205,7 +204,7 @@ public final class CriterionCodec extends JsonCodec<Criterion> { ...@@ -205,7 +204,7 @@ public final class CriterionCodec extends JsonCodec<Criterion> {
205 public ObjectNode formatCriterion(ObjectNode root, Criterion criterion) { 204 public ObjectNode formatCriterion(ObjectNode root, Criterion criterion) {
206 final Criteria.UdpPortCriterion udpPortCriterion = 205 final Criteria.UdpPortCriterion udpPortCriterion =
207 (Criteria.UdpPortCriterion) criterion; 206 (Criteria.UdpPortCriterion) criterion;
208 - return root.put("udpPort", udpPortCriterion.udpPort().byteValue()); 207 + return root.put("udpPort", udpPortCriterion.udpPort());
209 } 208 }
210 } 209 }
211 210
...@@ -214,8 +213,7 @@ public final class CriterionCodec extends JsonCodec<Criterion> { ...@@ -214,8 +213,7 @@ public final class CriterionCodec extends JsonCodec<Criterion> {
214 public ObjectNode formatCriterion(ObjectNode root, Criterion criterion) { 213 public ObjectNode formatCriterion(ObjectNode root, Criterion criterion) {
215 final Criteria.SctpPortCriterion sctpPortCriterion = 214 final Criteria.SctpPortCriterion sctpPortCriterion =
216 (Criteria.SctpPortCriterion) criterion; 215 (Criteria.SctpPortCriterion) criterion;
217 - return root.put("sctpPort", 216 + return root.put("sctpPort", sctpPortCriterion.sctpPort());
218 - sctpPortCriterion.sctpPort().byteValue());
219 } 217 }
220 } 218 }
221 219
......
...@@ -134,10 +134,10 @@ public class CriterionCodecTest { ...@@ -134,10 +134,10 @@ public class CriterionCodecTest {
134 */ 134 */
135 @Test 135 @Test
136 public void matchEthTypeTest() { 136 public void matchEthTypeTest() {
137 - Criterion criterion = Criteria.matchEthType((short) 3); 137 + Criterion criterion = Criteria.matchEthType((short) 0x8844);
138 ObjectNode result = criterionCodec.encode(criterion, context); 138 ObjectNode result = criterionCodec.encode(criterion, context);
139 assertThat(result.get("type").textValue(), is(criterion.type().toString())); 139 assertThat(result.get("type").textValue(), is(criterion.type().toString()));
140 - assertThat(result.get("ethType").asInt(), is(3)); 140 + assertThat(result.get("ethType").asInt(), is(0x8844));
141 } 141 }
142 142
143 /** 143 /**
...@@ -156,10 +156,10 @@ public class CriterionCodecTest { ...@@ -156,10 +156,10 @@ public class CriterionCodecTest {
156 */ 156 */
157 @Test 157 @Test
158 public void matchVlanPcpTest() { 158 public void matchVlanPcpTest() {
159 - Criterion criterion = Criteria.matchVlanPcp((byte) 4); 159 + Criterion criterion = Criteria.matchVlanPcp((byte) 7);
160 ObjectNode result = criterionCodec.encode(criterion, context); 160 ObjectNode result = criterionCodec.encode(criterion, context);
161 assertThat(result.get("type").textValue(), is(criterion.type().toString())); 161 assertThat(result.get("type").textValue(), is(criterion.type().toString()));
162 - assertThat(result.get("priority").asInt(), is(4)); 162 + assertThat(result.get("priority").asInt(), is(7));
163 } 163 }
164 164
165 /** 165 /**
...@@ -167,10 +167,10 @@ public class CriterionCodecTest { ...@@ -167,10 +167,10 @@ public class CriterionCodecTest {
167 */ 167 */
168 @Test 168 @Test
169 public void matchIPDscpTest() { 169 public void matchIPDscpTest() {
170 - Criterion criterion = Criteria.matchIPDscp((byte) 5); 170 + Criterion criterion = Criteria.matchIPDscp((byte) 63);
171 ObjectNode result = criterionCodec.encode(criterion, context); 171 ObjectNode result = criterionCodec.encode(criterion, context);
172 assertThat(result.get("type").textValue(), is(criterion.type().toString())); 172 assertThat(result.get("type").textValue(), is(criterion.type().toString()));
173 - assertThat(result.get("ipDscp").asInt(), is(5)); 173 + assertThat(result.get("ipDscp").asInt(), is(63));
174 } 174 }
175 175
176 /** 176 /**
...@@ -178,10 +178,10 @@ public class CriterionCodecTest { ...@@ -178,10 +178,10 @@ public class CriterionCodecTest {
178 */ 178 */
179 @Test 179 @Test
180 public void matchIPEcnTest() { 180 public void matchIPEcnTest() {
181 - Criterion criterion = Criteria.matchIPEcn((byte) 2); 181 + Criterion criterion = Criteria.matchIPEcn((byte) 7);
182 ObjectNode result = criterionCodec.encode(criterion, context); 182 ObjectNode result = criterionCodec.encode(criterion, context);
183 assertThat(result.get("type").textValue(), is(criterion.type().toString())); 183 assertThat(result.get("type").textValue(), is(criterion.type().toString()));
184 - assertThat(result.get("ipEcn").asInt(), is(2)); 184 + assertThat(result.get("ipEcn").asInt(), is(7));
185 } 185 }
186 186
187 /** 187 /**
...@@ -189,10 +189,10 @@ public class CriterionCodecTest { ...@@ -189,10 +189,10 @@ public class CriterionCodecTest {
189 */ 189 */
190 @Test 190 @Test
191 public void matchIPProtocolTest() { 191 public void matchIPProtocolTest() {
192 - Criterion criterion = Criteria.matchIPProtocol((byte) 7); 192 + Criterion criterion = Criteria.matchIPProtocol((byte) 250);
193 ObjectNode result = criterionCodec.encode(criterion, context); 193 ObjectNode result = criterionCodec.encode(criterion, context);
194 assertThat(result.get("type").textValue(), is(criterion.type().toString())); 194 assertThat(result.get("type").textValue(), is(criterion.type().toString()));
195 - assertThat(result.get("protocol").asInt(), is(7)); 195 + assertThat(result.get("protocol").asInt(), is(250));
196 } 196 }
197 197
198 /** 198 /**
...@@ -222,10 +222,10 @@ public class CriterionCodecTest { ...@@ -222,10 +222,10 @@ public class CriterionCodecTest {
222 */ 222 */
223 @Test 223 @Test
224 public void matchTcpSrcTest() { 224 public void matchTcpSrcTest() {
225 - Criterion criterion = Criteria.matchTcpSrc((short) 22); 225 + Criterion criterion = Criteria.matchTcpSrc((short) 40000);
226 ObjectNode result = criterionCodec.encode(criterion, context); 226 ObjectNode result = criterionCodec.encode(criterion, context);
227 assertThat(result.get("type").textValue(), is(criterion.type().toString())); 227 assertThat(result.get("type").textValue(), is(criterion.type().toString()));
228 - assertThat(result.get("tcpPort").asInt(), is(22)); 228 + assertThat(result.get("tcpPort").asInt(), is(40000));
229 } 229 }
230 230
231 /** 231 /**
...@@ -233,10 +233,10 @@ public class CriterionCodecTest { ...@@ -233,10 +233,10 @@ public class CriterionCodecTest {
233 */ 233 */
234 @Test 234 @Test
235 public void matchTcpDstTest() { 235 public void matchTcpDstTest() {
236 - Criterion criterion = Criteria.matchTcpDst((short) 22); 236 + Criterion criterion = Criteria.matchTcpDst((short) 40000);
237 ObjectNode result = criterionCodec.encode(criterion, context); 237 ObjectNode result = criterionCodec.encode(criterion, context);
238 assertThat(result.get("type").textValue(), is(criterion.type().toString())); 238 assertThat(result.get("type").textValue(), is(criterion.type().toString()));
239 - assertThat(result.get("tcpPort").asInt(), is(22)); 239 + assertThat(result.get("tcpPort").asInt(), is(40000));
240 } 240 }
241 241
242 /** 242 /**
...@@ -244,10 +244,10 @@ public class CriterionCodecTest { ...@@ -244,10 +244,10 @@ public class CriterionCodecTest {
244 */ 244 */
245 @Test 245 @Test
246 public void matchUdpSrcTest() { 246 public void matchUdpSrcTest() {
247 - Criterion criterion = Criteria.matchUdpSrc((short) 22); 247 + Criterion criterion = Criteria.matchUdpSrc((short) 40000);
248 ObjectNode result = criterionCodec.encode(criterion, context); 248 ObjectNode result = criterionCodec.encode(criterion, context);
249 assertThat(result.get("type").textValue(), is(criterion.type().toString())); 249 assertThat(result.get("type").textValue(), is(criterion.type().toString()));
250 - assertThat(result.get("udpPort").asInt(), is(22)); 250 + assertThat(result.get("udpPort").asInt(), is(40000));
251 } 251 }
252 252
253 /** 253 /**
...@@ -255,10 +255,10 @@ public class CriterionCodecTest { ...@@ -255,10 +255,10 @@ public class CriterionCodecTest {
255 */ 255 */
256 @Test 256 @Test
257 public void matchUdpDstTest() { 257 public void matchUdpDstTest() {
258 - Criterion criterion = Criteria.matchUdpDst((short) 22); 258 + Criterion criterion = Criteria.matchUdpDst((short) 40000);
259 ObjectNode result = criterionCodec.encode(criterion, context); 259 ObjectNode result = criterionCodec.encode(criterion, context);
260 assertThat(result.get("type").textValue(), is(criterion.type().toString())); 260 assertThat(result.get("type").textValue(), is(criterion.type().toString()));
261 - assertThat(result.get("udpPort").asInt(), is(22)); 261 + assertThat(result.get("udpPort").asInt(), is(40000));
262 } 262 }
263 263
264 /** 264 /**
...@@ -266,10 +266,10 @@ public class CriterionCodecTest { ...@@ -266,10 +266,10 @@ public class CriterionCodecTest {
266 */ 266 */
267 @Test 267 @Test
268 public void matchSctpSrcTest() { 268 public void matchSctpSrcTest() {
269 - Criterion criterion = Criteria.matchSctpSrc((short) 22); 269 + Criterion criterion = Criteria.matchSctpSrc((short) 40000);
270 ObjectNode result = criterionCodec.encode(criterion, context); 270 ObjectNode result = criterionCodec.encode(criterion, context);
271 assertThat(result.get("type").textValue(), is(criterion.type().toString())); 271 assertThat(result.get("type").textValue(), is(criterion.type().toString()));
272 - assertThat(result.get("sctpPort").asInt(), is(22)); 272 + assertThat(result.get("sctpPort").asInt(), is(40000));
273 } 273 }
274 274
275 /** 275 /**
...@@ -277,10 +277,10 @@ public class CriterionCodecTest { ...@@ -277,10 +277,10 @@ public class CriterionCodecTest {
277 */ 277 */
278 @Test 278 @Test
279 public void matchSctpDstTest() { 279 public void matchSctpDstTest() {
280 - Criterion criterion = Criteria.matchSctpDst((short) 22); 280 + Criterion criterion = Criteria.matchSctpDst((short) 40000);
281 ObjectNode result = criterionCodec.encode(criterion, context); 281 ObjectNode result = criterionCodec.encode(criterion, context);
282 assertThat(result.get("type").textValue(), is(criterion.type().toString())); 282 assertThat(result.get("type").textValue(), is(criterion.type().toString()));
283 - assertThat(result.get("sctpPort").asInt(), is(22)); 283 + assertThat(result.get("sctpPort").asInt(), is(40000));
284 } 284 }
285 285
286 /** 286 /**
...@@ -288,10 +288,10 @@ public class CriterionCodecTest { ...@@ -288,10 +288,10 @@ public class CriterionCodecTest {
288 */ 288 */
289 @Test 289 @Test
290 public void matchIcmpTypeTest() { 290 public void matchIcmpTypeTest() {
291 - Criterion criterion = Criteria.matchIcmpType((byte) 6); 291 + Criterion criterion = Criteria.matchIcmpType((byte) 250);
292 ObjectNode result = criterionCodec.encode(criterion, context); 292 ObjectNode result = criterionCodec.encode(criterion, context);
293 assertThat(result.get("type").textValue(), is(criterion.type().toString())); 293 assertThat(result.get("type").textValue(), is(criterion.type().toString()));
294 - assertThat(result.get("icmpType").asInt(), is(6)); 294 + assertThat(result.get("icmpType").asInt(), is(250));
295 } 295 }
296 296
297 /** 297 /**
...@@ -299,10 +299,10 @@ public class CriterionCodecTest { ...@@ -299,10 +299,10 @@ public class CriterionCodecTest {
299 */ 299 */
300 @Test 300 @Test
301 public void matchIcmpCodeTest() { 301 public void matchIcmpCodeTest() {
302 - Criterion criterion = Criteria.matchIcmpCode((byte) 6); 302 + Criterion criterion = Criteria.matchIcmpCode((byte) 250);
303 ObjectNode result = criterionCodec.encode(criterion, context); 303 ObjectNode result = criterionCodec.encode(criterion, context);
304 assertThat(result.get("type").textValue(), is(criterion.type().toString())); 304 assertThat(result.get("type").textValue(), is(criterion.type().toString()));
305 - assertThat(result.get("icmpCode").asInt(), is(6)); 305 + assertThat(result.get("icmpCode").asInt(), is(250));
306 } 306 }
307 307
308 /** 308 /**
...@@ -332,10 +332,10 @@ public class CriterionCodecTest { ...@@ -332,10 +332,10 @@ public class CriterionCodecTest {
332 */ 332 */
333 @Test 333 @Test
334 public void matchIPv6FlowLabelTest() { 334 public void matchIPv6FlowLabelTest() {
335 - Criterion criterion = Criteria.matchIPv6FlowLabel(7); 335 + Criterion criterion = Criteria.matchIPv6FlowLabel(0xffffe);
336 ObjectNode result = criterionCodec.encode(criterion, context); 336 ObjectNode result = criterionCodec.encode(criterion, context);
337 assertThat(result.get("type").textValue(), is(criterion.type().toString())); 337 assertThat(result.get("type").textValue(), is(criterion.type().toString()));
338 - assertThat(result.get("flowLabel").asInt(), is(7)); 338 + assertThat(result.get("flowLabel").asInt(), is(0xffffe));
339 } 339 }
340 340
341 /** 341 /**
...@@ -343,10 +343,10 @@ public class CriterionCodecTest { ...@@ -343,10 +343,10 @@ public class CriterionCodecTest {
343 */ 343 */
344 @Test 344 @Test
345 public void matchIcmpv6TypeTest() { 345 public void matchIcmpv6TypeTest() {
346 - Criterion criterion = Criteria.matchIcmpv6Type((byte) 15); 346 + Criterion criterion = Criteria.matchIcmpv6Type((byte) 250);
347 ObjectNode result = criterionCodec.encode(criterion, context); 347 ObjectNode result = criterionCodec.encode(criterion, context);
348 assertThat(result.get("type").textValue(), is(criterion.type().toString())); 348 assertThat(result.get("type").textValue(), is(criterion.type().toString()));
349 - assertThat(result.get("icmpv6Type").asInt(), is(15)); 349 + assertThat(result.get("icmpv6Type").asInt(), is(250));
350 } 350 }
351 351
352 /** 352 /**
...@@ -354,10 +354,10 @@ public class CriterionCodecTest { ...@@ -354,10 +354,10 @@ public class CriterionCodecTest {
354 */ 354 */
355 @Test 355 @Test
356 public void matchIcmpv6CodeTest() { 356 public void matchIcmpv6CodeTest() {
357 - Criterion criterion = Criteria.matchIcmpv6Code((byte) 17); 357 + Criterion criterion = Criteria.matchIcmpv6Code((byte) 250);
358 ObjectNode result = criterionCodec.encode(criterion, context); 358 ObjectNode result = criterionCodec.encode(criterion, context);
359 assertThat(result.get("type").textValue(), is(criterion.type().toString())); 359 assertThat(result.get("type").textValue(), is(criterion.type().toString()));
360 - assertThat(result.get("icmpv6Code").asInt(), is(17)); 360 + assertThat(result.get("icmpv6Code").asInt(), is(250));
361 } 361 }
362 362
363 /** 363 /**
...@@ -400,10 +400,10 @@ public class CriterionCodecTest { ...@@ -400,10 +400,10 @@ public class CriterionCodecTest {
400 */ 400 */
401 @Test 401 @Test
402 public void matchMplsLabelTest() { 402 public void matchMplsLabelTest() {
403 - Criterion criterion = Criteria.matchMplsLabel(88); 403 + Criterion criterion = Criteria.matchMplsLabel(0xffffe);
404 ObjectNode result = criterionCodec.encode(criterion, context); 404 ObjectNode result = criterionCodec.encode(criterion, context);
405 assertThat(result.get("type").textValue(), is(criterion.type().toString())); 405 assertThat(result.get("type").textValue(), is(criterion.type().toString()));
406 - assertThat(result.get("label").asInt(), is(88)); 406 + assertThat(result.get("label").asInt(), is(0xffffe));
407 } 407 }
408 408
409 /** 409 /**
...@@ -411,10 +411,10 @@ public class CriterionCodecTest { ...@@ -411,10 +411,10 @@ public class CriterionCodecTest {
411 */ 411 */
412 @Test 412 @Test
413 public void matchLambdaTest() { 413 public void matchLambdaTest() {
414 - Criterion criterion = Criteria.matchLambda((short) 9); 414 + Criterion criterion = Criteria.matchLambda((short) 40000);
415 ObjectNode result = criterionCodec.encode(criterion, context); 415 ObjectNode result = criterionCodec.encode(criterion, context);
416 assertThat(result.get("type").textValue(), is(criterion.type().toString())); 416 assertThat(result.get("type").textValue(), is(criterion.type().toString()));
417 - assertThat(result.get("lambda").asInt(), is(9)); 417 + assertThat(result.get("lambda").asInt(), is(40000));
418 } 418 }
419 419
420 /** 420 /**
...@@ -422,10 +422,10 @@ public class CriterionCodecTest { ...@@ -422,10 +422,10 @@ public class CriterionCodecTest {
422 */ 422 */
423 @Test 423 @Test
424 public void matchOpticalSignalTypeTest() { 424 public void matchOpticalSignalTypeTest() {
425 - Criterion criterion = Criteria.matchOpticalSignalType((short) 11); 425 + Criterion criterion = Criteria.matchOpticalSignalType((short) 40000);
426 ObjectNode result = criterionCodec.encode(criterion, context); 426 ObjectNode result = criterionCodec.encode(criterion, context);
427 assertThat(result.get("type").textValue(), is(criterion.type().toString())); 427 assertThat(result.get("type").textValue(), is(criterion.type().toString()));
428 - assertThat(result.get("signalType").asInt(), is(11)); 428 + assertThat(result.get("signalType").asInt(), is(40000));
429 } 429 }
430 430
431 } 431 }
......
...@@ -84,7 +84,8 @@ public final class CriterionJsonMatcher extends TypeSafeDiagnosingMatcher<JsonNo ...@@ -84,7 +84,8 @@ public final class CriterionJsonMatcher extends TypeSafeDiagnosingMatcher<JsonNo
84 case ETH_TYPE: 84 case ETH_TYPE:
85 final Criteria.EthTypeCriterion ethTypeCriterion = 85 final Criteria.EthTypeCriterion ethTypeCriterion =
86 (Criteria.EthTypeCriterion) criterion; 86 (Criteria.EthTypeCriterion) criterion;
87 - final String ethType = ethTypeCriterion.ethType().toString(); 87 + final String ethType =
88 + Long.toHexString(ethTypeCriterion.ethType());
88 final String jsonEthType = jsonCriterion.get("ethType").textValue(); 89 final String jsonEthType = jsonCriterion.get("ethType").textValue();
89 if (!ethType.equals(jsonEthType)) { 90 if (!ethType.equals(jsonEthType)) {
90 description.appendText("ethType was " + jsonEthType); 91 description.appendText("ethType was " + jsonEthType);
...@@ -139,10 +140,10 @@ public final class CriterionJsonMatcher extends TypeSafeDiagnosingMatcher<JsonNo ...@@ -139,10 +140,10 @@ public final class CriterionJsonMatcher extends TypeSafeDiagnosingMatcher<JsonNo
139 case IP_PROTO: 140 case IP_PROTO:
140 final Criteria.IPProtocolCriterion iPProtocolCriterion = 141 final Criteria.IPProtocolCriterion iPProtocolCriterion =
141 (Criteria.IPProtocolCriterion) criterion; 142 (Criteria.IPProtocolCriterion) criterion;
142 - final byte protocol = iPProtocolCriterion.protocol(); 143 + final short protocol = iPProtocolCriterion.protocol();
143 - final byte jsonProtocol = (byte) jsonCriterion.get("protocol").shortValue(); 144 + final short jsonProtocol = jsonCriterion.get("protocol").shortValue();
144 if (protocol != jsonProtocol) { 145 if (protocol != jsonProtocol) {
145 - description.appendText("protocol was " + Byte.toString(jsonProtocol)); 146 + description.appendText("protocol was " + Short.toString(jsonProtocol));
146 return false; 147 return false;
147 } 148 }
148 break; 149 break;
...@@ -165,10 +166,10 @@ public final class CriterionJsonMatcher extends TypeSafeDiagnosingMatcher<JsonNo ...@@ -165,10 +166,10 @@ public final class CriterionJsonMatcher extends TypeSafeDiagnosingMatcher<JsonNo
165 case TCP_DST: 166 case TCP_DST:
166 final Criteria.TcpPortCriterion tcpPortCriterion = 167 final Criteria.TcpPortCriterion tcpPortCriterion =
167 (Criteria.TcpPortCriterion) criterion; 168 (Criteria.TcpPortCriterion) criterion;
168 - final short tcpPort = tcpPortCriterion.tcpPort(); 169 + final int tcpPort = tcpPortCriterion.tcpPort();
169 - final short jsonTcpPort = jsonCriterion.get("tcpPort").shortValue(); 170 + final int jsonTcpPort = jsonCriterion.get("tcpPort").intValue();
170 if (tcpPort != jsonTcpPort) { 171 if (tcpPort != jsonTcpPort) {
171 - description.appendText("tcp port was " + Short.toString(jsonTcpPort)); 172 + description.appendText("tcp port was " + Integer.toString(jsonTcpPort));
172 return false; 173 return false;
173 } 174 }
174 break; 175 break;
...@@ -177,10 +178,10 @@ public final class CriterionJsonMatcher extends TypeSafeDiagnosingMatcher<JsonNo ...@@ -177,10 +178,10 @@ public final class CriterionJsonMatcher extends TypeSafeDiagnosingMatcher<JsonNo
177 case UDP_DST: 178 case UDP_DST:
178 final Criteria.UdpPortCriterion udpPortCriterion = 179 final Criteria.UdpPortCriterion udpPortCriterion =
179 (Criteria.UdpPortCriterion) criterion; 180 (Criteria.UdpPortCriterion) criterion;
180 - final short udpPort = udpPortCriterion.udpPort(); 181 + final int udpPort = udpPortCriterion.udpPort();
181 - final short jsonUdpPort = jsonCriterion.get("udpPort").shortValue(); 182 + final int jsonUdpPort = jsonCriterion.get("udpPort").intValue();
182 if (udpPort != jsonUdpPort) { 183 if (udpPort != jsonUdpPort) {
183 - description.appendText("udp port was " + Short.toString(jsonUdpPort)); 184 + description.appendText("udp port was " + Integer.toString(jsonUdpPort));
184 return false; 185 return false;
185 } 186 }
186 break; 187 break;
...@@ -189,10 +190,10 @@ public final class CriterionJsonMatcher extends TypeSafeDiagnosingMatcher<JsonNo ...@@ -189,10 +190,10 @@ public final class CriterionJsonMatcher extends TypeSafeDiagnosingMatcher<JsonNo
189 case SCTP_DST: 190 case SCTP_DST:
190 final Criteria.SctpPortCriterion sctpPortCriterion = 191 final Criteria.SctpPortCriterion sctpPortCriterion =
191 (Criteria.SctpPortCriterion) criterion; 192 (Criteria.SctpPortCriterion) criterion;
192 - final short sctpPort = sctpPortCriterion.sctpPort(); 193 + final int sctpPort = sctpPortCriterion.sctpPort();
193 - final short jsonSctpPort = jsonCriterion.get("sctpPort").shortValue(); 194 + final int jsonSctpPort = jsonCriterion.get("sctpPort").intValue();
194 if (sctpPort != jsonSctpPort) { 195 if (sctpPort != jsonSctpPort) {
195 - description.appendText("sctp port was " + Short.toString(jsonSctpPort)); 196 + description.appendText("sctp port was " + Integer.toString(jsonSctpPort));
196 return false; 197 return false;
197 } 198 }
198 break; 199 break;
...@@ -200,10 +201,10 @@ public final class CriterionJsonMatcher extends TypeSafeDiagnosingMatcher<JsonNo ...@@ -200,10 +201,10 @@ public final class CriterionJsonMatcher extends TypeSafeDiagnosingMatcher<JsonNo
200 case ICMPV4_TYPE: 201 case ICMPV4_TYPE:
201 final Criteria.IcmpTypeCriterion icmpTypeCriterion = 202 final Criteria.IcmpTypeCriterion icmpTypeCriterion =
202 (Criteria.IcmpTypeCriterion) criterion; 203 (Criteria.IcmpTypeCriterion) criterion;
203 - final byte icmpType = icmpTypeCriterion.icmpType(); 204 + final short icmpType = icmpTypeCriterion.icmpType();
204 - final byte jsonIcmpType = (byte) jsonCriterion.get("icmpType").shortValue(); 205 + final short jsonIcmpType = jsonCriterion.get("icmpType").shortValue();
205 if (icmpType != jsonIcmpType) { 206 if (icmpType != jsonIcmpType) {
206 - description.appendText("icmp type was " + Byte.toString(jsonIcmpType)); 207 + description.appendText("icmp type was " + Short.toString(jsonIcmpType));
207 return false; 208 return false;
208 } 209 }
209 break; 210 break;
...@@ -211,10 +212,10 @@ public final class CriterionJsonMatcher extends TypeSafeDiagnosingMatcher<JsonNo ...@@ -211,10 +212,10 @@ public final class CriterionJsonMatcher extends TypeSafeDiagnosingMatcher<JsonNo
211 case ICMPV4_CODE: 212 case ICMPV4_CODE:
212 final Criteria.IcmpCodeCriterion icmpCodeCriterion = 213 final Criteria.IcmpCodeCriterion icmpCodeCriterion =
213 (Criteria.IcmpCodeCriterion) criterion; 214 (Criteria.IcmpCodeCriterion) criterion;
214 - final byte icmpCode = icmpCodeCriterion.icmpCode(); 215 + final short icmpCode = icmpCodeCriterion.icmpCode();
215 - final byte jsonIcmpCode = (byte) jsonCriterion.get("icmpCode").shortValue(); 216 + final short jsonIcmpCode = jsonCriterion.get("icmpCode").shortValue();
216 if (icmpCode != jsonIcmpCode) { 217 if (icmpCode != jsonIcmpCode) {
217 - description.appendText("icmp code was " + Byte.toString(jsonIcmpCode)); 218 + description.appendText("icmp code was " + Short.toString(jsonIcmpCode));
218 return false; 219 return false;
219 } 220 }
220 break; 221 break;
...@@ -233,10 +234,10 @@ public final class CriterionJsonMatcher extends TypeSafeDiagnosingMatcher<JsonNo ...@@ -233,10 +234,10 @@ public final class CriterionJsonMatcher extends TypeSafeDiagnosingMatcher<JsonNo
233 case ICMPV6_TYPE: 234 case ICMPV6_TYPE:
234 final Criteria.Icmpv6TypeCriterion icmpv6TypeCriterion = 235 final Criteria.Icmpv6TypeCriterion icmpv6TypeCriterion =
235 (Criteria.Icmpv6TypeCriterion) criterion; 236 (Criteria.Icmpv6TypeCriterion) criterion;
236 - final byte icmpv6Type = icmpv6TypeCriterion.icmpv6Type(); 237 + final short icmpv6Type = icmpv6TypeCriterion.icmpv6Type();
237 - final byte jsonIcmpv6Type = (byte) jsonCriterion.get("icmpv6Type").shortValue(); 238 + final short jsonIcmpv6Type = jsonCriterion.get("icmpv6Type").shortValue();
238 if (icmpv6Type != jsonIcmpv6Type) { 239 if (icmpv6Type != jsonIcmpv6Type) {
239 - description.appendText("icmpv6 type was " + Byte.toString(jsonIcmpv6Type)); 240 + description.appendText("icmpv6 type was " + Short.toString(jsonIcmpv6Type));
240 return false; 241 return false;
241 } 242 }
242 break; 243 break;
...@@ -244,10 +245,10 @@ public final class CriterionJsonMatcher extends TypeSafeDiagnosingMatcher<JsonNo ...@@ -244,10 +245,10 @@ public final class CriterionJsonMatcher extends TypeSafeDiagnosingMatcher<JsonNo
244 case ICMPV6_CODE: 245 case ICMPV6_CODE:
245 final Criteria.Icmpv6CodeCriterion icmpv6CodeCriterion = 246 final Criteria.Icmpv6CodeCriterion icmpv6CodeCriterion =
246 (Criteria.Icmpv6CodeCriterion) criterion; 247 (Criteria.Icmpv6CodeCriterion) criterion;
247 - final byte icmpv6Code = icmpv6CodeCriterion.icmpv6Code(); 248 + final short icmpv6Code = icmpv6CodeCriterion.icmpv6Code();
248 - final byte jsonIcmpv6Code = (byte) jsonCriterion.get("icmpv6Code").shortValue(); 249 + final short jsonIcmpv6Code = jsonCriterion.get("icmpv6Code").shortValue();
249 if (icmpv6Code != jsonIcmpv6Code) { 250 if (icmpv6Code != jsonIcmpv6Code) {
250 - description.appendText("icmpv6 code was " + Byte.toString(jsonIcmpv6Code)); 251 + description.appendText("icmpv6 code was " + Short.toString(jsonIcmpv6Code));
251 return false; 252 return false;
252 } 253 }
253 break; 254 break;
...@@ -296,10 +297,10 @@ public final class CriterionJsonMatcher extends TypeSafeDiagnosingMatcher<JsonNo ...@@ -296,10 +297,10 @@ public final class CriterionJsonMatcher extends TypeSafeDiagnosingMatcher<JsonNo
296 case OCH_SIGID: 297 case OCH_SIGID:
297 final Criteria.LambdaCriterion lambdaCriterion = 298 final Criteria.LambdaCriterion lambdaCriterion =
298 (Criteria.LambdaCriterion) criterion; 299 (Criteria.LambdaCriterion) criterion;
299 - final short lambda = lambdaCriterion.lambda(); 300 + final int lambda = lambdaCriterion.lambda();
300 - final short jsonLambda = jsonCriterion.get("lambda").shortValue(); 301 + final int jsonLambda = jsonCriterion.get("lambda").intValue();
301 if (lambda != jsonLambda) { 302 if (lambda != jsonLambda) {
302 - description.appendText("lambda was " + Short.toString(lambda)); 303 + description.appendText("lambda was " + Integer.toString(lambda));
303 return false; 304 return false;
304 } 305 }
305 break; 306 break;
...@@ -307,10 +308,10 @@ public final class CriterionJsonMatcher extends TypeSafeDiagnosingMatcher<JsonNo ...@@ -307,10 +308,10 @@ public final class CriterionJsonMatcher extends TypeSafeDiagnosingMatcher<JsonNo
307 case OCH_SIGTYPE: 308 case OCH_SIGTYPE:
308 final Criteria.OpticalSignalTypeCriterion opticalSignalTypeCriterion = 309 final Criteria.OpticalSignalTypeCriterion opticalSignalTypeCriterion =
309 (Criteria.OpticalSignalTypeCriterion) criterion; 310 (Criteria.OpticalSignalTypeCriterion) criterion;
310 - final short signalType = opticalSignalTypeCriterion.signalType(); 311 + final int signalType = opticalSignalTypeCriterion.signalType();
311 - final short jsonSignalType = jsonCriterion.get("signalType").shortValue(); 312 + final int jsonSignalType = jsonCriterion.get("signalType").intValue();
312 if (signalType != jsonSignalType) { 313 if (signalType != jsonSignalType) {
313 - description.appendText("signal type was " + Short.toString(signalType)); 314 + description.appendText("signal type was " + Integer.toString(signalType));
314 return false; 315 return false;
315 } 316 }
316 break; 317 break;
......