Committed by
Gerrit Code Review
Remove duplicated treatment building from GroupBucketEntryBuilder
Change-Id: I0f956dd11d990209eb3dc00c866dd535843506ea
Showing
3 changed files
with
40 additions
and
13 deletions
| ... | @@ -91,6 +91,7 @@ import org.projectfloodlight.openflow.types.U64; | ... | @@ -91,6 +91,7 @@ import org.projectfloodlight.openflow.types.U64; |
| 91 | import org.projectfloodlight.openflow.types.U8; | 91 | import org.projectfloodlight.openflow.types.U8; |
| 92 | import org.projectfloodlight.openflow.types.VlanPcp; | 92 | import org.projectfloodlight.openflow.types.VlanPcp; |
| 93 | import org.slf4j.Logger; | 93 | import org.slf4j.Logger; |
| 94 | +import org.slf4j.LoggerFactory; | ||
| 94 | 95 | ||
| 95 | import java.util.List; | 96 | import java.util.List; |
| 96 | 97 | ||
| ... | @@ -104,10 +105,9 @@ import static org.onosproject.provider.of.flow.impl.OpenFlowValueMapper.lookupCh | ... | @@ -104,10 +105,9 @@ import static org.onosproject.provider.of.flow.impl.OpenFlowValueMapper.lookupCh |
| 104 | import static org.onosproject.provider.of.flow.impl.OpenFlowValueMapper.lookupGridType; | 105 | import static org.onosproject.provider.of.flow.impl.OpenFlowValueMapper.lookupGridType; |
| 105 | import static org.onosproject.provider.of.flow.impl.OpenFlowValueMapper.lookupOchSignalType; | 106 | import static org.onosproject.provider.of.flow.impl.OpenFlowValueMapper.lookupOchSignalType; |
| 106 | import static org.onosproject.provider.of.flow.impl.OpenFlowValueMapper.lookupOduSignalType; | 107 | import static org.onosproject.provider.of.flow.impl.OpenFlowValueMapper.lookupOduSignalType; |
| 107 | -import static org.slf4j.LoggerFactory.getLogger; | ||
| 108 | 108 | ||
| 109 | public class FlowEntryBuilder { | 109 | public class FlowEntryBuilder { |
| 110 | - private final Logger log = getLogger(getClass()); | 110 | + private static final Logger log = LoggerFactory.getLogger(FlowEntryBuilder.class); |
| 111 | 111 | ||
| 112 | private final OFFlowStatsEntry stat; | 112 | private final OFFlowStatsEntry stat; |
| 113 | private final OFFlowRemoved removed; | 113 | private final OFFlowRemoved removed; |
| ... | @@ -289,14 +289,24 @@ public class FlowEntryBuilder { | ... | @@ -289,14 +289,24 @@ public class FlowEntryBuilder { |
| 289 | return builder.build(); | 289 | return builder.build(); |
| 290 | } | 290 | } |
| 291 | 291 | ||
| 292 | - private TrafficTreatment.Builder buildActions(List<OFAction> actions, | 292 | + /** |
| 293 | - TrafficTreatment.Builder builder) { | 293 | + * Configures traffic treatment builder with a given collection of actions. |
| 294 | - DriverHandler driverHandler = getDriver(deviceId); | 294 | + * |
| 295 | - ExtensionTreatmentInterpreter treatmentInterpreter; | 295 | + * @param actions a set of OpenFlow actions |
| 296 | + * @param builder traffic treatment builder | ||
| 297 | + * @param driverHandler driver handler | ||
| 298 | + * @param deviceId device identifier | ||
| 299 | + * @return configured traffic treatment builder | ||
| 300 | + */ | ||
| 301 | + public static TrafficTreatment.Builder configureTreatmentBuilder(List<OFAction> actions, | ||
| 302 | + TrafficTreatment.Builder builder, | ||
| 303 | + DriverHandler driverHandler, | ||
| 304 | + DeviceId deviceId) { | ||
| 305 | + ExtensionTreatmentInterpreter interpreter; | ||
| 296 | if (driverHandler.hasBehaviour(ExtensionTreatmentInterpreter.class)) { | 306 | if (driverHandler.hasBehaviour(ExtensionTreatmentInterpreter.class)) { |
| 297 | - treatmentInterpreter = driverHandler.behaviour(ExtensionTreatmentInterpreter.class); | 307 | + interpreter = driverHandler.behaviour(ExtensionTreatmentInterpreter.class); |
| 298 | } else { | 308 | } else { |
| 299 | - treatmentInterpreter = null; | 309 | + interpreter = null; |
| 300 | } | 310 | } |
| 301 | 311 | ||
| 302 | for (OFAction act : actions) { | 312 | for (OFAction act : actions) { |
| ... | @@ -344,15 +354,15 @@ public class FlowEntryBuilder { | ... | @@ -344,15 +354,15 @@ public class FlowEntryBuilder { |
| 344 | lookupGridType(circuitSignalID.getGridType()), | 354 | lookupGridType(circuitSignalID.getGridType()), |
| 345 | lookupChannelSpacing(circuitSignalID.getChannelSpacing()), | 355 | lookupChannelSpacing(circuitSignalID.getChannelSpacing()), |
| 346 | circuitSignalID.getChannelNumber(), circuitSignalID.getSpectralWidth()))); | 356 | circuitSignalID.getChannelNumber(), circuitSignalID.getSpectralWidth()))); |
| 347 | - } else if (treatmentInterpreter != null) { | 357 | + } else if (interpreter != null) { |
| 348 | - builder.extension(treatmentInterpreter.mapAction(exp), deviceId); | 358 | + builder.extension(interpreter.mapAction(exp), deviceId); |
| 349 | } else { | 359 | } else { |
| 350 | log.warn("Unsupported OFActionExperimenter {}", exp.getExperimenter()); | 360 | log.warn("Unsupported OFActionExperimenter {}", exp.getExperimenter()); |
| 351 | } | 361 | } |
| 352 | break; | 362 | break; |
| 353 | case SET_FIELD: | 363 | case SET_FIELD: |
| 354 | OFActionSetField setField = (OFActionSetField) act; | 364 | OFActionSetField setField = (OFActionSetField) act; |
| 355 | - handleSetField(builder, setField); | 365 | + handleSetField(builder, setField, driverHandler, deviceId); |
| 356 | break; | 366 | break; |
| 357 | case POP_MPLS: | 367 | case POP_MPLS: |
| 358 | OFActionPopMpls popMpls = (OFActionPopMpls) act; | 368 | OFActionPopMpls popMpls = (OFActionPopMpls) act; |
| ... | @@ -410,9 +420,18 @@ public class FlowEntryBuilder { | ... | @@ -410,9 +420,18 @@ public class FlowEntryBuilder { |
| 410 | return builder; | 420 | return builder; |
| 411 | } | 421 | } |
| 412 | 422 | ||
| 413 | - | 423 | + private TrafficTreatment.Builder buildActions(List<OFAction> actions, |
| 414 | - private void handleSetField(TrafficTreatment.Builder builder, OFActionSetField action) { | 424 | + TrafficTreatment.Builder builder) { |
| 415 | DriverHandler driverHandler = getDriver(deviceId); | 425 | DriverHandler driverHandler = getDriver(deviceId); |
| 426 | + | ||
| 427 | + return configureTreatmentBuilder(actions, builder, driverHandler, deviceId); | ||
| 428 | + } | ||
| 429 | + | ||
| 430 | + | ||
| 431 | + private static void handleSetField(TrafficTreatment.Builder builder, | ||
| 432 | + OFActionSetField action, | ||
| 433 | + DriverHandler driverHandler, | ||
| 434 | + DeviceId deviceId) { | ||
| 416 | ExtensionTreatmentInterpreter treatmentInterpreter; | 435 | ExtensionTreatmentInterpreter treatmentInterpreter; |
| 417 | if (driverHandler.hasBehaviour(ExtensionTreatmentInterpreter.class)) { | 436 | if (driverHandler.hasBehaviour(ExtensionTreatmentInterpreter.class)) { |
| 418 | treatmentInterpreter = driverHandler.behaviour(ExtensionTreatmentInterpreter.class); | 437 | treatmentInterpreter = driverHandler.behaviour(ExtensionTreatmentInterpreter.class); | ... | ... |
| ... | @@ -31,4 +31,12 @@ | ... | @@ -31,4 +31,12 @@ |
| 31 | 31 | ||
| 32 | <description>ONOS OpenFlow protocol group provider</description> | 32 | <description>ONOS OpenFlow protocol group provider</description> |
| 33 | 33 | ||
| 34 | + <dependencies> | ||
| 35 | + <dependency> | ||
| 36 | + <groupId>org.onosproject</groupId> | ||
| 37 | + <artifactId>onos-of-provider-flow</artifactId> | ||
| 38 | + <version>${project.version}</version> | ||
| 39 | + </dependency> | ||
| 40 | + </dependencies> | ||
| 41 | + | ||
| 34 | </project> | 42 | </project> |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
This diff is collapsed. Click to expand it.
-
Please register or login to post a comment