Jian Li
Committed by Gerrit Code Review

[ONOS-4245] Support resubmit experimenter action for nicira driver

Change-Id: I7beac62d5c23fb8e2fe7d7d23947c55fbb849064
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
17 package org.onosproject.driver.extensions; 17 package org.onosproject.driver.extensions;
18 18
19 import org.onlab.packet.Ip4Address; 19 import org.onlab.packet.Ip4Address;
20 +import org.onosproject.net.PortNumber;
20 import org.onosproject.net.behaviour.ExtensionTreatmentResolver; 21 import org.onosproject.net.behaviour.ExtensionTreatmentResolver;
21 import org.onosproject.net.driver.AbstractHandlerBehaviour; 22 import org.onosproject.net.driver.AbstractHandlerBehaviour;
22 import org.onosproject.net.flow.instructions.ExtensionTreatment; 23 import org.onosproject.net.flow.instructions.ExtensionTreatment;
...@@ -28,6 +29,7 @@ import org.projectfloodlight.openflow.protocol.action.OFAction; ...@@ -28,6 +29,7 @@ import org.projectfloodlight.openflow.protocol.action.OFAction;
28 import org.projectfloodlight.openflow.protocol.action.OFActionExperimenter; 29 import org.projectfloodlight.openflow.protocol.action.OFActionExperimenter;
29 import org.projectfloodlight.openflow.protocol.action.OFActionNicira; 30 import org.projectfloodlight.openflow.protocol.action.OFActionNicira;
30 import org.projectfloodlight.openflow.protocol.action.OFActionNiciraMove; 31 import org.projectfloodlight.openflow.protocol.action.OFActionNiciraMove;
32 +import org.projectfloodlight.openflow.protocol.action.OFActionNiciraResubmit;
31 import org.projectfloodlight.openflow.protocol.action.OFActionSetField; 33 import org.projectfloodlight.openflow.protocol.action.OFActionSetField;
32 import org.projectfloodlight.openflow.protocol.oxm.OFOxm; 34 import org.projectfloodlight.openflow.protocol.oxm.OFOxm;
33 import org.projectfloodlight.openflow.protocol.oxm.OFOxmTunnelIpv4Dst; 35 import org.projectfloodlight.openflow.protocol.oxm.OFOxmTunnelIpv4Dst;
...@@ -40,12 +42,14 @@ public class NiciraExtensionTreatmentInterpreter extends AbstractHandlerBehaviou ...@@ -40,12 +42,14 @@ public class NiciraExtensionTreatmentInterpreter extends AbstractHandlerBehaviou
40 implements ExtensionTreatmentInterpreter, ExtensionTreatmentResolver { 42 implements ExtensionTreatmentInterpreter, ExtensionTreatmentResolver {
41 43
42 private static final int TYPE_NICIRA = 0x2320; 44 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_SHA = 0x00012206;
45 private static final int SRC_ARP_SPA = 0x00002004; 46 private static final int SRC_ARP_SPA = 0x00002004;
46 private static final int SRC_ETH = 0x00000406; 47 private static final int SRC_ETH = 0x00000406;
47 private static final int SRC_IP = 0x00000e04; 48 private static final int SRC_IP = 0x00000e04;
48 49
50 + private static final int SUB_TYPE_RESUBMIT = 1;
51 + private static final int SUB_TYPE_MOVE = 6;
52 +
49 @Override 53 @Override
50 public boolean supported(ExtensionTreatmentType extensionTreatmentType) { 54 public boolean supported(ExtensionTreatmentType extensionTreatmentType) {
51 if (extensionTreatmentType.equals( 55 if (extensionTreatmentType.equals(
...@@ -175,26 +179,33 @@ public class NiciraExtensionTreatmentInterpreter extends AbstractHandlerBehaviou ...@@ -175,26 +179,33 @@ public class NiciraExtensionTreatmentInterpreter extends AbstractHandlerBehaviou
175 if (Long.valueOf(experimenter.getExperimenter()) 179 if (Long.valueOf(experimenter.getExperimenter())
176 .intValue() == TYPE_NICIRA) { 180 .intValue() == TYPE_NICIRA) {
177 OFActionNicira nicira = (OFActionNicira) experimenter; 181 OFActionNicira nicira = (OFActionNicira) experimenter;
178 - if (nicira.getSubtype() == SUB_TYPE_MOVE) { 182 + switch (nicira.getSubtype()) {
179 - OFActionNiciraMove moveAction = (OFActionNiciraMove) nicira; 183 + case SUB_TYPE_MOVE:
180 - switch (Long.valueOf(moveAction.getSrc()).intValue()) { 184 + OFActionNiciraMove moveAction = (OFActionNiciraMove) nicira;
181 - case SRC_ARP_SHA: 185 + switch (Long.valueOf(moveAction.getSrc()).intValue()) {
182 - return NiciraMoveTreatmentFactory 186 + case SRC_ARP_SHA:
183 - .createNiciraMovArpShaToTha(); 187 + return NiciraMoveTreatmentFactory
184 - case SRC_ETH: 188 + .createNiciraMovArpShaToTha();
185 - return NiciraMoveTreatmentFactory 189 + case SRC_ETH:
186 - .createNiciraMovEthSrcToDst(); 190 + return NiciraMoveTreatmentFactory
187 - case SRC_IP: 191 + .createNiciraMovEthSrcToDst();
188 - return NiciraMoveTreatmentFactory 192 + case SRC_IP:
189 - .createNiciraMovIpSrcToDst(); 193 + return NiciraMoveTreatmentFactory
190 - case SRC_ARP_SPA: 194 + .createNiciraMovIpSrcToDst();
191 - return NiciraMoveTreatmentFactory 195 + case SRC_ARP_SPA:
192 - .createNiciraMovArpSpaToTpa(); 196 + return NiciraMoveTreatmentFactory
197 + .createNiciraMovArpSpaToTpa();
198 + default:
199 + throw new UnsupportedOperationException("Driver does not support move from "
200 + + moveAction.getSrc() + " to "
201 + + moveAction.getDst());
202 + }
203 + case SUB_TYPE_RESUBMIT:
204 + OFActionNiciraResubmit resubmitAction = (OFActionNiciraResubmit) nicira;
205 + return new NiciraResubmit(PortNumber.portNumber(resubmitAction.getInPort()));
193 default: 206 default:
194 - throw new UnsupportedOperationException("Driver does not support move from " 207 + throw new UnsupportedOperationException("Driver does not support extension subtype "
195 - + moveAction.getSrc() + " to " 208 + + nicira.getSubtype());
196 - + moveAction.getDst());
197 - }
198 } 209 }
199 } 210 }
200 } 211 }
......
...@@ -344,11 +344,8 @@ public class FlowEntryBuilder { ...@@ -344,11 +344,8 @@ public class FlowEntryBuilder {
344 lookupGridType(circuitSignalID.getGridType()), 344 lookupGridType(circuitSignalID.getGridType()),
345 lookupChannelSpacing(circuitSignalID.getChannelSpacing()), 345 lookupChannelSpacing(circuitSignalID.getChannelSpacing()),
346 circuitSignalID.getChannelNumber(), circuitSignalID.getSpectralWidth()))); 346 circuitSignalID.getChannelNumber(), circuitSignalID.getSpectralWidth())));
347 - } else if (exp.getExperimenter() == 0x2320) { 347 + } else if (treatmentInterpreter != null) {
348 - if (treatmentInterpreter != null) { 348 + builder.extension(treatmentInterpreter.mapAction(exp), deviceId);
349 - builder.extension(treatmentInterpreter.mapAction(exp),
350 - deviceId);
351 - }
352 } else { 349 } else {
353 log.warn("Unsupported OFActionExperimenter {}", exp.getExperimenter()); 350 log.warn("Unsupported OFActionExperimenter {}", exp.getExperimenter());
354 } 351 }
......