@Deprecated private void removeTenantSubnet(TenantId tenantId, SubnetId subnetId, ReadWriteTransaction rwTx) { Optional<Subnet> potentialSubnet = DataStoreHelper.removeIfExists(LogicalDatastoreType.CONFIGURATION, IidFactory.subnetIid(tenantId, subnetId), rwTx); if (!potentialSubnet.isPresent()) { LOG.warn("Illegal state - subnet {} does not exist.", subnetId.getValue()); rwTx.cancel(); return; } } }
public void loadAll(List<Subnet> subnets, List<MappedSubnet> mpSubnets) { if (mpSubnets != null) { for (MappedSubnet mpSubnet : mpSubnets) { mappedSubnets.putIfAbsent(mpSubnet.getGbpSubnetId(), mpSubnet.getFaasSubnetId()); } } if (subnets != null) { for (Subnet subnet : subnets) { LOG.debug("Loading Subnet {}", subnet.getId().getValue()); UlnDatastoreApi.submitSubnetToDs(initSubnetBuilder(subnet).build()); } } }
private Uuid getFaasSubnetId(SubnetId subnetId) { Uuid val = mappedSubnets.get(subnetId); if (val != null) { return val; } Uuid faasSubnetId = null; if (FaasPolicyManager.isUUid(subnetId.getValue())) { faasSubnetId = new Uuid(subnetId.getValue()); } else { faasSubnetId = new Uuid(UUID.randomUUID().toString()); } mappedSubnets.putIfAbsent(subnetId, faasSubnetId); val = mappedSubnets.get(subnetId); MappedSubnetBuilder builder = new MappedSubnetBuilder(); builder.setFaasSubnetId(val); builder.setGbpSubnetId(subnetId); WriteTransaction wTx = dataProvider.newWriteOnlyTransaction(); MappedSubnet result = builder.build(); wTx.put(LogicalDatastoreType.OPERATIONAL, FaasIidFactory.mappedSubnetIid(gbpTenantId, subnetId), result); if (DataStoreHelper.submitToDs(wTx)) { LOG.debug("Cached in Datastore Mapped Subnet {}", result); } else { LOG.error("Couldn't Cache in Datastore Mapped Subnet {}", result); } return val; }
List<Subnet> getLocalSubnets(NodeId nodeId) { Collection<Endpoint> endpointsForNode = ctx.getEndpointManager().getEndpointsForNode(nodeId); List<Subnet> localSubnets = new ArrayList<>(); for (Endpoint endpoint : endpointsForNode) { HashSet<Subnet> subnets = getSubnets(endpoint.getTenant()); if (subnets.isEmpty()) { LOG.debug("No local subnets in tenant {} for EP {}.", endpoint.getTenant(), endpoint.getKey()); continue; } NetworkDomainId epNetworkContainment = getEPNetworkContainment(endpoint, ctx.getTenant(endpoint.getTenant())); for (Subnet subnet : subnets) { if (epNetworkContainment.getValue().equals(subnet.getId().getValue())) { localSubnets.add(subnet); } } } return localSubnets; }
if (dao instanceof Subnet) { Subnet subnet = (Subnet) dao; LOG.debug("Subnet {} is Created.", subnet.getId().getValue()); UlnDatastoreApi.submitSubnetToDs(initSubnetBuilder(subnet).build()); if (entry.getValue() instanceof Subnet) { Subnet subnet = (Subnet) entry.getValue(); LOG.debug("Subnet {} is Updated.", subnet.getId().getValue()); UlnDatastoreApi.submitSubnetToDs(initSubnetBuilder(subnet).build());
builder.setName(new Text(gbpSubnet.getId().getValue())); if (gbpSubnet.getDescription() != null) builder.setDescription(new Text("gbp-subnet: " + gbpSubnet.getDescription().getValue()));
&& subnet.getVirtualRouterIp().getIpv6Address() != null) { LOG.warn("IPv6 virtual router {} for subnet {} not supported", subnet.getVirtualRouterIp(), subnet.getId() .getValue()); return;