blob: 82305810457c113ba05b795cda58a077a766ba9a [file] [log] [blame]
Saurav Das86d13e82017-04-28 17:03:48 -07001/*
Yi Tsengef19de12017-04-24 11:33:05 -07002 * Copyright 2017-present Open Networking Laboratory
Saurav Das86d13e82017-04-28 17:03:48 -07003 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
Yi Tsengef19de12017-04-24 11:33:05 -070017package org.onosproject.driver.pipeline.ofdpa;
Saurav Das86d13e82017-04-28 17:03:48 -070018
19import static org.slf4j.LoggerFactory.getLogger;
20
21import java.util.Collection;
22import org.onlab.packet.Ethernet;
23import org.onosproject.net.flow.FlowRule;
24import org.onosproject.net.flow.TrafficSelector;
25import org.onosproject.net.flow.criteria.Criterion;
26import org.onosproject.net.flow.criteria.EthTypeCriterion;
27import org.onosproject.net.flow.criteria.IPCriterion;
28import org.onosproject.net.flowobjective.ForwardingObjective;
29import org.onosproject.net.flowobjective.ObjectiveError;
30import org.slf4j.Logger;
31
32import com.google.common.collect.ImmutableSet;
33
34/**
35 * Pipeliner for Broadcom OF-DPA 3.0 TTP, specifically for Qumran based switches.
36 */
37public class Ofdpa3QmxPipeline extends Ofdpa3Pipeline {
38 private final Logger log = getLogger(getClass());
39
40 @Override
41 protected void initDriverId() {
42 driverId = coreService.registerApplication(
43 "org.onosproject.driver.Ofdpa3QmxPipeline");
44 }
45
46 @Override
47 protected boolean matchInPortTmacTable() {
48 return false;
49 }
50
51 @Override
52 protected Collection<FlowRule> processEthTypeSpecific(ForwardingObjective fwd) {
53 TrafficSelector selector = fwd.selector();
54 EthTypeCriterion ethType =
55 (EthTypeCriterion) selector.getCriterion(Criterion.Type.ETH_TYPE);
56 //XXX remove when support is added to Qumran based OF-DPA
57 if (ethType.ethType().toShort() == Ethernet.TYPE_IPV4 ||
58 ethType.ethType().toShort() == Ethernet.TYPE_IPV6) {
59 log.warn("Routing table is currently unsupported in dev:{}", deviceId);
60 return ImmutableSet.of();
61 }
62
63 return super.processEthTypeSpecific(fwd);
64 }
65
66 @Override
67 protected Collection<FlowRule> processVersatile(ForwardingObjective fwd) {
68 EthTypeCriterion ethType =
69 (EthTypeCriterion) fwd.selector().getCriterion(Criterion.Type.ETH_TYPE);
70 if (ethType == null) {
71 log.error("Versatile forwarding objective:{} must include ethType",
72 fwd.id());
73 fail(fwd, ObjectiveError.BADPARAMS);
74 return ImmutableSet.of();
75 }
76 //XXX remove when support is added to Qumran based OF-DPA
77 if (ethType.ethType().toShort() == Ethernet.TYPE_IPV6) {
78 log.warn("ACL table for IPv6 is currently unsupported in dev:{}", deviceId);
79 return ImmutableSet.of();
80 }
81
82 if (ethType.ethType().toShort() == Ethernet.TYPE_IPV4) {
83 for (Criterion c : fwd.selector().criteria()) {
84 if (c instanceof IPCriterion) {
85 if (((IPCriterion) c).type() == Criterion.Type.IPV4_DST) {
86 log.warn("ACL table for Dst IPv4 is currently "
87 + "unsupported in dev:{}", deviceId);
88 return ImmutableSet.of();
89 }
90 }
91 }
92 }
93
94 return super.processVersatile(fwd);
95 }
96}