use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeBuilder in project openflowplugin by opendaylight.
the class SyncPlanPushStrategyIncrementalImplTest method testUpdateTableFeatures.
@Test
public void testUpdateTableFeatures() throws Exception {
Mockito.when(tableCommitter.update(Matchers.<InstanceIdentifier<TableFeatures>>any(), Matchers.isNull(TableFeatures.class), tableFeaturesCaptor.capture(), Matchers.same(NODE_IDENT))).thenReturn(RpcResultBuilder.success(new UpdateTableOutputBuilder().build()).buildFuture());
final FlowCapableNode operational = new FlowCapableNodeBuilder().setTable(Collections.singletonList(new TableBuilder().setId((short) 1).build())).setTableFeatures(Collections.singletonList(new TableFeaturesBuilder().setName("test table features").setTableId((short) 1).build())).build();
final ListenableFuture<RpcResult<Void>> result = syncPlanPushStrategy.updateTableFeatures(NODE_IDENT, operational);
Assert.assertTrue(result.isDone());
Assert.assertTrue(result.get().isSuccessful());
final List<TableFeatures> groupCaptorAllValues = tableFeaturesCaptor.getAllValues();
// TODO: uncomment when enabled in impl
// Assert.assertEquals(1, groupCaptorAllValues.size());
// Assert.assertEquals("test table features", groupCaptorAllValues.get(0).getName());
// Assert.assertEquals(1, groupCaptorAllValues.get(0).getTableId().intValue());
Mockito.verify(flowCapableTxService).sendBarrier(Matchers.<SendBarrierInput>any());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeBuilder in project openflowplugin by opendaylight.
the class FRMTest method addFlowCapableNode.
public void addFlowCapableNode(NodeKey nodeKey) {
Nodes nodes = new NodesBuilder().setNode(Collections.<Node>emptyList()).build();
FlowCapableNodeBuilder fcnBuilder = new FlowCapableNodeBuilder();
NodeBuilder nodeBuilder = new NodeBuilder();
nodeBuilder.setKey(nodeKey);
nodeBuilder.addAugmentation(FlowCapableNode.class, fcnBuilder.build());
WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
writeTx.put(LogicalDatastoreType.OPERATIONAL, InstanceIdentifier.create(Nodes.class), nodes);
InstanceIdentifier<Node> flowNodeIdentifier = InstanceIdentifier.create(Nodes.class).child(Node.class, nodeKey);
writeTx.put(LogicalDatastoreType.OPERATIONAL, flowNodeIdentifier, nodeBuilder.build());
writeTx.put(LogicalDatastoreType.CONFIGURATION, InstanceIdentifier.create(Nodes.class), nodes);
writeTx.put(LogicalDatastoreType.CONFIGURATION, flowNodeIdentifier, nodeBuilder.build());
assertCommit(writeTx.submit());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeBuilder in project openflowplugin by opendaylight.
the class DeviceFlowRegistryImplTest method testFill.
@Test
public void testFill() throws Exception {
final InstanceIdentifier<FlowCapableNode> path = nodeInstanceIdentifier.augmentation(FlowCapableNode.class);
final Flow flow = new FlowBuilder().setTableId((short) 1).setPriority(10).setCookie(new FlowCookie(BigInteger.TEN)).setId(new FlowId("HELLO")).build();
final Table table = new TableBuilder().setFlow(Collections.singletonList(flow)).build();
final FlowCapableNode flowCapableNode = new FlowCapableNodeBuilder().setTable(Collections.singletonList(table)).build();
final Map<FlowRegistryKey, FlowDescriptor> allFlowDescriptors = fillRegistry(path, flowCapableNode);
key = FlowRegistryKeyFactory.create(OFConstants.OFP_VERSION_1_3, flow);
InOrder order = inOrder(dataBroker, readOnlyTransaction);
order.verify(dataBroker).newReadOnlyTransaction();
order.verify(readOnlyTransaction).read(LogicalDatastoreType.CONFIGURATION, path);
order.verify(dataBroker).newReadOnlyTransaction();
order.verify(readOnlyTransaction).read(LogicalDatastoreType.OPERATIONAL, path);
assertTrue(allFlowDescriptors.containsKey(key));
deviceFlowRegistry.addMark(key);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeBuilder in project openflowplugin by opendaylight.
the class DeviceFlowRegistryImplTest method testFailedFill.
@Test
public void testFailedFill() throws Exception {
final InstanceIdentifier<FlowCapableNode> path = nodeInstanceIdentifier.augmentation(FlowCapableNode.class);
fillRegistry(path, null);
fillRegistry(path, new FlowCapableNodeBuilder().setTable(null).build());
fillRegistry(path, new FlowCapableNodeBuilder().setTable(Collections.singletonList(null)).build());
fillRegistry(path, new FlowCapableNodeBuilder().setTable(Collections.singletonList(new TableBuilder().setFlow(null).build())).build());
fillRegistry(path, new FlowCapableNodeBuilder().setTable(Collections.singletonList(new TableBuilder().setFlow(Collections.singletonList(null)).build())).build());
fillRegistry(path, new FlowCapableNodeBuilder().setTable(Collections.singletonList(new TableBuilder().setFlow(Collections.singletonList(new FlowBuilder().setId(null).build())).build())).build());
verify(dataBroker, times(12)).newReadOnlyTransaction();
verify(readOnlyTransaction, times(6)).read(LogicalDatastoreType.CONFIGURATION, path);
verify(readOnlyTransaction, times(6)).read(LogicalDatastoreType.OPERATIONAL, path);
Assert.assertEquals(1, deviceFlowRegistry.getAllFlowDescriptors().size());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeBuilder in project genius by opendaylight.
the class MdSalUtilTest method addFlowCapableNode.
public void addFlowCapableNode(NodeKey nodeKey) throws ExecutionException, InterruptedException {
Nodes nodes = new NodesBuilder().setNode(Collections.emptyList()).build();
final InstanceIdentifier<Node> flowNodeIdentifier = InstanceIdentifier.create(Nodes.class).child(Node.class, nodeKey);
FlowCapableNodeBuilder fcnBuilder = new FlowCapableNodeBuilder();
NodeBuilder nodeBuilder = new NodeBuilder();
nodeBuilder.setKey(nodeKey);
nodeBuilder.addAugmentation(FlowCapableNode.class, fcnBuilder.build());
WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
writeTx.put(LogicalDatastoreType.OPERATIONAL, InstanceIdentifier.create(Nodes.class), nodes);
writeTx.put(LogicalDatastoreType.OPERATIONAL, flowNodeIdentifier, nodeBuilder.build());
writeTx.put(LogicalDatastoreType.CONFIGURATION, InstanceIdentifier.create(Nodes.class), nodes);
writeTx.put(LogicalDatastoreType.CONFIGURATION, flowNodeIdentifier, nodeBuilder.build());
assertCommit(writeTx.submit());
}
Aggregations