use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.LinkRemovedBuilder in project openflowplugin by opendaylight.
the class FlowCapableTopologyExporterTest method testOnLinkRemovedLinkDoesNotExist.
@Test
public void testOnLinkRemovedLinkDoesNotExist() {
org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey sourceNodeKey = newInvNodeKey("sourceNode");
org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey sourceNodeConnKey = newInvNodeConnKey("sourceTP");
InstanceIdentifier<?> sourceConnID = newNodeConnID(sourceNodeKey, sourceNodeConnKey);
org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey destNodeKey = newInvNodeKey("destNode");
org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey destNodeConnKey = newInvNodeConnKey("destTP");
InstanceIdentifier<?> destConnID = newNodeConnID(destNodeKey, destNodeConnKey);
ReadWriteTransaction mockTx = mock(ReadWriteTransaction.class);
final CountDownLatch submitLatch = setupStubbedSubmit(mockTx);
doReturn(mockTx).when(mockTxChain).newReadWriteTransaction();
doReturn(Futures.immediateCheckedFuture(Optional.<Link>absent())).when(mockTx).read(LogicalDatastoreType.OPERATIONAL, topologyIID.child(Link.class, new LinkKey(new LinkId(sourceNodeConnKey.getId()))));
exporter.onLinkRemoved(new LinkRemovedBuilder().setSource(new NodeConnectorRef(sourceConnID)).setDestination(new NodeConnectorRef(destConnID)).build());
waitForSubmit(submitLatch);
verify(mockTx, never()).delete(LogicalDatastoreType.OPERATIONAL, topologyIID.child(Link.class, new LinkKey(new LinkId(sourceNodeConnKey.getId()))));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.LinkRemovedBuilder in project openflowplugin by opendaylight.
the class FlowCapableTopologyExporterTest method testOnLinkRemoved.
@Test
public void testOnLinkRemoved() {
org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey sourceNodeKey = newInvNodeKey("sourceNode");
org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey sourceNodeConnKey = newInvNodeConnKey("sourceTP");
InstanceIdentifier<?> sourceConnID = newNodeConnID(sourceNodeKey, sourceNodeConnKey);
org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey destNodeKey = newInvNodeKey("destNode");
org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey destNodeConnKey = newInvNodeConnKey("destTP");
InstanceIdentifier<?> destConnID = newNodeConnID(destNodeKey, destNodeConnKey);
Link link = newLink(sourceNodeConnKey.getId().getValue(), newSourceTp(sourceNodeConnKey.getId().getValue()), newDestTp(destNodeConnKey.getId().getValue()));
ReadWriteTransaction mockTx = mock(ReadWriteTransaction.class);
final CountDownLatch submitLatch = setupStubbedSubmit(mockTx);
doReturn(mockTx).when(mockTxChain).newReadWriteTransaction();
doReturn(Futures.immediateCheckedFuture(Optional.of(link))).when(mockTx).read(LogicalDatastoreType.OPERATIONAL, topologyIID.child(Link.class, new LinkKey(new LinkId(sourceNodeConnKey.getId()))));
exporter.onLinkRemoved(new LinkRemovedBuilder().setSource(new NodeConnectorRef(sourceConnID)).setDestination(new NodeConnectorRef(destConnID)).build());
waitForSubmit(submitLatch);
verify(mockTx).delete(LogicalDatastoreType.OPERATIONAL, topologyIID.child(Link.class, new LinkKey(new LinkId(sourceNodeConnKey.getId()))));
}
Aggregations