use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcrep.message.pcrep.message.replies.Result in project openflowplugin by opendaylight.
the class OpendaylightDirectStatisticsServiceImplTest method testGetFlowStatisticsFail.
@Test
public void testGetFlowStatisticsFail() throws Exception {
RpcResult<GetFlowStatisticsOutput> result = emptyService.getFlowStatistics(getFlowStatisticsInput).get();
assertFalse(result.isSuccessful());
for (RpcError error : result.getErrors()) {
assertTrue(error.getMessage().contains(AbstractFlowDirectStatisticsService.class.getSimpleName()));
}
verify(flowDirectStatisticsService, times(0)).handleAndReply(getFlowStatisticsInput);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcrep.message.pcrep.message.replies.Result in project openflowplugin by opendaylight.
the class OpendaylightDirectStatisticsServiceImplTest method testGetMeterStatisticsFail.
@Test
public void testGetMeterStatisticsFail() throws Exception {
RpcResult<GetMeterStatisticsOutput> result = emptyService.getMeterStatistics(getMeterStatisticsInput).get();
assertFalse(result.isSuccessful());
for (RpcError error : result.getErrors()) {
assertTrue(error.getMessage().contains(AbstractMeterDirectStatisticsService.class.getSimpleName()));
}
verify(meterDirectStatisticsService, times(0)).handleAndReply(getMeterStatisticsInput);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcrep.message.pcrep.message.replies.Result in project openflowplugin by opendaylight.
the class SalFlowsBatchServiceImplTest method testRemoveFlowsBatch_failed.
@Test
public void testRemoveFlowsBatch_failed() throws Exception {
Mockito.when(salFlowService.removeFlow(Matchers.<RemoveFlowInput>any())).thenReturn(RpcResultBuilder.<RemoveFlowOutput>failed().withError(RpcError.ErrorType.APPLICATION, "flow-remove-fail-1").buildFuture());
final BatchRemoveFlows batchFlow1 = createEmptyBatchRemoveFlow(FLOW_ID_VALUE_1, 42);
final BatchRemoveFlows batchFlow2 = createEmptyBatchRemoveFlow(FLOW_ID_VALUE_2, 43);
final RemoveFlowsBatchInput input = new RemoveFlowsBatchInputBuilder().setNode(NODE_REF).setBarrierAfter(true).setBatchRemoveFlows(Lists.newArrayList(batchFlow1, batchFlow2)).build();
final Future<RpcResult<RemoveFlowsBatchOutput>> resultFuture = salFlowsBatchService.removeFlowsBatch(input);
Assert.assertTrue(resultFuture.isDone());
final RpcResult<RemoveFlowsBatchOutput> rpcResult = resultFuture.get();
Assert.assertFalse(rpcResult.isSuccessful());
final RemoveFlowsBatchOutput result = rpcResult.getResult();
Assert.assertEquals(2, result.getBatchFailedFlowsOutput().size());
Assert.assertEquals(FLOW_ID_VALUE_1, result.getBatchFailedFlowsOutput().get(0).getFlowId().getValue());
Assert.assertEquals(FLOW_ID_VALUE_2, result.getBatchFailedFlowsOutput().get(1).getFlowId().getValue());
final InOrder inOrder = Mockito.inOrder(salFlowService, transactionService);
inOrder.verify(salFlowService, Mockito.times(2)).removeFlow(removeFlowInputCpt.capture());
final List<RemoveFlowInput> allValues = removeFlowInputCpt.getAllValues();
Assert.assertEquals(2, allValues.size());
Assert.assertEquals(42, allValues.get(0).getPriority().longValue());
Assert.assertEquals(43, allValues.get(1).getPriority().longValue());
inOrder.verify(transactionService).sendBarrier(Matchers.<SendBarrierInput>any());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcrep.message.pcrep.message.replies.Result in project openflowplugin by opendaylight.
the class SingleLayerTableMultipartServiceTest method buildRequest.
@Test
public void buildRequest() throws Exception {
final UpdateTableInput input = new UpdateTableInputBuilder().setUpdatedTable(new UpdatedTableBuilder().setTableFeatures(Collections.singletonList(new TableFeaturesBuilder().setMaxEntries(MAX_ENTRIES).build())).build()).build();
final OfHeader ofHeader = service.buildRequest(DUMMY_XID, input);
assertEquals(MultipartRequest.class, ofHeader.getImplementedInterface());
final MultipartRequestTableFeatures result = MultipartRequestTableFeatures.class.cast(MultipartRequest.class.cast(ofHeader).getMultipartRequestBody());
assertEquals(MAX_ENTRIES, result.getTableFeatures().get(0).getMaxEntries().longValue());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcrep.message.pcrep.message.replies.Result in project openflowplugin by opendaylight.
the class RegLoadCodecTest method deserializeTest.
@Test
public void deserializeTest() {
createBuffer(buffer);
action = regLoadCodec.deserialize(buffer);
ActionRegLoad result = (ActionRegLoad) action.getActionChoice();
assertEquals(1, result.getNxActionRegLoad().getOfsNbits().shortValue());
assertEquals(2, result.getNxActionRegLoad().getDst().longValue());
assertEquals(3, result.getNxActionRegLoad().getValue().longValue());
assertEquals(0, buffer.readableBytes());
}
Aggregations