Committed by
Gerrit Code Review
Add driver support for Corsa Pipeline V3
Change-Id: If5c1aa9cec6093e3c9f2f908de6066957d9ad8fd
Showing
5 changed files
with
89 additions
and
12 deletions
... | @@ -15,13 +15,17 @@ | ... | @@ -15,13 +15,17 @@ |
15 | */ | 15 | */ |
16 | package org.onosproject.driver.handshaker; | 16 | package org.onosproject.driver.handshaker; |
17 | 17 | ||
18 | +import org.onosproject.net.meter.MeterId; | ||
18 | import org.onosproject.openflow.controller.driver.AbstractOpenFlowSwitch; | 19 | import org.onosproject.openflow.controller.driver.AbstractOpenFlowSwitch; |
19 | import org.onosproject.openflow.controller.driver.SwitchDriverSubHandshakeAlreadyStarted; | 20 | import org.onosproject.openflow.controller.driver.SwitchDriverSubHandshakeAlreadyStarted; |
20 | import org.onosproject.openflow.controller.driver.SwitchDriverSubHandshakeCompleted; | 21 | import org.onosproject.openflow.controller.driver.SwitchDriverSubHandshakeCompleted; |
21 | import org.onosproject.openflow.controller.driver.SwitchDriverSubHandshakeNotStarted; | 22 | import org.onosproject.openflow.controller.driver.SwitchDriverSubHandshakeNotStarted; |
22 | import org.projectfloodlight.openflow.protocol.OFBarrierRequest; | 23 | import org.projectfloodlight.openflow.protocol.OFBarrierRequest; |
23 | import org.projectfloodlight.openflow.protocol.OFFlowMod; | 24 | import org.projectfloodlight.openflow.protocol.OFFlowMod; |
25 | +import org.projectfloodlight.openflow.protocol.OFGroupMod; | ||
26 | +import org.projectfloodlight.openflow.protocol.OFGroupType; | ||
24 | import org.projectfloodlight.openflow.protocol.OFMessage; | 27 | import org.projectfloodlight.openflow.protocol.OFMessage; |
28 | +import org.projectfloodlight.openflow.protocol.OFMeterMod; | ||
25 | import org.projectfloodlight.openflow.protocol.OFType; | 29 | import org.projectfloodlight.openflow.protocol.OFType; |
26 | import org.projectfloodlight.openflow.types.OFGroup; | 30 | import org.projectfloodlight.openflow.types.OFGroup; |
27 | import org.projectfloodlight.openflow.types.TableId; | 31 | import org.projectfloodlight.openflow.types.TableId; |
... | @@ -58,6 +62,19 @@ public class CorsaSwitchHandshaker extends AbstractOpenFlowSwitch { | ... | @@ -58,6 +62,19 @@ public class CorsaSwitchHandshaker extends AbstractOpenFlowSwitch { |
58 | 62 | ||
59 | sendMsg(Collections.singletonList(fm)); | 63 | sendMsg(Collections.singletonList(fm)); |
60 | 64 | ||
65 | + OFGroupMod gm = factory().buildGroupDelete() | ||
66 | + .setGroup(OFGroup.ALL) | ||
67 | + .setGroupType(OFGroupType.ALL) | ||
68 | + .build(); | ||
69 | + | ||
70 | + sendMsg(Collections.singletonList(gm)); | ||
71 | + | ||
72 | + OFMeterMod mm = factory().buildMeterMod() | ||
73 | + .setMeterId(MeterId.ALL.id()) | ||
74 | + .build(); | ||
75 | + | ||
76 | + sendMsg(Collections.singletonList(mm)); | ||
77 | + | ||
61 | barrierXid = getNextTransactionId(); | 78 | barrierXid = getNextTransactionId(); |
62 | OFBarrierRequest barrier = factory().buildBarrierRequest() | 79 | OFBarrierRequest barrier = factory().buildBarrierRequest() |
63 | .setXid(barrierXid).build(); | 80 | .setXid(barrierXid).build(); | ... | ... |
... | @@ -26,8 +26,13 @@ import org.onosproject.net.flow.FlowRuleOperations; | ... | @@ -26,8 +26,13 @@ import org.onosproject.net.flow.FlowRuleOperations; |
26 | import org.onosproject.net.flow.FlowRuleOperationsContext; | 26 | import org.onosproject.net.flow.FlowRuleOperationsContext; |
27 | import org.onosproject.net.flow.TrafficSelector; | 27 | import org.onosproject.net.flow.TrafficSelector; |
28 | import org.onosproject.net.flow.TrafficTreatment; | 28 | import org.onosproject.net.flow.TrafficTreatment; |
29 | +import org.onosproject.net.flowobjective.ForwardingObjective; | ||
30 | +import org.onosproject.net.flowobjective.ObjectiveError; | ||
29 | import org.slf4j.Logger; | 31 | import org.slf4j.Logger; |
30 | 32 | ||
33 | +import java.util.Collection; | ||
34 | +import java.util.Collections; | ||
35 | + | ||
31 | /** | 36 | /** |
32 | * Driver for Corsa TTP. | 37 | * Driver for Corsa TTP. |
33 | * | 38 | * |
... | @@ -70,7 +75,14 @@ public class CorsaPipeline extends OVSCorsaPipeline { | ... | @@ -70,7 +75,14 @@ public class CorsaPipeline extends OVSCorsaPipeline { |
70 | "Failed to provision vlan/mpls table"); | 75 | "Failed to provision vlan/mpls table"); |
71 | } | 76 | } |
72 | })); | 77 | })); |
78 | + } | ||
73 | 79 | ||
80 | + @Override | ||
81 | + protected Collection<FlowRule> processSpecificSwitch(ForwardingObjective fwd) { | ||
82 | + /* Not supported by until CorsaPipelineV3 */ | ||
83 | + log.warn("Vlan switching not supported in corsa-v1 driver"); | ||
84 | + fail(fwd, ObjectiveError.UNSUPPORTED); | ||
85 | + return Collections.emptySet(); | ||
74 | } | 86 | } |
75 | 87 | ||
76 | } | 88 | } | ... | ... |
This diff is collapsed. Click to expand it.
... | @@ -67,6 +67,7 @@ import org.onosproject.net.group.GroupEvent; | ... | @@ -67,6 +67,7 @@ import org.onosproject.net.group.GroupEvent; |
67 | import org.onosproject.net.group.GroupKey; | 67 | import org.onosproject.net.group.GroupKey; |
68 | import org.onosproject.net.group.GroupListener; | 68 | import org.onosproject.net.group.GroupListener; |
69 | import org.onosproject.net.group.GroupService; | 69 | import org.onosproject.net.group.GroupService; |
70 | +import org.onosproject.net.meter.MeterService; | ||
70 | import org.slf4j.Logger; | 71 | import org.slf4j.Logger; |
71 | 72 | ||
72 | import java.util.Collection; | 73 | import java.util.Collection; |
... | @@ -96,8 +97,8 @@ public class OVSCorsaPipeline extends AbstractHandlerBehaviour implements Pipeli | ... | @@ -96,8 +97,8 @@ public class OVSCorsaPipeline extends AbstractHandlerBehaviour implements Pipeli |
96 | 97 | ||
97 | 98 | ||
98 | protected static final int CONTROLLER_PRIORITY = 255; | 99 | protected static final int CONTROLLER_PRIORITY = 255; |
99 | - private static final int DROP_PRIORITY = 0; | 100 | + protected static final int DROP_PRIORITY = 0; |
100 | - private static final int HIGHEST_PRIORITY = 0xffff; | 101 | + protected static final int HIGHEST_PRIORITY = 0xffff; |
101 | 102 | ||
102 | private final Logger log = getLogger(getClass()); | 103 | private final Logger log = getLogger(getClass()); |
103 | 104 | ||
... | @@ -105,6 +106,7 @@ public class OVSCorsaPipeline extends AbstractHandlerBehaviour implements Pipeli | ... | @@ -105,6 +106,7 @@ public class OVSCorsaPipeline extends AbstractHandlerBehaviour implements Pipeli |
105 | protected FlowRuleService flowRuleService; | 106 | protected FlowRuleService flowRuleService; |
106 | private CoreService coreService; | 107 | private CoreService coreService; |
107 | private GroupService groupService; | 108 | private GroupService groupService; |
109 | + protected MeterService meterService; | ||
108 | private FlowObjectiveStore flowObjectiveStore; | 110 | private FlowObjectiveStore flowObjectiveStore; |
109 | protected DeviceId deviceId; | 111 | protected DeviceId deviceId; |
110 | protected ApplicationId appId; | 112 | protected ApplicationId appId; |
... | @@ -140,6 +142,7 @@ public class OVSCorsaPipeline extends AbstractHandlerBehaviour implements Pipeli | ... | @@ -140,6 +142,7 @@ public class OVSCorsaPipeline extends AbstractHandlerBehaviour implements Pipeli |
140 | coreService = serviceDirectory.get(CoreService.class); | 142 | coreService = serviceDirectory.get(CoreService.class); |
141 | flowRuleService = serviceDirectory.get(FlowRuleService.class); | 143 | flowRuleService = serviceDirectory.get(FlowRuleService.class); |
142 | groupService = serviceDirectory.get(GroupService.class); | 144 | groupService = serviceDirectory.get(GroupService.class); |
145 | + meterService = serviceDirectory.get(MeterService.class); | ||
143 | flowObjectiveStore = context.store(); | 146 | flowObjectiveStore = context.store(); |
144 | 147 | ||
145 | groupService.addListener(new InnerGroupListener()); | 148 | groupService.addListener(new InnerGroupListener()); |
... | @@ -205,6 +208,7 @@ public class OVSCorsaPipeline extends AbstractHandlerBehaviour implements Pipeli | ... | @@ -205,6 +208,7 @@ public class OVSCorsaPipeline extends AbstractHandlerBehaviour implements Pipeli |
205 | Collection<TrafficTreatment> treatments = nextObjective.next(); | 208 | Collection<TrafficTreatment> treatments = nextObjective.next(); |
206 | if (treatments.size() == 1) { | 209 | if (treatments.size() == 1) { |
207 | TrafficTreatment treatment = treatments.iterator().next(); | 210 | TrafficTreatment treatment = treatments.iterator().next(); |
211 | + treatment = processNextTreatment(treatment); | ||
208 | GroupBucket bucket = | 212 | GroupBucket bucket = |
209 | DefaultGroupBucket.createIndirectGroupBucket(treatment); | 213 | DefaultGroupBucket.createIndirectGroupBucket(treatment); |
210 | final GroupKey key = new DefaultGroupKey(appKryo.serialize(nextObjective.id())); | 214 | final GroupKey key = new DefaultGroupKey(appKryo.serialize(nextObjective.id())); |
... | @@ -233,6 +237,11 @@ public class OVSCorsaPipeline extends AbstractHandlerBehaviour implements Pipeli | ... | @@ -233,6 +237,11 @@ public class OVSCorsaPipeline extends AbstractHandlerBehaviour implements Pipeli |
233 | 237 | ||
234 | } | 238 | } |
235 | 239 | ||
240 | + /* Hook for altering the NextObjective treatment */ | ||
241 | + protected TrafficTreatment processNextTreatment(TrafficTreatment treatment) { | ||
242 | + return treatment; /* Keep treatment as is for OVSCorsaPipeline */ | ||
243 | + } | ||
244 | + | ||
236 | private Collection<FlowRule> processForward(ForwardingObjective fwd) { | 245 | private Collection<FlowRule> processForward(ForwardingObjective fwd) { |
237 | switch (fwd.flag()) { | 246 | switch (fwd.flag()) { |
238 | case SPECIFIC: | 247 | case SPECIFIC: |
... | @@ -301,22 +310,32 @@ public class OVSCorsaPipeline extends AbstractHandlerBehaviour implements Pipeli | ... | @@ -301,22 +310,32 @@ public class OVSCorsaPipeline extends AbstractHandlerBehaviour implements Pipeli |
301 | private Collection<FlowRule> processSpecific(ForwardingObjective fwd) { | 310 | private Collection<FlowRule> processSpecific(ForwardingObjective fwd) { |
302 | log.debug("Processing specific forwarding objective"); | 311 | log.debug("Processing specific forwarding objective"); |
303 | TrafficSelector selector = fwd.selector(); | 312 | TrafficSelector selector = fwd.selector(); |
313 | + | ||
304 | EthTypeCriterion ethType = | 314 | EthTypeCriterion ethType = |
305 | (EthTypeCriterion) selector.getCriterion(Criterion.Type.ETH_TYPE); | 315 | (EthTypeCriterion) selector.getCriterion(Criterion.Type.ETH_TYPE); |
306 | - if (ethType == null || ethType.ethType().toShort() != Ethernet.TYPE_IPV4) { | 316 | + if (ethType != null) { |
317 | + short et = ethType.ethType().toShort(); | ||
318 | + if (et == Ethernet.TYPE_IPV4) { | ||
319 | + return processSpecificRoute(fwd); | ||
320 | + } else if (et == Ethernet.TYPE_VLAN) { | ||
321 | + /* The ForwardingObjective must specify VLAN ethtype in order to use the Transit Circuit */ | ||
322 | + return processSpecificSwitch(fwd); | ||
323 | + } | ||
324 | + } | ||
325 | + | ||
307 | fail(fwd, ObjectiveError.UNSUPPORTED); | 326 | fail(fwd, ObjectiveError.UNSUPPORTED); |
308 | return Collections.emptySet(); | 327 | return Collections.emptySet(); |
309 | } | 328 | } |
310 | 329 | ||
330 | + private Collection<FlowRule> processSpecificRoute(ForwardingObjective fwd) { | ||
311 | TrafficSelector filteredSelector = | 331 | TrafficSelector filteredSelector = |
312 | DefaultTrafficSelector.builder() | 332 | DefaultTrafficSelector.builder() |
313 | .matchEthType(Ethernet.TYPE_IPV4) | 333 | .matchEthType(Ethernet.TYPE_IPV4) |
314 | .matchIPDst( | 334 | .matchIPDst( |
315 | - ((IPCriterion) | 335 | + ((IPCriterion) fwd.selector().getCriterion(Criterion.Type.IPV4_DST)).ip()) |
316 | - selector.getCriterion(Criterion.Type.IPV4_DST)).ip()) | ||
317 | .build(); | 336 | .build(); |
318 | 337 | ||
319 | - TrafficTreatment.Builder tb = DefaultTrafficTreatment.builder(); | 338 | + TrafficTreatment.Builder tb = processSpecificRoutingTreatment(); |
320 | 339 | ||
321 | if (fwd.nextId() != null) { | 340 | if (fwd.nextId() != null) { |
322 | NextGroup next = flowObjectiveStore.getNextGroup(fwd.nextId()); | 341 | NextGroup next = flowObjectiveStore.getNextGroup(fwd.nextId()); |
... | @@ -337,20 +356,35 @@ public class OVSCorsaPipeline extends AbstractHandlerBehaviour implements Pipeli | ... | @@ -337,20 +356,35 @@ public class OVSCorsaPipeline extends AbstractHandlerBehaviour implements Pipeli |
337 | .withSelector(filteredSelector) | 356 | .withSelector(filteredSelector) |
338 | .withTreatment(tb.build()); | 357 | .withTreatment(tb.build()); |
339 | 358 | ||
359 | + ruleBuilder = processSpecificRoutingRule(ruleBuilder); | ||
360 | + | ||
340 | if (fwd.permanent()) { | 361 | if (fwd.permanent()) { |
341 | ruleBuilder.makePermanent(); | 362 | ruleBuilder.makePermanent(); |
342 | } else { | 363 | } else { |
343 | ruleBuilder.makeTemporary(fwd.timeout()); | 364 | ruleBuilder.makeTemporary(fwd.timeout()); |
344 | } | 365 | } |
345 | 366 | ||
346 | - ruleBuilder.forTable(FIB_TABLE); | 367 | + return Collections.singletonList(ruleBuilder.build()); |
368 | + } | ||
347 | 369 | ||
370 | + /* Hook for modifying Route traffic treatment */ | ||
371 | + protected TrafficTreatment.Builder processSpecificRoutingTreatment() { | ||
372 | + return DefaultTrafficTreatment.builder(); | ||
373 | + } | ||
348 | 374 | ||
349 | - return Collections.singletonList(ruleBuilder.build()); | 375 | + /* Hook for modifying Route flow rule */ |
376 | + protected FlowRule.Builder processSpecificRoutingRule(FlowRule.Builder rb) { | ||
377 | + return rb.forTable(FIB_TABLE); | ||
378 | + } | ||
350 | 379 | ||
380 | + protected Collection<FlowRule> processSpecificSwitch(ForwardingObjective fwd) { | ||
381 | + /* Not supported by until CorsaPipelineV3 */ | ||
382 | + log.warn("Vlan switching not supported in ovs-corsa driver"); | ||
383 | + fail(fwd, ObjectiveError.UNSUPPORTED); | ||
384 | + return Collections.emptySet(); | ||
351 | } | 385 | } |
352 | 386 | ||
353 | - private void processFilter(FilteringObjective filt, boolean install, | 387 | + protected void processFilter(FilteringObjective filt, boolean install, |
354 | ApplicationId applicationId) { | 388 | ApplicationId applicationId) { |
355 | // This driver only processes filtering criteria defined with switch | 389 | // This driver only processes filtering criteria defined with switch |
356 | // ports as the key | 390 | // ports as the key |
... | @@ -441,19 +475,19 @@ public class OVSCorsaPipeline extends AbstractHandlerBehaviour implements Pipeli | ... | @@ -441,19 +475,19 @@ public class OVSCorsaPipeline extends AbstractHandlerBehaviour implements Pipeli |
441 | })); | 475 | })); |
442 | } | 476 | } |
443 | 477 | ||
444 | - private void pass(Objective obj) { | 478 | + protected void pass(Objective obj) { |
445 | if (obj.context().isPresent()) { | 479 | if (obj.context().isPresent()) { |
446 | obj.context().get().onSuccess(obj); | 480 | obj.context().get().onSuccess(obj); |
447 | } | 481 | } |
448 | } | 482 | } |
449 | 483 | ||
450 | - private void fail(Objective obj, ObjectiveError error) { | 484 | + protected void fail(Objective obj, ObjectiveError error) { |
451 | if (obj.context().isPresent()) { | 485 | if (obj.context().isPresent()) { |
452 | obj.context().get().onError(obj, error); | 486 | obj.context().get().onError(obj, error); |
453 | } | 487 | } |
454 | } | 488 | } |
455 | 489 | ||
456 | - private void initializePipeline() { | 490 | + protected void initializePipeline() { |
457 | processMacTable(true); | 491 | processMacTable(true); |
458 | processVlanMplsTable(true); | 492 | processVlanMplsTable(true); |
459 | processVlanTable(true); | 493 | processVlanTable(true); | ... | ... |
... | @@ -84,6 +84,20 @@ | ... | @@ -84,6 +84,20 @@ |
84 | <behaviour api="org.onosproject.openflow.controller.driver.OpenFlowSwitchDriver" | 84 | <behaviour api="org.onosproject.openflow.controller.driver.OpenFlowSwitchDriver" |
85 | impl="org.onosproject.driver.handshaker.CorsaSwitchHandshaker"/> | 85 | impl="org.onosproject.driver.handshaker.CorsaSwitchHandshaker"/> |
86 | </driver> | 86 | </driver> |
87 | + <driver name="corsa-v1" | ||
88 | + manufacturer="Corsa" hwVersion="Corsa Element" swVersion="2.3.1"> | ||
89 | + <behaviour api="org.onosproject.net.behaviour.Pipeliner" | ||
90 | + impl="org.onosproject.driver.pipeline.CorsaPipeline"/> | ||
91 | + <behaviour api="org.onosproject.openflow.controller.driver.OpenFlowSwitchDriver" | ||
92 | + impl="org.onosproject.driver.handshaker.CorsaSwitchHandshaker"/> | ||
93 | + </driver> | ||
94 | + <driver name="corsa-v3" | ||
95 | + manufacturer="Corsa" hwVersion="Corsa Element" swVersion="2.3.1"> | ||
96 | + <behaviour api="org.onosproject.net.behaviour.Pipeliner" | ||
97 | + impl="org.onosproject.driver.pipeline.CorsaPipelineV3"/> | ||
98 | + <behaviour api="org.onosproject.openflow.controller.driver.OpenFlowSwitchDriver" | ||
99 | + impl="org.onosproject.driver.handshaker.CorsaSwitchHandshaker"/> | ||
100 | + </driver> | ||
87 | <driver name="ofdpa" extends="default" | 101 | <driver name="ofdpa" extends="default" |
88 | manufacturer="Broadcom Corp." hwVersion="OF-DPA.*" swVersion="OF-DPA.*"> | 102 | manufacturer="Broadcom Corp." hwVersion="OF-DPA.*" swVersion="OF-DPA.*"> |
89 | <behaviour api="org.onosproject.net.behaviour.Pipeliner" | 103 | <behaviour api="org.onosproject.net.behaviour.Pipeliner" | ... | ... |
-
Please register or login to post a comment