@Override public int hashCode() { return tenantId != null ? tenantId.hashCode() : 0; } }
public static Boolean contains(List<L2BridgeDomainId> l2Domains, L2BridgeDomainId l2Domain) { for (L2BridgeDomainId l2BridgeDomain : l2Domains) { if (l2BridgeDomain.getValue() != null && l2Domain.getValue() != null && l2BridgeDomain.getValue().equalsIgnoreCase(l2Domain.getValue())) { return true; } } return false; }
public static Boolean contains(List<L3ContextId> l3ContextIds, L3ContextId l3Context) { for (L3ContextId l3ContextId: l3ContextIds) { if (l3ContextId.getValue() != null && l3Context.getValue() != null && l3ContextId.getValue().equalsIgnoreCase(l3Context.getValue())) { return true; } } return false; }
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 Subnet createSubnet(List<L3Address> endPoints, NetworkDomainId networkDomainId , L2FloodDomainId floodDomainId) { L3Address endPoint = endPoints.get(0); String ip = endPoint.getIpAddress().getIpv4Address().getValue(); ip = ip.substring(0, ip.lastIndexOf('.')) + ".1"; return new SubnetBuilder() .setId(new SubnetId(networkDomainId.getValue())) .setParent(new ContextId(floodDomainId.getValue())) .setVirtualRouterIp( GBPRendererHelper.createIpAddress(ip)) .setIpPrefix(GBPRendererHelper.createIpPrefix(ip + "/24")) .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 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(); }
L3Context getL3ContextForSubnet(IndexedTenant indexedTenant, Subnet subnet) { if (indexedTenant == null || subnet == null || subnet.getParent() == null) { return null; } return indexedTenant.resolveL3Context(new L2FloodDomainId(subnet.getParent().getValue())); }
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 boolean isEqualService(ResolvedPolicy newPolicy, ResolvedPolicy oldPolicy) { return oldPolicy != null && newPolicy.getConsumerEpgId().equals(oldPolicy.getConsumerEpgId()) && newPolicy.getProviderEpgId().equals(oldPolicy.getProviderEpgId()) && newPolicy.getConsumerTenantId().equals(oldPolicy.getConsumerTenantId()) && newPolicy.getProviderTenantId().equals(oldPolicy.getProviderTenantId()); }
public GBPTenantPolicyCreator(DataBroker dataBroker, Intent intent) { this.dataProvider = dataBroker; this.intent = intent; this.mdsalUtils = new MdsalUtils(dataProvider); this.contractId = GBPRendererHelper.createUniqueId(); this.providerL3Addresses = new ArrayList<>(); this.consumerL3Addresses = new ArrayList<>(); this.bridgeDomainIds = new ArrayList<>(); this.l3ContextIds = new ArrayList<>(); this.providerNetworkDomainId = new NetworkDomainId(GBPRendererHelper.createUniqueId()); this.consumerNetworkDomainId = new NetworkDomainId(GBPRendererHelper.createUniqueId()); this.providerFloodDomainId = new L2FloodDomainId(GBPRendererHelper.createUniqueId()); this.consumerFloodDomainId = new L2FloodDomainId(GBPRendererHelper.createUniqueId()); }
@Deprecated private static @Nonnull L3Context createL3CtxFromRouter(Router router) { Name l3ContextName = null; if (!Strings.isNullOrEmpty(router.getName())) { l3ContextName = new Name(router.getName()); } return new L3ContextBuilder().setId(new L3ContextId(router.getUuid().getValue())) .setName(l3ContextName) .setDescription(new Description(MappingUtils.NEUTRON_ROUTER + router.getUuid().getValue())) .build(); }
public static SubjectName getSubjectName(SecurityRule secRule) { RuleName ruleName = SecRuleNameDecoder.getRuleName(secRule); return new SubjectName(ruleName); }
/** * Creates an ordinal for the OfOverlay pipeline comparison, based on @TenantId and a * uniqueID (UUID) associated with any other attribute. * * @param tenantId the tenant id * @param id a unique id * @return the ordinal */ public static int getContextOrdinal(final TenantId tenantId, final UniqueId id) { if (tenantId == null || id == null) return 0; return getContextOrdinalFromString(tenantId.getValue() + "|" + id.getValue()); }
@Override public boolean apply(EndpointL3Prefix input) { return (input.getTenant().equals(tenantId)); }
private Name getPortName(FlowCapableNodeConnector fcnc) { if (fcnc == null || fcnc.getName() == null) { return null; } return new Name(fcnc.getName()); }
@Override public void onFailure(Throwable arg0) { LOG.error("Failure reading ActionDefinition {}", id.getValue()); }
public static ActionRef createSfcActionRef(String sfcChainName) { return new ActionRefBuilder().setName(new ActionName(sfcChainName)).setOrder(0).build(); }
private Subject getBlockSubject() { return new SubjectBuilder() .setName(new SubjectName(SUBJECT_NAME)) .build(); }