use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.reg.move.grouping.NxActionRegMove in project openflowplugin by opendaylight.
the class RegMoveConvertor method convert.
@Override
public Action convert(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action nxActionArg) {
Preconditions.checkArgument(nxActionArg instanceof NxActionRegMoveGrouping);
NxActionRegMoveGrouping nxAction = (NxActionRegMoveGrouping) nxActionArg;
Dst dst = nxAction.getNxRegMove().getDst();
Src src = nxAction.getNxRegMove().getSrc();
final ActionRegMoveBuilder actionRegMoveBuilder = new ActionRegMoveBuilder();
NxActionRegMoveBuilder nxActionRegMove = new NxActionRegMoveBuilder();
nxActionRegMove.setDst(resolveDst(dst.getDstChoice()));
nxActionRegMove.setDstOfs(dst.getStart());
nxActionRegMove.setSrc(resolveSrc(src.getSrcChoice()));
nxActionRegMove.setSrcOfs(src.getStart());
nxActionRegMove.setNBits(dst.getEnd() - dst.getStart() + 1);
actionRegMoveBuilder.setNxActionRegMove(nxActionRegMove.build());
return ActionUtil.createAction(actionRegMoveBuilder.build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.reg.move.grouping.NxActionRegMove in project openflowplugin by opendaylight.
the class RegMoveConvertor method convert.
@Override
public org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action convert(Action input, ActionPath path) {
NxActionRegMove actionRegMove = ((ActionRegMove) input.getActionChoice()).getNxActionRegMove();
DstBuilder dstBuilder = new DstBuilder();
dstBuilder.setDstChoice(resolveDstValue(actionRegMove.getDst()));
dstBuilder.setStart(actionRegMove.getDstOfs());
dstBuilder.setEnd(actionRegMove.getDstOfs() + actionRegMove.getNBits() - 1);
SrcBuilder srcBuilder = new SrcBuilder();
srcBuilder.setSrcChoice(resolveSrcValue(actionRegMove.getSrc()));
srcBuilder.setStart(actionRegMove.getSrcOfs());
srcBuilder.setEnd(actionRegMove.getSrcOfs() + actionRegMove.getNBits() - 1);
NxRegMoveBuilder nxRegMoveBuilder = new NxRegMoveBuilder();
nxRegMoveBuilder.setDst(dstBuilder.build());
nxRegMoveBuilder.setSrc(srcBuilder.build());
return resolveAction(nxRegMoveBuilder.build(), path);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.reg.move.grouping.NxActionRegMove in project openflowplugin by opendaylight.
the class RegMoveConvertorTest method setUp.
@Before
public void setUp() throws Exception {
final Src src = Mockito.mock(Src.class);
final Dst dst = Mockito.mock(Dst.class);
when(actionsCase.getNxRegMove()).thenReturn(nxRegMove);
when(nxRegMove.getSrc()).thenReturn(src);
when(nxRegMove.getDst()).thenReturn(dst);
when(nxRegMove.getSrc().getStart()).thenReturn(1);
when(nxRegMove.getSrc().getEnd()).thenReturn(2);
when(nxRegMove.getDst().getStart()).thenReturn(3);
when(nxRegMove.getDst().getEnd()).thenReturn(4);
when(nxRegMove.getDst().getDstChoice()).thenReturn(Mockito.mock(DstNxTunIdCase.class));
when(nxRegMove.getSrc().getSrcChoice()).thenReturn(Mockito.mock(SrcNxTunIdCase.class));
final ActionRegMove actionRegMove = Mockito.mock(ActionRegMove.class);
final NxActionRegMove nxActionRegMove = Mockito.mock(NxActionRegMove.class);
when(nxActionRegMove.getSrc()).thenReturn(NiciraMatchCodecs.TUN_ID_CODEC.getHeaderWithoutHasMask().toLong());
when(nxActionRegMove.getDst()).thenReturn(NiciraMatchCodecs.TUN_ID_CODEC.getHeaderWithoutHasMask().toLong());
when(nxActionRegMove.getNBits()).thenReturn(7);
when(actionRegMove.getNxActionRegMove()).thenReturn(nxActionRegMove);
when(action.getActionChoice()).thenReturn(actionRegMove);
regMoveConvertor = new RegMoveConvertor();
}
Aggregations