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 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); }
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());
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(); }
if (ci == null) { LOG.warn("Classifier instance {} not found", cr.getInstanceName().getValue()); return null;
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());