@Test public void test_EndpointNetworkChange_NoEP() throws Exception { writeBaseNetworkElements(); EndpointNetwork en = createEndpointNetwork(L3_CONTEXT_ID, IP_V4_NETWORK_ADDRESS_2); InstanceIdentifier<EndpointNetwork> iid = InstanceIdentifier.builder(NetworkElements.class) .child(NetworkElement.class, new NetworkElementKey(createNetworkElementIid(NODE_ID_1))) .child(Interface.class, new InterfaceKey(CONNECTOR_ID_1)) .child(EndpointNetwork.class, new EndpointNetworkKey(en.getKey())) .build(); InstanceIdentifier<EndpointNetwork> removeIid = InstanceIdentifier.builder(NetworkElements.class) .child(NetworkElement.class, new NetworkElementKey(createNetworkElementIid(NODE_ID_1))) .child(Interface.class, new InterfaceKey(CONNECTOR_ID_1)) .child(EndpointNetwork.class, new EndpointNetworkKey( new IpPrefix(new Ipv4Prefix(IP_V4_NETWORK_ADDRESS_1)),new ContextId(L3_CONTEXT_ID))) .build(); WriteTransaction wtx = dataBroker.newWriteOnlyTransaction(); wtx.delete(LogicalDatastoreType.CONFIGURATION, removeIid); wtx.put(LogicalDatastoreType.CONFIGURATION, iid, en); wtx.submit().get(); NetworkElements nes = neProvider.getNetworkElements(); assertNotNull(nes.getNetworkElement()); assertEquals(1, nes.getNetworkElement().size()); assertNotNull(nes.getNetworkElement().get(0).getInterface()); assertEquals(1, nes.getNetworkElement().get(0).getInterface().size()); assertNotNull(nes.getNetworkElement().get(0).getInterface().get(0).getEndpointNetwork()); assertEquals(1, nes.getNetworkElement().get(0).getInterface().get(0).getEndpointNetwork().size()); assertEquals(en, nes.getNetworkElement().get(0).getInterface().get(0).getEndpointNetwork().get(0)); verifyEmptyLocations(); }
@VisibleForTesting synchronized NetworkElements getNetworkElements() { return networkElements; }
NeLocationProvider implements ClusteredDataTreeChangeListener<NetworkElements>, AutoCloseable { @VisibleForTesting synchronized NetworkElements getNetworkElements() { return networkElements; } }
NeLocationProvider implements ClusteredDataTreeChangeListener<NetworkElements>, AutoCloseable { @VisibleForTesting synchronized NetworkElements getNetworkElements() { return networkElements; } NeLocationProvider(DataBroker dataBroker); }
NeLocationProvider implements ClusteredDataTreeChangeListener<NetworkElements>, AutoCloseable { @VisibleForTesting synchronized NetworkElements getNetworkElements() { return networkElements; } NeLocationProvider(DataBroker dataBroker); @Override void close(); synchronized void onEndpointsChange(Collection<DataTreeModification<AddressEndpoint>> changes); @Override synchronized void onDataTreeChanged(Collection<DataTreeModification<NetworkElements>> changes); }
NeLocationProvider implements ClusteredDataTreeChangeListener<NetworkElements>, AutoCloseable { @VisibleForTesting synchronized NetworkElements getNetworkElements() { return networkElements; } NeLocationProvider(DataBroker dataBroker); @Override void close(); synchronized void onEndpointsChange(Collection<DataTreeModification<AddressEndpoint>> changes); @Override synchronized void onDataTreeChanged(Collection<DataTreeModification<NetworkElements>> changes); static final String NE_LOCATION_PROVIDER_NAME; }