use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.meter._case.MeterBuilder in project openflowplugin by opendaylight.
the class MeterForwarderTest method testUpdate.
@Test
public void testUpdate() throws Exception {
Mockito.when(salMeterService.updateMeter(updateMeterInputCpt.capture())).thenReturn(RpcResultBuilder.success(new UpdateMeterOutputBuilder().setTransactionId(txId).build()).buildFuture());
Meter meterOriginal = new MeterBuilder(meter).build();
Meter meterUpdate = new MeterBuilder(meter).setMeterName("another-test").build();
final Future<RpcResult<UpdateMeterOutput>> updateResult = meterForwarder.update(meterPath, meterOriginal, meterUpdate, flowCapableNodePath);
Mockito.verify(salMeterService).updateMeter(Matchers.<UpdateMeterInput>any());
Assert.assertTrue(updateResult.isDone());
final RpcResult<UpdateMeterOutput> meterResult = updateResult.get(2, TimeUnit.SECONDS);
Assert.assertTrue(meterResult.isSuccessful());
Assert.assertEquals(1, meterResult.getResult().getTransactionId().getValue().intValue());
final UpdateMeterInput updateMeterInput = updateMeterInputCpt.getValue();
Assert.assertEquals(meterPath, updateMeterInput.getMeterRef().getValue());
Assert.assertEquals(nodePath, updateMeterInput.getNode().getValue());
Assert.assertEquals("test-meter", updateMeterInput.getOriginalMeter().getMeterName());
Assert.assertEquals("another-test", updateMeterInput.getUpdatedMeter().getMeterName());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.meter._case.MeterBuilder in project openflowplugin by opendaylight.
the class MeterForwarderTest method testRemove.
@Test
public void testRemove() throws Exception {
Mockito.when(salMeterService.removeMeter(removeMeterInputCpt.capture())).thenReturn(RpcResultBuilder.success(new RemoveMeterOutputBuilder().setTransactionId(txId).build()).buildFuture());
Meter removeMeter = new MeterBuilder(meter).build();
final Future<RpcResult<RemoveMeterOutput>> removeResult = meterForwarder.remove(meterPath, removeMeter, flowCapableNodePath);
Mockito.verify(salMeterService).removeMeter(Matchers.<RemoveMeterInput>any());
Assert.assertTrue(removeResult.isDone());
final RpcResult<RemoveMeterOutput> meterResult = removeResult.get(2, TimeUnit.SECONDS);
Assert.assertTrue(meterResult.isSuccessful());
Assert.assertEquals(1, meterResult.getResult().getTransactionId().getValue().intValue());
final RemoveMeterInput removeMeterInput = removeMeterInputCpt.getValue();
Assert.assertEquals(meterPath, removeMeterInput.getMeterRef().getValue());
Assert.assertEquals(nodePath, removeMeterInput.getNode().getValue());
Assert.assertEquals("test-meter", removeMeterInput.getMeterName());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.meter._case.MeterBuilder in project openflowplugin by opendaylight.
the class MeterNotificationSupplierImplTest method createTestMeter.
private static Meter createTestMeter() {
final MeterBuilder builder = new MeterBuilder();
builder.setMeterId(new MeterId(METER_ID));
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.meter._case.MeterBuilder in project openflowplugin by opendaylight.
the class MeterNotificationSupplierImplTest method createUpdatedTestMeter.
private static Meter createUpdatedTestMeter() {
final MeterBuilder builder = new MeterBuilder();
builder.setMeterId(new MeterId(UPDATED_METER_ID));
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.meter._case.MeterBuilder in project openflowplugin by opendaylight.
the class OpenflowPluginBulkGroupTransactionProvider method createMeterInstructions.
private static InstructionsBuilder createMeterInstructions() {
MeterBuilder aab = new MeterBuilder();
aab.setMeterId(new MeterId(1L));
InstructionBuilder ib = new InstructionBuilder();
ib.setInstruction(new MeterCaseBuilder().setMeter(aab.build()).build());
// Put our Instruction in a list of Instructions
InstructionsBuilder isb = new InstructionsBuilder();
List<Instruction> instructions = new ArrayList<>();
instructions.add(ib.build());
isb.setInstruction(instructions);
return isb;
}
Aggregations