Committed by
Gerrit Code Review
[ONOS-2860] ONOSFW L3 uses ARP table as arp proxy. It need modify ARP
request packet to response packet. OpenFlow protocol provides some extension action to support it. e.g. move and load. But for now OpenFlow java implementation doesn't support for them. Change-Id: I8ee6b415d9dce9a471ad5b6d788eebc905219d89
Showing
3 changed files
with
57 additions
and
3 deletions
... | @@ -25,6 +25,9 @@ import org.onosproject.openflow.controller.ExtensionTreatmentInterpreter; | ... | @@ -25,6 +25,9 @@ import org.onosproject.openflow.controller.ExtensionTreatmentInterpreter; |
25 | import org.projectfloodlight.openflow.protocol.OFActionType; | 25 | import org.projectfloodlight.openflow.protocol.OFActionType; |
26 | import org.projectfloodlight.openflow.protocol.OFFactory; | 26 | import org.projectfloodlight.openflow.protocol.OFFactory; |
27 | import org.projectfloodlight.openflow.protocol.action.OFAction; | 27 | import org.projectfloodlight.openflow.protocol.action.OFAction; |
28 | +import org.projectfloodlight.openflow.protocol.action.OFActionExperimenter; | ||
29 | +import org.projectfloodlight.openflow.protocol.action.OFActionNicira; | ||
30 | +import org.projectfloodlight.openflow.protocol.action.OFActionNiciraMove; | ||
28 | import org.projectfloodlight.openflow.protocol.action.OFActionSetField; | 31 | import org.projectfloodlight.openflow.protocol.action.OFActionSetField; |
29 | import org.projectfloodlight.openflow.protocol.oxm.OFOxm; | 32 | import org.projectfloodlight.openflow.protocol.oxm.OFOxm; |
30 | import org.projectfloodlight.openflow.protocol.oxm.OFOxmTunnelIpv4Dst; | 33 | import org.projectfloodlight.openflow.protocol.oxm.OFOxmTunnelIpv4Dst; |
... | @@ -36,6 +39,13 @@ import org.projectfloodlight.openflow.types.IPv4Address; | ... | @@ -36,6 +39,13 @@ import org.projectfloodlight.openflow.types.IPv4Address; |
36 | public class NiciraExtensionTreatmentInterpreter extends AbstractHandlerBehaviour | 39 | public class NiciraExtensionTreatmentInterpreter extends AbstractHandlerBehaviour |
37 | implements ExtensionTreatmentInterpreter, ExtensionTreatmentResolver { | 40 | implements ExtensionTreatmentInterpreter, ExtensionTreatmentResolver { |
38 | 41 | ||
42 | + private static final int TYPE_NICIRA = 0x2320; | ||
43 | + private static final int SUB_TYPE_MOVE = 6; | ||
44 | + private static final int SRC_ARP_SHA = 0x00012206; | ||
45 | + private static final int SRC_ARP_SPA = 0x00002004; | ||
46 | + private static final int SRC_ETH = 0x00000406; | ||
47 | + private static final int SRC_IP = 0x00000e04; | ||
48 | + | ||
39 | @Override | 49 | @Override |
40 | public boolean supported(ExtensionTreatmentType extensionTreatmentType) { | 50 | public boolean supported(ExtensionTreatmentType extensionTreatmentType) { |
41 | if (extensionTreatmentType.equals( | 51 | if (extensionTreatmentType.equals( |
... | @@ -129,11 +139,19 @@ public class NiciraExtensionTreatmentInterpreter extends AbstractHandlerBehaviou | ... | @@ -129,11 +139,19 @@ public class NiciraExtensionTreatmentInterpreter extends AbstractHandlerBehaviou |
129 | NiciraSetNshContextHeader niciraNshch = (NiciraSetNshContextHeader) extensionTreatment; | 139 | NiciraSetNshContextHeader niciraNshch = (NiciraSetNshContextHeader) extensionTreatment; |
130 | return factory.actions().niciraSetNshc4(niciraNshch.nshCh().nshContextHeader()); | 140 | return factory.actions().niciraSetNshc4(niciraNshch.nshCh().nshContextHeader()); |
131 | } | 141 | } |
132 | - if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_MOV_ETH_SRC_TO_DST.type()) | 142 | + if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_MOV_ARP_SHA_TO_THA.type()) |
133 | || type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_MOV_ARP_SPA_TO_TPA.type()) | 143 | || type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_MOV_ARP_SPA_TO_TPA.type()) |
134 | || type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_MOV_ETH_SRC_TO_DST.type()) | 144 | || type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_MOV_ETH_SRC_TO_DST.type()) |
135 | || type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_MOV_IP_SRC_TO_DST.type())) { | 145 | || type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_MOV_IP_SRC_TO_DST.type())) { |
136 | - // TODO this will be implemented later | 146 | + MoveExtensionTreatment mov = (MoveExtensionTreatment) extensionTreatment; |
147 | + OFActionNiciraMove.Builder action = factory.actions() | ||
148 | + .buildNiciraMove(); | ||
149 | + action.setDstOfs(mov.dstOffset()); | ||
150 | + action.setSrcOfs(mov.srcOffset()); | ||
151 | + action.setNBits(mov.nBits()); | ||
152 | + action.setSrc(mov.src()); | ||
153 | + action.setDst(mov.dst()); | ||
154 | + return action.build(); | ||
137 | } | 155 | } |
138 | return null; | 156 | return null; |
139 | } | 157 | } |
... | @@ -152,6 +170,34 @@ public class NiciraExtensionTreatmentInterpreter extends AbstractHandlerBehaviou | ... | @@ -152,6 +170,34 @@ public class NiciraExtensionTreatmentInterpreter extends AbstractHandlerBehaviou |
152 | "Driver does not support extension type " + oxm.getMatchField().id); | 170 | "Driver does not support extension type " + oxm.getMatchField().id); |
153 | } | 171 | } |
154 | } | 172 | } |
173 | + if (action.getType().equals(OFActionType.EXPERIMENTER)) { | ||
174 | + OFActionExperimenter experimenter = (OFActionExperimenter) action; | ||
175 | + if (Long.valueOf(experimenter.getExperimenter()) | ||
176 | + .intValue() == TYPE_NICIRA) { | ||
177 | + OFActionNicira nicira = (OFActionNicira) experimenter; | ||
178 | + if (nicira.getSubtype() == SUB_TYPE_MOVE) { | ||
179 | + OFActionNiciraMove moveAction = (OFActionNiciraMove) nicira; | ||
180 | + switch (Long.valueOf(moveAction.getSrc()).intValue()) { | ||
181 | + case SRC_ARP_SHA: | ||
182 | + return NiciraMoveTreatmentFactory | ||
183 | + .createNiciraMovArpShaToTha(); | ||
184 | + case SRC_ETH: | ||
185 | + return NiciraMoveTreatmentFactory | ||
186 | + .createNiciraMovEthSrcToDst(); | ||
187 | + case SRC_IP: | ||
188 | + return NiciraMoveTreatmentFactory | ||
189 | + .createNiciraMovIpSrcToDst(); | ||
190 | + case SRC_ARP_SPA: | ||
191 | + return NiciraMoveTreatmentFactory | ||
192 | + .createNiciraMovArpSpaToTpa(); | ||
193 | + default: | ||
194 | + throw new UnsupportedOperationException("Driver does not support move from " | ||
195 | + + moveAction.getSrc() + " to " | ||
196 | + + moveAction.getDst()); | ||
197 | + } | ||
198 | + } | ||
199 | + } | ||
200 | + } | ||
155 | return null; | 201 | return null; |
156 | } | 202 | } |
157 | 203 | ... | ... |
... | @@ -91,7 +91,7 @@ public final class NiciraMoveTreatmentFactory { | ... | @@ -91,7 +91,7 @@ public final class NiciraMoveTreatmentFactory { |
91 | int dstOfs = 0; | 91 | int dstOfs = 0; |
92 | int nBits = 32; | 92 | int nBits = 32; |
93 | int srcIp = 0x00000e04; | 93 | int srcIp = 0x00000e04; |
94 | - int dstIp = 0x00001006; | 94 | + int dstIp = 0x00001004; |
95 | return new DefaultMoveExtensionTreatment(srcOfs, dstOfs, nBits, srcIp, | 95 | return new DefaultMoveExtensionTreatment(srcOfs, dstOfs, nBits, srcIp, |
96 | dstIp, | 96 | dstIp, |
97 | ExtensionTreatmentType.ExtensionTreatmentTypes | 97 | ExtensionTreatmentType.ExtensionTreatmentTypes | ... | ... |
... | @@ -329,6 +329,14 @@ public class FlowEntryBuilder { | ... | @@ -329,6 +329,14 @@ public class FlowEntryBuilder { |
329 | OFActionCircuit ct = (OFActionCircuit) exp; | 329 | OFActionCircuit ct = (OFActionCircuit) exp; |
330 | short lambda = ((OFOxmOchSigidBasic) ct.getField()).getValue().getChannelNumber(); | 330 | short lambda = ((OFOxmOchSigidBasic) ct.getField()).getValue().getChannelNumber(); |
331 | builder.add(Instructions.modL0Lambda(Lambda.indexedLambda(lambda))); | 331 | builder.add(Instructions.modL0Lambda(Lambda.indexedLambda(lambda))); |
332 | + } else if (exp.getExperimenter() == 0x2320) { | ||
333 | + DriverHandler driver = getDriver(dpid); | ||
334 | + ExtensionTreatmentInterpreter interpreter = driver | ||
335 | + .behaviour(ExtensionTreatmentInterpreter.class); | ||
336 | + if (interpreter != null) { | ||
337 | + builder.extension(interpreter.mapAction(exp), | ||
338 | + DeviceId.deviceId(Dpid.uri(dpid))); | ||
339 | + } | ||
332 | } else { | 340 | } else { |
333 | log.warn("Unsupported OFActionExperimenter {}", exp.getExperimenter()); | 341 | log.warn("Unsupported OFActionExperimenter {}", exp.getExperimenter()); |
334 | } | 342 | } | ... | ... |
-
Please register or login to post a comment