Search in sources :

Example 1 with AddMeterOutput

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());
}
Also used : AddMeterOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.AddMeterOutput) AddMeterInput(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.AddMeterInput) RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) AddMeterOutputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.AddMeterOutputBuilder) Test(org.junit.Test)

Example 2 with AddMeterOutput

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();
}
Also used : OriginalMeter(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.meter.update.OriginalMeter) UpdateMeterInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.UpdateMeterInputBuilder) AddMeterOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.AddMeterOutput) UpdatedMeter(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.meter.update.UpdatedMeter) UpdatedMeterBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.meter.update.UpdatedMeterBuilder) OriginalMeterBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.meter.update.OriginalMeterBuilder) UpdateMeterInput(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.UpdateMeterInput) MeterId(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterId)

Example 3 with AddMeterOutput

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();
}
Also used : AddMeterOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.AddMeterOutput) AddMeterInput(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.AddMeterInput) AddMeterInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.AddMeterInputBuilder) MeterId(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterId)

Example 4 with AddMeterOutput

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());
}
Also used : NodeRef(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef) AddMeterInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.AddMeterInputBuilder) MeterRef(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterRef) Uri(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri)

Example 5 with AddMeterOutput

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());
}
Also used : NodeRef(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef) AddMeterInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.AddMeterInputBuilder) MeterRef(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterRef)

Aggregations

AddMeterOutput (org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.AddMeterOutput)5 AddMeterInput (org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.AddMeterInput)4 AddMeterInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.AddMeterInputBuilder)4 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)4 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)2 ArrayList (java.util.ArrayList)2 Test (org.junit.Test)2 NodeRef (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef)2 MeterId (org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterId)2 MeterRef (org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterRef)2 InOrder (org.mockito.InOrder)1 CrudCounts (org.opendaylight.openflowplugin.applications.frsync.util.CrudCounts)1 ItemSyncBox (org.opendaylight.openflowplugin.applications.frsync.util.ItemSyncBox)1 Uri (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri)1 Meter (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.Meter)1 MeterKey (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.MeterKey)1 AddMeterOutputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.AddMeterOutputBuilder)1 UpdateMeterInput (org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.UpdateMeterInput)1 UpdateMeterInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.UpdateMeterInputBuilder)1 UpdateMeterOutput (org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.UpdateMeterOutput)1