/** * Comparation by tunnel */ @Override public boolean areObjectsEqual(Match statsMatch, Match storedMatch) { if (storedMatch == null) return false; if (storedMatch.getTunnel() == null) { if (statsMatch.getTunnel() != null) { return false; } } else if (!storedMatch.getTunnel().equals(statsMatch.getTunnel())) { return false; } return true; } };
result = prime * result + ((m.getProtocolMatchFields() == null) ? 0 : m.getProtocolMatchFields().hashCode()); result = prime * result + ((m.getTcpFlagsMatch() == null) ? 0 : m.getTcpFlagsMatch().hashCode()); result = prime * result + ((m.getTunnel() == null) ? 0 : m.getTunnel().hashCode()); result = prime * result + ((m.getVlanMatch() == null) ? 0 : m.getVlanMatch().hashCode());
if (!Objects.equals(m1.getInPhyPort(), m2.getInPhyPort())) { return false; } if (!Objects.equals(m1.getMetadata(), m2.getMetadata())) { return false; } if (!Objects.equals(m1.getTunnel(), m2.getTunnel())) { return false; } if (!Objects.equals(m1.getEthernetMatch(), m2.getEthernetMatch())) { return false; } if (!Objects.equals(m1.getVlanMatch(), m2.getVlanMatch())) { return false; }
public MatchBuilder(Match base) { this._ethernetMatch = base.getEthernetMatch(); this._icmpv4Match = base.getIcmpv4Match(); this._icmpv6Match = base.getIcmpv6Match(); this._inPhyPort = base.getInPhyPort(); this._inPort = base.getInPort(); this._ipMatch = base.getIpMatch(); this._layer3Match = base.getLayer3Match(); this._layer4Match = base.getLayer4Match(); this._metadata = base.getMetadata(); this._protocolMatchFields = base.getProtocolMatchFields(); this._tcpFlagMatch = base.getTcpFlagMatch(); this._tunnel = base.getTunnel(); this._vlanMatch = base.getVlanMatch(); if (base instanceof MatchImpl) { MatchImpl _impl = (MatchImpl) base; this.augmentation = new HashMap<>(_impl.augmentation); } }
/** * Verify the condition of the flow match. * * @return {@code true} if the flow match is valid. * {@code false} otherwise. */ private boolean isMatchValid() { boolean result = (flowMatch == null); if (!result) { result = (flowMatch.getInPhyPort() == null && flowMatch.getMetadata() == null && flowMatch.getTunnel() == null && flowMatch.getEthernetMatch() == null && flowMatch.getVlanMatch() == null && flowMatch.getIpMatch() == null && flowMatch.getLayer3Match() == null && flowMatch.getLayer4Match() == null && flowMatch.getIcmpv4Match() == null && flowMatch.getIcmpv6Match() == null && flowMatch.getProtocolMatchFields() == null && flowMatch.getTcpFlagsMatch() == null); } return result; }
/** * @param match is the original fields should be matched. * @param matchFields are the target fields should be compared. * @return the result of match. */ public boolean match(Match match, MatchFields matchFields) { log.info("Flow Entry Matching Start"); return (match == null) || ((matchInPort(match.getInPort(), matchFields) && matchInPhyPort(match.getInPhyPort(), matchFields) && matchIp(match.getIpMatch(), matchFields) && matchVlan(match.getVlanMatch(), matchFields) && matchTunnel(match.getTunnel(), matchFields) && matchMetadata(match.getMetadata(), matchFields) && matchEthernet(match.getEthernetMatch(), matchFields) && matchLayer3(match.getLayer3Match(), matchFields) && matchLayer4(match.getLayer4Match(), matchFields) && matchIcmpv4Match(match.getIcmpv4Match(), matchFields) && matchIcmpv6Match(match.getIcmpv6Match(), matchFields) && matchProtocolMatchFields(match.getProtocolMatchFields(), matchFields) && matchTcpFlag(match.getTcpFlagsMatch(), matchFields))); }