blob: 63fc63a7bdca83a2cb6fb1cb5c64e42056f94f65 [file] [log] [blame]
Thomas Vachuska781d18b2014-10-27 10:31:25 -07001/*
Ray Milkey34c95902015-04-15 09:47:53 -07002 * Copyright 2014-2015 Open Networking Laboratory
Thomas Vachuska781d18b2014-10-27 10:31:25 -07003 *
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07004 * 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
Thomas Vachuska781d18b2014-10-27 10:31:25 -07007 *
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07008 * 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.
Thomas Vachuska781d18b2014-10-27 10:31:25 -070015 */
Brian O'Connorabafb502014-12-02 22:26:20 -080016package org.onosproject.provider.of.flow.impl;
Jonathan Hart86e59352014-10-22 10:42:16 -070017
alshabib346b5b32015-03-06 00:42:16 -080018import com.google.common.collect.Lists;
Jonathan Hart29afca32015-01-20 18:17:39 -080019import org.onlab.packet.Ip4Address;
Pavlin Radoslavovfebe82c2015-02-11 19:08:15 -080020import org.onlab.packet.Ip6Address;
Sho SHIMIZUe397ffe2015-05-12 16:24:23 -070021import org.onosproject.net.OchSignal;
Charles M.C. Chanfe421812015-01-12 18:20:51 +080022import org.onosproject.net.PortNumber;
Brian O'Connorabafb502014-12-02 22:26:20 -080023import org.onosproject.net.flow.FlowRule;
24import org.onosproject.net.flow.TrafficTreatment;
25import org.onosproject.net.flow.instructions.Instruction;
alshabib9af70072015-02-09 14:34:16 -080026import org.onosproject.net.flow.instructions.Instructions;
sangho8995ac52015-02-04 11:29:03 -080027import org.onosproject.net.flow.instructions.Instructions.GroupInstruction;
alshabib9af70072015-02-09 14:34:16 -080028import org.onosproject.net.flow.instructions.Instructions.OutputInstruction;
Brian O'Connorabafb502014-12-02 22:26:20 -080029import org.onosproject.net.flow.instructions.L0ModificationInstruction;
30import org.onosproject.net.flow.instructions.L0ModificationInstruction.ModLambdaInstruction;
Sho SHIMIZUe397ffe2015-05-12 16:24:23 -070031import org.onosproject.net.flow.instructions.L0ModificationInstruction.ModOchSignalInstruction;
Brian O'Connorabafb502014-12-02 22:26:20 -080032import org.onosproject.net.flow.instructions.L2ModificationInstruction;
33import org.onosproject.net.flow.instructions.L2ModificationInstruction.ModEtherInstruction;
Jonathan Hart29afca32015-01-20 18:17:39 -080034import org.onosproject.net.flow.instructions.L2ModificationInstruction.ModMplsLabelInstruction;
Brian O'Connorabafb502014-12-02 22:26:20 -080035import org.onosproject.net.flow.instructions.L2ModificationInstruction.ModVlanIdInstruction;
36import org.onosproject.net.flow.instructions.L2ModificationInstruction.ModVlanPcpInstruction;
Brian O'Connorabafb502014-12-02 22:26:20 -080037import org.onosproject.net.flow.instructions.L2ModificationInstruction.PushHeaderInstructions;
38import org.onosproject.net.flow.instructions.L3ModificationInstruction;
39import org.onosproject.net.flow.instructions.L3ModificationInstruction.ModIPInstruction;
Pavlin Radoslavovfebe82c2015-02-11 19:08:15 -080040import org.onosproject.net.flow.instructions.L3ModificationInstruction.ModIPv6FlowLabelInstruction;
Jonathan Hart86e59352014-10-22 10:42:16 -070041import org.projectfloodlight.openflow.protocol.OFFactory;
42import org.projectfloodlight.openflow.protocol.OFFlowAdd;
43import org.projectfloodlight.openflow.protocol.OFFlowDelete;
44import org.projectfloodlight.openflow.protocol.OFFlowMod;
45import org.projectfloodlight.openflow.protocol.OFFlowModFlags;
46import org.projectfloodlight.openflow.protocol.action.OFAction;
sangho8995ac52015-02-04 11:29:03 -080047import org.projectfloodlight.openflow.protocol.action.OFActionGroup;
Charles M.C. Chanfe421812015-01-12 18:20:51 +080048import org.projectfloodlight.openflow.protocol.action.OFActionOutput;
alshabib9af70072015-02-09 14:34:16 -080049import org.projectfloodlight.openflow.protocol.instruction.OFInstruction;
Jonathan Hart86e59352014-10-22 10:42:16 -070050import org.projectfloodlight.openflow.protocol.match.Match;
51import org.projectfloodlight.openflow.protocol.oxm.OFOxm;
52import org.projectfloodlight.openflow.types.CircuitSignalID;
Praseed Balakrishnan8c67d172014-11-10 10:15:41 -080053import org.projectfloodlight.openflow.types.EthType;
Jonathan Hart86e59352014-10-22 10:42:16 -070054import org.projectfloodlight.openflow.types.IPv4Address;
Pavlin Radoslavovfebe82c2015-02-11 19:08:15 -080055import org.projectfloodlight.openflow.types.IPv6Address;
56import org.projectfloodlight.openflow.types.IPv6FlowLabel;
Jonathan Hart86e59352014-10-22 10:42:16 -070057import org.projectfloodlight.openflow.types.MacAddress;
58import org.projectfloodlight.openflow.types.OFBufferId;
sangho8995ac52015-02-04 11:29:03 -080059import org.projectfloodlight.openflow.types.OFGroup;
Jonathan Hart86e59352014-10-22 10:42:16 -070060import org.projectfloodlight.openflow.types.OFPort;
61import org.projectfloodlight.openflow.types.OFVlanVidMatch;
alshabib9af70072015-02-09 14:34:16 -080062import org.projectfloodlight.openflow.types.TableId;
Praseed Balakrishnan8c67d172014-11-10 10:15:41 -080063import org.projectfloodlight.openflow.types.U32;
Jonathan Hart86e59352014-10-22 10:42:16 -070064import org.projectfloodlight.openflow.types.U64;
65import org.projectfloodlight.openflow.types.VlanPcp;
66import org.slf4j.Logger;
67import org.slf4j.LoggerFactory;
68
Jonathan Hart29afca32015-01-20 18:17:39 -080069import java.util.Collections;
70import java.util.LinkedList;
71import java.util.List;
72import java.util.Optional;
73
Jonathan Hart86e59352014-10-22 10:42:16 -070074/**
75 * Flow mod builder for OpenFlow 1.3+.
76 */
77public class FlowModBuilderVer13 extends FlowModBuilder {
78
alshabib10580802015-02-18 18:30:33 -080079 private final Logger log = LoggerFactory.getLogger(getClass());
Charles M.C. Chanfe421812015-01-12 18:20:51 +080080 private static final int OFPCML_NO_BUFFER = 0xffff;
Jonathan Hart86e59352014-10-22 10:42:16 -070081
82 private final TrafficTreatment treatment;
83
84 /**
85 * Constructor for a flow mod builder for OpenFlow 1.3.
86 *
87 * @param flowRule the flow rule to transform into a flow mod
88 * @param factory the OpenFlow factory to use to build the flow mod
Pavlin Radoslavov119fd5c2014-11-25 19:08:19 -080089 * @param xid the transaction ID
Jonathan Hart86e59352014-10-22 10:42:16 -070090 */
Brian O'Connor427a1762014-11-19 18:40:32 -080091 protected FlowModBuilderVer13(FlowRule flowRule, OFFactory factory, Optional<Long> xid) {
92 super(flowRule, factory, xid);
Jonathan Hart86e59352014-10-22 10:42:16 -070093
94 this.treatment = flowRule.treatment();
95 }
96
97 @Override
98 public OFFlowAdd buildFlowAdd() {
99 Match match = buildMatch();
alshabib346b5b32015-03-06 00:42:16 -0800100 List<OFAction> deferredActions = buildActions(treatment.deferred());
101 List<OFAction> immediateActions = buildActions(treatment.immediate());
102 List<OFInstruction> instructions = Lists.newLinkedList();
Saurav Dascbe6de32015-03-01 18:30:46 -0800103
Jonathan Hartd4a8bba2014-10-28 12:44:20 -0700104
alshabib346b5b32015-03-06 00:42:16 -0800105 if (treatment.clearedDeferred()) {
106 instructions.add(factory().instructions().clearActions());
107 }
sangho1e575652015-05-14 00:39:53 -0700108 if (immediateActions.size() > 0) {
109 instructions.add(factory().instructions().applyActions(immediateActions));
110 }
alshabib346b5b32015-03-06 00:42:16 -0800111 if (deferredActions.size() > 0) {
112 instructions.add(factory().instructions().writeActions(deferredActions));
113 }
114 if (treatment.tableTransition() != null) {
115 instructions.add(buildTableGoto(treatment.tableTransition()));
Saurav Dascbe6de32015-03-01 18:30:46 -0800116 }
Saurav Das86af8f12015-05-25 23:55:33 -0700117 if (treatment.writeMetadata() != null) {
118 instructions.add(buildMetadata(treatment.writeMetadata()));
119 }
Jonathan Hart86e59352014-10-22 10:42:16 -0700120
121 long cookie = flowRule().id().value();
122
Jonathan Hart86e59352014-10-22 10:42:16 -0700123 OFFlowAdd fm = factory().buildFlowAdd()
Brian O'Connor427a1762014-11-19 18:40:32 -0800124 .setXid(xid)
Jonathan Hart86e59352014-10-22 10:42:16 -0700125 .setCookie(U64.of(cookie))
126 .setBufferId(OFBufferId.NO_BUFFER)
alshabib9af70072015-02-09 14:34:16 -0800127 .setInstructions(instructions)
Jonathan Hart86e59352014-10-22 10:42:16 -0700128 .setMatch(match)
129 .setFlags(Collections.singleton(OFFlowModFlags.SEND_FLOW_REM))
130 .setPriority(flowRule().priority())
alshabib08d98982015-04-21 16:25:50 -0700131 .setTableId(TableId.of(flowRule().tableId()))
Jonathan Hart86e59352014-10-22 10:42:16 -0700132 .build();
133
134 return fm;
135 }
136
137 @Override
138 public OFFlowMod buildFlowMod() {
139 Match match = buildMatch();
alshabib346b5b32015-03-06 00:42:16 -0800140 List<OFAction> deferredActions = buildActions(treatment.deferred());
141 List<OFAction> immediateActions = buildActions(treatment.immediate());
142 List<OFInstruction> instructions = Lists.newLinkedList();
Jonathan Harteda33872015-02-18 10:22:32 -0800143
alshabib346b5b32015-03-06 00:42:16 -0800144
145 if (immediateActions.size() > 0) {
146 instructions.add(factory().instructions().applyActions(immediateActions));
147 }
148 if (treatment.clearedDeferred()) {
149 instructions.add(factory().instructions().clearActions());
150 }
151 if (deferredActions.size() > 0) {
152 instructions.add(factory().instructions().writeActions(deferredActions));
153 }
154 if (treatment.tableTransition() != null) {
155 instructions.add(buildTableGoto(treatment.tableTransition()));
Saurav Dascbe6de32015-03-01 18:30:46 -0800156 }
Saurav Das86af8f12015-05-25 23:55:33 -0700157 if (treatment.writeMetadata() != null) {
158 instructions.add(buildMetadata(treatment.writeMetadata()));
159 }
Jonathan Hart86e59352014-10-22 10:42:16 -0700160
161 long cookie = flowRule().id().value();
162
Jonathan Hart86e59352014-10-22 10:42:16 -0700163 OFFlowMod fm = factory().buildFlowModify()
Brian O'Connor427a1762014-11-19 18:40:32 -0800164 .setXid(xid)
Jonathan Hart86e59352014-10-22 10:42:16 -0700165 .setCookie(U64.of(cookie))
166 .setBufferId(OFBufferId.NO_BUFFER)
alshabib9af70072015-02-09 14:34:16 -0800167 .setInstructions(instructions)
Jonathan Hart86e59352014-10-22 10:42:16 -0700168 .setMatch(match)
169 .setFlags(Collections.singleton(OFFlowModFlags.SEND_FLOW_REM))
170 .setPriority(flowRule().priority())
alshabib08d98982015-04-21 16:25:50 -0700171 .setTableId(TableId.of(flowRule().tableId()))
Jonathan Hart86e59352014-10-22 10:42:16 -0700172 .build();
173
174 return fm;
175 }
176
177 @Override
178 public OFFlowDelete buildFlowDel() {
179 Match match = buildMatch();
Jonathan Hart86e59352014-10-22 10:42:16 -0700180
181 long cookie = flowRule().id().value();
182
183 OFFlowDelete fm = factory().buildFlowDelete()
Brian O'Connor427a1762014-11-19 18:40:32 -0800184 .setXid(xid)
Jonathan Hart86e59352014-10-22 10:42:16 -0700185 .setCookie(U64.of(cookie))
186 .setBufferId(OFBufferId.NO_BUFFER)
Jonathan Hart86e59352014-10-22 10:42:16 -0700187 .setMatch(match)
188 .setFlags(Collections.singleton(OFFlowModFlags.SEND_FLOW_REM))
189 .setPriority(flowRule().priority())
alshabib08d98982015-04-21 16:25:50 -0700190 .setTableId(TableId.of(flowRule().tableId()))
Jonathan Hart86e59352014-10-22 10:42:16 -0700191 .build();
192
193 return fm;
194 }
195
alshabib346b5b32015-03-06 00:42:16 -0800196 private List<OFAction> buildActions(List<Instruction> treatments) {
Jonathan Hart86e59352014-10-22 10:42:16 -0700197 if (treatment == null) {
Sho SHIMIZU6601dd72015-05-11 19:00:29 -0700198 return Collections.emptyList();
Jonathan Hart86e59352014-10-22 10:42:16 -0700199 }
Sho SHIMIZU6601dd72015-05-11 19:00:29 -0700200
201 boolean tableFound = false;
202 List<OFAction> actions = new LinkedList<>();
alshabib346b5b32015-03-06 00:42:16 -0800203 for (Instruction i : treatments) {
Jonathan Hart86e59352014-10-22 10:42:16 -0700204 switch (i.type()) {
alshabib9af70072015-02-09 14:34:16 -0800205 case DROP:
Sho SHIMIZUb35ed362015-04-28 11:05:19 -0700206 return Collections.emptyList();
alshabib9af70072015-02-09 14:34:16 -0800207 case L0MODIFICATION:
208 actions.add(buildL0Modification(i));
209 break;
210 case L2MODIFICATION:
211 actions.add(buildL2Modification(i));
212 break;
213 case L3MODIFICATION:
214 actions.add(buildL3Modification(i));
215 break;
216 case OUTPUT:
217 OutputInstruction out = (OutputInstruction) i;
218 OFActionOutput.Builder action = factory().actions().buildOutput()
219 .setPort(OFPort.of((int) out.port().toLong()));
220 if (out.port().equals(PortNumber.CONTROLLER)) {
221 action.setMaxLen(OFPCML_NO_BUFFER);
222 }
223 actions.add(action.build());
224 break;
225 case GROUP:
226 GroupInstruction group = (GroupInstruction) i;
227 OFActionGroup.Builder groupBuilder = factory().actions().buildGroup()
228 .setGroup(OFGroup.of(group.groupId().id()));
229 actions.add(groupBuilder.build());
230 break;
alshabib10580802015-02-18 18:30:33 -0800231 case TABLE:
232 //FIXME: should not occur here.
Saurav Dascbe6de32015-03-01 18:30:46 -0800233 tableFound = true;
alshabib10580802015-02-18 18:30:33 -0800234 break;
alshabib9af70072015-02-09 14:34:16 -0800235 default:
236 log.warn("Instruction type {} not yet implemented.", i.type());
Jonathan Hart86e59352014-10-22 10:42:16 -0700237 }
238 }
Saurav Dascbe6de32015-03-01 18:30:46 -0800239 if (tableFound && actions.isEmpty()) {
240 // handles the case where there are no actions, but there is
241 // a goto instruction for the next table
Sho SHIMIZU6601dd72015-05-11 19:00:29 -0700242 return Collections.emptyList();
Saurav Dascbe6de32015-03-01 18:30:46 -0800243 }
Jonathan Hart86e59352014-10-22 10:42:16 -0700244 return actions;
245 }
246
alshabib9af70072015-02-09 14:34:16 -0800247 private OFInstruction buildTableGoto(Instructions.TableTypeTransition i) {
248 OFInstruction instruction = factory().instructions().gotoTable(
alshabibd17abc22015-04-21 18:26:35 -0700249 TableId.of(i.tableId()));
alshabib9af70072015-02-09 14:34:16 -0800250 return instruction;
251 }
252
Saurav Das86af8f12015-05-25 23:55:33 -0700253 private OFInstruction buildMetadata(Instructions.MetadataInstruction m) {
254 OFInstruction instruction = factory().instructions().writeMetadata(
255 U64.of(m.metadata()), U64.of(m.metadataMask()));
256 return instruction;
257 }
258
Jonathan Hart86e59352014-10-22 10:42:16 -0700259 private OFAction buildL0Modification(Instruction i) {
260 L0ModificationInstruction l0m = (L0ModificationInstruction) i;
261 switch (l0m.subtype()) {
Sho SHIMIZU5cd7ce92015-05-11 19:10:38 -0700262 case LAMBDA:
Sho SHIMIZUe397ffe2015-05-12 16:24:23 -0700263 return buildModLambdaInstruction((ModLambdaInstruction) i);
264 case OCH:
265 try {
266 return buildModOchSignalInstruction((ModOchSignalInstruction) i);
Sho SHIMIZUc17042d2015-05-28 12:07:23 -0700267 } catch (NoMappingFoundException e) {
Sho SHIMIZUe397ffe2015-05-12 16:24:23 -0700268 log.warn(e.getMessage());
269 break;
270 }
Sho SHIMIZU5cd7ce92015-05-11 19:10:38 -0700271 default:
272 log.warn("Unimplemented action type {}.", l0m.subtype());
273 break;
Jonathan Hart86e59352014-10-22 10:42:16 -0700274 }
275 return null;
276 }
277
Sho SHIMIZUe397ffe2015-05-12 16:24:23 -0700278 private OFAction buildModLambdaInstruction(ModLambdaInstruction instruction) {
279 return factory().actions().circuit(factory().oxms().ochSigidBasic(
280 new CircuitSignalID((byte) 1, (byte) 2, instruction.lambda(), (short) 1)));
281 }
282
283 private OFAction buildModOchSignalInstruction(ModOchSignalInstruction instruction) {
284 OchSignal signal = instruction.lambda();
Sho SHIMIZUc17042d2015-05-28 12:07:23 -0700285 byte gridType = OpenFlowValueMapper.lookupGridType(signal.gridType());
286 byte channelSpacing = OpenFlowValueMapper.lookupChannelSpacing(signal.channelSpacing());
Sho SHIMIZUe397ffe2015-05-12 16:24:23 -0700287
288 return factory().actions().circuit(factory().oxms().ochSigidBasic(
289 new CircuitSignalID(gridType, channelSpacing,
290 (short) signal.spacingMultiplier(), (short) signal.slotGranularity())
291 ));
292 }
293
Jonathan Hart86e59352014-10-22 10:42:16 -0700294 private OFAction buildL2Modification(Instruction i) {
295 L2ModificationInstruction l2m = (L2ModificationInstruction) i;
296 ModEtherInstruction eth;
297 OFOxm<?> oxm = null;
298 switch (l2m.subtype()) {
Praseed Balakrishnan8c67d172014-11-10 10:15:41 -0800299 case ETH_DST:
300 eth = (ModEtherInstruction) l2m;
301 oxm = factory().oxms().ethDst(MacAddress.of(eth.mac().toLong()));
302 break;
303 case ETH_SRC:
304 eth = (ModEtherInstruction) l2m;
305 oxm = factory().oxms().ethSrc(MacAddress.of(eth.mac().toLong()));
306 break;
307 case VLAN_ID:
308 ModVlanIdInstruction vlanId = (ModVlanIdInstruction) l2m;
309 oxm = factory().oxms().vlanVid(OFVlanVidMatch.ofVlan(vlanId.vlanId().toShort()));
310 break;
311 case VLAN_PCP:
312 ModVlanPcpInstruction vlanPcp = (ModVlanPcpInstruction) l2m;
313 oxm = factory().oxms().vlanPcp(VlanPcp.of(vlanPcp.vlanPcp()));
314 break;
315 case MPLS_PUSH:
316 PushHeaderInstructions pushHeaderInstructions =
317 (PushHeaderInstructions) l2m;
318 return factory().actions().pushMpls(EthType.of(pushHeaderInstructions
alshabib7b808c52015-06-26 14:22:24 -0700319 .ethernetType().toShort()));
Praseed Balakrishnan8c67d172014-11-10 10:15:41 -0800320 case MPLS_POP:
Jonathan Hart67fc0972015-03-19 15:21:20 -0700321 PushHeaderInstructions popHeaderInstructions =
Praseed Balakrishnan8c67d172014-11-10 10:15:41 -0800322 (PushHeaderInstructions) l2m;
323 return factory().actions().popMpls(EthType.of(popHeaderInstructions
alshabib7b808c52015-06-26 14:22:24 -0700324 .ethernetType().toShort()));
Praseed Balakrishnan8c67d172014-11-10 10:15:41 -0800325 case MPLS_LABEL:
326 ModMplsLabelInstruction mplsLabel =
327 (ModMplsLabelInstruction) l2m;
328 oxm = factory().oxms().mplsLabel(U32.of(mplsLabel.label()
329 .longValue()));
Praseed Balakrishnan8c67d172014-11-10 10:15:41 -0800330 break;
sangho3f97a17d2015-01-29 22:56:29 -0800331 case DEC_MPLS_TTL:
332 return factory().actions().decMplsTtl();
Saurav Dasfbe25c52015-03-04 11:12:00 -0800333 case VLAN_POP:
334 return factory().actions().popVlan();
Jonathan Hart54b406b2015-03-06 16:24:14 -0800335 case VLAN_PUSH:
336 PushHeaderInstructions pushVlanInstruction = (PushHeaderInstructions) l2m;
337 return factory().actions().pushVlan(
alshabib7b808c52015-06-26 14:22:24 -0700338 EthType.of(pushVlanInstruction.ethernetType().toShort()));
Praseed Balakrishnan8c67d172014-11-10 10:15:41 -0800339 default:
340 log.warn("Unimplemented action type {}.", l2m.subtype());
341 break;
Jonathan Hart86e59352014-10-22 10:42:16 -0700342 }
343
344 if (oxm != null) {
345 return factory().actions().buildSetField().setField(oxm).build();
346 }
347 return null;
348 }
349
350 private OFAction buildL3Modification(Instruction i) {
351 L3ModificationInstruction l3m = (L3ModificationInstruction) i;
352 ModIPInstruction ip;
Pavlin Radoslavov23e398d2014-11-05 15:17:57 -0800353 Ip4Address ip4;
Pavlin Radoslavovfebe82c2015-02-11 19:08:15 -0800354 Ip6Address ip6;
Jonathan Hart86e59352014-10-22 10:42:16 -0700355 OFOxm<?> oxm = null;
356 switch (l3m.subtype()) {
Sho SHIMIZU5cd7ce92015-05-11 19:10:38 -0700357 case IPV4_SRC:
358 ip = (ModIPInstruction) i;
359 ip4 = ip.ip().getIp4Address();
360 oxm = factory().oxms().ipv4Src(IPv4Address.of(ip4.toInt()));
361 break;
362 case IPV4_DST:
363 ip = (ModIPInstruction) i;
364 ip4 = ip.ip().getIp4Address();
365 oxm = factory().oxms().ipv4Dst(IPv4Address.of(ip4.toInt()));
366 break;
367 case IPV6_SRC:
368 ip = (ModIPInstruction) i;
369 ip6 = ip.ip().getIp6Address();
370 oxm = factory().oxms().ipv6Src(IPv6Address.of(ip6.toOctets()));
371 break;
372 case IPV6_DST:
373 ip = (ModIPInstruction) i;
374 ip6 = ip.ip().getIp6Address();
375 oxm = factory().oxms().ipv6Dst(IPv6Address.of(ip6.toOctets()));
376 break;
377 case IPV6_FLABEL:
378 ModIPv6FlowLabelInstruction flowLabelInstruction =
379 (ModIPv6FlowLabelInstruction) i;
380 int flowLabel = flowLabelInstruction.flowLabel();
381 oxm = factory().oxms().ipv6Flabel(IPv6FlowLabel.of(flowLabel));
382 break;
383 case DEC_TTL:
384 return factory().actions().decNwTtl();
385 case TTL_IN:
386 return factory().actions().copyTtlIn();
387 case TTL_OUT:
388 return factory().actions().copyTtlOut();
389 default:
390 log.warn("Unimplemented action type {}.", l3m.subtype());
391 break;
Jonathan Hart86e59352014-10-22 10:42:16 -0700392 }
393
394 if (oxm != null) {
395 return factory().actions().buildSetField().setField(oxm).build();
396 }
397 return null;
398 }
399
400}