public static ContractId resolveContractIdFromFlowCacheName(String flowCacheName) { List<String> keys = Splitter.on(DELIMETER).splitToList(flowCacheName); String policyRuleGroupKey = keys.get(0); String contractId = Splitter.on(KEY_DELIMETER).splitToList(policyRuleGroupKey).get(1); return new ContractId(contractId); }
public static ContractId getContractId(SecurityRule secRule) { return new ContractId(secRule.getUuid().getValue()); }
private Contract getDefaultContract() { ContractBuilder contractBuilder = new ContractBuilder().setId(new ContractId(this.contractId)); Subject subject = null; Action action = intent.getActions().get(0).getAction(); if (action instanceof Block) { subject = this.getBlockSubject(); } else if (action instanceof Allow) { subject = this.getAllowSubject(); } else { LOG.warn("The specified action is not recognized {}", action); } List<SubjectName> subjectNames = new ArrayList<>(); subjectNames.add(subject.getName()); contractBuilder.setSubject(ImmutableList.of(subject)); contractBuilder.setClause(ImmutableList.of(new ClauseBuilder() .setName(new ClauseName(DEFAULT_CONTRACT)) .setSubjectRefs(subjectNames) .build())); return contractBuilder.build(); }
.setConsumerNamedSelector(ImmutableList.of(new ConsumerNamedSelectorBuilder() .setName(new SelectorName(CONSUMER_NETWORK_NAME)) .setContract(ImmutableList.of(new ContractId(this.contractId))) .build())) .build(); .setProviderNamedSelector(ImmutableList.of(new ProviderNamedSelectorBuilder() .setName(new SelectorName(PROVIDER_NETWORK_NAME)) .setContract(ImmutableList.of(new ContractId(this.contractId))) .build())) .build();