Search in sources :

Example 1 with ActionOutputReg

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionOutputReg in project openflowplugin by opendaylight.

the class OutputRegConvertorTest method setUp.

@Before
public void setUp() throws Exception {
    final NxOutputReg nxOutputReg = Mockito.mock(NxOutputReg.class);
    final Src src = Mockito.mock(Src.class);
    when(src.getOfsNbits()).thenReturn(1);
    when(nxOutputReg.getSrc()).thenReturn(src);
    when(nxOutputReg.getSrc().getSrcChoice()).thenReturn(Mockito.mock(SrcNxTunIdCase.class));
    when(nxOutputReg.getMaxLen()).thenReturn(2);
    when(actionsCase.getNxOutputReg()).thenReturn(nxOutputReg);
    final ActionOutputReg actionOutputReg = Mockito.mock(ActionOutputReg.class);
    final NxActionOutputReg nxActionOutputReg = Mockito.mock(NxActionOutputReg.class);
    when(nxActionOutputReg.getSrc()).thenReturn(NiciraMatchCodecs.TUN_ID_CODEC.getHeaderWithoutHasMask().toLong());
    when(nxActionOutputReg.getMaxLen()).thenReturn(3);
    when(nxActionOutputReg.getNBits()).thenReturn(4);
    when(actionOutputReg.getNxActionOutputReg()).thenReturn(nxActionOutputReg);
    when(action.getActionChoice()).thenReturn(actionOutputReg);
    outputRegConvertor = new OutputRegConvertor();
}
Also used : NxOutputReg(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.output.reg.grouping.NxOutputReg) NxActionOutputReg(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.output.reg.grouping.NxActionOutputReg) ActionOutputReg(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionOutputReg) NxActionOutputReg(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.output.reg.grouping.NxActionOutputReg) Src(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.output.reg.grouping.nx.output.reg.Src) SrcNxTunIdCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcNxTunIdCase) Before(org.junit.Before)

Example 2 with ActionOutputReg

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionOutputReg in project openflowplugin by opendaylight.

the class OutputRegConvertorTest method testConvert.

@Test
public void testConvert() throws Exception {
    final ActionOutputReg actionOutputReg = (ActionOutputReg) outputRegConvertor.convert(actionsCase).getActionChoice();
    Assert.assertEquals(Integer.valueOf(1), actionOutputReg.getNxActionOutputReg().getNBits());
    Assert.assertEquals(Integer.valueOf(2), actionOutputReg.getNxActionOutputReg().getMaxLen());
}
Also used : NxActionOutputReg(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.output.reg.grouping.NxActionOutputReg) ActionOutputReg(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionOutputReg) Test(org.junit.Test)

Example 3 with ActionOutputReg

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionOutputReg in project openflowplugin by opendaylight.

the class OutputRegConvertor method convert.

@Override
public org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action convert(final Action input, final ActionPath path) {
    NxActionOutputReg action = ((ActionOutputReg) input.getActionChoice()).getNxActionOutputReg();
    SrcBuilder srcBuilder = new SrcBuilder();
    srcBuilder.setSrcChoice(RegMoveConvertor.resolveSrcValue(action.getSrc()));
    srcBuilder.setOfsNbits(action.getNBits());
    NxOutputRegBuilder builder = new NxOutputRegBuilder();
    builder.setSrc(srcBuilder.build());
    builder.setMaxLen(action.getMaxLen());
    return resolveAction(builder.build(), path);
}
Also used : NxActionOutputReg(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.output.reg.grouping.NxActionOutputReg) NxActionOutputReg(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.output.reg.grouping.NxActionOutputReg) ActionOutputReg(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionOutputReg) SrcBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.output.reg.grouping.nx.output.reg.SrcBuilder) NxOutputRegBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.output.reg.grouping.NxOutputRegBuilder)

Example 4 with ActionOutputReg

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionOutputReg in project openflowplugin by opendaylight.

the class OutputRegCodecTest method deserializeTest.

@Test
public void deserializeTest() {
    createBuffer(buffer);
    action = outRegCodec.deserialize(buffer);
    ActionOutputReg result = (ActionOutputReg) action.getActionChoice();
    assertEquals(1, result.getNxActionOutputReg().getNBits().shortValue());
    assertEquals(2, result.getNxActionOutputReg().getSrc().intValue());
    assertEquals(3, result.getNxActionOutputReg().getMaxLen().shortValue());
    assertEquals(0, buffer.readableBytes());
}
Also used : ActionOutputReg(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionOutputReg) Test(org.junit.Test)

Example 5 with ActionOutputReg

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionOutputReg in project openflowplugin by opendaylight.

the class OutputRegCodec method serialize.

@Override
public void serialize(final Action input, final ByteBuf outBuffer) {
    ActionOutputReg action = (ActionOutputReg) input.getActionChoice();
    serializeHeader(LENGTH, SUBTYPE, outBuffer);
    outBuffer.writeShort(action.getNxActionOutputReg().getNBits().shortValue());
    outBuffer.writeInt(action.getNxActionOutputReg().getSrc().intValue());
    outBuffer.writeShort(action.getNxActionOutputReg().getMaxLen().shortValue());
    outBuffer.writeZero(6);
}
Also used : ActionOutputReg(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionOutputReg)

Aggregations

ActionOutputReg (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionOutputReg)5 NxActionOutputReg (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.output.reg.grouping.NxActionOutputReg)3 Test (org.junit.Test)2 Before (org.junit.Before)1 NxOutputReg (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.output.reg.grouping.NxOutputReg)1 NxOutputRegBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.output.reg.grouping.NxOutputRegBuilder)1 Src (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.output.reg.grouping.nx.output.reg.Src)1 SrcBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.output.reg.grouping.nx.output.reg.SrcBuilder)1 SrcNxTunIdCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcNxTunIdCase)1