2 * Copyright © 2017 Red Hat, Inc. and others.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.genius.mdsalutil.actions;
10 import static org.junit.Assert.assertEquals;
11 import static org.junit.Assert.assertTrue;
13 import ch.vorburger.xtendbeans.XtendBeanGenerator;
14 import org.junit.Test;
15 import org.opendaylight.genius.mdsalutil.ActionInfo;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.Action;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstNxIpv6DstCase;
18 import 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;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.reg.move.grouping.NxRegMove;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcNxIpv6SrcCase;
21 import org.opendaylight.yangtools.yang.common.Empty;
24 * Test class for {@link ActionMoveSourceDestinationIpv6}.
26 public class ActionMoveSourceDestinationIpv6Test {
27 private final XtendBeanGenerator generator = new XtendBeanGenerator();
30 public void actionInfoTest() {
31 verifyAction(new ActionMoveSourceDestinationIpv6().buildAction());
34 private static void verifyAction(Action action) {
35 assertTrue(action.getAction() instanceof NxActionRegMoveNodesNodeTableFlowApplyActionsCase);
36 NxActionRegMoveNodesNodeTableFlowApplyActionsCase actionCase =
37 (NxActionRegMoveNodesNodeTableFlowApplyActionsCase) action.getAction();
38 NxRegMove nxRegMove = actionCase.getNxRegMove();
39 assertTrue(nxRegMove.getSrc().getSrcChoice() instanceof SrcNxIpv6SrcCase);
40 SrcNxIpv6SrcCase srcChoice = (SrcNxIpv6SrcCase) nxRegMove.getSrc().getSrcChoice();
41 assertEquals(Empty.getInstance(),srcChoice.getNxIpv6Src());
42 assertEquals(0, nxRegMove.getSrc().getStart().intValue());
43 assertTrue(nxRegMove.getDst().getDstChoice() instanceof DstNxIpv6DstCase);
44 DstNxIpv6DstCase dstChoice = (DstNxIpv6DstCase) nxRegMove.getDst().getDstChoice();
45 assertEquals(Empty.getInstance(), dstChoice.getNxIpv6Dst());
46 assertEquals(0, nxRegMove.getDst().getStart().intValue());
47 assertEquals(127, nxRegMove.getDst().getEnd().intValue());
51 public void generateAction() {
52 ActionInfo actionInfo = new ActionMoveSourceDestinationIpv6();
53 assertEquals("new ActionMoveSourceDestinationIpv6", generator.getExpression(actionInfo));