/** * Comparation by InPort */ @Override public boolean areObjectsEqual(Match statsMatch, Match storedMatch) { if (storedMatch == null) return false; if (storedMatch.getInPort() == null) { if (statsMatch.getInPort() != null) { return false; } } else if (!storedMatch.getInPort().equals(statsMatch.getInPort())) { return false; } return true; } };
/** * Check whether the flow match configured in the specified MD-SAL flow * entry meets the condition specified by this instance. * * @param flow The MD-SAL flow entry to be tested. * @return {@code true} if the specified flow entry meets the conditions. * {@code false} otherwise. */ private boolean checkMatch(Flow flow) { boolean result = (flowMatch == null); if (!result) { Match match = flow.getMatch(); if (match == null) { match = EMPTY_MATCH; } // Currently, only IN_PORT match is supported. NodeConnectorId inPort = flowMatch.getInPort(); result = (inPort == null || inPort.equals(match.getInPort())); if (result) { // Return false if unsupported filed is specified. result = validMatch; } } return result; }
cond = null; } else { NodeConnectorId ncId = match.getInPort(); ingress = (ncId == null) ? null : ncId.getValue(); try {
result = prime * result + ((m.getIcmpv6Match() == null) ? 0 : m.getIcmpv6Match().hashCode()); result = prime * result + ((m.getInPhyPort() == null) ? 0 : m.getInPhyPort().hashCode()); result = prime * result + ((m.getInPort() == null) ? 0 : m.getInPort().hashCode()); result = prime * result + ((m.getIpMatch() == null) ? 0 : m.getIpMatch().hashCode()); result = prime * result + ((m.getLayer3Match() == null) ? 0 : m.getLayer3Match().hashCode());
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); } }
/** * @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))); }