blob: 55f0c3e2ed2d142e91f35b61fbf57e5eafb0d5ff [file] [log] [blame]
Jonathan Hart3c259162015-10-21 21:31:19 -07001/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2016-present Open Networking Laboratory
Jonathan Hart3c259162015-10-21 21:31:19 -07003 *
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
17package org.onosproject.driver.extensions;
18
Jian Lidab72562016-04-12 14:10:32 -070019import com.fasterxml.jackson.databind.node.ObjectNode;
Jonathan Hart3c259162015-10-21 21:31:19 -070020import org.onlab.packet.Ip4Address;
Jian Lidab72562016-04-12 14:10:32 -070021import org.onosproject.codec.CodecContext;
Jian Lid4163882016-03-30 20:03:14 -070022import org.onosproject.net.PortNumber;
alshabib880b6442015-11-23 22:13:04 -080023import org.onosproject.net.behaviour.ExtensionTreatmentResolver;
Jonathan Hart3c259162015-10-21 21:31:19 -070024import org.onosproject.net.driver.AbstractHandlerBehaviour;
alshabib880b6442015-11-23 22:13:04 -080025import org.onosproject.net.flow.instructions.ExtensionTreatment;
26import org.onosproject.net.flow.instructions.ExtensionTreatmentType;
27import org.onosproject.openflow.controller.ExtensionTreatmentInterpreter;
Jonathan Hart3c259162015-10-21 21:31:19 -070028import org.projectfloodlight.openflow.protocol.OFActionType;
29import org.projectfloodlight.openflow.protocol.OFFactory;
30import org.projectfloodlight.openflow.protocol.action.OFAction;
samueljcc4f4d25a2015-12-07 10:52:28 +080031import org.projectfloodlight.openflow.protocol.action.OFActionExperimenter;
32import org.projectfloodlight.openflow.protocol.action.OFActionNicira;
33import org.projectfloodlight.openflow.protocol.action.OFActionNiciraMove;
Jian Lid4163882016-03-30 20:03:14 -070034import org.projectfloodlight.openflow.protocol.action.OFActionNiciraResubmit;
Jonathan Hart3c259162015-10-21 21:31:19 -070035import org.projectfloodlight.openflow.protocol.action.OFActionSetField;
36import org.projectfloodlight.openflow.protocol.oxm.OFOxm;
37import org.projectfloodlight.openflow.protocol.oxm.OFOxmTunnelIpv4Dst;
38import org.projectfloodlight.openflow.types.IPv4Address;
39
Jian Lidab72562016-04-12 14:10:32 -070040import static com.google.common.base.Preconditions.checkNotNull;
41import static org.onlab.util.Tools.nullIsIllegal;
42
Jonathan Hart3c259162015-10-21 21:31:19 -070043/**
Jonathan Hart26a8d952015-12-02 15:16:35 -080044 * Interpreter for Nicira OpenFlow treatment extensions.
Jonathan Hart3c259162015-10-21 21:31:19 -070045 */
alshabib880b6442015-11-23 22:13:04 -080046public class NiciraExtensionTreatmentInterpreter extends AbstractHandlerBehaviour
47 implements ExtensionTreatmentInterpreter, ExtensionTreatmentResolver {
Jonathan Hart3c259162015-10-21 21:31:19 -070048
samueljcc4f4d25a2015-12-07 10:52:28 +080049 private static final int TYPE_NICIRA = 0x2320;
samueljcc4f4d25a2015-12-07 10:52:28 +080050 private static final int SRC_ARP_SHA = 0x00012206;
51 private static final int SRC_ARP_SPA = 0x00002004;
52 private static final int SRC_ETH = 0x00000406;
53 private static final int SRC_IP = 0x00000e04;
54
Jian Lid4163882016-03-30 20:03:14 -070055 private static final int SUB_TYPE_RESUBMIT = 1;
56 private static final int SUB_TYPE_MOVE = 6;
57
Jian Lidab72562016-04-12 14:10:32 -070058 private static final String TUNNEL_DST = "tunnelDst";
59 private static final String RESUBMIT = "resubmit";
60 private static final String RESUBMIT_TABLE = "resubmitTable";
61 private static final String NICIRA_NSH_SPI = "niciraNshSpi";
62 private static final String NICIRA_NSH_SI = "niciraNshSi";
63 private static final String NICIRA_NSH_CH = "niciraNshCh";
64 private static final String NICIRA_MOVE = "niciraMove";
65
66 private static final String TYPE = "type";
67
68 private static final String MISSING_MEMBER_MESSAGE = " member is required in NiciraExtensionTreatmentInterpreter";
69
Jonathan Hart3c259162015-10-21 21:31:19 -070070 @Override
alshabib880b6442015-11-23 22:13:04 -080071 public boolean supported(ExtensionTreatmentType extensionTreatmentType) {
72 if (extensionTreatmentType.equals(
73 ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_SET_TUNNEL_DST.type())) {
Jonathan Hart3c259162015-10-21 21:31:19 -070074 return true;
75 }
alshabib880b6442015-11-23 22:13:04 -080076 if (extensionTreatmentType.equals(
77 ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_RESUBMIT.type())) {
BitOhenryb53ac6c2015-11-16 20:58:58 +080078 return true;
79 }
Phaneendra Mandaab5a7362015-12-02 01:10:01 +053080 if (extensionTreatmentType.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_SET_NSH_SPI.type())) {
81 return true;
82 }
83 if (extensionTreatmentType.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_SET_NSH_SI.type())) {
84 return true;
85 }
86 if (extensionTreatmentType.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_SET_NSH_CH1.type())) {
87 return true;
88 }
89 if (extensionTreatmentType.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_SET_NSH_CH2.type())) {
90 return true;
91 }
92 if (extensionTreatmentType.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_SET_NSH_CH3.type())) {
93 return true;
94 }
95 if (extensionTreatmentType.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_SET_NSH_CH4.type())) {
Phaneendra Mandace66cbc2015-11-26 18:07:48 +053096 return true;
97 }
BitOhenry74dd7e12015-12-01 09:07:19 +080098 if (extensionTreatmentType.equals(
99 ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_RESUBMIT_TABLE.type())) {
100 return true;
101 }
samueljcc4a527ed2015-12-03 13:59:49 +0800102 if (extensionTreatmentType.equals(
103 ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_MOV_ARP_SHA_TO_THA.type())) {
104 return true;
105 }
106 if (extensionTreatmentType.equals(
107 ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_MOV_ARP_SPA_TO_TPA.type())) {
108 return true;
109 }
110 if (extensionTreatmentType.equals(
111 ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_MOV_ETH_SRC_TO_DST.type())) {
112 return true;
113 }
114 if (extensionTreatmentType.equals(
115 ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_MOV_IP_SRC_TO_DST.type())) {
116 return true;
117 }
Jonathan Hart3c259162015-10-21 21:31:19 -0700118 return false;
119 }
120
121 @Override
alshabib880b6442015-11-23 22:13:04 -0800122 public OFAction mapInstruction(OFFactory factory, ExtensionTreatment extensionTreatment) {
123 ExtensionTreatmentType type = extensionTreatment.type();
124 if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_SET_TUNNEL_DST.type())) {
125 NiciraSetTunnelDst tunnelDst = (NiciraSetTunnelDst) extensionTreatment;
Jonathan Hart3c259162015-10-21 21:31:19 -0700126 return factory.actions().setField(factory.oxms().tunnelIpv4Dst(
127 IPv4Address.of(tunnelDst.tunnelDst().toInt())));
128 }
alshabib880b6442015-11-23 22:13:04 -0800129 if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_RESUBMIT.type())) {
BitOhenry5e2233a2015-12-08 09:26:38 +0800130 NiciraResubmit resubmit = (NiciraResubmit) extensionTreatment;
131 return factory.actions().niciraResubmit((int) resubmit.inPort().toLong(),
132 resubmit.table());
BitOhenryb53ac6c2015-11-16 20:58:58 +0800133 }
BitOhenry74dd7e12015-12-01 09:07:19 +0800134 if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_RESUBMIT_TABLE.type())) {
BitOhenry5e2233a2015-12-08 09:26:38 +0800135 NiciraResubmitTable resubmitTable = (NiciraResubmitTable) extensionTreatment;
136 return factory.actions().niciraResubmitTable((int) resubmitTable.inPort().toLong(),
137 resubmitTable.table());
Phaneendra Mandaab5a7362015-12-02 01:10:01 +0530138 }
samueljcc4f4d25a2015-12-07 10:52:28 +0800139 if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_MOV_ARP_SHA_TO_THA.type())
samueljcc4a527ed2015-12-03 13:59:49 +0800140 || type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_MOV_ARP_SPA_TO_TPA.type())
141 || type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_MOV_ETH_SRC_TO_DST.type())
142 || type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_MOV_IP_SRC_TO_DST.type())) {
samueljcc4f4d25a2015-12-07 10:52:28 +0800143 MoveExtensionTreatment mov = (MoveExtensionTreatment) extensionTreatment;
144 OFActionNiciraMove.Builder action = factory.actions()
145 .buildNiciraMove();
146 action.setDstOfs(mov.dstOffset());
147 action.setSrcOfs(mov.srcOffset());
148 action.setNBits(mov.nBits());
149 action.setSrc(mov.src());
150 action.setDst(mov.dst());
151 return action.build();
samueljcc4a527ed2015-12-03 13:59:49 +0800152 }
Jonathan Hart3c259162015-10-21 21:31:19 -0700153 return null;
154 }
155
156 @Override
Jian Liffef5002016-04-04 23:27:37 -0700157 public ExtensionTreatment mapAction(OFAction action) throws UnsupportedOperationException {
Jonathan Hart3c259162015-10-21 21:31:19 -0700158 if (action.getType().equals(OFActionType.SET_FIELD)) {
159 OFActionSetField setFieldAction = (OFActionSetField) action;
160 OFOxm<?> oxm = setFieldAction.getField();
161 switch (oxm.getMatchField().id) {
162 case TUNNEL_IPV4_DST:
163 OFOxmTunnelIpv4Dst tunnelIpv4Dst = (OFOxmTunnelIpv4Dst) oxm;
164 return new NiciraSetTunnelDst(Ip4Address.valueOf(tunnelIpv4Dst.getValue().getInt()));
165 default:
166 throw new UnsupportedOperationException(
167 "Driver does not support extension type " + oxm.getMatchField().id);
168 }
169 }
samueljcc4f4d25a2015-12-07 10:52:28 +0800170 if (action.getType().equals(OFActionType.EXPERIMENTER)) {
171 OFActionExperimenter experimenter = (OFActionExperimenter) action;
172 if (Long.valueOf(experimenter.getExperimenter())
173 .intValue() == TYPE_NICIRA) {
174 OFActionNicira nicira = (OFActionNicira) experimenter;
Jian Lid4163882016-03-30 20:03:14 -0700175 switch (nicira.getSubtype()) {
176 case SUB_TYPE_MOVE:
177 OFActionNiciraMove moveAction = (OFActionNiciraMove) nicira;
178 switch (Long.valueOf(moveAction.getSrc()).intValue()) {
179 case SRC_ARP_SHA:
180 return NiciraMoveTreatmentFactory
181 .createNiciraMovArpShaToTha();
182 case SRC_ETH:
183 return NiciraMoveTreatmentFactory
184 .createNiciraMovEthSrcToDst();
185 case SRC_IP:
186 return NiciraMoveTreatmentFactory
187 .createNiciraMovIpSrcToDst();
188 case SRC_ARP_SPA:
189 return NiciraMoveTreatmentFactory
190 .createNiciraMovArpSpaToTpa();
191 default:
192 throw new UnsupportedOperationException("Driver does not support move from "
193 + moveAction.getSrc() + " to "
194 + moveAction.getDst());
195 }
196 case SUB_TYPE_RESUBMIT:
197 OFActionNiciraResubmit resubmitAction = (OFActionNiciraResubmit) nicira;
198 return new NiciraResubmit(PortNumber.portNumber(resubmitAction.getInPort()));
samueljcc4f4d25a2015-12-07 10:52:28 +0800199 default:
Jian Lid4163882016-03-30 20:03:14 -0700200 throw new UnsupportedOperationException("Driver does not support extension subtype "
201 + nicira.getSubtype());
samueljcc4f4d25a2015-12-07 10:52:28 +0800202 }
203 }
204 }
Jonathan Hart3c259162015-10-21 21:31:19 -0700205 return null;
206 }
207
208 @Override
alshabib880b6442015-11-23 22:13:04 -0800209 public ExtensionTreatment getExtensionInstruction(ExtensionTreatmentType type) {
210 if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_SET_TUNNEL_DST.type())) {
Jonathan Hart3c259162015-10-21 21:31:19 -0700211 return new NiciraSetTunnelDst();
212 }
alshabib880b6442015-11-23 22:13:04 -0800213 if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_RESUBMIT.type())) {
BitOhenryb53ac6c2015-11-16 20:58:58 +0800214 return new NiciraResubmit();
215 }
Phaneendra Mandaab5a7362015-12-02 01:10:01 +0530216 if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_RESUBMIT_TABLE.type())) {
217 return new NiciraResubmitTable();
218 }
Phaneendra Mandace66cbc2015-11-26 18:07:48 +0530219 if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_SET_NSH_SPI.type())) {
220 return new NiciraSetNshSpi();
221 }
Phaneendra Mandaab5a7362015-12-02 01:10:01 +0530222 if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_SET_NSH_SI.type())) {
223 return new NiciraSetNshSi();
224 }
225 if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_SET_NSH_CH1.type())
226 || type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_SET_NSH_CH2.type())
227 || type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_SET_NSH_CH3.type())
228 || type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_SET_NSH_CH4.type())) {
229 return new NiciraSetNshContextHeader(type);
BitOhenry74dd7e12015-12-01 09:07:19 +0800230 }
samueljcc4a527ed2015-12-03 13:59:49 +0800231 if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_MOV_ARP_SHA_TO_THA.type())) {
232 return NiciraMoveTreatmentFactory.createNiciraMovArpShaToTha();
233 }
234 if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_MOV_ARP_SPA_TO_TPA.type())) {
235 return NiciraMoveTreatmentFactory.createNiciraMovArpSpaToTpa();
236 }
237 if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_MOV_ETH_SRC_TO_DST.type())) {
238 return NiciraMoveTreatmentFactory.createNiciraMovEthSrcToDst();
239 }
240 if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_MOV_IP_SRC_TO_DST.type())) {
241 return NiciraMoveTreatmentFactory.createNiciraMovIpSrcToDst();
242 }
Jonathan Hart3c259162015-10-21 21:31:19 -0700243 throw new UnsupportedOperationException(
244 "Driver does not support extension type " + type.toString());
245 }
Jian Lidab72562016-04-12 14:10:32 -0700246
247 @Override
248 public ObjectNode encode(ExtensionTreatment extensionTreatment, CodecContext context) {
249 checkNotNull(extensionTreatment, "Extension treatment cannot be null");
250 ExtensionTreatmentType type = extensionTreatment.type();
251 ObjectNode root = context.mapper().createObjectNode();
252
253 if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_SET_TUNNEL_DST.type())) {
254 NiciraSetTunnelDst tunnelDst = (NiciraSetTunnelDst) extensionTreatment;
255 root.set(TUNNEL_DST, context.codec(NiciraSetTunnelDst.class).encode(tunnelDst, context));
256 }
257
258 if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_RESUBMIT.type())) {
259 NiciraResubmit resubmit = (NiciraResubmit) extensionTreatment;
260 root.set(RESUBMIT, context.codec(NiciraResubmit.class).encode(resubmit, context));
261 }
262 if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_RESUBMIT_TABLE.type())) {
263 NiciraResubmitTable resubmitTable = (NiciraResubmitTable) extensionTreatment;
264 root.set(RESUBMIT_TABLE, context.codec(NiciraResubmitTable.class).encode(resubmitTable, context));
265 }
266 if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_SET_NSH_SPI.type())) {
267 NiciraSetNshSpi niciraNshSpi = (NiciraSetNshSpi) extensionTreatment;
268 root.set(NICIRA_NSH_SPI, context.codec(NiciraSetNshSpi.class).encode(niciraNshSpi, context));
269 }
270 if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_SET_NSH_SI.type())) {
271 NiciraSetNshSi niciraNshSi = (NiciraSetNshSi) extensionTreatment;
272 root.set(NICIRA_NSH_SI, context.codec(NiciraSetNshSi.class).encode(niciraNshSi, context));
273 }
274 if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_SET_NSH_CH1.type())) {
275 NiciraSetNshContextHeader niciraNshch = (NiciraSetNshContextHeader) extensionTreatment;
276 root.set(NICIRA_NSH_CH, context.codec(NiciraSetNshContextHeader.class).encode(niciraNshch, context));
277 }
278 if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_SET_NSH_CH2.type())) {
279 NiciraSetNshContextHeader niciraNshch = (NiciraSetNshContextHeader) extensionTreatment;
280 root.set(NICIRA_NSH_CH, context.codec(NiciraSetNshContextHeader.class).encode(niciraNshch, context));
281 }
282 if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_SET_NSH_CH3.type())) {
283 NiciraSetNshContextHeader niciraNshch = (NiciraSetNshContextHeader) extensionTreatment;
284 root.set(NICIRA_NSH_CH, context.codec(NiciraSetNshContextHeader.class).encode(niciraNshch, context));
285 }
286 if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_SET_NSH_CH4.type())) {
287 NiciraSetNshContextHeader niciraNshch = (NiciraSetNshContextHeader) extensionTreatment;
288 root.set(NICIRA_NSH_CH, context.codec(NiciraSetNshContextHeader.class).encode(niciraNshch, context));
289 }
290 if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_MOV_ARP_SHA_TO_THA.type())
291 || type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_MOV_ARP_SPA_TO_TPA.type())
292 || type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_MOV_ETH_SRC_TO_DST.type())
293 || type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_MOV_IP_SRC_TO_DST.type())) {
294 MoveExtensionTreatment mov = (MoveExtensionTreatment) extensionTreatment;
295 root.set(NICIRA_MOVE, context.codec(MoveExtensionTreatment.class).encode(mov, context));
296 }
297
298 return root;
299 }
300
301 @Override
302 public ExtensionTreatment decode(ObjectNode json, CodecContext context) {
303 if (json == null || !json.isObject()) {
304 return null;
305 }
306
307 // parse extension type
308 int typeInt = nullIsIllegal(json.get(TYPE), TYPE + MISSING_MEMBER_MESSAGE).asInt();
309 ExtensionTreatmentType type = new ExtensionTreatmentType(typeInt);
310
311 if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_SET_TUNNEL_DST.type())) {
312 return context.codec(NiciraSetTunnelDst.class).decode(json, context);
313 }
314
315 if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_RESUBMIT.type())) {
316 return context.codec(NiciraResubmit.class).decode(json, context);
317 }
318 if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_RESUBMIT_TABLE.type())) {
319 return context.codec(NiciraResubmitTable.class).decode(json, context);
320 }
321 if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_SET_NSH_SPI.type())) {
322 return context.codec(NiciraSetNshSpi.class).decode(json, context);
323 }
324 if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_SET_NSH_SI.type())) {
325 return context.codec(NiciraSetNshSi.class).decode(json, context);
326 }
327 if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_SET_NSH_CH1.type())) {
328 return context.codec(NiciraSetNshContextHeader.class).decode(json, context);
329 }
330 if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_SET_NSH_CH2.type())) {
331 return context.codec(NiciraSetNshContextHeader.class).decode(json, context);
332 }
333 if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_SET_NSH_CH3.type())) {
334 return context.codec(NiciraSetNshContextHeader.class).decode(json, context);
335 }
336 if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_SET_NSH_CH4.type())) {
337 return context.codec(NiciraSetNshContextHeader.class).decode(json, context);
338 }
339 if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_MOV_ARP_SHA_TO_THA.type())
340 || type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_MOV_ARP_SPA_TO_TPA.type())
341 || type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_MOV_ETH_SRC_TO_DST.type())
342 || type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_MOV_IP_SRC_TO_DST.type())) {
343 return context.codec(MoveExtensionTreatment.class).decode(json, context);
344 }
345 throw new UnsupportedOperationException(
346 "Driver does not support extension type " + type.toString());
347 }
Jonathan Hart3c259162015-10-21 21:31:19 -0700348}