@Test public void testUpdate_overrideBySameValue() { List<MatchBuilder> matches = new ArrayList<>(); Map<String, ParameterValue> params = new HashMap<>(); matches.add(new MatchBuilder() .setEthernetMatch(ClassifierTestUtils.createEthernetMatch(ClassifierTestUtils.IPV6_ETH_TYPE)) .setIpMatch(ClassifierTestUtils.createIpMatch(ClassifierTestUtils.UDP.shortValue()))); params.putAll( ClassifierTestUtils.createIntValueParam(EtherTypeClassifierDefinition.ETHERTYPE_PARAM, FlowUtils.IPv6)); List<MatchBuilder> updated = Classifier.ETHER_TYPE_CL.update(matches, params); assertEquals(1, updated.size()); MatchBuilder first = updated.get(0); assertEquals(ClassifierTestUtils.IPV6_ETH_TYPE, first.getEthernetMatch().getEthernetType()); assertSame(ClassifierTestUtils.UDP, first.getIpMatch().getIpProtocol().longValue()); }
@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; }
EtherTypeClassifier extends Classifier { @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; } }
EtherTypeClassifier extends Classifier { @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; } protected  EtherTypeClassifier(Classifier parent); }
EtherTypeClassifier extends Classifier { @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; } protected  EtherTypeClassifier(Classifier parent); @Override ClassifierDefinitionId getId(); @Override ClassifierDefinition getClassifierDefinition(); @Override List<SupportedParameterValues> getSupportedParameterValues(); }
EtherTypeClassifier extends Classifier { @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; } protected  EtherTypeClassifier(Classifier parent); @Override ClassifierDefinitionId getId(); @Override ClassifierDefinition getClassifierDefinition(); @Override List<SupportedParameterValues> getSupportedParameterValues();  }