public static ActionRef createSfcActionRef(String sfcChainName) { return new ActionRefBuilder().setName(new ActionName(sfcChainName)).setOrder(0).build(); }
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); }
private void addSfcChainActionInstance(ActionChoice action, TenantId tenantId, ReadWriteTransaction rwTx) { if (action instanceof SfcActionCase) { String sfcChainName = ((SfcActionCase) action).getSfcChainName(); ActionName actionName = new ActionName(sfcChainName); ActionInstance sfcActionInstance = new ActionInstanceBuilder().setName(actionName) .setActionDefinitionId(ChainActionDefinition.ID) .setParameterValue( ImmutableList.of(new ParameterValueBuilder().setName( new ParameterName(ChainActionDefinition.SFC_CHAIN_NAME)) .setStringValue(sfcChainName) .build())) .build(); rwTx.put(LogicalDatastoreType.CONFIGURATION, IidFactory.actionInstanceIid(tenantId, actionName), sfcActionInstance, true); } }
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(); }
ruleActionBuilder.setName(new Name(actionRef.getName().getValue())); ruleActionBuilder.setOrder(actionRef.getOrder()); ActionInstance actionInstance = getActionInstance(actionRef.getName()); LOG.trace("Action Instance {} has {} parameters", actionInstance.getName().getValue(), actionInstance.getParameterValue().size()); parms = new ArrayList<>(); LOG.trace("Added Parm {} from Action Instance {}", parm, actionInstance.getName().getValue()); parms.add(parm); LOG.trace("Action Instance {} has no parameters", actionInstance.getName().getValue());