@VisibleForTesting void addTenantAndResolvePolicy(Tenant unresolvedTenant) { Tenant t = InheritanceUtils.resolveTenant(unresolvedTenant); IndexedTenant it = new IndexedTenant(t); resolvedTenants.put(unresolvedTenant.getId(), it); policyInfo = resolvePolicy(resolvedTenants); }
HashSet<Subnet> getSubnets(TenantId tenantId) { IndexedTenant indexedTenant = ctx.getTenant(tenantId); if (indexedTenant != null && indexedTenant.getTenant() != null) { ForwardingContext forwardingContext = indexedTenant.getTenant().getForwardingContext(); if (forwardingContext != null && forwardingContext.getSubnet() != null) { return new HashSet<>(forwardingContext.getSubnet()); } } return new HashSet<>(); }
List<Subnet> subnets = null; if (tenant != null) { contracts = tenant.getPolicy().getContract(); subnets = tenant.getForwardingContext().getSubnet();
.getPolicy() .getExternalImplicitGroup(); boolean performNat = false;
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"); } }
public static Subnet resolveSubnetForIpv4Address(IndexedTenant t, Ipv4Address ipv4Addr) { Preconditions.checkNotNull(ipv4Addr); if (t == null || t.getTenant() == null || t.getTenant().getForwardingContext() == null) { return null; } List<Subnet> subnets = t.getTenant().getForwardingContext().getSubnet(); if (subnets != null) { for (Subnet subnet : subnets) { if (belongsToSubnet(ipv4Addr, subnet.getIpPrefix().getIpv4Prefix())) { return subnet; } } } return null; }
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(); } }
if (tenant != null && tenant.getForwardingContext() != null && tenant.getForwardingContext().getL2FloodDomain() != null) { List<L2FloodDomain> floodDomains = tenant.getForwardingContext().getL2FloodDomain(); flows.popVlanTagsOnExternalPortFlows(ingressNatId, connectorId, floodDomains, POP_VLAN_TAG_EXTERNAL, ofWriter);
@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