use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.output.reg.grouping.NxActionOutputReg 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.ofj.nx.action.output.reg.grouping.NxActionOutputReg 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);
}
Aggregations