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,7 +179,8 @@ public class NiciraExtensionTreatmentInterpreter extends AbstractHandlerBehaviou ...@@ -175,7 +179,8 @@ 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()) {
183 + case SUB_TYPE_MOVE:
179 OFActionNiciraMove moveAction = (OFActionNiciraMove) nicira; 184 OFActionNiciraMove moveAction = (OFActionNiciraMove) nicira;
180 switch (Long.valueOf(moveAction.getSrc()).intValue()) { 185 switch (Long.valueOf(moveAction.getSrc()).intValue()) {
181 case SRC_ARP_SHA: 186 case SRC_ARP_SHA:
...@@ -195,6 +200,12 @@ public class NiciraExtensionTreatmentInterpreter extends AbstractHandlerBehaviou ...@@ -195,6 +200,12 @@ public class NiciraExtensionTreatmentInterpreter extends AbstractHandlerBehaviou
195 + moveAction.getSrc() + " to " 200 + moveAction.getSrc() + " to "
196 + moveAction.getDst()); 201 + moveAction.getDst());
197 } 202 }
203 + case SUB_TYPE_RESUBMIT:
204 + OFActionNiciraResubmit resubmitAction = (OFActionNiciraResubmit) nicira;
205 + return new NiciraResubmit(PortNumber.portNumber(resubmitAction.getInPort()));
206 + default:
207 + throw new UnsupportedOperationException("Driver does not support extension subtype "
208 + + nicira.getSubtype());
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 }
......