@Override public void checkPrereqs(List<MatchBuilder> matches) { for (MatchBuilder match : matches) { Long proto = null; try { proto = Long.valueOf(match.getIpMatch().getIpProtocol().longValue()); } catch (NullPointerException e) { throw new IllegalArgumentException( "Parameter " + IpProtoClassifierDefinition.PROTO_PARAM + " " + MSG_IS_MISSING); } if (!IpProtoClassifierDefinition.TCP_VALUE.equals(proto) && !IpProtoClassifierDefinition.UDP_VALUE.equals(proto) && !IpProtoClassifierDefinition.SCTP_VALUE.equals(proto)) { throw new IllegalArgumentException("Value of parameter " + IpProtoClassifierDefinition.PROTO_PARAM + " is " + Classifier.MSG_NOT_SUPPORTED); } } } }
@Override protected List<MatchBuilder> update(List<MatchBuilder> matches, Map<String, ParameterValue> params) { Long proto = params.get(IpProtoClassifierDefinition.PROTO_PARAM).getIntValue(); for (MatchBuilder match : matches) { IpMatchBuilder imb; if (match.getIpMatch() != null) { equalOrNotSetValidation(match.getIpMatch().getIpProtocol(), proto); continue; } else { imb = new IpMatchBuilder(); } imb.setIpProtocol(proto.shortValue()); match.setIpMatch(imb.build()); } return matches; }
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); } }
private static IpMatch mergeIpMatch(MatchBuilder match, IpMatchBuilder ipMatchBuilder) { IpMatch ipMatch = match.getIpMatch(); if(ipMatch == null) { return ipMatchBuilder.build(); } if(ipMatch.getIpDscp() != null) { ipMatchBuilder.setIpDscp(ipMatch.getIpDscp()); } if(ipMatch.getIpEcn() != null) { ipMatchBuilder.setIpEcn(ipMatch.getIpEcn()); } if(ipMatch.getIpProto() != null) { ipMatchBuilder.setIpProto(ipMatch.getIpProto()); } if(ipMatch.getIpProtocol() != null) { ipMatchBuilder.setIpProtocol(ipMatch.getIpProtocol()); } return ipMatchBuilder.build(); }