Search in sources :

Example 1 with PopMplsAction

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.pop.mpls._case.PopMplsAction in project openflowplugin by opendaylight.

the class PopMplsActionSerializer method serialize.

@Override
public void serialize(PopMplsActionCase action, ByteBuf outBuffer) {
    super.serialize(action, outBuffer);
    final PopMplsAction popMplsAction = action.getPopMplsAction();
    outBuffer.writeShort(popMplsAction.getEthernetType());
    outBuffer.writeZero(ActionConstants.ETHERTYPE_ACTION_PADDING);
}
Also used : PopMplsAction(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.mpls.action._case.PopMplsAction)

Example 2 with PopMplsAction

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.pop.mpls._case.PopMplsAction in project openflowplugin by opendaylight.

the class PopMplsActionDeserializerTest method testDeserialize.

@Test
public void testDeserialize() throws Exception {
    final ByteBuf in = UnpooledByteBufAllocator.DEFAULT.buffer();
    final short ethType = 10;
    writeHeader(in);
    in.writeShort(ethType);
    in.writeZero(ActionConstants.ETHERTYPE_ACTION_PADDING);
    final Action action = deserializeAction(in);
    assertTrue(PopMplsActionCase.class.isInstance(action));
    final PopMplsAction popAction = PopMplsActionCase.class.cast(action).getPopMplsAction();
    assertEquals(ethType, popAction.getEthernetType().shortValue());
    assertEquals(0, in.readableBytes());
}
Also used : Action(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action) PopMplsAction(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.mpls.action._case.PopMplsAction) PopMplsActionCase(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopMplsActionCase) ByteBuf(io.netty.buffer.ByteBuf) PopMplsAction(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.mpls.action._case.PopMplsAction) Test(org.junit.Test)

Example 3 with PopMplsAction

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.pop.mpls._case.PopMplsAction in project openflowplugin by opendaylight.

the class OfToSalPopMplsCase method process.

@Override
public Optional<Action> process(@Nonnull final PopMplsCase source, final ActionResponseConvertorData data, ConvertorExecutor convertorExecutor) {
    PopMplsAction popMplsActionFromOF = source.getPopMplsAction();
    PopMplsActionBuilder popMplsAction = new PopMplsActionBuilder();
    popMplsAction.setEthernetType(popMplsActionFromOF.getEthertype().getValue());
    return Optional.of(new PopMplsActionCaseBuilder().setPopMplsAction(popMplsAction.build()).build());
}
Also used : PopMplsActionCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopMplsActionCaseBuilder) PopMplsActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.mpls.action._case.PopMplsActionBuilder) PopMplsAction(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.pop.mpls._case.PopMplsAction)

Aggregations

PopMplsAction (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.mpls.action._case.PopMplsAction)2 ByteBuf (io.netty.buffer.ByteBuf)1 Test (org.junit.Test)1 Action (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action)1 PopMplsActionCase (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopMplsActionCase)1 PopMplsActionCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopMplsActionCaseBuilder)1 PopMplsActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.mpls.action._case.PopMplsActionBuilder)1 PopMplsAction (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.pop.mpls._case.PopMplsAction)1