@Test public void testCreateClassifierDefinitionWithUnionOfParams_emptySupportedParams() { List<ParameterName> supportedParams = ImmutableList.of(); ClassifierDefinition classifierDefinitionWithUnionOfParams = listener .createClassifierDefinitionWithUnionOfParams(EtherTypeClassifierDefinition.DEFINITION, supportedParams); Assert.assertNull(classifierDefinitionWithUnionOfParams); }
@VisibleForTesting static ClassifierDefinition createClassifierDefinitionWithUnionOfParams(ClassifierDefinition cd, List<ParameterName> supportedParams) { if (supportedParams == null || supportedParams.isEmpty()) { LOG.debug("Classifier-definition with ID {} is not supported by any renderer.", cd.getId().getValue()); return null; } if (cd.getParameter() == null || cd.getParameter().isEmpty()) { LOG.trace("Classifier-definition with ID {} does not contain any parameter in CONF datastore.", cd.getId().getValue()); return cd; } List<Parameter> params = new ArrayList<>(); for (ParameterName supportedParam : supportedParams) { for (Parameter param : cd.getParameter()) { if (param.getName().equals(supportedParam)) { params.add(param); } } } ClassifierDefinitionBuilder cdBuilder = new ClassifierDefinitionBuilder(cd); return cdBuilder.setParameter(params).build(); }
SupportedClassifierDefinitionListener extends DataTreeChangeHandler<SupportedClassifierDefinition> { @VisibleForTesting static ClassifierDefinition createClassifierDefinitionWithUnionOfParams(ClassifierDefinition cd, List<ParameterName> supportedParams) { if (supportedParams == null || supportedParams.isEmpty()) { LOG.debug("Classifier-definition with ID {} is not supported by any renderer.", cd.getId().getValue()); return null; } if (cd.getParameter() == null || cd.getParameter().isEmpty()) { LOG.trace("Classifier-definition with ID {} does not contain any parameter in CONF datastore.", cd.getId().getValue()); return cd; } List<Parameter> params = new ArrayList<>(); for (ParameterName supportedParam : supportedParams) { for (Parameter param : cd.getParameter()) { if (param.getName().equals(supportedParam)) { params.add(param); } } } ClassifierDefinitionBuilder cdBuilder = new ClassifierDefinitionBuilder(cd); return cdBuilder.setParameter(params).build(); } }
SupportedClassifierDefinitionListener extends DataTreeChangeHandler<SupportedClassifierDefinition> { @VisibleForTesting static ClassifierDefinition createClassifierDefinitionWithUnionOfParams(ClassifierDefinition cd, List<ParameterName> supportedParams) { if (supportedParams == null || supportedParams.isEmpty()) { LOG.debug("Classifier-definition with ID {} is not supported by any renderer.", cd.getId().getValue()); return null; } if (cd.getParameter() == null || cd.getParameter().isEmpty()) { LOG.trace("Classifier-definition with ID {} does not contain any parameter in CONF datastore.", cd.getId().getValue()); return cd; } List<Parameter> params = new ArrayList<>(); for (ParameterName supportedParam : supportedParams) { for (Parameter param : cd.getParameter()) { if (param.getName().equals(supportedParam)) { params.add(param); } } } ClassifierDefinitionBuilder cdBuilder = new ClassifierDefinitionBuilder(cd); return cdBuilder.setParameter(params).build(); } SupportedClassifierDefinitionListener(DataBroker dataProvider, PolicyValidatorRegistry validatorRegistry); }
SupportedClassifierDefinitionListener extends DataTreeChangeHandler<SupportedClassifierDefinition> { @VisibleForTesting static ClassifierDefinition createClassifierDefinitionWithUnionOfParams(ClassifierDefinition cd, List<ParameterName> supportedParams) { if (supportedParams == null || supportedParams.isEmpty()) { LOG.debug("Classifier-definition with ID {} is not supported by any renderer.", cd.getId().getValue()); return null; } if (cd.getParameter() == null || cd.getParameter().isEmpty()) { LOG.trace("Classifier-definition with ID {} does not contain any parameter in CONF datastore.", cd.getId().getValue()); return cd; } List<Parameter> params = new ArrayList<>(); for (ParameterName supportedParam : supportedParams) { for (Parameter param : cd.getParameter()) { if (param.getName().equals(supportedParam)) { params.add(param); } } } ClassifierDefinitionBuilder cdBuilder = new ClassifierDefinitionBuilder(cd); return cdBuilder.setParameter(params).build(); } SupportedClassifierDefinitionListener(DataBroker dataProvider, PolicyValidatorRegistry validatorRegistry);  }
SupportedClassifierDefinitionListener extends DataTreeChangeHandler<SupportedClassifierDefinition> { @VisibleForTesting static ClassifierDefinition createClassifierDefinitionWithUnionOfParams(ClassifierDefinition cd, List<ParameterName> supportedParams) { if (supportedParams == null || supportedParams.isEmpty()) { LOG.debug("Classifier-definition with ID {} is not supported by any renderer.", cd.getId().getValue()); return null; } if (cd.getParameter() == null || cd.getParameter().isEmpty()) { LOG.trace("Classifier-definition with ID {} does not contain any parameter in CONF datastore.", cd.getId().getValue()); return cd; } List<Parameter> params = new ArrayList<>(); for (ParameterName supportedParam : supportedParams) { for (Parameter param : cd.getParameter()) { if (param.getName().equals(supportedParam)) { params.add(param); } } } ClassifierDefinitionBuilder cdBuilder = new ClassifierDefinitionBuilder(cd); return cdBuilder.setParameter(params).build(); } SupportedClassifierDefinitionListener(DataBroker dataProvider, PolicyValidatorRegistry validatorRegistry);   }