2 * Copyright (c) 2018 SUSE LINUX GmbH. All rights reserved.
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.openflowplugin.extension.vendor.nicira.convertor.action;
10 import org.junit.Assert;
11 import org.junit.Before;
12 import org.junit.Test;
13 import org.junit.runner.RunWith;
14 import org.mockito.Mock;
15 import org.mockito.Mockito;
16 import org.mockito.junit.MockitoJUnitRunner;
17 import org.opendaylight.openflowplugin.extension.api.path.ActionPath;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.aug.nx.action.ActionDecNshTtl;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.dec.nsh.ttl.grouping.NxActionDecNshTtl;
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.table.flow.instructions.instruction.instruction.write.actions._case.write.actions.action.action.NxActionDecNshTtlNodesNodeTableFlowWriteActionsCase;
22 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.dec.nsh.ttl.grouping.NxDecNshTtl;
24 @RunWith(MockitoJUnitRunner.class)
25 public class DecNshTtlConvertorTest {
28 private NxActionDecNshTtlNodesNodeTableFlowWriteActionsCase actionsCase;
31 private Action action;
33 private DecNshTtlConvertor decNshTtlConvertor;
37 NxDecNshTtl nxDecNshTtl = Mockito.mock(NxDecNshTtl.class);
39 NxActionDecNshTtl nxActionDecNshTtl = Mockito.mock(NxActionDecNshTtl.class);
40 ActionDecNshTtl actionDecNshTtl = Mockito.mock(ActionDecNshTtl.class);
42 decNshTtlConvertor = new DecNshTtlConvertor();
46 public void testConvertSalToOf() {
47 ActionDecNshTtl actionDecNshTtl = (ActionDecNshTtl) decNshTtlConvertor.convert(actionsCase).getActionChoice();
48 Assert.assertNotNull(actionDecNshTtl);
52 public void testConvertOfToSal() {
53 org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionResult
54 = decNshTtlConvertor.convert(action, ActionPath.FLOWS_STATISTICS_UPDATE_APPLY_ACTIONS);
55 Assert.assertNotNull(actionResult);
56 org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionResult1
57 = decNshTtlConvertor.convert(action, ActionPath.FLOWS_STATISTICS_UPDATE_WRITE_ACTIONS);
58 Assert.assertNotNull(actionResult1);
59 org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionResult2
60 = decNshTtlConvertor.convert(action, ActionPath.GROUP_DESC_STATS_UPDATED_BUCKET_ACTION);
61 Assert.assertNotNull(actionResult2);
62 org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionResult3
63 = decNshTtlConvertor.convert(action, ActionPath.INVENTORY_FLOWNODE_TABLE_WRITE_ACTIONS);
64 Assert.assertNotNull(actionResult3);
65 org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionResult4
66 = decNshTtlConvertor.convert(action, ActionPath.FLOWS_STATISTICS_RPC_APPLY_ACTIONS);
67 Assert.assertNotNull(actionResult4);
68 org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionResult5
69 = decNshTtlConvertor.convert(action, ActionPath.FLOWS_STATISTICS_RPC_WRITE_ACTIONS);
70 Assert.assertNotNull(actionResult5);