Search in sources :

Example 1 with ActionRegMove

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

the class RegMoveCodecTest method deserializeTest.

@Test
public void deserializeTest() {
    createBuffer(buffer);
    action = regMoveCodec.deserialize(buffer);
    ActionRegMove result = (ActionRegMove) action.getActionChoice();
    assertEquals(1, result.getNxActionRegMove().getNBits().shortValue());
    assertEquals(2, result.getNxActionRegMove().getSrcOfs().shortValue());
    assertEquals(3, result.getNxActionRegMove().getDstOfs().shortValue());
    assertEquals(4, result.getNxActionRegMove().getSrc().intValue());
    assertEquals(5, result.getNxActionRegMove().getDst().intValue());
    assertEquals(0, buffer.readableBytes());
}
Also used : ActionRegMove(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionRegMove) Test(org.junit.Test)

Example 2 with ActionRegMove

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

the class NexthopManager method buildBucketForDcGwLbGroup.

private Bucket buildBucketForDcGwLbGroup(String ipAddress, BigInteger dpnId, int index) {
    List<Action> listAction = new ArrayList<>();
    // ActionKey 0 goes to mpls label.
    int actionKey = 1;
    listAction.add(new ActionPushMpls().buildAction());
    listAction.add(new ActionRegMove(actionKey++, FibConstants.NXM_REG_MAPPING.get(index), 0, 19).buildAction());
    String tunnelInterfaceName = getTunnelInterfaceName(dpnId, new IpAddress(ipAddress.toCharArray()));
    List<Action> egressActions = getEgressActions(tunnelInterfaceName, actionKey++);
    if (!egressActions.isEmpty()) {
        listAction.addAll(getEgressActions(tunnelInterfaceName, actionKey++));
    } else {
        // clear off actions if there is no egress actions.
        listAction = Collections.emptyList();
    }
    return MDSALUtil.buildBucket(listAction, MDSALUtil.GROUP_WEIGHT, index, MDSALUtil.WATCH_PORT, MDSALUtil.WATCH_GROUP);
}
Also used : ActionPushMpls(org.opendaylight.genius.mdsalutil.actions.ActionPushMpls) Action(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action) ActionRegMove(org.opendaylight.genius.mdsalutil.actions.ActionRegMove) CopyOnWriteArrayList(java.util.concurrent.CopyOnWriteArrayList) ArrayList(java.util.ArrayList) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)

Example 3 with ActionRegMove

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionRegMove 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 4 with ActionRegMove

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

the class RegMoveCodec method serialize.

@Override
public void serialize(final Action input, final ByteBuf outBuffer) {
    ActionRegMove actionRegMove = (ActionRegMove) input.getActionChoice();
    serializeHeader(LENGTH, SUBTYPE, outBuffer);
    outBuffer.writeShort(actionRegMove.getNxActionRegMove().getNBits());
    outBuffer.writeShort(actionRegMove.getNxActionRegMove().getSrcOfs());
    outBuffer.writeShort(actionRegMove.getNxActionRegMove().getDstOfs());
    outBuffer.writeInt(actionRegMove.getNxActionRegMove().getSrc().intValue());
    outBuffer.writeInt(actionRegMove.getNxActionRegMove().getDst().intValue());
}
Also used : ActionRegMove(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionRegMove)

Example 5 with ActionRegMove

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionRegMove 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)5 Test (org.junit.Test)3 NxActionRegMove (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.reg.move.grouping.NxActionRegMove)3 ArrayList (java.util.ArrayList)1 CopyOnWriteArrayList (java.util.concurrent.CopyOnWriteArrayList)1 Before (org.junit.Before)1 ActionInfo (org.opendaylight.genius.mdsalutil.ActionInfo)1 ActionPushMpls (org.opendaylight.genius.mdsalutil.actions.ActionPushMpls)1 ActionRegMove (org.opendaylight.genius.mdsalutil.actions.ActionRegMove)1 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)1 Action (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.Action)1 Action (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action)1 DstNxTunIdCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstNxTunIdCase)1 DstOfMplsLabelCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstOfMplsLabelCase)1 NxActionRegMoveNodesNodeTableFlowApplyActionsCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.table.flow.instructions.instruction.instruction.apply.actions._case.apply.actions.action.action.NxActionRegMoveNodesNodeTableFlowApplyActionsCase)1 NxRegMove (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.reg.move.grouping.NxRegMove)1 NxRegMoveBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.reg.move.grouping.NxRegMoveBuilder)1 Dst (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.reg.move.grouping.nx.reg.move.Dst)1 DstBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.reg.move.grouping.nx.reg.move.DstBuilder)1 Src (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.reg.move.grouping.nx.reg.move.Src)1