Ray Milkey | d43fe45 | 2015-05-29 09:35:12 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | 5ab426f | 2016-04-09 01:19:45 -0700 | [diff] [blame] | 2 | * Copyright 2015-present Open Networking Laboratory |
Ray Milkey | d43fe45 | 2015-05-29 09:35:12 -0700 | [diff] [blame] | 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | package org.onosproject.codec.impl; |
| 17 | |
Jian Li | ce8c560 | 2016-03-03 21:43:24 -0800 | [diff] [blame] | 18 | import com.fasterxml.jackson.databind.node.ObjectNode; |
Yafit Hadar | 5796d97 | 2015-10-15 13:16:11 +0300 | [diff] [blame] | 19 | import org.onlab.util.HexString; |
Ray Milkey | d43fe45 | 2015-05-29 09:35:12 -0700 | [diff] [blame] | 20 | import org.onosproject.codec.CodecContext; |
| 21 | import org.onosproject.net.OchSignal; |
Yafit Hadar | 5796d97 | 2015-10-15 13:16:11 +0300 | [diff] [blame] | 22 | import org.onosproject.net.OduSignalId; |
Ray Milkey | d43fe45 | 2015-05-29 09:35:12 -0700 | [diff] [blame] | 23 | import org.onosproject.net.flow.instructions.Instruction; |
| 24 | import org.onosproject.net.flow.instructions.Instructions; |
| 25 | import org.onosproject.net.flow.instructions.L0ModificationInstruction; |
Yafit Hadar | 5796d97 | 2015-10-15 13:16:11 +0300 | [diff] [blame] | 26 | import org.onosproject.net.flow.instructions.L1ModificationInstruction; |
Ray Milkey | d43fe45 | 2015-05-29 09:35:12 -0700 | [diff] [blame] | 27 | import org.onosproject.net.flow.instructions.L2ModificationInstruction; |
| 28 | import org.onosproject.net.flow.instructions.L3ModificationInstruction; |
Hyunsun Moon | fab2950 | 2015-08-25 13:39:16 -0700 | [diff] [blame] | 29 | import org.onosproject.net.flow.instructions.L4ModificationInstruction; |
Ray Milkey | d43fe45 | 2015-05-29 09:35:12 -0700 | [diff] [blame] | 30 | import org.slf4j.Logger; |
| 31 | import org.slf4j.LoggerFactory; |
| 32 | |
Ray Milkey | d43fe45 | 2015-05-29 09:35:12 -0700 | [diff] [blame] | 33 | /** |
| 34 | * JSON encoding of Instructions. |
| 35 | */ |
Ray Milkey | 6d7968e | 2015-07-06 14:30:02 -0700 | [diff] [blame] | 36 | public final class EncodeInstructionCodecHelper { |
| 37 | protected static final Logger log = LoggerFactory.getLogger(EncodeInstructionCodecHelper.class); |
Ray Milkey | d43fe45 | 2015-05-29 09:35:12 -0700 | [diff] [blame] | 38 | private final Instruction instruction; |
| 39 | private final CodecContext context; |
| 40 | |
| 41 | /** |
| 42 | * Creates an instruction object encoder. |
| 43 | * |
| 44 | * @param instruction instruction to encode |
Jian Li | 47b2623 | 2016-03-07 09:59:59 -0800 | [diff] [blame] | 45 | * @param context codec context for the encoding |
Ray Milkey | d43fe45 | 2015-05-29 09:35:12 -0700 | [diff] [blame] | 46 | */ |
Ray Milkey | 6d7968e | 2015-07-06 14:30:02 -0700 | [diff] [blame] | 47 | public EncodeInstructionCodecHelper(Instruction instruction, CodecContext context) { |
Ray Milkey | d43fe45 | 2015-05-29 09:35:12 -0700 | [diff] [blame] | 48 | this.instruction = instruction; |
| 49 | this.context = context; |
| 50 | } |
| 51 | |
| 52 | |
| 53 | /** |
| 54 | * Encode an L0 modification instruction. |
| 55 | * |
| 56 | * @param result json node that the instruction attributes are added to |
| 57 | */ |
| 58 | private void encodeL0(ObjectNode result) { |
Jian Li | e099166 | 2016-03-07 11:22:25 -0800 | [diff] [blame] | 59 | L0ModificationInstruction l0Instruction = (L0ModificationInstruction) instruction; |
| 60 | result.put(InstructionCodec.SUBTYPE, l0Instruction.subtype().name()); |
Ray Milkey | d43fe45 | 2015-05-29 09:35:12 -0700 | [diff] [blame] | 61 | |
Jian Li | e099166 | 2016-03-07 11:22:25 -0800 | [diff] [blame] | 62 | switch (l0Instruction.subtype()) { |
Ray Milkey | d43fe45 | 2015-05-29 09:35:12 -0700 | [diff] [blame] | 63 | case OCH: |
| 64 | L0ModificationInstruction.ModOchSignalInstruction ochSignalInstruction = |
Jian Li | e099166 | 2016-03-07 11:22:25 -0800 | [diff] [blame] | 65 | (L0ModificationInstruction.ModOchSignalInstruction) l0Instruction; |
Ray Milkey | d43fe45 | 2015-05-29 09:35:12 -0700 | [diff] [blame] | 66 | OchSignal ochSignal = ochSignalInstruction.lambda(); |
| 67 | result.put(InstructionCodec.GRID_TYPE, ochSignal.gridType().name()); |
| 68 | result.put(InstructionCodec.CHANNEL_SPACING, ochSignal.channelSpacing().name()); |
| 69 | result.put(InstructionCodec.SPACING_MULTIPLIER, ochSignal.spacingMultiplier()); |
| 70 | result.put(InstructionCodec.SLOT_GRANULARITY, ochSignal.slotGranularity()); |
| 71 | break; |
| 72 | |
| 73 | default: |
Jian Li | e099166 | 2016-03-07 11:22:25 -0800 | [diff] [blame] | 74 | log.info("Cannot convert L0 subtype of {}", l0Instruction.subtype()); |
Ray Milkey | d43fe45 | 2015-05-29 09:35:12 -0700 | [diff] [blame] | 75 | } |
| 76 | } |
| 77 | |
| 78 | /** |
Yafit Hadar | 5796d97 | 2015-10-15 13:16:11 +0300 | [diff] [blame] | 79 | * Encode an L1 modification instruction. |
| 80 | * |
| 81 | * @param result json node that the instruction attributes are added to |
Yafit Hadar | 5796d97 | 2015-10-15 13:16:11 +0300 | [diff] [blame] | 82 | */ |
| 83 | private void encodeL1(ObjectNode result) { |
Jian Li | e099166 | 2016-03-07 11:22:25 -0800 | [diff] [blame] | 84 | L1ModificationInstruction l1Instruction = (L1ModificationInstruction) instruction; |
| 85 | result.put(InstructionCodec.SUBTYPE, l1Instruction.subtype().name()); |
Yafit Hadar | 5796d97 | 2015-10-15 13:16:11 +0300 | [diff] [blame] | 86 | |
Jian Li | e099166 | 2016-03-07 11:22:25 -0800 | [diff] [blame] | 87 | switch (l1Instruction.subtype()) { |
Jian Li | 47b2623 | 2016-03-07 09:59:59 -0800 | [diff] [blame] | 88 | case ODU_SIGID: |
| 89 | final L1ModificationInstruction.ModOduSignalIdInstruction oduSignalIdInstruction = |
Jian Li | e099166 | 2016-03-07 11:22:25 -0800 | [diff] [blame] | 90 | (L1ModificationInstruction.ModOduSignalIdInstruction) l1Instruction; |
Jian Li | 47b2623 | 2016-03-07 09:59:59 -0800 | [diff] [blame] | 91 | OduSignalId oduSignalId = oduSignalIdInstruction.oduSignalId(); |
Yafit Hadar | 5796d97 | 2015-10-15 13:16:11 +0300 | [diff] [blame] | 92 | |
Jian Li | 47b2623 | 2016-03-07 09:59:59 -0800 | [diff] [blame] | 93 | ObjectNode child = result.putObject("oduSignalId"); |
Yafit Hadar | 5796d97 | 2015-10-15 13:16:11 +0300 | [diff] [blame] | 94 | |
Jian Li | 47b2623 | 2016-03-07 09:59:59 -0800 | [diff] [blame] | 95 | child.put(InstructionCodec.TRIBUTARY_PORT_NUMBER, oduSignalId.tributaryPortNumber()); |
| 96 | child.put(InstructionCodec.TRIBUTARY_SLOT_LEN, oduSignalId.tributarySlotLength()); |
| 97 | child.put(InstructionCodec.TRIBUTARY_SLOT_BITMAP, |
| 98 | HexString.toHexString(oduSignalId.tributarySlotBitmap())); |
| 99 | break; |
| 100 | default: |
Jian Li | e099166 | 2016-03-07 11:22:25 -0800 | [diff] [blame] | 101 | log.info("Cannot convert L1 subtype of {}", l1Instruction.subtype()); |
Jian Li | 47b2623 | 2016-03-07 09:59:59 -0800 | [diff] [blame] | 102 | break; |
Yafit Hadar | 5796d97 | 2015-10-15 13:16:11 +0300 | [diff] [blame] | 103 | } |
| 104 | } |
| 105 | |
| 106 | /** |
Ray Milkey | d43fe45 | 2015-05-29 09:35:12 -0700 | [diff] [blame] | 107 | * Encode an L2 modification instruction. |
| 108 | * |
| 109 | * @param result json node that the instruction attributes are added to |
| 110 | */ |
| 111 | private void encodeL2(ObjectNode result) { |
Jian Li | e099166 | 2016-03-07 11:22:25 -0800 | [diff] [blame] | 112 | L2ModificationInstruction l2Instruction = (L2ModificationInstruction) instruction; |
| 113 | result.put(InstructionCodec.SUBTYPE, l2Instruction.subtype().name()); |
Ray Milkey | d43fe45 | 2015-05-29 09:35:12 -0700 | [diff] [blame] | 114 | |
Jian Li | e099166 | 2016-03-07 11:22:25 -0800 | [diff] [blame] | 115 | switch (l2Instruction.subtype()) { |
Ray Milkey | d43fe45 | 2015-05-29 09:35:12 -0700 | [diff] [blame] | 116 | case ETH_SRC: |
| 117 | case ETH_DST: |
| 118 | final L2ModificationInstruction.ModEtherInstruction modEtherInstruction = |
Jian Li | e099166 | 2016-03-07 11:22:25 -0800 | [diff] [blame] | 119 | (L2ModificationInstruction.ModEtherInstruction) l2Instruction; |
Ray Milkey | d43fe45 | 2015-05-29 09:35:12 -0700 | [diff] [blame] | 120 | result.put(InstructionCodec.MAC, modEtherInstruction.mac().toString()); |
| 121 | break; |
Ray Milkey | d43fe45 | 2015-05-29 09:35:12 -0700 | [diff] [blame] | 122 | case VLAN_ID: |
| 123 | final L2ModificationInstruction.ModVlanIdInstruction modVlanIdInstruction = |
Jian Li | e099166 | 2016-03-07 11:22:25 -0800 | [diff] [blame] | 124 | (L2ModificationInstruction.ModVlanIdInstruction) l2Instruction; |
Ray Milkey | d43fe45 | 2015-05-29 09:35:12 -0700 | [diff] [blame] | 125 | result.put(InstructionCodec.VLAN_ID, modVlanIdInstruction.vlanId().toShort()); |
| 126 | break; |
Ray Milkey | d43fe45 | 2015-05-29 09:35:12 -0700 | [diff] [blame] | 127 | case VLAN_PCP: |
| 128 | final L2ModificationInstruction.ModVlanPcpInstruction modVlanPcpInstruction = |
Jian Li | e099166 | 2016-03-07 11:22:25 -0800 | [diff] [blame] | 129 | (L2ModificationInstruction.ModVlanPcpInstruction) l2Instruction; |
Ray Milkey | d43fe45 | 2015-05-29 09:35:12 -0700 | [diff] [blame] | 130 | result.put(InstructionCodec.VLAN_PCP, modVlanPcpInstruction.vlanPcp()); |
| 131 | break; |
Ray Milkey | d43fe45 | 2015-05-29 09:35:12 -0700 | [diff] [blame] | 132 | case MPLS_LABEL: |
| 133 | final L2ModificationInstruction.ModMplsLabelInstruction modMplsLabelInstruction = |
Jian Li | e099166 | 2016-03-07 11:22:25 -0800 | [diff] [blame] | 134 | (L2ModificationInstruction.ModMplsLabelInstruction) l2Instruction; |
Ray Milkey | 125572b | 2016-02-22 16:48:17 -0800 | [diff] [blame] | 135 | result.put(InstructionCodec.MPLS_LABEL, modMplsLabelInstruction.label().toInt()); |
Ray Milkey | d43fe45 | 2015-05-29 09:35:12 -0700 | [diff] [blame] | 136 | break; |
Ray Milkey | d43fe45 | 2015-05-29 09:35:12 -0700 | [diff] [blame] | 137 | case MPLS_PUSH: |
| 138 | final L2ModificationInstruction.PushHeaderInstructions pushHeaderInstructions = |
Jian Li | e099166 | 2016-03-07 11:22:25 -0800 | [diff] [blame] | 139 | (L2ModificationInstruction.PushHeaderInstructions) l2Instruction; |
Ray Milkey | d43fe45 | 2015-05-29 09:35:12 -0700 | [diff] [blame] | 140 | |
alshabib | 7b808c5 | 2015-06-26 14:22:24 -0700 | [diff] [blame] | 141 | result.put(InstructionCodec.ETHERNET_TYPE, |
Jian Li | 47b2623 | 2016-03-07 09:59:59 -0800 | [diff] [blame] | 142 | pushHeaderInstructions.ethernetType().toShort()); |
Ray Milkey | d43fe45 | 2015-05-29 09:35:12 -0700 | [diff] [blame] | 143 | break; |
Hyunsun Moon | 7080a0d | 2015-08-14 19:18:48 -0700 | [diff] [blame] | 144 | case TUNNEL_ID: |
| 145 | final L2ModificationInstruction.ModTunnelIdInstruction modTunnelIdInstruction = |
Jian Li | e099166 | 2016-03-07 11:22:25 -0800 | [diff] [blame] | 146 | (L2ModificationInstruction.ModTunnelIdInstruction) l2Instruction; |
Hyunsun Moon | 7080a0d | 2015-08-14 19:18:48 -0700 | [diff] [blame] | 147 | result.put(InstructionCodec.TUNNEL_ID, modTunnelIdInstruction.tunnelId()); |
| 148 | break; |
Charles Chan | fbaabae | 2016-03-18 10:44:44 -0700 | [diff] [blame] | 149 | case MPLS_BOS: |
| 150 | final L2ModificationInstruction.ModMplsBosInstruction modMplsBosInstruction = |
| 151 | (L2ModificationInstruction.ModMplsBosInstruction) l2Instruction; |
| 152 | result.put(InstructionCodec.MPLS_BOS, modMplsBosInstruction.mplsBos()); |
| 153 | case MPLS_POP: |
| 154 | case DEC_MPLS_TTL: |
| 155 | break; |
Ray Milkey | d43fe45 | 2015-05-29 09:35:12 -0700 | [diff] [blame] | 156 | default: |
Jian Li | e099166 | 2016-03-07 11:22:25 -0800 | [diff] [blame] | 157 | log.info("Cannot convert L2 subtype of {}", l2Instruction.subtype()); |
Ray Milkey | d43fe45 | 2015-05-29 09:35:12 -0700 | [diff] [blame] | 158 | break; |
| 159 | } |
| 160 | } |
| 161 | |
| 162 | /** |
| 163 | * Encode an L3 modification instruction. |
| 164 | * |
| 165 | * @param result json node that the instruction attributes are added to |
| 166 | */ |
| 167 | private void encodeL3(ObjectNode result) { |
Jian Li | e099166 | 2016-03-07 11:22:25 -0800 | [diff] [blame] | 168 | L3ModificationInstruction l3Instruction = (L3ModificationInstruction) instruction; |
| 169 | result.put(InstructionCodec.SUBTYPE, l3Instruction.subtype().name()); |
| 170 | switch (l3Instruction.subtype()) { |
Ray Milkey | d43fe45 | 2015-05-29 09:35:12 -0700 | [diff] [blame] | 171 | case IPV4_SRC: |
| 172 | case IPV4_DST: |
| 173 | case IPV6_SRC: |
| 174 | case IPV6_DST: |
| 175 | final L3ModificationInstruction.ModIPInstruction modIPInstruction = |
Jian Li | e099166 | 2016-03-07 11:22:25 -0800 | [diff] [blame] | 176 | (L3ModificationInstruction.ModIPInstruction) l3Instruction; |
Ray Milkey | d43fe45 | 2015-05-29 09:35:12 -0700 | [diff] [blame] | 177 | result.put(InstructionCodec.IP, modIPInstruction.ip().toString()); |
| 178 | break; |
Ray Milkey | d43fe45 | 2015-05-29 09:35:12 -0700 | [diff] [blame] | 179 | case IPV6_FLABEL: |
| 180 | final L3ModificationInstruction.ModIPv6FlowLabelInstruction |
| 181 | modFlowLabelInstruction = |
Jian Li | e099166 | 2016-03-07 11:22:25 -0800 | [diff] [blame] | 182 | (L3ModificationInstruction.ModIPv6FlowLabelInstruction) l3Instruction; |
Ray Milkey | d43fe45 | 2015-05-29 09:35:12 -0700 | [diff] [blame] | 183 | result.put(InstructionCodec.FLOW_LABEL, modFlowLabelInstruction.flowLabel()); |
| 184 | break; |
Charles Chan | fbaabae | 2016-03-18 10:44:44 -0700 | [diff] [blame] | 185 | case TTL_IN: |
| 186 | case TTL_OUT: |
| 187 | case DEC_TTL: |
| 188 | break; |
Ray Milkey | d43fe45 | 2015-05-29 09:35:12 -0700 | [diff] [blame] | 189 | default: |
Jian Li | e099166 | 2016-03-07 11:22:25 -0800 | [diff] [blame] | 190 | log.info("Cannot convert L3 subtype of {}", l3Instruction.subtype()); |
Ray Milkey | d43fe45 | 2015-05-29 09:35:12 -0700 | [diff] [blame] | 191 | break; |
| 192 | } |
| 193 | } |
| 194 | |
| 195 | /** |
Hyunsun Moon | fab2950 | 2015-08-25 13:39:16 -0700 | [diff] [blame] | 196 | * Encode a L4 modification instruction. |
| 197 | * |
| 198 | * @param result json node that the instruction attributes are added to |
| 199 | */ |
| 200 | private void encodeL4(ObjectNode result) { |
Jian Li | e099166 | 2016-03-07 11:22:25 -0800 | [diff] [blame] | 201 | L4ModificationInstruction l4Instruction = (L4ModificationInstruction) instruction; |
| 202 | result.put(InstructionCodec.SUBTYPE, l4Instruction.subtype().name()); |
| 203 | switch (l4Instruction.subtype()) { |
Hyunsun Moon | fab2950 | 2015-08-25 13:39:16 -0700 | [diff] [blame] | 204 | case TCP_DST: |
| 205 | case TCP_SRC: |
| 206 | final L4ModificationInstruction.ModTransportPortInstruction modTcpPortInstruction = |
Jian Li | e099166 | 2016-03-07 11:22:25 -0800 | [diff] [blame] | 207 | (L4ModificationInstruction.ModTransportPortInstruction) l4Instruction; |
Hyunsun Moon | fab2950 | 2015-08-25 13:39:16 -0700 | [diff] [blame] | 208 | result.put(InstructionCodec.TCP_PORT, modTcpPortInstruction.port().toInt()); |
| 209 | break; |
Hyunsun Moon | fab2950 | 2015-08-25 13:39:16 -0700 | [diff] [blame] | 210 | case UDP_DST: |
| 211 | case UDP_SRC: |
| 212 | final L4ModificationInstruction.ModTransportPortInstruction modUdpPortInstruction = |
Jian Li | e099166 | 2016-03-07 11:22:25 -0800 | [diff] [blame] | 213 | (L4ModificationInstruction.ModTransportPortInstruction) l4Instruction; |
Hyunsun Moon | fab2950 | 2015-08-25 13:39:16 -0700 | [diff] [blame] | 214 | result.put(InstructionCodec.UDP_PORT, modUdpPortInstruction.port().toInt()); |
| 215 | break; |
Hyunsun Moon | fab2950 | 2015-08-25 13:39:16 -0700 | [diff] [blame] | 216 | default: |
Jian Li | e099166 | 2016-03-07 11:22:25 -0800 | [diff] [blame] | 217 | log.info("Cannot convert L4 subtype of {}", l4Instruction.subtype()); |
Hyunsun Moon | fab2950 | 2015-08-25 13:39:16 -0700 | [diff] [blame] | 218 | break; |
| 219 | } |
| 220 | } |
| 221 | |
| 222 | /** |
Charles Chan | fbaabae | 2016-03-18 10:44:44 -0700 | [diff] [blame] | 223 | * Encode a extension instruction. |
| 224 | * |
| 225 | * @param result json node that the instruction attributes are added to |
| 226 | */ |
| 227 | private void encodeExtension(ObjectNode result) { |
| 228 | // TODO Support extension in REST API |
| 229 | log.info("Cannot convert instruction type of EXTENSION"); |
| 230 | } |
| 231 | |
| 232 | /** |
Ray Milkey | d43fe45 | 2015-05-29 09:35:12 -0700 | [diff] [blame] | 233 | * Encodes the given instruction into JSON. |
| 234 | * |
| 235 | * @return JSON object node representing the instruction |
| 236 | */ |
| 237 | public ObjectNode encode() { |
| 238 | final ObjectNode result = context.mapper().createObjectNode() |
| 239 | .put(InstructionCodec.TYPE, instruction.type().toString()); |
| 240 | |
| 241 | switch (instruction.type()) { |
| 242 | case OUTPUT: |
| 243 | final Instructions.OutputInstruction outputInstruction = |
| 244 | (Instructions.OutputInstruction) instruction; |
Andrea Campanella | 5df3595 | 2015-12-08 15:46:49 -0800 | [diff] [blame] | 245 | result.put(InstructionCodec.PORT, outputInstruction.port().toString()); |
Ray Milkey | d43fe45 | 2015-05-29 09:35:12 -0700 | [diff] [blame] | 246 | break; |
| 247 | |
Brian O'Connor | 7664e7d | 2015-10-09 00:57:58 -0700 | [diff] [blame] | 248 | case NOACTION: |
Ray Milkey | d43fe45 | 2015-05-29 09:35:12 -0700 | [diff] [blame] | 249 | break; |
| 250 | |
Jian Li | ce8c560 | 2016-03-03 21:43:24 -0800 | [diff] [blame] | 251 | case GROUP: |
| 252 | final Instructions.GroupInstruction groupInstruction = |
| 253 | (Instructions.GroupInstruction) instruction; |
| 254 | result.put(InstructionCodec.GROUP_ID, groupInstruction.groupId().toString()); |
| 255 | break; |
| 256 | |
Jian Li | 47b2623 | 2016-03-07 09:59:59 -0800 | [diff] [blame] | 257 | case METER: |
| 258 | final Instructions.MeterInstruction meterInstruction = |
| 259 | (Instructions.MeterInstruction) instruction; |
| 260 | result.put(InstructionCodec.METER_ID, meterInstruction.meterId().toString()); |
| 261 | break; |
| 262 | |
Jian Li | 70dffe4 | 2016-03-08 22:23:02 -0800 | [diff] [blame] | 263 | case QUEUE: |
| 264 | final Instructions.SetQueueInstruction setQueueInstruction = |
| 265 | (Instructions.SetQueueInstruction) instruction; |
| 266 | result.put(InstructionCodec.QUEUE_ID, setQueueInstruction.queueId()); |
| 267 | result.put(InstructionCodec.PORT, setQueueInstruction.port().toString()); |
| 268 | break; |
| 269 | |
Ray Milkey | d43fe45 | 2015-05-29 09:35:12 -0700 | [diff] [blame] | 270 | case L0MODIFICATION: |
| 271 | encodeL0(result); |
| 272 | break; |
| 273 | |
Yafit Hadar | 5796d97 | 2015-10-15 13:16:11 +0300 | [diff] [blame] | 274 | case L1MODIFICATION: |
| 275 | encodeL1(result); |
| 276 | break; |
| 277 | |
Ray Milkey | d43fe45 | 2015-05-29 09:35:12 -0700 | [diff] [blame] | 278 | case L2MODIFICATION: |
| 279 | encodeL2(result); |
| 280 | break; |
| 281 | |
| 282 | case L3MODIFICATION: |
| 283 | encodeL3(result); |
| 284 | break; |
| 285 | |
Hyunsun Moon | fab2950 | 2015-08-25 13:39:16 -0700 | [diff] [blame] | 286 | case L4MODIFICATION: |
| 287 | encodeL4(result); |
| 288 | break; |
| 289 | |
Charles Chan | fbaabae | 2016-03-18 10:44:44 -0700 | [diff] [blame] | 290 | case EXTENSION: |
| 291 | encodeExtension(result); |
| 292 | break; |
| 293 | |
Ray Milkey | d43fe45 | 2015-05-29 09:35:12 -0700 | [diff] [blame] | 294 | default: |
| 295 | log.info("Cannot convert instruction type of {}", instruction.type()); |
| 296 | break; |
| 297 | } |
| 298 | return result; |
| 299 | } |
| 300 | |
| 301 | } |