Search in sources :

Example 1 with NxActionRegMove

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());
}
Also used : NxActionRegMoveBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.reg.move.grouping.NxActionRegMoveBuilder) ActionRegMoveBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionRegMoveBuilder) Dst(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.reg.move.grouping.nx.reg.move.Dst) Src(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.reg.move.grouping.nx.reg.move.Src) NxActionRegMoveBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.reg.move.grouping.NxActionRegMoveBuilder) NxActionRegMoveGrouping(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.NxActionRegMoveGrouping)

Example 2 with NxActionRegMove

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);
}
Also used : NxRegMoveBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.reg.move.grouping.NxRegMoveBuilder) ActionRegMove(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionRegMove) NxActionRegMove(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.reg.move.grouping.NxActionRegMove) DstBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.reg.move.grouping.nx.reg.move.DstBuilder) NxActionRegMove(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.reg.move.grouping.NxActionRegMove) SrcBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.reg.move.grouping.nx.reg.move.SrcBuilder)

Example 3 with NxActionRegMove

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();
}
Also used : NxActionRegMove(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.reg.move.grouping.NxActionRegMove) ActionRegMove(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionRegMove) Dst(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.reg.move.grouping.nx.reg.move.Dst) Src(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.reg.move.grouping.nx.reg.move.Src) DstNxTunIdCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstNxTunIdCase) SrcNxTunIdCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcNxTunIdCase) NxActionRegMove(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.reg.move.grouping.NxActionRegMove) Before(org.junit.Before)

Aggregations

ActionRegMove (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionRegMove)2 NxActionRegMove (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.reg.move.grouping.NxActionRegMove)2 Dst (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.reg.move.grouping.nx.reg.move.Dst)2 Src (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.reg.move.grouping.nx.reg.move.Src)2 Before (org.junit.Before)1 ActionRegMoveBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionRegMoveBuilder)1 NxActionRegMoveBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.reg.move.grouping.NxActionRegMoveBuilder)1 NxActionRegMoveGrouping (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.NxActionRegMoveGrouping)1 DstNxTunIdCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstNxTunIdCase)1 NxRegMoveBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.reg.move.grouping.NxRegMoveBuilder)1 DstBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.reg.move.grouping.nx.reg.move.DstBuilder)1 SrcBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.reg.move.grouping.nx.reg.move.SrcBuilder)1 SrcNxTunIdCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcNxTunIdCase)1