use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowUpdated in project openflowplugin by opendaylight.
the class FlowNotificationSupplierImplTest method testUpdate.
@Test
public void testUpdate() {
final FlowUpdated notification = notifSupplierImpl.updateNotification(createTestFlow(), createTestFlowPath());
assertNotNull(notification);
assertEquals(FLOW_ID, notification.getFlowRef().getValue().firstKeyOf(Flow.class, FlowKey.class).getId().getValue());
assertEquals(FLOW_TABLE_ID, notification.getFlowRef().getValue().firstKeyOf(Table.class, TableKey.class).getId());
assertEquals(FLOW_NODE_ID, notification.getNode().getValue().firstKeyOf(Node.class, NodeKey.class).getId().getValue());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowUpdated in project openflowplugin by opendaylight.
the class FlowNotificationSupplierImpl method updateNotification.
@Override
public FlowUpdated updateNotification(final Flow flow, final InstanceIdentifier<Flow> path) {
Preconditions.checkArgument(flow != null);
Preconditions.checkArgument(path != null);
final FlowUpdatedBuilder builder = new FlowUpdatedBuilder(flow);
builder.setFlowRef(new FlowRef(path));
builder.setNode(createNodeRef(path));
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowUpdated in project openflowplugin by opendaylight.
the class FlowForwarderTest method updateTest.
@Test
public void updateTest() throws Exception {
Mockito.when(salFlowService.updateFlow(updateFlowInputCpt.capture())).thenReturn(RpcResultBuilder.success(new UpdateFlowOutputBuilder().setTransactionId(new TransactionId(BigInteger.ONE)).build()).buildFuture());
final Instructions originalInstructions = new InstructionsBuilder().setInstruction(Collections.singletonList(new InstructionBuilder().setInstruction(new ApplyActionsCaseBuilder().setApplyActions(new ApplyActionsBuilder().setAction(Collections.singletonList(new ActionBuilder().setAction(new DropActionCaseBuilder().build()).build())).build()).build()).build())).build();
final Flow flowUpdated = new FlowBuilder(flow).setInstructions(originalInstructions).setMatch(new MatchBuilder().build()).build();
final Future<RpcResult<UpdateFlowOutput>> updateResult = flowForwarder.update(flowPath, flow, flowUpdated, flowCapableNodePath);
Mockito.verify(salFlowService).updateFlow(Matchers.<UpdateFlowInput>any());
final UpdateFlowInput updateFlowInput = updateFlowInputCpt.getValue();
final OriginalFlow flowOrigInput = updateFlowInput.getOriginalFlow();
final UpdatedFlow flowInput = updateFlowInput.getUpdatedFlow();
Assert.assertEquals(nodePath, updateFlowInput.getNode().getValue());
Assert.assertEquals(flowPath, updateFlowInput.getFlowRef().getValue());
Assert.assertEquals(2, flowInput.getTableId().shortValue());
Assert.assertEquals(emptyMatch, flowInput.getMatch());
Assert.assertEquals(originalInstructions, flowInput.getInstructions());
Assert.assertEquals(true, flowInput.isStrict());
Assert.assertEquals(2, flowOrigInput.getTableId().shortValue());
Assert.assertEquals(emptyMatch, flowOrigInput.getMatch());
Assert.assertEquals(null, flowOrigInput.getInstructions());
Assert.assertEquals(true, flowOrigInput.isStrict());
final RpcResult<UpdateFlowOutput> updateFlowOutputRpcResult = updateResult.get(2, TimeUnit.SECONDS);
Assert.assertTrue(updateFlowOutputRpcResult.isSuccessful());
final UpdateFlowOutput resultValue = updateFlowOutputRpcResult.getResult();
Assert.assertEquals(1, resultValue.getTransactionId().getValue().intValue());
}
Aggregations