@Test public void testUpdate_NoProto() { List<MatchBuilder> matches = new ArrayList<>(); Map<String, ParameterValue> params = new HashMap<>(); matches.add(new MatchBuilder()); Long dstRangeStart = GREATER_RANGE_START; Long dstRangeEnd = GREATER_RANGE_END; params.putAll(ClassifierTestUtils.createRangeValueParam(L4ClassifierDefinition.DST_PORT_RANGE_PARAM, dstRangeStart, dstRangeEnd)); thrown.expect(IllegalArgumentException.class); thrown.expectMessage(Classifier.MSG_IS_MISSING); Classifier.L4_CL.update(matches, params); }
@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; }
L4Classifier extends Classifier { @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; } }
L4Classifier extends Classifier { @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; } protected  L4Classifier(Classifier parent); }
L4Classifier extends Classifier { @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; } protected  L4Classifier(Classifier parent); @Override ClassifierDefinitionId getId(); @Override ClassifierDefinition getClassifierDefinition(); @Override List<SupportedParameterValues> getSupportedParameterValues(); @Override List<MatchBuilder> update(List<MatchBuilder> matches, Map<String, ParameterValue> params); @Override void checkPrereqs(List<MatchBuilder> matches); }
L4Classifier extends Classifier { @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; } protected  L4Classifier(Classifier parent); @Override ClassifierDefinitionId getId(); @Override ClassifierDefinition getClassifierDefinition(); @Override List<SupportedParameterValues> getSupportedParameterValues(); @Override List<MatchBuilder> update(List<MatchBuilder> matches, Map<String, ParameterValue> params); @Override void checkPrereqs(List<MatchBuilder> matches);  }