Adding a driver for OF-DPA in Qumran based switches.

Change-Id: I0dae54488e02dbd86c9bb81c556efba2f3f3f0dd
This commit is contained in:
Saurav Das 2017-04-28 17:03:48 -07:00 committed by Yuta HIGUCHI
parent 37cd451a16
commit 86d13e8ef4
3 changed files with 125 additions and 5 deletions

View File

@ -199,6 +199,15 @@ public class Ofdpa2Pipeline extends AbstractHandlerBehaviour implements Pipeline
return true;
}
/**
* Determines whether in-port should be matched on in TMAC table rules.
*
* @return true if match on in-port should be programmed
*/
protected boolean matchInPortTmacTable() {
return true;
}
//////////////////////////////////////
// Flow Objectives
//////////////////////////////////////
@ -624,7 +633,9 @@ public class Ofdpa2Pipeline extends AbstractHandlerBehaviour implements Pipeline
// for unicast IP packets
TrafficSelector.Builder selector = DefaultTrafficSelector.builder();
TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder();
selector.matchInPort(pnum);
if (matchInPortTmacTable()) {
selector.matchInPort(pnum);
}
if (requireVlanExtensions()) {
selector.extension(ofdpaMatchVlanVid, deviceId);
} else {
@ -645,7 +656,9 @@ public class Ofdpa2Pipeline extends AbstractHandlerBehaviour implements Pipeline
//for MPLS packets
selector = DefaultTrafficSelector.builder();
treatment = DefaultTrafficTreatment.builder();
selector.matchInPort(pnum);
if (matchInPortTmacTable()) {
selector.matchInPort(pnum);
}
if (requireVlanExtensions()) {
selector.extension(ofdpaMatchVlanVid, deviceId);
} else {
@ -668,7 +681,9 @@ public class Ofdpa2Pipeline extends AbstractHandlerBehaviour implements Pipeline
*/
selector = DefaultTrafficSelector.builder();
treatment = DefaultTrafficTreatment.builder();
selector.matchInPort(pnum);
if (matchInPortTmacTable()) {
selector.matchInPort(pnum);
}
if (requireVlanExtensions()) {
selector.extension(ofdpaMatchVlanVid, deviceId);
} else {

View File

@ -0,0 +1,96 @@
/*
* Copyright 2016-present Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.driver.pipeline;
import static org.slf4j.LoggerFactory.getLogger;
import java.util.Collection;
import org.onlab.packet.Ethernet;
import org.onosproject.net.flow.FlowRule;
import org.onosproject.net.flow.TrafficSelector;
import org.onosproject.net.flow.criteria.Criterion;
import org.onosproject.net.flow.criteria.EthTypeCriterion;
import org.onosproject.net.flow.criteria.IPCriterion;
import org.onosproject.net.flowobjective.ForwardingObjective;
import org.onosproject.net.flowobjective.ObjectiveError;
import org.slf4j.Logger;
import com.google.common.collect.ImmutableSet;
/**
* Pipeliner for Broadcom OF-DPA 3.0 TTP, specifically for Qumran based switches.
*/
public class Ofdpa3QmxPipeline extends Ofdpa3Pipeline {
private final Logger log = getLogger(getClass());
@Override
protected void initDriverId() {
driverId = coreService.registerApplication(
"org.onosproject.driver.Ofdpa3QmxPipeline");
}
@Override
protected boolean matchInPortTmacTable() {
return false;
}
@Override
protected Collection<FlowRule> processEthTypeSpecific(ForwardingObjective fwd) {
TrafficSelector selector = fwd.selector();
EthTypeCriterion ethType =
(EthTypeCriterion) selector.getCriterion(Criterion.Type.ETH_TYPE);
//XXX remove when support is added to Qumran based OF-DPA
if (ethType.ethType().toShort() == Ethernet.TYPE_IPV4 ||
ethType.ethType().toShort() == Ethernet.TYPE_IPV6) {
log.warn("Routing table is currently unsupported in dev:{}", deviceId);
return ImmutableSet.of();
}
return super.processEthTypeSpecific(fwd);
}
@Override
protected Collection<FlowRule> processVersatile(ForwardingObjective fwd) {
EthTypeCriterion ethType =
(EthTypeCriterion) fwd.selector().getCriterion(Criterion.Type.ETH_TYPE);
if (ethType == null) {
log.error("Versatile forwarding objective:{} must include ethType",
fwd.id());
fail(fwd, ObjectiveError.BADPARAMS);
return ImmutableSet.of();
}
//XXX remove when support is added to Qumran based OF-DPA
if (ethType.ethType().toShort() == Ethernet.TYPE_IPV6) {
log.warn("ACL table for IPv6 is currently unsupported in dev:{}", deviceId);
return ImmutableSet.of();
}
if (ethType.ethType().toShort() == Ethernet.TYPE_IPV4) {
for (Criterion c : fwd.selector().criteria()) {
if (c instanceof IPCriterion) {
if (((IPCriterion) c).type() == Criterion.Type.IPV4_DST) {
log.warn("ACL table for Dst IPv4 is currently "
+ "unsupported in dev:{}", deviceId);
return ImmutableSet.of();
}
}
}
}
return super.processVersatile(fwd);
}
}

View File

@ -88,8 +88,8 @@
impl="org.onosproject.driver.extensions.OfdpaExtensionSelectorInterpreter" />
</driver>
<!-- Driver for OFDPA 3.0 EA0.
~ TODO: version number in 3.0 EA0 is still 2.0. Update to 3.0 when OFDPA releases.
<!-- Driver for OFDPA 3.0 EA*.
~ TODO: version number from switch is still 2.0. Update when 3.0 is GA.
-->
<driver name="ofdpa3" extends="default"
manufacturer="Broadcom Corp." hwVersion="OF-DPA 2.0" swVersion="OF-DPA 2.0">
@ -105,6 +105,15 @@
impl="org.onosproject.driver.extensions.Ofdpa3ExtensionSelectorInterpreter" />
</driver>
<!-- Driver for OFDPA 3.0 EA* for Qumran based switches.
~ Note: driver needs to be configured using onos-netcfg.
-->
<driver name="qmx-ofdpa3" extends="ofdpa3"
manufacturer="Broadcom Corp." hwVersion="Qmx" swVersion="Qmx">
<behaviour api="org.onosproject.net.behaviour.Pipeliner"
impl="org.onosproject.driver.pipeline.Ofdpa3QmxPipeline"/>
</driver>
<driver name="znyx-ofdpa" extends="default"
manufacturer="ZNYX Networks" hwVersion=".*" swVersion=".*OF-DPA.*">
<behaviour api="org.onosproject.net.behaviour.Pipeliner"