use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.topology.inventory.rev131030.InventoryNodeConnector in project openflowplugin by opendaylight.
the class TerminationPointChangeListenerImpl method prepareTopologyTerminationPoint.
private static TerminationPoint prepareTopologyTerminationPoint(final TpId terminationPointIdInTopology, final InstanceIdentifier<FlowCapableNodeConnector> iiToNodeInInventory) {
final InventoryNodeConnector inventoryNodeConnector = new InventoryNodeConnectorBuilder().setInventoryNodeConnectorRef(new NodeConnectorRef(iiToNodeInInventory.firstIdentifierOf(NodeConnector.class))).build();
final TerminationPointBuilder terminationPointBuilder = new TerminationPointBuilder();
terminationPointBuilder.setTpId(terminationPointIdInTopology);
terminationPointBuilder.addAugmentation(InventoryNodeConnector.class, inventoryNodeConnector);
return terminationPointBuilder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.topology.inventory.rev131030.InventoryNodeConnector in project openflowplugin by opendaylight.
the class TerminationPointChangeListenerImplTest method testOnNodeConnectorUpdated.
@Test
public void testOnNodeConnectorUpdated() {
org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey nodeKey = newInvNodeKey("node1");
org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey ncKey = newInvNodeConnKey("tp1");
InstanceIdentifier<?> invNodeConnID = newNodeConnID(nodeKey, ncKey);
ReadWriteTransaction mockTx = mock(ReadWriteTransaction.class);
CountDownLatch submitLatch = setupStubbedSubmit(mockTx);
doReturn(mockTx).when(mockTxChain).newReadWriteTransaction();
DataTreeModification dataTreeModification = setupDataTreeChange(WRITE, invNodeConnID);
terminationPointListener.onDataTreeChanged(Collections.singleton(dataTreeModification));
waitForSubmit(submitLatch);
ArgumentCaptor<TerminationPoint> mergedNode = ArgumentCaptor.forClass(TerminationPoint.class);
NodeId expNodeId = new NodeId("node1");
TpId expTpId = new TpId("tp1");
InstanceIdentifier<TerminationPoint> expTpPath = topologyIID.child(Node.class, new NodeKey(expNodeId)).child(TerminationPoint.class, new TerminationPointKey(expTpId));
verify(mockTx).merge(eq(LogicalDatastoreType.OPERATIONAL), eq(expTpPath), mergedNode.capture(), eq(true));
assertEquals("getTpId", expTpId, mergedNode.getValue().getTpId());
InventoryNodeConnector augmentation = mergedNode.getValue().getAugmentation(InventoryNodeConnector.class);
assertNotNull("Missing augmentation", augmentation);
assertEquals("getInventoryNodeConnectorRef", new NodeConnectorRef(invNodeConnID), augmentation.getInventoryNodeConnectorRef());
}
Aggregations