@Override public List<MatchBuilder> update(List<MatchBuilder> matches, Map<String, ParameterValue> params) { Set<Long> sPorts = new HashSet<>(); Set<Long> dPorts = new HashSet<>(); addToPortSet(params, L4ClassifierDefinition.SRC_PORT_PARAM, L4ClassifierDefinition.SRC_PORT_RANGE_PARAM, sPorts); addToPortSet(params, L4ClassifierDefinition.DST_PORT_PARAM, L4ClassifierDefinition.DST_PORT_RANGE_PARAM, dPorts); List<MatchBuilder> newMatches = new ArrayList<>(); for (MatchBuilder matchBuilder : matches) { Layer4Match l4Match = matchBuilder.getLayer4Match(); Set<? extends Layer4Match> l4Matches = null; if (l4Match == null) { l4Match = resolveL4Match(params); } l4Matches = createL4Matches(l4Match, sPorts, dPorts); for (Layer4Match newL4Match : l4Matches) { newMatches.add(new MatchBuilder(matchBuilder.build()).setLayer4Match(newL4Match)); } } return newMatches; }
private MatchImpl(MatchBuilder 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(); switch (base.augmentation.size()) { case 0: this.augmentation = Collections.emptyMap(); break; case 1: final Map.Entry<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Match>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Match>> e = base.augmentation.entrySet().iterator().next(); this.augmentation = Collections.<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Match>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Match>>singletonMap(e.getKey(), e.getValue()); break; default : this.augmentation = new HashMap<>(base.augmentation); } }