@Override protected void checkPresenceOfRequiredParams(Map<String, ParameterValue> params) { if (params.get(IpProtoClassifierDefinition.PROTO_PARAM) == null) { throw new IllegalArgumentException( "Parameter " + IpProtoClassifierDefinition.PROTO_PARAM + " not specified."); } if (params.get(IpProtoClassifierDefinition.PROTO_PARAM).getIntValue() == null) { throw new IllegalArgumentException( "Value of " + IpProtoClassifierDefinition.PROTO_PARAM + " parameter is not present."); } }
@Override protected void checkPresenceOfRequiredParams(Map<String, ParameterValue> params) { if (params.get(IpProtoClassifierDefinition.PROTO_PARAM) == null) { throw new IllegalArgumentException( "Parameter " + IpProtoClassifierDefinition.PROTO_PARAM + " " + MSG_NOT_SPECIFIED); } if (params.get(IpProtoClassifierDefinition.PROTO_PARAM).getIntValue() == null) { throw new IllegalArgumentException( "Value of " + IpProtoClassifierDefinition.PROTO_PARAM + " " + MSG_PARAMETER_IS_NOT_PRESENT); } }
@Override protected void checkPresenceOfRequiredParams(Map<String, ParameterValue> params) { if (params.get(EtherTypeClassifierDefinition.ETHERTYPE_PARAM) == null) { throw new IllegalArgumentException( "Parameter " + EtherTypeClassifierDefinition.ETHERTYPE_PARAM + " " + MSG_NOT_SPECIFIED); } if (params.get(EtherTypeClassifierDefinition.ETHERTYPE_PARAM).getIntValue() == null) { throw new IllegalArgumentException( "Value of " + EtherTypeClassifierDefinition.ETHERTYPE_PARAM + " " + MSG_PARAMETER_IS_NOT_PRESENT); } }
@Override protected void checkPresenceOfRequiredParams(Map<String, ParameterValue> params) { if (params.get(EtherTypeClassifierDefinition.ETHERTYPE_PARAM) == null) { throw new IllegalArgumentException( "Parameter " + EtherTypeClassifierDefinition.ETHERTYPE_PARAM + " not specified."); } if (params.get(EtherTypeClassifierDefinition.ETHERTYPE_PARAM).getIntValue() == null) { throw new IllegalArgumentException( "Value of " + EtherTypeClassifierDefinition.ETHERTYPE_PARAM + " parameter is not present."); } } }
/** * Return the IpProtocol value. May return null. * * @param params the parameters of classifier-instance inserted by user * @return the IpProtocol value */ public static Long getIpProtoValue(Map<String, ParameterValue> params) { if (params == null) { return null; } if (params.get(IpProtoClassifierDefinition.PROTO_PARAM) == null) { return null; } Long proto = params.get(IpProtoClassifierDefinition.PROTO_PARAM).getIntValue(); if (proto != null) { return proto; } return null; } }
/** * Return the IpProtocol value. May return null. * * @param params the parameters of classifier-instance inserted by user * @return the IpProtocol value */ public static Long getIpProtoValue(Map<String, ParameterValue> params) { if (params == null) { return null; } if (params.get(IpProtoClassifierDefinition.PROTO_PARAM) == null) { return null; } Long proto = params.get(IpProtoClassifierDefinition.PROTO_PARAM).getIntValue(); if (proto != null) { return proto; } return null; } }
private void addToPortSet(Map<String, ParameterValue> params, String portParam, String portRangeParam, Set<Long> portSet) { if (params.get(portParam) != null) { portSet.add(params.get(portParam).getIntValue()); } else if (params.get(portRangeParam) != null) { portSet.addAll(createSetFromRange(params.get(portRangeParam).getRangeValue())); } }
private void validatePortParam(Map<String, ParameterValue> params, String portParam, String portRangeParam) { if (params.get(portParam) != null) { StringBuilder paramLog = new StringBuilder(); if (params.get(portParam).getIntValue() == null) { paramLog.append("Value of ").append(portParam).append(" parameter " + MSG_NOT_SPECIFIED); throw new IllegalArgumentException(paramLog.toString()); } if (params.get(portRangeParam) != null) { paramLog.append("Source port parameters ") .append(portParam) .append(" and ") .append(portRangeParam) .append(" are " + MSG_MUTUALLY_EXCLUSIVE); throw new IllegalArgumentException(paramLog.toString()); } } }
private static boolean isSrcOrDstPortParam(ParameterValue pv) { String pvName = pv.getName().getValue(); return pv.getIntValue() != null && (pvName.equals(L4ClassifierDefinition.SRC_PORT_PARAM) || pvName.equals(L4ClassifierDefinition.DST_PORT_PARAM)); }
private static boolean addL4InfoToFlowCache(Classifier classifier, FlowCacheDefinitionBuilder fcdBuilder) { List<ParameterValue> parametersAndValues = classifier.getParameterValue(); ParameterValue ipProtoParam = getParamVal(parametersAndValues, IpProtoClassifierDefinition.PROTO_PARAM); ParameterValue dstPortParam = getParamVal(parametersAndValues, L4ClassifierDefinition.DST_PORT_PARAM); ParameterValue srcPortParam = getParamVal(parametersAndValues, L4ClassifierDefinition.SRC_PORT_PARAM); if (ipProtoParam == null || (dstPortParam == null && srcPortParam == null)) { LOG.trace( "Cannot add L4 information to flow cache for Sflow-RT." + "\nipProtoParam:{} dstPortParam:{} srcPortParam:{}", ipProtoParam, dstPortParam, srcPortParam); return false; } if (dstPortParam != null) { if (!addTcpUdpPortKeys(ipProtoParam.getIntValue(), dstPortParam.getIntValue(), true, fcdBuilder)) { return false; } } if (srcPortParam != null) { if (!addTcpUdpPortKeys(ipProtoParam.getIntValue(), srcPortParam.getIntValue(), false, fcdBuilder)) { return false; } } return true; }
private static boolean addIpProtoInfoToFlowCache(Classifier classifier, FlowCacheDefinitionBuilder fcdBuilder) { List<ParameterValue> parametersAndValues = classifier.getParameterValue(); ParameterValue ipProtoParam = getParamVal(parametersAndValues, IpProtoClassifierDefinition.PROTO_PARAM); if (ipProtoParam != null) { fcdBuilder.getKeysBuilder().addValue(FlowCacheCons.Key.IP_PROTOCOL.get()); fcdBuilder.getFilterBuilder() .addValue(FlowCacheCons.Key.IP_PROTOCOL.get() + FlowCacheCons.EQ + ipProtoParam.getIntValue()); return true; } else { LOG.trace("Cannot add ip-proto information to flow cache for Sflow-RT."); return false; } }
@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; }
for (ParameterValue v : ci.getParameterValue()) { if (paramsFromClassifier.get(v.getName().getValue()) == null) { if (v.getIntValue() != null || v.getStringValue() != null || v.getRangeValue() != null) { paramsFromClassifier.put(v.getName().getValue(), v);
if (v.getName() == null) continue; if (v.getIntValue() != null) { params.put(v.getName().getValue(), v.getIntValue()); } else if (v.getStringValue() != null) { params.put(v.getName().getValue(), v.getStringValue());
@Override protected List<MatchBuilder> update(List<MatchBuilder> matches, Map<String, ParameterValue> params) { Long type = params.get(EtherTypeClassifierDefinition.ETHERTYPE_PARAM).getIntValue(); for (MatchBuilder match : matches) { EthernetMatchBuilder em; if (match.getEthernetMatch() != null) { equalOrNotSetValidation(match.getEthernetMatch().getEthernetType(), type); continue; } else { em = new EthernetMatchBuilder(); } em.setEthernetType(new EthernetTypeBuilder().setType(new EtherType(type)).build()); match.setEthernetMatch(em.build()); } return matches; }
for (org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.subject.feature.instance.ParameterValue instance : actionInstance.getParameterValue()) { ParameterValueBuilder pBuilder = new ParameterValueBuilder(); pBuilder.setIntValue(instance.getIntValue()); if (instance.getName() != null) { pBuilder.setName(new Name(instance.getName().getValue()));
for (org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.subject.feature.instance.ParameterValue instance : classifierInstance.getParameterValue()) { ParameterValueBuilder pBuilder = new ParameterValueBuilder(); pBuilder.setIntValue(instance.getIntValue()); pBuilder.setName(new Name(instance.getName().getValue())); pBuilder.setStringValue(instance.getStringValue());
private static void addEthTypeInfoToFlowCache(Classifier classifier, FlowCacheDefinitionBuilder fcdBuilder) { List<ParameterValue> parametersAndValues = classifier.getParameterValue(); ParameterValue ethTypeParam = getParamVal(parametersAndValues, EtherTypeClassifierDefinition.ETHERTYPE_PARAM); if (ethTypeParam != null) { fcdBuilder.getKeysBuilder().addValue(FlowCacheCons.Key.ETH_PROTOCOL.get()); fcdBuilder.getFilterBuilder() .addValue(FlowCacheCons.Key.ETH_PROTOCOL.get() + FlowCacheCons.EQ + ethTypeParam.getIntValue()); } else { fcdBuilder.getKeysBuilder().addValue(FlowCacheCons.Key.ETH_PROTOCOL.get()); fcdBuilder.getFilterBuilder() .addValue(FlowCacheCons.Key.ETH_PROTOCOL.get() + FlowCacheCons.EQ + FlowUtils.IPv4 + FlowCacheCons.OR + FlowCacheCons.Key.ETH_PROTOCOL.get() + FlowCacheCons.EQ + FlowUtils.IPv6); } }