2 * Copyright (c) 2014, 2016 Cisco Systems, Inc. and others. 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 com.google.common.base.Preconditions;
11 import org.opendaylight.openflowjava.nx.NiciraMatchCodecs;
12 import org.opendaylight.openflowjava.nx.codec.match.NxmHeader;
13 import org.opendaylight.openflowplugin.extension.api.ConvertorActionFromOFJava;
14 import org.opendaylight.openflowplugin.extension.api.ConvertorActionToOFJava;
15 import org.opendaylight.openflowplugin.extension.api.path.ActionPath;
16 import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.CodecPreconditionException;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionRegMove;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionRegMoveBuilder;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.reg.move.grouping.NxActionRegMove;
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.reg.move.grouping.NxActionRegMoveBuilder;
22 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxReg;
23 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxReg0;
24 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxReg1;
25 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxReg2;
26 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxReg3;
27 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxReg4;
28 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxReg5;
29 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxReg6;
30 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxReg7;
31 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.NxActionRegMoveGrouping;
32 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.DstChoice;
33 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstNxArpShaCase;
34 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstNxArpShaCaseBuilder;
35 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstNxArpThaCase;
36 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstNxArpThaCaseBuilder;
37 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstNxEncapEthDstCase;
38 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstNxEncapEthDstCaseBuilder;
39 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstNxEncapEthSrcCase;
40 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstNxEncapEthSrcCaseBuilder;
41 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstNxIpv6DstCase;
42 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstNxIpv6DstCaseBuilder;
43 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstNxIpv6SrcCase;
44 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstNxIpv6SrcCaseBuilder;
45 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstNxNshMdtypeCase;
46 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstNxNshMdtypeCaseBuilder;
47 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstNxNshNpCase;
48 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstNxNshNpCaseBuilder;
49 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstNxNshc1Case;
50 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstNxNshc1CaseBuilder;
51 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstNxNshc2Case;
52 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstNxNshc2CaseBuilder;
53 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstNxNshc3Case;
54 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstNxNshc3CaseBuilder;
55 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstNxNshc4Case;
56 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstNxNshc4CaseBuilder;
57 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstNxNsiCase;
58 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstNxNsiCaseBuilder;
59 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstNxNspCase;
60 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstNxNspCaseBuilder;
61 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstNxOfInPortCase;
62 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstNxOfInPortCaseBuilder;
63 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstNxRegCase;
64 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstNxRegCaseBuilder;
65 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstNxTunGpeNpCase;
66 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstNxTunGpeNpCaseBuilder;
67 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstNxTunIdCase;
68 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstNxTunIdCaseBuilder;
69 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstNxTunIpv4DstCase;
70 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstNxTunIpv4DstCaseBuilder;
71 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstNxTunIpv4SrcCase;
72 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstNxTunIpv4SrcCaseBuilder;
73 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstOfArpOpCase;
74 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstOfArpOpCaseBuilder;
75 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstOfArpSpaCase;
76 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstOfArpSpaCaseBuilder;
77 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstOfArpTpaCase;
78 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstOfArpTpaCaseBuilder;
79 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstOfEthDstCase;
80 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstOfEthDstCaseBuilder;
81 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstOfEthSrcCase;
82 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstOfEthSrcCaseBuilder;
83 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstOfIcmpTypeCase;
84 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstOfIcmpTypeCaseBuilder;
85 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstOfIpDstCase;
86 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstOfIpDstCaseBuilder;
87 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstOfIpSrcCase;
88 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstOfIpSrcCaseBuilder;
89 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstOfMplsLabelCase;
90 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstOfMplsLabelCaseBuilder;
91 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.flows.statistics.update.flow.and.statistics.map.list.instructions.instruction.instruction.apply.actions._case.apply.actions.action.action.NxActionRegMoveNotifFlowsStatisticsUpdateApplyActionsCaseBuilder;
92 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.flows.statistics.update.flow.and.statistics.map.list.instructions.instruction.instruction.write.actions._case.write.actions.action.action.NxActionRegMoveNotifFlowsStatisticsUpdateWriteActionsCaseBuilder;
93 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.get.flow.statistics.output.flow.and.statistics.map.list.instructions.instruction.instruction.apply.actions._case.apply.actions.action.action.NxActionRegMoveNotifDirectStatisticsUpdateApplyActionsCaseBuilder;
94 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.get.flow.statistics.output.flow.and.statistics.map.list.instructions.instruction.instruction.write.actions._case.write.actions.action.action.NxActionRegMoveNotifDirectStatisticsUpdateWriteActionsCaseBuilder;
95 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.group.desc.stats.updated.group.desc.stats.buckets.bucket.action.action.NxActionRegMoveNotifGroupDescStatsUpdatedCaseBuilder;
96 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.NxActionRegMoveNodesNodeTableFlowWriteActionsCaseBuilder;
97 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.reg.move.grouping.NxRegMove;
98 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.reg.move.grouping.NxRegMoveBuilder;
99 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.reg.move.grouping.nx.reg.move.Dst;
100 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.reg.move.grouping.nx.reg.move.DstBuilder;
101 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.reg.move.grouping.nx.reg.move.Src;
102 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.reg.move.grouping.nx.reg.move.SrcBuilder;
103 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.SrcChoice;
104 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcNxArpShaCase;
105 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcNxArpShaCaseBuilder;
106 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcNxArpThaCase;
107 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcNxArpThaCaseBuilder;
108 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcNxEncapEthDstCase;
109 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcNxEncapEthDstCaseBuilder;
110 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcNxEncapEthSrcCase;
111 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcNxEncapEthSrcCaseBuilder;
112 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcNxIpv6DstCase;
113 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcNxIpv6DstCaseBuilder;
114 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcNxIpv6SrcCase;
115 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcNxIpv6SrcCaseBuilder;
116 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcNxNshMdtypeCase;
117 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcNxNshMdtypeCaseBuilder;
118 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcNxNshNpCase;
119 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcNxNshNpCaseBuilder;
120 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcNxNshc1Case;
121 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcNxNshc1CaseBuilder;
122 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcNxNshc2Case;
123 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcNxNshc2CaseBuilder;
124 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcNxNshc3Case;
125 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcNxNshc3CaseBuilder;
126 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcNxNshc4Case;
127 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcNxNshc4CaseBuilder;
128 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcNxNsiCase;
129 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcNxNsiCaseBuilder;
130 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcNxNspCase;
131 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcNxNspCaseBuilder;
132 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcNxOfInPortCase;
133 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcNxOfInPortCaseBuilder;
134 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcNxOfMplsLabelCase;
135 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcNxRegCase;
136 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcNxRegCaseBuilder;
137 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcNxTunGpeNpCase;
138 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcNxTunGpeNpCaseBuilder;
139 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcNxTunIdCase;
140 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcNxTunIdCaseBuilder;
141 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcNxTunIpv4DstCase;
142 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcNxTunIpv4DstCaseBuilder;
143 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcNxTunIpv4SrcCase;
144 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcNxTunIpv4SrcCaseBuilder;
145 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcOfArpOpCase;
146 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcOfArpOpCaseBuilder;
147 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcOfArpSpaCase;
148 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcOfArpSpaCaseBuilder;
149 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcOfArpTpaCase;
150 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcOfArpTpaCaseBuilder;
151 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcOfEthDstCase;
152 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcOfEthDstCaseBuilder;
153 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcOfEthSrcCase;
154 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcOfEthSrcCaseBuilder;
155 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcOfEthTypeCase;
156 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcOfEthTypeCaseBuilder;
157 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcOfIpDstCase;
158 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcOfIpDstCaseBuilder;
159 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcOfIpSrcCase;
160 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcOfIpSrcCaseBuilder;
164 * @author Josh Hershberg (jhershbe@redhat.com)
166 public class RegMoveConvertor implements
167 ConvertorActionToOFJava<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action, Action>,
168 ConvertorActionFromOFJava<Action, ActionPath> {
171 public org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action convert(Action input, ActionPath path) {
172 NxActionRegMove actionRegMove = ((ActionRegMove) input.getActionChoice()).getNxActionRegMove();
173 DstBuilder dstBuilder = new DstBuilder();
174 dstBuilder.setDstChoice(resolveDst(actionRegMove.getDst()));
175 dstBuilder.setStart(actionRegMove.getDstOfs());
176 dstBuilder.setEnd(actionRegMove.getDstOfs() + actionRegMove.getNBits() - 1);
177 SrcBuilder srcBuilder = new SrcBuilder();
178 srcBuilder.setSrcChoice(resolveSrc(actionRegMove.getSrc()));
179 srcBuilder.setStart(actionRegMove.getSrcOfs());
180 srcBuilder.setEnd(actionRegMove.getSrcOfs() + actionRegMove.getNBits() - 1);
181 NxRegMoveBuilder nxRegMoveBuilder = new NxRegMoveBuilder();
182 nxRegMoveBuilder.setDst(dstBuilder.build());
183 nxRegMoveBuilder.setSrc(srcBuilder.build());
184 return resolveAction(nxRegMoveBuilder.build(), path);
187 public static DstChoice resolveDst(long dstValue) {
188 Class<? extends NxmNxReg> potentialDst = resolveReg(dstValue);
189 if (potentialDst != null) {
190 return new DstNxRegCaseBuilder().setNxReg(potentialDst).build();
192 if (dstValue == NiciraMatchCodecs.TUN_ID_CODEC.getHeaderWithoutHasMask().toLong()) {
193 return new DstNxTunIdCaseBuilder().setNxTunId(true).build();
195 if (dstValue == NiciraMatchCodecs.ARP_SHA_CODEC.getHeaderWithoutHasMask().toLong()) {
196 return new DstNxArpShaCaseBuilder().setNxArpSha(true).build();
198 if (dstValue == NiciraMatchCodecs.ARP_THA_CODEC.getHeaderWithoutHasMask().toLong()) {
199 return new DstNxArpThaCaseBuilder().setNxArpTha(true).build();
201 if (dstValue == NiciraMatchCodecs.ARP_OP_CODEC.getHeaderWithoutHasMask().toLong()) {
202 return new DstOfArpOpCaseBuilder().setOfArpOp(true).build();
204 if (dstValue == NiciraMatchCodecs.ARP_SPA_CODEC.getHeaderWithoutHasMask().toLong()) {
205 return new DstOfArpSpaCaseBuilder().setOfArpSpa(true).build();
207 if (dstValue == NiciraMatchCodecs.ARP_TPA_CODEC.getHeaderWithoutHasMask().toLong()) {
208 return new DstOfArpTpaCaseBuilder().setOfArpTpa(true).build();
210 if (dstValue == NiciraMatchCodecs.NXM_OF_IN_PORT_CODEC.getHeaderWithoutHasMask().toLong()) {
211 return new DstNxOfInPortCaseBuilder().setOfInPort(true).build();
213 if (dstValue == NiciraMatchCodecs.OXM_OF_MPLS_LABEL.getHeaderWithoutHasMask().toLong()) {
214 return new DstOfMplsLabelCaseBuilder().setOfMplsLabel(true).build();
216 if (dstValue == NiciraMatchCodecs.ETH_DST_CODEC.getHeaderWithoutHasMask().toLong()) {
217 return new DstOfEthDstCaseBuilder().setOfEthDst(true).build();
219 if (dstValue == NiciraMatchCodecs.ETH_SRC_CODEC.getHeaderWithoutHasMask().toLong()) {
220 return new DstOfEthSrcCaseBuilder().setOfEthSrc(true).build();
222 if (dstValue == NiciraMatchCodecs.TUN_IPV4_DST_CODEC.getHeaderWithoutHasMask().toLong()) {
223 return new DstNxTunIpv4DstCaseBuilder().setNxTunIpv4Dst(true).build();
225 if (dstValue == NiciraMatchCodecs.TUN_IPV4_SRC_CODEC.getHeaderWithoutHasMask().toLong()) {
226 return new DstNxTunIpv4SrcCaseBuilder().setNxTunIpv4Src(true).build();
228 if (dstValue == NiciraMatchCodecs.NSP_CODEC.getHeaderWithoutHasMask().toLong()) {
229 return new DstNxNspCaseBuilder().setNxNspDst(true).build();
231 if (dstValue == NiciraMatchCodecs.NSI_CODEC.getHeaderWithoutHasMask().toLong()) {
232 return new DstNxNsiCaseBuilder().setNxNsiDst(true).build();
234 if (dstValue == NiciraMatchCodecs.NSC1_CODEC.getHeaderWithoutHasMask().toLong()) {
235 return new DstNxNshc1CaseBuilder().setNxNshc1Dst(true).build();
237 if (dstValue == NiciraMatchCodecs.NSC2_CODEC.getHeaderWithoutHasMask().toLong()) {
238 return new DstNxNshc2CaseBuilder().setNxNshc2Dst(true).build();
240 if (dstValue == NiciraMatchCodecs.NSC3_CODEC.getHeaderWithoutHasMask().toLong()) {
241 return new DstNxNshc3CaseBuilder().setNxNshc3Dst(true).build();
243 if (dstValue == NiciraMatchCodecs.NSC4_CODEC.getHeaderWithoutHasMask().toLong()) {
244 return new DstNxNshc4CaseBuilder().setNxNshc4Dst(true).build();
246 if (dstValue == NiciraMatchCodecs.ENCAP_ETH_SRC_CODEC.getHeaderWithoutHasMask().toLong()) {
247 return new DstNxEncapEthSrcCaseBuilder().setNxEncapEthSrc(true).build();
249 if (dstValue == NiciraMatchCodecs.ENCAP_ETH_DST_CODEC.getHeaderWithoutHasMask().toLong()) {
250 return new DstNxEncapEthDstCaseBuilder().setNxEncapEthDst(true).build();
252 if (dstValue == NiciraMatchCodecs.NSH_MDTYPE_CODEC.getHeaderWithoutHasMask().toLong()) {
253 return new DstNxNshMdtypeCaseBuilder().setNxNshMdtype(true).build();
255 if (dstValue == NiciraMatchCodecs.NSH_NP_CODEC.getHeaderWithoutHasMask().toLong()) {
256 return new DstNxNshNpCaseBuilder().setNxNshNp(true).build();
258 if (dstValue == NiciraMatchCodecs.TUN_GPE_NP_CODEC.getHeaderWithoutHasMask().toLong()) {
259 return new DstNxTunGpeNpCaseBuilder().setNxTunGpeNp(true).build();
261 if (dstValue == NiciraMatchCodecs.IP_SRC_CODEC.getHeaderWithoutHasMask().toLong()) {
262 return new DstOfIpSrcCaseBuilder().setOfIpSrc(true).build();
264 if (dstValue == NiciraMatchCodecs.IP_DST_CODEC.getHeaderWithoutHasMask().toLong()) {
265 return new DstOfIpDstCaseBuilder().setOfIpDst(true).build();
267 if (dstValue == NiciraMatchCodecs.IPV6_SRC_CODEC.getHeaderWithoutHasMask().toLong()) {
268 return new DstNxIpv6SrcCaseBuilder().setNxIpv6Src(true).build();
270 if (dstValue == NiciraMatchCodecs.IPV6_DST_CODEC.getHeaderWithoutHasMask().toLong()) {
271 return new DstNxIpv6DstCaseBuilder().setNxIpv6Dst(true).build();
273 if (dstValue == NiciraMatchCodecs.ICMP_TYPE_CODEC.getHeaderWithoutHasMask().toLong()) {
274 return new DstOfIcmpTypeCaseBuilder().setOfIcmpType(true).build();
277 throw new CodecPreconditionException("Missing codec for " + new NxmHeader(dstValue));
280 static SrcChoice resolveSrc(long srcValue) {
281 Class<? extends NxmNxReg> potentialSrc = resolveReg(srcValue);
282 if (potentialSrc != null) {
283 return new SrcNxRegCaseBuilder().setNxReg(potentialSrc).build();
285 if (srcValue == NiciraMatchCodecs.TUN_ID_CODEC.getHeaderWithoutHasMask().toLong()) {
286 return new SrcNxTunIdCaseBuilder().setNxTunId(true).build();
288 if (srcValue == NiciraMatchCodecs.ARP_SHA_CODEC.getHeaderWithoutHasMask().toLong()) {
289 return new SrcNxArpShaCaseBuilder().setNxArpSha(true).build();
291 if (srcValue == NiciraMatchCodecs.ARP_THA_CODEC.getHeaderWithoutHasMask().toLong()) {
292 return new SrcNxArpThaCaseBuilder().setNxArpTha(true).build();
294 if (srcValue == NiciraMatchCodecs.ARP_OP_CODEC.getHeaderWithoutHasMask().toLong()) {
295 return new SrcOfArpOpCaseBuilder().setOfArpOp(true).build();
297 if (srcValue == NiciraMatchCodecs.ARP_SPA_CODEC.getHeaderWithoutHasMask().toLong()) {
298 return new SrcOfArpSpaCaseBuilder().setOfArpSpa(true).build();
300 if (srcValue == NiciraMatchCodecs.ARP_TPA_CODEC.getHeaderWithoutHasMask().toLong()) {
301 return new SrcOfArpTpaCaseBuilder().setOfArpTpa(true).build();
303 if (srcValue == NiciraMatchCodecs.NXM_OF_IN_PORT_CODEC.getHeaderWithoutHasMask().toLong()) {
304 return new SrcNxOfInPortCaseBuilder().setOfInPort(true).build();
306 if (srcValue == NiciraMatchCodecs.ETH_DST_CODEC.getHeaderWithoutHasMask().toLong()) {
307 return new SrcOfEthDstCaseBuilder().setOfEthDst(true).build();
309 if (srcValue == NiciraMatchCodecs.ETH_SRC_CODEC.getHeaderWithoutHasMask().toLong()) {
310 return new SrcOfEthSrcCaseBuilder().setOfEthSrc(true).build();
312 if (srcValue == NiciraMatchCodecs.ETH_TYPE_CODEC.getHeaderWithoutHasMask().toLong()) {
313 return new SrcOfEthTypeCaseBuilder().setOfEthType(true).build();
315 if (srcValue == NiciraMatchCodecs.TUN_IPV4_DST_CODEC.getHeaderWithoutHasMask().toLong()) {
316 return new SrcNxTunIpv4DstCaseBuilder().setNxTunIpv4Dst(true).build();
318 if (srcValue == NiciraMatchCodecs.TUN_IPV4_SRC_CODEC.getHeaderWithoutHasMask().toLong()) {
319 return new SrcNxTunIpv4SrcCaseBuilder().setNxTunIpv4Src(true).build();
321 if (srcValue == NiciraMatchCodecs.NSP_CODEC.getHeaderWithoutHasMask().toLong()) {
322 return new SrcNxNspCaseBuilder().setNxNspDst(true).build();
324 if (srcValue == NiciraMatchCodecs.NSI_CODEC.getHeaderWithoutHasMask().toLong()) {
325 return new SrcNxNsiCaseBuilder().setNxNsiDst(true).build();
327 if (srcValue == NiciraMatchCodecs.NSC1_CODEC.getHeaderWithoutHasMask().toLong()) {
328 return new SrcNxNshc1CaseBuilder().setNxNshc1Dst(true).build();
330 if (srcValue == NiciraMatchCodecs.NSC2_CODEC.getHeaderWithoutHasMask().toLong()) {
331 return new SrcNxNshc2CaseBuilder().setNxNshc2Dst(true).build();
333 if (srcValue == NiciraMatchCodecs.NSC3_CODEC.getHeaderWithoutHasMask().toLong()) {
334 return new SrcNxNshc3CaseBuilder().setNxNshc3Dst(true).build();
336 if (srcValue == NiciraMatchCodecs.NSC4_CODEC.getHeaderWithoutHasMask().toLong()) {
337 return new SrcNxNshc4CaseBuilder().setNxNshc4Dst(true).build();
339 if (srcValue == NiciraMatchCodecs.ENCAP_ETH_SRC_CODEC.getHeaderWithoutHasMask().toLong()) {
340 return new SrcNxEncapEthSrcCaseBuilder().setNxEncapEthSrc(true).build();
342 if (srcValue == NiciraMatchCodecs.ENCAP_ETH_DST_CODEC.getHeaderWithoutHasMask().toLong()) {
343 return new SrcNxEncapEthDstCaseBuilder().setNxEncapEthDst(true).build();
345 if (srcValue == NiciraMatchCodecs.NSH_MDTYPE_CODEC.getHeaderWithoutHasMask().toLong()) {
346 return new SrcNxNshMdtypeCaseBuilder().setNxNshMdtype(true).build();
348 if (srcValue == NiciraMatchCodecs.NSH_NP_CODEC.getHeaderWithoutHasMask().toLong()) {
349 return new SrcNxNshNpCaseBuilder().setNxNshNp(true).build();
351 if (srcValue == NiciraMatchCodecs.TUN_GPE_NP_CODEC.getHeaderWithoutHasMask().toLong()) {
352 return new SrcNxTunGpeNpCaseBuilder().setNxTunGpeNp(true).build();
354 if (srcValue == NiciraMatchCodecs.IP_DST_CODEC.getHeaderWithoutHasMask().toLong()) {
355 return new SrcOfIpDstCaseBuilder().setOfIpDst(true).build();
357 if (srcValue == NiciraMatchCodecs.IP_SRC_CODEC.getHeaderWithoutHasMask().toLong()) {
358 return new SrcOfIpSrcCaseBuilder().setOfIpSrc(true).build();
360 if (srcValue == NiciraMatchCodecs.IPV6_SRC_CODEC.getHeaderWithoutHasMask().toLong()) {
361 return new SrcNxIpv6SrcCaseBuilder().setNxIpv6Src(true).build();
363 if (srcValue == NiciraMatchCodecs.IPV6_DST_CODEC.getHeaderWithoutHasMask().toLong()) {
364 return new SrcNxIpv6DstCaseBuilder().setNxIpv6Dst(true).build();
367 throw new CodecPreconditionException("Missing codec for " + new NxmHeader(srcValue));
370 private static Class<? extends NxmNxReg> resolveReg(long value) {
371 if (value == NiciraMatchCodecs.REG0_CODEC.getHeaderWithoutHasMask().toLong()) {
372 return NxmNxReg0.class;
374 if (value == NiciraMatchCodecs.REG1_CODEC.getHeaderWithoutHasMask().toLong()) {
375 return NxmNxReg1.class;
377 if (value == NiciraMatchCodecs.REG2_CODEC.getHeaderWithoutHasMask().toLong()) {
378 return NxmNxReg2.class;
380 if (value == NiciraMatchCodecs.REG3_CODEC.getHeaderWithoutHasMask().toLong()) {
381 return NxmNxReg3.class;
383 if (value == NiciraMatchCodecs.REG4_CODEC.getHeaderWithoutHasMask().toLong()) {
384 return NxmNxReg4.class;
386 if (value == NiciraMatchCodecs.REG5_CODEC.getHeaderWithoutHasMask().toLong()) {
387 return NxmNxReg5.class;
389 if (value == NiciraMatchCodecs.REG6_CODEC.getHeaderWithoutHasMask().toLong()) {
390 return NxmNxReg6.class;
392 if (value == NiciraMatchCodecs.REG7_CODEC.getHeaderWithoutHasMask().toLong()) {
393 return NxmNxReg7.class;
398 private static org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action resolveAction(
399 NxRegMove value, ActionPath path) {
401 case NODES_NODE_TABLE_FLOW_INSTRUCTIONS_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION_EXTENSIONLIST_EXTENSION:
402 return new NxActionRegMoveNodesNodeTableFlowWriteActionsCaseBuilder().setNxRegMove(value).build();
403 case FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION:
404 return new NxActionRegMoveNotifFlowsStatisticsUpdateWriteActionsCaseBuilder().setNxRegMove(value).build();
405 case FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION:
406 return new NxActionRegMoveNotifFlowsStatisticsUpdateApplyActionsCaseBuilder().setNxRegMove(value).build();
407 case GROUPDESCSTATSUPDATED_GROUPDESCSTATS_BUCKETS_BUCKET_ACTION:
408 return new NxActionRegMoveNotifGroupDescStatsUpdatedCaseBuilder().setNxRegMove(value).build();
409 case RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION:
410 return new NxActionRegMoveNotifDirectStatisticsUpdateWriteActionsCaseBuilder().setNxRegMove(value).build();
411 case RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION:
412 return new NxActionRegMoveNotifDirectStatisticsUpdateApplyActionsCaseBuilder().setNxRegMove(value).build();
414 throw new CodecPreconditionException(path);
419 public Action convert(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action nxActionArg) {
420 Preconditions.checkArgument(nxActionArg instanceof NxActionRegMoveGrouping);
421 NxActionRegMoveGrouping nxAction = (NxActionRegMoveGrouping) nxActionArg;
423 Dst dst = nxAction.getNxRegMove().getDst();
424 Src src = nxAction.getNxRegMove().getSrc();
425 ActionRegMoveBuilder actionRegMoveBuilder = new ActionRegMoveBuilder();
426 NxActionRegMoveBuilder nxActionRegMove = new NxActionRegMoveBuilder();
428 nxActionRegMove.setDst(resolveDst(dst.getDstChoice()));
429 nxActionRegMove.setDstOfs(dst.getStart());
430 nxActionRegMove.setSrc(resolveSrc(src.getSrcChoice()));
431 nxActionRegMove.setSrcOfs(src.getStart());
432 nxActionRegMove.setNBits(dst.getEnd() - dst.getStart() + 1);
433 actionRegMoveBuilder.setNxActionRegMove(nxActionRegMove.build());
434 return ActionUtil.createAction(actionRegMoveBuilder.build());
437 public static long resolveDst(DstChoice dstChoice) {
438 if (dstChoice instanceof DstNxRegCase) {
439 return resolveReg(((DstNxRegCase) dstChoice).getNxReg());
441 if (dstChoice instanceof DstNxTunIdCase) {
442 return NiciraMatchCodecs.TUN_ID_CODEC.getHeaderWithoutHasMask().toLong();
444 if (dstChoice instanceof DstNxArpShaCase) {
445 return NiciraMatchCodecs.ARP_SHA_CODEC.getHeaderWithoutHasMask().toLong();
447 if (dstChoice instanceof DstNxArpThaCase) {
448 return NiciraMatchCodecs.ARP_THA_CODEC.getHeaderWithoutHasMask().toLong();
450 if (dstChoice instanceof DstOfArpOpCase) {
451 return NiciraMatchCodecs.ARP_OP_CODEC.getHeaderWithoutHasMask().toLong();
453 if (dstChoice instanceof DstOfArpSpaCase) {
454 return NiciraMatchCodecs.ARP_SPA_CODEC.getHeaderWithoutHasMask().toLong();
456 if (dstChoice instanceof DstOfArpTpaCase) {
457 return NiciraMatchCodecs.ARP_TPA_CODEC.getHeaderWithoutHasMask().toLong();
459 if (dstChoice instanceof DstNxOfInPortCase) {
460 return NiciraMatchCodecs.NXM_OF_IN_PORT_CODEC.getHeaderWithoutHasMask().toLong();
462 if (dstChoice instanceof DstOfMplsLabelCase) {
463 return NiciraMatchCodecs.OXM_OF_MPLS_LABEL.getHeaderWithoutHasMask().toLong();
465 if (dstChoice instanceof DstNxTunIpv4DstCase) {
466 return NiciraMatchCodecs.TUN_IPV4_DST_CODEC.getHeaderWithoutHasMask().toLong();
468 if (dstChoice instanceof DstNxTunIpv4SrcCase) {
469 return NiciraMatchCodecs.TUN_IPV4_SRC_CODEC.getHeaderWithoutHasMask().toLong();
471 if (dstChoice instanceof DstOfEthDstCase) {
472 return NiciraMatchCodecs.ETH_DST_CODEC.getHeaderWithoutHasMask().toLong();
474 if (dstChoice instanceof DstOfEthSrcCase) {
475 return NiciraMatchCodecs.ETH_SRC_CODEC.getHeaderWithoutHasMask().toLong();
477 if (dstChoice instanceof DstNxTunIpv4DstCase) {
478 return NiciraMatchCodecs.TUN_IPV4_DST_CODEC.getHeaderWithoutHasMask().toLong();
480 if (dstChoice instanceof DstNxTunIpv4SrcCase) {
481 return NiciraMatchCodecs.TUN_IPV4_SRC_CODEC.getHeaderWithoutHasMask().toLong();
483 if (dstChoice instanceof DstNxNspCase) {
484 return NiciraMatchCodecs.NSP_CODEC.getHeaderWithoutHasMask().toLong();
486 if (dstChoice instanceof DstNxNsiCase) {
487 return NiciraMatchCodecs.NSI_CODEC.getHeaderWithoutHasMask().toLong();
489 if (dstChoice instanceof DstNxNshc1Case) {
490 return NiciraMatchCodecs.NSC1_CODEC.getHeaderWithoutHasMask().toLong();
492 if (dstChoice instanceof DstNxNshc2Case) {
493 return NiciraMatchCodecs.NSC2_CODEC.getHeaderWithoutHasMask().toLong();
495 if (dstChoice instanceof DstNxNshc3Case) {
496 return NiciraMatchCodecs.NSC3_CODEC.getHeaderWithoutHasMask().toLong();
498 if (dstChoice instanceof DstNxNshc4Case) {
499 return NiciraMatchCodecs.NSC4_CODEC.getHeaderWithoutHasMask().toLong();
501 if (dstChoice instanceof DstOfIpSrcCase) {
502 return NiciraMatchCodecs.IP_SRC_CODEC.getHeaderWithoutHasMask().toLong();
504 if (dstChoice instanceof DstOfIpDstCase) {
505 return NiciraMatchCodecs.IP_DST_CODEC.getHeaderWithoutHasMask().toLong();
507 if (dstChoice instanceof DstNxIpv6SrcCase) {
508 return NiciraMatchCodecs.IPV6_SRC_CODEC.getHeaderWithoutHasMask().toLong();
510 if (dstChoice instanceof DstNxIpv6DstCase) {
511 return NiciraMatchCodecs.IPV6_DST_CODEC.getHeaderWithoutHasMask().toLong();
513 if (dstChoice instanceof DstOfIcmpTypeCase) {
514 return NiciraMatchCodecs.ICMP_TYPE_CODEC.getHeaderWithoutHasMask().toLong();
516 if (dstChoice instanceof DstNxEncapEthSrcCase) {
517 return NiciraMatchCodecs.ENCAP_ETH_SRC_CODEC.getHeaderWithoutHasMask().toLong();
519 if (dstChoice instanceof DstNxEncapEthDstCase) {
520 return NiciraMatchCodecs.ENCAP_ETH_DST_CODEC.getHeaderWithoutHasMask().toLong();
522 if (dstChoice instanceof DstNxNshMdtypeCase) {
523 return NiciraMatchCodecs.NSH_MDTYPE_CODEC.getHeaderWithoutHasMask().toLong();
525 if (dstChoice instanceof DstNxNshNpCase) {
526 return NiciraMatchCodecs.NSH_NP_CODEC.getHeaderWithoutHasMask().toLong();
528 if (dstChoice instanceof DstNxTunGpeNpCase) {
529 return NiciraMatchCodecs.TUN_GPE_NP_CODEC.getHeaderWithoutHasMask().toLong();
533 throw new CodecPreconditionException("Missing implementation of a case in dst-choice? " + dstChoice.getClass());
536 static long resolveSrc(SrcChoice srcChoice) {
537 if (srcChoice instanceof SrcNxRegCase) {
538 return resolveReg(((SrcNxRegCase) srcChoice).getNxReg());
540 if (srcChoice instanceof SrcNxTunIdCase) {
541 return NiciraMatchCodecs.TUN_ID_CODEC.getHeaderWithoutHasMask().toLong();
543 if (srcChoice instanceof SrcNxArpShaCase) {
544 return NiciraMatchCodecs.ARP_SHA_CODEC.getHeaderWithoutHasMask().toLong();
546 if (srcChoice instanceof SrcNxArpThaCase) {
547 return NiciraMatchCodecs.ARP_THA_CODEC.getHeaderWithoutHasMask().toLong();
549 if (srcChoice instanceof SrcOfArpOpCase) {
550 return NiciraMatchCodecs.ARP_OP_CODEC.getHeaderWithoutHasMask().toLong();
552 if (srcChoice instanceof SrcOfArpSpaCase) {
553 return NiciraMatchCodecs.ARP_SPA_CODEC.getHeaderWithoutHasMask().toLong();
555 if (srcChoice instanceof SrcOfArpTpaCase) {
556 return NiciraMatchCodecs.ARP_TPA_CODEC.getHeaderWithoutHasMask().toLong();
558 if (srcChoice instanceof SrcNxOfInPortCase) {
559 return NiciraMatchCodecs.NXM_OF_IN_PORT_CODEC.getHeaderWithoutHasMask().toLong();
561 if (srcChoice instanceof SrcNxOfMplsLabelCase) {
562 return NiciraMatchCodecs.OXM_OF_MPLS_LABEL.getHeaderWithoutHasMask().toLong();
564 if (srcChoice instanceof SrcNxTunIpv4DstCase) {
565 return NiciraMatchCodecs.TUN_IPV4_DST_CODEC.getHeaderWithoutHasMask().toLong();
567 if (srcChoice instanceof SrcNxTunIpv4SrcCase) {
568 return NiciraMatchCodecs.TUN_IPV4_SRC_CODEC.getHeaderWithoutHasMask().toLong();
570 if (srcChoice instanceof SrcOfEthDstCase) {
571 return NiciraMatchCodecs.ETH_DST_CODEC.getHeaderWithoutHasMask().toLong();
573 if (srcChoice instanceof SrcOfEthSrcCase) {
574 return NiciraMatchCodecs.ETH_SRC_CODEC.getHeaderWithoutHasMask().toLong();
576 if (srcChoice instanceof SrcOfEthTypeCase) {
577 return NiciraMatchCodecs.ETH_TYPE_CODEC.getHeaderWithoutHasMask().toLong();
579 if (srcChoice instanceof SrcNxTunIpv4DstCase) {
580 return NiciraMatchCodecs.TUN_IPV4_DST_CODEC.getHeaderWithoutHasMask().toLong();
582 if (srcChoice instanceof SrcNxTunIpv4SrcCase) {
583 return NiciraMatchCodecs.TUN_IPV4_SRC_CODEC.getHeaderWithoutHasMask().toLong();
585 if (srcChoice instanceof SrcNxNspCase) {
586 return NiciraMatchCodecs.NSP_CODEC.getHeaderWithoutHasMask().toLong();
588 if (srcChoice instanceof SrcNxNsiCase) {
589 return NiciraMatchCodecs.NSI_CODEC.getHeaderWithoutHasMask().toLong();
591 if (srcChoice instanceof SrcNxNshc1Case) {
592 return NiciraMatchCodecs.NSC1_CODEC.getHeaderWithoutHasMask().toLong();
594 if (srcChoice instanceof SrcNxNshc2Case) {
595 return NiciraMatchCodecs.NSC2_CODEC.getHeaderWithoutHasMask().toLong();
597 if (srcChoice instanceof SrcNxNshc3Case) {
598 return NiciraMatchCodecs.NSC3_CODEC.getHeaderWithoutHasMask().toLong();
600 if (srcChoice instanceof SrcNxNshc4Case) {
601 return NiciraMatchCodecs.NSC4_CODEC.getHeaderWithoutHasMask().toLong();
603 if (srcChoice instanceof SrcOfIpSrcCase) {
604 return NiciraMatchCodecs.IP_SRC_CODEC.getHeaderWithoutHasMask().toLong();
606 if (srcChoice instanceof SrcOfIpDstCase) {
607 return NiciraMatchCodecs.IP_DST_CODEC.getHeaderWithoutHasMask().toLong();
609 if (srcChoice instanceof SrcNxIpv6SrcCase) {
610 return NiciraMatchCodecs.IPV6_SRC_CODEC.getHeaderWithoutHasMask().toLong();
612 if (srcChoice instanceof SrcNxIpv6DstCase) {
613 return NiciraMatchCodecs.IPV6_DST_CODEC.getHeaderWithoutHasMask().toLong();
615 if (srcChoice instanceof SrcNxEncapEthSrcCase) {
616 return NiciraMatchCodecs.ENCAP_ETH_SRC_CODEC.getHeaderWithoutHasMask().toLong();
618 if (srcChoice instanceof SrcNxEncapEthDstCase) {
619 return NiciraMatchCodecs.ENCAP_ETH_DST_CODEC.getHeaderWithoutHasMask().toLong();
621 if (srcChoice instanceof SrcNxNshMdtypeCase) {
622 return NiciraMatchCodecs.NSH_MDTYPE_CODEC.getHeaderWithoutHasMask().toLong();
624 if (srcChoice instanceof SrcNxNshNpCase) {
625 return NiciraMatchCodecs.NSH_NP_CODEC.getHeaderWithoutHasMask().toLong();
627 if (srcChoice instanceof SrcNxTunGpeNpCase) {
628 return NiciraMatchCodecs.TUN_GPE_NP_CODEC.getHeaderWithoutHasMask().toLong();
631 throw new CodecPreconditionException("Missing implementation of a case in src-choice? " + srcChoice.getClass());
634 private static long resolveReg(Class<? extends NxmNxReg> reg) {
635 if (reg.equals(NxmNxReg0.class)) {
636 return NiciraMatchCodecs.REG0_CODEC.getHeaderWithoutHasMask().toLong();
638 if (reg.equals(NxmNxReg1.class)) {
639 return NiciraMatchCodecs.REG1_CODEC.getHeaderWithoutHasMask().toLong();
641 if (reg.equals(NxmNxReg2.class)) {
642 return NiciraMatchCodecs.REG2_CODEC.getHeaderWithoutHasMask().toLong();
644 if (reg.equals(NxmNxReg3.class)) {
645 return NiciraMatchCodecs.REG3_CODEC.getHeaderWithoutHasMask().toLong();
647 if (reg.equals(NxmNxReg4.class)) {
648 return NiciraMatchCodecs.REG4_CODEC.getHeaderWithoutHasMask().toLong();
650 if (reg.equals(NxmNxReg5.class)) {
651 return NiciraMatchCodecs.REG5_CODEC.getHeaderWithoutHasMask().toLong();
653 if (reg.equals(NxmNxReg6.class)) {
654 return NiciraMatchCodecs.REG6_CODEC.getHeaderWithoutHasMask().toLong();
656 if (reg.equals(NxmNxReg7.class)) {
657 return NiciraMatchCodecs.REG7_CODEC.getHeaderWithoutHasMask().toLong();
659 throw new CodecPreconditionException("Missing codec for nxm_nx_reg?" + reg);