use of Nodes.Node in project openflowplugin by opendaylight.
the class TransactionChainManagerTest method testSubmitTransactionFailed.
@Test
public void testSubmitTransactionFailed() throws Exception {
Mockito.when(writeTx.submit()).thenReturn(Futures.<Void, TransactionCommitFailedException>immediateFailedCheckedFuture(new TransactionCommitFailedException("mock")));
final Node data = new NodeBuilder().setId(nodeId).build();
txChainManager.initialSubmitWriteTransaction();
txChainManager.writeToTransaction(LogicalDatastoreType.CONFIGURATION, path, data, false);
txChainManager.submitTransaction();
Mockito.verify(txChain).newReadWriteTransaction();
Mockito.verify(writeTx).put(LogicalDatastoreType.CONFIGURATION, path, data, false);
Mockito.verify(writeTx).submit();
}
use of Nodes.Node in project openflowplugin by opendaylight.
the class TransactionChainManagerTest method testSubmitTransaction1.
/**
* test of {@link TransactionChainManager#submitTransaction()}: no submit, never enabled.
*/
@Test
public void testSubmitTransaction1() throws Exception {
final Node data = new NodeBuilder().setId(nodeId).build();
txChainManager.writeToTransaction(LogicalDatastoreType.CONFIGURATION, path, data, false);
txChainManager.submitTransaction();
Mockito.verify(txChain).newReadWriteTransaction();
Mockito.verify(writeTx).put(LogicalDatastoreType.CONFIGURATION, path, data, false);
Mockito.verify(writeTx, Mockito.never()).submit();
}
use of Nodes.Node in project openflowplugin by opendaylight.
the class TransactionChainManagerTest method testEnableCounter1.
/**
* Test of {@link TransactionChainManager#enableSubmit()}: no submit - counter is not active.
*/
@Test
public void testEnableCounter1() throws Exception {
final Node data = new NodeBuilder().setId(nodeId).build();
txChainManager.writeToTransaction(LogicalDatastoreType.CONFIGURATION, path, data, false);
txChainManager.writeToTransaction(LogicalDatastoreType.CONFIGURATION, path, data, false);
Mockito.verify(txChain).newReadWriteTransaction();
Mockito.verify(writeTx, Mockito.times(2)).put(LogicalDatastoreType.CONFIGURATION, path, data, false);
Mockito.verify(writeTx, Mockito.never()).submit();
}
use of Nodes.Node in project openflowplugin by opendaylight.
the class OF10DeviceInitializerTest method setUp.
@Before
public void setUp() throws Exception {
final KeyedInstanceIdentifier<Node, NodeKey> nodeInstanceIdentifier = DeviceStateUtil.createNodeInstanceIdentifier(new NodeId("openflow:1"));
deviceInitializer = new OF10DeviceInitializer();
when(featuresReply.getCapabilitiesV10()).thenReturn(capabilitiesV10);
when(featuresReply.getPhyPort()).thenReturn(Collections.singletonList(new PhyPortBuilder().setPortNo(42L).build()));
when(connectionContext.getFeatures()).thenReturn(featuresReply);
when(connectionContext.getOutboundQueueProvider()).thenReturn(outboundQueueProvider);
when(deviceContext.getDeviceState()).thenReturn(deviceState);
when(deviceInfo.getNodeInstanceIdentifier()).thenReturn(nodeInstanceIdentifier);
when(deviceContext.getDeviceInfo()).thenReturn(deviceInfo);
when(deviceContext.getMessageSpy()).thenReturn(messageSpy);
when(translatorLibrary.lookupTranslator(any())).thenReturn(messageTranslator);
when(deviceContext.oook()).thenReturn(translatorLibrary);
when(requestContext.getXid()).thenReturn(new Xid(42L));
when(requestContext.getFuture()).thenReturn(RpcResultBuilder.success().buildFuture());
when(deviceContext.createRequestContext()).thenReturn(requestContext);
when(deviceContext.getPrimaryConnectionContext()).thenReturn(connectionContext);
}
use of Nodes.Node in project openflowplugin by opendaylight.
the class NodeChangeListenerImpl method processAddedNode.
private void processAddedNode(final DataTreeModification<FlowCapableNode> modification) {
final InstanceIdentifier<FlowCapableNode> iiToNodeInInventory = modification.getRootPath().getRootIdentifier();
final NodeId nodeIdInTopology = provideTopologyNodeId(iiToNodeInInventory);
if (nodeIdInTopology != null) {
final InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node> iiToTopologyNode = provideIIToTopologyNode(nodeIdInTopology);
sendToTransactionChain(prepareTopologyNode(nodeIdInTopology, iiToNodeInInventory), iiToTopologyNode);
} else {
LOG.debug("Inventory node key is null. Data can't be written to topology");
}
}
Aggregations