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); } }
short tableId = flowRemoved.getTableId(); if (tableId == NwConstants.ELAN_SMAC_TABLE) { BigInteger metadata = flowRemoved.getMatch().getMetadata().getMetadata(); long elanTag = MetaDataUtil.getElanTagFromMetadata(metadata); ElanTagName elanTagInfo = elanUtils.getElanInfoByElanTag(elanTag); return; final String srcMacAddress = flowRemoved.getMatch().getEthernetMatch() .getEthernetSource().getAddress().getValue().toUpperCase(); int portTag = MetaDataUtil.getLportFromMetadata(metadata).intValue();
/** * 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; } };
/** * Comparation by Ethernet */ @Override public boolean areObjectsEqual(Match statsMatch, Match storedMatch) { if (storedMatch == null) return false; if (storedMatch.getEthernetMatch() == null) { if (statsMatch.getEthernetMatch() != null) { return false; } } else if (!MatchComparatorHelper.ethernetMatchEquals(statsMatch.getEthernetMatch(), storedMatch.getEthernetMatch())) { return false; } return true; } };
/** * Comparation by Ip */ @Override public boolean areObjectsEqual(Match statsMatch, Match storedMatch) { if (storedMatch == null) return false; if (storedMatch.getIpMatch() == null) { if (statsMatch.getIpMatch() != null) { return false; } } else if (!storedMatch.getIpMatch().equals(statsMatch.getIpMatch())) { return false; } return true; } };
/** * Comparation by VLAN */ @Override public boolean areObjectsEqual(Match statsMatch, Match storedMatch) { if (storedMatch == null) return false; if (storedMatch.getVlanMatch() == null) { if (statsMatch.getVlanMatch() != null) { return false; } } else if (!storedMatch.getVlanMatch().equals(statsMatch.getVlanMatch())) { return false; } return true; } };
/** * Comparation by metadata */ @Override public boolean areObjectsEqual(Match statsMatch, Match storedMatch) { if (storedMatch == null) return false; if (storedMatch.getMetadata() == null) { if (statsMatch.getMetadata() != null) { return false; } } else if (!storedMatch.getMetadata().equals(statsMatch.getMetadata())) { return false; } return true; } };
/** * Comparation by protocol fields */ @Override public boolean areObjectsEqual(Match statsMatch, Match storedMatch) { if (storedMatch == null) return false; if (storedMatch.getProtocolMatchFields() == null) { if (statsMatch.getProtocolMatchFields() != null) { return false; } } else if (!storedMatch.getProtocolMatchFields().equals(statsMatch.getProtocolMatchFields())) { return false; } return true; } };
/** * Comparation by Icmpv4 */ @Override public boolean areObjectsEqual(Match statsMatch, Match storedMatch) { if (storedMatch == null) return false; if (storedMatch.getIcmpv4Match() == null) { if (statsMatch.getIcmpv4Match() != null) { return false; } } else if (!storedMatch.getIcmpv4Match().equals(statsMatch.getIcmpv4Match())) { return false; } return true; } };
/** * Comparation by layer4 */ @Override public boolean areObjectsEqual(Match statsMatch, Match storedMatch) { if (storedMatch == null) return false; if (storedMatch.getLayer4Match() == null) { if (statsMatch.getLayer4Match() != null) { return false; } } else if (!storedMatch.getLayer4Match().equals(statsMatch.getLayer4Match())) { return false; } return true; } };
/** * Comparation by layer3 */ @Override public boolean areObjectsEqual(Match statsMatch, Match storedMatch) { if (storedMatch == null) return false; if (storedMatch.getLayer3Match() == null) { if (statsMatch.getLayer3Match() != null) { return false; } } else if (!MatchComparatorHelper.layer3MatchEquals(statsMatch.getLayer3Match(), storedMatch.getLayer3Match())) { return false; } return true; } };
/** * Comparation by InPhyPort */ @Override public boolean areObjectsEqual(Match statsMatch, Match storedMatch) { if (storedMatch == null) return false; if (storedMatch.getInPhyPort() == null) { if (statsMatch.getInPhyPort() != null) { return false; } } else if (!storedMatch.getInPhyPort().equals(statsMatch.getInPhyPort())) { 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; }
String destination = flowBuilder.getMatch().getEthernetMatch().getEthernetDestination().getAddress().getValue(); String source = flowBuilder.getMatch().getEthernetMatch().getEthernetSource().getAddress().getValue(); String logFlowId = L2_Rule_NAME + source + destination; if (table != null) {
/** * Safely gets ip protocol from flow. * * @param flow the flow * @return the ip protocol from flow */ public static Short getIpProtocolFromFlow(Flow flow) { Short ipProtocol = null; if (flow.getMatch() != null && flow.getMatch().getIpMatch() != null) { ipProtocol = flow.getMatch().getIpMatch().getIpProtocol(); } return ipProtocol; } }
final VlanMatch srcVlanMatch = srcMatch.getVlanMatch(); if (srcVlanMatch != null) {
/** * 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; }
cond = null; } else { NodeConnectorId ncId = match.getInPort(); ingress = (ncId == null) ? null : ncId.getValue(); try {
final int prime = 31; int result = 1; result = prime * result + ((m.getEthernetMatch() == null) ? 0 : m.getEthernetMatch().hashCode()); result = prime * result + ((m.getIcmpv4Match() == null) ? 0 : m.getIcmpv4Match().hashCode()); 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()); result = prime * result + ((m.getLayer4Match() == null) ? 0 : m.getLayer4Match().hashCode()); result = prime * result + ((m.getMetadata() == null) ? 0 : m.getMetadata().hashCode()); 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()); m.getAugmentation(GeneralAugMatchNodesNodeTableFlow.class); if (generalAugMatch != null) { List<ExtensionList> augMatchExtensionList = generalAugMatch.getExtensionList();
if (!Objects.equals(m1.getInPort(), m2.getInPort())) { return false; } 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; } if (!Objects.equals(m1.getIpMatch(), m2.getIpMatch())) { return false; } if (!Objects.equals(m1.getLayer3Match(), m2.getLayer3Match())) { return false; } if (!Objects.equals(m1.getLayer4Match(), m2.getLayer4Match())) { return false; } if (!Objects.equals(m1.getIcmpv4Match(), m2.getIcmpv4Match())) { return false; } if (!Objects.equals(m1.getIcmpv6Match(), m2.getIcmpv6Match())) { return false; } if (!Objects.equals(m1.getProtocolMatchFields(), m2.getProtocolMatchFields())) { return false; } if (!Objects.equals(m1.getTcpFlagsMatch(), m2.getTcpFlagsMatch())) { return false; }