Committed by
Gerrit Code Review
Pull out inner-classes from Criteria to be independent classes
Make constructors of sub-types of Criterion package private for limiting instantiation only from static factory methods in Criteria Change-Id: I1fb1e9d003288a778a49e758549a92b66bf3cfdf
Showing
34 changed files
with
2179 additions
and
1614 deletions
| ... | @@ -31,7 +31,7 @@ import org.onosproject.net.Host; | ... | @@ -31,7 +31,7 @@ import org.onosproject.net.Host; |
| 31 | import org.onosproject.net.device.DeviceService; | 31 | import org.onosproject.net.device.DeviceService; |
| 32 | import org.onosproject.net.flow.FlowRule; | 32 | import org.onosproject.net.flow.FlowRule; |
| 33 | import org.onosproject.net.flow.FlowRuleService; | 33 | import org.onosproject.net.flow.FlowRuleService; |
| 34 | -import org.onosproject.net.flow.criteria.Criteria.EthCriterion; | 34 | +import org.onosproject.net.flow.criteria.EthCriterion; |
| 35 | import org.onosproject.net.flow.criteria.Criterion; | 35 | import org.onosproject.net.flow.criteria.Criterion; |
| 36 | import org.onosproject.net.flow.criteria.Criterion.Type; | 36 | import org.onosproject.net.flow.criteria.Criterion.Type; |
| 37 | import org.onosproject.net.host.HostEvent; | 37 | import org.onosproject.net.host.HostEvent; | ... | ... |
| ... | @@ -40,7 +40,7 @@ import org.onosproject.net.flow.DefaultTrafficSelector; | ... | @@ -40,7 +40,7 @@ import org.onosproject.net.flow.DefaultTrafficSelector; |
| 40 | import org.onosproject.net.flow.DefaultTrafficTreatment; | 40 | import org.onosproject.net.flow.DefaultTrafficTreatment; |
| 41 | import org.onosproject.net.flow.TrafficSelector; | 41 | import org.onosproject.net.flow.TrafficSelector; |
| 42 | import org.onosproject.net.flow.TrafficTreatment; | 42 | import org.onosproject.net.flow.TrafficTreatment; |
| 43 | -import org.onosproject.net.flow.criteria.Criteria.IPCriterion; | 43 | +import org.onosproject.net.flow.criteria.IPCriterion; |
| 44 | import org.onosproject.net.flow.criteria.Criterion; | 44 | import org.onosproject.net.flow.criteria.Criterion; |
| 45 | import org.onosproject.net.host.HostService; | 45 | import org.onosproject.net.host.HostService; |
| 46 | import org.onosproject.net.intent.Intent; | 46 | import org.onosproject.net.intent.Intent; | ... | ... |
| ... | @@ -15,10 +15,6 @@ | ... | @@ -15,10 +15,6 @@ |
| 15 | */ | 15 | */ |
| 16 | package org.onosproject.net.flow.criteria; | 16 | package org.onosproject.net.flow.criteria; |
| 17 | 17 | ||
| 18 | -import static com.google.common.base.MoreObjects.toStringHelper; | ||
| 19 | - | ||
| 20 | -import java.util.Objects; | ||
| 21 | - | ||
| 22 | import org.onosproject.net.PortNumber; | 18 | import org.onosproject.net.PortNumber; |
| 23 | import org.onosproject.net.flow.criteria.Criterion.Type; | 19 | import org.onosproject.net.flow.criteria.Criterion.Type; |
| 24 | import org.onlab.packet.IpPrefix; | 20 | import org.onlab.packet.IpPrefix; |
| ... | @@ -380,1361 +376,6 @@ public final class Criteria { | ... | @@ -380,1361 +376,6 @@ public final class Criteria { |
| 380 | } | 376 | } |
| 381 | 377 | ||
| 382 | /** | 378 | /** |
| 383 | - * Implementation of input port criterion. | ||
| 384 | - */ | ||
| 385 | - public static final class PortCriterion implements Criterion { | ||
| 386 | - private final PortNumber port; | ||
| 387 | - private final Type type; | ||
| 388 | - | ||
| 389 | - /** | ||
| 390 | - * Constructor. | ||
| 391 | - * | ||
| 392 | - * @param port the input port number to match | ||
| 393 | - * @param type the match type. Should be either Type.IN_PORT or | ||
| 394 | - * Type.IN_PHY_PORT | ||
| 395 | - */ | ||
| 396 | - public PortCriterion(PortNumber port, Type type) { | ||
| 397 | - this.port = port; | ||
| 398 | - this.type = type; | ||
| 399 | - } | ||
| 400 | - | ||
| 401 | - @Override | ||
| 402 | - public Type type() { | ||
| 403 | - return this.type; | ||
| 404 | - } | ||
| 405 | - | ||
| 406 | - /** | ||
| 407 | - * Gets the input port number to match. | ||
| 408 | - * | ||
| 409 | - * @return the input port number to match | ||
| 410 | - */ | ||
| 411 | - public PortNumber port() { | ||
| 412 | - return this.port; | ||
| 413 | - } | ||
| 414 | - | ||
| 415 | - @Override | ||
| 416 | - public String toString() { | ||
| 417 | - return toStringHelper(type().toString()) | ||
| 418 | - .add("port", port).toString(); | ||
| 419 | - } | ||
| 420 | - | ||
| 421 | - @Override | ||
| 422 | - public int hashCode() { | ||
| 423 | - return Objects.hash(type(), port); | ||
| 424 | - } | ||
| 425 | - | ||
| 426 | - @Override | ||
| 427 | - public boolean equals(Object obj) { | ||
| 428 | - if (this == obj) { | ||
| 429 | - return true; | ||
| 430 | - } | ||
| 431 | - if (obj instanceof PortCriterion) { | ||
| 432 | - PortCriterion that = (PortCriterion) obj; | ||
| 433 | - return Objects.equals(port, that.port) && | ||
| 434 | - Objects.equals(this.type(), that.type()); | ||
| 435 | - } | ||
| 436 | - return false; | ||
| 437 | - } | ||
| 438 | - } | ||
| 439 | - | ||
| 440 | - /** | ||
| 441 | - * Implementation of Metadata criterion. | ||
| 442 | - */ | ||
| 443 | - public static final class MetadataCriterion implements Criterion { | ||
| 444 | - private final long metadata; | ||
| 445 | - | ||
| 446 | - /** | ||
| 447 | - * Constructor. | ||
| 448 | - * | ||
| 449 | - * @param metadata the metadata to match (64 bits data) | ||
| 450 | - */ | ||
| 451 | - public MetadataCriterion(long metadata) { | ||
| 452 | - this.metadata = metadata; | ||
| 453 | - } | ||
| 454 | - | ||
| 455 | - @Override | ||
| 456 | - public Type type() { | ||
| 457 | - return Type.METADATA; | ||
| 458 | - } | ||
| 459 | - | ||
| 460 | - /** | ||
| 461 | - * Gets the metadata to match. | ||
| 462 | - * | ||
| 463 | - * @return the metadata to match (64 bits data) | ||
| 464 | - */ | ||
| 465 | - public long metadata() { | ||
| 466 | - return metadata; | ||
| 467 | - } | ||
| 468 | - | ||
| 469 | - @Override | ||
| 470 | - public String toString() { | ||
| 471 | - return toStringHelper(type().toString()) | ||
| 472 | - .add("metadata", Long.toHexString(metadata)) | ||
| 473 | - .toString(); | ||
| 474 | - } | ||
| 475 | - | ||
| 476 | - @Override | ||
| 477 | - public int hashCode() { | ||
| 478 | - return Objects.hash(type(), metadata); | ||
| 479 | - } | ||
| 480 | - | ||
| 481 | - @Override | ||
| 482 | - public boolean equals(Object obj) { | ||
| 483 | - if (this == obj) { | ||
| 484 | - return true; | ||
| 485 | - } | ||
| 486 | - if (obj instanceof MetadataCriterion) { | ||
| 487 | - MetadataCriterion that = (MetadataCriterion) obj; | ||
| 488 | - return Objects.equals(metadata, that.metadata) && | ||
| 489 | - Objects.equals(this.type(), that.type()); | ||
| 490 | - } | ||
| 491 | - return false; | ||
| 492 | - } | ||
| 493 | - } | ||
| 494 | - | ||
| 495 | - /** | ||
| 496 | - * Implementation of MAC address criterion. | ||
| 497 | - */ | ||
| 498 | - public static final class EthCriterion implements Criterion { | ||
| 499 | - private final MacAddress mac; | ||
| 500 | - private final Type type; | ||
| 501 | - | ||
| 502 | - /** | ||
| 503 | - * Constructor. | ||
| 504 | - * | ||
| 505 | - * @param mac the source or destination MAC address to match | ||
| 506 | - * @param type the match type. Should be either Type.ETH_DST or | ||
| 507 | - * Type.ETH_SRC | ||
| 508 | - */ | ||
| 509 | - public EthCriterion(MacAddress mac, Type type) { | ||
| 510 | - this.mac = mac; | ||
| 511 | - this.type = type; | ||
| 512 | - } | ||
| 513 | - | ||
| 514 | - @Override | ||
| 515 | - public Type type() { | ||
| 516 | - return this.type; | ||
| 517 | - } | ||
| 518 | - | ||
| 519 | - /** | ||
| 520 | - * Gets the MAC address to match. | ||
| 521 | - * | ||
| 522 | - * @return the MAC address to match | ||
| 523 | - */ | ||
| 524 | - public MacAddress mac() { | ||
| 525 | - return this.mac; | ||
| 526 | - } | ||
| 527 | - | ||
| 528 | - @Override | ||
| 529 | - public String toString() { | ||
| 530 | - return toStringHelper(type().toString()) | ||
| 531 | - .add("mac", mac).toString(); | ||
| 532 | - } | ||
| 533 | - | ||
| 534 | - @Override | ||
| 535 | - public int hashCode() { | ||
| 536 | - return Objects.hash(type, mac); | ||
| 537 | - } | ||
| 538 | - | ||
| 539 | - @Override | ||
| 540 | - public boolean equals(Object obj) { | ||
| 541 | - if (this == obj) { | ||
| 542 | - return true; | ||
| 543 | - } | ||
| 544 | - if (obj instanceof EthCriterion) { | ||
| 545 | - EthCriterion that = (EthCriterion) obj; | ||
| 546 | - return Objects.equals(mac, that.mac) && | ||
| 547 | - Objects.equals(type, that.type); | ||
| 548 | - } | ||
| 549 | - return false; | ||
| 550 | - } | ||
| 551 | - } | ||
| 552 | - | ||
| 553 | - /** | ||
| 554 | - * Implementation of Ethernet type criterion (16 bits unsigned integer). | ||
| 555 | - */ | ||
| 556 | - public static final class EthTypeCriterion implements Criterion { | ||
| 557 | - private static final int MASK = 0xffff; | ||
| 558 | - private final int ethType; // Ethernet type value: 16 bits | ||
| 559 | - | ||
| 560 | - /** | ||
| 561 | - * Constructor. | ||
| 562 | - * | ||
| 563 | - * @param ethType the Ethernet frame type to match (16 bits unsigned | ||
| 564 | - * integer) | ||
| 565 | - */ | ||
| 566 | - public EthTypeCriterion(int ethType) { | ||
| 567 | - this.ethType = ethType & MASK; | ||
| 568 | - } | ||
| 569 | - | ||
| 570 | - @Override | ||
| 571 | - public Type type() { | ||
| 572 | - return Type.ETH_TYPE; | ||
| 573 | - } | ||
| 574 | - | ||
| 575 | - /** | ||
| 576 | - * Gets the Ethernet frame type to match. | ||
| 577 | - * | ||
| 578 | - * @return the Ethernet frame type to match (16 bits unsigned integer) | ||
| 579 | - */ | ||
| 580 | - public int ethType() { | ||
| 581 | - return ethType; | ||
| 582 | - } | ||
| 583 | - | ||
| 584 | - @Override | ||
| 585 | - public String toString() { | ||
| 586 | - return toStringHelper(type().toString()) | ||
| 587 | - .add("ethType", Long.toHexString(ethType)) | ||
| 588 | - .toString(); | ||
| 589 | - } | ||
| 590 | - | ||
| 591 | - @Override | ||
| 592 | - public int hashCode() { | ||
| 593 | - return Objects.hash(type(), ethType); | ||
| 594 | - } | ||
| 595 | - | ||
| 596 | - @Override | ||
| 597 | - public boolean equals(Object obj) { | ||
| 598 | - if (this == obj) { | ||
| 599 | - return true; | ||
| 600 | - } | ||
| 601 | - if (obj instanceof EthTypeCriterion) { | ||
| 602 | - EthTypeCriterion that = (EthTypeCriterion) obj; | ||
| 603 | - return Objects.equals(ethType, that.ethType) && | ||
| 604 | - Objects.equals(this.type(), that.type()); | ||
| 605 | - } | ||
| 606 | - return false; | ||
| 607 | - } | ||
| 608 | - } | ||
| 609 | - | ||
| 610 | - /** | ||
| 611 | - * Implementation of VLAN ID criterion. | ||
| 612 | - */ | ||
| 613 | - public static final class VlanIdCriterion implements Criterion { | ||
| 614 | - private final VlanId vlanId; | ||
| 615 | - | ||
| 616 | - /** | ||
| 617 | - * Constructor. | ||
| 618 | - * | ||
| 619 | - * @param vlanId the VLAN ID to match | ||
| 620 | - */ | ||
| 621 | - public VlanIdCriterion(VlanId vlanId) { | ||
| 622 | - this.vlanId = vlanId; | ||
| 623 | - } | ||
| 624 | - | ||
| 625 | - @Override | ||
| 626 | - public Type type() { | ||
| 627 | - return Type.VLAN_VID; | ||
| 628 | - } | ||
| 629 | - | ||
| 630 | - /** | ||
| 631 | - * Gets the VLAN ID to match. | ||
| 632 | - * | ||
| 633 | - * @return the VLAN ID to match | ||
| 634 | - */ | ||
| 635 | - public VlanId vlanId() { | ||
| 636 | - return vlanId; | ||
| 637 | - } | ||
| 638 | - | ||
| 639 | - @Override | ||
| 640 | - public String toString() { | ||
| 641 | - return toStringHelper(type().toString()) | ||
| 642 | - .add("vlanId", vlanId).toString(); | ||
| 643 | - } | ||
| 644 | - | ||
| 645 | - @Override | ||
| 646 | - public int hashCode() { | ||
| 647 | - return Objects.hash(type(), vlanId); | ||
| 648 | - } | ||
| 649 | - | ||
| 650 | - @Override | ||
| 651 | - public boolean equals(Object obj) { | ||
| 652 | - if (this == obj) { | ||
| 653 | - return true; | ||
| 654 | - } | ||
| 655 | - if (obj instanceof VlanIdCriterion) { | ||
| 656 | - VlanIdCriterion that = (VlanIdCriterion) obj; | ||
| 657 | - return Objects.equals(vlanId, that.vlanId) && | ||
| 658 | - Objects.equals(this.type(), that.type()); | ||
| 659 | - } | ||
| 660 | - return false; | ||
| 661 | - } | ||
| 662 | - } | ||
| 663 | - | ||
| 664 | - /** | ||
| 665 | - * Implementation of VLAN priority criterion (3 bits). | ||
| 666 | - */ | ||
| 667 | - public static final class VlanPcpCriterion implements Criterion { | ||
| 668 | - private static final byte MASK = 0x7; | ||
| 669 | - private final byte vlanPcp; // VLAN pcp value: 3 bits | ||
| 670 | - | ||
| 671 | - /** | ||
| 672 | - * Constructor. | ||
| 673 | - * | ||
| 674 | - * @param vlanPcp the VLAN priority to match (3 bits) | ||
| 675 | - */ | ||
| 676 | - public VlanPcpCriterion(byte vlanPcp) { | ||
| 677 | - this.vlanPcp = (byte) (vlanPcp & MASK); | ||
| 678 | - } | ||
| 679 | - | ||
| 680 | - @Override | ||
| 681 | - public Type type() { | ||
| 682 | - return Type.VLAN_PCP; | ||
| 683 | - } | ||
| 684 | - | ||
| 685 | - /** | ||
| 686 | - * Gets the VLAN priority to match. | ||
| 687 | - * | ||
| 688 | - * @return the VLAN priority to match (3 bits) | ||
| 689 | - */ | ||
| 690 | - public byte priority() { | ||
| 691 | - return vlanPcp; | ||
| 692 | - } | ||
| 693 | - | ||
| 694 | - @Override | ||
| 695 | - public String toString() { | ||
| 696 | - return toStringHelper(type().toString()) | ||
| 697 | - .add("priority", Long.toHexString(vlanPcp)).toString(); | ||
| 698 | - } | ||
| 699 | - | ||
| 700 | - @Override | ||
| 701 | - public int hashCode() { | ||
| 702 | - return Objects.hash(type(), vlanPcp); | ||
| 703 | - } | ||
| 704 | - | ||
| 705 | - @Override | ||
| 706 | - public boolean equals(Object obj) { | ||
| 707 | - if (this == obj) { | ||
| 708 | - return true; | ||
| 709 | - } | ||
| 710 | - if (obj instanceof VlanPcpCriterion) { | ||
| 711 | - VlanPcpCriterion that = (VlanPcpCriterion) obj; | ||
| 712 | - return Objects.equals(vlanPcp, that.vlanPcp) && | ||
| 713 | - Objects.equals(this.type(), that.type()); | ||
| 714 | - } | ||
| 715 | - return false; | ||
| 716 | - } | ||
| 717 | - } | ||
| 718 | - | ||
| 719 | - /** | ||
| 720 | - * Implementation of IP DSCP (Differentiated Services Code Point) | ||
| 721 | - * criterion (6 bits). | ||
| 722 | - */ | ||
| 723 | - public static final class IPDscpCriterion implements Criterion { | ||
| 724 | - private static final byte MASK = 0x3f; | ||
| 725 | - private final byte ipDscp; // IP DSCP value: 6 bits | ||
| 726 | - | ||
| 727 | - /** | ||
| 728 | - * Constructor. | ||
| 729 | - * | ||
| 730 | - * @param ipDscp the IP DSCP value to match | ||
| 731 | - */ | ||
| 732 | - public IPDscpCriterion(byte ipDscp) { | ||
| 733 | - this.ipDscp = (byte) (ipDscp & MASK); | ||
| 734 | - } | ||
| 735 | - | ||
| 736 | - @Override | ||
| 737 | - public Type type() { | ||
| 738 | - return Type.IP_DSCP; | ||
| 739 | - } | ||
| 740 | - | ||
| 741 | - /** | ||
| 742 | - * Gets the IP DSCP value to match. | ||
| 743 | - * | ||
| 744 | - * @return the IP DSCP value to match | ||
| 745 | - */ | ||
| 746 | - public byte ipDscp() { | ||
| 747 | - return ipDscp; | ||
| 748 | - } | ||
| 749 | - | ||
| 750 | - @Override | ||
| 751 | - public String toString() { | ||
| 752 | - return toStringHelper(type().toString()) | ||
| 753 | - .add("ipDscp", Long.toHexString(ipDscp)).toString(); | ||
| 754 | - } | ||
| 755 | - | ||
| 756 | - @Override | ||
| 757 | - public int hashCode() { | ||
| 758 | - return Objects.hash(type(), ipDscp); | ||
| 759 | - } | ||
| 760 | - | ||
| 761 | - @Override | ||
| 762 | - public boolean equals(Object obj) { | ||
| 763 | - if (this == obj) { | ||
| 764 | - return true; | ||
| 765 | - } | ||
| 766 | - if (obj instanceof IPDscpCriterion) { | ||
| 767 | - IPDscpCriterion that = (IPDscpCriterion) obj; | ||
| 768 | - return Objects.equals(ipDscp, that.ipDscp) && | ||
| 769 | - Objects.equals(this.type(), that.type()); | ||
| 770 | - } | ||
| 771 | - return false; | ||
| 772 | - } | ||
| 773 | - } | ||
| 774 | - | ||
| 775 | - /** | ||
| 776 | - * Implementation of IP ECN (Explicit Congestion Notification) criterion | ||
| 777 | - * (2 bits). | ||
| 778 | - */ | ||
| 779 | - public static final class IPEcnCriterion implements Criterion { | ||
| 780 | - private static final byte MASK = 0x3; | ||
| 781 | - private final byte ipEcn; // IP ECN value: 2 bits | ||
| 782 | - | ||
| 783 | - /** | ||
| 784 | - * Constructor. | ||
| 785 | - * | ||
| 786 | - * @param ipEcn the IP ECN value to match (2 bits) | ||
| 787 | - */ | ||
| 788 | - public IPEcnCriterion(byte ipEcn) { | ||
| 789 | - this.ipEcn = (byte) (ipEcn & MASK); | ||
| 790 | - } | ||
| 791 | - | ||
| 792 | - @Override | ||
| 793 | - public Type type() { | ||
| 794 | - return Type.IP_ECN; | ||
| 795 | - } | ||
| 796 | - | ||
| 797 | - /** | ||
| 798 | - * Gets the IP ECN value to match. | ||
| 799 | - * | ||
| 800 | - * @return the IP ECN value to match (2 bits) | ||
| 801 | - */ | ||
| 802 | - public byte ipEcn() { | ||
| 803 | - return ipEcn; | ||
| 804 | - } | ||
| 805 | - | ||
| 806 | - @Override | ||
| 807 | - public String toString() { | ||
| 808 | - return toStringHelper(type().toString()) | ||
| 809 | - .add("ipEcn", Long.toHexString(ipEcn)).toString(); | ||
| 810 | - } | ||
| 811 | - | ||
| 812 | - @Override | ||
| 813 | - public int hashCode() { | ||
| 814 | - return Objects.hash(type(), ipEcn); | ||
| 815 | - } | ||
| 816 | - | ||
| 817 | - @Override | ||
| 818 | - public boolean equals(Object obj) { | ||
| 819 | - if (this == obj) { | ||
| 820 | - return true; | ||
| 821 | - } | ||
| 822 | - if (obj instanceof IPEcnCriterion) { | ||
| 823 | - IPEcnCriterion that = (IPEcnCriterion) obj; | ||
| 824 | - return Objects.equals(ipEcn, that.ipEcn) && | ||
| 825 | - Objects.equals(this.type(), that.type()); | ||
| 826 | - } | ||
| 827 | - return false; | ||
| 828 | - } | ||
| 829 | - } | ||
| 830 | - | ||
| 831 | - /** | ||
| 832 | - * Implementation of Internet Protocol Number criterion (8 bits unsigned) | ||
| 833 | - * integer. | ||
| 834 | - */ | ||
| 835 | - public static final class IPProtocolCriterion implements Criterion { | ||
| 836 | - private static final short MASK = 0xff; | ||
| 837 | - private final short proto; // IP protocol number: 8 bits | ||
| 838 | - | ||
| 839 | - /** | ||
| 840 | - * Constructor. | ||
| 841 | - * | ||
| 842 | - * @param protocol the IP protocol (e.g., TCP=6, UDP=17) to match | ||
| 843 | - * (8 bits unsigned integer) | ||
| 844 | - */ | ||
| 845 | - public IPProtocolCriterion(short protocol) { | ||
| 846 | - this.proto = (short) (protocol & MASK); | ||
| 847 | - } | ||
| 848 | - | ||
| 849 | - @Override | ||
| 850 | - public Type type() { | ||
| 851 | - return Type.IP_PROTO; | ||
| 852 | - } | ||
| 853 | - | ||
| 854 | - /** | ||
| 855 | - * Gets the IP protocol to match. | ||
| 856 | - * | ||
| 857 | - * @return the IP protocol to match (8 bits unsigned integer) | ||
| 858 | - */ | ||
| 859 | - public short protocol() { | ||
| 860 | - return proto; | ||
| 861 | - } | ||
| 862 | - | ||
| 863 | - @Override | ||
| 864 | - public String toString() { | ||
| 865 | - return toStringHelper(type().toString()) | ||
| 866 | - .add("protocol", proto).toString(); | ||
| 867 | - } | ||
| 868 | - | ||
| 869 | - @Override | ||
| 870 | - public int hashCode() { | ||
| 871 | - return Objects.hash(type(), proto); | ||
| 872 | - } | ||
| 873 | - | ||
| 874 | - @Override | ||
| 875 | - public boolean equals(Object obj) { | ||
| 876 | - if (this == obj) { | ||
| 877 | - return true; | ||
| 878 | - } | ||
| 879 | - if (obj instanceof IPProtocolCriterion) { | ||
| 880 | - IPProtocolCriterion that = (IPProtocolCriterion) obj; | ||
| 881 | - return Objects.equals(proto, that.proto); | ||
| 882 | - } | ||
| 883 | - return false; | ||
| 884 | - } | ||
| 885 | - } | ||
| 886 | - | ||
| 887 | - /** | ||
| 888 | - * Implementation of IP address criterion. | ||
| 889 | - */ | ||
| 890 | - public static final class IPCriterion implements Criterion { | ||
| 891 | - private final IpPrefix ip; | ||
| 892 | - private final Type type; | ||
| 893 | - | ||
| 894 | - /** | ||
| 895 | - * Constructor. | ||
| 896 | - * | ||
| 897 | - * @param ip the IP prefix to match. Could be either IPv4 or IPv6 | ||
| 898 | - * @param type the match type. Should be one of the following: | ||
| 899 | - * Type.IPV4_SRC, Type.IPV4_DST, Type.IPV6_SRC, Type.IPV6_DST | ||
| 900 | - */ | ||
| 901 | - public IPCriterion(IpPrefix ip, Type type) { | ||
| 902 | - this.ip = ip; | ||
| 903 | - this.type = type; | ||
| 904 | - } | ||
| 905 | - | ||
| 906 | - @Override | ||
| 907 | - public Type type() { | ||
| 908 | - return this.type; | ||
| 909 | - } | ||
| 910 | - | ||
| 911 | - /** | ||
| 912 | - * Gets the IP prefix to match. | ||
| 913 | - * | ||
| 914 | - * @return the IP prefix to match | ||
| 915 | - */ | ||
| 916 | - public IpPrefix ip() { | ||
| 917 | - return this.ip; | ||
| 918 | - } | ||
| 919 | - | ||
| 920 | - @Override | ||
| 921 | - public String toString() { | ||
| 922 | - return toStringHelper(type().toString()) | ||
| 923 | - .add("ip", ip).toString(); | ||
| 924 | - } | ||
| 925 | - | ||
| 926 | - @Override | ||
| 927 | - public int hashCode() { | ||
| 928 | - return Objects.hash(type, ip); | ||
| 929 | - } | ||
| 930 | - | ||
| 931 | - @Override | ||
| 932 | - public boolean equals(Object obj) { | ||
| 933 | - if (this == obj) { | ||
| 934 | - return true; | ||
| 935 | - } | ||
| 936 | - if (obj instanceof IPCriterion) { | ||
| 937 | - IPCriterion that = (IPCriterion) obj; | ||
| 938 | - return Objects.equals(ip, that.ip) && | ||
| 939 | - Objects.equals(type, that.type); | ||
| 940 | - } | ||
| 941 | - return false; | ||
| 942 | - } | ||
| 943 | - } | ||
| 944 | - | ||
| 945 | - /** | ||
| 946 | - * Implementation of TCP port criterion (16 bits unsigned integer). | ||
| 947 | - */ | ||
| 948 | - public static final class TcpPortCriterion implements Criterion { | ||
| 949 | - private static final int MASK = 0xffff; | ||
| 950 | - private final int tcpPort; // Port value: 16 bits | ||
| 951 | - private final Type type; | ||
| 952 | - | ||
| 953 | - /** | ||
| 954 | - * Constructor. | ||
| 955 | - * | ||
| 956 | - * @param tcpPort the TCP port to match (16 bits unsigned integer) | ||
| 957 | - * @param type the match type. Should be either Type.TCP_SRC or | ||
| 958 | - * Type.TCP_DST | ||
| 959 | - */ | ||
| 960 | - public TcpPortCriterion(int tcpPort, Type type) { | ||
| 961 | - this.tcpPort = tcpPort & MASK; | ||
| 962 | - this.type = type; | ||
| 963 | - } | ||
| 964 | - | ||
| 965 | - @Override | ||
| 966 | - public Type type() { | ||
| 967 | - return this.type; | ||
| 968 | - } | ||
| 969 | - | ||
| 970 | - /** | ||
| 971 | - * Gets the TCP port to match. | ||
| 972 | - * | ||
| 973 | - * @return the TCP port to match (16 bits unsigned integer) | ||
| 974 | - */ | ||
| 975 | - public int tcpPort() { | ||
| 976 | - return this.tcpPort; | ||
| 977 | - } | ||
| 978 | - | ||
| 979 | - @Override | ||
| 980 | - public String toString() { | ||
| 981 | - return toStringHelper(type().toString()) | ||
| 982 | - .add("tcpPort", tcpPort).toString(); | ||
| 983 | - } | ||
| 984 | - | ||
| 985 | - @Override | ||
| 986 | - public int hashCode() { | ||
| 987 | - return Objects.hash(type, tcpPort); | ||
| 988 | - } | ||
| 989 | - | ||
| 990 | - @Override | ||
| 991 | - public boolean equals(Object obj) { | ||
| 992 | - if (this == obj) { | ||
| 993 | - return true; | ||
| 994 | - } | ||
| 995 | - if (obj instanceof TcpPortCriterion) { | ||
| 996 | - TcpPortCriterion that = (TcpPortCriterion) obj; | ||
| 997 | - return Objects.equals(tcpPort, that.tcpPort) && | ||
| 998 | - Objects.equals(type, that.type); | ||
| 999 | - } | ||
| 1000 | - return false; | ||
| 1001 | - } | ||
| 1002 | - } | ||
| 1003 | - | ||
| 1004 | - /** | ||
| 1005 | - * Implementation of UDP port criterion (16 bits unsigned integer). | ||
| 1006 | - */ | ||
| 1007 | - public static final class UdpPortCriterion implements Criterion { | ||
| 1008 | - private static final int MASK = 0xffff; | ||
| 1009 | - private final int udpPort; // Port value: 16 bits | ||
| 1010 | - private final Type type; | ||
| 1011 | - | ||
| 1012 | - /** | ||
| 1013 | - * Constructor. | ||
| 1014 | - * | ||
| 1015 | - * @param udpPort the UDP port to match (16 bits unsigned integer) | ||
| 1016 | - * @param type the match type. Should be either Type.UDP_SRC or | ||
| 1017 | - * Type.UDP_DST | ||
| 1018 | - */ | ||
| 1019 | - public UdpPortCriterion(int udpPort, Type type) { | ||
| 1020 | - this.udpPort = udpPort & MASK; | ||
| 1021 | - this.type = type; | ||
| 1022 | - } | ||
| 1023 | - | ||
| 1024 | - @Override | ||
| 1025 | - public Type type() { | ||
| 1026 | - return this.type; | ||
| 1027 | - } | ||
| 1028 | - | ||
| 1029 | - /** | ||
| 1030 | - * Gets the UDP port to match. | ||
| 1031 | - * | ||
| 1032 | - * @return the UDP port to match (16 bits unsigned integer) | ||
| 1033 | - */ | ||
| 1034 | - public int udpPort() { | ||
| 1035 | - return this.udpPort; | ||
| 1036 | - } | ||
| 1037 | - | ||
| 1038 | - @Override | ||
| 1039 | - public String toString() { | ||
| 1040 | - return toStringHelper(type().toString()) | ||
| 1041 | - .add("udpPort", udpPort).toString(); | ||
| 1042 | - } | ||
| 1043 | - | ||
| 1044 | - @Override | ||
| 1045 | - public int hashCode() { | ||
| 1046 | - return Objects.hash(type, udpPort); | ||
| 1047 | - } | ||
| 1048 | - | ||
| 1049 | - @Override | ||
| 1050 | - public boolean equals(Object obj) { | ||
| 1051 | - if (this == obj) { | ||
| 1052 | - return true; | ||
| 1053 | - } | ||
| 1054 | - if (obj instanceof UdpPortCriterion) { | ||
| 1055 | - UdpPortCriterion that = (UdpPortCriterion) obj; | ||
| 1056 | - return Objects.equals(udpPort, that.udpPort) && | ||
| 1057 | - Objects.equals(type, that.type); | ||
| 1058 | - } | ||
| 1059 | - return false; | ||
| 1060 | - } | ||
| 1061 | - } | ||
| 1062 | - | ||
| 1063 | - /** | ||
| 1064 | - * Implementation of SCTP port criterion (16 bits unsigned integer). | ||
| 1065 | - */ | ||
| 1066 | - public static final class SctpPortCriterion implements Criterion { | ||
| 1067 | - private static final int MASK = 0xffff; | ||
| 1068 | - private final int sctpPort; // Port value: 16 bits | ||
| 1069 | - private final Type type; | ||
| 1070 | - | ||
| 1071 | - /** | ||
| 1072 | - * Constructor. | ||
| 1073 | - * | ||
| 1074 | - * @param sctpPort the SCTP port to match (16 bits unsigned integer) | ||
| 1075 | - * @param type the match type. Should be either Type.SCTP_SRC or | ||
| 1076 | - * Type.SCTP_DST | ||
| 1077 | - */ | ||
| 1078 | - public SctpPortCriterion(int sctpPort, Type type) { | ||
| 1079 | - this.sctpPort = sctpPort & MASK; | ||
| 1080 | - this.type = type; | ||
| 1081 | - } | ||
| 1082 | - | ||
| 1083 | - @Override | ||
| 1084 | - public Type type() { | ||
| 1085 | - return this.type; | ||
| 1086 | - } | ||
| 1087 | - | ||
| 1088 | - /** | ||
| 1089 | - * Gets the SCTP port to match. | ||
| 1090 | - * | ||
| 1091 | - * @return the SCTP port to match (16 bits unsigned integer) | ||
| 1092 | - */ | ||
| 1093 | - public int sctpPort() { | ||
| 1094 | - return this.sctpPort; | ||
| 1095 | - } | ||
| 1096 | - | ||
| 1097 | - @Override | ||
| 1098 | - public String toString() { | ||
| 1099 | - return toStringHelper(type().toString()) | ||
| 1100 | - .add("sctpPort", sctpPort).toString(); | ||
| 1101 | - } | ||
| 1102 | - | ||
| 1103 | - @Override | ||
| 1104 | - public int hashCode() { | ||
| 1105 | - return Objects.hash(type, sctpPort); | ||
| 1106 | - } | ||
| 1107 | - | ||
| 1108 | - @Override | ||
| 1109 | - public boolean equals(Object obj) { | ||
| 1110 | - if (this == obj) { | ||
| 1111 | - return true; | ||
| 1112 | - } | ||
| 1113 | - if (obj instanceof SctpPortCriterion) { | ||
| 1114 | - SctpPortCriterion that = (SctpPortCriterion) obj; | ||
| 1115 | - return Objects.equals(sctpPort, that.sctpPort) && | ||
| 1116 | - Objects.equals(type, that.type); | ||
| 1117 | - } | ||
| 1118 | - return false; | ||
| 1119 | - } | ||
| 1120 | - } | ||
| 1121 | - | ||
| 1122 | - /** | ||
| 1123 | - * Implementation of ICMP type criterion (8 bits unsigned integer). | ||
| 1124 | - */ | ||
| 1125 | - public static final class IcmpTypeCriterion implements Criterion { | ||
| 1126 | - private static final short MASK = 0xff; | ||
| 1127 | - private final short icmpType; // The ICMP type: 8 bits | ||
| 1128 | - | ||
| 1129 | - /** | ||
| 1130 | - * Constructor. | ||
| 1131 | - * | ||
| 1132 | - * @param icmpType the ICMP type to match (8 bits unsigned integer) | ||
| 1133 | - */ | ||
| 1134 | - public IcmpTypeCriterion(short icmpType) { | ||
| 1135 | - this.icmpType = (short) (icmpType & MASK); | ||
| 1136 | - } | ||
| 1137 | - | ||
| 1138 | - @Override | ||
| 1139 | - public Type type() { | ||
| 1140 | - return Type.ICMPV4_TYPE; | ||
| 1141 | - } | ||
| 1142 | - | ||
| 1143 | - /** | ||
| 1144 | - * Gets the ICMP type to match. | ||
| 1145 | - * | ||
| 1146 | - * @return the ICMP type to match (8 bits unsigned integer) | ||
| 1147 | - */ | ||
| 1148 | - public short icmpType() { | ||
| 1149 | - return icmpType; | ||
| 1150 | - } | ||
| 1151 | - | ||
| 1152 | - @Override | ||
| 1153 | - public String toString() { | ||
| 1154 | - return toStringHelper(type().toString()) | ||
| 1155 | - .add("icmpType", icmpType).toString(); | ||
| 1156 | - } | ||
| 1157 | - | ||
| 1158 | - @Override | ||
| 1159 | - public int hashCode() { | ||
| 1160 | - return Objects.hash(type(), icmpType); | ||
| 1161 | - } | ||
| 1162 | - | ||
| 1163 | - @Override | ||
| 1164 | - public boolean equals(Object obj) { | ||
| 1165 | - if (this == obj) { | ||
| 1166 | - return true; | ||
| 1167 | - } | ||
| 1168 | - if (obj instanceof IcmpTypeCriterion) { | ||
| 1169 | - IcmpTypeCriterion that = (IcmpTypeCriterion) obj; | ||
| 1170 | - return Objects.equals(icmpType, that.icmpType) && | ||
| 1171 | - Objects.equals(this.type(), that.type()); | ||
| 1172 | - } | ||
| 1173 | - return false; | ||
| 1174 | - } | ||
| 1175 | - } | ||
| 1176 | - | ||
| 1177 | - /** | ||
| 1178 | - * Implementation of ICMP code criterion (8 bits unsigned integer). | ||
| 1179 | - */ | ||
| 1180 | - public static final class IcmpCodeCriterion implements Criterion { | ||
| 1181 | - private static final short MASK = 0xff; | ||
| 1182 | - private final short icmpCode; // The ICMP code: 8 bits | ||
| 1183 | - | ||
| 1184 | - /** | ||
| 1185 | - * Constructor. | ||
| 1186 | - * | ||
| 1187 | - * @param icmpCode the ICMP code to match (8 bits unsigned integer) | ||
| 1188 | - */ | ||
| 1189 | - public IcmpCodeCriterion(short icmpCode) { | ||
| 1190 | - this.icmpCode = (short) (icmpCode & MASK); | ||
| 1191 | - } | ||
| 1192 | - | ||
| 1193 | - @Override | ||
| 1194 | - public Type type() { | ||
| 1195 | - return Type.ICMPV4_CODE; | ||
| 1196 | - } | ||
| 1197 | - | ||
| 1198 | - /** | ||
| 1199 | - * Gets the ICMP code to match. | ||
| 1200 | - * | ||
| 1201 | - * @return the ICMP code to match (8 bits unsigned integer) | ||
| 1202 | - */ | ||
| 1203 | - public short icmpCode() { | ||
| 1204 | - return icmpCode; | ||
| 1205 | - } | ||
| 1206 | - | ||
| 1207 | - @Override | ||
| 1208 | - public String toString() { | ||
| 1209 | - return toStringHelper(type().toString()) | ||
| 1210 | - .add("icmpCode", icmpCode).toString(); | ||
| 1211 | - } | ||
| 1212 | - | ||
| 1213 | - @Override | ||
| 1214 | - public int hashCode() { | ||
| 1215 | - return Objects.hash(type(), icmpCode); | ||
| 1216 | - } | ||
| 1217 | - | ||
| 1218 | - @Override | ||
| 1219 | - public boolean equals(Object obj) { | ||
| 1220 | - if (this == obj) { | ||
| 1221 | - return true; | ||
| 1222 | - } | ||
| 1223 | - if (obj instanceof IcmpCodeCriterion) { | ||
| 1224 | - IcmpCodeCriterion that = (IcmpCodeCriterion) obj; | ||
| 1225 | - return Objects.equals(icmpCode, that.icmpCode) && | ||
| 1226 | - Objects.equals(this.type(), that.type()); | ||
| 1227 | - } | ||
| 1228 | - return false; | ||
| 1229 | - } | ||
| 1230 | - } | ||
| 1231 | - | ||
| 1232 | - /** | ||
| 1233 | - * Implementation of IPv6 Flow Label (RFC 6437) criterion (20 bits unsigned | ||
| 1234 | - * integer). | ||
| 1235 | - */ | ||
| 1236 | - public static final class IPv6FlowLabelCriterion implements Criterion { | ||
| 1237 | - private static final int MASK = 0xfffff; | ||
| 1238 | - private final int flowLabel; // IPv6 flow label: 20 bits | ||
| 1239 | - | ||
| 1240 | - /** | ||
| 1241 | - * Constructor. | ||
| 1242 | - * | ||
| 1243 | - * @param flowLabel the IPv6 flow label to match (20 bits) | ||
| 1244 | - */ | ||
| 1245 | - public IPv6FlowLabelCriterion(int flowLabel) { | ||
| 1246 | - this.flowLabel = flowLabel & MASK; | ||
| 1247 | - } | ||
| 1248 | - | ||
| 1249 | - @Override | ||
| 1250 | - public Type type() { | ||
| 1251 | - return Type.IPV6_FLABEL; | ||
| 1252 | - } | ||
| 1253 | - | ||
| 1254 | - /** | ||
| 1255 | - * Gets the IPv6 flow label to match. | ||
| 1256 | - * | ||
| 1257 | - * @return the IPv6 flow label to match (20 bits) | ||
| 1258 | - */ | ||
| 1259 | - public int flowLabel() { | ||
| 1260 | - return flowLabel; | ||
| 1261 | - } | ||
| 1262 | - | ||
| 1263 | - @Override | ||
| 1264 | - public String toString() { | ||
| 1265 | - return toStringHelper(type().toString()) | ||
| 1266 | - .add("flowLabel", Long.toHexString(flowLabel)).toString(); | ||
| 1267 | - } | ||
| 1268 | - | ||
| 1269 | - @Override | ||
| 1270 | - public int hashCode() { | ||
| 1271 | - return Objects.hash(type(), flowLabel); | ||
| 1272 | - } | ||
| 1273 | - | ||
| 1274 | - @Override | ||
| 1275 | - public boolean equals(Object obj) { | ||
| 1276 | - if (this == obj) { | ||
| 1277 | - return true; | ||
| 1278 | - } | ||
| 1279 | - if (obj instanceof IPv6FlowLabelCriterion) { | ||
| 1280 | - IPv6FlowLabelCriterion that = (IPv6FlowLabelCriterion) obj; | ||
| 1281 | - return Objects.equals(flowLabel, that.flowLabel) && | ||
| 1282 | - Objects.equals(this.type(), that.type()); | ||
| 1283 | - } | ||
| 1284 | - return false; | ||
| 1285 | - } | ||
| 1286 | - } | ||
| 1287 | - | ||
| 1288 | - /** | ||
| 1289 | - * Implementation of ICMPv6 type criterion (8 bits unsigned integer). | ||
| 1290 | - */ | ||
| 1291 | - public static final class Icmpv6TypeCriterion implements Criterion { | ||
| 1292 | - private static final short MASK = 0xff; | ||
| 1293 | - private final short icmpv6Type; // ICMPv6 type: 8 bits | ||
| 1294 | - | ||
| 1295 | - /** | ||
| 1296 | - * Constructor. | ||
| 1297 | - * | ||
| 1298 | - * @param icmpv6Type the ICMPv6 type to match (8 bits unsigned integer) | ||
| 1299 | - */ | ||
| 1300 | - public Icmpv6TypeCriterion(short icmpv6Type) { | ||
| 1301 | - this.icmpv6Type = (short) (icmpv6Type & MASK); | ||
| 1302 | - } | ||
| 1303 | - | ||
| 1304 | - @Override | ||
| 1305 | - public Type type() { | ||
| 1306 | - return Type.ICMPV6_TYPE; | ||
| 1307 | - } | ||
| 1308 | - | ||
| 1309 | - /** | ||
| 1310 | - * Gets the ICMPv6 type to match. | ||
| 1311 | - * | ||
| 1312 | - * @return the ICMPv6 type to match (8 bits unsigned integer) | ||
| 1313 | - */ | ||
| 1314 | - public short icmpv6Type() { | ||
| 1315 | - return icmpv6Type; | ||
| 1316 | - } | ||
| 1317 | - | ||
| 1318 | - @Override | ||
| 1319 | - public String toString() { | ||
| 1320 | - return toStringHelper(type().toString()) | ||
| 1321 | - .add("icmpv6Type", icmpv6Type).toString(); | ||
| 1322 | - } | ||
| 1323 | - | ||
| 1324 | - @Override | ||
| 1325 | - public int hashCode() { | ||
| 1326 | - return Objects.hash(type(), icmpv6Type); | ||
| 1327 | - } | ||
| 1328 | - | ||
| 1329 | - @Override | ||
| 1330 | - public boolean equals(Object obj) { | ||
| 1331 | - if (this == obj) { | ||
| 1332 | - return true; | ||
| 1333 | - } | ||
| 1334 | - if (obj instanceof Icmpv6TypeCriterion) { | ||
| 1335 | - Icmpv6TypeCriterion that = (Icmpv6TypeCriterion) obj; | ||
| 1336 | - return Objects.equals(icmpv6Type, that.icmpv6Type) && | ||
| 1337 | - Objects.equals(this.type(), that.type()); | ||
| 1338 | - } | ||
| 1339 | - return false; | ||
| 1340 | - } | ||
| 1341 | - } | ||
| 1342 | - | ||
| 1343 | - /** | ||
| 1344 | - * Implementation of ICMPv6 code criterion (8 bits unsigned integer). | ||
| 1345 | - */ | ||
| 1346 | - public static final class Icmpv6CodeCriterion implements Criterion { | ||
| 1347 | - private static final short MASK = 0xff; | ||
| 1348 | - private final short icmpv6Code; // ICMPv6 code: 8 bits | ||
| 1349 | - | ||
| 1350 | - /** | ||
| 1351 | - * Constructor. | ||
| 1352 | - * | ||
| 1353 | - * @param icmpv6Code the ICMPv6 code to match (8 bits unsigned integer) | ||
| 1354 | - */ | ||
| 1355 | - public Icmpv6CodeCriterion(short icmpv6Code) { | ||
| 1356 | - this.icmpv6Code = (short) (icmpv6Code & MASK); | ||
| 1357 | - } | ||
| 1358 | - | ||
| 1359 | - @Override | ||
| 1360 | - public Type type() { | ||
| 1361 | - return Type.ICMPV6_CODE; | ||
| 1362 | - } | ||
| 1363 | - | ||
| 1364 | - /** | ||
| 1365 | - * Gets the ICMPv6 code to match. | ||
| 1366 | - * | ||
| 1367 | - * @return the ICMPv6 code to match (8 bits unsigned integer) | ||
| 1368 | - */ | ||
| 1369 | - public short icmpv6Code() { | ||
| 1370 | - return icmpv6Code; | ||
| 1371 | - } | ||
| 1372 | - | ||
| 1373 | - @Override | ||
| 1374 | - public String toString() { | ||
| 1375 | - return toStringHelper(type().toString()) | ||
| 1376 | - .add("icmpv6Code", icmpv6Code).toString(); | ||
| 1377 | - } | ||
| 1378 | - | ||
| 1379 | - @Override | ||
| 1380 | - public int hashCode() { | ||
| 1381 | - return Objects.hash(type(), icmpv6Code); | ||
| 1382 | - } | ||
| 1383 | - | ||
| 1384 | - @Override | ||
| 1385 | - public boolean equals(Object obj) { | ||
| 1386 | - if (this == obj) { | ||
| 1387 | - return true; | ||
| 1388 | - } | ||
| 1389 | - if (obj instanceof Icmpv6CodeCriterion) { | ||
| 1390 | - Icmpv6CodeCriterion that = (Icmpv6CodeCriterion) obj; | ||
| 1391 | - return Objects.equals(icmpv6Code, that.icmpv6Code) && | ||
| 1392 | - Objects.equals(this.type(), that.type()); | ||
| 1393 | - } | ||
| 1394 | - return false; | ||
| 1395 | - } | ||
| 1396 | - } | ||
| 1397 | - | ||
| 1398 | - /** | ||
| 1399 | - * Implementation of IPv6 Neighbor Discovery target address criterion. | ||
| 1400 | - */ | ||
| 1401 | - public static final class IPv6NDTargetAddressCriterion | ||
| 1402 | - implements Criterion { | ||
| 1403 | - private final Ip6Address targetAddress; | ||
| 1404 | - | ||
| 1405 | - /** | ||
| 1406 | - * Constructor. | ||
| 1407 | - * | ||
| 1408 | - * @param targetAddress the IPv6 target address to match | ||
| 1409 | - */ | ||
| 1410 | - public IPv6NDTargetAddressCriterion(Ip6Address targetAddress) { | ||
| 1411 | - this.targetAddress = targetAddress; | ||
| 1412 | - } | ||
| 1413 | - | ||
| 1414 | - @Override | ||
| 1415 | - public Type type() { | ||
| 1416 | - return Type.IPV6_ND_TARGET; | ||
| 1417 | - } | ||
| 1418 | - | ||
| 1419 | - /** | ||
| 1420 | - * Gets the IPv6 target address to match. | ||
| 1421 | - * | ||
| 1422 | - * @return the IPv6 target address to match | ||
| 1423 | - */ | ||
| 1424 | - public Ip6Address targetAddress() { | ||
| 1425 | - return this.targetAddress; | ||
| 1426 | - } | ||
| 1427 | - | ||
| 1428 | - @Override | ||
| 1429 | - public String toString() { | ||
| 1430 | - return toStringHelper(type().toString()) | ||
| 1431 | - .add("targetAddress", targetAddress).toString(); | ||
| 1432 | - } | ||
| 1433 | - | ||
| 1434 | - @Override | ||
| 1435 | - public int hashCode() { | ||
| 1436 | - return Objects.hash(type(), targetAddress); | ||
| 1437 | - } | ||
| 1438 | - | ||
| 1439 | - @Override | ||
| 1440 | - public boolean equals(Object obj) { | ||
| 1441 | - if (this == obj) { | ||
| 1442 | - return true; | ||
| 1443 | - } | ||
| 1444 | - if (obj instanceof IPv6NDTargetAddressCriterion) { | ||
| 1445 | - IPv6NDTargetAddressCriterion that = | ||
| 1446 | - (IPv6NDTargetAddressCriterion) obj; | ||
| 1447 | - return Objects.equals(targetAddress, that.targetAddress) && | ||
| 1448 | - Objects.equals(type(), that.type()); | ||
| 1449 | - } | ||
| 1450 | - return false; | ||
| 1451 | - } | ||
| 1452 | - } | ||
| 1453 | - | ||
| 1454 | - /** | ||
| 1455 | - * Implementation of IPv6 Neighbor Discovery link-layer address criterion. | ||
| 1456 | - */ | ||
| 1457 | - public static final class IPv6NDLinkLayerAddressCriterion | ||
| 1458 | - implements Criterion { | ||
| 1459 | - private final MacAddress mac; | ||
| 1460 | - private final Type type; | ||
| 1461 | - | ||
| 1462 | - /** | ||
| 1463 | - * Constructor. | ||
| 1464 | - * | ||
| 1465 | - * @param mac the source or destination link-layer address to match | ||
| 1466 | - * @param type the match type. Should be either Type.IPV6_ND_SLL or | ||
| 1467 | - * Type.IPV6_ND_TLL | ||
| 1468 | - */ | ||
| 1469 | - public IPv6NDLinkLayerAddressCriterion(MacAddress mac, Type type) { | ||
| 1470 | - this.mac = mac; | ||
| 1471 | - this.type = type; | ||
| 1472 | - } | ||
| 1473 | - | ||
| 1474 | - @Override | ||
| 1475 | - public Type type() { | ||
| 1476 | - return this.type; | ||
| 1477 | - } | ||
| 1478 | - | ||
| 1479 | - /** | ||
| 1480 | - * Gets the MAC link-layer address to match. | ||
| 1481 | - * | ||
| 1482 | - * @return the MAC link-layer address to match | ||
| 1483 | - */ | ||
| 1484 | - public MacAddress mac() { | ||
| 1485 | - return this.mac; | ||
| 1486 | - } | ||
| 1487 | - | ||
| 1488 | - @Override | ||
| 1489 | - public String toString() { | ||
| 1490 | - return toStringHelper(type().toString()) | ||
| 1491 | - .add("mac", mac).toString(); | ||
| 1492 | - } | ||
| 1493 | - | ||
| 1494 | - @Override | ||
| 1495 | - public int hashCode() { | ||
| 1496 | - return Objects.hash(type, mac); | ||
| 1497 | - } | ||
| 1498 | - | ||
| 1499 | - @Override | ||
| 1500 | - public boolean equals(Object obj) { | ||
| 1501 | - if (this == obj) { | ||
| 1502 | - return true; | ||
| 1503 | - } | ||
| 1504 | - if (obj instanceof IPv6NDLinkLayerAddressCriterion) { | ||
| 1505 | - IPv6NDLinkLayerAddressCriterion that = | ||
| 1506 | - (IPv6NDLinkLayerAddressCriterion) obj; | ||
| 1507 | - return Objects.equals(mac, that.mac) && | ||
| 1508 | - Objects.equals(type, that.type); | ||
| 1509 | - } | ||
| 1510 | - return false; | ||
| 1511 | - } | ||
| 1512 | - } | ||
| 1513 | - | ||
| 1514 | - /** | ||
| 1515 | - * Implementation of MPLS tag criterion (20 bits). | ||
| 1516 | - */ | ||
| 1517 | - public static final class MplsCriterion implements Criterion { | ||
| 1518 | - private static final int MASK = 0xfffff; | ||
| 1519 | - private final MplsLabel mplsLabel; | ||
| 1520 | - | ||
| 1521 | - public MplsCriterion(MplsLabel mplsLabel) { | ||
| 1522 | - this.mplsLabel = mplsLabel; | ||
| 1523 | - } | ||
| 1524 | - | ||
| 1525 | - @Override | ||
| 1526 | - public Type type() { | ||
| 1527 | - return Type.MPLS_LABEL; | ||
| 1528 | - } | ||
| 1529 | - | ||
| 1530 | - public MplsLabel label() { | ||
| 1531 | - return mplsLabel; | ||
| 1532 | - } | ||
| 1533 | - | ||
| 1534 | - @Override | ||
| 1535 | - public String toString() { | ||
| 1536 | - return toStringHelper(type().toString()) | ||
| 1537 | - .add("mpls", mplsLabel).toString(); | ||
| 1538 | - } | ||
| 1539 | - | ||
| 1540 | - @Override | ||
| 1541 | - public int hashCode() { | ||
| 1542 | - return Objects.hash(type(), mplsLabel); | ||
| 1543 | - } | ||
| 1544 | - | ||
| 1545 | - @Override | ||
| 1546 | - public boolean equals(Object obj) { | ||
| 1547 | - if (this == obj) { | ||
| 1548 | - return true; | ||
| 1549 | - } | ||
| 1550 | - if (obj instanceof MplsCriterion) { | ||
| 1551 | - MplsCriterion that = (MplsCriterion) obj; | ||
| 1552 | - return Objects.equals(mplsLabel, that.mplsLabel) && | ||
| 1553 | - Objects.equals(this.type(), that.type()); | ||
| 1554 | - } | ||
| 1555 | - return false; | ||
| 1556 | - } | ||
| 1557 | - } | ||
| 1558 | - | ||
| 1559 | - /** | ||
| 1560 | - * Implementation of IPv6 Extension Header pseudo-field criterion | ||
| 1561 | - * (16 bits). Those are defined in Criterion.IPv6ExthdrFlags. | ||
| 1562 | - */ | ||
| 1563 | - public static final class IPv6ExthdrFlagsCriterion implements Criterion { | ||
| 1564 | - private static final int MASK = 0xffff; | ||
| 1565 | - private final int exthdrFlags; // IPv6 Exthdr flags: 16 bits | ||
| 1566 | - | ||
| 1567 | - /** | ||
| 1568 | - * Constructor. | ||
| 1569 | - * | ||
| 1570 | - * @param exthdrFlags the IPv6 Extension Header pseudo-field flags | ||
| 1571 | - * to match (16 bits). Those are defined in Criterion.IPv6ExthdrFlags | ||
| 1572 | - */ | ||
| 1573 | - public IPv6ExthdrFlagsCriterion(int exthdrFlags) { | ||
| 1574 | - this.exthdrFlags = exthdrFlags & MASK; | ||
| 1575 | - } | ||
| 1576 | - | ||
| 1577 | - @Override | ||
| 1578 | - public Type type() { | ||
| 1579 | - return Type.IPV6_EXTHDR; | ||
| 1580 | - } | ||
| 1581 | - | ||
| 1582 | - /** | ||
| 1583 | - * Gets the IPv6 Extension Header pseudo-field flags to match. | ||
| 1584 | - * | ||
| 1585 | - * @return the IPv6 Extension Header pseudo-field flags to match | ||
| 1586 | - * (16 bits). Those are defined in Criterion.IPv6ExthdrFlags | ||
| 1587 | - */ | ||
| 1588 | - public int exthdrFlags() { | ||
| 1589 | - return exthdrFlags; | ||
| 1590 | - } | ||
| 1591 | - | ||
| 1592 | - @Override | ||
| 1593 | - public String toString() { | ||
| 1594 | - return toStringHelper(type().toString()) | ||
| 1595 | - .add("exthdrFlags", Long.toHexString(exthdrFlags)).toString(); | ||
| 1596 | - } | ||
| 1597 | - | ||
| 1598 | - @Override | ||
| 1599 | - public int hashCode() { | ||
| 1600 | - return Objects.hash(type(), exthdrFlags); | ||
| 1601 | - } | ||
| 1602 | - | ||
| 1603 | - @Override | ||
| 1604 | - public boolean equals(Object obj) { | ||
| 1605 | - if (this == obj) { | ||
| 1606 | - return true; | ||
| 1607 | - } | ||
| 1608 | - if (obj instanceof IPv6ExthdrFlagsCriterion) { | ||
| 1609 | - IPv6ExthdrFlagsCriterion that = (IPv6ExthdrFlagsCriterion) obj; | ||
| 1610 | - return Objects.equals(exthdrFlags, that.exthdrFlags) && | ||
| 1611 | - Objects.equals(this.type(), that.type()); | ||
| 1612 | - } | ||
| 1613 | - return false; | ||
| 1614 | - } | ||
| 1615 | - } | ||
| 1616 | - | ||
| 1617 | - /** | ||
| 1618 | - * Implementation of lambda (wavelength) criterion (16 bits unsigned | ||
| 1619 | - * integer). | ||
| 1620 | - */ | ||
| 1621 | - public static final class LambdaCriterion implements Criterion { | ||
| 1622 | - private static final int MASK = 0xffff; | ||
| 1623 | - private final int lambda; // Lambda value: 16 bits | ||
| 1624 | - private final Type type; | ||
| 1625 | - | ||
| 1626 | - /** | ||
| 1627 | - * Constructor. | ||
| 1628 | - * | ||
| 1629 | - * @param lambda the lambda (wavelength) to match (16 bits unsigned | ||
| 1630 | - * integer) | ||
| 1631 | - * @param type the match type. Should be Type.OCH_SIGID | ||
| 1632 | - */ | ||
| 1633 | - public LambdaCriterion(int lambda, Type type) { | ||
| 1634 | - this.lambda = lambda & MASK; | ||
| 1635 | - this.type = type; | ||
| 1636 | - } | ||
| 1637 | - | ||
| 1638 | - @Override | ||
| 1639 | - public Type type() { | ||
| 1640 | - return this.type; | ||
| 1641 | - } | ||
| 1642 | - | ||
| 1643 | - /** | ||
| 1644 | - * Gets the lambda (wavelength) to match. | ||
| 1645 | - * | ||
| 1646 | - * @return the lambda (wavelength) to match (16 bits unsigned integer) | ||
| 1647 | - */ | ||
| 1648 | - public int lambda() { | ||
| 1649 | - return lambda; | ||
| 1650 | - } | ||
| 1651 | - | ||
| 1652 | - @Override | ||
| 1653 | - public String toString() { | ||
| 1654 | - return toStringHelper(type().toString()) | ||
| 1655 | - .add("lambda", lambda).toString(); | ||
| 1656 | - } | ||
| 1657 | - | ||
| 1658 | - @Override | ||
| 1659 | - public int hashCode() { | ||
| 1660 | - return Objects.hash(type, lambda); | ||
| 1661 | - } | ||
| 1662 | - | ||
| 1663 | - @Override | ||
| 1664 | - public boolean equals(Object obj) { | ||
| 1665 | - if (this == obj) { | ||
| 1666 | - return true; | ||
| 1667 | - } | ||
| 1668 | - if (obj instanceof LambdaCriterion) { | ||
| 1669 | - LambdaCriterion that = (LambdaCriterion) obj; | ||
| 1670 | - return Objects.equals(lambda, that.lambda) && | ||
| 1671 | - Objects.equals(type, that.type); | ||
| 1672 | - } | ||
| 1673 | - return false; | ||
| 1674 | - } | ||
| 1675 | - } | ||
| 1676 | - | ||
| 1677 | - /** | ||
| 1678 | - * Implementation of optical signal type criterion (8 bits unsigned | ||
| 1679 | - * integer). | ||
| 1680 | - */ | ||
| 1681 | - public static final class OpticalSignalTypeCriterion implements Criterion { | ||
| 1682 | - private static final short MASK = 0xff; | ||
| 1683 | - private final short signalType; // Signal type value: 8 bits | ||
| 1684 | - private final Type type; | ||
| 1685 | - | ||
| 1686 | - /** | ||
| 1687 | - * Constructor. | ||
| 1688 | - * | ||
| 1689 | - * @param signalType the optical signal type to match (8 bits unsigned | ||
| 1690 | - * integer) | ||
| 1691 | - * @param type the match type. Should be Type.OCH_SIGTYPE | ||
| 1692 | - */ | ||
| 1693 | - public OpticalSignalTypeCriterion(short signalType, Type type) { | ||
| 1694 | - this.signalType = (short) (signalType & MASK); | ||
| 1695 | - this.type = type; | ||
| 1696 | - } | ||
| 1697 | - | ||
| 1698 | - @Override | ||
| 1699 | - public Type type() { | ||
| 1700 | - return this.type; | ||
| 1701 | - } | ||
| 1702 | - | ||
| 1703 | - /** | ||
| 1704 | - * Gets the optical signal type to match. | ||
| 1705 | - * | ||
| 1706 | - * @return the optical signal type to match (8 bits unsigned integer) | ||
| 1707 | - */ | ||
| 1708 | - public short signalType() { | ||
| 1709 | - return signalType; | ||
| 1710 | - } | ||
| 1711 | - | ||
| 1712 | - @Override | ||
| 1713 | - public String toString() { | ||
| 1714 | - return toStringHelper(type().toString()) | ||
| 1715 | - .add("signalType", signalType).toString(); | ||
| 1716 | - } | ||
| 1717 | - | ||
| 1718 | - @Override | ||
| 1719 | - public int hashCode() { | ||
| 1720 | - return Objects.hash(type, signalType); | ||
| 1721 | - } | ||
| 1722 | - | ||
| 1723 | - @Override | ||
| 1724 | - public boolean equals(Object obj) { | ||
| 1725 | - if (this == obj) { | ||
| 1726 | - return true; | ||
| 1727 | - } | ||
| 1728 | - if (obj instanceof OpticalSignalTypeCriterion) { | ||
| 1729 | - OpticalSignalTypeCriterion that = (OpticalSignalTypeCriterion) obj; | ||
| 1730 | - return Objects.equals(signalType, that.signalType) && | ||
| 1731 | - Objects.equals(type, that.type); | ||
| 1732 | - } | ||
| 1733 | - return false; | ||
| 1734 | - } | ||
| 1735 | - } | ||
| 1736 | - | ||
| 1737 | - /** | ||
| 1738 | * Dummy Criterion used with @see{FilteringObjective}. | 379 | * Dummy Criterion used with @see{FilteringObjective}. |
| 1739 | */ | 380 | */ |
| 1740 | private static class DummyCriterion implements Criterion { | 381 | private static class DummyCriterion implements Criterion { | ... | ... |
| 1 | +/* | ||
| 2 | + * Copyright 2015 Open Networking Laboratory | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + */ | ||
| 16 | +package org.onosproject.net.flow.criteria; | ||
| 17 | + | ||
| 18 | +import org.onlab.packet.MacAddress; | ||
| 19 | + | ||
| 20 | +import java.util.Objects; | ||
| 21 | + | ||
| 22 | +import static com.google.common.base.MoreObjects.toStringHelper; | ||
| 23 | + | ||
| 24 | +/** | ||
| 25 | + * Implementation of MAC address criterion. | ||
| 26 | + */ | ||
| 27 | +public final class EthCriterion implements Criterion { | ||
| 28 | + private final MacAddress mac; | ||
| 29 | + private final Type type; | ||
| 30 | + | ||
| 31 | + /** | ||
| 32 | + * Constructor. | ||
| 33 | + * | ||
| 34 | + * @param mac the source or destination MAC address to match | ||
| 35 | + * @param type the match type. Should be either Type.ETH_DST or | ||
| 36 | + * Type.ETH_SRC | ||
| 37 | + */ | ||
| 38 | + EthCriterion(MacAddress mac, Type type) { | ||
| 39 | + this.mac = mac; | ||
| 40 | + this.type = type; | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + @Override | ||
| 44 | + public Type type() { | ||
| 45 | + return this.type; | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + /** | ||
| 49 | + * Gets the MAC address to match. | ||
| 50 | + * | ||
| 51 | + * @return the MAC address to match | ||
| 52 | + */ | ||
| 53 | + public MacAddress mac() { | ||
| 54 | + return this.mac; | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + @Override | ||
| 58 | + public String toString() { | ||
| 59 | + return toStringHelper(type().toString()) | ||
| 60 | + .add("mac", mac).toString(); | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + @Override | ||
| 64 | + public int hashCode() { | ||
| 65 | + return Objects.hash(type, mac); | ||
| 66 | + } | ||
| 67 | + | ||
| 68 | + @Override | ||
| 69 | + public boolean equals(Object obj) { | ||
| 70 | + if (this == obj) { | ||
| 71 | + return true; | ||
| 72 | + } | ||
| 73 | + if (obj instanceof EthCriterion) { | ||
| 74 | + EthCriterion that = (EthCriterion) obj; | ||
| 75 | + return Objects.equals(mac, that.mac) && | ||
| 76 | + Objects.equals(type, that.type); | ||
| 77 | + } | ||
| 78 | + return false; | ||
| 79 | + } | ||
| 80 | +} |
| 1 | +/* | ||
| 2 | + * Copyright 2015 Open Networking Laboratory | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + */ | ||
| 16 | +package org.onosproject.net.flow.criteria; | ||
| 17 | + | ||
| 18 | +import java.util.Objects; | ||
| 19 | + | ||
| 20 | +import static com.google.common.base.MoreObjects.toStringHelper; | ||
| 21 | + | ||
| 22 | +/** | ||
| 23 | + * Implementation of Ethernet type criterion (16 bits unsigned integer). | ||
| 24 | + */ | ||
| 25 | +public final class EthTypeCriterion implements Criterion { | ||
| 26 | + private static final int MASK = 0xffff; | ||
| 27 | + private final int ethType; // Ethernet type value: 16 bits | ||
| 28 | + | ||
| 29 | + /** | ||
| 30 | + * Constructor. | ||
| 31 | + * | ||
| 32 | + * @param ethType the Ethernet frame type to match (16 bits unsigned | ||
| 33 | + * integer) | ||
| 34 | + */ | ||
| 35 | + EthTypeCriterion(int ethType) { | ||
| 36 | + this.ethType = ethType & MASK; | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + @Override | ||
| 40 | + public Type type() { | ||
| 41 | + return Type.ETH_TYPE; | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + /** | ||
| 45 | + * Gets the Ethernet frame type to match. | ||
| 46 | + * | ||
| 47 | + * @return the Ethernet frame type to match (16 bits unsigned integer) | ||
| 48 | + */ | ||
| 49 | + public int ethType() { | ||
| 50 | + return ethType; | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + @Override | ||
| 54 | + public String toString() { | ||
| 55 | + return toStringHelper(type().toString()) | ||
| 56 | + .add("ethType", Long.toHexString(ethType)) | ||
| 57 | + .toString(); | ||
| 58 | + } | ||
| 59 | + | ||
| 60 | + @Override | ||
| 61 | + public int hashCode() { | ||
| 62 | + return Objects.hash(type(), ethType); | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + @Override | ||
| 66 | + public boolean equals(Object obj) { | ||
| 67 | + if (this == obj) { | ||
| 68 | + return true; | ||
| 69 | + } | ||
| 70 | + if (obj instanceof EthTypeCriterion) { | ||
| 71 | + EthTypeCriterion that = (EthTypeCriterion) obj; | ||
| 72 | + return Objects.equals(ethType, that.ethType) && | ||
| 73 | + Objects.equals(this.type(), that.type()); | ||
| 74 | + } | ||
| 75 | + return false; | ||
| 76 | + } | ||
| 77 | +} |
| 1 | +/* | ||
| 2 | + * Copyright 2015 Open Networking Laboratory | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + */ | ||
| 16 | +package org.onosproject.net.flow.criteria; | ||
| 17 | + | ||
| 18 | +import org.onlab.packet.IpPrefix; | ||
| 19 | + | ||
| 20 | +import java.util.Objects; | ||
| 21 | + | ||
| 22 | +import static com.google.common.base.MoreObjects.toStringHelper; | ||
| 23 | + | ||
| 24 | +/** | ||
| 25 | + * Implementation of IP address criterion. | ||
| 26 | + */ | ||
| 27 | +public final class IPCriterion implements Criterion { | ||
| 28 | + private final IpPrefix ip; | ||
| 29 | + private final Type type; | ||
| 30 | + | ||
| 31 | + /** | ||
| 32 | + * Constructor. | ||
| 33 | + * | ||
| 34 | + * @param ip the IP prefix to match. Could be either IPv4 or IPv6 | ||
| 35 | + * @param type the match type. Should be one of the following: | ||
| 36 | + * Type.IPV4_SRC, Type.IPV4_DST, Type.IPV6_SRC, Type.IPV6_DST | ||
| 37 | + */ | ||
| 38 | + IPCriterion(IpPrefix ip, Type type) { | ||
| 39 | + this.ip = ip; | ||
| 40 | + this.type = type; | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + @Override | ||
| 44 | + public Type type() { | ||
| 45 | + return this.type; | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + /** | ||
| 49 | + * Gets the IP prefix to match. | ||
| 50 | + * | ||
| 51 | + * @return the IP prefix to match | ||
| 52 | + */ | ||
| 53 | + public IpPrefix ip() { | ||
| 54 | + return this.ip; | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + @Override | ||
| 58 | + public String toString() { | ||
| 59 | + return toStringHelper(type().toString()) | ||
| 60 | + .add("ip", ip).toString(); | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + @Override | ||
| 64 | + public int hashCode() { | ||
| 65 | + return Objects.hash(type, ip); | ||
| 66 | + } | ||
| 67 | + | ||
| 68 | + @Override | ||
| 69 | + public boolean equals(Object obj) { | ||
| 70 | + if (this == obj) { | ||
| 71 | + return true; | ||
| 72 | + } | ||
| 73 | + if (obj instanceof IPCriterion) { | ||
| 74 | + IPCriterion that = (IPCriterion) obj; | ||
| 75 | + return Objects.equals(ip, that.ip) && | ||
| 76 | + Objects.equals(type, that.type); | ||
| 77 | + } | ||
| 78 | + return false; | ||
| 79 | + } | ||
| 80 | +} |
| 1 | +/* | ||
| 2 | + * Copyright 2015 Open Networking Laboratory | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + */ | ||
| 16 | +package org.onosproject.net.flow.criteria; | ||
| 17 | + | ||
| 18 | +import java.util.Objects; | ||
| 19 | + | ||
| 20 | +import static com.google.common.base.MoreObjects.toStringHelper; | ||
| 21 | + | ||
| 22 | +/** | ||
| 23 | + * Implementation of IP DSCP (Differentiated Services Code Point) | ||
| 24 | + * criterion (6 bits). | ||
| 25 | + */ | ||
| 26 | +public final class IPDscpCriterion implements Criterion { | ||
| 27 | + private static final byte MASK = 0x3f; | ||
| 28 | + private final byte ipDscp; // IP DSCP value: 6 bits | ||
| 29 | + | ||
| 30 | + /** | ||
| 31 | + * Constructor. | ||
| 32 | + * | ||
| 33 | + * @param ipDscp the IP DSCP value to match | ||
| 34 | + */ | ||
| 35 | + IPDscpCriterion(byte ipDscp) { | ||
| 36 | + this.ipDscp = (byte) (ipDscp & MASK); | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + @Override | ||
| 40 | + public Type type() { | ||
| 41 | + return Type.IP_DSCP; | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + /** | ||
| 45 | + * Gets the IP DSCP value to match. | ||
| 46 | + * | ||
| 47 | + * @return the IP DSCP value to match | ||
| 48 | + */ | ||
| 49 | + public byte ipDscp() { | ||
| 50 | + return ipDscp; | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + @Override | ||
| 54 | + public String toString() { | ||
| 55 | + return toStringHelper(type().toString()) | ||
| 56 | + .add("ipDscp", Long.toHexString(ipDscp)).toString(); | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + @Override | ||
| 60 | + public int hashCode() { | ||
| 61 | + return Objects.hash(type(), ipDscp); | ||
| 62 | + } | ||
| 63 | + | ||
| 64 | + @Override | ||
| 65 | + public boolean equals(Object obj) { | ||
| 66 | + if (this == obj) { | ||
| 67 | + return true; | ||
| 68 | + } | ||
| 69 | + if (obj instanceof IPDscpCriterion) { | ||
| 70 | + IPDscpCriterion that = (IPDscpCriterion) obj; | ||
| 71 | + return Objects.equals(ipDscp, that.ipDscp) && | ||
| 72 | + Objects.equals(this.type(), that.type()); | ||
| 73 | + } | ||
| 74 | + return false; | ||
| 75 | + } | ||
| 76 | +} |
| 1 | +/* | ||
| 2 | + * Copyright 2015 Open Networking Laboratory | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + */ | ||
| 16 | +package org.onosproject.net.flow.criteria; | ||
| 17 | + | ||
| 18 | +import java.util.Objects; | ||
| 19 | + | ||
| 20 | +import static com.google.common.base.MoreObjects.toStringHelper; | ||
| 21 | + | ||
| 22 | +/** | ||
| 23 | + * Implementation of IP ECN (Explicit Congestion Notification) criterion | ||
| 24 | + * (2 bits). | ||
| 25 | + */ | ||
| 26 | +public final class IPEcnCriterion implements Criterion { | ||
| 27 | + private static final byte MASK = 0x3; | ||
| 28 | + private final byte ipEcn; // IP ECN value: 2 bits | ||
| 29 | + | ||
| 30 | + /** | ||
| 31 | + * Constructor. | ||
| 32 | + * | ||
| 33 | + * @param ipEcn the IP ECN value to match (2 bits) | ||
| 34 | + */ | ||
| 35 | + IPEcnCriterion(byte ipEcn) { | ||
| 36 | + this.ipEcn = (byte) (ipEcn & MASK); | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + @Override | ||
| 40 | + public Type type() { | ||
| 41 | + return Type.IP_ECN; | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + /** | ||
| 45 | + * Gets the IP ECN value to match. | ||
| 46 | + * | ||
| 47 | + * @return the IP ECN value to match (2 bits) | ||
| 48 | + */ | ||
| 49 | + public byte ipEcn() { | ||
| 50 | + return ipEcn; | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + @Override | ||
| 54 | + public String toString() { | ||
| 55 | + return toStringHelper(type().toString()) | ||
| 56 | + .add("ipEcn", Long.toHexString(ipEcn)).toString(); | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + @Override | ||
| 60 | + public int hashCode() { | ||
| 61 | + return Objects.hash(type(), ipEcn); | ||
| 62 | + } | ||
| 63 | + | ||
| 64 | + @Override | ||
| 65 | + public boolean equals(Object obj) { | ||
| 66 | + if (this == obj) { | ||
| 67 | + return true; | ||
| 68 | + } | ||
| 69 | + if (obj instanceof IPEcnCriterion) { | ||
| 70 | + IPEcnCriterion that = (IPEcnCriterion) obj; | ||
| 71 | + return Objects.equals(ipEcn, that.ipEcn) && | ||
| 72 | + Objects.equals(this.type(), that.type()); | ||
| 73 | + } | ||
| 74 | + return false; | ||
| 75 | + } | ||
| 76 | +} |
| 1 | +/* | ||
| 2 | + * Copyright 2015 Open Networking Laboratory | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + */ | ||
| 16 | +package org.onosproject.net.flow.criteria; | ||
| 17 | + | ||
| 18 | +import java.util.Objects; | ||
| 19 | + | ||
| 20 | +import static com.google.common.base.MoreObjects.toStringHelper; | ||
| 21 | + | ||
| 22 | +/** | ||
| 23 | + * Implementation of Internet Protocol Number criterion (8 bits unsigned) | ||
| 24 | + * integer. | ||
| 25 | + */ | ||
| 26 | +public final class IPProtocolCriterion implements Criterion { | ||
| 27 | + private static final short MASK = 0xff; | ||
| 28 | + private final short proto; // IP protocol number: 8 bits | ||
| 29 | + | ||
| 30 | + /** | ||
| 31 | + * Constructor. | ||
| 32 | + * | ||
| 33 | + * @param protocol the IP protocol (e.g., TCP=6, UDP=17) to match | ||
| 34 | + * (8 bits unsigned integer) | ||
| 35 | + */ | ||
| 36 | + IPProtocolCriterion(short protocol) { | ||
| 37 | + this.proto = (short) (protocol & MASK); | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + @Override | ||
| 41 | + public Type type() { | ||
| 42 | + return Type.IP_PROTO; | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + /** | ||
| 46 | + * Gets the IP protocol to match. | ||
| 47 | + * | ||
| 48 | + * @return the IP protocol to match (8 bits unsigned integer) | ||
| 49 | + */ | ||
| 50 | + public short protocol() { | ||
| 51 | + return proto; | ||
| 52 | + } | ||
| 53 | + | ||
| 54 | + @Override | ||
| 55 | + public String toString() { | ||
| 56 | + return toStringHelper(type().toString()) | ||
| 57 | + .add("protocol", proto).toString(); | ||
| 58 | + } | ||
| 59 | + | ||
| 60 | + @Override | ||
| 61 | + public int hashCode() { | ||
| 62 | + return Objects.hash(type(), proto); | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + @Override | ||
| 66 | + public boolean equals(Object obj) { | ||
| 67 | + if (this == obj) { | ||
| 68 | + return true; | ||
| 69 | + } | ||
| 70 | + if (obj instanceof IPProtocolCriterion) { | ||
| 71 | + IPProtocolCriterion that = (IPProtocolCriterion) obj; | ||
| 72 | + return Objects.equals(proto, that.proto); | ||
| 73 | + } | ||
| 74 | + return false; | ||
| 75 | + } | ||
| 76 | +} |
| 1 | +/* | ||
| 2 | + * Copyright 2015 Open Networking Laboratory | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + */ | ||
| 16 | +package org.onosproject.net.flow.criteria; | ||
| 17 | + | ||
| 18 | +import java.util.Objects; | ||
| 19 | + | ||
| 20 | +import static com.google.common.base.MoreObjects.toStringHelper; | ||
| 21 | + | ||
| 22 | +/** | ||
| 23 | + * Implementation of IPv6 Extension Header pseudo-field criterion | ||
| 24 | + * (16 bits). Those are defined in Criterion.IPv6ExthdrFlags. | ||
| 25 | + */ | ||
| 26 | +public final class IPv6ExthdrFlagsCriterion implements Criterion { | ||
| 27 | + private static final int MASK = 0xffff; | ||
| 28 | + private final int exthdrFlags; // IPv6 Exthdr flags: 16 bits | ||
| 29 | + | ||
| 30 | + /** | ||
| 31 | + * Constructor. | ||
| 32 | + * | ||
| 33 | + * @param exthdrFlags the IPv6 Extension Header pseudo-field flags | ||
| 34 | + * to match (16 bits). Those are defined in Criterion.IPv6ExthdrFlags | ||
| 35 | + */ | ||
| 36 | + IPv6ExthdrFlagsCriterion(int exthdrFlags) { | ||
| 37 | + this.exthdrFlags = exthdrFlags & MASK; | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + @Override | ||
| 41 | + public Type type() { | ||
| 42 | + return Type.IPV6_EXTHDR; | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + /** | ||
| 46 | + * Gets the IPv6 Extension Header pseudo-field flags to match. | ||
| 47 | + * | ||
| 48 | + * @return the IPv6 Extension Header pseudo-field flags to match | ||
| 49 | + * (16 bits). Those are defined in Criterion.IPv6ExthdrFlags | ||
| 50 | + */ | ||
| 51 | + public int exthdrFlags() { | ||
| 52 | + return exthdrFlags; | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | + @Override | ||
| 56 | + public String toString() { | ||
| 57 | + return toStringHelper(type().toString()) | ||
| 58 | + .add("exthdrFlags", Long.toHexString(exthdrFlags)).toString(); | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | + @Override | ||
| 62 | + public int hashCode() { | ||
| 63 | + return Objects.hash(type(), exthdrFlags); | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + @Override | ||
| 67 | + public boolean equals(Object obj) { | ||
| 68 | + if (this == obj) { | ||
| 69 | + return true; | ||
| 70 | + } | ||
| 71 | + if (obj instanceof IPv6ExthdrFlagsCriterion) { | ||
| 72 | + IPv6ExthdrFlagsCriterion that = (IPv6ExthdrFlagsCriterion) obj; | ||
| 73 | + return Objects.equals(exthdrFlags, that.exthdrFlags) && | ||
| 74 | + Objects.equals(this.type(), that.type()); | ||
| 75 | + } | ||
| 76 | + return false; | ||
| 77 | + } | ||
| 78 | +} |
| 1 | +/* | ||
| 2 | + * Copyright 2015 Open Networking Laboratory | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + */ | ||
| 16 | +package org.onosproject.net.flow.criteria; | ||
| 17 | + | ||
| 18 | +import java.util.Objects; | ||
| 19 | + | ||
| 20 | +import static com.google.common.base.MoreObjects.toStringHelper; | ||
| 21 | + | ||
| 22 | +/** | ||
| 23 | + * Implementation of IPv6 Flow Label (RFC 6437) criterion (20 bits unsigned | ||
| 24 | + * integer). | ||
| 25 | + */ | ||
| 26 | +public final class IPv6FlowLabelCriterion implements Criterion { | ||
| 27 | + private static final int MASK = 0xfffff; | ||
| 28 | + private final int flowLabel; // IPv6 flow label: 20 bits | ||
| 29 | + | ||
| 30 | + /** | ||
| 31 | + * Constructor. | ||
| 32 | + * | ||
| 33 | + * @param flowLabel the IPv6 flow label to match (20 bits) | ||
| 34 | + */ | ||
| 35 | + IPv6FlowLabelCriterion(int flowLabel) { | ||
| 36 | + this.flowLabel = flowLabel & MASK; | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + @Override | ||
| 40 | + public Type type() { | ||
| 41 | + return Type.IPV6_FLABEL; | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + /** | ||
| 45 | + * Gets the IPv6 flow label to match. | ||
| 46 | + * | ||
| 47 | + * @return the IPv6 flow label to match (20 bits) | ||
| 48 | + */ | ||
| 49 | + public int flowLabel() { | ||
| 50 | + return flowLabel; | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + @Override | ||
| 54 | + public String toString() { | ||
| 55 | + return toStringHelper(type().toString()) | ||
| 56 | + .add("flowLabel", Long.toHexString(flowLabel)).toString(); | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + @Override | ||
| 60 | + public int hashCode() { | ||
| 61 | + return Objects.hash(type(), flowLabel); | ||
| 62 | + } | ||
| 63 | + | ||
| 64 | + @Override | ||
| 65 | + public boolean equals(Object obj) { | ||
| 66 | + if (this == obj) { | ||
| 67 | + return true; | ||
| 68 | + } | ||
| 69 | + if (obj instanceof IPv6FlowLabelCriterion) { | ||
| 70 | + IPv6FlowLabelCriterion that = (IPv6FlowLabelCriterion) obj; | ||
| 71 | + return Objects.equals(flowLabel, that.flowLabel) && | ||
| 72 | + Objects.equals(this.type(), that.type()); | ||
| 73 | + } | ||
| 74 | + return false; | ||
| 75 | + } | ||
| 76 | +} |
core/api/src/main/java/org/onosproject/net/flow/criteria/IPv6NDLinkLayerAddressCriterion.java
0 → 100644
| 1 | +/* | ||
| 2 | + * Copyright 2015 Open Networking Laboratory | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + */ | ||
| 16 | +package org.onosproject.net.flow.criteria; | ||
| 17 | + | ||
| 18 | +import org.onlab.packet.MacAddress; | ||
| 19 | + | ||
| 20 | +import java.util.Objects; | ||
| 21 | + | ||
| 22 | +import static com.google.common.base.MoreObjects.toStringHelper; | ||
| 23 | + | ||
| 24 | +/** | ||
| 25 | + * Implementation of IPv6 Neighbor Discovery link-layer address criterion. | ||
| 26 | + */ | ||
| 27 | +public final class IPv6NDLinkLayerAddressCriterion implements Criterion { | ||
| 28 | + private final MacAddress mac; | ||
| 29 | + private final Type type; | ||
| 30 | + | ||
| 31 | + /** | ||
| 32 | + * Constructor. | ||
| 33 | + * | ||
| 34 | + * @param mac the source or destination link-layer address to match | ||
| 35 | + * @param type the match type. Should be either Type.IPV6_ND_SLL or | ||
| 36 | + * Type.IPV6_ND_TLL | ||
| 37 | + */ | ||
| 38 | + IPv6NDLinkLayerAddressCriterion(MacAddress mac, Type type) { | ||
| 39 | + this.mac = mac; | ||
| 40 | + this.type = type; | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + @Override | ||
| 44 | + public Type type() { | ||
| 45 | + return this.type; | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + /** | ||
| 49 | + * Gets the MAC link-layer address to match. | ||
| 50 | + * | ||
| 51 | + * @return the MAC link-layer address to match | ||
| 52 | + */ | ||
| 53 | + public MacAddress mac() { | ||
| 54 | + return this.mac; | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + @Override | ||
| 58 | + public String toString() { | ||
| 59 | + return toStringHelper(type().toString()) | ||
| 60 | + .add("mac", mac).toString(); | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + @Override | ||
| 64 | + public int hashCode() { | ||
| 65 | + return Objects.hash(type, mac); | ||
| 66 | + } | ||
| 67 | + | ||
| 68 | + @Override | ||
| 69 | + public boolean equals(Object obj) { | ||
| 70 | + if (this == obj) { | ||
| 71 | + return true; | ||
| 72 | + } | ||
| 73 | + if (obj instanceof IPv6NDLinkLayerAddressCriterion) { | ||
| 74 | + IPv6NDLinkLayerAddressCriterion that = | ||
| 75 | + (IPv6NDLinkLayerAddressCriterion) obj; | ||
| 76 | + return Objects.equals(mac, that.mac) && | ||
| 77 | + Objects.equals(type, that.type); | ||
| 78 | + } | ||
| 79 | + return false; | ||
| 80 | + } | ||
| 81 | +} |
core/api/src/main/java/org/onosproject/net/flow/criteria/IPv6NDTargetAddressCriterion.java
0 → 100644
| 1 | +/* | ||
| 2 | + * Copyright 2015 Open Networking Laboratory | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + */ | ||
| 16 | +package org.onosproject.net.flow.criteria; | ||
| 17 | + | ||
| 18 | +import org.onlab.packet.Ip6Address; | ||
| 19 | + | ||
| 20 | +import java.util.Objects; | ||
| 21 | + | ||
| 22 | +import static com.google.common.base.MoreObjects.toStringHelper; | ||
| 23 | + | ||
| 24 | +/** | ||
| 25 | + * Implementation of IPv6 Neighbor Discovery target address criterion. | ||
| 26 | + */ | ||
| 27 | +public final class IPv6NDTargetAddressCriterion implements Criterion { | ||
| 28 | + private final Ip6Address targetAddress; | ||
| 29 | + | ||
| 30 | + /** | ||
| 31 | + * Constructor. | ||
| 32 | + * | ||
| 33 | + * @param targetAddress the IPv6 target address to match | ||
| 34 | + */ | ||
| 35 | + IPv6NDTargetAddressCriterion(Ip6Address targetAddress) { | ||
| 36 | + this.targetAddress = targetAddress; | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + @Override | ||
| 40 | + public Type type() { | ||
| 41 | + return Type.IPV6_ND_TARGET; | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + /** | ||
| 45 | + * Gets the IPv6 target address to match. | ||
| 46 | + * | ||
| 47 | + * @return the IPv6 target address to match | ||
| 48 | + */ | ||
| 49 | + public Ip6Address targetAddress() { | ||
| 50 | + return this.targetAddress; | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + @Override | ||
| 54 | + public String toString() { | ||
| 55 | + return toStringHelper(type().toString()) | ||
| 56 | + .add("targetAddress", targetAddress).toString(); | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + @Override | ||
| 60 | + public int hashCode() { | ||
| 61 | + return Objects.hash(type(), targetAddress); | ||
| 62 | + } | ||
| 63 | + | ||
| 64 | + @Override | ||
| 65 | + public boolean equals(Object obj) { | ||
| 66 | + if (this == obj) { | ||
| 67 | + return true; | ||
| 68 | + } | ||
| 69 | + if (obj instanceof IPv6NDTargetAddressCriterion) { | ||
| 70 | + IPv6NDTargetAddressCriterion that = | ||
| 71 | + (IPv6NDTargetAddressCriterion) obj; | ||
| 72 | + return Objects.equals(targetAddress, that.targetAddress) && | ||
| 73 | + Objects.equals(type(), that.type()); | ||
| 74 | + } | ||
| 75 | + return false; | ||
| 76 | + } | ||
| 77 | +} |
| 1 | +/* | ||
| 2 | + * Copyright 2015 Open Networking Laboratory | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + */ | ||
| 16 | +package org.onosproject.net.flow.criteria; | ||
| 17 | + | ||
| 18 | +import java.util.Objects; | ||
| 19 | + | ||
| 20 | +import static com.google.common.base.MoreObjects.toStringHelper; | ||
| 21 | + | ||
| 22 | +/** | ||
| 23 | + * Implementation of ICMP code criterion (8 bits unsigned integer). | ||
| 24 | + */ | ||
| 25 | +public final class IcmpCodeCriterion implements Criterion { | ||
| 26 | + private static final short MASK = 0xff; | ||
| 27 | + private final short icmpCode; // The ICMP code: 8 bits | ||
| 28 | + | ||
| 29 | + /** | ||
| 30 | + * Constructor. | ||
| 31 | + * | ||
| 32 | + * @param icmpCode the ICMP code to match (8 bits unsigned integer) | ||
| 33 | + */ | ||
| 34 | + IcmpCodeCriterion(short icmpCode) { | ||
| 35 | + this.icmpCode = (short) (icmpCode & MASK); | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + @Override | ||
| 39 | + public Type type() { | ||
| 40 | + return Type.ICMPV4_CODE; | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + /** | ||
| 44 | + * Gets the ICMP code to match. | ||
| 45 | + * | ||
| 46 | + * @return the ICMP code to match (8 bits unsigned integer) | ||
| 47 | + */ | ||
| 48 | + public short icmpCode() { | ||
| 49 | + return icmpCode; | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | + @Override | ||
| 53 | + public String toString() { | ||
| 54 | + return toStringHelper(type().toString()) | ||
| 55 | + .add("icmpCode", icmpCode).toString(); | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | + @Override | ||
| 59 | + public int hashCode() { | ||
| 60 | + return Objects.hash(type(), icmpCode); | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + @Override | ||
| 64 | + public boolean equals(Object obj) { | ||
| 65 | + if (this == obj) { | ||
| 66 | + return true; | ||
| 67 | + } | ||
| 68 | + if (obj instanceof IcmpCodeCriterion) { | ||
| 69 | + IcmpCodeCriterion that = (IcmpCodeCriterion) obj; | ||
| 70 | + return Objects.equals(icmpCode, that.icmpCode) && | ||
| 71 | + Objects.equals(this.type(), that.type()); | ||
| 72 | + } | ||
| 73 | + return false; | ||
| 74 | + } | ||
| 75 | +} |
| 1 | +/* | ||
| 2 | + * Copyright 2015 Open Networking Laboratory | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + */ | ||
| 16 | +package org.onosproject.net.flow.criteria; | ||
| 17 | + | ||
| 18 | +import java.util.Objects; | ||
| 19 | + | ||
| 20 | +import static com.google.common.base.MoreObjects.toStringHelper; | ||
| 21 | + | ||
| 22 | +/** | ||
| 23 | + * Implementation of ICMP type criterion (8 bits unsigned integer). | ||
| 24 | + */ | ||
| 25 | +public final class IcmpTypeCriterion implements Criterion { | ||
| 26 | + private static final short MASK = 0xff; | ||
| 27 | + private final short icmpType; // The ICMP type: 8 bits | ||
| 28 | + | ||
| 29 | + /** | ||
| 30 | + * Constructor. | ||
| 31 | + * | ||
| 32 | + * @param icmpType the ICMP type to match (8 bits unsigned integer) | ||
| 33 | + */ | ||
| 34 | + IcmpTypeCriterion(short icmpType) { | ||
| 35 | + this.icmpType = (short) (icmpType & MASK); | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + @Override | ||
| 39 | + public Type type() { | ||
| 40 | + return Type.ICMPV4_TYPE; | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + /** | ||
| 44 | + * Gets the ICMP type to match. | ||
| 45 | + * | ||
| 46 | + * @return the ICMP type to match (8 bits unsigned integer) | ||
| 47 | + */ | ||
| 48 | + public short icmpType() { | ||
| 49 | + return icmpType; | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | + @Override | ||
| 53 | + public String toString() { | ||
| 54 | + return toStringHelper(type().toString()) | ||
| 55 | + .add("icmpType", icmpType).toString(); | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | + @Override | ||
| 59 | + public int hashCode() { | ||
| 60 | + return Objects.hash(type(), icmpType); | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + @Override | ||
| 64 | + public boolean equals(Object obj) { | ||
| 65 | + if (this == obj) { | ||
| 66 | + return true; | ||
| 67 | + } | ||
| 68 | + if (obj instanceof IcmpTypeCriterion) { | ||
| 69 | + IcmpTypeCriterion that = (IcmpTypeCriterion) obj; | ||
| 70 | + return Objects.equals(icmpType, that.icmpType) && | ||
| 71 | + Objects.equals(this.type(), that.type()); | ||
| 72 | + } | ||
| 73 | + return false; | ||
| 74 | + } | ||
| 75 | +} |
| 1 | +/* | ||
| 2 | + * Copyright 2015 Open Networking Laboratory | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + */ | ||
| 16 | +package org.onosproject.net.flow.criteria; | ||
| 17 | + | ||
| 18 | +import java.util.Objects; | ||
| 19 | + | ||
| 20 | +import static com.google.common.base.MoreObjects.toStringHelper; | ||
| 21 | + | ||
| 22 | +/** | ||
| 23 | + * Implementation of ICMPv6 code criterion (8 bits unsigned integer). | ||
| 24 | + */ | ||
| 25 | +public final class Icmpv6CodeCriterion implements Criterion { | ||
| 26 | + private static final short MASK = 0xff; | ||
| 27 | + private final short icmpv6Code; // ICMPv6 code: 8 bits | ||
| 28 | + | ||
| 29 | + /** | ||
| 30 | + * Constructor. | ||
| 31 | + * | ||
| 32 | + * @param icmpv6Code the ICMPv6 code to match (8 bits unsigned integer) | ||
| 33 | + */ | ||
| 34 | + Icmpv6CodeCriterion(short icmpv6Code) { | ||
| 35 | + this.icmpv6Code = (short) (icmpv6Code & MASK); | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + @Override | ||
| 39 | + public Type type() { | ||
| 40 | + return Type.ICMPV6_CODE; | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + /** | ||
| 44 | + * Gets the ICMPv6 code to match. | ||
| 45 | + * | ||
| 46 | + * @return the ICMPv6 code to match (8 bits unsigned integer) | ||
| 47 | + */ | ||
| 48 | + public short icmpv6Code() { | ||
| 49 | + return icmpv6Code; | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | + @Override | ||
| 53 | + public String toString() { | ||
| 54 | + return toStringHelper(type().toString()) | ||
| 55 | + .add("icmpv6Code", icmpv6Code).toString(); | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | + @Override | ||
| 59 | + public int hashCode() { | ||
| 60 | + return Objects.hash(type(), icmpv6Code); | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + @Override | ||
| 64 | + public boolean equals(Object obj) { | ||
| 65 | + if (this == obj) { | ||
| 66 | + return true; | ||
| 67 | + } | ||
| 68 | + if (obj instanceof Icmpv6CodeCriterion) { | ||
| 69 | + Icmpv6CodeCriterion that = (Icmpv6CodeCriterion) obj; | ||
| 70 | + return Objects.equals(icmpv6Code, that.icmpv6Code) && | ||
| 71 | + Objects.equals(this.type(), that.type()); | ||
| 72 | + } | ||
| 73 | + return false; | ||
| 74 | + } | ||
| 75 | +} |
| 1 | +/* | ||
| 2 | + * Copyright 2015 Open Networking Laboratory | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + */ | ||
| 16 | +package org.onosproject.net.flow.criteria; | ||
| 17 | + | ||
| 18 | +import java.util.Objects; | ||
| 19 | + | ||
| 20 | +import static com.google.common.base.MoreObjects.toStringHelper; | ||
| 21 | + | ||
| 22 | +/** | ||
| 23 | + * Implementation of ICMPv6 type criterion (8 bits unsigned integer). | ||
| 24 | + */ | ||
| 25 | +public final class Icmpv6TypeCriterion implements Criterion { | ||
| 26 | + private static final short MASK = 0xff; | ||
| 27 | + private final short icmpv6Type; // ICMPv6 type: 8 bits | ||
| 28 | + | ||
| 29 | + /** | ||
| 30 | + * Constructor. | ||
| 31 | + * | ||
| 32 | + * @param icmpv6Type the ICMPv6 type to match (8 bits unsigned integer) | ||
| 33 | + */ | ||
| 34 | + Icmpv6TypeCriterion(short icmpv6Type) { | ||
| 35 | + this.icmpv6Type = (short) (icmpv6Type & MASK); | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + @Override | ||
| 39 | + public Type type() { | ||
| 40 | + return Type.ICMPV6_TYPE; | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + /** | ||
| 44 | + * Gets the ICMPv6 type to match. | ||
| 45 | + * | ||
| 46 | + * @return the ICMPv6 type to match (8 bits unsigned integer) | ||
| 47 | + */ | ||
| 48 | + public short icmpv6Type() { | ||
| 49 | + return icmpv6Type; | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | + @Override | ||
| 53 | + public String toString() { | ||
| 54 | + return toStringHelper(type().toString()) | ||
| 55 | + .add("icmpv6Type", icmpv6Type).toString(); | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | + @Override | ||
| 59 | + public int hashCode() { | ||
| 60 | + return Objects.hash(type(), icmpv6Type); | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + @Override | ||
| 64 | + public boolean equals(Object obj) { | ||
| 65 | + if (this == obj) { | ||
| 66 | + return true; | ||
| 67 | + } | ||
| 68 | + if (obj instanceof Icmpv6TypeCriterion) { | ||
| 69 | + Icmpv6TypeCriterion that = (Icmpv6TypeCriterion) obj; | ||
| 70 | + return Objects.equals(icmpv6Type, that.icmpv6Type) && | ||
| 71 | + Objects.equals(this.type(), that.type()); | ||
| 72 | + } | ||
| 73 | + return false; | ||
| 74 | + } | ||
| 75 | +} |
| 1 | +/* | ||
| 2 | + * Copyright 2015 Open Networking Laboratory | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + */ | ||
| 16 | +package org.onosproject.net.flow.criteria; | ||
| 17 | + | ||
| 18 | +import java.util.Objects; | ||
| 19 | + | ||
| 20 | +import static com.google.common.base.MoreObjects.toStringHelper; | ||
| 21 | + | ||
| 22 | +/** | ||
| 23 | + * Implementation of lambda (wavelength) criterion (16 bits unsigned | ||
| 24 | + * integer). | ||
| 25 | + */ | ||
| 26 | +public final class LambdaCriterion implements Criterion { | ||
| 27 | + private static final int MASK = 0xffff; | ||
| 28 | + private final int lambda; // Lambda value: 16 bits | ||
| 29 | + private final Type type; | ||
| 30 | + | ||
| 31 | + /** | ||
| 32 | + * Constructor. | ||
| 33 | + * | ||
| 34 | + * @param lambda the lambda (wavelength) to match (16 bits unsigned | ||
| 35 | + * integer) | ||
| 36 | + * @param type the match type. Should be Type.OCH_SIGID | ||
| 37 | + */ | ||
| 38 | + LambdaCriterion(int lambda, Type type) { | ||
| 39 | + this.lambda = lambda & MASK; | ||
| 40 | + this.type = type; | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + @Override | ||
| 44 | + public Type type() { | ||
| 45 | + return this.type; | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + /** | ||
| 49 | + * Gets the lambda (wavelength) to match. | ||
| 50 | + * | ||
| 51 | + * @return the lambda (wavelength) to match (16 bits unsigned integer) | ||
| 52 | + */ | ||
| 53 | + public int lambda() { | ||
| 54 | + return lambda; | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + @Override | ||
| 58 | + public String toString() { | ||
| 59 | + return toStringHelper(type().toString()) | ||
| 60 | + .add("lambda", lambda).toString(); | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + @Override | ||
| 64 | + public int hashCode() { | ||
| 65 | + return Objects.hash(type, lambda); | ||
| 66 | + } | ||
| 67 | + | ||
| 68 | + @Override | ||
| 69 | + public boolean equals(Object obj) { | ||
| 70 | + if (this == obj) { | ||
| 71 | + return true; | ||
| 72 | + } | ||
| 73 | + if (obj instanceof LambdaCriterion) { | ||
| 74 | + LambdaCriterion that = (LambdaCriterion) obj; | ||
| 75 | + return Objects.equals(lambda, that.lambda) && | ||
| 76 | + Objects.equals(type, that.type); | ||
| 77 | + } | ||
| 78 | + return false; | ||
| 79 | + } | ||
| 80 | +} |
| 1 | +/* | ||
| 2 | + * Copyright 2015 Open Networking Laboratory | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + */ | ||
| 16 | +package org.onosproject.net.flow.criteria; | ||
| 17 | + | ||
| 18 | +import java.util.Objects; | ||
| 19 | + | ||
| 20 | +import static com.google.common.base.MoreObjects.toStringHelper; | ||
| 21 | + | ||
| 22 | +/** | ||
| 23 | + * Implementation of Metadata criterion. | ||
| 24 | + */ | ||
| 25 | +public final class MetadataCriterion implements Criterion { | ||
| 26 | + private final long metadata; | ||
| 27 | + | ||
| 28 | + /** | ||
| 29 | + * Constructor. | ||
| 30 | + * | ||
| 31 | + * @param metadata the metadata to match (64 bits data) | ||
| 32 | + */ | ||
| 33 | + MetadataCriterion(long metadata) { | ||
| 34 | + this.metadata = metadata; | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | + @Override | ||
| 38 | + public Type type() { | ||
| 39 | + return Type.METADATA; | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + /** | ||
| 43 | + * Gets the metadata to match. | ||
| 44 | + * | ||
| 45 | + * @return the metadata to match (64 bits data) | ||
| 46 | + */ | ||
| 47 | + public long metadata() { | ||
| 48 | + return metadata; | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + @Override | ||
| 52 | + public String toString() { | ||
| 53 | + return toStringHelper(type().toString()) | ||
| 54 | + .add("metadata", Long.toHexString(metadata)) | ||
| 55 | + .toString(); | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | + @Override | ||
| 59 | + public int hashCode() { | ||
| 60 | + return Objects.hash(type(), metadata); | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + @Override | ||
| 64 | + public boolean equals(Object obj) { | ||
| 65 | + if (this == obj) { | ||
| 66 | + return true; | ||
| 67 | + } | ||
| 68 | + if (obj instanceof MetadataCriterion) { | ||
| 69 | + MetadataCriterion that = (MetadataCriterion) obj; | ||
| 70 | + return Objects.equals(metadata, that.metadata) && | ||
| 71 | + Objects.equals(this.type(), that.type()); | ||
| 72 | + } | ||
| 73 | + return false; | ||
| 74 | + } | ||
| 75 | +} |
| 1 | +/* | ||
| 2 | + * Copyright 2015 Open Networking Laboratory | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + */ | ||
| 16 | +package org.onosproject.net.flow.criteria; | ||
| 17 | + | ||
| 18 | +import org.onlab.packet.MplsLabel; | ||
| 19 | + | ||
| 20 | +import java.util.Objects; | ||
| 21 | + | ||
| 22 | +import static com.google.common.base.MoreObjects.toStringHelper; | ||
| 23 | + | ||
| 24 | +/** | ||
| 25 | + * Implementation of MPLS tag criterion (20 bits). | ||
| 26 | + */ | ||
| 27 | +public final class MplsCriterion implements Criterion { | ||
| 28 | + private static final int MASK = 0xfffff; | ||
| 29 | + private final MplsLabel mplsLabel; | ||
| 30 | + | ||
| 31 | + MplsCriterion(MplsLabel mplsLabel) { | ||
| 32 | + this.mplsLabel = mplsLabel; | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + @Override | ||
| 36 | + public Type type() { | ||
| 37 | + return Type.MPLS_LABEL; | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + public MplsLabel label() { | ||
| 41 | + return mplsLabel; | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + @Override | ||
| 45 | + public String toString() { | ||
| 46 | + return toStringHelper(type().toString()) | ||
| 47 | + .add("mpls", mplsLabel).toString(); | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | + @Override | ||
| 51 | + public int hashCode() { | ||
| 52 | + return Objects.hash(type(), mplsLabel); | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | + @Override | ||
| 56 | + public boolean equals(Object obj) { | ||
| 57 | + if (this == obj) { | ||
| 58 | + return true; | ||
| 59 | + } | ||
| 60 | + if (obj instanceof MplsCriterion) { | ||
| 61 | + MplsCriterion that = (MplsCriterion) obj; | ||
| 62 | + return Objects.equals(mplsLabel, that.mplsLabel) && | ||
| 63 | + Objects.equals(this.type(), that.type()); | ||
| 64 | + } | ||
| 65 | + return false; | ||
| 66 | + } | ||
| 67 | +} |
| 1 | +/* | ||
| 2 | + * Copyright 2015 Open Networking Laboratory | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + */ | ||
| 16 | +package org.onosproject.net.flow.criteria; | ||
| 17 | + | ||
| 18 | +import java.util.Objects; | ||
| 19 | + | ||
| 20 | +import static com.google.common.base.MoreObjects.toStringHelper; | ||
| 21 | + | ||
| 22 | +/** | ||
| 23 | + * Implementation of optical signal type criterion (8 bits unsigned | ||
| 24 | + * integer). | ||
| 25 | + */ | ||
| 26 | +public final class OpticalSignalTypeCriterion implements Criterion { | ||
| 27 | + private static final short MASK = 0xff; | ||
| 28 | + private final short signalType; // Signal type value: 8 bits | ||
| 29 | + private final Type type; | ||
| 30 | + | ||
| 31 | + /** | ||
| 32 | + * Constructor. | ||
| 33 | + * | ||
| 34 | + * @param signalType the optical signal type to match (8 bits unsigned | ||
| 35 | + * integer) | ||
| 36 | + * @param type the match type. Should be Type.OCH_SIGTYPE | ||
| 37 | + */ | ||
| 38 | + OpticalSignalTypeCriterion(short signalType, Type type) { | ||
| 39 | + this.signalType = (short) (signalType & MASK); | ||
| 40 | + this.type = type; | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + @Override | ||
| 44 | + public Type type() { | ||
| 45 | + return this.type; | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + /** | ||
| 49 | + * Gets the optical signal type to match. | ||
| 50 | + * | ||
| 51 | + * @return the optical signal type to match (8 bits unsigned integer) | ||
| 52 | + */ | ||
| 53 | + public short signalType() { | ||
| 54 | + return signalType; | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + @Override | ||
| 58 | + public String toString() { | ||
| 59 | + return toStringHelper(type().toString()) | ||
| 60 | + .add("signalType", signalType).toString(); | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + @Override | ||
| 64 | + public int hashCode() { | ||
| 65 | + return Objects.hash(type, signalType); | ||
| 66 | + } | ||
| 67 | + | ||
| 68 | + @Override | ||
| 69 | + public boolean equals(Object obj) { | ||
| 70 | + if (this == obj) { | ||
| 71 | + return true; | ||
| 72 | + } | ||
| 73 | + if (obj instanceof OpticalSignalTypeCriterion) { | ||
| 74 | + OpticalSignalTypeCriterion that = (OpticalSignalTypeCriterion) obj; | ||
| 75 | + return Objects.equals(signalType, that.signalType) && | ||
| 76 | + Objects.equals(type, that.type); | ||
| 77 | + } | ||
| 78 | + return false; | ||
| 79 | + } | ||
| 80 | +} |
| 1 | +/* | ||
| 2 | + * Copyright 2015 Open Networking Laboratory | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + */ | ||
| 16 | +package org.onosproject.net.flow.criteria; | ||
| 17 | + | ||
| 18 | +import org.onosproject.net.PortNumber; | ||
| 19 | + | ||
| 20 | +import java.util.Objects; | ||
| 21 | + | ||
| 22 | +import static com.google.common.base.MoreObjects.toStringHelper; | ||
| 23 | + | ||
| 24 | +/** | ||
| 25 | + * Implementation of input port criterion. | ||
| 26 | + */ | ||
| 27 | +public final class PortCriterion implements Criterion { | ||
| 28 | + private final PortNumber port; | ||
| 29 | + private final Type type; | ||
| 30 | + | ||
| 31 | + /** | ||
| 32 | + * Constructor. | ||
| 33 | + * | ||
| 34 | + * @param port the input port number to match | ||
| 35 | + * @param type the match type. Should be either Type.IN_PORT or | ||
| 36 | + * Type.IN_PHY_PORT | ||
| 37 | + */ | ||
| 38 | + PortCriterion(PortNumber port, Type type) { | ||
| 39 | + this.port = port; | ||
| 40 | + this.type = type; | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + @Override | ||
| 44 | + public Type type() { | ||
| 45 | + return this.type; | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + /** | ||
| 49 | + * Gets the input port number to match. | ||
| 50 | + * | ||
| 51 | + * @return the input port number to match | ||
| 52 | + */ | ||
| 53 | + public PortNumber port() { | ||
| 54 | + return this.port; | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + @Override | ||
| 58 | + public String toString() { | ||
| 59 | + return toStringHelper(type().toString()) | ||
| 60 | + .add("port", port).toString(); | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + @Override | ||
| 64 | + public int hashCode() { | ||
| 65 | + return Objects.hash(type(), port); | ||
| 66 | + } | ||
| 67 | + | ||
| 68 | + @Override | ||
| 69 | + public boolean equals(Object obj) { | ||
| 70 | + if (this == obj) { | ||
| 71 | + return true; | ||
| 72 | + } | ||
| 73 | + if (obj instanceof PortCriterion) { | ||
| 74 | + PortCriterion that = (PortCriterion) obj; | ||
| 75 | + return Objects.equals(port, that.port) && | ||
| 76 | + Objects.equals(this.type(), that.type()); | ||
| 77 | + } | ||
| 78 | + return false; | ||
| 79 | + } | ||
| 80 | +} |
| 1 | +/* | ||
| 2 | + * Copyright 2015 Open Networking Laboratory | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + */ | ||
| 16 | +package org.onosproject.net.flow.criteria; | ||
| 17 | + | ||
| 18 | +import java.util.Objects; | ||
| 19 | + | ||
| 20 | +import static com.google.common.base.MoreObjects.toStringHelper; | ||
| 21 | + | ||
| 22 | +/** | ||
| 23 | + * Implementation of SCTP port criterion (16 bits unsigned integer). | ||
| 24 | + */ | ||
| 25 | +public final class SctpPortCriterion implements Criterion { | ||
| 26 | + private static final int MASK = 0xffff; | ||
| 27 | + private final int sctpPort; // Port value: 16 bits | ||
| 28 | + private final Type type; | ||
| 29 | + | ||
| 30 | + /** | ||
| 31 | + * Constructor. | ||
| 32 | + * | ||
| 33 | + * @param sctpPort the SCTP port to match (16 bits unsigned integer) | ||
| 34 | + * @param type the match type. Should be either Type.SCTP_SRC or | ||
| 35 | + * Type.SCTP_DST | ||
| 36 | + */ | ||
| 37 | + SctpPortCriterion(int sctpPort, Type type) { | ||
| 38 | + this.sctpPort = sctpPort & MASK; | ||
| 39 | + this.type = type; | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + @Override | ||
| 43 | + public Type type() { | ||
| 44 | + return this.type; | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + /** | ||
| 48 | + * Gets the SCTP port to match. | ||
| 49 | + * | ||
| 50 | + * @return the SCTP port to match (16 bits unsigned integer) | ||
| 51 | + */ | ||
| 52 | + public int sctpPort() { | ||
| 53 | + return this.sctpPort; | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + @Override | ||
| 57 | + public String toString() { | ||
| 58 | + return toStringHelper(type().toString()) | ||
| 59 | + .add("sctpPort", sctpPort).toString(); | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + @Override | ||
| 63 | + public int hashCode() { | ||
| 64 | + return Objects.hash(type, sctpPort); | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + @Override | ||
| 68 | + public boolean equals(Object obj) { | ||
| 69 | + if (this == obj) { | ||
| 70 | + return true; | ||
| 71 | + } | ||
| 72 | + if (obj instanceof SctpPortCriterion) { | ||
| 73 | + SctpPortCriterion that = (SctpPortCriterion) obj; | ||
| 74 | + return Objects.equals(sctpPort, that.sctpPort) && | ||
| 75 | + Objects.equals(type, that.type); | ||
| 76 | + } | ||
| 77 | + return false; | ||
| 78 | + } | ||
| 79 | +} |
| 1 | +/* | ||
| 2 | + * Copyright 2015 Open Networking Laboratory | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + */ | ||
| 16 | +package org.onosproject.net.flow.criteria; | ||
| 17 | + | ||
| 18 | +import java.util.Objects; | ||
| 19 | + | ||
| 20 | +import static com.google.common.base.MoreObjects.toStringHelper; | ||
| 21 | + | ||
| 22 | +/** | ||
| 23 | + * Implementation of TCP port criterion (16 bits unsigned integer). | ||
| 24 | + */ | ||
| 25 | +public final class TcpPortCriterion implements Criterion { | ||
| 26 | + private static final int MASK = 0xffff; | ||
| 27 | + private final int tcpPort; // Port value: 16 bits | ||
| 28 | + private final Type type; | ||
| 29 | + | ||
| 30 | + /** | ||
| 31 | + * Constructor. | ||
| 32 | + * | ||
| 33 | + * @param tcpPort the TCP port to match (16 bits unsigned integer) | ||
| 34 | + * @param type the match type. Should be either Type.TCP_SRC or | ||
| 35 | + * Type.TCP_DST | ||
| 36 | + */ | ||
| 37 | + TcpPortCriterion(int tcpPort, Type type) { | ||
| 38 | + this.tcpPort = tcpPort & MASK; | ||
| 39 | + this.type = type; | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + @Override | ||
| 43 | + public Type type() { | ||
| 44 | + return this.type; | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + /** | ||
| 48 | + * Gets the TCP port to match. | ||
| 49 | + * | ||
| 50 | + * @return the TCP port to match (16 bits unsigned integer) | ||
| 51 | + */ | ||
| 52 | + public int tcpPort() { | ||
| 53 | + return this.tcpPort; | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + @Override | ||
| 57 | + public String toString() { | ||
| 58 | + return toStringHelper(type().toString()) | ||
| 59 | + .add("tcpPort", tcpPort).toString(); | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + @Override | ||
| 63 | + public int hashCode() { | ||
| 64 | + return Objects.hash(type, tcpPort); | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + @Override | ||
| 68 | + public boolean equals(Object obj) { | ||
| 69 | + if (this == obj) { | ||
| 70 | + return true; | ||
| 71 | + } | ||
| 72 | + if (obj instanceof TcpPortCriterion) { | ||
| 73 | + TcpPortCriterion that = (TcpPortCriterion) obj; | ||
| 74 | + return Objects.equals(tcpPort, that.tcpPort) && | ||
| 75 | + Objects.equals(type, that.type); | ||
| 76 | + } | ||
| 77 | + return false; | ||
| 78 | + } | ||
| 79 | +} |
| 1 | +/* | ||
| 2 | + * Copyright 2015 Open Networking Laboratory | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + */ | ||
| 16 | +package org.onosproject.net.flow.criteria; | ||
| 17 | + | ||
| 18 | +import java.util.Objects; | ||
| 19 | + | ||
| 20 | +import static com.google.common.base.MoreObjects.toStringHelper; | ||
| 21 | + | ||
| 22 | +/** | ||
| 23 | + * Implementation of UDP port criterion (16 bits unsigned integer). | ||
| 24 | + */ | ||
| 25 | +public final class UdpPortCriterion implements Criterion { | ||
| 26 | + private static final int MASK = 0xffff; | ||
| 27 | + private final int udpPort; // Port value: 16 bits | ||
| 28 | + private final Type type; | ||
| 29 | + | ||
| 30 | + /** | ||
| 31 | + * Constructor. | ||
| 32 | + * | ||
| 33 | + * @param udpPort the UDP port to match (16 bits unsigned integer) | ||
| 34 | + * @param type the match type. Should be either Type.UDP_SRC or | ||
| 35 | + * Type.UDP_DST | ||
| 36 | + */ | ||
| 37 | + UdpPortCriterion(int udpPort, Type type) { | ||
| 38 | + this.udpPort = udpPort & MASK; | ||
| 39 | + this.type = type; | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + @Override | ||
| 43 | + public Type type() { | ||
| 44 | + return this.type; | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + /** | ||
| 48 | + * Gets the UDP port to match. | ||
| 49 | + * | ||
| 50 | + * @return the UDP port to match (16 bits unsigned integer) | ||
| 51 | + */ | ||
| 52 | + public int udpPort() { | ||
| 53 | + return this.udpPort; | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + @Override | ||
| 57 | + public String toString() { | ||
| 58 | + return toStringHelper(type().toString()) | ||
| 59 | + .add("udpPort", udpPort).toString(); | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + @Override | ||
| 63 | + public int hashCode() { | ||
| 64 | + return Objects.hash(type, udpPort); | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + @Override | ||
| 68 | + public boolean equals(Object obj) { | ||
| 69 | + if (this == obj) { | ||
| 70 | + return true; | ||
| 71 | + } | ||
| 72 | + if (obj instanceof UdpPortCriterion) { | ||
| 73 | + UdpPortCriterion that = (UdpPortCriterion) obj; | ||
| 74 | + return Objects.equals(udpPort, that.udpPort) && | ||
| 75 | + Objects.equals(type, that.type); | ||
| 76 | + } | ||
| 77 | + return false; | ||
| 78 | + } | ||
| 79 | +} |
| 1 | +/* | ||
| 2 | + * Copyright 2015 Open Networking Laboratory | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + */ | ||
| 16 | +package org.onosproject.net.flow.criteria; | ||
| 17 | + | ||
| 18 | +import org.onlab.packet.VlanId; | ||
| 19 | + | ||
| 20 | +import java.util.Objects; | ||
| 21 | + | ||
| 22 | +import static com.google.common.base.MoreObjects.toStringHelper; | ||
| 23 | + | ||
| 24 | +/** | ||
| 25 | + * Implementation of VLAN ID criterion. | ||
| 26 | + */ | ||
| 27 | +public final class VlanIdCriterion implements Criterion { | ||
| 28 | + private final VlanId vlanId; | ||
| 29 | + | ||
| 30 | + /** | ||
| 31 | + * Constructor. | ||
| 32 | + * | ||
| 33 | + * @param vlanId the VLAN ID to match | ||
| 34 | + */ | ||
| 35 | + VlanIdCriterion(VlanId vlanId) { | ||
| 36 | + this.vlanId = vlanId; | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + @Override | ||
| 40 | + public Type type() { | ||
| 41 | + return Type.VLAN_VID; | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + /** | ||
| 45 | + * Gets the VLAN ID to match. | ||
| 46 | + * | ||
| 47 | + * @return the VLAN ID to match | ||
| 48 | + */ | ||
| 49 | + public VlanId vlanId() { | ||
| 50 | + return vlanId; | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + @Override | ||
| 54 | + public String toString() { | ||
| 55 | + return toStringHelper(type().toString()) | ||
| 56 | + .add("vlanId", vlanId).toString(); | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + @Override | ||
| 60 | + public int hashCode() { | ||
| 61 | + return Objects.hash(type(), vlanId); | ||
| 62 | + } | ||
| 63 | + | ||
| 64 | + @Override | ||
| 65 | + public boolean equals(Object obj) { | ||
| 66 | + if (this == obj) { | ||
| 67 | + return true; | ||
| 68 | + } | ||
| 69 | + if (obj instanceof VlanIdCriterion) { | ||
| 70 | + VlanIdCriterion that = (VlanIdCriterion) obj; | ||
| 71 | + return Objects.equals(vlanId, that.vlanId) && | ||
| 72 | + Objects.equals(this.type(), that.type()); | ||
| 73 | + } | ||
| 74 | + return false; | ||
| 75 | + } | ||
| 76 | +} |
| 1 | +/* | ||
| 2 | + * Copyright 2015 Open Networking Laboratory | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + */ | ||
| 16 | +package org.onosproject.net.flow.criteria; | ||
| 17 | + | ||
| 18 | +import java.util.Objects; | ||
| 19 | + | ||
| 20 | +import static com.google.common.base.MoreObjects.toStringHelper; | ||
| 21 | + | ||
| 22 | +/** | ||
| 23 | + * Implementation of VLAN priority criterion (3 bits). | ||
| 24 | + */ | ||
| 25 | +public final class VlanPcpCriterion implements Criterion { | ||
| 26 | + private static final byte MASK = 0x7; | ||
| 27 | + private final byte vlanPcp; // VLAN pcp value: 3 bits | ||
| 28 | + | ||
| 29 | + /** | ||
| 30 | + * Constructor. | ||
| 31 | + * | ||
| 32 | + * @param vlanPcp the VLAN priority to match (3 bits) | ||
| 33 | + */ | ||
| 34 | + VlanPcpCriterion(byte vlanPcp) { | ||
| 35 | + this.vlanPcp = (byte) (vlanPcp & MASK); | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + @Override | ||
| 39 | + public Type type() { | ||
| 40 | + return Type.VLAN_PCP; | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + /** | ||
| 44 | + * Gets the VLAN priority to match. | ||
| 45 | + * | ||
| 46 | + * @return the VLAN priority to match (3 bits) | ||
| 47 | + */ | ||
| 48 | + public byte priority() { | ||
| 49 | + return vlanPcp; | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | + @Override | ||
| 53 | + public String toString() { | ||
| 54 | + return toStringHelper(type().toString()) | ||
| 55 | + .add("priority", Long.toHexString(vlanPcp)).toString(); | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | + @Override | ||
| 59 | + public int hashCode() { | ||
| 60 | + return Objects.hash(type(), vlanPcp); | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + @Override | ||
| 64 | + public boolean equals(Object obj) { | ||
| 65 | + if (this == obj) { | ||
| 66 | + return true; | ||
| 67 | + } | ||
| 68 | + if (obj instanceof VlanPcpCriterion) { | ||
| 69 | + VlanPcpCriterion that = (VlanPcpCriterion) obj; | ||
| 70 | + return Objects.equals(vlanPcp, that.vlanPcp) && | ||
| 71 | + Objects.equals(this.type(), that.type()); | ||
| 72 | + } | ||
| 73 | + return false; | ||
| 74 | + } | ||
| 75 | +} |
| ... | @@ -254,30 +254,30 @@ public class CriteriaTest { | ... | @@ -254,30 +254,30 @@ public class CriteriaTest { |
| 254 | */ | 254 | */ |
| 255 | @Test | 255 | @Test |
| 256 | public void testCriteriaImmutability() { | 256 | public void testCriteriaImmutability() { |
| 257 | - assertThatClassIsImmutable(Criteria.PortCriterion.class); | 257 | + assertThatClassIsImmutable(PortCriterion.class); |
| 258 | - assertThatClassIsImmutable(Criteria.MetadataCriterion.class); | 258 | + assertThatClassIsImmutable(MetadataCriterion.class); |
| 259 | - assertThatClassIsImmutable(Criteria.EthCriterion.class); | 259 | + assertThatClassIsImmutable(EthCriterion.class); |
| 260 | - assertThatClassIsImmutable(Criteria.EthTypeCriterion.class); | 260 | + assertThatClassIsImmutable(EthTypeCriterion.class); |
| 261 | - assertThatClassIsImmutable(Criteria.VlanIdCriterion.class); | 261 | + assertThatClassIsImmutable(VlanIdCriterion.class); |
| 262 | - assertThatClassIsImmutable(Criteria.VlanPcpCriterion.class); | 262 | + assertThatClassIsImmutable(VlanPcpCriterion.class); |
| 263 | - assertThatClassIsImmutable(Criteria.IPDscpCriterion.class); | 263 | + assertThatClassIsImmutable(IPDscpCriterion.class); |
| 264 | - assertThatClassIsImmutable(Criteria.IPEcnCriterion.class); | 264 | + assertThatClassIsImmutable(IPEcnCriterion.class); |
| 265 | - assertThatClassIsImmutable(Criteria.IPProtocolCriterion.class); | 265 | + assertThatClassIsImmutable(IPProtocolCriterion.class); |
| 266 | - assertThatClassIsImmutable(Criteria.IPCriterion.class); | 266 | + assertThatClassIsImmutable(IPCriterion.class); |
| 267 | - assertThatClassIsImmutable(Criteria.TcpPortCriterion.class); | 267 | + assertThatClassIsImmutable(TcpPortCriterion.class); |
| 268 | - assertThatClassIsImmutable(Criteria.UdpPortCriterion.class); | 268 | + assertThatClassIsImmutable(UdpPortCriterion.class); |
| 269 | - assertThatClassIsImmutable(Criteria.SctpPortCriterion.class); | 269 | + assertThatClassIsImmutable(SctpPortCriterion.class); |
| 270 | - assertThatClassIsImmutable(Criteria.IcmpTypeCriterion.class); | 270 | + assertThatClassIsImmutable(IcmpTypeCriterion.class); |
| 271 | - assertThatClassIsImmutable(Criteria.IcmpCodeCriterion.class); | 271 | + assertThatClassIsImmutable(IcmpCodeCriterion.class); |
| 272 | - assertThatClassIsImmutable(Criteria.IPv6FlowLabelCriterion.class); | 272 | + assertThatClassIsImmutable(IPv6FlowLabelCriterion.class); |
| 273 | - assertThatClassIsImmutable(Criteria.Icmpv6TypeCriterion.class); | 273 | + assertThatClassIsImmutable(Icmpv6TypeCriterion.class); |
| 274 | - assertThatClassIsImmutable(Criteria.Icmpv6CodeCriterion.class); | 274 | + assertThatClassIsImmutable(Icmpv6CodeCriterion.class); |
| 275 | - assertThatClassIsImmutable(Criteria.IPv6NDTargetAddressCriterion.class); | 275 | + assertThatClassIsImmutable(IPv6NDTargetAddressCriterion.class); |
| 276 | - assertThatClassIsImmutable(Criteria.IPv6NDLinkLayerAddressCriterion.class); | 276 | + assertThatClassIsImmutable(IPv6NDLinkLayerAddressCriterion.class); |
| 277 | - assertThatClassIsImmutable(Criteria.MplsCriterion.class); | 277 | + assertThatClassIsImmutable(MplsCriterion.class); |
| 278 | - assertThatClassIsImmutable(Criteria.IPv6ExthdrFlagsCriterion.class); | 278 | + assertThatClassIsImmutable(IPv6ExthdrFlagsCriterion.class); |
| 279 | - assertThatClassIsImmutable(Criteria.LambdaCriterion.class); | 279 | + assertThatClassIsImmutable(LambdaCriterion.class); |
| 280 | - assertThatClassIsImmutable(Criteria.OpticalSignalTypeCriterion.class); | 280 | + assertThatClassIsImmutable(OpticalSignalTypeCriterion.class); |
| 281 | } | 281 | } |
| 282 | 282 | ||
| 283 | // PortCriterion class | 283 | // PortCriterion class |
| ... | @@ -289,10 +289,10 @@ public class CriteriaTest { | ... | @@ -289,10 +289,10 @@ public class CriteriaTest { |
| 289 | public void testMatchInPortMethod() { | 289 | public void testMatchInPortMethod() { |
| 290 | PortNumber p1 = portNumber(1); | 290 | PortNumber p1 = portNumber(1); |
| 291 | Criterion matchInPort = Criteria.matchInPort(p1); | 291 | Criterion matchInPort = Criteria.matchInPort(p1); |
| 292 | - Criteria.PortCriterion portCriterion = | 292 | + PortCriterion portCriterion = |
| 293 | checkAndConvert(matchInPort, | 293 | checkAndConvert(matchInPort, |
| 294 | Criterion.Type.IN_PORT, | 294 | Criterion.Type.IN_PORT, |
| 295 | - Criteria.PortCriterion.class); | 295 | + PortCriterion.class); |
| 296 | assertThat(portCriterion.port(), is(equalTo(p1))); | 296 | assertThat(portCriterion.port(), is(equalTo(p1))); |
| 297 | } | 297 | } |
| 298 | 298 | ||
| ... | @@ -303,10 +303,10 @@ public class CriteriaTest { | ... | @@ -303,10 +303,10 @@ public class CriteriaTest { |
| 303 | public void testMatchInPhyPortMethod() { | 303 | public void testMatchInPhyPortMethod() { |
| 304 | PortNumber p1 = portNumber(1); | 304 | PortNumber p1 = portNumber(1); |
| 305 | Criterion matchInPhyPort = Criteria.matchInPhyPort(p1); | 305 | Criterion matchInPhyPort = Criteria.matchInPhyPort(p1); |
| 306 | - Criteria.PortCriterion portCriterion = | 306 | + PortCriterion portCriterion = |
| 307 | checkAndConvert(matchInPhyPort, | 307 | checkAndConvert(matchInPhyPort, |
| 308 | Criterion.Type.IN_PHY_PORT, | 308 | Criterion.Type.IN_PHY_PORT, |
| 309 | - Criteria.PortCriterion.class); | 309 | + PortCriterion.class); |
| 310 | assertThat(portCriterion.port(), is(equalTo(p1))); | 310 | assertThat(portCriterion.port(), is(equalTo(p1))); |
| 311 | } | 311 | } |
| 312 | 312 | ||
| ... | @@ -335,10 +335,10 @@ public class CriteriaTest { | ... | @@ -335,10 +335,10 @@ public class CriteriaTest { |
| 335 | public void testMatchMetadataMethod() { | 335 | public void testMatchMetadataMethod() { |
| 336 | Long metadata = 12L; | 336 | Long metadata = 12L; |
| 337 | Criterion matchMetadata = Criteria.matchMetadata(metadata); | 337 | Criterion matchMetadata = Criteria.matchMetadata(metadata); |
| 338 | - Criteria.MetadataCriterion metadataCriterion = | 338 | + MetadataCriterion metadataCriterion = |
| 339 | checkAndConvert(matchMetadata, | 339 | checkAndConvert(matchMetadata, |
| 340 | Criterion.Type.METADATA, | 340 | Criterion.Type.METADATA, |
| 341 | - Criteria.MetadataCriterion.class); | 341 | + MetadataCriterion.class); |
| 342 | assertThat(metadataCriterion.metadata(), is(equalTo(metadata))); | 342 | assertThat(metadataCriterion.metadata(), is(equalTo(metadata))); |
| 343 | } | 343 | } |
| 344 | 344 | ||
| ... | @@ -361,10 +361,10 @@ public class CriteriaTest { | ... | @@ -361,10 +361,10 @@ public class CriteriaTest { |
| 361 | @Test | 361 | @Test |
| 362 | public void testMatchEthDstMethod() { | 362 | public void testMatchEthDstMethod() { |
| 363 | Criterion matchEthDst = Criteria.matchEthDst(mac1); | 363 | Criterion matchEthDst = Criteria.matchEthDst(mac1); |
| 364 | - Criteria.EthCriterion ethCriterion = | 364 | + EthCriterion ethCriterion = |
| 365 | checkAndConvert(matchEthDst, | 365 | checkAndConvert(matchEthDst, |
| 366 | Criterion.Type.ETH_DST, | 366 | Criterion.Type.ETH_DST, |
| 367 | - Criteria.EthCriterion.class); | 367 | + EthCriterion.class); |
| 368 | assertThat(ethCriterion.mac(), is(equalTo(mac1))); | 368 | assertThat(ethCriterion.mac(), is(equalTo(mac1))); |
| 369 | } | 369 | } |
| 370 | 370 | ||
| ... | @@ -374,10 +374,10 @@ public class CriteriaTest { | ... | @@ -374,10 +374,10 @@ public class CriteriaTest { |
| 374 | @Test | 374 | @Test |
| 375 | public void testMatchEthSrcMethod() { | 375 | public void testMatchEthSrcMethod() { |
| 376 | Criterion matchEthSrc = Criteria.matchEthSrc(mac1); | 376 | Criterion matchEthSrc = Criteria.matchEthSrc(mac1); |
| 377 | - Criteria.EthCriterion ethCriterion = | 377 | + EthCriterion ethCriterion = |
| 378 | checkAndConvert(matchEthSrc, | 378 | checkAndConvert(matchEthSrc, |
| 379 | Criterion.Type.ETH_SRC, | 379 | Criterion.Type.ETH_SRC, |
| 380 | - Criteria.EthCriterion.class); | 380 | + EthCriterion.class); |
| 381 | assertThat(ethCriterion.mac(), is(mac1)); | 381 | assertThat(ethCriterion.mac(), is(mac1)); |
| 382 | } | 382 | } |
| 383 | 383 | ||
| ... | @@ -401,10 +401,10 @@ public class CriteriaTest { | ... | @@ -401,10 +401,10 @@ public class CriteriaTest { |
| 401 | public void testMatchEthTypeMethod() { | 401 | public void testMatchEthTypeMethod() { |
| 402 | int ethType = 12; | 402 | int ethType = 12; |
| 403 | Criterion matchEthType = Criteria.matchEthType(ethType); | 403 | Criterion matchEthType = Criteria.matchEthType(ethType); |
| 404 | - Criteria.EthTypeCriterion ethTypeCriterion = | 404 | + EthTypeCriterion ethTypeCriterion = |
| 405 | checkAndConvert(matchEthType, | 405 | checkAndConvert(matchEthType, |
| 406 | Criterion.Type.ETH_TYPE, | 406 | Criterion.Type.ETH_TYPE, |
| 407 | - Criteria.EthTypeCriterion.class); | 407 | + EthTypeCriterion.class); |
| 408 | assertThat(ethTypeCriterion.ethType(), is(equalTo(ethType))); | 408 | assertThat(ethTypeCriterion.ethType(), is(equalTo(ethType))); |
| 409 | } | 409 | } |
| 410 | 410 | ||
| ... | @@ -427,10 +427,10 @@ public class CriteriaTest { | ... | @@ -427,10 +427,10 @@ public class CriteriaTest { |
| 427 | @Test | 427 | @Test |
| 428 | public void testMatchVlanIdMethod() { | 428 | public void testMatchVlanIdMethod() { |
| 429 | Criterion matchVlanId = Criteria.matchVlanId(vlanId1); | 429 | Criterion matchVlanId = Criteria.matchVlanId(vlanId1); |
| 430 | - Criteria.VlanIdCriterion vlanIdCriterion = | 430 | + VlanIdCriterion vlanIdCriterion = |
| 431 | checkAndConvert(matchVlanId, | 431 | checkAndConvert(matchVlanId, |
| 432 | Criterion.Type.VLAN_VID, | 432 | Criterion.Type.VLAN_VID, |
| 433 | - Criteria.VlanIdCriterion.class); | 433 | + VlanIdCriterion.class); |
| 434 | assertThat(vlanIdCriterion.vlanId(), is(equalTo(vlanId1))); | 434 | assertThat(vlanIdCriterion.vlanId(), is(equalTo(vlanId1))); |
| 435 | } | 435 | } |
| 436 | 436 | ||
| ... | @@ -453,10 +453,10 @@ public class CriteriaTest { | ... | @@ -453,10 +453,10 @@ public class CriteriaTest { |
| 453 | @Test | 453 | @Test |
| 454 | public void testMatchVlanPcpMethod() { | 454 | public void testMatchVlanPcpMethod() { |
| 455 | Criterion matchVlanPcp = Criteria.matchVlanPcp(vlanPcp1); | 455 | Criterion matchVlanPcp = Criteria.matchVlanPcp(vlanPcp1); |
| 456 | - Criteria.VlanPcpCriterion vlanPcpCriterion = | 456 | + VlanPcpCriterion vlanPcpCriterion = |
| 457 | checkAndConvert(matchVlanPcp, | 457 | checkAndConvert(matchVlanPcp, |
| 458 | Criterion.Type.VLAN_PCP, | 458 | Criterion.Type.VLAN_PCP, |
| 459 | - Criteria.VlanPcpCriterion.class); | 459 | + VlanPcpCriterion.class); |
| 460 | assertThat(vlanPcpCriterion.priority(), is(equalTo(vlanPcp1))); | 460 | assertThat(vlanPcpCriterion.priority(), is(equalTo(vlanPcp1))); |
| 461 | } | 461 | } |
| 462 | 462 | ||
| ... | @@ -479,10 +479,10 @@ public class CriteriaTest { | ... | @@ -479,10 +479,10 @@ public class CriteriaTest { |
| 479 | @Test | 479 | @Test |
| 480 | public void testMatchIPDscpMethod() { | 480 | public void testMatchIPDscpMethod() { |
| 481 | Criterion matchIPDscp = Criteria.matchIPDscp(ipDscp1); | 481 | Criterion matchIPDscp = Criteria.matchIPDscp(ipDscp1); |
| 482 | - Criteria.IPDscpCriterion ipDscpCriterion = | 482 | + IPDscpCriterion ipDscpCriterion = |
| 483 | checkAndConvert(matchIPDscp, | 483 | checkAndConvert(matchIPDscp, |
| 484 | Criterion.Type.IP_DSCP, | 484 | Criterion.Type.IP_DSCP, |
| 485 | - Criteria.IPDscpCriterion.class); | 485 | + IPDscpCriterion.class); |
| 486 | assertThat(ipDscpCriterion.ipDscp(), is(equalTo(ipDscp1))); | 486 | assertThat(ipDscpCriterion.ipDscp(), is(equalTo(ipDscp1))); |
| 487 | } | 487 | } |
| 488 | 488 | ||
| ... | @@ -505,10 +505,10 @@ public class CriteriaTest { | ... | @@ -505,10 +505,10 @@ public class CriteriaTest { |
| 505 | @Test | 505 | @Test |
| 506 | public void testMatchIPEcnMethod() { | 506 | public void testMatchIPEcnMethod() { |
| 507 | Criterion matchIPEcn = Criteria.matchIPEcn(ipEcn1); | 507 | Criterion matchIPEcn = Criteria.matchIPEcn(ipEcn1); |
| 508 | - Criteria.IPEcnCriterion ipEcnCriterion = | 508 | + IPEcnCriterion ipEcnCriterion = |
| 509 | checkAndConvert(matchIPEcn, | 509 | checkAndConvert(matchIPEcn, |
| 510 | Criterion.Type.IP_ECN, | 510 | Criterion.Type.IP_ECN, |
| 511 | - Criteria.IPEcnCriterion.class); | 511 | + IPEcnCriterion.class); |
| 512 | assertThat(ipEcnCriterion.ipEcn(), is(equalTo(ipEcn1))); | 512 | assertThat(ipEcnCriterion.ipEcn(), is(equalTo(ipEcn1))); |
| 513 | } | 513 | } |
| 514 | 514 | ||
| ... | @@ -531,10 +531,10 @@ public class CriteriaTest { | ... | @@ -531,10 +531,10 @@ public class CriteriaTest { |
| 531 | @Test | 531 | @Test |
| 532 | public void testMatchIpProtocolMethod() { | 532 | public void testMatchIpProtocolMethod() { |
| 533 | Criterion matchIPProtocol = Criteria.matchIPProtocol(protocol1); | 533 | Criterion matchIPProtocol = Criteria.matchIPProtocol(protocol1); |
| 534 | - Criteria.IPProtocolCriterion ipProtocolCriterion = | 534 | + IPProtocolCriterion ipProtocolCriterion = |
| 535 | checkAndConvert(matchIPProtocol, | 535 | checkAndConvert(matchIPProtocol, |
| 536 | Criterion.Type.IP_PROTO, | 536 | Criterion.Type.IP_PROTO, |
| 537 | - Criteria.IPProtocolCriterion.class); | 537 | + IPProtocolCriterion.class); |
| 538 | assertThat(ipProtocolCriterion.protocol(), is(equalTo(protocol1))); | 538 | assertThat(ipProtocolCriterion.protocol(), is(equalTo(protocol1))); |
| 539 | } | 539 | } |
| 540 | 540 | ||
| ... | @@ -557,10 +557,10 @@ public class CriteriaTest { | ... | @@ -557,10 +557,10 @@ public class CriteriaTest { |
| 557 | @Test | 557 | @Test |
| 558 | public void testMatchIPSrcMethod() { | 558 | public void testMatchIPSrcMethod() { |
| 559 | Criterion matchIpSrc = Criteria.matchIPSrc(ip1); | 559 | Criterion matchIpSrc = Criteria.matchIPSrc(ip1); |
| 560 | - Criteria.IPCriterion ipCriterion = | 560 | + IPCriterion ipCriterion = |
| 561 | checkAndConvert(matchIpSrc, | 561 | checkAndConvert(matchIpSrc, |
| 562 | Criterion.Type.IPV4_SRC, | 562 | Criterion.Type.IPV4_SRC, |
| 563 | - Criteria.IPCriterion.class); | 563 | + IPCriterion.class); |
| 564 | assertThat(ipCriterion.ip(), is(ip1)); | 564 | assertThat(ipCriterion.ip(), is(ip1)); |
| 565 | } | 565 | } |
| 566 | 566 | ||
| ... | @@ -570,10 +570,10 @@ public class CriteriaTest { | ... | @@ -570,10 +570,10 @@ public class CriteriaTest { |
| 570 | @Test | 570 | @Test |
| 571 | public void testMatchIPDstMethod() { | 571 | public void testMatchIPDstMethod() { |
| 572 | Criterion matchIPDst = Criteria.matchIPDst(ip1); | 572 | Criterion matchIPDst = Criteria.matchIPDst(ip1); |
| 573 | - Criteria.IPCriterion ipCriterion = | 573 | + IPCriterion ipCriterion = |
| 574 | checkAndConvert(matchIPDst, | 574 | checkAndConvert(matchIPDst, |
| 575 | Criterion.Type.IPV4_DST, | 575 | Criterion.Type.IPV4_DST, |
| 576 | - Criteria.IPCriterion.class); | 576 | + IPCriterion.class); |
| 577 | assertThat(ipCriterion.ip(), is(equalTo(ip1))); | 577 | assertThat(ipCriterion.ip(), is(equalTo(ip1))); |
| 578 | } | 578 | } |
| 579 | 579 | ||
| ... | @@ -583,10 +583,10 @@ public class CriteriaTest { | ... | @@ -583,10 +583,10 @@ public class CriteriaTest { |
| 583 | @Test | 583 | @Test |
| 584 | public void testMatchIPv6SrcMethod() { | 584 | public void testMatchIPv6SrcMethod() { |
| 585 | Criterion matchIpv6Src = Criteria.matchIPv6Src(ipv61); | 585 | Criterion matchIpv6Src = Criteria.matchIPv6Src(ipv61); |
| 586 | - Criteria.IPCriterion ipCriterion = | 586 | + IPCriterion ipCriterion = |
| 587 | checkAndConvert(matchIpv6Src, | 587 | checkAndConvert(matchIpv6Src, |
| 588 | Criterion.Type.IPV6_SRC, | 588 | Criterion.Type.IPV6_SRC, |
| 589 | - Criteria.IPCriterion.class); | 589 | + IPCriterion.class); |
| 590 | assertThat(ipCriterion.ip(), is(ipv61)); | 590 | assertThat(ipCriterion.ip(), is(ipv61)); |
| 591 | } | 591 | } |
| 592 | 592 | ||
| ... | @@ -596,10 +596,10 @@ public class CriteriaTest { | ... | @@ -596,10 +596,10 @@ public class CriteriaTest { |
| 596 | @Test | 596 | @Test |
| 597 | public void testMatchIPv6DstMethod() { | 597 | public void testMatchIPv6DstMethod() { |
| 598 | Criterion matchIPv6Dst = Criteria.matchIPv6Dst(ipv61); | 598 | Criterion matchIPv6Dst = Criteria.matchIPv6Dst(ipv61); |
| 599 | - Criteria.IPCriterion ipCriterion = | 599 | + IPCriterion ipCriterion = |
| 600 | checkAndConvert(matchIPv6Dst, | 600 | checkAndConvert(matchIPv6Dst, |
| 601 | Criterion.Type.IPV6_DST, | 601 | Criterion.Type.IPV6_DST, |
| 602 | - Criteria.IPCriterion.class); | 602 | + IPCriterion.class); |
| 603 | assertThat(ipCriterion.ip(), is(equalTo(ipv61))); | 603 | assertThat(ipCriterion.ip(), is(equalTo(ipv61))); |
| 604 | } | 604 | } |
| 605 | 605 | ||
| ... | @@ -627,10 +627,10 @@ public class CriteriaTest { | ... | @@ -627,10 +627,10 @@ public class CriteriaTest { |
| 627 | @Test | 627 | @Test |
| 628 | public void testMatchTcpSrcMethod() { | 628 | public void testMatchTcpSrcMethod() { |
| 629 | Criterion matchTcpSrc = Criteria.matchTcpSrc(1); | 629 | Criterion matchTcpSrc = Criteria.matchTcpSrc(1); |
| 630 | - Criteria.TcpPortCriterion tcpPortCriterion = | 630 | + TcpPortCriterion tcpPortCriterion = |
| 631 | checkAndConvert(matchTcpSrc, | 631 | checkAndConvert(matchTcpSrc, |
| 632 | Criterion.Type.TCP_SRC, | 632 | Criterion.Type.TCP_SRC, |
| 633 | - Criteria.TcpPortCriterion.class); | 633 | + TcpPortCriterion.class); |
| 634 | assertThat(tcpPortCriterion.tcpPort(), is(equalTo(1))); | 634 | assertThat(tcpPortCriterion.tcpPort(), is(equalTo(1))); |
| 635 | } | 635 | } |
| 636 | 636 | ||
| ... | @@ -640,10 +640,10 @@ public class CriteriaTest { | ... | @@ -640,10 +640,10 @@ public class CriteriaTest { |
| 640 | @Test | 640 | @Test |
| 641 | public void testMatchTcpDstMethod() { | 641 | public void testMatchTcpDstMethod() { |
| 642 | Criterion matchTcpDst = Criteria.matchTcpDst(1); | 642 | Criterion matchTcpDst = Criteria.matchTcpDst(1); |
| 643 | - Criteria.TcpPortCriterion tcpPortCriterion = | 643 | + TcpPortCriterion tcpPortCriterion = |
| 644 | checkAndConvert(matchTcpDst, | 644 | checkAndConvert(matchTcpDst, |
| 645 | Criterion.Type.TCP_DST, | 645 | Criterion.Type.TCP_DST, |
| 646 | - Criteria.TcpPortCriterion.class); | 646 | + TcpPortCriterion.class); |
| 647 | assertThat(tcpPortCriterion.tcpPort(), is(equalTo(1))); | 647 | assertThat(tcpPortCriterion.tcpPort(), is(equalTo(1))); |
| 648 | } | 648 | } |
| 649 | 649 | ||
| ... | @@ -666,10 +666,10 @@ public class CriteriaTest { | ... | @@ -666,10 +666,10 @@ public class CriteriaTest { |
| 666 | @Test | 666 | @Test |
| 667 | public void testMatchUdpSrcMethod() { | 667 | public void testMatchUdpSrcMethod() { |
| 668 | Criterion matchUdpSrc = Criteria.matchUdpSrc(1); | 668 | Criterion matchUdpSrc = Criteria.matchUdpSrc(1); |
| 669 | - Criteria.UdpPortCriterion udpPortCriterion = | 669 | + UdpPortCriterion udpPortCriterion = |
| 670 | checkAndConvert(matchUdpSrc, | 670 | checkAndConvert(matchUdpSrc, |
| 671 | Criterion.Type.UDP_SRC, | 671 | Criterion.Type.UDP_SRC, |
| 672 | - Criteria.UdpPortCriterion.class); | 672 | + UdpPortCriterion.class); |
| 673 | assertThat(udpPortCriterion.udpPort(), is(equalTo(1))); | 673 | assertThat(udpPortCriterion.udpPort(), is(equalTo(1))); |
| 674 | } | 674 | } |
| 675 | 675 | ||
| ... | @@ -679,10 +679,10 @@ public class CriteriaTest { | ... | @@ -679,10 +679,10 @@ public class CriteriaTest { |
| 679 | @Test | 679 | @Test |
| 680 | public void testMatchUdpDstMethod() { | 680 | public void testMatchUdpDstMethod() { |
| 681 | Criterion matchUdpDst = Criteria.matchUdpDst(1); | 681 | Criterion matchUdpDst = Criteria.matchUdpDst(1); |
| 682 | - Criteria.UdpPortCriterion udpPortCriterion = | 682 | + UdpPortCriterion udpPortCriterion = |
| 683 | checkAndConvert(matchUdpDst, | 683 | checkAndConvert(matchUdpDst, |
| 684 | Criterion.Type.UDP_DST, | 684 | Criterion.Type.UDP_DST, |
| 685 | - Criteria.UdpPortCriterion.class); | 685 | + UdpPortCriterion.class); |
| 686 | assertThat(udpPortCriterion.udpPort(), is(equalTo(1))); | 686 | assertThat(udpPortCriterion.udpPort(), is(equalTo(1))); |
| 687 | } | 687 | } |
| 688 | 688 | ||
| ... | @@ -705,10 +705,10 @@ public class CriteriaTest { | ... | @@ -705,10 +705,10 @@ public class CriteriaTest { |
| 705 | @Test | 705 | @Test |
| 706 | public void testMatchSctpSrcMethod() { | 706 | public void testMatchSctpSrcMethod() { |
| 707 | Criterion matchSctpSrc = Criteria.matchSctpSrc(1); | 707 | Criterion matchSctpSrc = Criteria.matchSctpSrc(1); |
| 708 | - Criteria.SctpPortCriterion sctpPortCriterion = | 708 | + SctpPortCriterion sctpPortCriterion = |
| 709 | checkAndConvert(matchSctpSrc, | 709 | checkAndConvert(matchSctpSrc, |
| 710 | Criterion.Type.SCTP_SRC, | 710 | Criterion.Type.SCTP_SRC, |
| 711 | - Criteria.SctpPortCriterion.class); | 711 | + SctpPortCriterion.class); |
| 712 | assertThat(sctpPortCriterion.sctpPort(), is(equalTo(1))); | 712 | assertThat(sctpPortCriterion.sctpPort(), is(equalTo(1))); |
| 713 | } | 713 | } |
| 714 | 714 | ||
| ... | @@ -718,10 +718,10 @@ public class CriteriaTest { | ... | @@ -718,10 +718,10 @@ public class CriteriaTest { |
| 718 | @Test | 718 | @Test |
| 719 | public void testMatchSctpDstMethod() { | 719 | public void testMatchSctpDstMethod() { |
| 720 | Criterion matchSctpDst = Criteria.matchSctpDst(1); | 720 | Criterion matchSctpDst = Criteria.matchSctpDst(1); |
| 721 | - Criteria.SctpPortCriterion sctpPortCriterion = | 721 | + SctpPortCriterion sctpPortCriterion = |
| 722 | checkAndConvert(matchSctpDst, | 722 | checkAndConvert(matchSctpDst, |
| 723 | Criterion.Type.SCTP_DST, | 723 | Criterion.Type.SCTP_DST, |
| 724 | - Criteria.SctpPortCriterion.class); | 724 | + SctpPortCriterion.class); |
| 725 | assertThat(sctpPortCriterion.sctpPort(), is(equalTo(1))); | 725 | assertThat(sctpPortCriterion.sctpPort(), is(equalTo(1))); |
| 726 | } | 726 | } |
| 727 | 727 | ||
| ... | @@ -745,10 +745,10 @@ public class CriteriaTest { | ... | @@ -745,10 +745,10 @@ public class CriteriaTest { |
| 745 | public void testMatchIcmpTypeMethod() { | 745 | public void testMatchIcmpTypeMethod() { |
| 746 | short icmpType = 12; | 746 | short icmpType = 12; |
| 747 | Criterion matchIcmpType = Criteria.matchIcmpType(icmpType); | 747 | Criterion matchIcmpType = Criteria.matchIcmpType(icmpType); |
| 748 | - Criteria.IcmpTypeCriterion icmpTypeCriterion = | 748 | + IcmpTypeCriterion icmpTypeCriterion = |
| 749 | checkAndConvert(matchIcmpType, | 749 | checkAndConvert(matchIcmpType, |
| 750 | Criterion.Type.ICMPV4_TYPE, | 750 | Criterion.Type.ICMPV4_TYPE, |
| 751 | - Criteria.IcmpTypeCriterion.class); | 751 | + IcmpTypeCriterion.class); |
| 752 | assertThat(icmpTypeCriterion.icmpType(), is(equalTo(icmpType))); | 752 | assertThat(icmpTypeCriterion.icmpType(), is(equalTo(icmpType))); |
| 753 | } | 753 | } |
| 754 | 754 | ||
| ... | @@ -772,10 +772,10 @@ public class CriteriaTest { | ... | @@ -772,10 +772,10 @@ public class CriteriaTest { |
| 772 | public void testMatchIcmpCodeMethod() { | 772 | public void testMatchIcmpCodeMethod() { |
| 773 | short icmpCode = 12; | 773 | short icmpCode = 12; |
| 774 | Criterion matchIcmpCode = Criteria.matchIcmpCode(icmpCode); | 774 | Criterion matchIcmpCode = Criteria.matchIcmpCode(icmpCode); |
| 775 | - Criteria.IcmpCodeCriterion icmpCodeCriterion = | 775 | + IcmpCodeCriterion icmpCodeCriterion = |
| 776 | checkAndConvert(matchIcmpCode, | 776 | checkAndConvert(matchIcmpCode, |
| 777 | Criterion.Type.ICMPV4_CODE, | 777 | Criterion.Type.ICMPV4_CODE, |
| 778 | - Criteria.IcmpCodeCriterion.class); | 778 | + IcmpCodeCriterion.class); |
| 779 | assertThat(icmpCodeCriterion.icmpCode(), is(equalTo(icmpCode))); | 779 | assertThat(icmpCodeCriterion.icmpCode(), is(equalTo(icmpCode))); |
| 780 | } | 780 | } |
| 781 | 781 | ||
| ... | @@ -799,10 +799,10 @@ public class CriteriaTest { | ... | @@ -799,10 +799,10 @@ public class CriteriaTest { |
| 799 | public void testMatchIPv6FlowLabelMethod() { | 799 | public void testMatchIPv6FlowLabelMethod() { |
| 800 | int flowLabel = 12; | 800 | int flowLabel = 12; |
| 801 | Criterion matchFlowLabel = Criteria.matchIPv6FlowLabel(flowLabel); | 801 | Criterion matchFlowLabel = Criteria.matchIPv6FlowLabel(flowLabel); |
| 802 | - Criteria.IPv6FlowLabelCriterion flowLabelCriterion = | 802 | + IPv6FlowLabelCriterion flowLabelCriterion = |
| 803 | checkAndConvert(matchFlowLabel, | 803 | checkAndConvert(matchFlowLabel, |
| 804 | Criterion.Type.IPV6_FLABEL, | 804 | Criterion.Type.IPV6_FLABEL, |
| 805 | - Criteria.IPv6FlowLabelCriterion.class); | 805 | + IPv6FlowLabelCriterion.class); |
| 806 | assertThat(flowLabelCriterion.flowLabel(), is(equalTo(flowLabel))); | 806 | assertThat(flowLabelCriterion.flowLabel(), is(equalTo(flowLabel))); |
| 807 | } | 807 | } |
| 808 | 808 | ||
| ... | @@ -826,10 +826,10 @@ public class CriteriaTest { | ... | @@ -826,10 +826,10 @@ public class CriteriaTest { |
| 826 | public void testMatchIcmpv6TypeMethod() { | 826 | public void testMatchIcmpv6TypeMethod() { |
| 827 | short icmpv6Type = 12; | 827 | short icmpv6Type = 12; |
| 828 | Criterion matchIcmpv6Type = Criteria.matchIcmpv6Type(icmpv6Type); | 828 | Criterion matchIcmpv6Type = Criteria.matchIcmpv6Type(icmpv6Type); |
| 829 | - Criteria.Icmpv6TypeCriterion icmpv6TypeCriterion = | 829 | + Icmpv6TypeCriterion icmpv6TypeCriterion = |
| 830 | checkAndConvert(matchIcmpv6Type, | 830 | checkAndConvert(matchIcmpv6Type, |
| 831 | Criterion.Type.ICMPV6_TYPE, | 831 | Criterion.Type.ICMPV6_TYPE, |
| 832 | - Criteria.Icmpv6TypeCriterion.class); | 832 | + Icmpv6TypeCriterion.class); |
| 833 | assertThat(icmpv6TypeCriterion.icmpv6Type(), is(equalTo(icmpv6Type))); | 833 | assertThat(icmpv6TypeCriterion.icmpv6Type(), is(equalTo(icmpv6Type))); |
| 834 | } | 834 | } |
| 835 | 835 | ||
| ... | @@ -853,10 +853,10 @@ public class CriteriaTest { | ... | @@ -853,10 +853,10 @@ public class CriteriaTest { |
| 853 | public void testMatchIcmpv6CodeMethod() { | 853 | public void testMatchIcmpv6CodeMethod() { |
| 854 | short icmpv6Code = 12; | 854 | short icmpv6Code = 12; |
| 855 | Criterion matchIcmpv6Code = Criteria.matchIcmpv6Code(icmpv6Code); | 855 | Criterion matchIcmpv6Code = Criteria.matchIcmpv6Code(icmpv6Code); |
| 856 | - Criteria.Icmpv6CodeCriterion icmpv6CodeCriterion = | 856 | + Icmpv6CodeCriterion icmpv6CodeCriterion = |
| 857 | checkAndConvert(matchIcmpv6Code, | 857 | checkAndConvert(matchIcmpv6Code, |
| 858 | Criterion.Type.ICMPV6_CODE, | 858 | Criterion.Type.ICMPV6_CODE, |
| 859 | - Criteria.Icmpv6CodeCriterion.class); | 859 | + Icmpv6CodeCriterion.class); |
| 860 | assertThat(icmpv6CodeCriterion.icmpv6Code(), is(equalTo(icmpv6Code))); | 860 | assertThat(icmpv6CodeCriterion.icmpv6Code(), is(equalTo(icmpv6Code))); |
| 861 | } | 861 | } |
| 862 | 862 | ||
| ... | @@ -880,10 +880,10 @@ public class CriteriaTest { | ... | @@ -880,10 +880,10 @@ public class CriteriaTest { |
| 880 | public void testMatchIPv6NDTargetAddressMethod() { | 880 | public void testMatchIPv6NDTargetAddressMethod() { |
| 881 | Criterion matchTargetAddress = | 881 | Criterion matchTargetAddress = |
| 882 | Criteria.matchIPv6NDTargetAddress(ip6TargetAddress1); | 882 | Criteria.matchIPv6NDTargetAddress(ip6TargetAddress1); |
| 883 | - Criteria.IPv6NDTargetAddressCriterion targetAddressCriterion = | 883 | + IPv6NDTargetAddressCriterion targetAddressCriterion = |
| 884 | checkAndConvert(matchTargetAddress, | 884 | checkAndConvert(matchTargetAddress, |
| 885 | Criterion.Type.IPV6_ND_TARGET, | 885 | Criterion.Type.IPV6_ND_TARGET, |
| 886 | - Criteria.IPv6NDTargetAddressCriterion.class); | 886 | + IPv6NDTargetAddressCriterion.class); |
| 887 | assertThat(targetAddressCriterion.targetAddress(), | 887 | assertThat(targetAddressCriterion.targetAddress(), |
| 888 | is(ip6TargetAddress1)); | 888 | is(ip6TargetAddress1)); |
| 889 | } | 889 | } |
| ... | @@ -909,10 +909,10 @@ public class CriteriaTest { | ... | @@ -909,10 +909,10 @@ public class CriteriaTest { |
| 909 | public void testMatchIPv6NDSourceLinkLayerAddressMethod() { | 909 | public void testMatchIPv6NDSourceLinkLayerAddressMethod() { |
| 910 | Criterion matchSrcLlAddr = | 910 | Criterion matchSrcLlAddr = |
| 911 | Criteria.matchIPv6NDSourceLinkLayerAddress(llMac1); | 911 | Criteria.matchIPv6NDSourceLinkLayerAddress(llMac1); |
| 912 | - Criteria.IPv6NDLinkLayerAddressCriterion srcLlCriterion = | 912 | + IPv6NDLinkLayerAddressCriterion srcLlCriterion = |
| 913 | checkAndConvert(matchSrcLlAddr, | 913 | checkAndConvert(matchSrcLlAddr, |
| 914 | Criterion.Type.IPV6_ND_SLL, | 914 | Criterion.Type.IPV6_ND_SLL, |
| 915 | - Criteria.IPv6NDLinkLayerAddressCriterion.class); | 915 | + IPv6NDLinkLayerAddressCriterion.class); |
| 916 | assertThat(srcLlCriterion.mac(), is(equalTo(llMac1))); | 916 | assertThat(srcLlCriterion.mac(), is(equalTo(llMac1))); |
| 917 | } | 917 | } |
| 918 | 918 | ||
| ... | @@ -923,10 +923,10 @@ public class CriteriaTest { | ... | @@ -923,10 +923,10 @@ public class CriteriaTest { |
| 923 | public void testMatchIPv6NDTargetLinkLayerAddressMethod() { | 923 | public void testMatchIPv6NDTargetLinkLayerAddressMethod() { |
| 924 | Criterion matchTargetLlAddr = | 924 | Criterion matchTargetLlAddr = |
| 925 | Criteria.matchIPv6NDTargetLinkLayerAddress(llMac1); | 925 | Criteria.matchIPv6NDTargetLinkLayerAddress(llMac1); |
| 926 | - Criteria.IPv6NDLinkLayerAddressCriterion targetLlCriterion = | 926 | + IPv6NDLinkLayerAddressCriterion targetLlCriterion = |
| 927 | checkAndConvert(matchTargetLlAddr, | 927 | checkAndConvert(matchTargetLlAddr, |
| 928 | Criterion.Type.IPV6_ND_TLL, | 928 | Criterion.Type.IPV6_ND_TLL, |
| 929 | - Criteria.IPv6NDLinkLayerAddressCriterion.class); | 929 | + IPv6NDLinkLayerAddressCriterion.class); |
| 930 | assertThat(targetLlCriterion.mac(), is(equalTo(llMac1))); | 930 | assertThat(targetLlCriterion.mac(), is(equalTo(llMac1))); |
| 931 | } | 931 | } |
| 932 | 932 | ||
| ... | @@ -954,10 +954,10 @@ public class CriteriaTest { | ... | @@ -954,10 +954,10 @@ public class CriteriaTest { |
| 954 | @Test | 954 | @Test |
| 955 | public void testMatchMplsLabelMethod() { | 955 | public void testMatchMplsLabelMethod() { |
| 956 | Criterion matchMplsLabel = Criteria.matchMplsLabel(mpls1); | 956 | Criterion matchMplsLabel = Criteria.matchMplsLabel(mpls1); |
| 957 | - Criteria.MplsCriterion mplsCriterion = | 957 | + MplsCriterion mplsCriterion = |
| 958 | checkAndConvert(matchMplsLabel, | 958 | checkAndConvert(matchMplsLabel, |
| 959 | Criterion.Type.MPLS_LABEL, | 959 | Criterion.Type.MPLS_LABEL, |
| 960 | - Criteria.MplsCriterion.class); | 960 | + MplsCriterion.class); |
| 961 | assertThat(mplsCriterion.label(), is(equalTo(mpls1))); | 961 | assertThat(mplsCriterion.label(), is(equalTo(mpls1))); |
| 962 | } | 962 | } |
| 963 | 963 | ||
| ... | @@ -981,10 +981,10 @@ public class CriteriaTest { | ... | @@ -981,10 +981,10 @@ public class CriteriaTest { |
| 981 | public void testMatchIPv6ExthdrFlagsMethod() { | 981 | public void testMatchIPv6ExthdrFlagsMethod() { |
| 982 | Criterion matchExthdrFlags = | 982 | Criterion matchExthdrFlags = |
| 983 | Criteria.matchIPv6ExthdrFlags(ipv6ExthdrFlags1); | 983 | Criteria.matchIPv6ExthdrFlags(ipv6ExthdrFlags1); |
| 984 | - Criteria.IPv6ExthdrFlagsCriterion exthdrFlagsCriterion = | 984 | + IPv6ExthdrFlagsCriterion exthdrFlagsCriterion = |
| 985 | checkAndConvert(matchExthdrFlags, | 985 | checkAndConvert(matchExthdrFlags, |
| 986 | Criterion.Type.IPV6_EXTHDR, | 986 | Criterion.Type.IPV6_EXTHDR, |
| 987 | - Criteria.IPv6ExthdrFlagsCriterion.class); | 987 | + IPv6ExthdrFlagsCriterion.class); |
| 988 | assertThat(exthdrFlagsCriterion.exthdrFlags(), | 988 | assertThat(exthdrFlagsCriterion.exthdrFlags(), |
| 989 | is(equalTo(ipv6ExthdrFlags1))); | 989 | is(equalTo(ipv6ExthdrFlags1))); |
| 990 | } | 990 | } |
| ... | @@ -1009,10 +1009,10 @@ public class CriteriaTest { | ... | @@ -1009,10 +1009,10 @@ public class CriteriaTest { |
| 1009 | @Test | 1009 | @Test |
| 1010 | public void testMatchLambdaMethod() { | 1010 | public void testMatchLambdaMethod() { |
| 1011 | Criterion matchLambda = Criteria.matchLambda(lambda1); | 1011 | Criterion matchLambda = Criteria.matchLambda(lambda1); |
| 1012 | - Criteria.LambdaCriterion lambdaCriterion = | 1012 | + LambdaCriterion lambdaCriterion = |
| 1013 | checkAndConvert(matchLambda, | 1013 | checkAndConvert(matchLambda, |
| 1014 | Criterion.Type.OCH_SIGID, | 1014 | Criterion.Type.OCH_SIGID, |
| 1015 | - Criteria.LambdaCriterion.class); | 1015 | + LambdaCriterion.class); |
| 1016 | assertThat(lambdaCriterion.lambda(), is(equalTo(lambda1))); | 1016 | assertThat(lambdaCriterion.lambda(), is(equalTo(lambda1))); |
| 1017 | } | 1017 | } |
| 1018 | 1018 | ||
| ... | @@ -1035,10 +1035,10 @@ public class CriteriaTest { | ... | @@ -1035,10 +1035,10 @@ public class CriteriaTest { |
| 1035 | @Test | 1035 | @Test |
| 1036 | public void testMatchOpticalSignalTypeMethod() { | 1036 | public void testMatchOpticalSignalTypeMethod() { |
| 1037 | Criterion matchLambda = Criteria.matchOpticalSignalType(signalLambda1); | 1037 | Criterion matchLambda = Criteria.matchOpticalSignalType(signalLambda1); |
| 1038 | - Criteria.OpticalSignalTypeCriterion opticalSignalTypeCriterion = | 1038 | + OpticalSignalTypeCriterion opticalSignalTypeCriterion = |
| 1039 | checkAndConvert(matchLambda, | 1039 | checkAndConvert(matchLambda, |
| 1040 | Criterion.Type.OCH_SIGTYPE, | 1040 | Criterion.Type.OCH_SIGTYPE, |
| 1041 | - Criteria.OpticalSignalTypeCriterion.class); | 1041 | + OpticalSignalTypeCriterion.class); |
| 1042 | assertThat(opticalSignalTypeCriterion.signalType(), is(equalTo(signalLambda1))); | 1042 | assertThat(opticalSignalTypeCriterion.signalType(), is(equalTo(signalLambda1))); |
| 1043 | } | 1043 | } |
| 1044 | 1044 | ... | ... |
| ... | @@ -19,8 +19,31 @@ import java.util.EnumMap; | ... | @@ -19,8 +19,31 @@ import java.util.EnumMap; |
| 19 | 19 | ||
| 20 | import org.onosproject.codec.CodecContext; | 20 | import org.onosproject.codec.CodecContext; |
| 21 | import org.onosproject.codec.JsonCodec; | 21 | import org.onosproject.codec.JsonCodec; |
| 22 | -import org.onosproject.net.flow.criteria.Criteria; | ||
| 23 | import org.onosproject.net.flow.criteria.Criterion; | 22 | import org.onosproject.net.flow.criteria.Criterion; |
| 23 | +import org.onosproject.net.flow.criteria.EthCriterion; | ||
| 24 | +import org.onosproject.net.flow.criteria.EthTypeCriterion; | ||
| 25 | +import org.onosproject.net.flow.criteria.IPCriterion; | ||
| 26 | +import org.onosproject.net.flow.criteria.IPDscpCriterion; | ||
| 27 | +import org.onosproject.net.flow.criteria.IPEcnCriterion; | ||
| 28 | +import org.onosproject.net.flow.criteria.IPProtocolCriterion; | ||
| 29 | +import org.onosproject.net.flow.criteria.IPv6ExthdrFlagsCriterion; | ||
| 30 | +import org.onosproject.net.flow.criteria.IPv6FlowLabelCriterion; | ||
| 31 | +import org.onosproject.net.flow.criteria.IPv6NDLinkLayerAddressCriterion; | ||
| 32 | +import org.onosproject.net.flow.criteria.IPv6NDTargetAddressCriterion; | ||
| 33 | +import org.onosproject.net.flow.criteria.IcmpCodeCriterion; | ||
| 34 | +import org.onosproject.net.flow.criteria.IcmpTypeCriterion; | ||
| 35 | +import org.onosproject.net.flow.criteria.Icmpv6CodeCriterion; | ||
| 36 | +import org.onosproject.net.flow.criteria.Icmpv6TypeCriterion; | ||
| 37 | +import org.onosproject.net.flow.criteria.LambdaCriterion; | ||
| 38 | +import org.onosproject.net.flow.criteria.MetadataCriterion; | ||
| 39 | +import org.onosproject.net.flow.criteria.MplsCriterion; | ||
| 40 | +import org.onosproject.net.flow.criteria.OpticalSignalTypeCriterion; | ||
| 41 | +import org.onosproject.net.flow.criteria.PortCriterion; | ||
| 42 | +import org.onosproject.net.flow.criteria.SctpPortCriterion; | ||
| 43 | +import org.onosproject.net.flow.criteria.TcpPortCriterion; | ||
| 44 | +import org.onosproject.net.flow.criteria.UdpPortCriterion; | ||
| 45 | +import org.onosproject.net.flow.criteria.VlanIdCriterion; | ||
| 46 | +import org.onosproject.net.flow.criteria.VlanPcpCriterion; | ||
| 24 | import org.slf4j.Logger; | 47 | import org.slf4j.Logger; |
| 25 | import org.slf4j.LoggerFactory; | 48 | import org.slf4j.LoggerFactory; |
| 26 | 49 | ||
| ... | @@ -107,7 +130,7 @@ public final class CriterionCodec extends JsonCodec<Criterion> { | ... | @@ -107,7 +130,7 @@ public final class CriterionCodec extends JsonCodec<Criterion> { |
| 107 | private static class FormatInPort implements CriterionTypeFormatter { | 130 | private static class FormatInPort implements CriterionTypeFormatter { |
| 108 | @Override | 131 | @Override |
| 109 | public ObjectNode formatCriterion(ObjectNode root, Criterion criterion) { | 132 | public ObjectNode formatCriterion(ObjectNode root, Criterion criterion) { |
| 110 | - final Criteria.PortCriterion portCriterion = (Criteria.PortCriterion) criterion; | 133 | + final PortCriterion portCriterion = (PortCriterion) criterion; |
| 111 | return root.put("port", portCriterion.port().toLong()); | 134 | return root.put("port", portCriterion.port().toLong()); |
| 112 | } | 135 | } |
| 113 | } | 136 | } |
| ... | @@ -115,8 +138,8 @@ public final class CriterionCodec extends JsonCodec<Criterion> { | ... | @@ -115,8 +138,8 @@ public final class CriterionCodec extends JsonCodec<Criterion> { |
| 115 | private static class FormatMetadata implements CriterionTypeFormatter { | 138 | private static class FormatMetadata implements CriterionTypeFormatter { |
| 116 | @Override | 139 | @Override |
| 117 | public ObjectNode formatCriterion(ObjectNode root, Criterion criterion) { | 140 | public ObjectNode formatCriterion(ObjectNode root, Criterion criterion) { |
| 118 | - final Criteria.MetadataCriterion metadataCriterion = | 141 | + final MetadataCriterion metadataCriterion = |
| 119 | - (Criteria.MetadataCriterion) criterion; | 142 | + (MetadataCriterion) criterion; |
| 120 | return root.put("metadata", metadataCriterion.metadata()); | 143 | return root.put("metadata", metadataCriterion.metadata()); |
| 121 | } | 144 | } |
| 122 | } | 145 | } |
| ... | @@ -124,7 +147,7 @@ public final class CriterionCodec extends JsonCodec<Criterion> { | ... | @@ -124,7 +147,7 @@ public final class CriterionCodec extends JsonCodec<Criterion> { |
| 124 | private static class FormatEth implements CriterionTypeFormatter { | 147 | private static class FormatEth implements CriterionTypeFormatter { |
| 125 | @Override | 148 | @Override |
| 126 | public ObjectNode formatCriterion(ObjectNode root, Criterion criterion) { | 149 | public ObjectNode formatCriterion(ObjectNode root, Criterion criterion) { |
| 127 | - final Criteria.EthCriterion ethCriterion = (Criteria.EthCriterion) criterion; | 150 | + final EthCriterion ethCriterion = (EthCriterion) criterion; |
| 128 | return root.put("mac", ethCriterion.mac().toString()); | 151 | return root.put("mac", ethCriterion.mac().toString()); |
| 129 | } | 152 | } |
| 130 | } | 153 | } |
| ... | @@ -132,8 +155,8 @@ public final class CriterionCodec extends JsonCodec<Criterion> { | ... | @@ -132,8 +155,8 @@ public final class CriterionCodec extends JsonCodec<Criterion> { |
| 132 | private static class FormatEthType implements CriterionTypeFormatter { | 155 | private static class FormatEthType implements CriterionTypeFormatter { |
| 133 | @Override | 156 | @Override |
| 134 | public ObjectNode formatCriterion(ObjectNode root, Criterion criterion) { | 157 | public ObjectNode formatCriterion(ObjectNode root, Criterion criterion) { |
| 135 | - final Criteria.EthTypeCriterion ethTypeCriterion = | 158 | + final EthTypeCriterion ethTypeCriterion = |
| 136 | - (Criteria.EthTypeCriterion) criterion; | 159 | + (EthTypeCriterion) criterion; |
| 137 | return root.put("ethType", ethTypeCriterion.ethType()); | 160 | return root.put("ethType", ethTypeCriterion.ethType()); |
| 138 | } | 161 | } |
| 139 | } | 162 | } |
| ... | @@ -141,8 +164,8 @@ public final class CriterionCodec extends JsonCodec<Criterion> { | ... | @@ -141,8 +164,8 @@ public final class CriterionCodec extends JsonCodec<Criterion> { |
| 141 | private static class FormatVlanVid implements CriterionTypeFormatter { | 164 | private static class FormatVlanVid implements CriterionTypeFormatter { |
| 142 | @Override | 165 | @Override |
| 143 | public ObjectNode formatCriterion(ObjectNode root, Criterion criterion) { | 166 | public ObjectNode formatCriterion(ObjectNode root, Criterion criterion) { |
| 144 | - final Criteria.VlanIdCriterion vlanIdCriterion = | 167 | + final VlanIdCriterion vlanIdCriterion = |
| 145 | - (Criteria.VlanIdCriterion) criterion; | 168 | + (VlanIdCriterion) criterion; |
| 146 | return root.put("vlanId", vlanIdCriterion.vlanId().toShort()); | 169 | return root.put("vlanId", vlanIdCriterion.vlanId().toShort()); |
| 147 | } | 170 | } |
| 148 | } | 171 | } |
| ... | @@ -150,8 +173,8 @@ public final class CriterionCodec extends JsonCodec<Criterion> { | ... | @@ -150,8 +173,8 @@ public final class CriterionCodec extends JsonCodec<Criterion> { |
| 150 | private static class FormatVlanPcp implements CriterionTypeFormatter { | 173 | private static class FormatVlanPcp implements CriterionTypeFormatter { |
| 151 | @Override | 174 | @Override |
| 152 | public ObjectNode formatCriterion(ObjectNode root, Criterion criterion) { | 175 | public ObjectNode formatCriterion(ObjectNode root, Criterion criterion) { |
| 153 | - final Criteria.VlanPcpCriterion vlanPcpCriterion = | 176 | + final VlanPcpCriterion vlanPcpCriterion = |
| 154 | - (Criteria.VlanPcpCriterion) criterion; | 177 | + (VlanPcpCriterion) criterion; |
| 155 | return root.put("priority", vlanPcpCriterion.priority()); | 178 | return root.put("priority", vlanPcpCriterion.priority()); |
| 156 | } | 179 | } |
| 157 | } | 180 | } |
| ... | @@ -159,8 +182,8 @@ public final class CriterionCodec extends JsonCodec<Criterion> { | ... | @@ -159,8 +182,8 @@ public final class CriterionCodec extends JsonCodec<Criterion> { |
| 159 | private static class FormatIpDscp implements CriterionTypeFormatter { | 182 | private static class FormatIpDscp implements CriterionTypeFormatter { |
| 160 | @Override | 183 | @Override |
| 161 | public ObjectNode formatCriterion(ObjectNode root, Criterion criterion) { | 184 | public ObjectNode formatCriterion(ObjectNode root, Criterion criterion) { |
| 162 | - final Criteria.IPDscpCriterion ipDscpCriterion = | 185 | + final IPDscpCriterion ipDscpCriterion = |
| 163 | - (Criteria.IPDscpCriterion) criterion; | 186 | + (IPDscpCriterion) criterion; |
| 164 | return root.put("ipDscp", ipDscpCriterion.ipDscp()); | 187 | return root.put("ipDscp", ipDscpCriterion.ipDscp()); |
| 165 | } | 188 | } |
| 166 | } | 189 | } |
| ... | @@ -168,8 +191,8 @@ public final class CriterionCodec extends JsonCodec<Criterion> { | ... | @@ -168,8 +191,8 @@ public final class CriterionCodec extends JsonCodec<Criterion> { |
| 168 | private static class FormatIpEcn implements CriterionTypeFormatter { | 191 | private static class FormatIpEcn implements CriterionTypeFormatter { |
| 169 | @Override | 192 | @Override |
| 170 | public ObjectNode formatCriterion(ObjectNode root, Criterion criterion) { | 193 | public ObjectNode formatCriterion(ObjectNode root, Criterion criterion) { |
| 171 | - final Criteria.IPEcnCriterion ipEcnCriterion = | 194 | + final IPEcnCriterion ipEcnCriterion = |
| 172 | - (Criteria.IPEcnCriterion) criterion; | 195 | + (IPEcnCriterion) criterion; |
| 173 | return root.put("ipEcn", ipEcnCriterion.ipEcn()); | 196 | return root.put("ipEcn", ipEcnCriterion.ipEcn()); |
| 174 | } | 197 | } |
| 175 | } | 198 | } |
| ... | @@ -177,8 +200,8 @@ public final class CriterionCodec extends JsonCodec<Criterion> { | ... | @@ -177,8 +200,8 @@ public final class CriterionCodec extends JsonCodec<Criterion> { |
| 177 | private static class FormatIpProto implements CriterionTypeFormatter { | 200 | private static class FormatIpProto implements CriterionTypeFormatter { |
| 178 | @Override | 201 | @Override |
| 179 | public ObjectNode formatCriterion(ObjectNode root, Criterion criterion) { | 202 | public ObjectNode formatCriterion(ObjectNode root, Criterion criterion) { |
| 180 | - final Criteria.IPProtocolCriterion iPProtocolCriterion = | 203 | + final IPProtocolCriterion iPProtocolCriterion = |
| 181 | - (Criteria.IPProtocolCriterion) criterion; | 204 | + (IPProtocolCriterion) criterion; |
| 182 | return root.put("protocol", iPProtocolCriterion.protocol()); | 205 | return root.put("protocol", iPProtocolCriterion.protocol()); |
| 183 | } | 206 | } |
| 184 | } | 207 | } |
| ... | @@ -186,7 +209,7 @@ public final class CriterionCodec extends JsonCodec<Criterion> { | ... | @@ -186,7 +209,7 @@ public final class CriterionCodec extends JsonCodec<Criterion> { |
| 186 | private static class FormatIp implements CriterionTypeFormatter { | 209 | private static class FormatIp implements CriterionTypeFormatter { |
| 187 | @Override | 210 | @Override |
| 188 | public ObjectNode formatCriterion(ObjectNode root, Criterion criterion) { | 211 | public ObjectNode formatCriterion(ObjectNode root, Criterion criterion) { |
| 189 | - final Criteria.IPCriterion iPCriterion = (Criteria.IPCriterion) criterion; | 212 | + final IPCriterion iPCriterion = (IPCriterion) criterion; |
| 190 | return root.put("ip", iPCriterion.ip().toString()); | 213 | return root.put("ip", iPCriterion.ip().toString()); |
| 191 | } | 214 | } |
| 192 | } | 215 | } |
| ... | @@ -194,8 +217,8 @@ public final class CriterionCodec extends JsonCodec<Criterion> { | ... | @@ -194,8 +217,8 @@ public final class CriterionCodec extends JsonCodec<Criterion> { |
| 194 | private static class FormatTcp implements CriterionTypeFormatter { | 217 | private static class FormatTcp implements CriterionTypeFormatter { |
| 195 | @Override | 218 | @Override |
| 196 | public ObjectNode formatCriterion(ObjectNode root, Criterion criterion) { | 219 | public ObjectNode formatCriterion(ObjectNode root, Criterion criterion) { |
| 197 | - final Criteria.TcpPortCriterion tcpPortCriterion = | 220 | + final TcpPortCriterion tcpPortCriterion = |
| 198 | - (Criteria.TcpPortCriterion) criterion; | 221 | + (TcpPortCriterion) criterion; |
| 199 | return root.put("tcpPort", tcpPortCriterion.tcpPort()); | 222 | return root.put("tcpPort", tcpPortCriterion.tcpPort()); |
| 200 | } | 223 | } |
| 201 | } | 224 | } |
| ... | @@ -203,8 +226,8 @@ public final class CriterionCodec extends JsonCodec<Criterion> { | ... | @@ -203,8 +226,8 @@ public final class CriterionCodec extends JsonCodec<Criterion> { |
| 203 | private static class FormatUdp implements CriterionTypeFormatter { | 226 | private static class FormatUdp implements CriterionTypeFormatter { |
| 204 | @Override | 227 | @Override |
| 205 | public ObjectNode formatCriterion(ObjectNode root, Criterion criterion) { | 228 | public ObjectNode formatCriterion(ObjectNode root, Criterion criterion) { |
| 206 | - final Criteria.UdpPortCriterion udpPortCriterion = | 229 | + final UdpPortCriterion udpPortCriterion = |
| 207 | - (Criteria.UdpPortCriterion) criterion; | 230 | + (UdpPortCriterion) criterion; |
| 208 | return root.put("udpPort", udpPortCriterion.udpPort()); | 231 | return root.put("udpPort", udpPortCriterion.udpPort()); |
| 209 | } | 232 | } |
| 210 | } | 233 | } |
| ... | @@ -212,8 +235,8 @@ public final class CriterionCodec extends JsonCodec<Criterion> { | ... | @@ -212,8 +235,8 @@ public final class CriterionCodec extends JsonCodec<Criterion> { |
| 212 | private static class FormatSctp implements CriterionTypeFormatter { | 235 | private static class FormatSctp implements CriterionTypeFormatter { |
| 213 | @Override | 236 | @Override |
| 214 | public ObjectNode formatCriterion(ObjectNode root, Criterion criterion) { | 237 | public ObjectNode formatCriterion(ObjectNode root, Criterion criterion) { |
| 215 | - final Criteria.SctpPortCriterion sctpPortCriterion = | 238 | + final SctpPortCriterion sctpPortCriterion = |
| 216 | - (Criteria.SctpPortCriterion) criterion; | 239 | + (SctpPortCriterion) criterion; |
| 217 | return root.put("sctpPort", sctpPortCriterion.sctpPort()); | 240 | return root.put("sctpPort", sctpPortCriterion.sctpPort()); |
| 218 | } | 241 | } |
| 219 | } | 242 | } |
| ... | @@ -221,8 +244,8 @@ public final class CriterionCodec extends JsonCodec<Criterion> { | ... | @@ -221,8 +244,8 @@ public final class CriterionCodec extends JsonCodec<Criterion> { |
| 221 | private static class FormatIcmpV4Type implements CriterionTypeFormatter { | 244 | private static class FormatIcmpV4Type implements CriterionTypeFormatter { |
| 222 | @Override | 245 | @Override |
| 223 | public ObjectNode formatCriterion(ObjectNode root, Criterion criterion) { | 246 | public ObjectNode formatCriterion(ObjectNode root, Criterion criterion) { |
| 224 | - final Criteria.IcmpTypeCriterion icmpTypeCriterion = | 247 | + final IcmpTypeCriterion icmpTypeCriterion = |
| 225 | - (Criteria.IcmpTypeCriterion) criterion; | 248 | + (IcmpTypeCriterion) criterion; |
| 226 | return root.put("icmpType", icmpTypeCriterion.icmpType()); | 249 | return root.put("icmpType", icmpTypeCriterion.icmpType()); |
| 227 | } | 250 | } |
| 228 | } | 251 | } |
| ... | @@ -230,8 +253,8 @@ public final class CriterionCodec extends JsonCodec<Criterion> { | ... | @@ -230,8 +253,8 @@ public final class CriterionCodec extends JsonCodec<Criterion> { |
| 230 | private static class FormatIcmpV4Code implements CriterionTypeFormatter { | 253 | private static class FormatIcmpV4Code implements CriterionTypeFormatter { |
| 231 | @Override | 254 | @Override |
| 232 | public ObjectNode formatCriterion(ObjectNode root, Criterion criterion) { | 255 | public ObjectNode formatCriterion(ObjectNode root, Criterion criterion) { |
| 233 | - final Criteria.IcmpCodeCriterion icmpCodeCriterion = | 256 | + final IcmpCodeCriterion icmpCodeCriterion = |
| 234 | - (Criteria.IcmpCodeCriterion) criterion; | 257 | + (IcmpCodeCriterion) criterion; |
| 235 | return root.put("icmpCode", icmpCodeCriterion.icmpCode()); | 258 | return root.put("icmpCode", icmpCodeCriterion.icmpCode()); |
| 236 | } | 259 | } |
| 237 | } | 260 | } |
| ... | @@ -239,8 +262,8 @@ public final class CriterionCodec extends JsonCodec<Criterion> { | ... | @@ -239,8 +262,8 @@ public final class CriterionCodec extends JsonCodec<Criterion> { |
| 239 | private static class FormatIpV6FLabel implements CriterionTypeFormatter { | 262 | private static class FormatIpV6FLabel implements CriterionTypeFormatter { |
| 240 | @Override | 263 | @Override |
| 241 | public ObjectNode formatCriterion(ObjectNode root, Criterion criterion) { | 264 | public ObjectNode formatCriterion(ObjectNode root, Criterion criterion) { |
| 242 | - final Criteria.IPv6FlowLabelCriterion ipv6FlowLabelCriterion = | 265 | + final IPv6FlowLabelCriterion ipv6FlowLabelCriterion = |
| 243 | - (Criteria.IPv6FlowLabelCriterion) criterion; | 266 | + (IPv6FlowLabelCriterion) criterion; |
| 244 | return root.put("flowLabel", ipv6FlowLabelCriterion.flowLabel()); | 267 | return root.put("flowLabel", ipv6FlowLabelCriterion.flowLabel()); |
| 245 | } | 268 | } |
| 246 | } | 269 | } |
| ... | @@ -248,8 +271,8 @@ public final class CriterionCodec extends JsonCodec<Criterion> { | ... | @@ -248,8 +271,8 @@ public final class CriterionCodec extends JsonCodec<Criterion> { |
| 248 | private static class FormatIcmpV6Type implements CriterionTypeFormatter { | 271 | private static class FormatIcmpV6Type implements CriterionTypeFormatter { |
| 249 | @Override | 272 | @Override |
| 250 | public ObjectNode formatCriterion(ObjectNode root, Criterion criterion) { | 273 | public ObjectNode formatCriterion(ObjectNode root, Criterion criterion) { |
| 251 | - final Criteria.Icmpv6TypeCriterion icmpv6TypeCriterion = | 274 | + final Icmpv6TypeCriterion icmpv6TypeCriterion = |
| 252 | - (Criteria.Icmpv6TypeCriterion) criterion; | 275 | + (Icmpv6TypeCriterion) criterion; |
| 253 | return root.put("icmpv6Type", icmpv6TypeCriterion.icmpv6Type()); | 276 | return root.put("icmpv6Type", icmpv6TypeCriterion.icmpv6Type()); |
| 254 | } | 277 | } |
| 255 | } | 278 | } |
| ... | @@ -257,8 +280,8 @@ public final class CriterionCodec extends JsonCodec<Criterion> { | ... | @@ -257,8 +280,8 @@ public final class CriterionCodec extends JsonCodec<Criterion> { |
| 257 | private static class FormatIcmpV6Code implements CriterionTypeFormatter { | 280 | private static class FormatIcmpV6Code implements CriterionTypeFormatter { |
| 258 | @Override | 281 | @Override |
| 259 | public ObjectNode formatCriterion(ObjectNode root, Criterion criterion) { | 282 | public ObjectNode formatCriterion(ObjectNode root, Criterion criterion) { |
| 260 | - final Criteria.Icmpv6CodeCriterion icmpv6CodeCriterion = | 283 | + final Icmpv6CodeCriterion icmpv6CodeCriterion = |
| 261 | - (Criteria.Icmpv6CodeCriterion) criterion; | 284 | + (Icmpv6CodeCriterion) criterion; |
| 262 | return root.put("icmpv6Code", icmpv6CodeCriterion.icmpv6Code()); | 285 | return root.put("icmpv6Code", icmpv6CodeCriterion.icmpv6Code()); |
| 263 | } | 286 | } |
| 264 | } | 287 | } |
| ... | @@ -266,8 +289,8 @@ public final class CriterionCodec extends JsonCodec<Criterion> { | ... | @@ -266,8 +289,8 @@ public final class CriterionCodec extends JsonCodec<Criterion> { |
| 266 | private static class FormatV6NDTarget implements CriterionTypeFormatter { | 289 | private static class FormatV6NDTarget implements CriterionTypeFormatter { |
| 267 | @Override | 290 | @Override |
| 268 | public ObjectNode formatCriterion(ObjectNode root, Criterion criterion) { | 291 | public ObjectNode formatCriterion(ObjectNode root, Criterion criterion) { |
| 269 | - final Criteria.IPv6NDTargetAddressCriterion ipv6NDTargetAddressCriterion | 292 | + final IPv6NDTargetAddressCriterion ipv6NDTargetAddressCriterion |
| 270 | - = (Criteria.IPv6NDTargetAddressCriterion) criterion; | 293 | + = (IPv6NDTargetAddressCriterion) criterion; |
| 271 | return root.put("targetAddress", ipv6NDTargetAddressCriterion.targetAddress().toString()); | 294 | return root.put("targetAddress", ipv6NDTargetAddressCriterion.targetAddress().toString()); |
| 272 | } | 295 | } |
| 273 | } | 296 | } |
| ... | @@ -275,8 +298,8 @@ public final class CriterionCodec extends JsonCodec<Criterion> { | ... | @@ -275,8 +298,8 @@ public final class CriterionCodec extends JsonCodec<Criterion> { |
| 275 | private static class FormatV6NDTll implements CriterionTypeFormatter { | 298 | private static class FormatV6NDTll implements CriterionTypeFormatter { |
| 276 | @Override | 299 | @Override |
| 277 | public ObjectNode formatCriterion(ObjectNode root, Criterion criterion) { | 300 | public ObjectNode formatCriterion(ObjectNode root, Criterion criterion) { |
| 278 | - final Criteria.IPv6NDLinkLayerAddressCriterion ipv6NDLinkLayerAddressCriterion | 301 | + final IPv6NDLinkLayerAddressCriterion ipv6NDLinkLayerAddressCriterion |
| 279 | - = (Criteria.IPv6NDLinkLayerAddressCriterion) criterion; | 302 | + = (IPv6NDLinkLayerAddressCriterion) criterion; |
| 280 | return root.put("mac", ipv6NDLinkLayerAddressCriterion.mac().toString()); | 303 | return root.put("mac", ipv6NDLinkLayerAddressCriterion.mac().toString()); |
| 281 | } | 304 | } |
| 282 | } | 305 | } |
| ... | @@ -284,8 +307,8 @@ public final class CriterionCodec extends JsonCodec<Criterion> { | ... | @@ -284,8 +307,8 @@ public final class CriterionCodec extends JsonCodec<Criterion> { |
| 284 | private static class FormatMplsLabel implements CriterionTypeFormatter { | 307 | private static class FormatMplsLabel implements CriterionTypeFormatter { |
| 285 | @Override | 308 | @Override |
| 286 | public ObjectNode formatCriterion(ObjectNode root, Criterion criterion) { | 309 | public ObjectNode formatCriterion(ObjectNode root, Criterion criterion) { |
| 287 | - final Criteria.MplsCriterion mplsCriterion = | 310 | + final MplsCriterion mplsCriterion = |
| 288 | - (Criteria.MplsCriterion) criterion; | 311 | + (MplsCriterion) criterion; |
| 289 | return root.put("label", mplsCriterion.label().toInt()); | 312 | return root.put("label", mplsCriterion.label().toInt()); |
| 290 | } | 313 | } |
| 291 | } | 314 | } |
| ... | @@ -293,8 +316,8 @@ public final class CriterionCodec extends JsonCodec<Criterion> { | ... | @@ -293,8 +316,8 @@ public final class CriterionCodec extends JsonCodec<Criterion> { |
| 293 | private static class FormatIpV6Exthdr implements CriterionTypeFormatter { | 316 | private static class FormatIpV6Exthdr implements CriterionTypeFormatter { |
| 294 | @Override | 317 | @Override |
| 295 | public ObjectNode formatCriterion(ObjectNode root, Criterion criterion) { | 318 | public ObjectNode formatCriterion(ObjectNode root, Criterion criterion) { |
| 296 | - final Criteria.IPv6ExthdrFlagsCriterion exthdrCriterion = | 319 | + final IPv6ExthdrFlagsCriterion exthdrCriterion = |
| 297 | - (Criteria.IPv6ExthdrFlagsCriterion) criterion; | 320 | + (IPv6ExthdrFlagsCriterion) criterion; |
| 298 | return root.put("exthdrFlags", exthdrCriterion.exthdrFlags()); | 321 | return root.put("exthdrFlags", exthdrCriterion.exthdrFlags()); |
| 299 | } | 322 | } |
| 300 | } | 323 | } |
| ... | @@ -302,8 +325,8 @@ public final class CriterionCodec extends JsonCodec<Criterion> { | ... | @@ -302,8 +325,8 @@ public final class CriterionCodec extends JsonCodec<Criterion> { |
| 302 | private static class FormatOchSigId implements CriterionTypeFormatter { | 325 | private static class FormatOchSigId implements CriterionTypeFormatter { |
| 303 | @Override | 326 | @Override |
| 304 | public ObjectNode formatCriterion(ObjectNode root, Criterion criterion) { | 327 | public ObjectNode formatCriterion(ObjectNode root, Criterion criterion) { |
| 305 | - final Criteria.LambdaCriterion lambdaCriterion = | 328 | + final LambdaCriterion lambdaCriterion = |
| 306 | - (Criteria.LambdaCriterion) criterion; | 329 | + (LambdaCriterion) criterion; |
| 307 | return root.put("lambda", lambdaCriterion.lambda()); | 330 | return root.put("lambda", lambdaCriterion.lambda()); |
| 308 | } | 331 | } |
| 309 | } | 332 | } |
| ... | @@ -311,8 +334,8 @@ public final class CriterionCodec extends JsonCodec<Criterion> { | ... | @@ -311,8 +334,8 @@ public final class CriterionCodec extends JsonCodec<Criterion> { |
| 311 | private static class FormatOchSigType implements CriterionTypeFormatter { | 334 | private static class FormatOchSigType implements CriterionTypeFormatter { |
| 312 | @Override | 335 | @Override |
| 313 | public ObjectNode formatCriterion(ObjectNode root, Criterion criterion) { | 336 | public ObjectNode formatCriterion(ObjectNode root, Criterion criterion) { |
| 314 | - final Criteria.OpticalSignalTypeCriterion opticalSignalTypeCriterion = | 337 | + final OpticalSignalTypeCriterion opticalSignalTypeCriterion = |
| 315 | - (Criteria.OpticalSignalTypeCriterion) criterion; | 338 | + (OpticalSignalTypeCriterion) criterion; |
| 316 | return root.put("signalType", opticalSignalTypeCriterion.signalType()); | 339 | return root.put("signalType", opticalSignalTypeCriterion.signalType()); |
| 317 | } | 340 | } |
| 318 | } | 341 | } | ... | ... |
| ... | @@ -17,10 +17,33 @@ package org.onosproject.codec.impl; | ... | @@ -17,10 +17,33 @@ package org.onosproject.codec.impl; |
| 17 | 17 | ||
| 18 | import org.hamcrest.Description; | 18 | import org.hamcrest.Description; |
| 19 | import org.hamcrest.TypeSafeDiagnosingMatcher; | 19 | import org.hamcrest.TypeSafeDiagnosingMatcher; |
| 20 | -import org.onosproject.net.flow.criteria.Criteria; | ||
| 21 | import org.onosproject.net.flow.criteria.Criterion; | 20 | import org.onosproject.net.flow.criteria.Criterion; |
| 22 | 21 | ||
| 23 | import com.fasterxml.jackson.databind.JsonNode; | 22 | import com.fasterxml.jackson.databind.JsonNode; |
| 23 | +import org.onosproject.net.flow.criteria.EthCriterion; | ||
| 24 | +import org.onosproject.net.flow.criteria.EthTypeCriterion; | ||
| 25 | +import org.onosproject.net.flow.criteria.IPCriterion; | ||
| 26 | +import org.onosproject.net.flow.criteria.IPDscpCriterion; | ||
| 27 | +import org.onosproject.net.flow.criteria.IPEcnCriterion; | ||
| 28 | +import org.onosproject.net.flow.criteria.IPProtocolCriterion; | ||
| 29 | +import org.onosproject.net.flow.criteria.IPv6ExthdrFlagsCriterion; | ||
| 30 | +import org.onosproject.net.flow.criteria.IPv6FlowLabelCriterion; | ||
| 31 | +import org.onosproject.net.flow.criteria.IPv6NDLinkLayerAddressCriterion; | ||
| 32 | +import org.onosproject.net.flow.criteria.IPv6NDTargetAddressCriterion; | ||
| 33 | +import org.onosproject.net.flow.criteria.IcmpCodeCriterion; | ||
| 34 | +import org.onosproject.net.flow.criteria.IcmpTypeCriterion; | ||
| 35 | +import org.onosproject.net.flow.criteria.Icmpv6CodeCriterion; | ||
| 36 | +import org.onosproject.net.flow.criteria.Icmpv6TypeCriterion; | ||
| 37 | +import org.onosproject.net.flow.criteria.LambdaCriterion; | ||
| 38 | +import org.onosproject.net.flow.criteria.MetadataCriterion; | ||
| 39 | +import org.onosproject.net.flow.criteria.MplsCriterion; | ||
| 40 | +import org.onosproject.net.flow.criteria.OpticalSignalTypeCriterion; | ||
| 41 | +import org.onosproject.net.flow.criteria.PortCriterion; | ||
| 42 | +import org.onosproject.net.flow.criteria.SctpPortCriterion; | ||
| 43 | +import org.onosproject.net.flow.criteria.TcpPortCriterion; | ||
| 44 | +import org.onosproject.net.flow.criteria.UdpPortCriterion; | ||
| 45 | +import org.onosproject.net.flow.criteria.VlanIdCriterion; | ||
| 46 | +import org.onosproject.net.flow.criteria.VlanPcpCriterion; | ||
| 24 | 47 | ||
| 25 | /** | 48 | /** |
| 26 | * Hamcrest matcher for criterion objects. | 49 | * Hamcrest matcher for criterion objects. |
| ... | @@ -57,7 +80,7 @@ public final class CriterionJsonMatcher extends | ... | @@ -57,7 +80,7 @@ public final class CriterionJsonMatcher extends |
| 57 | * @param criterion criterion to match | 80 | * @param criterion criterion to match |
| 58 | * @return true if the JSON matches the criterion, false otherwise. | 81 | * @return true if the JSON matches the criterion, false otherwise. |
| 59 | */ | 82 | */ |
| 60 | - private boolean matchCriterion(Criteria.PortCriterion criterion) { | 83 | + private boolean matchCriterion(PortCriterion criterion) { |
| 61 | final long port = criterion.port().toLong(); | 84 | final long port = criterion.port().toLong(); |
| 62 | final long jsonPort = jsonCriterion.get("port").asLong(); | 85 | final long jsonPort = jsonCriterion.get("port").asLong(); |
| 63 | if (port != jsonPort) { | 86 | if (port != jsonPort) { |
| ... | @@ -73,7 +96,7 @@ public final class CriterionJsonMatcher extends | ... | @@ -73,7 +96,7 @@ public final class CriterionJsonMatcher extends |
| 73 | * @param criterion criterion to match | 96 | * @param criterion criterion to match |
| 74 | * @return true if the JSON matches the criterion, false otherwise. | 97 | * @return true if the JSON matches the criterion, false otherwise. |
| 75 | */ | 98 | */ |
| 76 | - private boolean matchCriterion(Criteria.MetadataCriterion criterion) { | 99 | + private boolean matchCriterion(MetadataCriterion criterion) { |
| 77 | final long metadata = criterion.metadata(); | 100 | final long metadata = criterion.metadata(); |
| 78 | final long jsonMetadata = jsonCriterion.get("metadata").asLong(); | 101 | final long jsonMetadata = jsonCriterion.get("metadata").asLong(); |
| 79 | if (metadata != jsonMetadata) { | 102 | if (metadata != jsonMetadata) { |
| ... | @@ -90,7 +113,7 @@ public final class CriterionJsonMatcher extends | ... | @@ -90,7 +113,7 @@ public final class CriterionJsonMatcher extends |
| 90 | * @param criterion criterion to match | 113 | * @param criterion criterion to match |
| 91 | * @return true if the JSON matches the criterion, false otherwise. | 114 | * @return true if the JSON matches the criterion, false otherwise. |
| 92 | */ | 115 | */ |
| 93 | - private boolean matchCriterion(Criteria.EthCriterion criterion) { | 116 | + private boolean matchCriterion(EthCriterion criterion) { |
| 94 | final String mac = criterion.mac().toString(); | 117 | final String mac = criterion.mac().toString(); |
| 95 | final String jsonMac = jsonCriterion.get("mac").textValue(); | 118 | final String jsonMac = jsonCriterion.get("mac").textValue(); |
| 96 | if (!mac.equals(jsonMac)) { | 119 | if (!mac.equals(jsonMac)) { |
| ... | @@ -106,7 +129,7 @@ public final class CriterionJsonMatcher extends | ... | @@ -106,7 +129,7 @@ public final class CriterionJsonMatcher extends |
| 106 | * @param criterion criterion to match | 129 | * @param criterion criterion to match |
| 107 | * @return true if the JSON matches the criterion, false otherwise. | 130 | * @return true if the JSON matches the criterion, false otherwise. |
| 108 | */ | 131 | */ |
| 109 | - private boolean matchCriterion(Criteria.EthTypeCriterion criterion) { | 132 | + private boolean matchCriterion(EthTypeCriterion criterion) { |
| 110 | final int ethType = criterion.ethType(); | 133 | final int ethType = criterion.ethType(); |
| 111 | final int jsonEthType = jsonCriterion.get("ethType").intValue(); | 134 | final int jsonEthType = jsonCriterion.get("ethType").intValue(); |
| 112 | if (ethType != jsonEthType) { | 135 | if (ethType != jsonEthType) { |
| ... | @@ -123,7 +146,7 @@ public final class CriterionJsonMatcher extends | ... | @@ -123,7 +146,7 @@ public final class CriterionJsonMatcher extends |
| 123 | * @param criterion criterion to match | 146 | * @param criterion criterion to match |
| 124 | * @return true if the JSON matches the criterion, false otherwise. | 147 | * @return true if the JSON matches the criterion, false otherwise. |
| 125 | */ | 148 | */ |
| 126 | - private boolean matchCriterion(Criteria.VlanIdCriterion criterion) { | 149 | + private boolean matchCriterion(VlanIdCriterion criterion) { |
| 127 | final short vlanId = criterion.vlanId().toShort(); | 150 | final short vlanId = criterion.vlanId().toShort(); |
| 128 | final short jsonVlanId = jsonCriterion.get("vlanId").shortValue(); | 151 | final short jsonVlanId = jsonCriterion.get("vlanId").shortValue(); |
| 129 | if (vlanId != jsonVlanId) { | 152 | if (vlanId != jsonVlanId) { |
| ... | @@ -139,7 +162,7 @@ public final class CriterionJsonMatcher extends | ... | @@ -139,7 +162,7 @@ public final class CriterionJsonMatcher extends |
| 139 | * @param criterion criterion to match | 162 | * @param criterion criterion to match |
| 140 | * @return true if the JSON matches the criterion, false otherwise. | 163 | * @return true if the JSON matches the criterion, false otherwise. |
| 141 | */ | 164 | */ |
| 142 | - private boolean matchCriterion(Criteria.VlanPcpCriterion criterion) { | 165 | + private boolean matchCriterion(VlanPcpCriterion criterion) { |
| 143 | final byte priority = criterion.priority(); | 166 | final byte priority = criterion.priority(); |
| 144 | final byte jsonPriority = | 167 | final byte jsonPriority = |
| 145 | (byte) jsonCriterion.get("priority").shortValue(); | 168 | (byte) jsonCriterion.get("priority").shortValue(); |
| ... | @@ -156,7 +179,7 @@ public final class CriterionJsonMatcher extends | ... | @@ -156,7 +179,7 @@ public final class CriterionJsonMatcher extends |
| 156 | * @param criterion criterion to match | 179 | * @param criterion criterion to match |
| 157 | * @return true if the JSON matches the criterion, false otherwise. | 180 | * @return true if the JSON matches the criterion, false otherwise. |
| 158 | */ | 181 | */ |
| 159 | - private boolean matchCriterion(Criteria.IPDscpCriterion criterion) { | 182 | + private boolean matchCriterion(IPDscpCriterion criterion) { |
| 160 | final byte ipDscp = criterion.ipDscp(); | 183 | final byte ipDscp = criterion.ipDscp(); |
| 161 | final byte jsonIpDscp = (byte) jsonCriterion.get("ipDscp").shortValue(); | 184 | final byte jsonIpDscp = (byte) jsonCriterion.get("ipDscp").shortValue(); |
| 162 | if (ipDscp != jsonIpDscp) { | 185 | if (ipDscp != jsonIpDscp) { |
| ... | @@ -172,7 +195,7 @@ public final class CriterionJsonMatcher extends | ... | @@ -172,7 +195,7 @@ public final class CriterionJsonMatcher extends |
| 172 | * @param criterion criterion to match | 195 | * @param criterion criterion to match |
| 173 | * @return true if the JSON matches the criterion, false otherwise. | 196 | * @return true if the JSON matches the criterion, false otherwise. |
| 174 | */ | 197 | */ |
| 175 | - private boolean matchCriterion(Criteria.IPEcnCriterion criterion) { | 198 | + private boolean matchCriterion(IPEcnCriterion criterion) { |
| 176 | final byte ipEcn = criterion.ipEcn(); | 199 | final byte ipEcn = criterion.ipEcn(); |
| 177 | final byte jsonIpEcn = (byte) jsonCriterion.get("ipEcn").shortValue(); | 200 | final byte jsonIpEcn = (byte) jsonCriterion.get("ipEcn").shortValue(); |
| 178 | if (ipEcn != jsonIpEcn) { | 201 | if (ipEcn != jsonIpEcn) { |
| ... | @@ -188,7 +211,7 @@ public final class CriterionJsonMatcher extends | ... | @@ -188,7 +211,7 @@ public final class CriterionJsonMatcher extends |
| 188 | * @param criterion criterion to match | 211 | * @param criterion criterion to match |
| 189 | * @return true if the JSON matches the criterion, false otherwise. | 212 | * @return true if the JSON matches the criterion, false otherwise. |
| 190 | */ | 213 | */ |
| 191 | - private boolean matchCriterion(Criteria.IPProtocolCriterion criterion) { | 214 | + private boolean matchCriterion(IPProtocolCriterion criterion) { |
| 192 | final short protocol = criterion.protocol(); | 215 | final short protocol = criterion.protocol(); |
| 193 | final short jsonProtocol = jsonCriterion.get("protocol").shortValue(); | 216 | final short jsonProtocol = jsonCriterion.get("protocol").shortValue(); |
| 194 | if (protocol != jsonProtocol) { | 217 | if (protocol != jsonProtocol) { |
| ... | @@ -205,7 +228,7 @@ public final class CriterionJsonMatcher extends | ... | @@ -205,7 +228,7 @@ public final class CriterionJsonMatcher extends |
| 205 | * @param criterion criterion to match | 228 | * @param criterion criterion to match |
| 206 | * @return true if the JSON matches the criterion, false otherwise. | 229 | * @return true if the JSON matches the criterion, false otherwise. |
| 207 | */ | 230 | */ |
| 208 | - private boolean matchCriterion(Criteria.IPCriterion criterion) { | 231 | + private boolean matchCriterion(IPCriterion criterion) { |
| 209 | final String ip = criterion.ip().toString(); | 232 | final String ip = criterion.ip().toString(); |
| 210 | final String jsonIp = jsonCriterion.get("ip").textValue(); | 233 | final String jsonIp = jsonCriterion.get("ip").textValue(); |
| 211 | if (!ip.equals(jsonIp)) { | 234 | if (!ip.equals(jsonIp)) { |
| ... | @@ -221,7 +244,7 @@ public final class CriterionJsonMatcher extends | ... | @@ -221,7 +244,7 @@ public final class CriterionJsonMatcher extends |
| 221 | * @param criterion criterion to match | 244 | * @param criterion criterion to match |
| 222 | * @return true if the JSON matches the criterion, false otherwise. | 245 | * @return true if the JSON matches the criterion, false otherwise. |
| 223 | */ | 246 | */ |
| 224 | - private boolean matchCriterion(Criteria.TcpPortCriterion criterion) { | 247 | + private boolean matchCriterion(TcpPortCriterion criterion) { |
| 225 | final int tcpPort = criterion.tcpPort(); | 248 | final int tcpPort = criterion.tcpPort(); |
| 226 | final int jsonTcpPort = jsonCriterion.get("tcpPort").intValue(); | 249 | final int jsonTcpPort = jsonCriterion.get("tcpPort").intValue(); |
| 227 | if (tcpPort != jsonTcpPort) { | 250 | if (tcpPort != jsonTcpPort) { |
| ... | @@ -238,7 +261,7 @@ public final class CriterionJsonMatcher extends | ... | @@ -238,7 +261,7 @@ public final class CriterionJsonMatcher extends |
| 238 | * @param criterion criterion to match | 261 | * @param criterion criterion to match |
| 239 | * @return true if the JSON matches the criterion, false otherwise. | 262 | * @return true if the JSON matches the criterion, false otherwise. |
| 240 | */ | 263 | */ |
| 241 | - private boolean matchCriterion(Criteria.UdpPortCriterion criterion) { | 264 | + private boolean matchCriterion(UdpPortCriterion criterion) { |
| 242 | final int udpPort = criterion.udpPort(); | 265 | final int udpPort = criterion.udpPort(); |
| 243 | final int jsonUdpPort = jsonCriterion.get("udpPort").intValue(); | 266 | final int jsonUdpPort = jsonCriterion.get("udpPort").intValue(); |
| 244 | if (udpPort != jsonUdpPort) { | 267 | if (udpPort != jsonUdpPort) { |
| ... | @@ -255,7 +278,7 @@ public final class CriterionJsonMatcher extends | ... | @@ -255,7 +278,7 @@ public final class CriterionJsonMatcher extends |
| 255 | * @param criterion criterion to match | 278 | * @param criterion criterion to match |
| 256 | * @return true if the JSON matches the criterion, false otherwise. | 279 | * @return true if the JSON matches the criterion, false otherwise. |
| 257 | */ | 280 | */ |
| 258 | - private boolean matchCriterion(Criteria.SctpPortCriterion criterion) { | 281 | + private boolean matchCriterion(SctpPortCriterion criterion) { |
| 259 | final int sctpPort = criterion.sctpPort(); | 282 | final int sctpPort = criterion.sctpPort(); |
| 260 | final int jsonSctpPort = jsonCriterion.get("sctpPort").intValue(); | 283 | final int jsonSctpPort = jsonCriterion.get("sctpPort").intValue(); |
| 261 | if (sctpPort != jsonSctpPort) { | 284 | if (sctpPort != jsonSctpPort) { |
| ... | @@ -272,7 +295,7 @@ public final class CriterionJsonMatcher extends | ... | @@ -272,7 +295,7 @@ public final class CriterionJsonMatcher extends |
| 272 | * @param criterion criterion to match | 295 | * @param criterion criterion to match |
| 273 | * @return true if the JSON matches the criterion, false otherwise. | 296 | * @return true if the JSON matches the criterion, false otherwise. |
| 274 | */ | 297 | */ |
| 275 | - private boolean matchCriterion(Criteria.IcmpTypeCriterion criterion) { | 298 | + private boolean matchCriterion(IcmpTypeCriterion criterion) { |
| 276 | final short icmpType = criterion.icmpType(); | 299 | final short icmpType = criterion.icmpType(); |
| 277 | final short jsonIcmpType = jsonCriterion.get("icmpType").shortValue(); | 300 | final short jsonIcmpType = jsonCriterion.get("icmpType").shortValue(); |
| 278 | if (icmpType != jsonIcmpType) { | 301 | if (icmpType != jsonIcmpType) { |
| ... | @@ -289,7 +312,7 @@ public final class CriterionJsonMatcher extends | ... | @@ -289,7 +312,7 @@ public final class CriterionJsonMatcher extends |
| 289 | * @param criterion criterion to match | 312 | * @param criterion criterion to match |
| 290 | * @return true if the JSON matches the criterion, false otherwise. | 313 | * @return true if the JSON matches the criterion, false otherwise. |
| 291 | */ | 314 | */ |
| 292 | - private boolean matchCriterion(Criteria.IcmpCodeCriterion criterion) { | 315 | + private boolean matchCriterion(IcmpCodeCriterion criterion) { |
| 293 | final short icmpCode = criterion.icmpCode(); | 316 | final short icmpCode = criterion.icmpCode(); |
| 294 | final short jsonIcmpCode = jsonCriterion.get("icmpCode").shortValue(); | 317 | final short jsonIcmpCode = jsonCriterion.get("icmpCode").shortValue(); |
| 295 | if (icmpCode != jsonIcmpCode) { | 318 | if (icmpCode != jsonIcmpCode) { |
| ... | @@ -306,7 +329,7 @@ public final class CriterionJsonMatcher extends | ... | @@ -306,7 +329,7 @@ public final class CriterionJsonMatcher extends |
| 306 | * @param criterion criterion to match | 329 | * @param criterion criterion to match |
| 307 | * @return true if the JSON matches the criterion, false otherwise. | 330 | * @return true if the JSON matches the criterion, false otherwise. |
| 308 | */ | 331 | */ |
| 309 | - private boolean matchCriterion(Criteria.IPv6FlowLabelCriterion criterion) { | 332 | + private boolean matchCriterion(IPv6FlowLabelCriterion criterion) { |
| 310 | final int flowLabel = criterion.flowLabel(); | 333 | final int flowLabel = criterion.flowLabel(); |
| 311 | final int jsonFlowLabel = jsonCriterion.get("flowLabel").intValue(); | 334 | final int jsonFlowLabel = jsonCriterion.get("flowLabel").intValue(); |
| 312 | if (flowLabel != jsonFlowLabel) { | 335 | if (flowLabel != jsonFlowLabel) { |
| ... | @@ -323,7 +346,7 @@ public final class CriterionJsonMatcher extends | ... | @@ -323,7 +346,7 @@ public final class CriterionJsonMatcher extends |
| 323 | * @param criterion criterion to match | 346 | * @param criterion criterion to match |
| 324 | * @return true if the JSON matches the criterion, false otherwise. | 347 | * @return true if the JSON matches the criterion, false otherwise. |
| 325 | */ | 348 | */ |
| 326 | - private boolean matchCriterion(Criteria.Icmpv6TypeCriterion criterion) { | 349 | + private boolean matchCriterion(Icmpv6TypeCriterion criterion) { |
| 327 | final short icmpv6Type = criterion.icmpv6Type(); | 350 | final short icmpv6Type = criterion.icmpv6Type(); |
| 328 | final short jsonIcmpv6Type = | 351 | final short jsonIcmpv6Type = |
| 329 | jsonCriterion.get("icmpv6Type").shortValue(); | 352 | jsonCriterion.get("icmpv6Type").shortValue(); |
| ... | @@ -341,7 +364,7 @@ public final class CriterionJsonMatcher extends | ... | @@ -341,7 +364,7 @@ public final class CriterionJsonMatcher extends |
| 341 | * @param criterion criterion to match | 364 | * @param criterion criterion to match |
| 342 | * @return true if the JSON matches the criterion, false otherwise. | 365 | * @return true if the JSON matches the criterion, false otherwise. |
| 343 | */ | 366 | */ |
| 344 | - private boolean matchCriterion(Criteria.Icmpv6CodeCriterion criterion) { | 367 | + private boolean matchCriterion(Icmpv6CodeCriterion criterion) { |
| 345 | final short icmpv6Code = criterion.icmpv6Code(); | 368 | final short icmpv6Code = criterion.icmpv6Code(); |
| 346 | final short jsonIcmpv6Code = | 369 | final short jsonIcmpv6Code = |
| 347 | jsonCriterion.get("icmpv6Code").shortValue(); | 370 | jsonCriterion.get("icmpv6Code").shortValue(); |
| ... | @@ -359,7 +382,7 @@ public final class CriterionJsonMatcher extends | ... | @@ -359,7 +382,7 @@ public final class CriterionJsonMatcher extends |
| 359 | * @param criterion criterion to match | 382 | * @param criterion criterion to match |
| 360 | * @return true if the JSON matches the criterion, false otherwise. | 383 | * @return true if the JSON matches the criterion, false otherwise. |
| 361 | */ | 384 | */ |
| 362 | - private boolean matchCriterion(Criteria.IPv6NDTargetAddressCriterion criterion) { | 385 | + private boolean matchCriterion(IPv6NDTargetAddressCriterion criterion) { |
| 363 | final String targetAddress = | 386 | final String targetAddress = |
| 364 | criterion.targetAddress().toString(); | 387 | criterion.targetAddress().toString(); |
| 365 | final String jsonTargetAddress = | 388 | final String jsonTargetAddress = |
| ... | @@ -378,7 +401,7 @@ public final class CriterionJsonMatcher extends | ... | @@ -378,7 +401,7 @@ public final class CriterionJsonMatcher extends |
| 378 | * @param criterion criterion to match | 401 | * @param criterion criterion to match |
| 379 | * @return true if the JSON matches the criterion, false otherwise. | 402 | * @return true if the JSON matches the criterion, false otherwise. |
| 380 | */ | 403 | */ |
| 381 | - private boolean matchCriterion(Criteria.IPv6NDLinkLayerAddressCriterion criterion) { | 404 | + private boolean matchCriterion(IPv6NDLinkLayerAddressCriterion criterion) { |
| 382 | final String llAddress = | 405 | final String llAddress = |
| 383 | criterion.mac().toString(); | 406 | criterion.mac().toString(); |
| 384 | final String jsonLlAddress = | 407 | final String jsonLlAddress = |
| ... | @@ -396,7 +419,7 @@ public final class CriterionJsonMatcher extends | ... | @@ -396,7 +419,7 @@ public final class CriterionJsonMatcher extends |
| 396 | * @param criterion criterion to match | 419 | * @param criterion criterion to match |
| 397 | * @return true if the JSON matches the criterion, false otherwise. | 420 | * @return true if the JSON matches the criterion, false otherwise. |
| 398 | */ | 421 | */ |
| 399 | - private boolean matchCriterion(Criteria.MplsCriterion criterion) { | 422 | + private boolean matchCriterion(MplsCriterion criterion) { |
| 400 | final int label = criterion.label().toInt(); | 423 | final int label = criterion.label().toInt(); |
| 401 | final int jsonLabel = jsonCriterion.get("label").intValue(); | 424 | final int jsonLabel = jsonCriterion.get("label").intValue(); |
| 402 | if (label != jsonLabel) { | 425 | if (label != jsonLabel) { |
| ... | @@ -412,7 +435,7 @@ public final class CriterionJsonMatcher extends | ... | @@ -412,7 +435,7 @@ public final class CriterionJsonMatcher extends |
| 412 | * @param criterion criterion to match | 435 | * @param criterion criterion to match |
| 413 | * @return true if the JSON matches the criterion, false otherwise. | 436 | * @return true if the JSON matches the criterion, false otherwise. |
| 414 | */ | 437 | */ |
| 415 | - private boolean matchCriterion(Criteria.IPv6ExthdrFlagsCriterion criterion) { | 438 | + private boolean matchCriterion(IPv6ExthdrFlagsCriterion criterion) { |
| 416 | final int exthdrFlags = criterion.exthdrFlags(); | 439 | final int exthdrFlags = criterion.exthdrFlags(); |
| 417 | final int jsonExthdrFlags = | 440 | final int jsonExthdrFlags = |
| 418 | jsonCriterion.get("exthdrFlags").intValue(); | 441 | jsonCriterion.get("exthdrFlags").intValue(); |
| ... | @@ -430,7 +453,7 @@ public final class CriterionJsonMatcher extends | ... | @@ -430,7 +453,7 @@ public final class CriterionJsonMatcher extends |
| 430 | * @param criterion criterion to match | 453 | * @param criterion criterion to match |
| 431 | * @return true if the JSON matches the criterion, false otherwise. | 454 | * @return true if the JSON matches the criterion, false otherwise. |
| 432 | */ | 455 | */ |
| 433 | - private boolean matchCriterion(Criteria.LambdaCriterion criterion) { | 456 | + private boolean matchCriterion(LambdaCriterion criterion) { |
| 434 | final int lambda = criterion.lambda(); | 457 | final int lambda = criterion.lambda(); |
| 435 | final int jsonLambda = jsonCriterion.get("lambda").intValue(); | 458 | final int jsonLambda = jsonCriterion.get("lambda").intValue(); |
| 436 | if (lambda != jsonLambda) { | 459 | if (lambda != jsonLambda) { |
| ... | @@ -446,7 +469,7 @@ public final class CriterionJsonMatcher extends | ... | @@ -446,7 +469,7 @@ public final class CriterionJsonMatcher extends |
| 446 | * @param criterion criterion to match | 469 | * @param criterion criterion to match |
| 447 | * @return true if the JSON matches the criterion, false otherwise. | 470 | * @return true if the JSON matches the criterion, false otherwise. |
| 448 | */ | 471 | */ |
| 449 | - private boolean matchCriterion(Criteria.OpticalSignalTypeCriterion criterion) { | 472 | + private boolean matchCriterion(OpticalSignalTypeCriterion criterion) { |
| 450 | final short signalType = criterion.signalType(); | 473 | final short signalType = criterion.signalType(); |
| 451 | final short jsonSignalType = jsonCriterion.get("signalType").shortValue(); | 474 | final short jsonSignalType = jsonCriterion.get("signalType").shortValue(); |
| 452 | if (signalType != jsonSignalType) { | 475 | if (signalType != jsonSignalType) { |
| ... | @@ -472,88 +495,88 @@ public final class CriterionJsonMatcher extends | ... | @@ -472,88 +495,88 @@ public final class CriterionJsonMatcher extends |
| 472 | 495 | ||
| 473 | case IN_PORT: | 496 | case IN_PORT: |
| 474 | case IN_PHY_PORT: | 497 | case IN_PHY_PORT: |
| 475 | - return matchCriterion((Criteria.PortCriterion) criterion); | 498 | + return matchCriterion((PortCriterion) criterion); |
| 476 | 499 | ||
| 477 | case METADATA: | 500 | case METADATA: |
| 478 | - return matchCriterion((Criteria.MetadataCriterion) criterion); | 501 | + return matchCriterion((MetadataCriterion) criterion); |
| 479 | 502 | ||
| 480 | case ETH_DST: | 503 | case ETH_DST: |
| 481 | case ETH_SRC: | 504 | case ETH_SRC: |
| 482 | - return matchCriterion((Criteria.EthCriterion) criterion); | 505 | + return matchCriterion((EthCriterion) criterion); |
| 483 | 506 | ||
| 484 | case ETH_TYPE: | 507 | case ETH_TYPE: |
| 485 | - return matchCriterion((Criteria.EthTypeCriterion) criterion); | 508 | + return matchCriterion((EthTypeCriterion) criterion); |
| 486 | 509 | ||
| 487 | case VLAN_VID: | 510 | case VLAN_VID: |
| 488 | - return matchCriterion((Criteria.VlanIdCriterion) criterion); | 511 | + return matchCriterion((VlanIdCriterion) criterion); |
| 489 | 512 | ||
| 490 | case VLAN_PCP: | 513 | case VLAN_PCP: |
| 491 | - return matchCriterion((Criteria.VlanPcpCriterion) criterion); | 514 | + return matchCriterion((VlanPcpCriterion) criterion); |
| 492 | 515 | ||
| 493 | case IP_DSCP: | 516 | case IP_DSCP: |
| 494 | - return matchCriterion((Criteria.IPDscpCriterion) criterion); | 517 | + return matchCriterion((IPDscpCriterion) criterion); |
| 495 | 518 | ||
| 496 | case IP_ECN: | 519 | case IP_ECN: |
| 497 | - return matchCriterion((Criteria.IPEcnCriterion) criterion); | 520 | + return matchCriterion((IPEcnCriterion) criterion); |
| 498 | 521 | ||
| 499 | case IP_PROTO: | 522 | case IP_PROTO: |
| 500 | - return matchCriterion((Criteria.IPProtocolCriterion) criterion); | 523 | + return matchCriterion((IPProtocolCriterion) criterion); |
| 501 | 524 | ||
| 502 | case IPV4_SRC: | 525 | case IPV4_SRC: |
| 503 | case IPV4_DST: | 526 | case IPV4_DST: |
| 504 | case IPV6_SRC: | 527 | case IPV6_SRC: |
| 505 | case IPV6_DST: | 528 | case IPV6_DST: |
| 506 | - return matchCriterion((Criteria.IPCriterion) criterion); | 529 | + return matchCriterion((IPCriterion) criterion); |
| 507 | 530 | ||
| 508 | case TCP_SRC: | 531 | case TCP_SRC: |
| 509 | case TCP_DST: | 532 | case TCP_DST: |
| 510 | - return matchCriterion((Criteria.TcpPortCriterion) criterion); | 533 | + return matchCriterion((TcpPortCriterion) criterion); |
| 511 | 534 | ||
| 512 | case UDP_SRC: | 535 | case UDP_SRC: |
| 513 | case UDP_DST: | 536 | case UDP_DST: |
| 514 | - return matchCriterion((Criteria.UdpPortCriterion) criterion); | 537 | + return matchCriterion((UdpPortCriterion) criterion); |
| 515 | 538 | ||
| 516 | case SCTP_SRC: | 539 | case SCTP_SRC: |
| 517 | case SCTP_DST: | 540 | case SCTP_DST: |
| 518 | - return matchCriterion((Criteria.SctpPortCriterion) criterion); | 541 | + return matchCriterion((SctpPortCriterion) criterion); |
| 519 | 542 | ||
| 520 | case ICMPV4_TYPE: | 543 | case ICMPV4_TYPE: |
| 521 | - return matchCriterion((Criteria.IcmpTypeCriterion) criterion); | 544 | + return matchCriterion((IcmpTypeCriterion) criterion); |
| 522 | 545 | ||
| 523 | case ICMPV4_CODE: | 546 | case ICMPV4_CODE: |
| 524 | - return matchCriterion((Criteria.IcmpCodeCriterion) criterion); | 547 | + return matchCriterion((IcmpCodeCriterion) criterion); |
| 525 | 548 | ||
| 526 | case IPV6_FLABEL: | 549 | case IPV6_FLABEL: |
| 527 | - return matchCriterion((Criteria.IPv6FlowLabelCriterion) criterion); | 550 | + return matchCriterion((IPv6FlowLabelCriterion) criterion); |
| 528 | 551 | ||
| 529 | case ICMPV6_TYPE: | 552 | case ICMPV6_TYPE: |
| 530 | - return matchCriterion((Criteria.Icmpv6TypeCriterion) criterion); | 553 | + return matchCriterion((Icmpv6TypeCriterion) criterion); |
| 531 | 554 | ||
| 532 | case ICMPV6_CODE: | 555 | case ICMPV6_CODE: |
| 533 | - return matchCriterion((Criteria.Icmpv6CodeCriterion) criterion); | 556 | + return matchCriterion((Icmpv6CodeCriterion) criterion); |
| 534 | 557 | ||
| 535 | case IPV6_ND_TARGET: | 558 | case IPV6_ND_TARGET: |
| 536 | return matchCriterion( | 559 | return matchCriterion( |
| 537 | - (Criteria.IPv6NDTargetAddressCriterion) criterion); | 560 | + (IPv6NDTargetAddressCriterion) criterion); |
| 538 | 561 | ||
| 539 | case IPV6_ND_SLL: | 562 | case IPV6_ND_SLL: |
| 540 | case IPV6_ND_TLL: | 563 | case IPV6_ND_TLL: |
| 541 | return matchCriterion( | 564 | return matchCriterion( |
| 542 | - (Criteria.IPv6NDLinkLayerAddressCriterion) criterion); | 565 | + (IPv6NDLinkLayerAddressCriterion) criterion); |
| 543 | 566 | ||
| 544 | case MPLS_LABEL: | 567 | case MPLS_LABEL: |
| 545 | - return matchCriterion((Criteria.MplsCriterion) criterion); | 568 | + return matchCriterion((MplsCriterion) criterion); |
| 546 | 569 | ||
| 547 | case IPV6_EXTHDR: | 570 | case IPV6_EXTHDR: |
| 548 | return matchCriterion( | 571 | return matchCriterion( |
| 549 | - (Criteria.IPv6ExthdrFlagsCriterion) criterion); | 572 | + (IPv6ExthdrFlagsCriterion) criterion); |
| 550 | 573 | ||
| 551 | case OCH_SIGID: | 574 | case OCH_SIGID: |
| 552 | - return matchCriterion((Criteria.LambdaCriterion) criterion); | 575 | + return matchCriterion((LambdaCriterion) criterion); |
| 553 | 576 | ||
| 554 | case OCH_SIGTYPE: | 577 | case OCH_SIGTYPE: |
| 555 | return matchCriterion( | 578 | return matchCriterion( |
| 556 | - (Criteria.OpticalSignalTypeCriterion) criterion); | 579 | + (OpticalSignalTypeCriterion) criterion); |
| 557 | 580 | ||
| 558 | default: | 581 | default: |
| 559 | // Don't know how to format this type | 582 | // Don't know how to format this type | ... | ... |
| ... | @@ -34,8 +34,8 @@ import org.onosproject.net.flow.DefaultTrafficTreatment; | ... | @@ -34,8 +34,8 @@ import org.onosproject.net.flow.DefaultTrafficTreatment; |
| 34 | import org.onosproject.net.flow.FlowRule; | 34 | import org.onosproject.net.flow.FlowRule; |
| 35 | import org.onosproject.net.flow.TrafficSelector; | 35 | import org.onosproject.net.flow.TrafficSelector; |
| 36 | import org.onosproject.net.flow.TrafficTreatment; | 36 | import org.onosproject.net.flow.TrafficTreatment; |
| 37 | -import org.onosproject.net.flow.criteria.Criteria; | ||
| 38 | import org.onosproject.net.flow.criteria.Criterion; | 37 | import org.onosproject.net.flow.criteria.Criterion; |
| 38 | +import org.onosproject.net.flow.criteria.EthTypeCriterion; | ||
| 39 | import org.onosproject.net.intent.FlowRuleIntent; | 39 | import org.onosproject.net.intent.FlowRuleIntent; |
| 40 | import org.onosproject.net.intent.Intent; | 40 | import org.onosproject.net.intent.Intent; |
| 41 | import org.onosproject.net.intent.IntentCompiler; | 41 | import org.onosproject.net.intent.IntentCompiler; |
| ... | @@ -241,8 +241,8 @@ public class MplsPathIntentCompiler implements IntentCompiler<MplsPathIntent> { | ... | @@ -241,8 +241,8 @@ public class MplsPathIntentCompiler implements IntentCompiler<MplsPathIntent> { |
| 241 | // if the ingress ethertype is defined, the egress traffic | 241 | // if the ingress ethertype is defined, the egress traffic |
| 242 | // will be use that value, otherwise the IPv4 ethertype is used. | 242 | // will be use that value, otherwise the IPv4 ethertype is used. |
| 243 | Criterion c = intent.selector().getCriterion(Criterion.Type.ETH_TYPE); | 243 | Criterion c = intent.selector().getCriterion(Criterion.Type.ETH_TYPE); |
| 244 | - if (c != null && c instanceof Criteria.EthTypeCriterion) { | 244 | + if (c != null && c instanceof EthTypeCriterion) { |
| 245 | - Criteria.EthTypeCriterion ethertype = (Criteria.EthTypeCriterion) c; | 245 | + EthTypeCriterion ethertype = (EthTypeCriterion) c; |
| 246 | treat.popMpls((short) ethertype.ethType()); | 246 | treat.popMpls((short) ethertype.ethType()); |
| 247 | } else { | 247 | } else { |
| 248 | treat.popMpls(Ethernet.TYPE_IPV4); | 248 | treat.popMpls(Ethernet.TYPE_IPV4); | ... | ... |
| ... | @@ -73,8 +73,31 @@ import org.onosproject.net.flow.FlowRuleBatchOperation; | ... | @@ -73,8 +73,31 @@ import org.onosproject.net.flow.FlowRuleBatchOperation; |
| 73 | import org.onosproject.net.flow.FlowRuleBatchRequest; | 73 | import org.onosproject.net.flow.FlowRuleBatchRequest; |
| 74 | import org.onosproject.net.flow.FlowRuleExtPayLoad; | 74 | import org.onosproject.net.flow.FlowRuleExtPayLoad; |
| 75 | import org.onosproject.net.flow.StoredFlowEntry; | 75 | import org.onosproject.net.flow.StoredFlowEntry; |
| 76 | -import org.onosproject.net.flow.criteria.Criteria; | ||
| 77 | import org.onosproject.net.flow.criteria.Criterion; | 76 | import org.onosproject.net.flow.criteria.Criterion; |
| 77 | +import org.onosproject.net.flow.criteria.EthCriterion; | ||
| 78 | +import org.onosproject.net.flow.criteria.EthTypeCriterion; | ||
| 79 | +import org.onosproject.net.flow.criteria.IPCriterion; | ||
| 80 | +import org.onosproject.net.flow.criteria.IPDscpCriterion; | ||
| 81 | +import org.onosproject.net.flow.criteria.IPEcnCriterion; | ||
| 82 | +import org.onosproject.net.flow.criteria.IPProtocolCriterion; | ||
| 83 | +import org.onosproject.net.flow.criteria.IPv6ExthdrFlagsCriterion; | ||
| 84 | +import org.onosproject.net.flow.criteria.IPv6FlowLabelCriterion; | ||
| 85 | +import org.onosproject.net.flow.criteria.IPv6NDLinkLayerAddressCriterion; | ||
| 86 | +import org.onosproject.net.flow.criteria.IPv6NDTargetAddressCriterion; | ||
| 87 | +import org.onosproject.net.flow.criteria.IcmpCodeCriterion; | ||
| 88 | +import org.onosproject.net.flow.criteria.IcmpTypeCriterion; | ||
| 89 | +import org.onosproject.net.flow.criteria.Icmpv6CodeCriterion; | ||
| 90 | +import org.onosproject.net.flow.criteria.Icmpv6TypeCriterion; | ||
| 91 | +import org.onosproject.net.flow.criteria.LambdaCriterion; | ||
| 92 | +import org.onosproject.net.flow.criteria.MetadataCriterion; | ||
| 93 | +import org.onosproject.net.flow.criteria.MplsCriterion; | ||
| 94 | +import org.onosproject.net.flow.criteria.OpticalSignalTypeCriterion; | ||
| 95 | +import org.onosproject.net.flow.criteria.PortCriterion; | ||
| 96 | +import org.onosproject.net.flow.criteria.SctpPortCriterion; | ||
| 97 | +import org.onosproject.net.flow.criteria.TcpPortCriterion; | ||
| 98 | +import org.onosproject.net.flow.criteria.UdpPortCriterion; | ||
| 99 | +import org.onosproject.net.flow.criteria.VlanIdCriterion; | ||
| 100 | +import org.onosproject.net.flow.criteria.VlanPcpCriterion; | ||
| 78 | import org.onosproject.net.flow.instructions.Instructions; | 101 | import org.onosproject.net.flow.instructions.Instructions; |
| 79 | import org.onosproject.net.flow.instructions.L0ModificationInstruction; | 102 | import org.onosproject.net.flow.instructions.L0ModificationInstruction; |
| 80 | import org.onosproject.net.flow.instructions.L2ModificationInstruction; | 103 | import org.onosproject.net.flow.instructions.L2ModificationInstruction; |
| ... | @@ -234,30 +257,30 @@ public final class KryoNamespaces { | ... | @@ -234,30 +257,30 @@ public final class KryoNamespaces { |
| 234 | FlowEntry.FlowEntryState.class, | 257 | FlowEntry.FlowEntryState.class, |
| 235 | FlowId.class, | 258 | FlowId.class, |
| 236 | DefaultTrafficSelector.class, | 259 | DefaultTrafficSelector.class, |
| 237 | - Criteria.PortCriterion.class, | 260 | + PortCriterion.class, |
| 238 | - Criteria.MetadataCriterion.class, | 261 | + MetadataCriterion.class, |
| 239 | - Criteria.EthCriterion.class, | 262 | + EthCriterion.class, |
| 240 | - Criteria.EthTypeCriterion.class, | 263 | + EthTypeCriterion.class, |
| 241 | - Criteria.VlanIdCriterion.class, | 264 | + VlanIdCriterion.class, |
| 242 | - Criteria.VlanPcpCriterion.class, | 265 | + VlanPcpCriterion.class, |
| 243 | - Criteria.IPDscpCriterion.class, | 266 | + IPDscpCriterion.class, |
| 244 | - Criteria.IPEcnCriterion.class, | 267 | + IPEcnCriterion.class, |
| 245 | - Criteria.IPProtocolCriterion.class, | 268 | + IPProtocolCriterion.class, |
| 246 | - Criteria.IPCriterion.class, | 269 | + IPCriterion.class, |
| 247 | - Criteria.TcpPortCriterion.class, | 270 | + TcpPortCriterion.class, |
| 248 | - Criteria.UdpPortCriterion.class, | 271 | + UdpPortCriterion.class, |
| 249 | - Criteria.SctpPortCriterion.class, | 272 | + SctpPortCriterion.class, |
| 250 | - Criteria.IcmpTypeCriterion.class, | 273 | + IcmpTypeCriterion.class, |
| 251 | - Criteria.IcmpCodeCriterion.class, | 274 | + IcmpCodeCriterion.class, |
| 252 | - Criteria.IPv6FlowLabelCriterion.class, | 275 | + IPv6FlowLabelCriterion.class, |
| 253 | - Criteria.Icmpv6TypeCriterion.class, | 276 | + Icmpv6TypeCriterion.class, |
| 254 | - Criteria.Icmpv6CodeCriterion.class, | 277 | + Icmpv6CodeCriterion.class, |
| 255 | - Criteria.IPv6NDTargetAddressCriterion.class, | 278 | + IPv6NDTargetAddressCriterion.class, |
| 256 | - Criteria.IPv6NDLinkLayerAddressCriterion.class, | 279 | + IPv6NDLinkLayerAddressCriterion.class, |
| 257 | - Criteria.MplsCriterion.class, | 280 | + MplsCriterion.class, |
| 258 | - Criteria.IPv6ExthdrFlagsCriterion.class, | 281 | + IPv6ExthdrFlagsCriterion.class, |
| 259 | - Criteria.LambdaCriterion.class, | 282 | + LambdaCriterion.class, |
| 260 | - Criteria.OpticalSignalTypeCriterion.class, | 283 | + OpticalSignalTypeCriterion.class, |
| 261 | Criterion.class, | 284 | Criterion.class, |
| 262 | Criterion.Type.class, | 285 | Criterion.Type.class, |
| 263 | DefaultTrafficTreatment.class, | 286 | DefaultTrafficTreatment.class, | ... | ... |
| ... | @@ -44,6 +44,12 @@ import org.onosproject.net.flow.TrafficSelector; | ... | @@ -44,6 +44,12 @@ import org.onosproject.net.flow.TrafficSelector; |
| 44 | import org.onosproject.net.flow.TrafficTreatment; | 44 | import org.onosproject.net.flow.TrafficTreatment; |
| 45 | import org.onosproject.net.flow.criteria.Criteria; | 45 | import org.onosproject.net.flow.criteria.Criteria; |
| 46 | import org.onosproject.net.flow.criteria.Criterion; | 46 | import org.onosproject.net.flow.criteria.Criterion; |
| 47 | +import org.onosproject.net.flow.criteria.EthCriterion; | ||
| 48 | +import org.onosproject.net.flow.criteria.EthTypeCriterion; | ||
| 49 | +import org.onosproject.net.flow.criteria.IPCriterion; | ||
| 50 | +import org.onosproject.net.flow.criteria.IPProtocolCriterion; | ||
| 51 | +import org.onosproject.net.flow.criteria.PortCriterion; | ||
| 52 | +import org.onosproject.net.flow.criteria.VlanIdCriterion; | ||
| 47 | import org.onosproject.net.flowobjective.FilteringObjective; | 53 | import org.onosproject.net.flowobjective.FilteringObjective; |
| 48 | import org.onosproject.net.flowobjective.FlowObjectiveStore; | 54 | import org.onosproject.net.flowobjective.FlowObjectiveStore; |
| 49 | import org.onosproject.net.flowobjective.ForwardingObjective; | 55 | import org.onosproject.net.flowobjective.ForwardingObjective; |
| ... | @@ -245,8 +251,8 @@ public class OVSCorsaPipeline extends AbstractHandlerBehaviour implements Pipeli | ... | @@ -245,8 +251,8 @@ public class OVSCorsaPipeline extends AbstractHandlerBehaviour implements Pipeli |
| 245 | log.debug("Processing versatile forwarding objective"); | 251 | log.debug("Processing versatile forwarding objective"); |
| 246 | TrafficSelector selector = fwd.selector(); | 252 | TrafficSelector selector = fwd.selector(); |
| 247 | 253 | ||
| 248 | - Criteria.EthTypeCriterion ethType = | 254 | + EthTypeCriterion ethType = |
| 249 | - (Criteria.EthTypeCriterion) selector.getCriterion(Criterion.Type.ETH_TYPE); | 255 | + (EthTypeCriterion) selector.getCriterion(Criterion.Type.ETH_TYPE); |
| 250 | if (ethType == null) { | 256 | if (ethType == null) { |
| 251 | log.error("Versatile forwarding objective must include ethType"); | 257 | log.error("Versatile forwarding objective must include ethType"); |
| 252 | fail(fwd, ObjectiveError.UNKNOWN); | 258 | fail(fwd, ObjectiveError.UNKNOWN); |
| ... | @@ -263,11 +269,11 @@ public class OVSCorsaPipeline extends AbstractHandlerBehaviour implements Pipeli | ... | @@ -263,11 +269,11 @@ public class OVSCorsaPipeline extends AbstractHandlerBehaviour implements Pipeli |
| 263 | fail(fwd, ObjectiveError.UNSUPPORTED); | 269 | fail(fwd, ObjectiveError.UNSUPPORTED); |
| 264 | return Collections.emptySet(); | 270 | return Collections.emptySet(); |
| 265 | } else if (ethType.ethType() == Ethernet.TYPE_IPV4) { | 271 | } else if (ethType.ethType() == Ethernet.TYPE_IPV4) { |
| 266 | - Criteria.IPCriterion ipSrc = (Criteria.IPCriterion) selector | 272 | + IPCriterion ipSrc = (IPCriterion) selector |
| 267 | .getCriterion(Criterion.Type.IPV4_SRC); | 273 | .getCriterion(Criterion.Type.IPV4_SRC); |
| 268 | - Criteria.IPCriterion ipDst = (Criteria.IPCriterion) selector | 274 | + IPCriterion ipDst = (IPCriterion) selector |
| 269 | .getCriterion(Criterion.Type.IPV4_DST); | 275 | .getCriterion(Criterion.Type.IPV4_DST); |
| 270 | - Criteria.IPProtocolCriterion ipProto = (Criteria.IPProtocolCriterion) selector | 276 | + IPProtocolCriterion ipProto = (IPProtocolCriterion) selector |
| 271 | .getCriterion(Criterion.Type.IP_PROTO); | 277 | .getCriterion(Criterion.Type.IP_PROTO); |
| 272 | if (ipSrc != null) { | 278 | if (ipSrc != null) { |
| 273 | log.warn("Driver does not currently handle matching Src IP"); | 279 | log.warn("Driver does not currently handle matching Src IP"); |
| ... | @@ -296,8 +302,8 @@ public class OVSCorsaPipeline extends AbstractHandlerBehaviour implements Pipeli | ... | @@ -296,8 +302,8 @@ public class OVSCorsaPipeline extends AbstractHandlerBehaviour implements Pipeli |
| 296 | private Collection<FlowRule> processSpecific(ForwardingObjective fwd) { | 302 | private Collection<FlowRule> processSpecific(ForwardingObjective fwd) { |
| 297 | log.debug("Processing specific forwarding objective"); | 303 | log.debug("Processing specific forwarding objective"); |
| 298 | TrafficSelector selector = fwd.selector(); | 304 | TrafficSelector selector = fwd.selector(); |
| 299 | - Criteria.EthTypeCriterion ethType = | 305 | + EthTypeCriterion ethType = |
| 300 | - (Criteria.EthTypeCriterion) selector.getCriterion(Criterion.Type.ETH_TYPE); | 306 | + (EthTypeCriterion) selector.getCriterion(Criterion.Type.ETH_TYPE); |
| 301 | if (ethType == null || ethType.ethType() != Ethernet.TYPE_IPV4) { | 307 | if (ethType == null || ethType.ethType() != Ethernet.TYPE_IPV4) { |
| 302 | fail(fwd, ObjectiveError.UNSUPPORTED); | 308 | fail(fwd, ObjectiveError.UNSUPPORTED); |
| 303 | return Collections.emptySet(); | 309 | return Collections.emptySet(); |
| ... | @@ -307,7 +313,7 @@ public class OVSCorsaPipeline extends AbstractHandlerBehaviour implements Pipeli | ... | @@ -307,7 +313,7 @@ public class OVSCorsaPipeline extends AbstractHandlerBehaviour implements Pipeli |
| 307 | DefaultTrafficSelector.builder() | 313 | DefaultTrafficSelector.builder() |
| 308 | .matchEthType(Ethernet.TYPE_IPV4) | 314 | .matchEthType(Ethernet.TYPE_IPV4) |
| 309 | .matchIPDst( | 315 | .matchIPDst( |
| 310 | - ((Criteria.IPCriterion) | 316 | + ((IPCriterion) |
| 311 | selector.getCriterion(Criterion.Type.IPV4_DST)).ip()) | 317 | selector.getCriterion(Criterion.Type.IPV4_DST)).ip()) |
| 312 | .build(); | 318 | .build(); |
| 313 | 319 | ||
| ... | @@ -351,10 +357,10 @@ public class OVSCorsaPipeline extends AbstractHandlerBehaviour implements Pipeli | ... | @@ -351,10 +357,10 @@ public class OVSCorsaPipeline extends AbstractHandlerBehaviour implements Pipeli |
| 351 | ApplicationId applicationId) { | 357 | ApplicationId applicationId) { |
| 352 | // This driver only processes filtering criteria defined with switch | 358 | // This driver only processes filtering criteria defined with switch |
| 353 | // ports as the key | 359 | // ports as the key |
| 354 | - Criteria.PortCriterion p; | 360 | + PortCriterion p; |
| 355 | if (!filt.key().equals(Criteria.dummy()) && | 361 | if (!filt.key().equals(Criteria.dummy()) && |
| 356 | filt.key().type() == Criterion.Type.IN_PORT) { | 362 | filt.key().type() == Criterion.Type.IN_PORT) { |
| 357 | - p = (Criteria.PortCriterion) filt.key(); | 363 | + p = (PortCriterion) filt.key(); |
| 358 | } else { | 364 | } else { |
| 359 | log.warn("No key defined in filtering objective from app: {}. Not" | 365 | log.warn("No key defined in filtering objective from app: {}. Not" |
| 360 | + "processing filtering objective", applicationId); | 366 | + "processing filtering objective", applicationId); |
| ... | @@ -365,7 +371,7 @@ public class OVSCorsaPipeline extends AbstractHandlerBehaviour implements Pipeli | ... | @@ -365,7 +371,7 @@ public class OVSCorsaPipeline extends AbstractHandlerBehaviour implements Pipeli |
| 365 | FlowRuleOperations.Builder ops = FlowRuleOperations.builder(); | 371 | FlowRuleOperations.Builder ops = FlowRuleOperations.builder(); |
| 366 | for (Criterion c : filt.conditions()) { | 372 | for (Criterion c : filt.conditions()) { |
| 367 | if (c.type() == Criterion.Type.ETH_DST) { | 373 | if (c.type() == Criterion.Type.ETH_DST) { |
| 368 | - Criteria.EthCriterion e = (Criteria.EthCriterion) c; | 374 | + EthCriterion e = (EthCriterion) c; |
| 369 | log.debug("adding rule for MAC: {}", e.mac()); | 375 | log.debug("adding rule for MAC: {}", e.mac()); |
| 370 | TrafficSelector.Builder selector = DefaultTrafficSelector.builder(); | 376 | TrafficSelector.Builder selector = DefaultTrafficSelector.builder(); |
| 371 | TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder(); | 377 | TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder(); |
| ... | @@ -381,7 +387,7 @@ public class OVSCorsaPipeline extends AbstractHandlerBehaviour implements Pipeli | ... | @@ -381,7 +387,7 @@ public class OVSCorsaPipeline extends AbstractHandlerBehaviour implements Pipeli |
| 381 | .forTable(MAC_TABLE).build(); | 387 | .forTable(MAC_TABLE).build(); |
| 382 | ops = install ? ops.add(rule) : ops.remove(rule); | 388 | ops = install ? ops.add(rule) : ops.remove(rule); |
| 383 | } else if (c.type() == Criterion.Type.VLAN_VID) { | 389 | } else if (c.type() == Criterion.Type.VLAN_VID) { |
| 384 | - Criteria.VlanIdCriterion v = (Criteria.VlanIdCriterion) c; | 390 | + VlanIdCriterion v = (VlanIdCriterion) c; |
| 385 | log.debug("adding rule for VLAN: {}", v.vlanId()); | 391 | log.debug("adding rule for VLAN: {}", v.vlanId()); |
| 386 | TrafficSelector.Builder selector = DefaultTrafficSelector.builder(); | 392 | TrafficSelector.Builder selector = DefaultTrafficSelector.builder(); |
| 387 | TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder(); | 393 | TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder(); |
| ... | @@ -399,7 +405,7 @@ public class OVSCorsaPipeline extends AbstractHandlerBehaviour implements Pipeli | ... | @@ -399,7 +405,7 @@ public class OVSCorsaPipeline extends AbstractHandlerBehaviour implements Pipeli |
| 399 | .forTable(VLAN_TABLE).build(); | 405 | .forTable(VLAN_TABLE).build(); |
| 400 | ops = install ? ops.add(rule) : ops.remove(rule); | 406 | ops = install ? ops.add(rule) : ops.remove(rule); |
| 401 | } else if (c.type() == Criterion.Type.IPV4_DST) { | 407 | } else if (c.type() == Criterion.Type.IPV4_DST) { |
| 402 | - Criteria.IPCriterion ip = (Criteria.IPCriterion) c; | 408 | + IPCriterion ip = (IPCriterion) c; |
| 403 | log.debug("adding rule for IP: {}", ip.ip()); | 409 | log.debug("adding rule for IP: {}", ip.ip()); |
| 404 | TrafficSelector.Builder selector = DefaultTrafficSelector.builder(); | 410 | TrafficSelector.Builder selector = DefaultTrafficSelector.builder(); |
| 405 | TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder(); | 411 | TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder(); | ... | ... |
| ... | @@ -22,28 +22,30 @@ import org.onlab.packet.Ip6Prefix; | ... | @@ -22,28 +22,30 @@ import org.onlab.packet.Ip6Prefix; |
| 22 | import org.onlab.packet.VlanId; | 22 | import org.onlab.packet.VlanId; |
| 23 | import org.onosproject.net.flow.FlowRule; | 23 | import org.onosproject.net.flow.FlowRule; |
| 24 | import org.onosproject.net.flow.TrafficSelector; | 24 | import org.onosproject.net.flow.TrafficSelector; |
| 25 | -import org.onosproject.net.flow.criteria.Criteria; | 25 | +import org.onosproject.net.flow.criteria.EthCriterion; |
| 26 | -import org.onosproject.net.flow.criteria.Criteria.EthCriterion; | 26 | +import org.onosproject.net.flow.criteria.EthTypeCriterion; |
| 27 | -import org.onosproject.net.flow.criteria.Criteria.EthTypeCriterion; | 27 | +import org.onosproject.net.flow.criteria.IPCriterion; |
| 28 | -import org.onosproject.net.flow.criteria.Criteria.IPCriterion; | 28 | +import org.onosproject.net.flow.criteria.IPDscpCriterion; |
| 29 | -import org.onosproject.net.flow.criteria.Criteria.IPDscpCriterion; | 29 | +import org.onosproject.net.flow.criteria.IPEcnCriterion; |
| 30 | -import org.onosproject.net.flow.criteria.Criteria.IPEcnCriterion; | 30 | +import org.onosproject.net.flow.criteria.IPProtocolCriterion; |
| 31 | -import org.onosproject.net.flow.criteria.Criteria.IPProtocolCriterion; | 31 | +import org.onosproject.net.flow.criteria.IPv6ExthdrFlagsCriterion; |
| 32 | -import org.onosproject.net.flow.criteria.Criteria.IPv6FlowLabelCriterion; | 32 | +import org.onosproject.net.flow.criteria.IPv6FlowLabelCriterion; |
| 33 | -import org.onosproject.net.flow.criteria.Criteria.IPv6NDLinkLayerAddressCriterion; | 33 | +import org.onosproject.net.flow.criteria.IPv6NDLinkLayerAddressCriterion; |
| 34 | -import org.onosproject.net.flow.criteria.Criteria.IPv6NDTargetAddressCriterion; | 34 | +import org.onosproject.net.flow.criteria.IPv6NDTargetAddressCriterion; |
| 35 | -import org.onosproject.net.flow.criteria.Criteria.IcmpCodeCriterion; | 35 | +import org.onosproject.net.flow.criteria.IcmpCodeCriterion; |
| 36 | -import org.onosproject.net.flow.criteria.Criteria.IcmpTypeCriterion; | 36 | +import org.onosproject.net.flow.criteria.IcmpTypeCriterion; |
| 37 | -import org.onosproject.net.flow.criteria.Criteria.Icmpv6CodeCriterion; | 37 | +import org.onosproject.net.flow.criteria.Icmpv6CodeCriterion; |
| 38 | -import org.onosproject.net.flow.criteria.Criteria.Icmpv6TypeCriterion; | 38 | +import org.onosproject.net.flow.criteria.Icmpv6TypeCriterion; |
| 39 | -import org.onosproject.net.flow.criteria.Criteria.LambdaCriterion; | 39 | +import org.onosproject.net.flow.criteria.LambdaCriterion; |
| 40 | -import org.onosproject.net.flow.criteria.Criteria.MetadataCriterion; | 40 | +import org.onosproject.net.flow.criteria.MetadataCriterion; |
| 41 | -import org.onosproject.net.flow.criteria.Criteria.PortCriterion; | 41 | +import org.onosproject.net.flow.criteria.MplsCriterion; |
| 42 | -import org.onosproject.net.flow.criteria.Criteria.SctpPortCriterion; | 42 | +import org.onosproject.net.flow.criteria.OpticalSignalTypeCriterion; |
| 43 | -import org.onosproject.net.flow.criteria.Criteria.TcpPortCriterion; | 43 | +import org.onosproject.net.flow.criteria.PortCriterion; |
| 44 | -import org.onosproject.net.flow.criteria.Criteria.UdpPortCriterion; | 44 | +import org.onosproject.net.flow.criteria.SctpPortCriterion; |
| 45 | -import org.onosproject.net.flow.criteria.Criteria.VlanIdCriterion; | 45 | +import org.onosproject.net.flow.criteria.TcpPortCriterion; |
| 46 | -import org.onosproject.net.flow.criteria.Criteria.VlanPcpCriterion; | 46 | +import org.onosproject.net.flow.criteria.UdpPortCriterion; |
| 47 | +import org.onosproject.net.flow.criteria.VlanIdCriterion; | ||
| 48 | +import org.onosproject.net.flow.criteria.VlanPcpCriterion; | ||
| 47 | import org.onosproject.net.flow.criteria.Criterion; | 49 | import org.onosproject.net.flow.criteria.Criterion; |
| 48 | import org.projectfloodlight.openflow.protocol.OFFactory; | 50 | import org.projectfloodlight.openflow.protocol.OFFactory; |
| 49 | import org.projectfloodlight.openflow.protocol.OFFlowAdd; | 51 | import org.projectfloodlight.openflow.protocol.OFFlowAdd; |
| ... | @@ -362,12 +364,12 @@ public abstract class FlowModBuilder { | ... | @@ -362,12 +364,12 @@ public abstract class FlowModBuilder { |
| 362 | MacAddress.of(llAddressCriterion.mac().toLong())); | 364 | MacAddress.of(llAddressCriterion.mac().toLong())); |
| 363 | break; | 365 | break; |
| 364 | case MPLS_LABEL: | 366 | case MPLS_LABEL: |
| 365 | - Criteria.MplsCriterion mp = (Criteria.MplsCriterion) c; | 367 | + MplsCriterion mp = (MplsCriterion) c; |
| 366 | mBuilder.setExact(MatchField.MPLS_LABEL, U32.of(mp.label().toInt())); | 368 | mBuilder.setExact(MatchField.MPLS_LABEL, U32.of(mp.label().toInt())); |
| 367 | break; | 369 | break; |
| 368 | case IPV6_EXTHDR: | 370 | case IPV6_EXTHDR: |
| 369 | - Criteria.IPv6ExthdrFlagsCriterion exthdrFlagsCriterion = | 371 | + IPv6ExthdrFlagsCriterion exthdrFlagsCriterion = |
| 370 | - (Criteria.IPv6ExthdrFlagsCriterion) c; | 372 | + (IPv6ExthdrFlagsCriterion) c; |
| 371 | mBuilder.setExact(MatchField.IPV6_EXTHDR, | 373 | mBuilder.setExact(MatchField.IPV6_EXTHDR, |
| 372 | U16.of(exthdrFlagsCriterion.exthdrFlags())); | 374 | U16.of(exthdrFlagsCriterion.exthdrFlags())); |
| 373 | break; | 375 | break; |
| ... | @@ -378,8 +380,8 @@ public abstract class FlowModBuilder { | ... | @@ -378,8 +380,8 @@ public abstract class FlowModBuilder { |
| 378 | (short) lc.lambda(), (short) 1)); | 380 | (short) lc.lambda(), (short) 1)); |
| 379 | break; | 381 | break; |
| 380 | case OCH_SIGTYPE: | 382 | case OCH_SIGTYPE: |
| 381 | - Criteria.OpticalSignalTypeCriterion sc = | 383 | + OpticalSignalTypeCriterion sc = |
| 382 | - (Criteria.OpticalSignalTypeCriterion) c; | 384 | + (OpticalSignalTypeCriterion) c; |
| 383 | mBuilder.setExact(MatchField.OCH_SIGTYPE, | 385 | mBuilder.setExact(MatchField.OCH_SIGTYPE, |
| 384 | U8.of(sc.signalType())); | 386 | U8.of(sc.signalType())); |
| 385 | break; | 387 | break; | ... | ... |
-
Please register or login to post a comment