use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.topology.inventory.rev131030.InventoryNode in project openflowplugin by opendaylight.
the class NodeChangeListenerImpl method prepareTopologyNode.
private static org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node prepareTopologyNode(final NodeId nodeIdInTopology, final InstanceIdentifier<FlowCapableNode> iiToNodeInInventory) {
final InventoryNode inventoryNode = new InventoryNodeBuilder().setInventoryNodeRef(new NodeRef(iiToNodeInInventory.firstIdentifierOf(Node.class))).build();
final NodeBuilder topologyNodeBuilder = new NodeBuilder();
topologyNodeBuilder.setNodeId(nodeIdInTopology);
topologyNodeBuilder.addAugmentation(InventoryNode.class, inventoryNode);
return topologyNodeBuilder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.topology.inventory.rev131030.InventoryNode in project openflowplugin by opendaylight.
the class NodeChangeListenerImplTest method testOnNodeAdded.
@Test
public void testOnNodeAdded() {
org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey nodeKey = newInvNodeKey("node1");
InstanceIdentifier<?> invNodeID = InstanceIdentifier.create(Nodes.class).child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node.class, nodeKey);
ReadWriteTransaction mockTx = mock(ReadWriteTransaction.class);
CountDownLatch submitLatch = setupStubbedSubmit(mockTx);
doReturn(mockTx).when(mockTxChain).newReadWriteTransaction();
DataTreeModification dataTreeModification = setupDataTreeChange(WRITE, invNodeID);
nodeChangeListener.onDataTreeChanged(Collections.singleton(dataTreeModification));
waitForSubmit(submitLatch);
ArgumentCaptor<Node> mergedNode = ArgumentCaptor.forClass(Node.class);
NodeId expNodeId = new NodeId("node1");
verify(mockTx).merge(eq(LogicalDatastoreType.OPERATIONAL), eq(topologyIID.child(Node.class, new NodeKey(expNodeId))), mergedNode.capture(), eq(true));
assertEquals("getNodeId", expNodeId, mergedNode.getValue().getNodeId());
InventoryNode augmentation = mergedNode.getValue().getAugmentation(InventoryNode.class);
assertNotNull("Missing augmentation", augmentation);
assertEquals("getInventoryNodeRef", new NodeRef(invNodeID), augmentation.getInventoryNodeRef());
}
Aggregations