public static ClassifierName getClassifierRefName(SecurityRule secRule) { Direction direction = SecRuleEntityDecoder.getDirection(secRule); ClassifierName classifierInstanceName = getClassifierInstanceName(secRule); String crName = new StringBuilder().append(direction.name()) .append(MappingUtils.NAME_DOUBLE_DELIMETER) .append(classifierInstanceName.getValue()) .toString(); return new ClassifierName(crName); }
public static RuleName getRuleName(SecurityRule secRule) { ClassifierName classifierRefName = SecRuleNameDecoder.getClassifierRefName(secRule); String ruleName = new StringBuilder(MappingUtils.ACTION_ALLOW.getName().getValue()) .append(MappingUtils.NAME_DOUBLE_DELIMETER).append(classifierRefName.getValue()).toString(); return new RuleName(ruleName); }
public static ClassifierName resolveClassifierNameFromFlowCacheName(String flowCacheName) { List<String> keys = Splitter.on(DELIMETER).splitToList(flowCacheName); String classifierName = keys.get(2); return new ClassifierName(classifierName); }
public static String createFlowCacheName(InstanceIdentifier<Classifier> classifierIid, FlowCacheCons.Value value) { PolicyRuleGroupKey policyRuleGroup = classifierIid.firstKeyOf(PolicyRuleGroup.class); ResolvedRuleKey resolvedRule = classifierIid.firstKeyOf(ResolvedRule.class); ClassifierKey classifier = classifierIid.firstKeyOf(Classifier.class); StringBuilder sb = new StringBuilder(); sb.append(createStringFromCompositeKey(policyRuleGroup.getTenantId().getValue(), policyRuleGroup.getContractId().getValue(), policyRuleGroup.getSubjectName().getValue())) .append(DELIMETER) .append(resolvedRule.getName().getValue()) .append(DELIMETER) .append(classifier.getName().getValue()) .append(DELIMETER) .append(value.get()); return sb.toString(); }
private Subject getAllowSubject() { return new SubjectBuilder() .setName(new SubjectName(SUBJECT_NAME)) .setRule(ImmutableList.of(new RuleBuilder() .setKey(new RuleKey(new RuleName(SUBJECT_NAME + "_Rule"))) .setActionRef(ImmutableList.of(new ActionRefBuilder() .setName(new ActionName(ACTION_ALLOW)) .build())) .setClassifierRef(ImmutableList.of(new ClassifierRefBuilder() .setKey(new ClassifierRefKey(new ClassifierName(SUBJECT_NAME + "_Classifier"))) .setName(new ClassifierName(CLASSIFIER_NAME)) .setDirection(Direction.Bidirectional) .build())) .build())) .build(); }
Integer portMax = secRule.getPortRangeMax(); if (portMin != null && portMax != null) { keyBuilder.append(L4ClassifierDefinition.DEFINITION.getName().getValue()); if (portMin.equals(portMax)) { keyBuilder.append(MappingUtils.NAME_DELIMETER) protocolString = protocol.getIdentityref().getSimpleName(); keyBuilder.append(IpProtoClassifierDefinition.DEFINITION.getName().getValue()) .append(MappingUtils.NAME_VALUE_DELIMETER) .append(protocolString); keyBuilder.append(MappingUtils.NAME_DOUBLE_DELIMETER); keyBuilder.append(EtherTypeClassifierDefinition.DEFINITION.getName().getValue()) .append(MappingUtils.NAME_VALUE_DELIMETER) .append(ethertype.getSimpleName()); return new ClassifierName(keyBuilder.toString());
if (ci == null) { LOG.warn("Classifier instance {} not found", cr.getInstanceName().getValue()); return null;
return classifierBuilder.setParameterValue(params).setName(new ClassifierName(classifierName)).build();
private static Rule createRuleAllow(ClassifierName classifierName, Direction direction) { ClassifierName name = new ClassifierName(direction.name() + MappingUtils.NAME_DOUBLE_DELIMETER + classifierName.getValue()); ClassifierRef classifierRef = new ClassifierRefBuilder().setName(name) .setInstanceName(classifierName) .setDirection(direction) .build(); return new RuleBuilder().setName(new RuleName(name)) .setActionRef(ImmutableList.<ActionRef>of(MappingUtils.ACTION_REF_ALLOW)) .setClassifierRef(ImmutableList.of(classifierRef)) .build(); }
ruleClassifierBuilder.setName(new Name(classifierRef.getName().getValue())); ClassifierInstance classifierInstance = getClassifierInstance(tenantId, classifierRef.getName(), dataProvider); LOG.trace("Calssifier Instance {} has {} parameters", classifierInstance.getName().getValue(), classifierInstance.getParameterValue().size()); parms = new ArrayList<>(); .getValue()); parms.add(parm); LOG.trace("Classifier Instance {} has no parameters", classifierInstance.getName().getValue());