Search in sources :

Example 31 with OfHeader

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader in project openflowplugin by opendaylight.

the class SalExperimenterMessageServiceImplTest method testBuildRequest.

@Test
public void testBuildRequest() throws Exception {
    SendExperimenterInput sendExperimenterInput = buildSendExperimenterInput();
    final OfHeader request = salExperimenterMessageService.buildRequest(new Xid(DUMMY_XID_VALUE), sendExperimenterInput);
    assertEquals(DUMMY_XID_VALUE, request.getXid());
    assertTrue(request instanceof ExperimenterInput);
    final ExperimenterInput input = (ExperimenterInput) request;
    assertEquals(43L, input.getExperimenter().getValue().longValue());
    assertEquals(44L, input.getExpType().longValue());
    Mockito.verify(extensionConverter).convert(sendExperimenterInput.getExperimenterMessageOfChoice());
}
Also used : Xid(org.opendaylight.openflowplugin.api.openflow.device.Xid) OfHeader(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader) SendExperimenterInput(org.opendaylight.yang.gen.v1.urn.opendaylight.experimenter.message.service.rev151020.SendExperimenterInput) ExperimenterInput(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInput) SendExperimenterInput(org.opendaylight.yang.gen.v1.urn.opendaylight.experimenter.message.service.rev151020.SendExperimenterInput) Test(org.junit.Test)

Example 32 with OfHeader

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader in project openflowplugin by opendaylight.

the class SingleLayerAggregateFlowMultipartServiceTest method buildRequest.

@Test
public void buildRequest() throws Exception {
    final GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput input = new GetAggregateFlowStatisticsFromFlowTableForGivenMatchInputBuilder().setTableId(TABLE_ID).build();
    final OfHeader ofHeader = service.buildRequest(DUMMY_XID, input);
    assertEquals(MultipartRequest.class, ofHeader.getImplementedInterface());
    final MultipartRequestFlowAggregateStats result = MultipartRequestFlowAggregateStats.class.cast(MultipartRequest.class.cast(ofHeader).getMultipartRequestBody());
    assertEquals(TABLE_ID, result.getTableId().shortValue());
}
Also used : GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput) OfHeader(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader) GetAggregateFlowStatisticsFromFlowTableForGivenMatchInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForGivenMatchInputBuilder) MultipartRequestFlowAggregateStats(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.multipart.request.multipart.request.body.MultipartRequestFlowAggregateStats) Test(org.junit.Test)

Example 33 with OfHeader

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader in project openflowplugin by opendaylight.

the class SingleLayerFlowServiceTest method buildRequest.

@Test
public void buildRequest() throws Exception {
    final AddFlowInput input = new AddFlowInputBuilder().setTableId(TABLE_ID).build();
    final OfHeader ofHeader = service.buildRequest(DUMMY_XID, input);
    assertEquals(FlowMessage.class, ofHeader.getImplementedInterface());
    final FlowMessage result = FlowMessage.class.cast(ofHeader);
    assertEquals(FlowModCommand.OFPFCADD, result.getCommand());
    assertEquals(TABLE_ID, result.getTableId().shortValue());
}
Also used : OfHeader(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader) AddFlowInput(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowInput) AddFlowInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowInputBuilder) FlowMessage(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowMessage) Test(org.junit.Test)

Example 34 with OfHeader

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader in project openflowplugin by opendaylight.

the class SingleLayerMeterServiceTest method buildRequest.

@Test
public void buildRequest() throws Exception {
    final AddMeterInput input = new AddMeterInputBuilder().setMeterId(new MeterId(METER_ID)).build();
    final OfHeader ofHeader = service.buildRequest(DUMMY_XID, input);
    assertEquals(MeterMessage.class, ofHeader.getImplementedInterface());
    final MeterMessage result = MeterMessage.class.cast(ofHeader);
    assertEquals(MeterModCommand.OFPMCADD, result.getCommand());
    assertEquals(METER_ID, result.getMeterId().getValue().longValue());
}
Also used : AddMeterInput(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.AddMeterInput) OfHeader(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader) MeterMessage(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterMessage) AddMeterInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.AddMeterInputBuilder) MeterId(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterId) Test(org.junit.Test)

Example 35 with OfHeader

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader in project openflowplugin by opendaylight.

the class FlowCapableTransactionServiceImplTest method testBuildRequest.

@Test
public void testBuildRequest() throws Exception {
    SendBarrierInput sendBarrierInput = buildSendBarrierInput();
    final OfHeader request = flowCapableTransactionService.buildRequest(new Xid(DUMMY_XID_VALUE), sendBarrierInput);
    assertEquals(DUMMY_XID_VALUE, request.getXid());
    assertTrue(request instanceof BarrierInput);
}
Also used : BarrierInput(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierInput) SendBarrierInput(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.SendBarrierInput) SendBarrierInput(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.SendBarrierInput) Xid(org.opendaylight.openflowplugin.api.openflow.device.Xid) OfHeader(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader) Test(org.junit.Test)

Aggregations

OfHeader (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader)30 Test (org.junit.Test)23 MultipartRequestInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder)17 Xid (org.opendaylight.openflowplugin.api.openflow.device.Xid)10 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)5 ExecutionException (java.util.concurrent.ExecutionException)3 ServiceException (org.opendaylight.openflowplugin.impl.services.util.ServiceException)3 GroupMessage (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupMessage)3 MultipartType (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType)3 FutureCallback (com.google.common.util.concurrent.FutureCallback)2 List (java.util.List)2 Future (java.util.concurrent.Future)2 Function (java.util.function.Function)2 OFDeserializer (org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer)2 TypeVersionKey (org.opendaylight.openflowplugin.extension.api.TypeVersionKey)2 ConversionException (org.opendaylight.openflowplugin.extension.api.exception.ConversionException)2 ConverterNotFoundException (org.opendaylight.openflowplugin.extension.api.exception.ConverterNotFoundException)2 ConvertorExecutor (org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor)2 PortMessage (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortMessage)2 FlowMessage (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowMessage)2