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();
}
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());
}
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);
}
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());
}
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);
}
Aggregations