Mark potentially-static methods as static
[genius.git] / mdsalutil / mdsalutil-api / src / test / java / org / opendaylight / genius / mdsalutil / actions / ActionMoveSourceDestinationIpv6Test.java
1 /*
2  * Copyright © 2017 Red Hat, Inc. and others.
3  *
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
7  */
8 package org.opendaylight.genius.mdsalutil.actions;
9
10 import static org.junit.Assert.assertEquals;
11 import static org.junit.Assert.assertTrue;
12
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;
22
23 /**
24  * Test class for {@link ActionMoveSourceDestinationIpv6}.
25  */
26 public class ActionMoveSourceDestinationIpv6Test {
27     private final XtendBeanGenerator generator = new XtendBeanGenerator();
28
29     @Test
30     public void actionInfoTest() {
31         verifyAction(new ActionMoveSourceDestinationIpv6().buildAction());
32     }
33
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());
48     }
49
50     @Test
51     public void generateAction() {
52         ActionInfo actionInfo = new ActionMoveSourceDestinationIpv6();
53         assertEquals("new ActionMoveSourceDestinationIpv6", generator.getExpression(actionInfo));
54     }
55 }