private CheckedFuture<Optional<AddressEndpoint>, ReadFailedException> findExistingEndPoint(final ContextId containment, final String address) { KeyedInstanceIdentifier<AddressEndpoint, AddressEndpointKey> addressEndpointPath = InstanceIdentifier.create(Endpoints.class).child(AddressEndpoints.class).child(AddressEndpoint.class, new AddressEndpointKey(address, IpPrefixType.class, containment, L3Context.class)); final ReadOnlyTransaction rTx = dataBroker.newReadOnlyTransaction(); final CheckedFuture<Optional<AddressEndpoint>, ReadFailedException> read = rTx.read( LogicalDatastoreType.OPERATIONAL, addressEndpointPath); Futures.addCallback(read, SxpListenerUtil.createTxCloseCallback(rTx)); return read; }
public static AddressEndpointKey addressEndpointKey(RendererEndpointKey fromKey) { return new AddressEndpointKey(fromKey.getAddress(), fromKey.getAddressType(), fromKey.getContextId(), fromKey.getContextType()); }
private void registerBaseEndpointAndStoreMapping(List<AddressEndpointReg> addrEpRegs, Port port, WriteTransaction wTx) { RegisterEndpointInput regBaseEpInput = new RegisterEndpointInputBuilder().setAddressEndpointReg(addrEpRegs) .build(); boolean isRegisteredBaseEndpoint = epRegistrator.registerEndpoint(regBaseEpInput); if (!isRegisteredBaseEndpoint) { LOG.error("Failed to register an address endpoint: {}", addrEpRegs); return; } for (AddressEndpointReg addrEpReg : addrEpRegs) { if (MappingUtils.L2_BRDIGE_DOMAIN.equals(addrEpReg.getContextType())) { UniqueId portId = new UniqueId(port.getUuid().getValue()); LOG.trace("Adding Port-BaseEndpoint mapping for port {} (device owner {}) and endpoint {}", port.getUuid()); AddressEndpointKey addrEpKey = new AddressEndpointKey(addrEpReg.getAddress(), addrEpReg.getAddressType(), addrEpReg.getContextId(), addrEpReg.getContextType()); addBaseEndpointMappings(addrEpKey, portId, wTx); } } }
rwTx.merge(LogicalDatastoreType.CONFIGURATION, L2L3IidFactory.subnetIid(tenantId, subnetDomain.getNetworkDomainId()), subnetDomain); AddressEndpointKey addrEpKey = new AddressEndpointKey(port.getMacAddress().getValue(), MacAddressType.class, new ContextId(port.getNetworkId().getValue()), MappingUtils.L2_BRDIGE_DOMAIN); UniqueId portId = new UniqueId(port.getUuid().getValue());