public DestinationPortRangeBuilder(DestinationPortRange base) { this._lowerPort = base.getLowerPort(); this._upperPort = base.getUpperPort(); if (base instanceof DestinationPortRangeImpl) { DestinationPortRangeImpl impl = (DestinationPortRangeImpl) base; if (!impl.augmentation.isEmpty()) { this.augmentation = new HashMap<>(impl.augmentation); } } else if (base instanceof AugmentationHolder) { @SuppressWarnings("unchecked") Map<Class<? extends Augmentation<DestinationPortRange>>, Augmentation<DestinationPortRange>> aug =((AugmentationHolder<DestinationPortRange>) base).augmentations(); if (!aug.isEmpty()) { this.augmentation = new HashMap<>(aug); } } }
if (!Objects.equals(_lowerPort, other.getLowerPort())) { return false; if (!Objects.equals(_upperPort, other.getUpperPort())) { return false; if (!e.getValue().equals(other.augmentation(e.getKey()))) { return false;
private void addIpProtocolMatch(AceIp aceIp) { int srcPort = 0; int dstPort = 0; // TODO Ranges are not supported yet if (aceIp.getSourcePortRange() != null && aceIp.getSourcePortRange().getLowerPort() != null) { srcPort = aceIp.getSourcePortRange().getLowerPort().getValue(); } if (aceIp.getDestinationPortRange() != null && aceIp.getDestinationPortRange().getLowerPort() != null) { dstPort = aceIp.getDestinationPortRange().getLowerPort().getValue(); } MatchUtils.createIpProtocolMatch(matchBuilder, aceIp.getProtocol()); MatchUtils.addLayer4Match(matchBuilder, aceIp.getProtocol().intValue(), srcPort, dstPort); }
public MatchBuilder buildMatch(Matches matches) { MatchBuilder matchBuilder = new MatchBuilder(); if (matches.getAceType() instanceof AceIp) { AceIp aceIp = (AceIp)matches.getAceType(); if (aceIp.getAceIpVersion() instanceof AceIpv4) { //AceIpv4 aceIpv4 = (AceIpv4) aceIp.getAceIpVersion(); //MatchUtils.createSrcL3IPv4Match(matchBuilder, aceIpv4.getSourceIpv4Network()); //MatchUtils.createDstL3IPv4Match(matchBuilder, aceIpv4.getDestinationIpv4Network()); MatchUtils.createIpProtocolMatch(matchBuilder, aceIp.getProtocol()); MatchUtils.addLayer4Match(matchBuilder, aceIp.getProtocol().intValue(), 0, aceIp.getDestinationPortRange().getLowerPort().getValue().intValue()); } } else if (matches.getAceType() instanceof AceEth) { AceEth aceEth = (AceEth) matches.getAceType(); MatchUtils.createEthSrcMatch(matchBuilder, new MacAddress(aceEth.getSourceMacAddress().getValue())); MatchUtils.createDestEthMatch(matchBuilder, new MacAddress(aceEth.getDestinationMacAddress().getValue()), new MacAddress(aceEth.getDestinationMacAddressMask().getValue())); } LOG.info("buildMatch: {}", matchBuilder.build()); return matchBuilder; }
private ObjectNode getDestinationPortRangeObjectNode(AceIp aceIp) { if (aceIp == null) { return null; } ObjectNode destinationPortRangeNode = null; DestinationPortRange destinationPortRange = aceIp.getDestinationPortRange(); if (destinationPortRange != null) { destinationPortRangeNode = mapper.createObjectNode(); if (destinationPortRange.getLowerPort() != null) { destinationPortRangeNode.put(_LOWER_PORT, destinationPortRange.getLowerPort().getValue()); } if (destinationPortRange.getUpperPort() != null) { destinationPortRangeNode.put(_UPPER_PORT, destinationPortRange.getUpperPort().getValue()); } } return destinationPortRangeNode; }
Map<Integer, Integer> portMaskMap = getLayer4MaskForRange(destinationPortRange.getLowerPort().getValue(), destinationPortRange.getUpperPort().getValue()); for (Integer port: portMaskMap.keySet()) { List<MatchInfoBase> flowMatches = new ArrayList<>();
Map<Integer, Integer> portMaskMap = getLayer4MaskForRange(destinationPortRange.getLowerPort().getValue(), destinationPortRange.getUpperPort().getValue()); for (Integer port: portMaskMap.keySet()) { List<MatchInfoBase> flowMatches = new ArrayList<>();
if (acl.getAceIpVersion() instanceof AceIpv4 ) { flowMatches.add(new MatchInfo(MatchFieldType.icmp_v4, new long[] { destinationPortRange.getLowerPort().getValue(), destinationPortRange.getUpperPort().getValue() })); flowId = flowId + "V4_DESTINATION_" + destinationPortRange.getLowerPort().getValue() + destinationPortRange.getUpperPort().getValue() + "_"; } else if (acl.getAceIpVersion() instanceof AceIpv6 ) { flowMatches.add(new MatchInfo(MatchFieldType.icmp_v6, new long[] { destinationPortRange.getLowerPort().getValue(), destinationPortRange.getUpperPort().getValue() })); flowId = flowId + "V6_DESTINATION_" + destinationPortRange.getLowerPort().getValue() + destinationPortRange.getUpperPort().getValue() + "_";