@Test public final void updateOrderBasedOnProtoClassifTest() throws Exception { ClassifierInstance ci = createClassifierInstance(IpProtoClassifierDefinition.ID); assertEquals(SingleClassifierRule.updateOrderBasedOn(ci, allow, 0), 300); assertEquals(SingleClassifierRule.updateOrderBasedOn(ci, sfc, 0), 295); }
@VisibleForTesting static int updateOrderBasedOn(ClassifierInstance ci, ActionChoice action, Integer baseOrder) { int delta = 0; if (ci.getClassifierDefinitionId().equals(EtherTypeClassifierDefinition.ID)) { delta = 350; } else if (ci.getClassifierDefinitionId().equals(IpProtoClassifierDefinition.ID)) { delta = 300; } else if (ci.getClassifierDefinitionId().equals(L4ClassifierDefinition.ID)) { delta = 200; List<ParameterValue> parameterValue = ci.getParameterValue(); for (ParameterValue pv : parameterValue) { if (isSrcOrDstPortParam(pv)) { delta -= 30; } else if (isRangePortParam(pv)) { delta -= pv.getRangeValue().getMin().equals(pv.getRangeValue().getMax()) ? 30 : 20; } } } if (action instanceof SfcActionCase) { delta -= 5; } return baseOrder + delta; }
SingleClassifierRule { @VisibleForTesting static int updateOrderBasedOn(ClassifierInstance ci, ActionChoice action, Integer baseOrder) { int delta = 0; if (ci.getClassifierDefinitionId().equals(EtherTypeClassifierDefinition.ID)) { delta = 350; } else if (ci.getClassifierDefinitionId().equals(IpProtoClassifierDefinition.ID)) { delta = 300; } else if (ci.getClassifierDefinitionId().equals(L4ClassifierDefinition.ID)) { delta = 200; List<ParameterValue> parameterValue = ci.getParameterValue(); for (ParameterValue pv : parameterValue) { if (isSrcOrDstPortParam(pv)) { delta -= 30; } else if (isRangePortParam(pv)) { delta -= pv.getRangeValue().getMin().equals(pv.getRangeValue().getMax()) ? 30 : 20; } } } if (action instanceof SfcActionCase) { delta -= 5; } return baseOrder + delta; } }
SingleClassifierRule { @VisibleForTesting static int updateOrderBasedOn(ClassifierInstance ci, ActionChoice action, Integer baseOrder) { int delta = 0; if (ci.getClassifierDefinitionId().equals(EtherTypeClassifierDefinition.ID)) { delta = 350; } else if (ci.getClassifierDefinitionId().equals(IpProtoClassifierDefinition.ID)) { delta = 300; } else if (ci.getClassifierDefinitionId().equals(L4ClassifierDefinition.ID)) { delta = 200; List<ParameterValue> parameterValue = ci.getParameterValue(); for (ParameterValue pv : parameterValue) { if (isSrcOrDstPortParam(pv)) { delta -= 30; } else if (isRangePortParam(pv)) { delta -= pv.getRangeValue().getMin().equals(pv.getRangeValue().getMax()) ? 30 : 20; } } } if (action instanceof SfcActionCase) { delta -= 5; } return baseOrder + delta; } SingleClassifierRule(SecurityRule secRule, int ruleBaseOrder, ActionChoice action); }
SingleClassifierRule { @VisibleForTesting static int updateOrderBasedOn(ClassifierInstance ci, ActionChoice action, Integer baseOrder) { int delta = 0; if (ci.getClassifierDefinitionId().equals(EtherTypeClassifierDefinition.ID)) { delta = 350; } else if (ci.getClassifierDefinitionId().equals(IpProtoClassifierDefinition.ID)) { delta = 300; } else if (ci.getClassifierDefinitionId().equals(L4ClassifierDefinition.ID)) { delta = 200; List<ParameterValue> parameterValue = ci.getParameterValue(); for (ParameterValue pv : parameterValue) { if (isSrcOrDstPortParam(pv)) { delta -= 30; } else if (isRangePortParam(pv)) { delta -= pv.getRangeValue().getMin().equals(pv.getRangeValue().getMax()) ? 30 : 20; } } } if (action instanceof SfcActionCase) { delta -= 5; } return baseOrder + delta; } SingleClassifierRule(SecurityRule secRule, int ruleBaseOrder, ActionChoice action); ClassifierInstance getClassifierInstance(); ClassifierRef getClassifierRef(); Rule getRule(); }
SingleClassifierRule { @VisibleForTesting static int updateOrderBasedOn(ClassifierInstance ci, ActionChoice action, Integer baseOrder) { int delta = 0; if (ci.getClassifierDefinitionId().equals(EtherTypeClassifierDefinition.ID)) { delta = 350; } else if (ci.getClassifierDefinitionId().equals(IpProtoClassifierDefinition.ID)) { delta = 300; } else if (ci.getClassifierDefinitionId().equals(L4ClassifierDefinition.ID)) { delta = 200; List<ParameterValue> parameterValue = ci.getParameterValue(); for (ParameterValue pv : parameterValue) { if (isSrcOrDstPortParam(pv)) { delta -= 30; } else if (isRangePortParam(pv)) { delta -= pv.getRangeValue().getMin().equals(pv.getRangeValue().getMax()) ? 30 : 20; } } } if (action instanceof SfcActionCase) { delta -= 5; } return baseOrder + delta; } SingleClassifierRule(SecurityRule secRule, int ruleBaseOrder, ActionChoice action); ClassifierInstance getClassifierInstance(); ClassifierRef getClassifierRef(); Rule getRule();  }