use of org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.AddMeterOutput in project openflowplugin by opendaylight.
the class MeterForwarderTest method testAdd.
@Test
public void testAdd() throws Exception {
Mockito.when(salMeterService.addMeter(addMeterInputCpt.capture())).thenReturn(RpcResultBuilder.success(new AddMeterOutputBuilder().setTransactionId(txId).build()).buildFuture());
final Future<RpcResult<AddMeterOutput>> addResult = meterForwarder.add(meterPath, meter, flowCapableNodePath);
Mockito.verify(salMeterService).addMeter(Matchers.<AddMeterInput>any());
Assert.assertTrue(addResult.isDone());
final RpcResult<AddMeterOutput> meterResult = addResult.get(2, TimeUnit.SECONDS);
Assert.assertTrue(meterResult.isSuccessful());
Assert.assertEquals(1, meterResult.getResult().getTransactionId().getValue().intValue());
final AddMeterInput addMeterInput = addMeterInputCpt.getValue();
Assert.assertEquals(meterPath, addMeterInput.getMeterRef().getValue());
Assert.assertEquals(nodePath, addMeterInput.getNode().getValue());
Assert.assertEquals("test-meter", addMeterInput.getMeterName());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.AddMeterOutput in project openflowplugin by opendaylight.
the class SalMeterServiceImplTest method updateMeter.
private void updateMeter() throws Exception {
final UpdatedMeter dummyUpdatedMeter = new UpdatedMeterBuilder().setMeterId(new MeterId(DUMMY_METTER_ID)).build();
final OriginalMeter dummyOriginalMeter = new OriginalMeterBuilder().setMeterId(new MeterId(DUMMY_METTER_ID)).build();
final UpdateMeterInput updateMeterInput = new UpdateMeterInputBuilder().setUpdatedMeter(dummyUpdatedMeter).setOriginalMeter(dummyOriginalMeter).build();
this.<AddMeterOutput>mockSuccessfulFuture();
salMeterService.updateMeter(updateMeterInput);
verify(mockedRequestContextStack).createRequestContext();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.AddMeterOutput in project openflowplugin by opendaylight.
the class SalMeterServiceImplTest method addMeter.
private void addMeter() {
final MeterId dummyMeterId = new MeterId(DUMMY_METER_ID);
AddMeterInput addMeterInput = new AddMeterInputBuilder().setMeterId(dummyMeterId).build();
this.<AddMeterOutput>mockSuccessfulFuture();
salMeterService.addMeter(addMeterInput);
verify(mockedRequestContextStack).createRequestContext();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.AddMeterOutput in project openflowplugin by opendaylight.
the class MeterForwarder method add.
@Override
public Future<RpcResult<AddMeterOutput>> add(final InstanceIdentifier<Meter> identifier, final Meter addDataObj, final InstanceIdentifier<FlowCapableNode> nodeIdent) {
final AddMeterInputBuilder builder = new AddMeterInputBuilder(addDataObj);
builder.setNode(new NodeRef(nodeIdent.firstIdentifierOf(Node.class)));
builder.setMeterRef(new MeterRef(identifier));
builder.setTransactionUri(new Uri(provider.getNewTransactionId()));
return this.provider.getSalMeterService().addMeter(builder.build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.AddMeterOutput in project openflowplugin by opendaylight.
the class MeterForwarder method add.
@Override
public Future<RpcResult<AddMeterOutput>> add(final InstanceIdentifier<Meter> identifier, final Meter addDataObj, final InstanceIdentifier<FlowCapableNode> nodeIdent) {
LOG.trace("Received the Meter ADD request [Tbl id, node Id {} {} {}", identifier, nodeIdent, addDataObj);
final AddMeterInputBuilder builder = new AddMeterInputBuilder(addDataObj);
builder.setNode(new NodeRef(nodeIdent.firstIdentifierOf(Node.class)));
builder.setMeterRef(new MeterRef(identifier));
return salMeterService.addMeter(builder.build());
}
Aggregations