Thomas Vachuska | 781d18b | 2014-10-27 10:31:25 -0700 | [diff] [blame] | 1 | /* |
Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 2 | * Copyright 2014 Open Networking Laboratory |
Thomas Vachuska | 781d18b | 2014-10-27 10:31:25 -0700 | [diff] [blame] | 3 | * |
Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 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 |
Thomas Vachuska | 781d18b | 2014-10-27 10:31:25 -0700 | [diff] [blame] | 7 | * |
Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 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. |
Thomas Vachuska | 781d18b | 2014-10-27 10:31:25 -0700 | [diff] [blame] | 15 | */ |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 16 | package org.onosproject.provider.of.flow.impl; |
alshabib | eec3a06 | 2014-09-17 18:01:26 -0700 | [diff] [blame] | 17 | |
Jonathan Hart | 6cd2f35 | 2015-01-13 17:44:45 -0800 | [diff] [blame^] | 18 | import org.onlab.packet.Ip4Address; |
| 19 | import org.onlab.packet.Ip4Prefix; |
Charles M.C. Chan | 52fae7d | 2015-01-17 00:35:53 +0800 | [diff] [blame] | 20 | import org.onlab.packet.Ip6Address; |
| 21 | import org.onlab.packet.Ip6Prefix; |
Jonathan Hart | 6cd2f35 | 2015-01-13 17:44:45 -0800 | [diff] [blame^] | 22 | import org.onlab.packet.VlanId; |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 23 | import org.onosproject.net.flow.FlowRule; |
| 24 | import org.onosproject.net.flow.TrafficSelector; |
| 25 | import org.onosproject.net.flow.criteria.Criteria; |
| 26 | import org.onosproject.net.flow.criteria.Criteria.EthCriterion; |
| 27 | import org.onosproject.net.flow.criteria.Criteria.EthTypeCriterion; |
| 28 | import org.onosproject.net.flow.criteria.Criteria.IPCriterion; |
| 29 | import org.onosproject.net.flow.criteria.Criteria.IPProtocolCriterion; |
Jonathan Hart | 6cd2f35 | 2015-01-13 17:44:45 -0800 | [diff] [blame^] | 30 | import org.onosproject.net.flow.criteria.Criteria.Icmpv6CodeCriterion; |
| 31 | import org.onosproject.net.flow.criteria.Criteria.Icmpv6TypeCriterion; |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 32 | import org.onosproject.net.flow.criteria.Criteria.LambdaCriterion; |
| 33 | import org.onosproject.net.flow.criteria.Criteria.PortCriterion; |
| 34 | import org.onosproject.net.flow.criteria.Criteria.TcpPortCriterion; |
| 35 | import org.onosproject.net.flow.criteria.Criteria.VlanIdCriterion; |
| 36 | import org.onosproject.net.flow.criteria.Criteria.VlanPcpCriterion; |
| 37 | import org.onosproject.net.flow.criteria.Criterion; |
alshabib | eec3a06 | 2014-09-17 18:01:26 -0700 | [diff] [blame] | 38 | import org.projectfloodlight.openflow.protocol.OFFactory; |
alshabib | 193525b | 2014-10-08 18:58:03 -0700 | [diff] [blame] | 39 | import org.projectfloodlight.openflow.protocol.OFFlowAdd; |
| 40 | import org.projectfloodlight.openflow.protocol.OFFlowDelete; |
alshabib | eec3a06 | 2014-09-17 18:01:26 -0700 | [diff] [blame] | 41 | import org.projectfloodlight.openflow.protocol.OFFlowMod; |
alshabib | eec3a06 | 2014-09-17 18:01:26 -0700 | [diff] [blame] | 42 | import org.projectfloodlight.openflow.protocol.match.Match; |
| 43 | import org.projectfloodlight.openflow.protocol.match.MatchField; |
Marc De Leenheer | 4908775 | 2014-10-23 13:54:09 -0700 | [diff] [blame] | 44 | import org.projectfloodlight.openflow.types.CircuitSignalID; |
alshabib | eec3a06 | 2014-09-17 18:01:26 -0700 | [diff] [blame] | 45 | import org.projectfloodlight.openflow.types.EthType; |
| 46 | import org.projectfloodlight.openflow.types.IPv4Address; |
Charles M.C. Chan | 52fae7d | 2015-01-17 00:35:53 +0800 | [diff] [blame] | 47 | import org.projectfloodlight.openflow.types.IPv6Address; |
alshabib | eec3a06 | 2014-09-17 18:01:26 -0700 | [diff] [blame] | 48 | import org.projectfloodlight.openflow.types.IpProtocol; |
| 49 | import org.projectfloodlight.openflow.types.MacAddress; |
| 50 | import org.projectfloodlight.openflow.types.Masked; |
alshabib | eec3a06 | 2014-09-17 18:01:26 -0700 | [diff] [blame] | 51 | import org.projectfloodlight.openflow.types.OFPort; |
| 52 | import org.projectfloodlight.openflow.types.OFVlanVidMatch; |
Jonathan Hart | 34bc614 | 2014-10-17 11:00:43 -0700 | [diff] [blame] | 53 | import org.projectfloodlight.openflow.types.TransportPort; |
Praseed Balakrishnan | 8c67d17 | 2014-11-10 10:15:41 -0800 | [diff] [blame] | 54 | import org.projectfloodlight.openflow.types.U32; |
Praseed Balakrishnan | 2dd5abd | 2014-11-03 14:56:28 -0800 | [diff] [blame] | 55 | import org.projectfloodlight.openflow.types.U8; |
alshabib | eec3a06 | 2014-09-17 18:01:26 -0700 | [diff] [blame] | 56 | import org.projectfloodlight.openflow.types.VlanPcp; |
| 57 | import org.projectfloodlight.openflow.types.VlanVid; |
| 58 | import org.slf4j.Logger; |
| 59 | |
Brian O'Connor | 427a176 | 2014-11-19 18:40:32 -0800 | [diff] [blame] | 60 | import java.util.Optional; |
| 61 | |
Jonathan Hart | 6cd2f35 | 2015-01-13 17:44:45 -0800 | [diff] [blame^] | 62 | import static org.slf4j.LoggerFactory.getLogger; |
| 63 | |
Jonathan Hart | 86e5935 | 2014-10-22 10:42:16 -0700 | [diff] [blame] | 64 | /** |
| 65 | * Builder for OpenFlow flow mods based on FlowRules. |
| 66 | */ |
| 67 | public abstract class FlowModBuilder { |
alshabib | eec3a06 | 2014-09-17 18:01:26 -0700 | [diff] [blame] | 68 | |
| 69 | private final Logger log = getLogger(getClass()); |
| 70 | |
| 71 | private final OFFactory factory; |
Jonathan Hart | 86e5935 | 2014-10-22 10:42:16 -0700 | [diff] [blame] | 72 | private final FlowRule flowRule; |
alshabib | eec3a06 | 2014-09-17 18:01:26 -0700 | [diff] [blame] | 73 | private final TrafficSelector selector; |
Brian O'Connor | 427a176 | 2014-11-19 18:40:32 -0800 | [diff] [blame] | 74 | protected final Long xid; |
alshabib | eec3a06 | 2014-09-17 18:01:26 -0700 | [diff] [blame] | 75 | |
Jonathan Hart | 86e5935 | 2014-10-22 10:42:16 -0700 | [diff] [blame] | 76 | /** |
| 77 | * Creates a new flow mod builder. |
| 78 | * |
| 79 | * @param flowRule the flow rule to transform into a flow mod |
| 80 | * @param factory the OpenFlow factory to use to build the flow mod |
Pavlin Radoslavov | 119fd5c | 2014-11-25 19:08:19 -0800 | [diff] [blame] | 81 | * @param xid the transaction ID |
Jonathan Hart | 86e5935 | 2014-10-22 10:42:16 -0700 | [diff] [blame] | 82 | * @return the new flow mod builder |
| 83 | */ |
Brian O'Connor | 427a176 | 2014-11-19 18:40:32 -0800 | [diff] [blame] | 84 | public static FlowModBuilder builder(FlowRule flowRule, |
| 85 | OFFactory factory, Optional<Long> xid) { |
Jonathan Hart | 86e5935 | 2014-10-22 10:42:16 -0700 | [diff] [blame] | 86 | switch (factory.getVersion()) { |
| 87 | case OF_10: |
Brian O'Connor | 427a176 | 2014-11-19 18:40:32 -0800 | [diff] [blame] | 88 | return new FlowModBuilderVer10(flowRule, factory, xid); |
Jonathan Hart | 86e5935 | 2014-10-22 10:42:16 -0700 | [diff] [blame] | 89 | case OF_13: |
Brian O'Connor | 427a176 | 2014-11-19 18:40:32 -0800 | [diff] [blame] | 90 | return new FlowModBuilderVer13(flowRule, factory, xid); |
Jonathan Hart | 86e5935 | 2014-10-22 10:42:16 -0700 | [diff] [blame] | 91 | default: |
| 92 | throw new UnsupportedOperationException( |
| 93 | "No flow mod builder for protocol version " + factory.getVersion()); |
| 94 | } |
| 95 | } |
alshabib | eec3a06 | 2014-09-17 18:01:26 -0700 | [diff] [blame] | 96 | |
Jonathan Hart | 86e5935 | 2014-10-22 10:42:16 -0700 | [diff] [blame] | 97 | /** |
| 98 | * Constructs a flow mod builder. |
| 99 | * |
| 100 | * @param flowRule the flow rule to transform into a flow mod |
| 101 | * @param factory the OpenFlow factory to use to build the flow mod |
Pavlin Radoslavov | 119fd5c | 2014-11-25 19:08:19 -0800 | [diff] [blame] | 102 | * @param xid the transaction ID |
Jonathan Hart | 86e5935 | 2014-10-22 10:42:16 -0700 | [diff] [blame] | 103 | */ |
Brian O'Connor | 427a176 | 2014-11-19 18:40:32 -0800 | [diff] [blame] | 104 | protected FlowModBuilder(FlowRule flowRule, OFFactory factory, Optional<Long> xid) { |
alshabib | eec3a06 | 2014-09-17 18:01:26 -0700 | [diff] [blame] | 105 | this.factory = factory; |
Jonathan Hart | 86e5935 | 2014-10-22 10:42:16 -0700 | [diff] [blame] | 106 | this.flowRule = flowRule; |
alshabib | eec3a06 | 2014-09-17 18:01:26 -0700 | [diff] [blame] | 107 | this.selector = flowRule.selector(); |
Brian O'Connor | 427a176 | 2014-11-19 18:40:32 -0800 | [diff] [blame] | 108 | this.xid = xid.orElse((long) 0); |
| 109 | |
alshabib | eec3a06 | 2014-09-17 18:01:26 -0700 | [diff] [blame] | 110 | } |
| 111 | |
Jonathan Hart | 86e5935 | 2014-10-22 10:42:16 -0700 | [diff] [blame] | 112 | /** |
| 113 | * Builds an ADD flow mod. |
| 114 | * |
| 115 | * @return the flow mod |
| 116 | */ |
| 117 | public abstract OFFlowAdd buildFlowAdd(); |
alshabib | eec3a06 | 2014-09-17 18:01:26 -0700 | [diff] [blame] | 118 | |
Jonathan Hart | 86e5935 | 2014-10-22 10:42:16 -0700 | [diff] [blame] | 119 | /** |
| 120 | * Builds a MODIFY flow mod. |
| 121 | * |
| 122 | * @return the flow mod |
| 123 | */ |
| 124 | public abstract OFFlowMod buildFlowMod(); |
alshabib | eec3a06 | 2014-09-17 18:01:26 -0700 | [diff] [blame] | 125 | |
Jonathan Hart | 86e5935 | 2014-10-22 10:42:16 -0700 | [diff] [blame] | 126 | /** |
| 127 | * Builds a DELETE flow mod. |
| 128 | * |
| 129 | * @return the flow mod |
| 130 | */ |
| 131 | public abstract OFFlowDelete buildFlowDel(); |
alshabib | eec3a06 | 2014-09-17 18:01:26 -0700 | [diff] [blame] | 132 | |
Jonathan Hart | 86e5935 | 2014-10-22 10:42:16 -0700 | [diff] [blame] | 133 | /** |
| 134 | * Builds the match for the flow mod. |
| 135 | * |
| 136 | * @return the match |
| 137 | */ |
| 138 | protected Match buildMatch() { |
alshabib | eec3a06 | 2014-09-17 18:01:26 -0700 | [diff] [blame] | 139 | Match.Builder mBuilder = factory.buildMatch(); |
| 140 | EthCriterion eth; |
| 141 | IPCriterion ip; |
Pavlin Radoslavov | 23e398d | 2014-11-05 15:17:57 -0800 | [diff] [blame] | 142 | Ip4Prefix ip4Prefix; |
Charles M.C. Chan | 52fae7d | 2015-01-17 00:35:53 +0800 | [diff] [blame] | 143 | Ip6Prefix ip6Prefix; |
Jonathan Hart | 34bc614 | 2014-10-17 11:00:43 -0700 | [diff] [blame] | 144 | TcpPortCriterion tp; |
alshabib | eec3a06 | 2014-09-17 18:01:26 -0700 | [diff] [blame] | 145 | for (Criterion c : selector.criteria()) { |
| 146 | switch (c.type()) { |
| 147 | case IN_PORT: |
| 148 | PortCriterion inport = (PortCriterion) c; |
| 149 | mBuilder.setExact(MatchField.IN_PORT, OFPort.of((int) inport.port().toLong())); |
| 150 | break; |
| 151 | case ETH_SRC: |
| 152 | eth = (EthCriterion) c; |
| 153 | mBuilder.setExact(MatchField.ETH_SRC, MacAddress.of(eth.mac().toLong())); |
| 154 | break; |
| 155 | case ETH_DST: |
| 156 | eth = (EthCriterion) c; |
| 157 | mBuilder.setExact(MatchField.ETH_DST, MacAddress.of(eth.mac().toLong())); |
| 158 | break; |
| 159 | case ETH_TYPE: |
| 160 | EthTypeCriterion ethType = (EthTypeCriterion) c; |
| 161 | mBuilder.setExact(MatchField.ETH_TYPE, EthType.of(ethType.ethType())); |
| 162 | break; |
| 163 | case IPV4_DST: |
| 164 | ip = (IPCriterion) c; |
Pavlin Radoslavov | 23e398d | 2014-11-05 15:17:57 -0800 | [diff] [blame] | 165 | ip4Prefix = ip.ip().getIp4Prefix(); |
| 166 | if (ip4Prefix.prefixLength() != Ip4Prefix.MAX_MASK_LENGTH) { |
| 167 | Ip4Address maskAddr = |
| 168 | Ip4Address.makeMaskPrefix(ip4Prefix.prefixLength()); |
Pavlin Radoslavov | 855ea2d | 2014-10-30 15:32:39 -0700 | [diff] [blame] | 169 | Masked<IPv4Address> maskedIp = |
Pavlin Radoslavov | 23e398d | 2014-11-05 15:17:57 -0800 | [diff] [blame] | 170 | Masked.of(IPv4Address.of(ip4Prefix.address().toInt()), |
Pavlin Radoslavov | 855ea2d | 2014-10-30 15:32:39 -0700 | [diff] [blame] | 171 | IPv4Address.of(maskAddr.toInt())); |
alshabib | eec3a06 | 2014-09-17 18:01:26 -0700 | [diff] [blame] | 172 | mBuilder.setMasked(MatchField.IPV4_DST, maskedIp); |
| 173 | } else { |
Pavlin Radoslavov | 855ea2d | 2014-10-30 15:32:39 -0700 | [diff] [blame] | 174 | mBuilder.setExact(MatchField.IPV4_DST, |
Pavlin Radoslavov | 23e398d | 2014-11-05 15:17:57 -0800 | [diff] [blame] | 175 | IPv4Address.of(ip4Prefix.address().toInt())); |
alshabib | eec3a06 | 2014-09-17 18:01:26 -0700 | [diff] [blame] | 176 | } |
| 177 | break; |
| 178 | case IPV4_SRC: |
| 179 | ip = (IPCriterion) c; |
Pavlin Radoslavov | 23e398d | 2014-11-05 15:17:57 -0800 | [diff] [blame] | 180 | ip4Prefix = ip.ip().getIp4Prefix(); |
| 181 | if (ip4Prefix.prefixLength() != Ip4Prefix.MAX_MASK_LENGTH) { |
| 182 | Ip4Address maskAddr = |
| 183 | Ip4Address.makeMaskPrefix(ip4Prefix.prefixLength()); |
Pavlin Radoslavov | 855ea2d | 2014-10-30 15:32:39 -0700 | [diff] [blame] | 184 | Masked<IPv4Address> maskedIp = |
Pavlin Radoslavov | 23e398d | 2014-11-05 15:17:57 -0800 | [diff] [blame] | 185 | Masked.of(IPv4Address.of(ip4Prefix.address().toInt()), |
Pavlin Radoslavov | 855ea2d | 2014-10-30 15:32:39 -0700 | [diff] [blame] | 186 | IPv4Address.of(maskAddr.toInt())); |
alshabib | eec3a06 | 2014-09-17 18:01:26 -0700 | [diff] [blame] | 187 | mBuilder.setMasked(MatchField.IPV4_SRC, maskedIp); |
| 188 | } else { |
Pavlin Radoslavov | 855ea2d | 2014-10-30 15:32:39 -0700 | [diff] [blame] | 189 | mBuilder.setExact(MatchField.IPV4_SRC, |
Pavlin Radoslavov | 23e398d | 2014-11-05 15:17:57 -0800 | [diff] [blame] | 190 | IPv4Address.of(ip4Prefix.address().toInt())); |
alshabib | eec3a06 | 2014-09-17 18:01:26 -0700 | [diff] [blame] | 191 | } |
| 192 | break; |
| 193 | case IP_PROTO: |
| 194 | IPProtocolCriterion p = (IPProtocolCriterion) c; |
| 195 | mBuilder.setExact(MatchField.IP_PROTO, IpProtocol.of(p.protocol())); |
| 196 | break; |
| 197 | case VLAN_PCP: |
| 198 | VlanPcpCriterion vpcp = (VlanPcpCriterion) c; |
| 199 | mBuilder.setExact(MatchField.VLAN_PCP, VlanPcp.of(vpcp.priority())); |
| 200 | break; |
| 201 | case VLAN_VID: |
| 202 | VlanIdCriterion vid = (VlanIdCriterion) c; |
Jonathan Hart | 6cd2f35 | 2015-01-13 17:44:45 -0800 | [diff] [blame^] | 203 | |
| 204 | if (vid.vlanId().equals(VlanId.ANY)) { |
| 205 | mBuilder.setMasked(MatchField.VLAN_VID, OFVlanVidMatch.PRESENT, |
| 206 | OFVlanVidMatch.PRESENT); |
| 207 | } else { |
| 208 | mBuilder.setExact(MatchField.VLAN_VID, |
| 209 | OFVlanVidMatch.ofVlanVid(VlanVid.ofVlan(vid.vlanId().toShort()))); |
| 210 | } |
alshabib | eec3a06 | 2014-09-17 18:01:26 -0700 | [diff] [blame] | 211 | break; |
Jonathan Hart | 34bc614 | 2014-10-17 11:00:43 -0700 | [diff] [blame] | 212 | case TCP_DST: |
| 213 | tp = (TcpPortCriterion) c; |
| 214 | mBuilder.setExact(MatchField.TCP_DST, TransportPort.of(tp.tcpPort())); |
| 215 | break; |
| 216 | case TCP_SRC: |
| 217 | tp = (TcpPortCriterion) c; |
| 218 | mBuilder.setExact(MatchField.TCP_SRC, TransportPort.of(tp.tcpPort())); |
| 219 | break; |
Praseed Balakrishnan | 8c67d17 | 2014-11-10 10:15:41 -0800 | [diff] [blame] | 220 | case MPLS_LABEL: |
| 221 | Criteria.MplsCriterion mp = (Criteria.MplsCriterion) c; |
| 222 | mBuilder.setExact(MatchField.MPLS_LABEL, |
| 223 | U32.of(mp.label().intValue())); |
| 224 | break; |
Marc De Leenheer | 4908775 | 2014-10-23 13:54:09 -0700 | [diff] [blame] | 225 | case OCH_SIGID: |
| 226 | LambdaCriterion lc = (LambdaCriterion) c; |
| 227 | mBuilder.setExact(MatchField.OCH_SIGID, |
| 228 | new CircuitSignalID((byte) 1, (byte) 2, lc.lambda(), (short) 1)); |
| 229 | break; |
Praseed Balakrishnan | 2dd5abd | 2014-11-03 14:56:28 -0800 | [diff] [blame] | 230 | case OCH_SIGTYPE: |
| 231 | Criteria.OpticalSignalTypeCriterion sc = |
| 232 | (Criteria.OpticalSignalTypeCriterion) c; |
| 233 | mBuilder.setExact(MatchField.OCH_SIGTYPE, |
| 234 | U8.of(sc.signalType())); |
| 235 | break; |
Charles M.C. Chan | 52fae7d | 2015-01-17 00:35:53 +0800 | [diff] [blame] | 236 | case IPV6_DST: |
| 237 | ip = (IPCriterion) c; |
| 238 | ip6Prefix = ip.ip().getIp6Prefix(); |
| 239 | if (ip6Prefix.prefixLength() != Ip6Prefix.MAX_MASK_LENGTH) { |
| 240 | Ip6Address maskAddr = |
| 241 | Ip6Address.makeMaskPrefix(ip6Prefix.prefixLength()); |
| 242 | Masked<IPv6Address> maskedIp = |
| 243 | Masked.of(IPv6Address.of(ip6Prefix.address().toString()), |
| 244 | IPv6Address.of(maskAddr.toString())); |
| 245 | mBuilder.setMasked(MatchField.IPV6_DST, maskedIp); |
| 246 | } else { |
| 247 | mBuilder.setExact(MatchField.IPV6_DST, |
| 248 | IPv6Address.of(ip6Prefix.address().toString())); |
| 249 | } |
| 250 | break; |
| 251 | case IPV6_SRC: |
| 252 | ip = (IPCriterion) c; |
| 253 | ip6Prefix = ip.ip().getIp6Prefix(); |
| 254 | if (ip6Prefix.prefixLength() != Ip6Prefix.MAX_MASK_LENGTH) { |
| 255 | Ip6Address maskAddr = |
| 256 | Ip6Address.makeMaskPrefix(ip6Prefix.prefixLength()); |
| 257 | Masked<IPv6Address> maskedIp = |
| 258 | Masked.of(IPv6Address.of(ip6Prefix.address().toString()), |
| 259 | IPv6Address.of(maskAddr.toString())); |
| 260 | mBuilder.setMasked(MatchField.IPV6_SRC, maskedIp); |
| 261 | } else { |
| 262 | mBuilder.setExact(MatchField.IPV6_SRC, |
| 263 | IPv6Address.of(ip6Prefix.address().toString())); |
| 264 | } |
| 265 | break; |
Kunihiro Ishiguro | 0f9aba8 | 2015-01-15 17:14:17 -0800 | [diff] [blame] | 266 | case ICMPV6_TYPE: |
| 267 | Icmpv6TypeCriterion icmpv6type = (Icmpv6TypeCriterion) c; |
| 268 | mBuilder.setExact(MatchField.ICMPV6_TYPE, |
| 269 | U8.of(icmpv6type.icmpv6Type().byteValue())); |
| 270 | break; |
| 271 | case ICMPV6_CODE: |
| 272 | Icmpv6CodeCriterion icmpv6code = (Icmpv6CodeCriterion) c; |
| 273 | mBuilder.setExact(MatchField.ICMPV6_CODE, |
| 274 | U8.of(icmpv6code.icmpv6Code().byteValue())); |
| 275 | break; |
alshabib | eec3a06 | 2014-09-17 18:01:26 -0700 | [diff] [blame] | 276 | case ARP_OP: |
| 277 | case ARP_SHA: |
| 278 | case ARP_SPA: |
| 279 | case ARP_THA: |
| 280 | case ARP_TPA: |
| 281 | case ICMPV4_CODE: |
| 282 | case ICMPV4_TYPE: |
alshabib | eec3a06 | 2014-09-17 18:01:26 -0700 | [diff] [blame] | 283 | case IN_PHY_PORT: |
alshabib | eec3a06 | 2014-09-17 18:01:26 -0700 | [diff] [blame] | 284 | case IPV6_EXTHDR: |
| 285 | case IPV6_FLABEL: |
| 286 | case IPV6_ND_SLL: |
| 287 | case IPV6_ND_TARGET: |
| 288 | case IPV6_ND_TLL: |
alshabib | eec3a06 | 2014-09-17 18:01:26 -0700 | [diff] [blame] | 289 | case IP_DSCP: |
| 290 | case IP_ECN: |
| 291 | case METADATA: |
| 292 | case MPLS_BOS: |
alshabib | eec3a06 | 2014-09-17 18:01:26 -0700 | [diff] [blame] | 293 | case MPLS_TC: |
| 294 | case PBB_ISID: |
| 295 | case SCTP_DST: |
| 296 | case SCTP_SRC: |
alshabib | eec3a06 | 2014-09-17 18:01:26 -0700 | [diff] [blame] | 297 | case TUNNEL_ID: |
| 298 | case UDP_DST: |
| 299 | case UDP_SRC: |
| 300 | default: |
| 301 | log.warn("Match type {} not yet implemented.", c.type()); |
| 302 | } |
| 303 | } |
| 304 | return mBuilder.build(); |
| 305 | } |
| 306 | |
Jonathan Hart | 86e5935 | 2014-10-22 10:42:16 -0700 | [diff] [blame] | 307 | /** |
| 308 | * Returns the flow rule for this builder. |
| 309 | * |
| 310 | * @return the flow rule |
| 311 | */ |
| 312 | protected FlowRule flowRule() { |
| 313 | return flowRule; |
| 314 | } |
alshabib | 219ebaa | 2014-09-22 15:41:24 -0700 | [diff] [blame] | 315 | |
Jonathan Hart | 86e5935 | 2014-10-22 10:42:16 -0700 | [diff] [blame] | 316 | /** |
| 317 | * Returns the factory used for building OpenFlow constructs. |
| 318 | * |
| 319 | * @return the factory |
| 320 | */ |
| 321 | protected OFFactory factory() { |
| 322 | return factory; |
| 323 | } |
alshabib | 219ebaa | 2014-09-22 15:41:24 -0700 | [diff] [blame] | 324 | |
alshabib | eec3a06 | 2014-09-17 18:01:26 -0700 | [diff] [blame] | 325 | } |