@VisibleForTesting void addTenantAndResolvePolicy(Tenant unresolvedTenant) { Tenant t = InheritanceUtils.resolveTenant(unresolvedTenant); IndexedTenant it = new IndexedTenant(t); resolvedTenants.put(unresolvedTenant.getId(), it); policyInfo = resolvePolicy(resolvedTenants); }
public OfContext(DataBroker dataBroker, PolicyManager policyManager, SwitchManager switchManager, EndpointManager endpointManager, ScheduledExecutorService executor) { this.dataBroker = dataBroker; this.policyManager = policyManager; this.switchManager = switchManager; this.epManager = endpointManager; this.executor = executor; if (dataBroker == null) { LOG.error("DataBroker is null. Cannot read resolved tenants and resolved policy from DS."); } else { ReadOnlyTransaction rTx = dataBroker.newReadOnlyTransaction(); Optional<Tenants> potentialTenants = DataStoreHelper.readFromDs(LogicalDatastoreType.OPERATIONAL, TENANTS_IID, rTx); if (potentialTenants.isPresent() && potentialTenants.get().getTenant() != null) { for (Tenant tenant : potentialTenants.get().getTenant()) { resolvedTenants.put(tenant.getId(), new IndexedTenant(tenant)); } // TODO we should read resolved-policy from DS instead of this policyInfo = resolvePolicy(resolvedTenants); } rTx.close(); } }
public void processIntentToGBP() { if (!this.verifyIntent()) { return; } TenantBuilder tenantBuilder = this.getTenant(); if (tenantBuilder == null) { return; } else { Tenant tenant = tenantBuilder.build(); //TODO - Add modules to support tenant update and delete InstanceIdentifier<Tenant> tenantInstanceIdentifier = GBPRendererHelper.createTenantIid(tenant.getId()); mdsalUtils.put(LogicalDatastoreType.CONFIGURATION, tenantInstanceIdentifier, tenant); LOG.info("Policy tenant successfully inserted into the config store"); } }
@VisibleForTesting void executeEvent(final AsyncDataChangeEvent<InstanceIdentifier<?>, DataObject> change) { // Remove for (InstanceIdentifier<?> iid : change.getRemovedPaths()) { DataObject old = change.getOriginalData().get(iid); if (old == null) { continue; } if (old instanceof Tenant) { Tenant tenant = (Tenant) old; if (tenant.getId().equals(gbpTenantId)) { LOG.info("Removed gbp Tenant {} -- faas Tenant {}", gbpTenantId.getValue(), faasTenantId.getValue()); this.policyManager.removeTenantLogicalNetwork(gbpTenantId, faasTenantId); } } } } }
if (l3Context != null && localSubnet.getVirtualRouterIp() != null) { MacAddress matcherMacAddress = utils.routerPortMac(l3Context, localSubnet.getVirtualRouterIp(), tenant.getTenant().getId()); OfOverlayContext context = gatewayEp.getAugmentation(OfOverlayContext.class); if (EndpointManager.isInternal(gatewayEp, tenant.getExternalImplicitGroups())) {
TenantId tenantId = rg.getContractTenant().getId(); IndexedTenant tenant = ctx.getTenant(tenantId); for (Direction direction : new Direction[] {Direction.In, Direction.Out}) {
L3Context l3Context = utils.getL3ContextForSubnet(indexedTenant, subnet); if (l3Context != null) { int contextOrdinal = OrdinalFactory.getContextOrdinal(tenant.getId(), l3Context.getId()); MacAddress routerMac = utils.routerPortMac(l3Context, subnet.getVirtualRouterIp(), indexedTenant.getTenant().getId()); if (routerMac != null) { if (subnet.getVirtualRouterIp().getIpv4Address() == null