Thomas Vachuska | 781d18b | 2014-10-27 10:31:25 -0700 | [diff] [blame] | 1 | /* |
Ray Milkey | 34c9590 | 2015-04-15 09:47:53 -0700 | [diff] [blame] | 2 | * Copyright 2014-2015 Open Networking Laboratory |
Thomas Vachuska | 781d18b | 2014-10-27 10:31:25 -0700 | [diff] [blame] | 3 | * |
Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 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 |
Thomas Vachuska | 781d18b | 2014-10-27 10:31:25 -0700 | [diff] [blame] | 7 | * |
Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 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. |
Thomas Vachuska | 781d18b | 2014-10-27 10:31:25 -0700 | [diff] [blame] | 15 | */ |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 16 | package org.onosproject.provider.of.flow.impl; |
Jonathan Hart | 86e5935 | 2014-10-22 10:42:16 -0700 | [diff] [blame] | 17 | |
alshabib | 346b5b3 | 2015-03-06 00:42:16 -0800 | [diff] [blame] | 18 | import com.google.common.collect.Lists; |
Jonathan Hart | 29afca3 | 2015-01-20 18:17:39 -0800 | [diff] [blame] | 19 | import org.onlab.packet.Ip4Address; |
Pavlin Radoslavov | febe82c | 2015-02-11 19:08:15 -0800 | [diff] [blame] | 20 | import org.onlab.packet.Ip6Address; |
Sho SHIMIZU | e397ffe | 2015-05-12 16:24:23 -0700 | [diff] [blame] | 21 | import org.onosproject.net.OchSignal; |
Yafit Hadar | 7351461 | 2015-11-04 10:14:21 +0200 | [diff] [blame] | 22 | import org.onosproject.net.OduSignalId; |
Charles M.C. Chan | fe42181 | 2015-01-12 18:20:51 +0800 | [diff] [blame] | 23 | import org.onosproject.net.PortNumber; |
Jonathan Hart | 3c25916 | 2015-10-21 21:31:19 -0700 | [diff] [blame] | 24 | import org.onosproject.net.driver.DefaultDriverData; |
| 25 | import org.onosproject.net.driver.DefaultDriverHandler; |
| 26 | import org.onosproject.net.driver.Driver; |
| 27 | import org.onosproject.net.driver.DriverService; |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 28 | import org.onosproject.net.flow.FlowRule; |
| 29 | import org.onosproject.net.flow.TrafficTreatment; |
alshabib | 880b644 | 2015-11-23 22:13:04 -0800 | [diff] [blame] | 30 | import org.onosproject.net.flow.instructions.ExtensionTreatment; |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 31 | import org.onosproject.net.flow.instructions.Instruction; |
alshabib | 9af7007 | 2015-02-09 14:34:16 -0800 | [diff] [blame] | 32 | import org.onosproject.net.flow.instructions.Instructions; |
sangho | 8995ac5 | 2015-02-04 11:29:03 -0800 | [diff] [blame] | 33 | import org.onosproject.net.flow.instructions.Instructions.GroupInstruction; |
alshabib | 9af7007 | 2015-02-09 14:34:16 -0800 | [diff] [blame] | 34 | import org.onosproject.net.flow.instructions.Instructions.OutputInstruction; |
Steffen Gebert | bbfdaaa | 2015-09-29 11:01:46 +0200 | [diff] [blame] | 35 | import org.onosproject.net.flow.instructions.Instructions.SetQueueInstruction; |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 36 | import org.onosproject.net.flow.instructions.L0ModificationInstruction; |
| 37 | import org.onosproject.net.flow.instructions.L0ModificationInstruction.ModLambdaInstruction; |
Sho SHIMIZU | e397ffe | 2015-05-12 16:24:23 -0700 | [diff] [blame] | 38 | import org.onosproject.net.flow.instructions.L0ModificationInstruction.ModOchSignalInstruction; |
Yafit Hadar | 7351461 | 2015-11-04 10:14:21 +0200 | [diff] [blame] | 39 | import org.onosproject.net.flow.instructions.L1ModificationInstruction; |
| 40 | import org.onosproject.net.flow.instructions.L1ModificationInstruction.ModOduSignalIdInstruction; |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 41 | import org.onosproject.net.flow.instructions.L2ModificationInstruction; |
| 42 | import org.onosproject.net.flow.instructions.L2ModificationInstruction.ModEtherInstruction; |
Saurav Das | 73a7dd4 | 2015-08-19 22:20:31 -0700 | [diff] [blame] | 43 | import org.onosproject.net.flow.instructions.L2ModificationInstruction.ModMplsBosInstruction; |
Jonathan Hart | 29afca3 | 2015-01-20 18:17:39 -0800 | [diff] [blame] | 44 | import org.onosproject.net.flow.instructions.L2ModificationInstruction.ModMplsLabelInstruction; |
Jonathan Hart | 3c25916 | 2015-10-21 21:31:19 -0700 | [diff] [blame] | 45 | import org.onosproject.net.flow.instructions.L2ModificationInstruction.ModTunnelIdInstruction; |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 46 | import org.onosproject.net.flow.instructions.L2ModificationInstruction.ModVlanIdInstruction; |
| 47 | import org.onosproject.net.flow.instructions.L2ModificationInstruction.ModVlanPcpInstruction; |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 48 | import org.onosproject.net.flow.instructions.L2ModificationInstruction.PushHeaderInstructions; |
| 49 | import org.onosproject.net.flow.instructions.L3ModificationInstruction; |
| 50 | import org.onosproject.net.flow.instructions.L3ModificationInstruction.ModIPInstruction; |
lishuai | 3cce60b | 2015-12-01 19:35:16 +0800 | [diff] [blame] | 51 | import org.onosproject.net.flow.instructions.L3ModificationInstruction.ModArpIPInstruction; |
| 52 | import org.onosproject.net.flow.instructions.L3ModificationInstruction.ModArpEthInstruction; |
| 53 | import org.onosproject.net.flow.instructions.L3ModificationInstruction.ModArpOpInstruction; |
Pavlin Radoslavov | febe82c | 2015-02-11 19:08:15 -0800 | [diff] [blame] | 54 | import org.onosproject.net.flow.instructions.L3ModificationInstruction.ModIPv6FlowLabelInstruction; |
Hyunsun Moon | c8bd97c | 2015-07-18 22:47:33 -0700 | [diff] [blame] | 55 | import org.onosproject.net.flow.instructions.L4ModificationInstruction; |
| 56 | import org.onosproject.net.flow.instructions.L4ModificationInstruction.ModTransportPortInstruction; |
alshabib | 880b644 | 2015-11-23 22:13:04 -0800 | [diff] [blame] | 57 | import org.onosproject.openflow.controller.ExtensionTreatmentInterpreter; |
Jonathan Hart | 86e5935 | 2014-10-22 10:42:16 -0700 | [diff] [blame] | 58 | import org.projectfloodlight.openflow.protocol.OFFactory; |
| 59 | import org.projectfloodlight.openflow.protocol.OFFlowAdd; |
| 60 | import org.projectfloodlight.openflow.protocol.OFFlowDelete; |
| 61 | import org.projectfloodlight.openflow.protocol.OFFlowMod; |
| 62 | import org.projectfloodlight.openflow.protocol.OFFlowModFlags; |
| 63 | import org.projectfloodlight.openflow.protocol.action.OFAction; |
sangho | 8995ac5 | 2015-02-04 11:29:03 -0800 | [diff] [blame] | 64 | import org.projectfloodlight.openflow.protocol.action.OFActionGroup; |
Charles M.C. Chan | fe42181 | 2015-01-12 18:20:51 +0800 | [diff] [blame] | 65 | import org.projectfloodlight.openflow.protocol.action.OFActionOutput; |
Steffen Gebert | bbfdaaa | 2015-09-29 11:01:46 +0200 | [diff] [blame] | 66 | import org.projectfloodlight.openflow.protocol.action.OFActionSetQueue; |
alshabib | 9af7007 | 2015-02-09 14:34:16 -0800 | [diff] [blame] | 67 | import org.projectfloodlight.openflow.protocol.instruction.OFInstruction; |
Jonathan Hart | 86e5935 | 2014-10-22 10:42:16 -0700 | [diff] [blame] | 68 | import org.projectfloodlight.openflow.protocol.match.Match; |
| 69 | import org.projectfloodlight.openflow.protocol.oxm.OFOxm; |
lishuai | 3cce60b | 2015-12-01 19:35:16 +0800 | [diff] [blame] | 70 | import org.projectfloodlight.openflow.types.ArpOpcode; |
Jonathan Hart | 86e5935 | 2014-10-22 10:42:16 -0700 | [diff] [blame] | 71 | import org.projectfloodlight.openflow.types.CircuitSignalID; |
Praseed Balakrishnan | 8c67d17 | 2014-11-10 10:15:41 -0800 | [diff] [blame] | 72 | import org.projectfloodlight.openflow.types.EthType; |
Jonathan Hart | 86e5935 | 2014-10-22 10:42:16 -0700 | [diff] [blame] | 73 | import org.projectfloodlight.openflow.types.IPv4Address; |
Pavlin Radoslavov | febe82c | 2015-02-11 19:08:15 -0800 | [diff] [blame] | 74 | import org.projectfloodlight.openflow.types.IPv6Address; |
| 75 | import org.projectfloodlight.openflow.types.IPv6FlowLabel; |
Jonathan Hart | 86e5935 | 2014-10-22 10:42:16 -0700 | [diff] [blame] | 76 | import org.projectfloodlight.openflow.types.MacAddress; |
Saurav Das | 73a7dd4 | 2015-08-19 22:20:31 -0700 | [diff] [blame] | 77 | import org.projectfloodlight.openflow.types.OFBooleanValue; |
Jonathan Hart | 86e5935 | 2014-10-22 10:42:16 -0700 | [diff] [blame] | 78 | import org.projectfloodlight.openflow.types.OFBufferId; |
sangho | 8995ac5 | 2015-02-04 11:29:03 -0800 | [diff] [blame] | 79 | import org.projectfloodlight.openflow.types.OFGroup; |
Jonathan Hart | 86e5935 | 2014-10-22 10:42:16 -0700 | [diff] [blame] | 80 | import org.projectfloodlight.openflow.types.OFPort; |
| 81 | import org.projectfloodlight.openflow.types.OFVlanVidMatch; |
Yafit Hadar | 7351461 | 2015-11-04 10:14:21 +0200 | [diff] [blame] | 82 | import org.projectfloodlight.openflow.types.OduSignalID; |
alshabib | 9af7007 | 2015-02-09 14:34:16 -0800 | [diff] [blame] | 83 | import org.projectfloodlight.openflow.types.TableId; |
Hyunsun Moon | c8bd97c | 2015-07-18 22:47:33 -0700 | [diff] [blame] | 84 | import org.projectfloodlight.openflow.types.TransportPort; |
Praseed Balakrishnan | 8c67d17 | 2014-11-10 10:15:41 -0800 | [diff] [blame] | 85 | import org.projectfloodlight.openflow.types.U32; |
Jonathan Hart | 86e5935 | 2014-10-22 10:42:16 -0700 | [diff] [blame] | 86 | import org.projectfloodlight.openflow.types.U64; |
| 87 | import org.projectfloodlight.openflow.types.VlanPcp; |
| 88 | import org.slf4j.Logger; |
| 89 | import org.slf4j.LoggerFactory; |
| 90 | |
Jonathan Hart | 29afca3 | 2015-01-20 18:17:39 -0800 | [diff] [blame] | 91 | import java.util.Collections; |
| 92 | import java.util.LinkedList; |
| 93 | import java.util.List; |
| 94 | import java.util.Optional; |
| 95 | |
Jonathan Hart | 86e5935 | 2014-10-22 10:42:16 -0700 | [diff] [blame] | 96 | /** |
| 97 | * Flow mod builder for OpenFlow 1.3+. |
| 98 | */ |
| 99 | public class FlowModBuilderVer13 extends FlowModBuilder { |
| 100 | |
alshabib | 1058080 | 2015-02-18 18:30:33 -0800 | [diff] [blame] | 101 | private final Logger log = LoggerFactory.getLogger(getClass()); |
Charles M.C. Chan | fe42181 | 2015-01-12 18:20:51 +0800 | [diff] [blame] | 102 | private static final int OFPCML_NO_BUFFER = 0xffff; |
Jonathan Hart | 86e5935 | 2014-10-22 10:42:16 -0700 | [diff] [blame] | 103 | |
| 104 | private final TrafficTreatment treatment; |
| 105 | |
| 106 | /** |
| 107 | * Constructor for a flow mod builder for OpenFlow 1.3. |
| 108 | * |
| 109 | * @param flowRule the flow rule to transform into a flow mod |
| 110 | * @param factory the OpenFlow factory to use to build the flow mod |
Pavlin Radoslavov | 119fd5c | 2014-11-25 19:08:19 -0800 | [diff] [blame] | 111 | * @param xid the transaction ID |
Charles Chan | 30ba400 | 2015-11-05 14:45:16 -0800 | [diff] [blame] | 112 | * @param driverService the device driver service |
Jonathan Hart | 86e5935 | 2014-10-22 10:42:16 -0700 | [diff] [blame] | 113 | */ |
Jonathan Hart | 3c25916 | 2015-10-21 21:31:19 -0700 | [diff] [blame] | 114 | protected FlowModBuilderVer13(FlowRule flowRule, OFFactory factory, Optional<Long> xid, |
| 115 | Optional<DriverService> driverService) { |
| 116 | super(flowRule, factory, xid, driverService); |
Jonathan Hart | 86e5935 | 2014-10-22 10:42:16 -0700 | [diff] [blame] | 117 | |
| 118 | this.treatment = flowRule.treatment(); |
| 119 | } |
| 120 | |
| 121 | @Override |
| 122 | public OFFlowAdd buildFlowAdd() { |
| 123 | Match match = buildMatch(); |
alshabib | 346b5b3 | 2015-03-06 00:42:16 -0800 | [diff] [blame] | 124 | List<OFAction> deferredActions = buildActions(treatment.deferred()); |
| 125 | List<OFAction> immediateActions = buildActions(treatment.immediate()); |
| 126 | List<OFInstruction> instructions = Lists.newLinkedList(); |
Saurav Das | cbe6de3 | 2015-03-01 18:30:46 -0800 | [diff] [blame] | 127 | |
Jonathan Hart | d4a8bba | 2014-10-28 12:44:20 -0700 | [diff] [blame] | 128 | |
alshabib | 346b5b3 | 2015-03-06 00:42:16 -0800 | [diff] [blame] | 129 | if (treatment.clearedDeferred()) { |
| 130 | instructions.add(factory().instructions().clearActions()); |
| 131 | } |
sangho | 1e57565 | 2015-05-14 00:39:53 -0700 | [diff] [blame] | 132 | if (immediateActions.size() > 0) { |
| 133 | instructions.add(factory().instructions().applyActions(immediateActions)); |
| 134 | } |
alshabib | 346b5b3 | 2015-03-06 00:42:16 -0800 | [diff] [blame] | 135 | if (deferredActions.size() > 0) { |
| 136 | instructions.add(factory().instructions().writeActions(deferredActions)); |
| 137 | } |
| 138 | if (treatment.tableTransition() != null) { |
| 139 | instructions.add(buildTableGoto(treatment.tableTransition())); |
Saurav Das | cbe6de3 | 2015-03-01 18:30:46 -0800 | [diff] [blame] | 140 | } |
Saurav Das | 86af8f1 | 2015-05-25 23:55:33 -0700 | [diff] [blame] | 141 | if (treatment.writeMetadata() != null) { |
| 142 | instructions.add(buildMetadata(treatment.writeMetadata())); |
| 143 | } |
chengfan | e264bef | 2015-09-28 08:38:19 +0800 | [diff] [blame] | 144 | if (treatment.metered() != null) { |
| 145 | instructions.add(buildMeter(treatment.metered())); |
| 146 | } |
Jonathan Hart | 86e5935 | 2014-10-22 10:42:16 -0700 | [diff] [blame] | 147 | |
| 148 | long cookie = flowRule().id().value(); |
| 149 | |
Jonathan Hart | 86e5935 | 2014-10-22 10:42:16 -0700 | [diff] [blame] | 150 | OFFlowAdd fm = factory().buildFlowAdd() |
Brian O'Connor | 427a176 | 2014-11-19 18:40:32 -0800 | [diff] [blame] | 151 | .setXid(xid) |
Jonathan Hart | 86e5935 | 2014-10-22 10:42:16 -0700 | [diff] [blame] | 152 | .setCookie(U64.of(cookie)) |
| 153 | .setBufferId(OFBufferId.NO_BUFFER) |
alshabib | 9af7007 | 2015-02-09 14:34:16 -0800 | [diff] [blame] | 154 | .setInstructions(instructions) |
Jonathan Hart | 86e5935 | 2014-10-22 10:42:16 -0700 | [diff] [blame] | 155 | .setMatch(match) |
| 156 | .setFlags(Collections.singleton(OFFlowModFlags.SEND_FLOW_REM)) |
| 157 | .setPriority(flowRule().priority()) |
alshabib | 08d9898 | 2015-04-21 16:25:50 -0700 | [diff] [blame] | 158 | .setTableId(TableId.of(flowRule().tableId())) |
Jonathan Hart | 86e5935 | 2014-10-22 10:42:16 -0700 | [diff] [blame] | 159 | .build(); |
| 160 | |
| 161 | return fm; |
| 162 | } |
| 163 | |
| 164 | @Override |
| 165 | public OFFlowMod buildFlowMod() { |
| 166 | Match match = buildMatch(); |
alshabib | 346b5b3 | 2015-03-06 00:42:16 -0800 | [diff] [blame] | 167 | List<OFAction> deferredActions = buildActions(treatment.deferred()); |
| 168 | List<OFAction> immediateActions = buildActions(treatment.immediate()); |
| 169 | List<OFInstruction> instructions = Lists.newLinkedList(); |
Jonathan Hart | eda3387 | 2015-02-18 10:22:32 -0800 | [diff] [blame] | 170 | |
alshabib | 346b5b3 | 2015-03-06 00:42:16 -0800 | [diff] [blame] | 171 | |
| 172 | if (immediateActions.size() > 0) { |
| 173 | instructions.add(factory().instructions().applyActions(immediateActions)); |
| 174 | } |
| 175 | if (treatment.clearedDeferred()) { |
| 176 | instructions.add(factory().instructions().clearActions()); |
| 177 | } |
| 178 | if (deferredActions.size() > 0) { |
| 179 | instructions.add(factory().instructions().writeActions(deferredActions)); |
| 180 | } |
| 181 | if (treatment.tableTransition() != null) { |
| 182 | instructions.add(buildTableGoto(treatment.tableTransition())); |
Saurav Das | cbe6de3 | 2015-03-01 18:30:46 -0800 | [diff] [blame] | 183 | } |
Saurav Das | 86af8f1 | 2015-05-25 23:55:33 -0700 | [diff] [blame] | 184 | if (treatment.writeMetadata() != null) { |
| 185 | instructions.add(buildMetadata(treatment.writeMetadata())); |
| 186 | } |
alshabib | 10c810b | 2015-08-18 16:59:04 -0700 | [diff] [blame] | 187 | if (treatment.metered() != null) { |
| 188 | instructions.add(buildMeter(treatment.metered())); |
| 189 | } |
Jonathan Hart | 86e5935 | 2014-10-22 10:42:16 -0700 | [diff] [blame] | 190 | |
| 191 | long cookie = flowRule().id().value(); |
| 192 | |
Jonathan Hart | 86e5935 | 2014-10-22 10:42:16 -0700 | [diff] [blame] | 193 | OFFlowMod fm = factory().buildFlowModify() |
Brian O'Connor | 427a176 | 2014-11-19 18:40:32 -0800 | [diff] [blame] | 194 | .setXid(xid) |
Jonathan Hart | 86e5935 | 2014-10-22 10:42:16 -0700 | [diff] [blame] | 195 | .setCookie(U64.of(cookie)) |
| 196 | .setBufferId(OFBufferId.NO_BUFFER) |
alshabib | 9af7007 | 2015-02-09 14:34:16 -0800 | [diff] [blame] | 197 | .setInstructions(instructions) |
Jonathan Hart | 86e5935 | 2014-10-22 10:42:16 -0700 | [diff] [blame] | 198 | .setMatch(match) |
| 199 | .setFlags(Collections.singleton(OFFlowModFlags.SEND_FLOW_REM)) |
| 200 | .setPriority(flowRule().priority()) |
alshabib | 08d9898 | 2015-04-21 16:25:50 -0700 | [diff] [blame] | 201 | .setTableId(TableId.of(flowRule().tableId())) |
Jonathan Hart | 86e5935 | 2014-10-22 10:42:16 -0700 | [diff] [blame] | 202 | .build(); |
| 203 | |
| 204 | return fm; |
| 205 | } |
| 206 | |
| 207 | @Override |
| 208 | public OFFlowDelete buildFlowDel() { |
| 209 | Match match = buildMatch(); |
Jonathan Hart | 86e5935 | 2014-10-22 10:42:16 -0700 | [diff] [blame] | 210 | |
| 211 | long cookie = flowRule().id().value(); |
| 212 | |
| 213 | OFFlowDelete fm = factory().buildFlowDelete() |
Brian O'Connor | 427a176 | 2014-11-19 18:40:32 -0800 | [diff] [blame] | 214 | .setXid(xid) |
Jonathan Hart | 86e5935 | 2014-10-22 10:42:16 -0700 | [diff] [blame] | 215 | .setCookie(U64.of(cookie)) |
| 216 | .setBufferId(OFBufferId.NO_BUFFER) |
Jonathan Hart | 86e5935 | 2014-10-22 10:42:16 -0700 | [diff] [blame] | 217 | .setMatch(match) |
| 218 | .setFlags(Collections.singleton(OFFlowModFlags.SEND_FLOW_REM)) |
| 219 | .setPriority(flowRule().priority()) |
alshabib | 08d9898 | 2015-04-21 16:25:50 -0700 | [diff] [blame] | 220 | .setTableId(TableId.of(flowRule().tableId())) |
Jonathan Hart | 86e5935 | 2014-10-22 10:42:16 -0700 | [diff] [blame] | 221 | .build(); |
| 222 | |
| 223 | return fm; |
| 224 | } |
| 225 | |
alshabib | 346b5b3 | 2015-03-06 00:42:16 -0800 | [diff] [blame] | 226 | private List<OFAction> buildActions(List<Instruction> treatments) { |
Jonathan Hart | 86e5935 | 2014-10-22 10:42:16 -0700 | [diff] [blame] | 227 | if (treatment == null) { |
Sho SHIMIZU | 6601dd7 | 2015-05-11 19:00:29 -0700 | [diff] [blame] | 228 | return Collections.emptyList(); |
Jonathan Hart | 86e5935 | 2014-10-22 10:42:16 -0700 | [diff] [blame] | 229 | } |
Sho SHIMIZU | 6601dd7 | 2015-05-11 19:00:29 -0700 | [diff] [blame] | 230 | |
| 231 | boolean tableFound = false; |
| 232 | List<OFAction> actions = new LinkedList<>(); |
alshabib | 346b5b3 | 2015-03-06 00:42:16 -0800 | [diff] [blame] | 233 | for (Instruction i : treatments) { |
Jonathan Hart | 86e5935 | 2014-10-22 10:42:16 -0700 | [diff] [blame] | 234 | switch (i.type()) { |
alshabib | 9af7007 | 2015-02-09 14:34:16 -0800 | [diff] [blame] | 235 | case DROP: |
Charles Chan | 7efabeb | 2015-09-28 15:12:19 -0700 | [diff] [blame] | 236 | case NOACTION: |
Sho SHIMIZU | b35ed36 | 2015-04-28 11:05:19 -0700 | [diff] [blame] | 237 | return Collections.emptyList(); |
alshabib | 9af7007 | 2015-02-09 14:34:16 -0800 | [diff] [blame] | 238 | case L0MODIFICATION: |
| 239 | actions.add(buildL0Modification(i)); |
| 240 | break; |
Yafit Hadar | 7351461 | 2015-11-04 10:14:21 +0200 | [diff] [blame] | 241 | case L1MODIFICATION: |
| 242 | actions.add(buildL1Modification(i)); |
| 243 | break; |
alshabib | 9af7007 | 2015-02-09 14:34:16 -0800 | [diff] [blame] | 244 | case L2MODIFICATION: |
| 245 | actions.add(buildL2Modification(i)); |
| 246 | break; |
| 247 | case L3MODIFICATION: |
| 248 | actions.add(buildL3Modification(i)); |
| 249 | break; |
Hyunsun Moon | c8bd97c | 2015-07-18 22:47:33 -0700 | [diff] [blame] | 250 | case L4MODIFICATION: |
| 251 | actions.add(buildL4Modification(i)); |
| 252 | break; |
alshabib | 9af7007 | 2015-02-09 14:34:16 -0800 | [diff] [blame] | 253 | case OUTPUT: |
| 254 | OutputInstruction out = (OutputInstruction) i; |
| 255 | OFActionOutput.Builder action = factory().actions().buildOutput() |
| 256 | .setPort(OFPort.of((int) out.port().toLong())); |
| 257 | if (out.port().equals(PortNumber.CONTROLLER)) { |
| 258 | action.setMaxLen(OFPCML_NO_BUFFER); |
| 259 | } |
| 260 | actions.add(action.build()); |
| 261 | break; |
| 262 | case GROUP: |
| 263 | GroupInstruction group = (GroupInstruction) i; |
| 264 | OFActionGroup.Builder groupBuilder = factory().actions().buildGroup() |
| 265 | .setGroup(OFGroup.of(group.groupId().id())); |
| 266 | actions.add(groupBuilder.build()); |
| 267 | break; |
Steffen Gebert | bbfdaaa | 2015-09-29 11:01:46 +0200 | [diff] [blame] | 268 | case QUEUE: |
| 269 | SetQueueInstruction queue = (SetQueueInstruction) i; |
| 270 | OFActionSetQueue.Builder queueBuilder = factory().actions().buildSetQueue() |
| 271 | .setQueueId(queue.queueId()); |
| 272 | actions.add(queueBuilder.build()); |
| 273 | break; |
alshabib | 1058080 | 2015-02-18 18:30:33 -0800 | [diff] [blame] | 274 | case TABLE: |
| 275 | //FIXME: should not occur here. |
Saurav Das | cbe6de3 | 2015-03-01 18:30:46 -0800 | [diff] [blame] | 276 | tableFound = true; |
alshabib | 1058080 | 2015-02-18 18:30:33 -0800 | [diff] [blame] | 277 | break; |
Jonathan Hart | 3c25916 | 2015-10-21 21:31:19 -0700 | [diff] [blame] | 278 | case EXTENSION: |
| 279 | actions.add(buildExtensionAction(((Instructions.ExtensionInstructionWrapper) i) |
| 280 | .extensionInstruction())); |
| 281 | break; |
alshabib | 9af7007 | 2015-02-09 14:34:16 -0800 | [diff] [blame] | 282 | default: |
| 283 | log.warn("Instruction type {} not yet implemented.", i.type()); |
Jonathan Hart | 86e5935 | 2014-10-22 10:42:16 -0700 | [diff] [blame] | 284 | } |
| 285 | } |
Saurav Das | cbe6de3 | 2015-03-01 18:30:46 -0800 | [diff] [blame] | 286 | if (tableFound && actions.isEmpty()) { |
| 287 | // handles the case where there are no actions, but there is |
| 288 | // a goto instruction for the next table |
Sho SHIMIZU | 6601dd7 | 2015-05-11 19:00:29 -0700 | [diff] [blame] | 289 | return Collections.emptyList(); |
Saurav Das | cbe6de3 | 2015-03-01 18:30:46 -0800 | [diff] [blame] | 290 | } |
Jonathan Hart | 86e5935 | 2014-10-22 10:42:16 -0700 | [diff] [blame] | 291 | return actions; |
| 292 | } |
| 293 | |
alshabib | 9af7007 | 2015-02-09 14:34:16 -0800 | [diff] [blame] | 294 | private OFInstruction buildTableGoto(Instructions.TableTypeTransition i) { |
| 295 | OFInstruction instruction = factory().instructions().gotoTable( |
alshabib | d17abc2 | 2015-04-21 18:26:35 -0700 | [diff] [blame] | 296 | TableId.of(i.tableId())); |
alshabib | 9af7007 | 2015-02-09 14:34:16 -0800 | [diff] [blame] | 297 | return instruction; |
| 298 | } |
| 299 | |
Saurav Das | 86af8f1 | 2015-05-25 23:55:33 -0700 | [diff] [blame] | 300 | private OFInstruction buildMetadata(Instructions.MetadataInstruction m) { |
| 301 | OFInstruction instruction = factory().instructions().writeMetadata( |
| 302 | U64.of(m.metadata()), U64.of(m.metadataMask())); |
| 303 | return instruction; |
| 304 | } |
| 305 | |
alshabib | 10c810b | 2015-08-18 16:59:04 -0700 | [diff] [blame] | 306 | private OFInstruction buildMeter(Instructions.MeterInstruction metered) { |
| 307 | return factory().instructions().meter(metered.meterId().id()); |
| 308 | } |
| 309 | |
| 310 | |
Jonathan Hart | 86e5935 | 2014-10-22 10:42:16 -0700 | [diff] [blame] | 311 | private OFAction buildL0Modification(Instruction i) { |
| 312 | L0ModificationInstruction l0m = (L0ModificationInstruction) i; |
Yafit Hadar | 7351461 | 2015-11-04 10:14:21 +0200 | [diff] [blame] | 313 | OFOxm<?> oxm = null; |
Jonathan Hart | 86e5935 | 2014-10-22 10:42:16 -0700 | [diff] [blame] | 314 | switch (l0m.subtype()) { |
Sho SHIMIZU | 5cd7ce9 | 2015-05-11 19:10:38 -0700 | [diff] [blame] | 315 | case LAMBDA: |
Sho SHIMIZU | e397ffe | 2015-05-12 16:24:23 -0700 | [diff] [blame] | 316 | return buildModLambdaInstruction((ModLambdaInstruction) i); |
| 317 | case OCH: |
| 318 | try { |
Yafit Hadar | 7351461 | 2015-11-04 10:14:21 +0200 | [diff] [blame] | 319 | ModOchSignalInstruction modOchSignalInstruction = (ModOchSignalInstruction) l0m; |
| 320 | OchSignal signal = modOchSignalInstruction.lambda(); |
| 321 | byte gridType = OpenFlowValueMapper.lookupGridType(signal.gridType()); |
| 322 | byte channelSpacing = OpenFlowValueMapper.lookupChannelSpacing(signal.channelSpacing()); |
| 323 | oxm = factory().oxms().expOchSigId( |
| 324 | new CircuitSignalID(gridType, channelSpacing, |
| 325 | (short) signal.spacingMultiplier(), (short) signal.slotGranularity())); |
Sho SHIMIZU | c17042d | 2015-05-28 12:07:23 -0700 | [diff] [blame] | 326 | } catch (NoMappingFoundException e) { |
Sho SHIMIZU | e397ffe | 2015-05-12 16:24:23 -0700 | [diff] [blame] | 327 | log.warn(e.getMessage()); |
| 328 | break; |
| 329 | } |
Yafit Hadar | 7351461 | 2015-11-04 10:14:21 +0200 | [diff] [blame] | 330 | break; |
Sho SHIMIZU | 5cd7ce9 | 2015-05-11 19:10:38 -0700 | [diff] [blame] | 331 | default: |
| 332 | log.warn("Unimplemented action type {}.", l0m.subtype()); |
| 333 | break; |
Jonathan Hart | 86e5935 | 2014-10-22 10:42:16 -0700 | [diff] [blame] | 334 | } |
Yafit Hadar | 7351461 | 2015-11-04 10:14:21 +0200 | [diff] [blame] | 335 | if (oxm != null) { |
| 336 | return factory().actions().buildSetField().setField(oxm).build(); |
| 337 | } |
Jonathan Hart | 86e5935 | 2014-10-22 10:42:16 -0700 | [diff] [blame] | 338 | return null; |
| 339 | } |
| 340 | |
Sho SHIMIZU | e397ffe | 2015-05-12 16:24:23 -0700 | [diff] [blame] | 341 | private OFAction buildModLambdaInstruction(ModLambdaInstruction instruction) { |
Marc De Leenheer | c2999f3 | 2015-11-20 15:52:16 -0800 | [diff] [blame] | 342 | return factory().actions().circuit(factory().oxms().expOchSigId( |
Sho SHIMIZU | e397ffe | 2015-05-12 16:24:23 -0700 | [diff] [blame] | 343 | new CircuitSignalID((byte) 1, (byte) 2, instruction.lambda(), (short) 1))); |
| 344 | } |
| 345 | |
| 346 | private OFAction buildModOchSignalInstruction(ModOchSignalInstruction instruction) { |
| 347 | OchSignal signal = instruction.lambda(); |
Sho SHIMIZU | c17042d | 2015-05-28 12:07:23 -0700 | [diff] [blame] | 348 | byte gridType = OpenFlowValueMapper.lookupGridType(signal.gridType()); |
| 349 | byte channelSpacing = OpenFlowValueMapper.lookupChannelSpacing(signal.channelSpacing()); |
Sho SHIMIZU | e397ffe | 2015-05-12 16:24:23 -0700 | [diff] [blame] | 350 | |
Marc De Leenheer | c2999f3 | 2015-11-20 15:52:16 -0800 | [diff] [blame] | 351 | return factory().actions().circuit(factory().oxms().expOchSigId( |
Sho SHIMIZU | e397ffe | 2015-05-12 16:24:23 -0700 | [diff] [blame] | 352 | new CircuitSignalID(gridType, channelSpacing, |
| 353 | (short) signal.spacingMultiplier(), (short) signal.slotGranularity()) |
| 354 | )); |
| 355 | } |
| 356 | |
Yafit Hadar | 7351461 | 2015-11-04 10:14:21 +0200 | [diff] [blame] | 357 | private OFAction buildL1Modification(Instruction i) { |
| 358 | L1ModificationInstruction l1m = (L1ModificationInstruction) i; |
| 359 | OFOxm<?> oxm = null; |
| 360 | switch (l1m.subtype()) { |
| 361 | case ODU_SIGID: |
| 362 | ModOduSignalIdInstruction modOduSignalIdInstruction = (ModOduSignalIdInstruction) l1m; |
| 363 | OduSignalId oduSignalId = modOduSignalIdInstruction.oduSignalId(); |
| 364 | |
| 365 | OduSignalID oduSignalID = new OduSignalID((short) oduSignalId.tributaryPortNumber(), |
| 366 | (short) oduSignalId.tributarySlotLength(), |
| 367 | oduSignalId.tributarySlotBitmap()); |
| 368 | |
| 369 | oxm = factory().oxms().expOduSigId(oduSignalID); |
| 370 | break; |
| 371 | default: |
| 372 | log.warn("Unimplemented action type {}.", l1m.subtype()); |
| 373 | break; |
| 374 | } |
| 375 | |
| 376 | if (oxm != null) { |
| 377 | return factory().actions().buildSetField().setField(oxm).build(); |
| 378 | } |
| 379 | return null; |
| 380 | } |
| 381 | |
Jonathan Hart | 86e5935 | 2014-10-22 10:42:16 -0700 | [diff] [blame] | 382 | private OFAction buildL2Modification(Instruction i) { |
| 383 | L2ModificationInstruction l2m = (L2ModificationInstruction) i; |
| 384 | ModEtherInstruction eth; |
| 385 | OFOxm<?> oxm = null; |
| 386 | switch (l2m.subtype()) { |
Praseed Balakrishnan | 8c67d17 | 2014-11-10 10:15:41 -0800 | [diff] [blame] | 387 | case ETH_DST: |
| 388 | eth = (ModEtherInstruction) l2m; |
| 389 | oxm = factory().oxms().ethDst(MacAddress.of(eth.mac().toLong())); |
| 390 | break; |
| 391 | case ETH_SRC: |
| 392 | eth = (ModEtherInstruction) l2m; |
| 393 | oxm = factory().oxms().ethSrc(MacAddress.of(eth.mac().toLong())); |
| 394 | break; |
| 395 | case VLAN_ID: |
| 396 | ModVlanIdInstruction vlanId = (ModVlanIdInstruction) l2m; |
| 397 | oxm = factory().oxms().vlanVid(OFVlanVidMatch.ofVlan(vlanId.vlanId().toShort())); |
| 398 | break; |
| 399 | case VLAN_PCP: |
| 400 | ModVlanPcpInstruction vlanPcp = (ModVlanPcpInstruction) l2m; |
| 401 | oxm = factory().oxms().vlanPcp(VlanPcp.of(vlanPcp.vlanPcp())); |
| 402 | break; |
| 403 | case MPLS_PUSH: |
| 404 | PushHeaderInstructions pushHeaderInstructions = |
| 405 | (PushHeaderInstructions) l2m; |
| 406 | return factory().actions().pushMpls(EthType.of(pushHeaderInstructions |
alshabib | 7b808c5 | 2015-06-26 14:22:24 -0700 | [diff] [blame] | 407 | .ethernetType().toShort())); |
Praseed Balakrishnan | 8c67d17 | 2014-11-10 10:15:41 -0800 | [diff] [blame] | 408 | case MPLS_POP: |
Jonathan Hart | 67fc097 | 2015-03-19 15:21:20 -0700 | [diff] [blame] | 409 | PushHeaderInstructions popHeaderInstructions = |
Praseed Balakrishnan | 8c67d17 | 2014-11-10 10:15:41 -0800 | [diff] [blame] | 410 | (PushHeaderInstructions) l2m; |
| 411 | return factory().actions().popMpls(EthType.of(popHeaderInstructions |
alshabib | 7b808c5 | 2015-06-26 14:22:24 -0700 | [diff] [blame] | 412 | .ethernetType().toShort())); |
Praseed Balakrishnan | 8c67d17 | 2014-11-10 10:15:41 -0800 | [diff] [blame] | 413 | case MPLS_LABEL: |
| 414 | ModMplsLabelInstruction mplsLabel = |
| 415 | (ModMplsLabelInstruction) l2m; |
HIGUCHI Yuta | 04b49fc | 2015-08-28 09:58:58 -0700 | [diff] [blame] | 416 | oxm = factory().oxms().mplsLabel(U32.of(mplsLabel.mplsLabel().toInt())); |
Praseed Balakrishnan | 8c67d17 | 2014-11-10 10:15:41 -0800 | [diff] [blame] | 417 | break; |
Saurav Das | 73a7dd4 | 2015-08-19 22:20:31 -0700 | [diff] [blame] | 418 | case MPLS_BOS: |
| 419 | ModMplsBosInstruction mplsBos = (ModMplsBosInstruction) l2m; |
| 420 | oxm = factory().oxms() |
| 421 | .mplsBos(mplsBos.mplsBos() ? OFBooleanValue.TRUE |
| 422 | : OFBooleanValue.FALSE); |
| 423 | break; |
sangho | 3f97a17d | 2015-01-29 22:56:29 -0800 | [diff] [blame] | 424 | case DEC_MPLS_TTL: |
| 425 | return factory().actions().decMplsTtl(); |
Saurav Das | fbe25c5 | 2015-03-04 11:12:00 -0800 | [diff] [blame] | 426 | case VLAN_POP: |
| 427 | return factory().actions().popVlan(); |
Jonathan Hart | 54b406b | 2015-03-06 16:24:14 -0800 | [diff] [blame] | 428 | case VLAN_PUSH: |
| 429 | PushHeaderInstructions pushVlanInstruction = (PushHeaderInstructions) l2m; |
| 430 | return factory().actions().pushVlan( |
alshabib | 7b808c5 | 2015-06-26 14:22:24 -0700 | [diff] [blame] | 431 | EthType.of(pushVlanInstruction.ethernetType().toShort())); |
Hyunsun Moon | a08c5d0 | 2015-07-14 17:53:00 -0700 | [diff] [blame] | 432 | case TUNNEL_ID: |
| 433 | ModTunnelIdInstruction tunnelId = (ModTunnelIdInstruction) l2m; |
| 434 | oxm = factory().oxms().tunnelId(U64.of(tunnelId.tunnelId())); |
| 435 | break; |
Praseed Balakrishnan | 8c67d17 | 2014-11-10 10:15:41 -0800 | [diff] [blame] | 436 | default: |
| 437 | log.warn("Unimplemented action type {}.", l2m.subtype()); |
| 438 | break; |
Jonathan Hart | 86e5935 | 2014-10-22 10:42:16 -0700 | [diff] [blame] | 439 | } |
| 440 | |
| 441 | if (oxm != null) { |
| 442 | return factory().actions().buildSetField().setField(oxm).build(); |
| 443 | } |
| 444 | return null; |
| 445 | } |
| 446 | |
| 447 | private OFAction buildL3Modification(Instruction i) { |
| 448 | L3ModificationInstruction l3m = (L3ModificationInstruction) i; |
| 449 | ModIPInstruction ip; |
Pavlin Radoslavov | 23e398d | 2014-11-05 15:17:57 -0800 | [diff] [blame] | 450 | Ip4Address ip4; |
Pavlin Radoslavov | febe82c | 2015-02-11 19:08:15 -0800 | [diff] [blame] | 451 | Ip6Address ip6; |
Jonathan Hart | 86e5935 | 2014-10-22 10:42:16 -0700 | [diff] [blame] | 452 | OFOxm<?> oxm = null; |
| 453 | switch (l3m.subtype()) { |
Sho SHIMIZU | 5cd7ce9 | 2015-05-11 19:10:38 -0700 | [diff] [blame] | 454 | case IPV4_SRC: |
| 455 | ip = (ModIPInstruction) i; |
| 456 | ip4 = ip.ip().getIp4Address(); |
| 457 | oxm = factory().oxms().ipv4Src(IPv4Address.of(ip4.toInt())); |
| 458 | break; |
| 459 | case IPV4_DST: |
| 460 | ip = (ModIPInstruction) i; |
| 461 | ip4 = ip.ip().getIp4Address(); |
| 462 | oxm = factory().oxms().ipv4Dst(IPv4Address.of(ip4.toInt())); |
| 463 | break; |
| 464 | case IPV6_SRC: |
| 465 | ip = (ModIPInstruction) i; |
| 466 | ip6 = ip.ip().getIp6Address(); |
| 467 | oxm = factory().oxms().ipv6Src(IPv6Address.of(ip6.toOctets())); |
| 468 | break; |
| 469 | case IPV6_DST: |
| 470 | ip = (ModIPInstruction) i; |
| 471 | ip6 = ip.ip().getIp6Address(); |
| 472 | oxm = factory().oxms().ipv6Dst(IPv6Address.of(ip6.toOctets())); |
| 473 | break; |
| 474 | case IPV6_FLABEL: |
| 475 | ModIPv6FlowLabelInstruction flowLabelInstruction = |
| 476 | (ModIPv6FlowLabelInstruction) i; |
| 477 | int flowLabel = flowLabelInstruction.flowLabel(); |
| 478 | oxm = factory().oxms().ipv6Flabel(IPv6FlowLabel.of(flowLabel)); |
| 479 | break; |
lishuai | 3cce60b | 2015-12-01 19:35:16 +0800 | [diff] [blame] | 480 | case ARP_SPA: |
| 481 | ModArpIPInstruction aip = (ModArpIPInstruction) i; |
| 482 | ip4 = aip.ip().getIp4Address(); |
| 483 | oxm = factory().oxms().arpSpa(IPv4Address.of(ip4.toInt())); |
| 484 | break; |
| 485 | case ARP_SHA: |
| 486 | ModArpEthInstruction ei = (ModArpEthInstruction) i; |
| 487 | oxm = factory().oxms().arpSha(MacAddress.of(ei.mac().toLong())); |
| 488 | break; |
| 489 | case ARP_OP: |
| 490 | ModArpOpInstruction oi = (ModArpOpInstruction) i; |
| 491 | oxm = factory().oxms().arpOp(ArpOpcode.of((int) oi.op())); |
| 492 | break; |
Sho SHIMIZU | 5cd7ce9 | 2015-05-11 19:10:38 -0700 | [diff] [blame] | 493 | case DEC_TTL: |
| 494 | return factory().actions().decNwTtl(); |
| 495 | case TTL_IN: |
| 496 | return factory().actions().copyTtlIn(); |
| 497 | case TTL_OUT: |
| 498 | return factory().actions().copyTtlOut(); |
| 499 | default: |
| 500 | log.warn("Unimplemented action type {}.", l3m.subtype()); |
| 501 | break; |
Jonathan Hart | 86e5935 | 2014-10-22 10:42:16 -0700 | [diff] [blame] | 502 | } |
| 503 | |
| 504 | if (oxm != null) { |
| 505 | return factory().actions().buildSetField().setField(oxm).build(); |
| 506 | } |
| 507 | return null; |
| 508 | } |
| 509 | |
Hyunsun Moon | c8bd97c | 2015-07-18 22:47:33 -0700 | [diff] [blame] | 510 | private OFAction buildL4Modification(Instruction i) { |
| 511 | L4ModificationInstruction l4m = (L4ModificationInstruction) i; |
| 512 | ModTransportPortInstruction tp; |
| 513 | OFOxm<?> oxm = null; |
| 514 | switch (l4m.subtype()) { |
| 515 | case TCP_SRC: |
| 516 | tp = (ModTransportPortInstruction) l4m; |
Hyunsun Moon | cf732fb | 2015-08-22 21:04:23 -0700 | [diff] [blame] | 517 | oxm = factory().oxms().tcpSrc(TransportPort.of(tp.port().toInt())); |
Hyunsun Moon | c8bd97c | 2015-07-18 22:47:33 -0700 | [diff] [blame] | 518 | break; |
| 519 | case TCP_DST: |
| 520 | tp = (ModTransportPortInstruction) l4m; |
Hyunsun Moon | cf732fb | 2015-08-22 21:04:23 -0700 | [diff] [blame] | 521 | oxm = factory().oxms().tcpDst(TransportPort.of(tp.port().toInt())); |
Hyunsun Moon | c8bd97c | 2015-07-18 22:47:33 -0700 | [diff] [blame] | 522 | break; |
| 523 | case UDP_SRC: |
| 524 | tp = (ModTransportPortInstruction) l4m; |
Hyunsun Moon | cf732fb | 2015-08-22 21:04:23 -0700 | [diff] [blame] | 525 | oxm = factory().oxms().udpSrc(TransportPort.of(tp.port().toInt())); |
Hyunsun Moon | c8bd97c | 2015-07-18 22:47:33 -0700 | [diff] [blame] | 526 | break; |
| 527 | case UDP_DST: |
| 528 | tp = (ModTransportPortInstruction) l4m; |
Hyunsun Moon | cf732fb | 2015-08-22 21:04:23 -0700 | [diff] [blame] | 529 | oxm = factory().oxms().udpDst(TransportPort.of(tp.port().toInt())); |
Hyunsun Moon | c8bd97c | 2015-07-18 22:47:33 -0700 | [diff] [blame] | 530 | break; |
| 531 | default: |
| 532 | log.warn("Unimplemented action type {}.", l4m.subtype()); |
| 533 | break; |
| 534 | } |
| 535 | |
| 536 | if (oxm != null) { |
| 537 | return factory().actions().buildSetField().setField(oxm).build(); |
| 538 | } |
| 539 | return null; |
| 540 | } |
| 541 | |
alshabib | 880b644 | 2015-11-23 22:13:04 -0800 | [diff] [blame] | 542 | private OFAction buildExtensionAction(ExtensionTreatment i) { |
Jonathan Hart | 3c25916 | 2015-10-21 21:31:19 -0700 | [diff] [blame] | 543 | if (!driverService.isPresent()) { |
| 544 | log.error("No driver service present"); |
| 545 | return null; |
| 546 | } |
| 547 | Driver driver = driverService.get().getDriver(deviceId); |
alshabib | 880b644 | 2015-11-23 22:13:04 -0800 | [diff] [blame] | 548 | if (driver.hasBehaviour(ExtensionTreatmentInterpreter.class)) { |
Jonathan Hart | 3c25916 | 2015-10-21 21:31:19 -0700 | [diff] [blame] | 549 | DefaultDriverHandler handler = |
| 550 | new DefaultDriverHandler(new DefaultDriverData(driver, deviceId)); |
alshabib | 880b644 | 2015-11-23 22:13:04 -0800 | [diff] [blame] | 551 | ExtensionTreatmentInterpreter interpreter = handler.behaviour(ExtensionTreatmentInterpreter.class); |
Jonathan Hart | 3c25916 | 2015-10-21 21:31:19 -0700 | [diff] [blame] | 552 | return interpreter.mapInstruction(factory(), i); |
| 553 | } |
| 554 | |
| 555 | return null; |
| 556 | } |
| 557 | |
Jonathan Hart | 86e5935 | 2014-10-22 10:42:16 -0700 | [diff] [blame] | 558 | } |