@Test public void l2ChildHasTwoL3Parents_swapped_order() { locationProvider.createLocationForVppEndpoint(vppEndpointBuilder(MAC_KEY_23_45_VPP, NODE_1, INTF_NAME)); l2ChildHasTwoIpParents(false); }
@Override public ListenableFuture<Void> createLocationForVppEndpoint(VppEndpoint vppEndpoint) { try { THREAD_LOCK.lock(); vppEndpoints.put(vppEndpoint.getKey(), vppEndpoint); Collection<AddressEndpoint> cachedAddrEp = pendingAddrEndpoints.row(vppEndpoint.getKey()).values(); if (cachedAddrEp == null || cachedAddrEp.isEmpty()) { return Futures.immediateFuture(null); } ReadWriteTransaction rwTx = syncedChain.newReadWriteTransaction(); List<AddressEndpoint> result = cachedAddrEp.stream().filter(ep -> canCreateLocation(ep)).collect(Collectors.toList()); result.forEach(ep -> syncEndpointLocation(rwTx, ep)); result.forEach(ep -> pendingAddrEndpoints.remove(vppEndpoint.getKey(), ep.getKey())); syncedChain.submitNow(rwTx); } catch (Exception e) { LOG.error("Failed to resolve location for vpp endpoint {}. {}", vppEndpoint.getKey(), e); } finally { THREAD_LOCK.unlock(); } return Futures.immediateFuture(null); }
VppEndpointLocationProvider implements ClusteredDataTreeChangeListener<AddressEndpoint>, VPPLocationProvider, AutoCloseable { @Override public ListenableFuture<Void> createLocationForVppEndpoint(VppEndpoint vppEndpoint) { try { THREAD_LOCK.lock(); vppEndpoints.put(vppEndpoint.getKey(), vppEndpoint); Collection<AddressEndpoint> cachedAddrEp = pendingAddrEndpoints.row(vppEndpoint.getKey()).values(); if (cachedAddrEp == null || cachedAddrEp.isEmpty()) { return Futures.immediateFuture(null); } ReadWriteTransaction rwTx = syncedChain.newReadWriteTransaction(); List<AddressEndpoint> result = cachedAddrEp.stream().filter(ep -> canCreateLocation(ep)).collect(Collectors.toList()); result.forEach(ep -> syncEndpointLocation(rwTx, ep)); result.forEach(ep -> pendingAddrEndpoints.remove(vppEndpoint.getKey(), ep.getKey())); syncedChain.submitNow(rwTx); } catch (Exception e) { LOG.error("Failed to resolve location for vpp endpoint {}. {}", vppEndpoint.getKey(), e); } finally { THREAD_LOCK.unlock(); } return Futures.immediateFuture(null); } }
VppEndpointLocationProvider implements ClusteredDataTreeChangeListener<AddressEndpoint>, VPPLocationProvider, AutoCloseable { @Override public ListenableFuture<Void> createLocationForVppEndpoint(VppEndpoint vppEndpoint) { try { THREAD_LOCK.lock(); vppEndpoints.put(vppEndpoint.getKey(), vppEndpoint); Collection<AddressEndpoint> cachedAddrEp = pendingAddrEndpoints.row(vppEndpoint.getKey()).values(); if (cachedAddrEp == null || cachedAddrEp.isEmpty()) { return Futures.immediateFuture(null); } ReadWriteTransaction rwTx = syncedChain.newReadWriteTransaction(); List<AddressEndpoint> result = cachedAddrEp.stream().filter(ep -> canCreateLocation(ep)).collect(Collectors.toList()); result.forEach(ep -> syncEndpointLocation(rwTx, ep)); result.forEach(ep -> pendingAddrEndpoints.remove(vppEndpoint.getKey(), ep.getKey())); syncedChain.submitNow(rwTx); } catch (Exception e) { LOG.error("Failed to resolve location for vpp endpoint {}. {}", vppEndpoint.getKey(), e); } finally { THREAD_LOCK.unlock(); } return Futures.immediateFuture(null); } VppEndpointLocationProvider(DataBroker dataProvider); }
VppEndpointLocationProvider implements ClusteredDataTreeChangeListener<AddressEndpoint>, VPPLocationProvider, AutoCloseable { @Override public ListenableFuture<Void> createLocationForVppEndpoint(VppEndpoint vppEndpoint) { try { THREAD_LOCK.lock(); vppEndpoints.put(vppEndpoint.getKey(), vppEndpoint); Collection<AddressEndpoint> cachedAddrEp = pendingAddrEndpoints.row(vppEndpoint.getKey()).values(); if (cachedAddrEp == null || cachedAddrEp.isEmpty()) { return Futures.immediateFuture(null); } ReadWriteTransaction rwTx = syncedChain.newReadWriteTransaction(); List<AddressEndpoint> result = cachedAddrEp.stream().filter(ep -> canCreateLocation(ep)).collect(Collectors.toList()); result.forEach(ep -> syncEndpointLocation(rwTx, ep)); result.forEach(ep -> pendingAddrEndpoints.remove(vppEndpoint.getKey(), ep.getKey())); syncedChain.submitNow(rwTx); } catch (Exception e) { LOG.error("Failed to resolve location for vpp endpoint {}. {}", vppEndpoint.getKey(), e); } finally { THREAD_LOCK.unlock(); } return Futures.immediateFuture(null); } VppEndpointLocationProvider(DataBroker dataProvider); @Override void onDataTreeChanged(Collection<DataTreeModification<AddressEndpoint>> change); @Override ListenableFuture<Void> createLocationForVppEndpoint(VppEndpoint vppEndpoint); @Override ListenableFuture<Void> deleteLocationForVppEndpoint(VppEndpoint vppEndpoint); @Override ListenableFuture<Void> replaceLocationForEndpoint(@Nonnull ExternalLocationCase location,
            @Nonnull AddressEndpointWithLocationKey addrEpWithLocKey); @Override void close(); }
VppEndpointLocationProvider implements ClusteredDataTreeChangeListener<AddressEndpoint>, VPPLocationProvider, AutoCloseable { @Override public ListenableFuture<Void> createLocationForVppEndpoint(VppEndpoint vppEndpoint) { try { THREAD_LOCK.lock(); vppEndpoints.put(vppEndpoint.getKey(), vppEndpoint); Collection<AddressEndpoint> cachedAddrEp = pendingAddrEndpoints.row(vppEndpoint.getKey()).values(); if (cachedAddrEp == null || cachedAddrEp.isEmpty()) { return Futures.immediateFuture(null); } ReadWriteTransaction rwTx = syncedChain.newReadWriteTransaction(); List<AddressEndpoint> result = cachedAddrEp.stream().filter(ep -> canCreateLocation(ep)).collect(Collectors.toList()); result.forEach(ep -> syncEndpointLocation(rwTx, ep)); result.forEach(ep -> pendingAddrEndpoints.remove(vppEndpoint.getKey(), ep.getKey())); syncedChain.submitNow(rwTx); } catch (Exception e) { LOG.error("Failed to resolve location for vpp endpoint {}. {}", vppEndpoint.getKey(), e); } finally { THREAD_LOCK.unlock(); } return Futures.immediateFuture(null); } VppEndpointLocationProvider(DataBroker dataProvider); @Override void onDataTreeChanged(Collection<DataTreeModification<AddressEndpoint>> change); @Override ListenableFuture<Void> createLocationForVppEndpoint(VppEndpoint vppEndpoint); @Override ListenableFuture<Void> deleteLocationForVppEndpoint(VppEndpoint vppEndpoint); @Override ListenableFuture<Void> replaceLocationForEndpoint(@Nonnull ExternalLocationCase location,
            @Nonnull AddressEndpointWithLocationKey addrEpWithLocKey); @Override void close(); static final ProviderName VPP_ENDPOINT_LOCATION_PROVIDER; static final long PROVIDER_PRIORITY; }