blob: 15aa511ef220232800919e9c55f021917884e8f7 [file] [log] [blame]
Thomas Vachuska781d18b2014-10-27 10:31:25 -07001/*
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07002 * Copyright 2014 Open Networking Laboratory
Thomas Vachuska781d18b2014-10-27 10:31:25 -07003 *
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07004 * 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 Vachuska781d18b2014-10-27 10:31:25 -07007 *
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07008 * 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 Vachuska781d18b2014-10-27 10:31:25 -070015 */
Brian O'Connorabafb502014-12-02 22:26:20 -080016package org.onosproject.provider.of.flow.impl;
alshabibeec3a062014-09-17 18:01:26 -070017
Jonathan Hart6cd2f352015-01-13 17:44:45 -080018import org.onlab.packet.Ip4Address;
19import org.onlab.packet.Ip4Prefix;
Charles M.C. Chan52fae7d2015-01-17 00:35:53 +080020import org.onlab.packet.Ip6Address;
21import org.onlab.packet.Ip6Prefix;
Jonathan Hart6cd2f352015-01-13 17:44:45 -080022import org.onlab.packet.VlanId;
Brian O'Connorabafb502014-12-02 22:26:20 -080023import org.onosproject.net.flow.FlowRule;
24import org.onosproject.net.flow.TrafficSelector;
25import org.onosproject.net.flow.criteria.Criteria;
26import org.onosproject.net.flow.criteria.Criteria.EthCriterion;
27import org.onosproject.net.flow.criteria.Criteria.EthTypeCriterion;
Pavlin Radoslavov320e6c92015-02-02 16:51:58 -080028import org.onosproject.net.flow.criteria.Criteria.IcmpCodeCriterion;
29import org.onosproject.net.flow.criteria.Criteria.IcmpTypeCriterion;
Jonathan Hart6cd2f352015-01-13 17:44:45 -080030import org.onosproject.net.flow.criteria.Criteria.Icmpv6CodeCriterion;
31import org.onosproject.net.flow.criteria.Criteria.Icmpv6TypeCriterion;
Pavlin Radoslavov320e6c92015-02-02 16:51:58 -080032import org.onosproject.net.flow.criteria.Criteria.IPCriterion;
Pavlin Radoslavovd0fd8412015-02-04 13:57:00 -080033import org.onosproject.net.flow.criteria.Criteria.IPDscpCriterion;
34import org.onosproject.net.flow.criteria.Criteria.IPEcnCriterion;
Pavlin Radoslavov320e6c92015-02-02 16:51:58 -080035import org.onosproject.net.flow.criteria.Criteria.IPProtocolCriterion;
36import org.onosproject.net.flow.criteria.Criteria.IPv6FlowLabelCriterion;
37import org.onosproject.net.flow.criteria.Criteria.IPv6NDLinkLayerAddressCriterion;
38import org.onosproject.net.flow.criteria.Criteria.IPv6NDTargetAddressCriterion;
Brian O'Connorabafb502014-12-02 22:26:20 -080039import org.onosproject.net.flow.criteria.Criteria.LambdaCriterion;
Pavlin Radoslavovd0fd8412015-02-04 13:57:00 -080040import org.onosproject.net.flow.criteria.Criteria.MetadataCriterion;
Brian O'Connorabafb502014-12-02 22:26:20 -080041import org.onosproject.net.flow.criteria.Criteria.PortCriterion;
Pavlin Radoslavov320e6c92015-02-02 16:51:58 -080042import org.onosproject.net.flow.criteria.Criteria.SctpPortCriterion;
Brian O'Connorabafb502014-12-02 22:26:20 -080043import org.onosproject.net.flow.criteria.Criteria.TcpPortCriterion;
Pavlin Radoslavov320e6c92015-02-02 16:51:58 -080044import org.onosproject.net.flow.criteria.Criteria.UdpPortCriterion;
Brian O'Connorabafb502014-12-02 22:26:20 -080045import org.onosproject.net.flow.criteria.Criteria.VlanIdCriterion;
46import org.onosproject.net.flow.criteria.Criteria.VlanPcpCriterion;
47import org.onosproject.net.flow.criteria.Criterion;
alshabibeec3a062014-09-17 18:01:26 -070048import org.projectfloodlight.openflow.protocol.OFFactory;
alshabib193525b2014-10-08 18:58:03 -070049import org.projectfloodlight.openflow.protocol.OFFlowAdd;
50import org.projectfloodlight.openflow.protocol.OFFlowDelete;
alshabibeec3a062014-09-17 18:01:26 -070051import org.projectfloodlight.openflow.protocol.OFFlowMod;
alshabibeec3a062014-09-17 18:01:26 -070052import org.projectfloodlight.openflow.protocol.match.Match;
53import org.projectfloodlight.openflow.protocol.match.MatchField;
Marc De Leenheer49087752014-10-23 13:54:09 -070054import org.projectfloodlight.openflow.types.CircuitSignalID;
alshabibeec3a062014-09-17 18:01:26 -070055import org.projectfloodlight.openflow.types.EthType;
Pavlin Radoslavov320e6c92015-02-02 16:51:58 -080056import org.projectfloodlight.openflow.types.ICMPv4Code;
57import org.projectfloodlight.openflow.types.ICMPv4Type;
alshabibeec3a062014-09-17 18:01:26 -070058import org.projectfloodlight.openflow.types.IPv4Address;
Charles M.C. Chan52fae7d2015-01-17 00:35:53 +080059import org.projectfloodlight.openflow.types.IPv6Address;
Pavlin Radoslavov320e6c92015-02-02 16:51:58 -080060import org.projectfloodlight.openflow.types.IPv6FlowLabel;
Pavlin Radoslavovd0fd8412015-02-04 13:57:00 -080061import org.projectfloodlight.openflow.types.IpDscp;
62import org.projectfloodlight.openflow.types.IpEcn;
alshabibeec3a062014-09-17 18:01:26 -070063import org.projectfloodlight.openflow.types.IpProtocol;
64import org.projectfloodlight.openflow.types.MacAddress;
65import org.projectfloodlight.openflow.types.Masked;
Pavlin Radoslavovd0fd8412015-02-04 13:57:00 -080066import org.projectfloodlight.openflow.types.OFMetadata;
alshabibeec3a062014-09-17 18:01:26 -070067import org.projectfloodlight.openflow.types.OFPort;
68import org.projectfloodlight.openflow.types.OFVlanVidMatch;
Jonathan Hart34bc6142014-10-17 11:00:43 -070069import org.projectfloodlight.openflow.types.TransportPort;
Praseed Balakrishnan8c67d172014-11-10 10:15:41 -080070import org.projectfloodlight.openflow.types.U32;
Praseed Balakrishnan2dd5abd2014-11-03 14:56:28 -080071import org.projectfloodlight.openflow.types.U8;
alshabibeec3a062014-09-17 18:01:26 -070072import org.projectfloodlight.openflow.types.VlanPcp;
73import org.projectfloodlight.openflow.types.VlanVid;
74import org.slf4j.Logger;
75
Brian O'Connor427a1762014-11-19 18:40:32 -080076import java.util.Optional;
77
Jonathan Hart6cd2f352015-01-13 17:44:45 -080078import static org.slf4j.LoggerFactory.getLogger;
79
Jonathan Hart86e59352014-10-22 10:42:16 -070080/**
81 * Builder for OpenFlow flow mods based on FlowRules.
82 */
83public abstract class FlowModBuilder {
alshabibeec3a062014-09-17 18:01:26 -070084
85 private final Logger log = getLogger(getClass());
86
87 private final OFFactory factory;
Jonathan Hart86e59352014-10-22 10:42:16 -070088 private final FlowRule flowRule;
alshabibeec3a062014-09-17 18:01:26 -070089 private final TrafficSelector selector;
Brian O'Connor427a1762014-11-19 18:40:32 -080090 protected final Long xid;
alshabibeec3a062014-09-17 18:01:26 -070091
Jonathan Hart86e59352014-10-22 10:42:16 -070092 /**
93 * Creates a new flow mod builder.
94 *
95 * @param flowRule the flow rule to transform into a flow mod
96 * @param factory the OpenFlow factory to use to build the flow mod
Pavlin Radoslavov119fd5c2014-11-25 19:08:19 -080097 * @param xid the transaction ID
Jonathan Hart86e59352014-10-22 10:42:16 -070098 * @return the new flow mod builder
99 */
Brian O'Connor427a1762014-11-19 18:40:32 -0800100 public static FlowModBuilder builder(FlowRule flowRule,
101 OFFactory factory, Optional<Long> xid) {
Jonathan Hart86e59352014-10-22 10:42:16 -0700102 switch (factory.getVersion()) {
103 case OF_10:
Brian O'Connor427a1762014-11-19 18:40:32 -0800104 return new FlowModBuilderVer10(flowRule, factory, xid);
Jonathan Hart86e59352014-10-22 10:42:16 -0700105 case OF_13:
Brian O'Connor427a1762014-11-19 18:40:32 -0800106 return new FlowModBuilderVer13(flowRule, factory, xid);
Jonathan Hart86e59352014-10-22 10:42:16 -0700107 default:
108 throw new UnsupportedOperationException(
109 "No flow mod builder for protocol version " + factory.getVersion());
110 }
111 }
alshabibeec3a062014-09-17 18:01:26 -0700112
Jonathan Hart86e59352014-10-22 10:42:16 -0700113 /**
114 * Constructs a flow mod builder.
115 *
116 * @param flowRule the flow rule to transform into a flow mod
117 * @param factory the OpenFlow factory to use to build the flow mod
Pavlin Radoslavov119fd5c2014-11-25 19:08:19 -0800118 * @param xid the transaction ID
Jonathan Hart86e59352014-10-22 10:42:16 -0700119 */
Brian O'Connor427a1762014-11-19 18:40:32 -0800120 protected FlowModBuilder(FlowRule flowRule, OFFactory factory, Optional<Long> xid) {
alshabibeec3a062014-09-17 18:01:26 -0700121 this.factory = factory;
Jonathan Hart86e59352014-10-22 10:42:16 -0700122 this.flowRule = flowRule;
alshabibeec3a062014-09-17 18:01:26 -0700123 this.selector = flowRule.selector();
Brian O'Connor427a1762014-11-19 18:40:32 -0800124 this.xid = xid.orElse((long) 0);
125
alshabibeec3a062014-09-17 18:01:26 -0700126 }
127
Jonathan Hart86e59352014-10-22 10:42:16 -0700128 /**
129 * Builds an ADD flow mod.
130 *
131 * @return the flow mod
132 */
133 public abstract OFFlowAdd buildFlowAdd();
alshabibeec3a062014-09-17 18:01:26 -0700134
Jonathan Hart86e59352014-10-22 10:42:16 -0700135 /**
136 * Builds a MODIFY flow mod.
137 *
138 * @return the flow mod
139 */
140 public abstract OFFlowMod buildFlowMod();
alshabibeec3a062014-09-17 18:01:26 -0700141
Jonathan Hart86e59352014-10-22 10:42:16 -0700142 /**
143 * Builds a DELETE flow mod.
144 *
145 * @return the flow mod
146 */
147 public abstract OFFlowDelete buildFlowDel();
alshabibeec3a062014-09-17 18:01:26 -0700148
Jonathan Hart86e59352014-10-22 10:42:16 -0700149 /**
150 * Builds the match for the flow mod.
151 *
152 * @return the match
153 */
Pavlin Radoslavov320e6c92015-02-02 16:51:58 -0800154 // CHECKSTYLE IGNORE MethodLength FOR NEXT 300 LINES
Jonathan Hart86e59352014-10-22 10:42:16 -0700155 protected Match buildMatch() {
alshabibeec3a062014-09-17 18:01:26 -0700156 Match.Builder mBuilder = factory.buildMatch();
Pavlin Radoslavov320e6c92015-02-02 16:51:58 -0800157 Ip6Address ip6Address;
Pavlin Radoslavov23e398d2014-11-05 15:17:57 -0800158 Ip4Prefix ip4Prefix;
Charles M.C. Chan52fae7d2015-01-17 00:35:53 +0800159 Ip6Prefix ip6Prefix;
Pavlin Radoslavov320e6c92015-02-02 16:51:58 -0800160 EthCriterion ethCriterion;
161 IPCriterion ipCriterion;
162 TcpPortCriterion tcpPortCriterion;
163 UdpPortCriterion udpPortCriterion;
164 SctpPortCriterion sctpPortCriterion;
165 IPv6NDLinkLayerAddressCriterion llAddressCriterion;
166
alshabibeec3a062014-09-17 18:01:26 -0700167 for (Criterion c : selector.criteria()) {
168 switch (c.type()) {
169 case IN_PORT:
Pavlin Radoslavovd0fd8412015-02-04 13:57:00 -0800170 PortCriterion inPort = (PortCriterion) c;
171 mBuilder.setExact(MatchField.IN_PORT,
172 OFPort.of((int) inPort.port().toLong()));
173 break;
174 case IN_PHY_PORT:
175 PortCriterion inPhyPort = (PortCriterion) c;
176 mBuilder.setExact(MatchField.IN_PORT,
177 OFPort.of((int) inPhyPort.port().toLong()));
178 break;
179 case METADATA:
180 MetadataCriterion metadata = (MetadataCriterion) c;
181 mBuilder.setExact(MatchField.METADATA,
182 OFMetadata.ofRaw(metadata.metadata()));
alshabibeec3a062014-09-17 18:01:26 -0700183 break;
alshabibeec3a062014-09-17 18:01:26 -0700184 case ETH_DST:
Pavlin Radoslavov320e6c92015-02-02 16:51:58 -0800185 ethCriterion = (EthCriterion) c;
186 mBuilder.setExact(MatchField.ETH_DST,
187 MacAddress.of(ethCriterion.mac().toLong()));
188 break;
189 case ETH_SRC:
190 ethCriterion = (EthCriterion) c;
191 mBuilder.setExact(MatchField.ETH_SRC,
192 MacAddress.of(ethCriterion.mac().toLong()));
alshabibeec3a062014-09-17 18:01:26 -0700193 break;
194 case ETH_TYPE:
195 EthTypeCriterion ethType = (EthTypeCriterion) c;
196 mBuilder.setExact(MatchField.ETH_TYPE, EthType.of(ethType.ethType()));
197 break;
alshabibeec3a062014-09-17 18:01:26 -0700198 case VLAN_VID:
199 VlanIdCriterion vid = (VlanIdCriterion) c;
Jonathan Hart6cd2f352015-01-13 17:44:45 -0800200
201 if (vid.vlanId().equals(VlanId.ANY)) {
202 mBuilder.setMasked(MatchField.VLAN_VID, OFVlanVidMatch.PRESENT,
203 OFVlanVidMatch.PRESENT);
204 } else {
205 mBuilder.setExact(MatchField.VLAN_VID,
206 OFVlanVidMatch.ofVlanVid(VlanVid.ofVlan(vid.vlanId().toShort())));
207 }
alshabibeec3a062014-09-17 18:01:26 -0700208 break;
Pavlin Radoslavov320e6c92015-02-02 16:51:58 -0800209 case VLAN_PCP:
210 VlanPcpCriterion vpcp = (VlanPcpCriterion) c;
211 mBuilder.setExact(MatchField.VLAN_PCP, VlanPcp.of(vpcp.priority()));
212 break;
Pavlin Radoslavovd0fd8412015-02-04 13:57:00 -0800213 case IP_DSCP:
214 IPDscpCriterion ipDscpCriterion = (IPDscpCriterion) c;
215 mBuilder.setExact(MatchField.IP_DSCP,
216 IpDscp.of(ipDscpCriterion.ipDscp()));
217 break;
218 case IP_ECN:
219 IPEcnCriterion ipEcnCriterion = (IPEcnCriterion) c;
220 mBuilder.setExact(MatchField.IP_ECN,
221 IpEcn.of(ipEcnCriterion.ipEcn()));
222 break;
Pavlin Radoslavov320e6c92015-02-02 16:51:58 -0800223 case IP_PROTO:
224 IPProtocolCriterion p = (IPProtocolCriterion) c;
225 mBuilder.setExact(MatchField.IP_PROTO, IpProtocol.of(p.protocol()));
226 break;
227 case IPV4_SRC:
228 ipCriterion = (IPCriterion) c;
229 ip4Prefix = ipCriterion.ip().getIp4Prefix();
230 if (ip4Prefix.prefixLength() != Ip4Prefix.MAX_MASK_LENGTH) {
231 Ip4Address maskAddr =
232 Ip4Address.makeMaskPrefix(ip4Prefix.prefixLength());
233 Masked<IPv4Address> maskedIp =
234 Masked.of(IPv4Address.of(ip4Prefix.address().toInt()),
235 IPv4Address.of(maskAddr.toInt()));
236 mBuilder.setMasked(MatchField.IPV4_SRC, maskedIp);
237 } else {
238 mBuilder.setExact(MatchField.IPV4_SRC,
239 IPv4Address.of(ip4Prefix.address().toInt()));
240 }
241 break;
242 case IPV4_DST:
243 ipCriterion = (IPCriterion) c;
244 ip4Prefix = ipCriterion.ip().getIp4Prefix();
245 if (ip4Prefix.prefixLength() != Ip4Prefix.MAX_MASK_LENGTH) {
246 Ip4Address maskAddr =
247 Ip4Address.makeMaskPrefix(ip4Prefix.prefixLength());
248 Masked<IPv4Address> maskedIp =
249 Masked.of(IPv4Address.of(ip4Prefix.address().toInt()),
250 IPv4Address.of(maskAddr.toInt()));
251 mBuilder.setMasked(MatchField.IPV4_DST, maskedIp);
252 } else {
253 mBuilder.setExact(MatchField.IPV4_DST,
254 IPv4Address.of(ip4Prefix.address().toInt()));
255 }
Jonathan Hart34bc6142014-10-17 11:00:43 -0700256 break;
257 case TCP_SRC:
Pavlin Radoslavov320e6c92015-02-02 16:51:58 -0800258 tcpPortCriterion = (TcpPortCriterion) c;
259 mBuilder.setExact(MatchField.TCP_SRC,
260 TransportPort.of(tcpPortCriterion.tcpPort()));
261 break;
262 case TCP_DST:
263 tcpPortCriterion = (TcpPortCriterion) c;
264 mBuilder.setExact(MatchField.TCP_DST,
265 TransportPort.of(tcpPortCriterion.tcpPort()));
266 break;
267 case UDP_SRC:
268 udpPortCriterion = (UdpPortCriterion) c;
269 mBuilder.setExact(MatchField.UDP_SRC,
270 TransportPort.of(udpPortCriterion.udpPort()));
271 break;
272 case UDP_DST:
273 udpPortCriterion = (UdpPortCriterion) c;
274 mBuilder.setExact(MatchField.UDP_DST,
275 TransportPort.of(udpPortCriterion.udpPort()));
276 break;
277 case SCTP_SRC:
278 sctpPortCriterion = (SctpPortCriterion) c;
279 mBuilder.setExact(MatchField.SCTP_SRC,
280 TransportPort.of(sctpPortCriterion.sctpPort()));
281 break;
282 case SCTP_DST:
283 sctpPortCriterion = (SctpPortCriterion) c;
284 mBuilder.setExact(MatchField.SCTP_DST,
285 TransportPort.of(sctpPortCriterion.sctpPort()));
286 break;
287 case ICMPV4_TYPE:
288 IcmpTypeCriterion icmpType = (IcmpTypeCriterion) c;
289 mBuilder.setExact(MatchField.ICMPV4_TYPE,
290 ICMPv4Type.of(icmpType.icmpType()));
291 break;
292 case ICMPV4_CODE:
293 IcmpCodeCriterion icmpCode = (IcmpCodeCriterion) c;
294 mBuilder.setExact(MatchField.ICMPV4_CODE,
295 ICMPv4Code.of(icmpCode.icmpCode()));
296 break;
297 case IPV6_SRC:
298 ipCriterion = (IPCriterion) c;
299 ip6Prefix = ipCriterion.ip().getIp6Prefix();
300 if (ip6Prefix.prefixLength() != Ip6Prefix.MAX_MASK_LENGTH) {
301 Ip6Address maskAddr =
302 Ip6Address.makeMaskPrefix(ip6Prefix.prefixLength());
303 Masked<IPv6Address> maskedIp =
304 Masked.of(IPv6Address.of(ip6Prefix.address().toString()),
305 IPv6Address.of(maskAddr.toString()));
306 mBuilder.setMasked(MatchField.IPV6_SRC, maskedIp);
307 } else {
308 mBuilder.setExact(MatchField.IPV6_SRC,
309 IPv6Address.of(ip6Prefix.address().toString()));
310 }
311 break;
312 case IPV6_DST:
313 ipCriterion = (IPCriterion) c;
314 ip6Prefix = ipCriterion.ip().getIp6Prefix();
315 if (ip6Prefix.prefixLength() != Ip6Prefix.MAX_MASK_LENGTH) {
316 Ip6Address maskAddr =
317 Ip6Address.makeMaskPrefix(ip6Prefix.prefixLength());
318 Masked<IPv6Address> maskedIp =
319 Masked.of(IPv6Address.of(ip6Prefix.address().toString()),
320 IPv6Address.of(maskAddr.toString()));
321 mBuilder.setMasked(MatchField.IPV6_DST, maskedIp);
322 } else {
323 mBuilder.setExact(MatchField.IPV6_DST,
324 IPv6Address.of(ip6Prefix.address().toString()));
325 }
326 break;
327 case IPV6_FLABEL:
328 IPv6FlowLabelCriterion flowLabelCriterion =
329 (IPv6FlowLabelCriterion) c;
330 mBuilder.setExact(MatchField.IPV6_FLABEL,
331 IPv6FlowLabel.of(flowLabelCriterion.flowLabel()));
332 break;
333 case ICMPV6_TYPE:
334 Icmpv6TypeCriterion icmpv6Type = (Icmpv6TypeCriterion) c;
335 mBuilder.setExact(MatchField.ICMPV6_TYPE,
Pavlin Radoslavovf3b69332015-02-06 15:47:05 -0800336 U8.of(icmpv6Type.icmpv6Type()));
Pavlin Radoslavov320e6c92015-02-02 16:51:58 -0800337 break;
338 case ICMPV6_CODE:
339 Icmpv6CodeCriterion icmpv6Code = (Icmpv6CodeCriterion) c;
340 mBuilder.setExact(MatchField.ICMPV6_CODE,
Pavlin Radoslavovf3b69332015-02-06 15:47:05 -0800341 U8.of(icmpv6Code.icmpv6Code()));
Pavlin Radoslavov320e6c92015-02-02 16:51:58 -0800342 break;
343 case IPV6_ND_TARGET:
344 IPv6NDTargetAddressCriterion targetAddressCriterion =
345 (IPv6NDTargetAddressCriterion) c;
346 ip6Address = targetAddressCriterion.targetAddress();
347 mBuilder.setExact(MatchField.IPV6_ND_TARGET,
348 IPv6Address.of(ip6Address.toOctets()));
349 break;
350 case IPV6_ND_SLL:
351 llAddressCriterion =
352 (IPv6NDLinkLayerAddressCriterion) c;
353 mBuilder.setExact(MatchField.IPV6_ND_SLL,
354 MacAddress.of(llAddressCriterion.mac().toLong()));
355 break;
356 case IPV6_ND_TLL:
357 llAddressCriterion =
358 (IPv6NDLinkLayerAddressCriterion) c;
359 mBuilder.setExact(MatchField.IPV6_ND_TLL,
360 MacAddress.of(llAddressCriterion.mac().toLong()));
Jonathan Hart34bc6142014-10-17 11:00:43 -0700361 break;
Praseed Balakrishnan8c67d172014-11-10 10:15:41 -0800362 case MPLS_LABEL:
363 Criteria.MplsCriterion mp = (Criteria.MplsCriterion) c;
Pavlin Radoslavovf3b69332015-02-06 15:47:05 -0800364 mBuilder.setExact(MatchField.MPLS_LABEL, U32.of(mp.label()));
Praseed Balakrishnan8c67d172014-11-10 10:15:41 -0800365 break;
Marc De Leenheer49087752014-10-23 13:54:09 -0700366 case OCH_SIGID:
367 LambdaCriterion lc = (LambdaCriterion) c;
368 mBuilder.setExact(MatchField.OCH_SIGID,
Pavlin Radoslavovf3b69332015-02-06 15:47:05 -0800369 new CircuitSignalID((byte) 1, (byte) 2,
370 (short) lc.lambda(), (short) 1));
Marc De Leenheer49087752014-10-23 13:54:09 -0700371 break;
Praseed Balakrishnan2dd5abd2014-11-03 14:56:28 -0800372 case OCH_SIGTYPE:
373 Criteria.OpticalSignalTypeCriterion sc =
374 (Criteria.OpticalSignalTypeCriterion) c;
375 mBuilder.setExact(MatchField.OCH_SIGTYPE,
Pavlin Radoslavovf3b69332015-02-06 15:47:05 -0800376 U8.of((short) sc.signalType()));
Praseed Balakrishnan2dd5abd2014-11-03 14:56:28 -0800377 break;
alshabibeec3a062014-09-17 18:01:26 -0700378 case ARP_OP:
379 case ARP_SHA:
380 case ARP_SPA:
381 case ARP_THA:
382 case ARP_TPA:
alshabibeec3a062014-09-17 18:01:26 -0700383 case IPV6_EXTHDR:
alshabibeec3a062014-09-17 18:01:26 -0700384 case MPLS_BOS:
alshabibeec3a062014-09-17 18:01:26 -0700385 case MPLS_TC:
386 case PBB_ISID:
alshabibeec3a062014-09-17 18:01:26 -0700387 case TUNNEL_ID:
alshabibeec3a062014-09-17 18:01:26 -0700388 default:
389 log.warn("Match type {} not yet implemented.", c.type());
390 }
391 }
392 return mBuilder.build();
393 }
394
Jonathan Hart86e59352014-10-22 10:42:16 -0700395 /**
396 * Returns the flow rule for this builder.
397 *
398 * @return the flow rule
399 */
400 protected FlowRule flowRule() {
401 return flowRule;
402 }
alshabib219ebaa2014-09-22 15:41:24 -0700403
Jonathan Hart86e59352014-10-22 10:42:16 -0700404 /**
405 * Returns the factory used for building OpenFlow constructs.
406 *
407 * @return the factory
408 */
409 protected OFFactory factory() {
410 return factory;
411 }
alshabib219ebaa2014-09-22 15:41:24 -0700412
alshabibeec3a062014-09-17 18:01:26 -0700413}