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(); }
public static ClauseName getClauseName(SecurityRule secRule) { IpPrefix remoteIpPrefix = secRule.getRemoteIpPrefix(); SubjectName subjectName = getSubjectName(secRule); if (remoteIpPrefix == null) { return new ClauseName(subjectName); } return new ClauseName(subjectName.getValue() + MappingUtils.NAME_DOUBLE_DELIMETER + Utils.getStringIpPrefix(remoteIpPrefix).replace('/', '_')); }
private static ProviderNamedSelector createProviderSelector(Contract contract) { SelectorName selectorName = new SelectorName(contract.getSubject().get(0).getName().getValue()); return new ProviderNamedSelectorBuilder().setName(selectorName) .setContract(ImmutableList.of(contract.getId())) .build(); }
private static ConsumerNamedSelector createConsumerSelector(Contract contract) { SelectorName selectorName = new SelectorName(contract.getSubject().get(0).getName().getValue()); return new ConsumerNamedSelectorBuilder().setName(selectorName) .setContract(ImmutableList.of(contract.getId())) .build(); }
if (subjectRef.equals(sub.getName())) { SecurityRuleGroupBuilder securityRuleGroupBuilder = new SecurityRuleGroupBuilder(); securityRuleGroupBuilder.setName(new Name(subjectRef.getValue())); List<Rule> subRules = sub.getRule(); if (subRules == null) { LOG.warn("Subject {} in Contract {} doesn't have rules", subjectRef.getValue(), contract.getId().getValue()); } else { List<SecurityRule> securityRules = getSecurityRules(contract, subjectRef, subRules); LOG.debug("Subject {} in Contract {} has {} rules", subjectRef.getValue(), contract.getId() .getValue(), securityRules.size()); securityRuleGroupBuilder.setSecurityRule(securityRules); .getValue(), subjectRef.getValue(), contract.getId().getValue()); securityRuleGroups.add(securityRuleGroupBuilder.build());
ProviderMatchers providerMatchers = null; StringBuilder clauseName = new StringBuilder(); clauseName.append(subjectName.getValue()); if (ipPrefix != null) { clauseName.append(MappingUtils.NAME_DOUBLE_DELIMETER).append(Utils.getStringIpPrefix(ipPrefix));