diff options
Diffstat (limited to 'framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria')
42 files changed, 0 insertions, 3923 deletions
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/ArpHaCriterion.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/ArpHaCriterion.java deleted file mode 100644 index 71269dd1..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/ArpHaCriterion.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.flow.criteria; - -import static com.google.common.base.MoreObjects.toStringHelper; -import static com.google.common.base.Preconditions.checkNotNull; - -import java.util.Objects; - -import org.onlab.packet.MacAddress; - -/** - * Implementation of arp_eth_src address or arp_eth_dst address criterion. - */ -public final class ArpHaCriterion implements Criterion { - private final MacAddress mac; - private final Type type; - - /** - * Constructor. - * - * @param mac the MAC Address to match. - * @param type the match type. Should be one of the following: - * Type.ARP_SHA, Type.ARP_THA - */ - ArpHaCriterion(MacAddress mac, Type type) { - checkNotNull(mac, "mac cannot be null"); - checkNotNull(type, "type cannot be null"); - this.mac = mac; - this.type = type; - } - - @Override - public Type type() { - return this.type; - } - - /** - * Gets the MAC Address to match. - * - * @return the MAC Address to match - */ - public MacAddress mac() { - return this.mac; - } - - @Override - public String toString() { - return toStringHelper(type().toString()) - .add("mac", mac).toString(); - } - - @Override - public int hashCode() { - return Objects.hash(type().ordinal(), mac); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof ArpHaCriterion) { - ArpHaCriterion that = (ArpHaCriterion) obj; - return Objects.equals(mac, that.mac) && - Objects.equals(type, that.type); - } - return false; - } -}
\ No newline at end of file diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/ArpOpCriterion.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/ArpOpCriterion.java deleted file mode 100644 index 8c5398c6..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/ArpOpCriterion.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.flow.criteria; - -import static com.google.common.base.MoreObjects.toStringHelper; - -import java.util.Objects; - -/** - * Implementation of arp operation type criterion. - */ -public final class ArpOpCriterion implements Criterion { - private final int arpOp; - private final Type type; - - /** - * Constructor. - * - * @param arpOp the arp operation type to match. - * @param type the match type. Should be the following: - * Type.ARP_OP - */ - ArpOpCriterion(int arpOp, Type type) { - this.arpOp = arpOp; - this.type = type; - } - - @Override - public Type type() { - return this.type; - } - - /** - * Gets the arp operation type to match. - * - * @return the arp operation type to match - */ - public int arpOp() { - return this.arpOp; - } - - @Override - public String toString() { - return toStringHelper(type().toString()) - .add("arpOp", arpOp).toString(); - } - - @Override - public int hashCode() { - return Objects.hash(type().ordinal(), arpOp); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof ArpOpCriterion) { - ArpOpCriterion that = (ArpOpCriterion) obj; - return Objects.equals(arpOp, that.arpOp) && - Objects.equals(type, that.type); - } - return false; - } -}
\ No newline at end of file diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/ArpPaCriterion.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/ArpPaCriterion.java deleted file mode 100644 index ba5a03d8..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/ArpPaCriterion.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.flow.criteria; - -import static com.google.common.base.MoreObjects.toStringHelper; - -import java.util.Objects; - -import org.onlab.packet.Ip4Address; - -/** - * Implementation of arp spa or tpa address criterion. - */ -public final class ArpPaCriterion implements Criterion { - private final Ip4Address ip; - private final Type type; - - /** - * Constructor. - * - * @param ip the Ip4 Address to match. - * @param type the match type. Should be one of the following: - * Type.ARP_SPA, Type.ARP_TPA - */ - ArpPaCriterion(Ip4Address ip, Type type) { - this.ip = ip; - this.type = type; - } - - @Override - public Type type() { - return this.type; - } - - /** - * Gets the Ip4 Address to match. - * - * @return the Ip4 Address to match - */ - public Ip4Address ip() { - return this.ip; - } - - @Override - public String toString() { - return toStringHelper(type().toString()) - .add("ip", ip).toString(); - } - - @Override - public int hashCode() { - return Objects.hash(type().ordinal(), ip); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof ArpPaCriterion) { - ArpPaCriterion that = (ArpPaCriterion) obj; - return Objects.equals(ip, that.ip) && - Objects.equals(type, that.type); - } - return false; - } -}
\ No newline at end of file diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/Criteria.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/Criteria.java deleted file mode 100644 index c94b1e02..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/Criteria.java +++ /dev/null @@ -1,624 +0,0 @@ -/* - * Copyright 2014-2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.flow.criteria; - -import org.onlab.packet.EthType; -import org.onlab.packet.Ip4Address; -import org.onlab.packet.Ip6Address; -import org.onlab.packet.IpPrefix; -import org.onlab.packet.MacAddress; -import org.onlab.packet.MplsLabel; -import org.onlab.packet.TpPort; -import org.onlab.packet.VlanId; -import org.onosproject.net.DeviceId; -import org.onosproject.net.IndexedLambda; -import org.onosproject.net.Lambda; -import org.onosproject.net.OchSignal; -import org.onosproject.net.OchSignalType; -import org.onosproject.net.OduSignalId; -import org.onosproject.net.OduSignalType; -import org.onosproject.net.PortNumber; -import org.onosproject.net.flow.criteria.Criterion.Type; - -/** - * Factory class to create various traffic selection criteria. - */ -public final class Criteria { - - //TODO: incomplete type implementation. Need to implement complete list from Criterion - - // Ban construction - private Criteria() { - } - - /** - * Creates a match on IN_PORT field using the specified value. - * - * @param port inport value - * @return match criterion - */ - public static Criterion matchInPort(PortNumber port) { - return new PortCriterion(port, Type.IN_PORT); - } - - /** - * Creates a match on IN_PHY_PORT field using the specified value. - * - * @param port inport value - * @return match criterion - */ - public static Criterion matchInPhyPort(PortNumber port) { - return new PortCriterion(port, Type.IN_PHY_PORT); - } - - /** - * Creates a match on METADATA field using the specified value. - * - * @param metadata metadata value (64 bits data) - * @return match criterion - */ - public static Criterion matchMetadata(long metadata) { - return new MetadataCriterion(metadata); - } - - /** - * Creates a match on ETH_DST field using the specified value. This value - * may be a wildcard mask. - * - * @param mac MAC address value or wildcard mask - * @return match criterion - */ - public static Criterion matchEthDst(MacAddress mac) { - return new EthCriterion(mac, Type.ETH_DST); - } - - /** - * Creates a match on ETH_SRC field using the specified value. This value - * may be a wildcard mask. - * - * @param mac MAC address value or wildcard mask - * @return match criterion - */ - public static Criterion matchEthSrc(MacAddress mac) { - return new EthCriterion(mac, Type.ETH_SRC); - } - - /** - * Creates a match on ETH_TYPE field using the specified value. - * - * @param ethType eth type value (16 bits unsigned integer) - * @return match criterion - */ - public static Criterion matchEthType(int ethType) { - return new EthTypeCriterion(ethType); - } - - /** - * Creates a match on ETH_TYPE field using the specified value. - * - * @param ethType eth type value - * @return match criterion - */ - public static Criterion matchEthType(EthType ethType) { - return new EthTypeCriterion(ethType); - } - - /** - * Creates a match on VLAN ID field using the specified value. - * - * @param vlanId vlan id value - * @return match criterion - */ - public static Criterion matchVlanId(VlanId vlanId) { - return new VlanIdCriterion(vlanId); - } - - /** - * Creates a match on VLAN PCP field using the specified value. - * - * @param vlanPcp vlan pcp value (3 bits) - * @return match criterion - */ - public static Criterion matchVlanPcp(byte vlanPcp) { - return new VlanPcpCriterion(vlanPcp); - } - - /** - * Creates a match on IP DSCP field using the specified value. - * - * @param ipDscp ip dscp value (6 bits) - * @return match criterion - */ - public static Criterion matchIPDscp(byte ipDscp) { - return new IPDscpCriterion(ipDscp); - } - - /** - * Creates a match on IP ECN field using the specified value. - * - * @param ipEcn ip ecn value (2 bits) - * @return match criterion - */ - public static Criterion matchIPEcn(byte ipEcn) { - return new IPEcnCriterion(ipEcn); - } - - /** - * Creates a match on IP proto field using the specified value. - * - * @param proto ip protocol value (8 bits unsigned integer) - * @return match criterion - */ - public static Criterion matchIPProtocol(short proto) { - return new IPProtocolCriterion(proto); - } - - /** - * Creates a match on IPv4 source field using the specified value. - * - * @param ip ipv4 source value - * @return match criterion - */ - public static Criterion matchIPSrc(IpPrefix ip) { - return new IPCriterion(ip, Type.IPV4_SRC); - } - - /** - * Creates a match on IPv4 destination field using the specified value. - * - * @param ip ipv4 source value - * @return match criterion - */ - public static Criterion matchIPDst(IpPrefix ip) { - return new IPCriterion(ip, Type.IPV4_DST); - } - - /** - * Creates a match on TCP source port field using the specified value. - * - * @param tcpPort TCP source port - * @return match criterion - * @deprecated in Drake release - */ - @Deprecated - public static Criterion matchTcpSrc(short tcpPort) { - return new TcpPortCriterion(TpPort.tpPort(tcpPort), Type.TCP_SRC); - } - - /** - * Creates a match on TCP source port field using the specified value. - * - * @param tcpPort TCP source port - * @return match criterion - */ - public static Criterion matchTcpSrc(TpPort tcpPort) { - return new TcpPortCriterion(tcpPort, Type.TCP_SRC); - } - - /** - * Creates a match on TCP destination port field using the specified value. - * - * @param tcpPort TCP destination port - * @return match criterion - * @deprecated in Drake release - */ - @Deprecated - public static Criterion matchTcpDst(short tcpPort) { - return new TcpPortCriterion(TpPort.tpPort(tcpPort), Type.TCP_DST); - } - - /** - * Creates a match on TCP destination port field using the specified value. - * - * @param tcpPort TCP destination port - * @return match criterion - */ - public static Criterion matchTcpDst(TpPort tcpPort) { - return new TcpPortCriterion(tcpPort, Type.TCP_DST); - } - - /** - * Creates a match on TCP flags using the specified value. - * - * @param flags TCP flags - * @return match criterion - */ - public static Criterion matchTcpFlags(int flags) { - return new TcpFlagsCriterion(flags); - } - - /** - * Creates a match on UDP source port field using the specified value. - * - * @param udpPort UDP source port - * @return match criterion - * @deprecated in Drake release - */ - @Deprecated - public static Criterion matchUdpSrc(short udpPort) { - return new UdpPortCriterion(TpPort.tpPort(udpPort), Type.UDP_SRC); - } - - /** - * Creates a match on UDP source port field using the specified value. - * - * @param udpPort UDP source port - * @return match criterion - */ - public static Criterion matchUdpSrc(TpPort udpPort) { - return new UdpPortCriterion(udpPort, Type.UDP_SRC); - } - - /** - * Creates a match on UDP destination port field using the specified value. - * - * @param udpPort UDP destination port - * @return match criterion - * @deprecated in Drake release - */ - @Deprecated - public static Criterion matchUdpDst(short udpPort) { - return new UdpPortCriterion(TpPort.tpPort(udpPort), Type.UDP_DST); - } - - /** - * Creates a match on UDP destination port field using the specified value. - * - * @param udpPort UDP destination port - * @return match criterion - */ - public static Criterion matchUdpDst(TpPort udpPort) { - return new UdpPortCriterion(udpPort, Type.UDP_DST); - } - - /** - * Creates a match on SCTP source port field using the specified value. - * - * @param sctpPort SCTP source port - * @return match criterion - * @deprecated in Drake release - */ - @Deprecated - public static Criterion matchSctpSrc(short sctpPort) { - return new SctpPortCriterion(TpPort.tpPort(sctpPort), Type.SCTP_SRC); - } - - /** - * Creates a match on SCTP source port field using the specified value. - * - * @param sctpPort SCTP source port - * @return match criterion - */ - public static Criterion matchSctpSrc(TpPort sctpPort) { - return new SctpPortCriterion(sctpPort, Type.SCTP_SRC); - } - - /** - * Creates a match on SCTP destination port field using the specified - * value. - * - * @param sctpPort SCTP destination port - * @return match criterion - * @deprecated in Drake release - */ - @Deprecated - public static Criterion matchSctpDst(short sctpPort) { - return new SctpPortCriterion(TpPort.tpPort(sctpPort), Type.SCTP_DST); - } - - /** - * Creates a match on SCTP destination port field using the specified - * value. - * - * @param sctpPort SCTP destination port - * @return match criterion - */ - public static Criterion matchSctpDst(TpPort sctpPort) { - return new SctpPortCriterion(sctpPort, Type.SCTP_DST); - } - - /** - * Creates a match on ICMP type field using the specified value. - * - * @param icmpType ICMP type (8 bits unsigned integer) - * @return match criterion - */ - public static Criterion matchIcmpType(short icmpType) { - return new IcmpTypeCriterion(icmpType); - } - - /** - * Creates a match on ICMP code field using the specified value. - * - * @param icmpCode ICMP code (8 bits unsigned integer) - * @return match criterion - */ - public static Criterion matchIcmpCode(short icmpCode) { - return new IcmpCodeCriterion(icmpCode); - } - - /** - * Creates a match on IPv6 source field using the specified value. - * - * @param ip ipv6 source value - * @return match criterion - */ - public static Criterion matchIPv6Src(IpPrefix ip) { - return new IPCriterion(ip, Type.IPV6_SRC); - } - - /** - * Creates a match on IPv6 destination field using the specified value. - * - * @param ip ipv6 destination value - * @return match criterion - */ - public static Criterion matchIPv6Dst(IpPrefix ip) { - return new IPCriterion(ip, Type.IPV6_DST); - } - - /** - * Creates a match on IPv6 flow label field using the specified value. - * - * @param flowLabel IPv6 flow label (20 bits) - * @return match criterion - */ - public static Criterion matchIPv6FlowLabel(int flowLabel) { - return new IPv6FlowLabelCriterion(flowLabel); - } - - /** - * Creates a match on ICMPv6 type field using the specified value. - * - * @param icmpv6Type ICMPv6 type (8 bits unsigned integer) - * @return match criterion - */ - public static Criterion matchIcmpv6Type(short icmpv6Type) { - return new Icmpv6TypeCriterion(icmpv6Type); - } - - /** - * Creates a match on ICMPv6 code field using the specified value. - * - * @param icmpv6Code ICMPv6 code (8 bits unsigned integer) - * @return match criterion - */ - public static Criterion matchIcmpv6Code(short icmpv6Code) { - return new Icmpv6CodeCriterion(icmpv6Code); - } - - /** - * Creates a match on IPv6 Neighbor Discovery target address using the - * specified value. - * - * @param targetAddress IPv6 Neighbor Discovery target address - * @return match criterion - */ - public static Criterion matchIPv6NDTargetAddress(Ip6Address targetAddress) { - return new IPv6NDTargetAddressCriterion(targetAddress); - } - - /** - * Creates a match on IPv6 Neighbor Discovery source link-layer address - * using the specified value. - * - * @param mac IPv6 Neighbor Discovery source link-layer address - * @return match criterion - */ - public static Criterion matchIPv6NDSourceLinkLayerAddress(MacAddress mac) { - return new IPv6NDLinkLayerAddressCriterion(mac, Type.IPV6_ND_SLL); - } - - /** - * Creates a match on IPv6 Neighbor Discovery target link-layer address - * using the specified value. - * - * @param mac IPv6 Neighbor Discovery target link-layer address - * @return match criterion - */ - public static Criterion matchIPv6NDTargetLinkLayerAddress(MacAddress mac) { - return new IPv6NDLinkLayerAddressCriterion(mac, Type.IPV6_ND_TLL); - } - - /** - * Creates a match on MPLS label. - * - * @param mplsLabel MPLS label (20 bits) - * @return match criterion - */ - public static Criterion matchMplsLabel(MplsLabel mplsLabel) { - return new MplsCriterion(mplsLabel); - } - - /** - * Creates a match on MPLS Bottom-of-Stack indicator bit. - * - * @param mplsBos boolean value indicating true (BOS=1) or false (BOS=0) - * @return match criterion - */ - public static Criterion matchMplsBos(boolean mplsBos) { - return new MplsBosCriterion(mplsBos); - } - - /** - * Creates a match on MPLS TC. - * - * @param mplsTc MPLS TC (3 bits) - * @return match criterion - */ - public static Criterion matchMplsTc(byte mplsTc) { - return new MplsTcCriterion(mplsTc); - } - - /** - * Creates a match on Tunnel ID. - * - * @param tunnelId Tunnel ID (64 bits) - * @return match criterion - */ - public static Criterion matchTunnelId(long tunnelId) { - return new TunnelIdCriterion(tunnelId); - } - - /** - * Creates a match on IPv6 Extension Header pseudo-field fiags. - * Those are defined in Criterion.IPv6ExthdrFlags. - * - * @param exthdrFlags IPv6 Extension Header pseudo-field flags (16 bits) - * @return match criterion - */ - public static Criterion matchIPv6ExthdrFlags(int exthdrFlags) { - return new IPv6ExthdrFlagsCriterion(exthdrFlags); - } - - /** - * Creates a match on lambda using the specified value. - * - * @param lambda lambda - * @return match criterion - */ - public static Criterion matchLambda(Lambda lambda) { - if (lambda instanceof IndexedLambda) { - return new IndexedLambdaCriterion((IndexedLambda) lambda); - } else if (lambda instanceof OchSignal) { - return new OchSignalCriterion((OchSignal) lambda); - } else { - throw new UnsupportedOperationException(String.format("Unsupported type of Lambda: %s", lambda)); - } - } - - /** - * Create a match on OCh (Optical Channel) signal type. - * - * @param signalType OCh signal type - * @return match criterion - */ - public static Criterion matchOchSignalType(OchSignalType signalType) { - return new OchSignalTypeCriterion(signalType); - } - - /** - * Creates a match on ODU (Optical channel Data Unit) signal ID using the specified value. - * - * @param oduSignalId ODU Signal Id - * @return match criterion - */ - public static Criterion matchOduSignalId(OduSignalId oduSignalId) { - return new OduSignalIdCriterion(oduSignalId); - } - - /** - * Creates a match on ODU (Optical channel Data Unit) signal Type using the specified value. - * - * @param signalType ODU Signal Type - * @return match criterion - */ - public static Criterion matchOduSignalType(OduSignalType signalType) { - return new OduSignalTypeCriterion(signalType); - } - - /** - * Creates a match on IPv4 destination field using the specified value. - * - * @param ip ipv4 destination value - * @return match criterion - */ - public static Criterion matchArpTpa(Ip4Address ip) { - return new ArpPaCriterion(ip, Type.ARP_TPA); - } - - /** - * Creates a match on IPv4 source field using the specified value. - * - * @param ip ipv4 source value - * @return match criterion - */ - public static Criterion matchArpSpa(Ip4Address ip) { - return new ArpPaCriterion(ip, Type.ARP_SPA); - } - - /** - * Creates a match on MAC destination field using the specified value. - * - * @param mac MAC destination value - * @return match criterion - */ - public static Criterion matchArpTha(MacAddress mac) { - return new ArpHaCriterion(mac, Type.ARP_THA); - } - - /** - * Creates a match on MAC source field using the specified value. - * - * @param mac MAC source value - * @return match criterion - */ - public static Criterion matchArpSha(MacAddress mac) { - return new ArpHaCriterion(mac, Type.ARP_SHA); - } - - /** - * Creates a match on arp operation type field using the specified value. - * - * @param arpOp arp operation type value - * @return match criterion - */ - public static Criterion matchArpOp(int arpOp) { - return new ArpOpCriterion(arpOp, Type.ARP_OP); - } - - /** - * Creates a match on PBB I-SID field using the specific value. - * - * @param pbbIsid PBB I-SID - * @return match criterion - */ - public static Criterion matchPbbIsid(int pbbIsid) { - return new PbbIsidCriterion(pbbIsid); - } - - /** - * Creates an extension criterion for the specified extension selector. - * - * @param extensionSelector extension selector - * @param deviceId device ID - * @return match criterion - */ - public static Criterion extension(ExtensionSelector extensionSelector, - DeviceId deviceId) { - return new ExtensionCriterion(extensionSelector, deviceId); - } - - /** - * Creates a dummy criterion. - * - * @return match criterion - */ - public static Criterion dummy() { - return new DummyCriterion(); - } - - /** - * Dummy Criterion used with @see{FilteringObjective}. - */ - private static class DummyCriterion implements Criterion { - - @Override - public Type type() { - return Type.DUMMY; - } - } -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/Criterion.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/Criterion.java deleted file mode 100644 index 17557b9d..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/Criterion.java +++ /dev/null @@ -1,270 +0,0 @@ -/* - * Copyright 2014-2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.flow.criteria; - - -/** - * Representation of a single header field selection. - */ -public interface Criterion { - - /** - * Types of fields to which the selection criterion may apply. - */ - // From page 75 of OpenFlow 1.5.0 spec - enum Type { - /** Switch input port. */ - IN_PORT, - - /** Switch physical input port. */ - IN_PHY_PORT, - - /** Metadata passed between tables. */ - METADATA, - - /** Ethernet destination address. */ - ETH_DST, - - /** Ethernet source address. */ - ETH_SRC, - - /** Ethernet frame type. */ - ETH_TYPE, - - /** VLAN id. */ - VLAN_VID, - - /** VLAN priority. */ - VLAN_PCP, - - /** IP DSCP (6 bits in ToS field). */ - IP_DSCP, - - /** IP ECN (2 bits in ToS field). */ - IP_ECN, - - /** IP protocol. */ - IP_PROTO, - - /** IPv4 source address. */ - IPV4_SRC, - - /** IPv4 destination address. */ - IPV4_DST, - - /** TCP source port. */ - TCP_SRC, - - /** TCP destination port. */ - TCP_DST, - - /** UDP source port. */ - UDP_SRC, - - /** UDP destination port. */ - UDP_DST, - - /** SCTP source port. */ - SCTP_SRC, - - /** SCTP destination port. */ - SCTP_DST, - - /** ICMP type. */ - ICMPV4_TYPE, - - /** ICMP code. */ - ICMPV4_CODE, - - /** ARP opcode. */ - ARP_OP, - - /** ARP source IPv4 address. */ - ARP_SPA, - - /** ARP target IPv4 address. */ - ARP_TPA, - - /** ARP source hardware address. */ - ARP_SHA, - - /** ARP target hardware address. */ - ARP_THA, - - /** IPv6 source address. */ - IPV6_SRC, - - /** IPv6 destination address. */ - IPV6_DST, - - /** IPv6 Flow Label. */ - IPV6_FLABEL, - - /** ICMPv6 type. */ - ICMPV6_TYPE, - - /** ICMPv6 code. */ - ICMPV6_CODE, - - /** Target address for ND. */ - IPV6_ND_TARGET, - - /** Source link-layer for ND. */ - IPV6_ND_SLL, - - /** Target link-layer for ND. */ - IPV6_ND_TLL, - - /** MPLS label. */ - MPLS_LABEL, - - /** MPLS TC. */ - MPLS_TC, - - /** MPLS BoS bit. */ - MPLS_BOS, - - /** PBB I-SID. */ - PBB_ISID, - - /** Logical Port Metadata. */ - TUNNEL_ID, - - /** IPv6 Extension Header pseudo-field. */ - IPV6_EXTHDR, - - /** Unassigned value: 40. */ - UNASSIGNED_40, - - /** PBB UCA header field. */ - PBB_UCA, - - /** TCP flags. */ - TCP_FLAGS, - - /** Output port from action set metadata. */ - ACTSET_OUTPUT, - - /** Packet type value. */ - PACKET_TYPE, - - // - // NOTE: Everything below is defined elsewhere: ONOS-specific, - // extensions, etc. - // - /** Optical channel signal ID (lambda). */ - OCH_SIGID, - - /** Optical channel signal type (fixed or flexible). */ - OCH_SIGTYPE, - - /** ODU (Optical channel Data Unit) signal ID. */ - ODU_SIGID, - - /** ODU (Optical channel Data Unit) signal type. */ - ODU_SIGTYPE, - - /** Extension criterion. */ - EXTENSION, - - /** An empty criterion. */ - DUMMY - } - - /** - * Returns the type of criterion. - * - * @return type of criterion - */ - Type type(); - - /** - * Bit definitions for IPv6 Extension Header pseudo-field. - * From page 79 of OpenFlow 1.5.0 spec. - */ - enum IPv6ExthdrFlags { - /** "No next header" encountered. */ - NONEXT((short) (1 << 0)), - /** Encrypted Sec Payload header present. */ - ESP((short) (1 << 1)), - /** Authentication header present. */ - AUTH((short) (1 << 2)), - /** 1 or 2 dest headers present. */ - DEST((short) (1 << 3)), - /** Fragment header present. */ - FRAG((short) (1 << 4)), - /** Router header present. */ - ROUTER((short) (1 << 5)), - /** Hop-by-hop header present. */ - HOP((short) (1 << 6)), - /** Unexpected repeats encountered. */ - UNREP((short) (1 << 7)), - /** Unexpected sequencing encountered. */ - UNSEQ((short) (1 << 8)); - - private short value; - - IPv6ExthdrFlags(short value) { - this.value = value; - } - - /** - * Gets the value as an integer. - * - * @return the value as an integer - */ - public short getValue() { - return this.value; - } - } - - enum TCPFlags { - - /** ECN-nonce concealment protection. */ - NS((short) (1 << 0)), - /** Congestion Window Reduced. */ - CWR((short) (1 << 1)), - /** ECN-Echo. **/ - ECE((short) (1 << 2)), - /** Urgent pointer field is significant. */ - URG((short) (1 << 3)), - /** Acknowledgment field is significant. */ - ACK((short) (1 << 4)), - /** Push the buffered data to the receiving application. */ - PSH((short) (1 << 5)), - /** Reset the connection. */ - RST((short) (1 << 6)), - /** Synchronize sequence numbers. */ - SYN((short) (1 << 7)), - /** No more data from sender. */ - FIN((short) (1 << 8)); - - private short value; - - TCPFlags(short value) { - this.value = value; - } - - /** - * Gets the value as an integer. - * - * @return the value as an integer - */ - public short getValue() { - return this.value; - } - } -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/EthCriterion.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/EthCriterion.java deleted file mode 100644 index 6020974d..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/EthCriterion.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.flow.criteria; - -import org.onlab.packet.MacAddress; - -import java.util.Objects; - -import static com.google.common.base.MoreObjects.toStringHelper; - -/** - * Implementation of MAC address criterion. - */ -public final class EthCriterion implements Criterion { - private final MacAddress mac; - private final Type type; - - /** - * Constructor. - * - * @param mac the source or destination MAC address to match - * @param type the match type. Should be either Type.ETH_DST or - * Type.ETH_SRC - */ - EthCriterion(MacAddress mac, Type type) { - this.mac = mac; - this.type = type; - } - - @Override - public Type type() { - return this.type; - } - - /** - * Gets the MAC address to match. - * - * @return the MAC address to match - */ - public MacAddress mac() { - return this.mac; - } - - @Override - public String toString() { - return toStringHelper(type().toString()) - .add("mac", mac).toString(); - } - - @Override - public int hashCode() { - return Objects.hash(type.ordinal(), mac); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof EthCriterion) { - EthCriterion that = (EthCriterion) obj; - return Objects.equals(mac, that.mac) && - Objects.equals(type, that.type); - } - return false; - } -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/EthTypeCriterion.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/EthTypeCriterion.java deleted file mode 100644 index b2666d4d..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/EthTypeCriterion.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.flow.criteria; - -import org.onlab.packet.EthType; - -import java.util.Objects; - -import static com.google.common.base.MoreObjects.toStringHelper; - -/** - * Implementation of Ethernet type criterion (16 bits unsigned integer). - */ -public final class EthTypeCriterion implements Criterion { - - - private final EthType ethType; - - /** - * Constructor. - * - * @param ethType the Ethernet frame type to match (16 bits unsigned - * integer) - */ - EthTypeCriterion(int ethType) { - this.ethType = new EthType(ethType); - } - - /** - * Constructor. - * - * @param ethType the Ethernet frame type to match - */ - EthTypeCriterion(EthType ethType) { - this.ethType = ethType; - } - - @Override - public Type type() { - return Type.ETH_TYPE; - } - - /** - * Gets the Ethernet frame type to match. - * - * @return the Ethernet frame type to match (16 bits unsigned integer) - */ - public EthType ethType() { - return ethType; - } - - @Override - public String toString() { - return toStringHelper(type().toString()) - .add("ethType", ethType.toString()) - .toString(); - } - - @Override - public int hashCode() { - return Objects.hash(type().ordinal(), ethType); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof EthTypeCriterion) { - EthTypeCriterion that = (EthTypeCriterion) obj; - return Objects.equals(ethType, that.ethType) && - Objects.equals(this.type(), that.type()); - } - return false; - } -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/ExtensionCriterion.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/ExtensionCriterion.java deleted file mode 100644 index 646b4184..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/ExtensionCriterion.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.onosproject.net.flow.criteria; - -import org.onosproject.net.DeviceId; - -import java.util.Objects; - -import static com.google.common.base.MoreObjects.toStringHelper; - -/** - * Criterion for implementing selector extensions. - */ -public class ExtensionCriterion implements Criterion { - - private final ExtensionSelector extensionSelector; - private final DeviceId deviceId; - - /** - * Constructor. - * - * @param extensionSelector extension selector - */ - public ExtensionCriterion(ExtensionSelector extensionSelector, DeviceId deviceId) { - this.extensionSelector = extensionSelector; - this.deviceId = deviceId; - } - - /** - * Returns the extension selector. - * - * @return extension selector - */ - public ExtensionSelector extensionSelector() { - return extensionSelector; - } - - /** - * Returns the device ID. - * - * @return device ID - */ - public DeviceId deviceId() { - return deviceId; - } - - @Override - public Type type() { - return Type.EXTENSION; - } - - @Override - public String toString() { - return toStringHelper(type().toString()) - .add("extensionSelector", extensionSelector.toString()) - .add("deviceId", deviceId) - .toString(); - } - - @Override - public int hashCode() { - return Objects.hash(type().ordinal(), extensionSelector, deviceId); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof ExtensionCriterion) { - ExtensionCriterion that = (ExtensionCriterion) obj; - return Objects.equals(extensionSelector, that.extensionSelector) && - Objects.equals(deviceId, that.deviceId) && - Objects.equals(this.type(), that.type()); - } - return false; - } -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/ExtensionSelector.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/ExtensionSelector.java deleted file mode 100644 index d3cebb37..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/ExtensionSelector.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.onosproject.net.flow.criteria; - -import org.onosproject.net.flow.Extension; - -/** - * An extension for the selector API. - */ -public interface ExtensionSelector extends Extension { - - /** - * Gets the type of the extension selector. - * - * @return type - */ - ExtensionSelectorType type(); -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/ExtensionSelectorType.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/ExtensionSelectorType.java deleted file mode 100644 index fa8f0923..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/ExtensionSelectorType.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.onosproject.net.flow.criteria; - -import com.google.common.annotations.Beta; -import com.google.common.base.MoreObjects; - -import java.util.Objects; - -/** - * Type of selector extensions. - */ -@Beta -public class ExtensionSelectorType { - - /** - * A list of well-known named extension selector type codes. - * These numbers have no impact on the actual OF type id. - */ - public enum ExtensionSelectorTypes { - NICIRA_MATCH_NSH_SPI(0), - NICIRA_MATCH_NSH_SI(1), - NICIRA_MATCH_NSH_CH1(2), - NICIRA_MATCH_NSH_CH2(3), - NICIRA_MATCH_NSH_CH3(4), - NICIRA_MATCH_NSH_CH4(5); - - - private ExtensionSelectorType type; - - /** - * Creates a new named extension selector type. - * - * @param type type code - */ - ExtensionSelectorTypes(int type) { - this.type = new ExtensionSelectorType(type); - } - - /** - * Gets the extension type object for this named type code. - * - * @return extension type object - */ - public ExtensionSelectorType type() { - return type; - } - } - - private final int type; - - /** - * Creates an extension type with the given int type code. - * - * @param type type code - */ - public ExtensionSelectorType(int type) { - this.type = type; - } - - @Override - public int hashCode() { - return Objects.hash(type); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof ExtensionSelectorType) { - final ExtensionSelectorType that = (ExtensionSelectorType) obj; - return this.type == that.type; - } - return false; - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(ExtensionSelectorType.class) - .add("type", type) - .toString(); - } -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/IPCriterion.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/IPCriterion.java deleted file mode 100644 index 018afe80..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/IPCriterion.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.flow.criteria; - -import org.onlab.packet.IpPrefix; - -import java.util.Objects; - -import static com.google.common.base.MoreObjects.toStringHelper; - -/** - * Implementation of IP address criterion. - */ -public final class IPCriterion implements Criterion { - private final IpPrefix ip; - private final Type type; - - /** - * Constructor. - * - * @param ip the IP prefix to match. Could be either IPv4 or IPv6 - * @param type the match type. Should be one of the following: - * Type.IPV4_SRC, Type.IPV4_DST, Type.IPV6_SRC, Type.IPV6_DST - */ - IPCriterion(IpPrefix ip, Type type) { - this.ip = ip; - this.type = type; - } - - @Override - public Type type() { - return this.type; - } - - /** - * Gets the IP prefix to match. - * - * @return the IP prefix to match - */ - public IpPrefix ip() { - return this.ip; - } - - @Override - public String toString() { - return toStringHelper(type().toString()) - .add("ip", ip).toString(); - } - - @Override - public int hashCode() { - return Objects.hash(type().ordinal(), ip); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof IPCriterion) { - IPCriterion that = (IPCriterion) obj; - return Objects.equals(ip, that.ip) && - Objects.equals(type, that.type); - } - return false; - } -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/IPDscpCriterion.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/IPDscpCriterion.java deleted file mode 100644 index 8634aa66..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/IPDscpCriterion.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.flow.criteria; - -import java.util.Objects; - -import static com.google.common.base.MoreObjects.toStringHelper; - -/** - * Implementation of IP DSCP (Differentiated Services Code Point) - * criterion (6 bits). - */ -public final class IPDscpCriterion implements Criterion { - private static final byte MASK = 0x3f; - private final byte ipDscp; // IP DSCP value: 6 bits - - /** - * Constructor. - * - * @param ipDscp the IP DSCP value to match - */ - IPDscpCriterion(byte ipDscp) { - this.ipDscp = (byte) (ipDscp & MASK); - } - - @Override - public Type type() { - return Type.IP_DSCP; - } - - /** - * Gets the IP DSCP value to match. - * - * @return the IP DSCP value to match - */ - public byte ipDscp() { - return ipDscp; - } - - @Override - public String toString() { - return toStringHelper(type().toString()) - .add("ipDscp", Long.toHexString(ipDscp)).toString(); - } - - @Override - public int hashCode() { - return Objects.hash(type().ordinal(), ipDscp); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof IPDscpCriterion) { - IPDscpCriterion that = (IPDscpCriterion) obj; - return Objects.equals(ipDscp, that.ipDscp) && - Objects.equals(this.type(), that.type()); - } - return false; - } -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/IPEcnCriterion.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/IPEcnCriterion.java deleted file mode 100644 index 48b3fbf6..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/IPEcnCriterion.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.flow.criteria; - -import java.util.Objects; - -import static com.google.common.base.MoreObjects.toStringHelper; - -/** - * Implementation of IP ECN (Explicit Congestion Notification) criterion - * (2 bits). - */ -public final class IPEcnCriterion implements Criterion { - private static final byte MASK = 0x3; - private final byte ipEcn; // IP ECN value: 2 bits - - /** - * Constructor. - * - * @param ipEcn the IP ECN value to match (2 bits) - */ - IPEcnCriterion(byte ipEcn) { - this.ipEcn = (byte) (ipEcn & MASK); - } - - @Override - public Type type() { - return Type.IP_ECN; - } - - /** - * Gets the IP ECN value to match. - * - * @return the IP ECN value to match (2 bits) - */ - public byte ipEcn() { - return ipEcn; - } - - @Override - public String toString() { - return toStringHelper(type().toString()) - .add("ipEcn", Long.toHexString(ipEcn)).toString(); - } - - @Override - public int hashCode() { - return Objects.hash(type().ordinal(), ipEcn); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof IPEcnCriterion) { - IPEcnCriterion that = (IPEcnCriterion) obj; - return Objects.equals(ipEcn, that.ipEcn) && - Objects.equals(this.type(), that.type()); - } - return false; - } -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/IPProtocolCriterion.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/IPProtocolCriterion.java deleted file mode 100644 index 6879f802..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/IPProtocolCriterion.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.flow.criteria; - -import java.util.Objects; - -import static com.google.common.base.MoreObjects.toStringHelper; - -/** - * Implementation of Internet Protocol Number criterion (8 bits unsigned) - * integer. - */ -public final class IPProtocolCriterion implements Criterion { - private static final short MASK = 0xff; - private final short proto; // IP protocol number: 8 bits - - /** - * Constructor. - * - * @param protocol the IP protocol (e.g., TCP=6, UDP=17) to match - * (8 bits unsigned integer) - */ - IPProtocolCriterion(short protocol) { - this.proto = (short) (protocol & MASK); - } - - @Override - public Type type() { - return Type.IP_PROTO; - } - - /** - * Gets the IP protocol to match. - * - * @return the IP protocol to match (8 bits unsigned integer) - */ - public short protocol() { - return proto; - } - - @Override - public String toString() { - return toStringHelper(type().toString()) - .add("protocol", proto).toString(); - } - - @Override - public int hashCode() { - return Objects.hash(type().ordinal(), proto); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof IPProtocolCriterion) { - IPProtocolCriterion that = (IPProtocolCriterion) obj; - return Objects.equals(proto, that.proto); - } - return false; - } -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/IPv6ExthdrFlagsCriterion.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/IPv6ExthdrFlagsCriterion.java deleted file mode 100644 index 2463bf64..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/IPv6ExthdrFlagsCriterion.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.flow.criteria; - -import java.util.Objects; - -import static com.google.common.base.MoreObjects.toStringHelper; - -/** - * Implementation of IPv6 Extension Header pseudo-field criterion - * (16 bits). Those are defined in Criterion.IPv6ExthdrFlags. - */ -public final class IPv6ExthdrFlagsCriterion implements Criterion { - private static final int MASK = 0xffff; - private final int exthdrFlags; // IPv6 Exthdr flags: 16 bits - - /** - * Constructor. - * - * @param exthdrFlags the IPv6 Extension Header pseudo-field flags - * to match (16 bits). Those are defined in Criterion.IPv6ExthdrFlags - */ - IPv6ExthdrFlagsCriterion(int exthdrFlags) { - this.exthdrFlags = exthdrFlags & MASK; - } - - @Override - public Type type() { - return Type.IPV6_EXTHDR; - } - - /** - * Gets the IPv6 Extension Header pseudo-field flags to match. - * - * @return the IPv6 Extension Header pseudo-field flags to match - * (16 bits). Those are defined in Criterion.IPv6ExthdrFlags - */ - public int exthdrFlags() { - return exthdrFlags; - } - - @Override - public String toString() { - return toStringHelper(type().toString()) - .add("exthdrFlags", Long.toHexString(exthdrFlags)).toString(); - } - - @Override - public int hashCode() { - return Objects.hash(type().ordinal(), exthdrFlags); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof IPv6ExthdrFlagsCriterion) { - IPv6ExthdrFlagsCriterion that = (IPv6ExthdrFlagsCriterion) obj; - return Objects.equals(exthdrFlags, that.exthdrFlags) && - Objects.equals(this.type(), that.type()); - } - return false; - } -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/IPv6FlowLabelCriterion.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/IPv6FlowLabelCriterion.java deleted file mode 100644 index 6e1021d9..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/IPv6FlowLabelCriterion.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.flow.criteria; - -import java.util.Objects; - -import static com.google.common.base.MoreObjects.toStringHelper; - -/** - * Implementation of IPv6 Flow Label (RFC 6437) criterion (20 bits unsigned - * integer). - */ -public final class IPv6FlowLabelCriterion implements Criterion { - private static final int MASK = 0xfffff; - private final int flowLabel; // IPv6 flow label: 20 bits - - /** - * Constructor. - * - * @param flowLabel the IPv6 flow label to match (20 bits) - */ - IPv6FlowLabelCriterion(int flowLabel) { - this.flowLabel = flowLabel & MASK; - } - - @Override - public Type type() { - return Type.IPV6_FLABEL; - } - - /** - * Gets the IPv6 flow label to match. - * - * @return the IPv6 flow label to match (20 bits) - */ - public int flowLabel() { - return flowLabel; - } - - @Override - public String toString() { - return toStringHelper(type().toString()) - .add("flowLabel", Long.toHexString(flowLabel)).toString(); - } - - @Override - public int hashCode() { - return Objects.hash(type().ordinal(), flowLabel); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof IPv6FlowLabelCriterion) { - IPv6FlowLabelCriterion that = (IPv6FlowLabelCriterion) obj; - return Objects.equals(flowLabel, that.flowLabel) && - Objects.equals(this.type(), that.type()); - } - return false; - } -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/IPv6NDLinkLayerAddressCriterion.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/IPv6NDLinkLayerAddressCriterion.java deleted file mode 100644 index 9f310d4a..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/IPv6NDLinkLayerAddressCriterion.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.flow.criteria; - -import org.onlab.packet.MacAddress; - -import java.util.Objects; - -import static com.google.common.base.MoreObjects.toStringHelper; - -/** - * Implementation of IPv6 Neighbor Discovery link-layer address criterion. - */ -public final class IPv6NDLinkLayerAddressCriterion implements Criterion { - private final MacAddress mac; - private final Type type; - - /** - * Constructor. - * - * @param mac the source or destination link-layer address to match - * @param type the match type. Should be either Type.IPV6_ND_SLL or - * Type.IPV6_ND_TLL - */ - IPv6NDLinkLayerAddressCriterion(MacAddress mac, Type type) { - this.mac = mac; - this.type = type; - } - - @Override - public Type type() { - return this.type; - } - - /** - * Gets the MAC link-layer address to match. - * - * @return the MAC link-layer address to match - */ - public MacAddress mac() { - return this.mac; - } - - @Override - public String toString() { - return toStringHelper(type().toString()) - .add("mac", mac).toString(); - } - - @Override - public int hashCode() { - return Objects.hash(type().ordinal(), mac); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof IPv6NDLinkLayerAddressCriterion) { - IPv6NDLinkLayerAddressCriterion that = - (IPv6NDLinkLayerAddressCriterion) obj; - return Objects.equals(mac, that.mac) && - Objects.equals(type, that.type); - } - return false; - } -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/IPv6NDTargetAddressCriterion.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/IPv6NDTargetAddressCriterion.java deleted file mode 100644 index ffef044a..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/IPv6NDTargetAddressCriterion.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.flow.criteria; - -import org.onlab.packet.Ip6Address; - -import java.util.Objects; - -import static com.google.common.base.MoreObjects.toStringHelper; - -/** - * Implementation of IPv6 Neighbor Discovery target address criterion. - */ -public final class IPv6NDTargetAddressCriterion implements Criterion { - private final Ip6Address targetAddress; - - /** - * Constructor. - * - * @param targetAddress the IPv6 target address to match - */ - IPv6NDTargetAddressCriterion(Ip6Address targetAddress) { - this.targetAddress = targetAddress; - } - - @Override - public Type type() { - return Type.IPV6_ND_TARGET; - } - - /** - * Gets the IPv6 target address to match. - * - * @return the IPv6 target address to match - */ - public Ip6Address targetAddress() { - return this.targetAddress; - } - - @Override - public String toString() { - return toStringHelper(type().toString()) - .add("targetAddress", targetAddress).toString(); - } - - @Override - public int hashCode() { - return Objects.hash(type().ordinal(), targetAddress); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof IPv6NDTargetAddressCriterion) { - IPv6NDTargetAddressCriterion that = - (IPv6NDTargetAddressCriterion) obj; - return Objects.equals(targetAddress, that.targetAddress) && - Objects.equals(type(), that.type()); - } - return false; - } -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/IcmpCodeCriterion.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/IcmpCodeCriterion.java deleted file mode 100644 index 516f61b3..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/IcmpCodeCriterion.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.flow.criteria; - -import java.util.Objects; - -import static com.google.common.base.MoreObjects.toStringHelper; - -/** - * Implementation of ICMP code criterion (8 bits unsigned integer). - */ -public final class IcmpCodeCriterion implements Criterion { - private static final short MASK = 0xff; - private final short icmpCode; // The ICMP code: 8 bits - - /** - * Constructor. - * - * @param icmpCode the ICMP code to match (8 bits unsigned integer) - */ - IcmpCodeCriterion(short icmpCode) { - this.icmpCode = (short) (icmpCode & MASK); - } - - @Override - public Type type() { - return Type.ICMPV4_CODE; - } - - /** - * Gets the ICMP code to match. - * - * @return the ICMP code to match (8 bits unsigned integer) - */ - public short icmpCode() { - return icmpCode; - } - - @Override - public String toString() { - return toStringHelper(type().toString()) - .add("icmpCode", icmpCode).toString(); - } - - @Override - public int hashCode() { - return Objects.hash(type().ordinal(), icmpCode); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof IcmpCodeCriterion) { - IcmpCodeCriterion that = (IcmpCodeCriterion) obj; - return Objects.equals(icmpCode, that.icmpCode) && - Objects.equals(this.type(), that.type()); - } - return false; - } -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/IcmpTypeCriterion.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/IcmpTypeCriterion.java deleted file mode 100644 index 63251425..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/IcmpTypeCriterion.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.flow.criteria; - -import java.util.Objects; - -import static com.google.common.base.MoreObjects.toStringHelper; - -/** - * Implementation of ICMP type criterion (8 bits unsigned integer). - */ -public final class IcmpTypeCriterion implements Criterion { - private static final short MASK = 0xff; - private final short icmpType; // The ICMP type: 8 bits - - /** - * Constructor. - * - * @param icmpType the ICMP type to match (8 bits unsigned integer) - */ - IcmpTypeCriterion(short icmpType) { - this.icmpType = (short) (icmpType & MASK); - } - - @Override - public Type type() { - return Type.ICMPV4_TYPE; - } - - /** - * Gets the ICMP type to match. - * - * @return the ICMP type to match (8 bits unsigned integer) - */ - public short icmpType() { - return icmpType; - } - - @Override - public String toString() { - return toStringHelper(type().toString()) - .add("icmpType", icmpType).toString(); - } - - @Override - public int hashCode() { - return Objects.hash(type().ordinal(), icmpType); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof IcmpTypeCriterion) { - IcmpTypeCriterion that = (IcmpTypeCriterion) obj; - return Objects.equals(icmpType, that.icmpType) && - Objects.equals(this.type(), that.type()); - } - return false; - } -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/Icmpv6CodeCriterion.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/Icmpv6CodeCriterion.java deleted file mode 100644 index a41b6fef..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/Icmpv6CodeCriterion.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.flow.criteria; - -import java.util.Objects; - -import static com.google.common.base.MoreObjects.toStringHelper; - -/** - * Implementation of ICMPv6 code criterion (8 bits unsigned integer). - */ -public final class Icmpv6CodeCriterion implements Criterion { - private static final short MASK = 0xff; - private final short icmpv6Code; // ICMPv6 code: 8 bits - - /** - * Constructor. - * - * @param icmpv6Code the ICMPv6 code to match (8 bits unsigned integer) - */ - Icmpv6CodeCriterion(short icmpv6Code) { - this.icmpv6Code = (short) (icmpv6Code & MASK); - } - - @Override - public Type type() { - return Type.ICMPV6_CODE; - } - - /** - * Gets the ICMPv6 code to match. - * - * @return the ICMPv6 code to match (8 bits unsigned integer) - */ - public short icmpv6Code() { - return icmpv6Code; - } - - @Override - public String toString() { - return toStringHelper(type().toString()) - .add("icmpv6Code", icmpv6Code).toString(); - } - - @Override - public int hashCode() { - return Objects.hash(type().ordinal(), icmpv6Code); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof Icmpv6CodeCriterion) { - Icmpv6CodeCriterion that = (Icmpv6CodeCriterion) obj; - return Objects.equals(icmpv6Code, that.icmpv6Code) && - Objects.equals(this.type(), that.type()); - } - return false; - } -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/Icmpv6TypeCriterion.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/Icmpv6TypeCriterion.java deleted file mode 100644 index 7410ba17..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/Icmpv6TypeCriterion.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.flow.criteria; - -import java.util.Objects; - -import static com.google.common.base.MoreObjects.toStringHelper; - -/** - * Implementation of ICMPv6 type criterion (8 bits unsigned integer). - */ -public final class Icmpv6TypeCriterion implements Criterion { - private static final short MASK = 0xff; - private final short icmpv6Type; // ICMPv6 type: 8 bits - - /** - * Constructor. - * - * @param icmpv6Type the ICMPv6 type to match (8 bits unsigned integer) - */ - Icmpv6TypeCriterion(short icmpv6Type) { - this.icmpv6Type = (short) (icmpv6Type & MASK); - } - - @Override - public Type type() { - return Type.ICMPV6_TYPE; - } - - /** - * Gets the ICMPv6 type to match. - * - * @return the ICMPv6 type to match (8 bits unsigned integer) - */ - public short icmpv6Type() { - return icmpv6Type; - } - - @Override - public String toString() { - return toStringHelper(type().toString()) - .add("icmpv6Type", icmpv6Type).toString(); - } - - @Override - public int hashCode() { - return Objects.hash(type().ordinal(), icmpv6Type); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof Icmpv6TypeCriterion) { - Icmpv6TypeCriterion that = (Icmpv6TypeCriterion) obj; - return Objects.equals(icmpv6Type, that.icmpv6Type) && - Objects.equals(this.type(), that.type()); - } - return false; - } -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/IndexedLambdaCriterion.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/IndexedLambdaCriterion.java deleted file mode 100644 index 88a6fe10..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/IndexedLambdaCriterion.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.flow.criteria; - -import com.google.common.base.MoreObjects; -import org.onosproject.net.IndexedLambda; - -import java.util.Objects; - -import static com.google.common.base.Preconditions.checkNotNull; - -/** - * Implementation of indexed lambda criterion. - */ -public class IndexedLambdaCriterion implements Criterion { - - private final IndexedLambda lambda; - - /** - * Creates a criterion with the specified value. - * - * @param lambda lambda index number - */ - IndexedLambdaCriterion(IndexedLambda lambda) { - this.lambda = checkNotNull(lambda); - } - - @Override - public Type type() { - // TODO: consider defining a new specific type - // Now OCH_SIGID is used due to compatibility concerns - return Type.OCH_SIGID; - } - - /** - * Returns the indexed lambda to match. - * - * @return the indexed lambda to match - */ - public IndexedLambda lambda() { - return lambda; - } - - @Override - public int hashCode() { - return Objects.hash(type().ordinal(), lambda); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (!(obj instanceof IndexedLambdaCriterion)) { - return false; - } - final IndexedLambdaCriterion that = (IndexedLambdaCriterion) obj; - return Objects.equals(this.lambda, that.lambda); - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this) - .add("lambda", lambda) - .toString(); - } -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/LambdaCriterion.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/LambdaCriterion.java deleted file mode 100644 index 656800b1..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/LambdaCriterion.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.flow.criteria; - -import java.util.Objects; - -import static com.google.common.base.MoreObjects.toStringHelper; - -/** - * Implementation of lambda (wavelength) criterion (16 bits unsigned - * integer). - */ -public final class LambdaCriterion implements Criterion { - private static final int MASK = 0xffff; - private final int lambda; // Lambda value: 16 bits - private final Type type; - - /** - * Constructor. - * - * @param lambda the lambda (wavelength) to match (16 bits unsigned - * integer) - * @param type the match type. Should be Type.OCH_SIGID - */ - LambdaCriterion(int lambda, Type type) { - this.lambda = lambda & MASK; - this.type = type; - } - - @Override - public Type type() { - return this.type; - } - - /** - * Gets the lambda (wavelength) to match. - * - * @return the lambda (wavelength) to match (16 bits unsigned integer) - */ - public int lambda() { - return lambda; - } - - @Override - public String toString() { - return toStringHelper(type().toString()) - .add("lambda", lambda).toString(); - } - - @Override - public int hashCode() { - return Objects.hash(type().ordinal(), lambda); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof LambdaCriterion) { - LambdaCriterion that = (LambdaCriterion) obj; - return Objects.equals(lambda, that.lambda) && - Objects.equals(type, that.type); - } - return false; - } -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/MetadataCriterion.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/MetadataCriterion.java deleted file mode 100644 index 8177b483..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/MetadataCriterion.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.flow.criteria; - -import java.util.Objects; - -import static com.google.common.base.MoreObjects.toStringHelper; - -/** - * Implementation of Metadata criterion. - */ -public final class MetadataCriterion implements Criterion { - private final long metadata; - - /** - * Constructor. - * - * @param metadata the metadata to match (64 bits data) - */ - MetadataCriterion(long metadata) { - this.metadata = metadata; - } - - @Override - public Type type() { - return Type.METADATA; - } - - /** - * Gets the metadata to match. - * - * @return the metadata to match (64 bits data) - */ - public long metadata() { - return metadata; - } - - @Override - public String toString() { - return toStringHelper(type().toString()) - .add("metadata", Long.toHexString(metadata)) - .toString(); - } - - @Override - public int hashCode() { - return Objects.hash(type().ordinal(), metadata); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof MetadataCriterion) { - MetadataCriterion that = (MetadataCriterion) obj; - return Objects.equals(metadata, that.metadata) && - Objects.equals(this.type(), that.type()); - } - return false; - } -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/MplsBosCriterion.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/MplsBosCriterion.java deleted file mode 100644 index c8b6690d..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/MplsBosCriterion.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.flow.criteria; - -import static com.google.common.base.MoreObjects.toStringHelper; -import java.util.Objects; - -/** - * Implementation of MPLS BOS criterion (1 bit). - */ -public class MplsBosCriterion implements Criterion { - private boolean mplsBos; - - MplsBosCriterion(boolean mplsBos) { - this.mplsBos = mplsBos; - } - - @Override - public Type type() { - return Type.MPLS_BOS; - } - - public boolean mplsBos() { - return mplsBos; - } - - @Override - public String toString() { - return toStringHelper(type().toString()) - .add("bos", mplsBos).toString(); - } - - @Override - public int hashCode() { - return Objects.hash(type().ordinal(), mplsBos); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof MplsBosCriterion) { - MplsBosCriterion that = (MplsBosCriterion) obj; - return Objects.equals(mplsBos, that.mplsBos()) && - Objects.equals(this.type(), that.type()); - } - return false; - } -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/MplsCriterion.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/MplsCriterion.java deleted file mode 100644 index 34d384f1..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/MplsCriterion.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.flow.criteria; - -import org.onlab.packet.MplsLabel; - -import java.util.Objects; - -import static com.google.common.base.MoreObjects.toStringHelper; - -/** - * Implementation of MPLS tag criterion (20 bits). - */ -public final class MplsCriterion implements Criterion { - private static final int MASK = 0xfffff; - private final MplsLabel mplsLabel; - - MplsCriterion(MplsLabel mplsLabel) { - this.mplsLabel = mplsLabel; - } - - @Override - public Type type() { - return Type.MPLS_LABEL; - } - - public MplsLabel label() { - return mplsLabel; - } - - @Override - public String toString() { - return toStringHelper(type().toString()) - .add("mpls", mplsLabel).toString(); - } - - @Override - public int hashCode() { - return Objects.hash(type().ordinal(), mplsLabel); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof MplsCriterion) { - MplsCriterion that = (MplsCriterion) obj; - return Objects.equals(mplsLabel, that.mplsLabel) && - Objects.equals(this.type(), that.type()); - } - return false; - } -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/MplsTcCriterion.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/MplsTcCriterion.java deleted file mode 100644 index 8ad62358..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/MplsTcCriterion.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.flow.criteria; - -import java.util.Objects; - -import static com.google.common.base.MoreObjects.toStringHelper; - -/** - * Implementation of MPLS TC criterion (3 bits). - */ -public final class MplsTcCriterion implements Criterion { - private static final byte MASK = 0x7; - private final byte mplsTc; - - /** - * Constructor. - * - * @param mplsTc the MPLS TC to match (3 bits) - */ - MplsTcCriterion(byte mplsTc) { - this.mplsTc = (byte) (mplsTc & MASK); - } - - @Override - public Type type() { - return Type.MPLS_TC; - } - - /** - * Gets the MPLS TC to match. - * - * @return the MPLS TC to match (3 bits) - */ - public byte tc() { - return mplsTc; - } - - @Override - public String toString() { - return toStringHelper(type().toString()) - .add("tc", Long.toHexString(mplsTc)).toString(); - } - - @Override - public int hashCode() { - return Objects.hash(type().ordinal(), mplsTc); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof MplsTcCriterion) { - MplsTcCriterion that = (MplsTcCriterion) obj; - return Objects.equals(mplsTc, that.mplsTc) && - Objects.equals(this.type(), that.type()); - } - return false; - } -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/OchSignalCriterion.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/OchSignalCriterion.java deleted file mode 100644 index 3a51a6bd..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/OchSignalCriterion.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.flow.criteria; - -import com.google.common.base.MoreObjects; -import org.onosproject.net.OchSignal; - -import java.util.Objects; - -import static com.google.common.base.Preconditions.checkNotNull; - -/** - * Implementation of OCh (Optical Channel) signal criterion. - * This criterion is based on the specification of "OFPXMT_EXP_OCH_SIGID" in - * Open Networking Foundation "Optical Transport Protocol Extension Version 1.0", but - * defined in protocol agnostic way. - */ -public final class OchSignalCriterion implements Criterion { - - private final OchSignal lambda; - - /** - * Create an instance with the specified OCh signal. - * - * @param lambda OCh signal - */ - OchSignalCriterion(OchSignal lambda) { - this.lambda = checkNotNull(lambda); - } - - @Override - public Type type() { - return Type.OCH_SIGID; - } - - /** - * Returns the OCh signal to match. - * - * @return the OCh signal to match - */ - public OchSignal lambda() { - return lambda; - } - - @Override - public int hashCode() { - return Objects.hash(type().ordinal(), lambda); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (!(obj instanceof OchSignalCriterion)) { - return false; - } - final OchSignalCriterion that = (OchSignalCriterion) obj; - return Objects.equals(this.lambda, that.lambda); - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this) - .add("lambda", lambda) - .toString(); - } -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/OchSignalTypeCriterion.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/OchSignalTypeCriterion.java deleted file mode 100644 index cf838bf3..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/OchSignalTypeCriterion.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.flow.criteria; - -import com.google.common.base.MoreObjects; -import org.onosproject.net.OchSignalType; - -import java.util.Objects; - -import static com.google.common.base.Preconditions.checkNotNull; - -/** - * Implementation of OCh (Optical Channel) signal type criterion. - */ -public class OchSignalTypeCriterion implements Criterion { - - private final OchSignalType signalType; - - /** - * Creates a criterion with the specified value. - * - * @param signalType OCh signal type - */ - OchSignalTypeCriterion(OchSignalType signalType) { - this.signalType = checkNotNull(signalType); - } - - @Override - public Type type() { - return Type.OCH_SIGTYPE; - } - - /** - * Returns the OCh signal type to match. - * - * @return the OCh signal type to match - */ - public OchSignalType signalType() { - return signalType; - } - - @Override - public int hashCode() { - return Objects.hash(type().ordinal(), signalType); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (!(obj instanceof OchSignalTypeCriterion)) { - return false; - } - final OchSignalTypeCriterion that = (OchSignalTypeCriterion) obj; - return Objects.equals(this.signalType, that.signalType); - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this) - .add("signalType", signalType) - .toString(); - } -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/OduSignalIdCriterion.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/OduSignalIdCriterion.java deleted file mode 100644 index 21018544..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/OduSignalIdCriterion.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.flow.criteria; - -import static com.google.common.base.MoreObjects.toStringHelper; -import static com.google.common.base.Preconditions.checkNotNull; - -import java.util.Objects; - -import org.onosproject.net.OduSignalId; - -/** - * Implementation of ODU (Optical channel Data Unit) signal ID signal criterion. - * This criterion is based on the specification of "OFPXMT_EXP_ODU_SIGID" in - * Open Networking Foundation "Optical Transport Protocol Extension Version 1.0", but - * defined in protocol agnostic way. - */ -public final class OduSignalIdCriterion implements Criterion { - - private final OduSignalId oduSignalId; - - /** - * Create an instance with the specified ODU signal ID. - * - * @param oduSignalId - ODU signal ID - */ - OduSignalIdCriterion(OduSignalId oduSignalId) { - this.oduSignalId = checkNotNull(oduSignalId); - } - - @Override - public Type type() { - return Type.ODU_SIGID; - } - - /** - * Returns the ODU Signal to match. - * - * @return the ODU signal to match - */ - public OduSignalId oduSignalId() { - return oduSignalId; - } - - @Override - public int hashCode() { - return Objects.hash(type(), oduSignalId); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (!(obj instanceof OduSignalIdCriterion)) { - return false; - } - final OduSignalIdCriterion that = (OduSignalIdCriterion) obj; - return Objects.equals(this.oduSignalId, that.oduSignalId); - } - - @Override - public String toString() { - return toStringHelper(this) - .add("oduSignalId", oduSignalId) - .toString(); - } - -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/OduSignalTypeCriterion.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/OduSignalTypeCriterion.java deleted file mode 100644 index f4854339..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/OduSignalTypeCriterion.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.flow.criteria; - -import static com.google.common.base.MoreObjects.toStringHelper; -import static com.google.common.base.Preconditions.checkNotNull; - -import java.util.Objects; - -import org.onosproject.net.OduSignalType; - -/** - * Implementation of ODU (Optical channel Data Unit) signal Type criterion. - * This criterion is based on the specification of "OFPXMT_EXP_ODU_SIGTYPE" in - * Open Networking Foundation "Optical Transport Protocol Extension Version 1.0", but - * defined in protocol agnostic way. - */ -public final class OduSignalTypeCriterion implements Criterion { - - private final OduSignalType signalType; - - /** - * Create an instance with the specified ODU signal Type. - * - * @param signalType - ODU signal Type - */ - OduSignalTypeCriterion(OduSignalType signalType) { - this.signalType = checkNotNull(signalType); - } - - @Override - public Type type() { - return Type.ODU_SIGTYPE; - } - - /** - * Returns the ODU Signal Type to match. - * - * @return the ODU signal Type to match - */ - public OduSignalType signalType() { - return signalType; - } - - @Override - public int hashCode() { - return Objects.hash(type(), signalType); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (!(obj instanceof OduSignalTypeCriterion)) { - return false; - } - final OduSignalTypeCriterion that = (OduSignalTypeCriterion) obj; - return Objects.equals(this.signalType, that.signalType); - } - - @Override - public String toString() { - return toStringHelper(this) - .add("signalType", signalType) - .toString(); - } -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/PbbIsidCriterion.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/PbbIsidCriterion.java deleted file mode 100644 index 979aa6bd..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/PbbIsidCriterion.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.flow.criteria; - -import java.util.Objects; - -import static com.google.common.base.MoreObjects.toStringHelper; - -/** - * Implementation of PBB I-SID criterion (24 bits unsigned integer). - */ -public final class PbbIsidCriterion implements Criterion { - private static final int MASK = 0xfffff; - private final int pbbIsid; // PBB I-SID: 24 bits - - /** - * Constructor. - * - * @param pbbIsid the PBB I-SID to match (24 bits) - */ - PbbIsidCriterion(int pbbIsid) { - this.pbbIsid = pbbIsid & MASK; - } - - @Override - public Criterion.Type type() { - return Criterion.Type.PBB_ISID; - } - - /** - * Gets the PBB I-SID to match. - * - * @return the PBB I-SID to match (24 bits) - */ - public int pbbIsid() { - return this.pbbIsid; - } - - @Override - public String toString() { - return toStringHelper(type().toString()) - .add("pbbIsid", Long.toHexString(pbbIsid)).toString(); - } - - @Override - public int hashCode() { - return Objects.hash(type().ordinal(), pbbIsid); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof PbbIsidCriterion) { - PbbIsidCriterion that = (PbbIsidCriterion) obj; - return Objects.equals(pbbIsid, that.pbbIsid) && - Objects.equals(this.type(), that.type()); - } - return false; - } -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/PortCriterion.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/PortCriterion.java deleted file mode 100644 index f07cd500..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/PortCriterion.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.flow.criteria; - -import org.onosproject.net.PortNumber; - -import java.util.Objects; - -import static com.google.common.base.MoreObjects.toStringHelper; - -/** - * Implementation of input port criterion. - */ -public final class PortCriterion implements Criterion { - private final PortNumber port; - private final Type type; - - /** - * Constructor. - * - * @param port the input port number to match - * @param type the match type. Should be either Type.IN_PORT or - * Type.IN_PHY_PORT - */ - PortCriterion(PortNumber port, Type type) { - this.port = port; - this.type = type; - } - - @Override - public Type type() { - return this.type; - } - - /** - * Gets the input port number to match. - * - * @return the input port number to match - */ - public PortNumber port() { - return this.port; - } - - @Override - public String toString() { - return toStringHelper(type().toString()) - .add("port", port).toString(); - } - - @Override - public int hashCode() { - return Objects.hash(type().ordinal(), port); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof PortCriterion) { - PortCriterion that = (PortCriterion) obj; - return Objects.equals(port, that.port) && - Objects.equals(this.type(), that.type()); - } - return false; - } -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/SctpPortCriterion.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/SctpPortCriterion.java deleted file mode 100644 index 2d4cf15a..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/SctpPortCriterion.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.flow.criteria; - -import org.onlab.packet.TpPort; - -import java.util.Objects; - -import static com.google.common.base.MoreObjects.toStringHelper; - -/** - * Implementation of SCTP port criterion (16 bits unsigned integer). - */ -public final class SctpPortCriterion implements Criterion { - private final TpPort sctpPort; - private final Type type; - - /** - * Constructor. - * - * @param sctpPort the SCTP port to match - * @param type the match type. Should be either Type.SCTP_SRC or - * Type.SCTP_DST - */ - SctpPortCriterion(TpPort sctpPort, Type type) { - this.sctpPort = sctpPort; - this.type = type; - } - - @Override - public Type type() { - return this.type; - } - - /** - * Gets the SCTP port to match. - * - * @return the SCTP port to match - */ - public TpPort sctpPort() { - return this.sctpPort; - } - - @Override - public String toString() { - return toStringHelper(type().toString()) - .add("sctpPort", sctpPort).toString(); - } - - @Override - public int hashCode() { - return Objects.hash(type().ordinal(), sctpPort); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof SctpPortCriterion) { - SctpPortCriterion that = (SctpPortCriterion) obj; - return Objects.equals(sctpPort, that.sctpPort) && - Objects.equals(type, that.type); - } - return false; - } -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/TcpFlagsCriterion.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/TcpFlagsCriterion.java deleted file mode 100644 index e0b53958..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/TcpFlagsCriterion.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.flow.criteria; - -import java.util.Objects; - -import static com.google.common.base.MoreObjects.toStringHelper; - -/** - * Implementation of TCP flags criterion (12 bits unsigned integer). - */ -public final class TcpFlagsCriterion implements Criterion { - private static final int MASK = 0xfffff; - private final int flags; // TCP flags: 12 bits - - /** - * Constructor. - * - * @param flags the TCP flags to match (12 bits) - */ - TcpFlagsCriterion(int flags) { - this.flags = flags & MASK; - } - - @Override - public Type type() { - return Type.TCP_FLAGS; - } - - /** - * Gets the TCP flags to match. - * - * @return the TCP flags to match (12 bits) - */ - public int flags() { - return flags; - } - - @Override - public String toString() { - return toStringHelper(type().toString()) - .add("flags", Long.toHexString(flags)).toString(); - } - - @Override - public int hashCode() { - return Objects.hash(type().ordinal(), flags); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof TcpFlagsCriterion) { - TcpFlagsCriterion that = (TcpFlagsCriterion) obj; - return Objects.equals(flags, that.flags) && - Objects.equals(this.type(), that.type()); - } - return false; - } -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/TcpPortCriterion.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/TcpPortCriterion.java deleted file mode 100644 index e682b238..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/TcpPortCriterion.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.flow.criteria; - -import org.onlab.packet.TpPort; - -import java.util.Objects; - -import static com.google.common.base.MoreObjects.toStringHelper; - -/** - * Implementation of TCP port criterion (16 bits unsigned integer). - */ -public final class TcpPortCriterion implements Criterion { - private final TpPort tcpPort; - private final Type type; - - /** - * Constructor. - * - * @param tcpPort the TCP port to match - * @param type the match type. Should be either Type.TCP_SRC or - * Type.TCP_DST - */ - TcpPortCriterion(TpPort tcpPort, Type type) { - this.tcpPort = tcpPort; - this.type = type; - } - - @Override - public Type type() { - return this.type; - } - - /** - * Gets the TCP port to match. - * - * @return the TCP port to match - */ - public TpPort tcpPort() { - return this.tcpPort; - } - - @Override - public String toString() { - return toStringHelper(type().toString()) - .add("tcpPort", tcpPort).toString(); - } - - @Override - public int hashCode() { - return Objects.hash(type().ordinal(), tcpPort); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof TcpPortCriterion) { - TcpPortCriterion that = (TcpPortCriterion) obj; - return Objects.equals(tcpPort, that.tcpPort) && - Objects.equals(type, that.type); - } - return false; - } -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/TunnelIdCriterion.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/TunnelIdCriterion.java deleted file mode 100644 index 3362c73f..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/TunnelIdCriterion.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.flow.criteria; - -import java.util.Objects; - -import static com.google.common.base.MoreObjects.toStringHelper; -/** - * Implementation of Tunnel ID criterion. - */ -public class TunnelIdCriterion implements Criterion { - private final long tunnelId; - - /** - * Constructor. - * - * @param tunnelId a Tunnel ID to match(64 bits) - */ - TunnelIdCriterion(long tunnelId) { - this.tunnelId = tunnelId; - } - - @Override - public Type type() { - return Type.TUNNEL_ID; - } - - /** - * Gets the Tunnel ID to match. - * - * @return the Tunnel ID to match (64 bits) - */ - public long tunnelId() { - return tunnelId; - } - - @Override - public String toString() { - return toStringHelper(type().toString()) - .add("tunnelId", Long.toHexString(tunnelId)) - .toString(); - } - - @Override - public int hashCode() { - return Objects.hash(type().ordinal(), tunnelId); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof TunnelIdCriterion) { - TunnelIdCriterion that = (TunnelIdCriterion) obj; - return Objects.equals(tunnelId, that.tunnelId) && - Objects.equals(this.type(), that.type()); - } - return false; - } -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/UdpPortCriterion.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/UdpPortCriterion.java deleted file mode 100644 index 8a29f471..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/UdpPortCriterion.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.flow.criteria; - -import org.onlab.packet.TpPort; - -import java.util.Objects; - -import static com.google.common.base.MoreObjects.toStringHelper; - -/** - * Implementation of UDP port criterion (16 bits unsigned integer). - */ -public final class UdpPortCriterion implements Criterion { - private final TpPort udpPort; - private final Type type; - - /** - * Constructor. - * - * @param udpPort the UDP port to match - * @param type the match type. Should be either Type.UDP_SRC or - * Type.UDP_DST - */ - UdpPortCriterion(TpPort udpPort, Type type) { - this.udpPort = udpPort; - this.type = type; - } - - @Override - public Type type() { - return this.type; - } - - /** - * Gets the UDP port to match. - * - * @return the UDP port to match - */ - public TpPort udpPort() { - return this.udpPort; - } - - @Override - public String toString() { - return toStringHelper(type().toString()) - .add("udpPort", udpPort).toString(); - } - - @Override - public int hashCode() { - return Objects.hash(type().ordinal(), udpPort); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof UdpPortCriterion) { - UdpPortCriterion that = (UdpPortCriterion) obj; - return Objects.equals(udpPort, that.udpPort) && - Objects.equals(type, that.type); - } - return false; - } -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/VlanIdCriterion.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/VlanIdCriterion.java deleted file mode 100644 index c73edb12..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/VlanIdCriterion.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.flow.criteria; - -import org.onlab.packet.VlanId; - -import java.util.Objects; - -import static com.google.common.base.MoreObjects.toStringHelper; - -/** - * Implementation of VLAN ID criterion. - */ -public final class VlanIdCriterion implements Criterion { - private final VlanId vlanId; - - /** - * Constructor. - * - * @param vlanId the VLAN ID to match - */ - VlanIdCriterion(VlanId vlanId) { - this.vlanId = vlanId; - } - - @Override - public Type type() { - return Type.VLAN_VID; - } - - /** - * Gets the VLAN ID to match. - * - * @return the VLAN ID to match - */ - public VlanId vlanId() { - return vlanId; - } - - @Override - public String toString() { - return toStringHelper(type().toString()) - .add("vlanId", vlanId).toString(); - } - - @Override - public int hashCode() { - return Objects.hash(type().ordinal(), vlanId); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof VlanIdCriterion) { - VlanIdCriterion that = (VlanIdCriterion) obj; - return Objects.equals(vlanId, that.vlanId) && - Objects.equals(this.type(), that.type()); - } - return false; - } -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/VlanPcpCriterion.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/VlanPcpCriterion.java deleted file mode 100644 index 0c83e141..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/VlanPcpCriterion.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.flow.criteria; - -import java.util.Objects; - -import static com.google.common.base.MoreObjects.toStringHelper; - -/** - * Implementation of VLAN priority criterion (3 bits). - */ -public final class VlanPcpCriterion implements Criterion { - private static final byte MASK = 0x7; - private final byte vlanPcp; // VLAN pcp value: 3 bits - - /** - * Constructor. - * - * @param vlanPcp the VLAN priority to match (3 bits) - */ - VlanPcpCriterion(byte vlanPcp) { - this.vlanPcp = (byte) (vlanPcp & MASK); - } - - @Override - public Type type() { - return Type.VLAN_PCP; - } - - /** - * Gets the VLAN priority to match. - * - * @return the VLAN priority to match (3 bits) - */ - public byte priority() { - return vlanPcp; - } - - @Override - public String toString() { - return toStringHelper(type().toString()) - .add("priority", Long.toHexString(vlanPcp)).toString(); - } - - @Override - public int hashCode() { - return Objects.hash(type().ordinal(), vlanPcp); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof VlanPcpCriterion) { - VlanPcpCriterion that = (VlanPcpCriterion) obj; - return Objects.equals(vlanPcp, that.vlanPcp) && - Objects.equals(this.type(), that.type()); - } - return false; - } -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/package-info.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/package-info.java deleted file mode 100644 index 1f091928..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flow/criteria/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2014 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Traffic selection criteria model. - */ -package org.onosproject.net.flow.criteria; |