/
ofctrl_builder.go
599 lines (541 loc) · 17.7 KB
/
ofctrl_builder.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
// Copyright 2020 Antrea Authors
//
// 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 openflow
import (
"fmt"
"net"
"strings"
"github.com/contiv/libOpenflow/openflow13"
"github.com/contiv/ofnet/ofctrl"
)
type ofFlowBuilder struct {
ofFlow
}
func (b *ofFlowBuilder) MatchTunMetadata(index int, data uint32) FlowBuilder {
rng := openflow13.NewNXRange(0, 31)
tm := &ofctrl.NXTunMetadata{
ID: index,
Data: data,
Range: rng,
}
b.ofFlow.Match.TunMetadatas = append(b.ofFlow.Match.TunMetadatas, tm)
return b
}
func (b *ofFlowBuilder) SetHardTimeout(timout uint16) FlowBuilder {
b.ofFlow.HardTimeout = timout
return b
}
func (b *ofFlowBuilder) SetIdleTimeout(timeout uint16) FlowBuilder {
b.ofFlow.IdleTimeout = timeout
return b
}
func (b *ofFlowBuilder) Done() Flow {
if b.ctStates != nil {
b.Flow.Match.CtStates = b.ctStates
b.ctStates = nil
}
if b.ctStateString != "" {
b.matchers = append(b.matchers, b.ctStateString)
b.ctStateString = ""
}
return &b.ofFlow
}
// MatchReg adds match condition for matching data in the target register.
func (b *ofFlowBuilder) MatchReg(regID int, data uint32) FlowBuilder {
b.matchers = append(b.matchers, fmt.Sprintf("reg%d=0x%x", regID, data))
reg := &ofctrl.NXRegister{
ID: regID,
Data: data,
}
b.Match.NxRegs = append(b.Match.NxRegs, reg)
return b
}
// MatchXXReg adds match condition for matching data in the target xx-register.
func (b *ofFlowBuilder) MatchXXReg(regID int, data []byte) FlowBuilder {
s := fmt.Sprintf("xxreg%d=0x%x", regID, data)
b.matchers = append(b.matchers, s)
reg := &ofctrl.XXRegister{
ID: regID,
Data: data,
}
b.Match.XxRegs = append(b.Match.XxRegs, reg)
return b
}
// MatchRegRange adds match condition for matching data in the target register at specified range.
func (b *ofFlowBuilder) MatchRegRange(regID int, data uint32, rng Range) FlowBuilder {
s := fmt.Sprintf("reg%d[%d..%d]=0x%x", regID, rng[0], rng[1], data)
b.matchers = append(b.matchers, s)
if rng[0] > 0 {
data <<= rng[0]
}
reg := &ofctrl.NXRegister{
ID: regID,
Data: data,
Range: rng.ToNXRange(),
}
b.Match.NxRegs = append(b.Match.NxRegs, reg)
return b
}
func (b *ofFlowBuilder) addCTStateString(value string) {
if b.ctStateString == "" {
b.ctStateString = fmt.Sprintf("ct_state=%s", value)
} else {
b.ctStateString += value
}
}
func (b *ofFlowBuilder) MatchCTStateNew(set bool) FlowBuilder {
if b.ctStates == nil {
b.ctStates = openflow13.NewCTStates()
}
if set {
b.ctStates.SetNew()
b.addCTStateString("+new")
} else {
b.ctStates.UnsetNew()
b.addCTStateString("-trk")
}
return b
}
func (b *ofFlowBuilder) MatchCTStateRel(set bool) FlowBuilder {
if b.ctStates == nil {
b.ctStates = openflow13.NewCTStates()
}
if set {
b.ctStates.SetRel()
b.addCTStateString("+rel")
} else {
b.ctStates.UnsetRel()
b.addCTStateString("-rel")
}
return b
}
func (b *ofFlowBuilder) MatchCTStateRpl(set bool) FlowBuilder {
if b.ctStates == nil {
b.ctStates = openflow13.NewCTStates()
}
if set {
b.ctStates.SetRpl()
b.addCTStateString("+rpl")
} else {
b.ctStates.UnsetRpl()
b.addCTStateString("-rpl")
}
return b
}
func (b *ofFlowBuilder) MatchCTStateEst(set bool) FlowBuilder {
if b.ctStates == nil {
b.ctStates = openflow13.NewCTStates()
}
if set {
b.ctStates.SetEst()
b.addCTStateString("+est")
} else {
b.ctStates.UnsetEst()
b.addCTStateString("-est")
}
return b
}
func (b *ofFlowBuilder) MatchCTStateTrk(set bool) FlowBuilder {
if b.ctStates == nil {
b.ctStates = openflow13.NewCTStates()
}
if set {
b.ctStates.SetTrk()
b.addCTStateString("+trk")
} else {
b.ctStates.UnsetTrk()
b.addCTStateString("-trk")
}
return b
}
func (b *ofFlowBuilder) MatchCTStateInv(set bool) FlowBuilder {
if b.ctStates == nil {
b.ctStates = openflow13.NewCTStates()
}
if set {
b.ctStates.SetInv()
b.addCTStateString("+inv")
} else {
b.ctStates.UnsetInv()
b.addCTStateString("-inv")
}
return b
}
func (b *ofFlowBuilder) MatchCTStateDNAT(set bool) FlowBuilder {
if b.ctStates == nil {
b.ctStates = openflow13.NewCTStates()
}
if set {
b.ctStates.SetDNAT()
b.addCTStateString("+dnat")
} else {
b.ctStates.UnsetDNAT()
b.addCTStateString("-dnat")
}
return b
}
func (b *ofFlowBuilder) MatchCTStateSNAT(set bool) FlowBuilder {
if b.ctStates == nil {
b.ctStates = openflow13.NewCTStates()
}
if set {
b.ctStates.SetSNAT()
b.addCTStateString("+snat")
} else {
b.ctStates.UnsetSNAT()
b.addCTStateString("-snat")
}
return b
}
// MatchCTMark adds match condition for matching ct_mark. If mask is nil, the mask should be not set in the OpenFlow
// message which is sent to OVS, and OVS should match the value exactly.
func (b *ofFlowBuilder) MatchCTMark(value uint32, mask *uint32) FlowBuilder {
b.matchers = append(b.matchers, fmt.Sprintf("ct_mark=%d", value))
b.ofFlow.Match.CtMark = value
b.ofFlow.Match.CtMarkMask = mask
return b
}
// MatchCTMarkMask sets the mask of ct_mark. The mask is used only if ct_mark is set.
func (b *ofFlowBuilder) MatchCTMarkMask(mask uint32) FlowBuilder {
if b.Flow.Match.CtMark > 0 {
b.ofFlow.Match.CtMarkMask = &mask
for i, data := range b.matchers {
if strings.HasPrefix(data, "ct_mark=") {
b.matchers[i] = fmt.Sprintf("%s/0x%x", data, mask)
break
}
}
}
return b
}
// MatchPktMark adds match condition for matching pkt_mark. If mask is nil, the mask should be not set in the OpenFlow
// message which is sent to OVS, and OVS should match the value exactly.
func (b *ofFlowBuilder) MatchPktMark(value uint32, mask *uint32) FlowBuilder {
b.matchers = append(b.matchers, fmt.Sprintf("pkt_mark=%d", value))
b.ofFlow.Match.PktMark = value
b.ofFlow.Match.PktMarkMask = mask
return b
}
// MatchTunnelDst adds match condition for matching tun_dst or tun_ipv6_dst.
func (b *ofFlowBuilder) MatchTunnelDst(dstIP net.IP) FlowBuilder {
if dstIP.To4() != nil {
b.matchers = append(b.matchers, fmt.Sprintf("tun_dst=%s", dstIP.String()))
} else {
b.matchers = append(b.matchers, fmt.Sprintf("tun_ipv6_dst=%s", dstIP.String()))
}
b.ofFlow.Match.TunnelDst = &dstIP
return b
}
func ctLabelRange(high, low uint64, rng Range, match *ofctrl.FlowMatch) {
// [127..64] [63..0]
// high low
match.CtLabelHi = high
match.CtLabelLo = low
match.CtLabelHiMask = 0xffff_ffff_ffff_ffff
match.CtLabelLoMask = 0xffff_ffff_ffff_ffff
if rng[0] == rng[1] {
if rng[0] < 64 {
match.CtLabelLoMask = 1 << rng[0]
match.CtLabelHiMask = 0
} else {
match.CtLabelHiMask = 1 << (rng[0] - 64)
match.CtLabelLoMask = 0
}
} else if rng[0] < 64 && rng[1] >= 64 {
match.CtLabelLoMask <<= rng[0]
match.CtLabelHiMask >>= 127 - rng[1]
} else if rng[1] < 64 {
match.CtLabelLoMask &= 0xffff_ffff_ffff_ffff << rng[0]
match.CtLabelLoMask &= 0xffff_ffff_ffff_ffff >> (63 - rng[1])
match.CtLabelHiMask = 0
} else if rng[0] >= 64 {
match.CtLabelHiMask &= 0xffff_ffff_ffff_ffff << (rng[0] - 64)
match.CtLabelHiMask &= 0xffff_ffff_ffff_ffff >> (127 - rng[1])
match.CtLabelLoMask = 0
}
}
func (b *ofFlowBuilder) MatchCTLabelRange(high, low uint64, bitRange Range) FlowBuilder {
b.matchers = append(b.matchers, fmt.Sprintf("ct_label[%d..%d]=0x%x%x", bitRange[0], bitRange[1], high, low))
ctLabelRange(high, low, bitRange, &b.ofFlow.Match)
return b
}
// MatchInPort adds match condition for matching in_port.
func (b *ofFlowBuilder) MatchInPort(inPort uint32) FlowBuilder {
b.matchers = append(b.matchers, fmt.Sprintf("in_port=%d", inPort))
b.Match.InputPort = inPort
return b
}
// MatchDstIP adds match condition for matching destination IP address.
func (b *ofFlowBuilder) MatchDstIP(ip net.IP) FlowBuilder {
if ip.To4() != nil {
b.matchers = append(b.matchers, fmt.Sprintf("nw_dst=%s", ip.String()))
} else {
b.matchers = append(b.matchers, fmt.Sprintf("ipv6_dst=%s", ip.String()))
}
b.Match.IpDa = &ip
return b
}
// MatchDstIPNet adds match condition for matching destination IP CIDR.
func (b *ofFlowBuilder) MatchDstIPNet(ipnet net.IPNet) FlowBuilder {
if ipnet.IP.To4() != nil {
b.matchers = append(b.matchers, fmt.Sprintf("nw_dst=%s", ipnet.String()))
} else {
b.matchers = append(b.matchers, fmt.Sprintf("ipv6_dst=%s", ipnet.String()))
}
b.Match.IpDa = &ipnet.IP
b.Match.IpDaMask = maskToIP(ipnet.Mask)
return b
}
func (b *ofFlowBuilder) MatchICMPv6Type(icmp6Type byte) FlowBuilder {
b.matchers = append(b.matchers, fmt.Sprintf("icmp_type=%d", icmp6Type))
b.Match.Icmp6Type = &icmp6Type
return b
}
func (b *ofFlowBuilder) MatchICMPv6Code(icmp6Code byte) FlowBuilder {
b.matchers = append(b.matchers, fmt.Sprintf("icmp_code=%d", icmp6Code))
b.Match.Icmp6Code = &icmp6Code
return b
}
func maskToIP(mask net.IPMask) *net.IP {
ip := net.IP(mask)
return &ip
}
// MatchSrcIP adds match condition for matching source IP address.
func (b *ofFlowBuilder) MatchSrcIP(ip net.IP) FlowBuilder {
if ip.To4() != nil {
b.matchers = append(b.matchers, fmt.Sprintf("nw_src=%s", ip.String()))
} else {
b.matchers = append(b.matchers, fmt.Sprintf("ipv6_src=%s", ip.String()))
}
b.Match.IpSa = &ip
return b
}
// MatchSrcIPNet adds match condition for matching source IP CIDR.
func (b *ofFlowBuilder) MatchSrcIPNet(ipnet net.IPNet) FlowBuilder {
if ipnet.IP.To4() != nil {
b.matchers = append(b.matchers, fmt.Sprintf("nw_src=%s", ipnet.String()))
} else {
b.matchers = append(b.matchers, fmt.Sprintf("ipv6_src=%s", ipnet.String()))
}
b.Match.IpSa = &ipnet.IP
b.Match.IpSaMask = maskToIP(ipnet.Mask)
return b
}
// MatchDstMAC adds match condition for matching destination MAC address.
func (b *ofFlowBuilder) MatchDstMAC(mac net.HardwareAddr) FlowBuilder {
b.matchers = append(b.matchers, fmt.Sprintf("dl_dst=%s", mac.String()))
b.Match.MacDa = &mac
return b
}
// MatchSrcMAC adds match condition for matching source MAC address.
func (b *ofFlowBuilder) MatchSrcMAC(mac net.HardwareAddr) FlowBuilder {
b.matchers = append(b.matchers, fmt.Sprintf("dl_src=%s", mac.String()))
b.Match.MacSa = &mac
return b
}
// MatchARPSha adds match condition for matching ARP source host address.
func (b *ofFlowBuilder) MatchARPSha(mac net.HardwareAddr) FlowBuilder {
b.matchers = append(b.matchers, fmt.Sprintf("arp_sha=%s", mac.String()))
b.Match.ArpSha = &mac
return b
}
// MatchARPTha adds match condition for matching ARP target host address.
func (b *ofFlowBuilder) MatchARPTha(mac net.HardwareAddr) FlowBuilder {
b.matchers = append(b.matchers, fmt.Sprintf("arp_tha=%s", mac.String()))
b.Match.ArpTha = &mac
return b
}
// MatchARPSpa adds match condition for matching ARP source protocol address.
func (b *ofFlowBuilder) MatchARPSpa(ip net.IP) FlowBuilder {
b.matchers = append(b.matchers, fmt.Sprintf("arp_spa=%s", ip.String()))
b.Match.ArpSpa = &ip
return b
}
// MatchARPTpa adds match condition for matching ARP target protocol address.
func (b *ofFlowBuilder) MatchARPTpa(ip net.IP) FlowBuilder {
b.matchers = append(b.matchers, fmt.Sprintf("arp_tpa=%s", ip.String()))
b.Match.ArpTpa = &ip
return b
}
// MatchARPOp adds match condition for matching ARP operator.
func (b *ofFlowBuilder) MatchARPOp(op uint16) FlowBuilder {
b.matchers = append(b.matchers, fmt.Sprintf("arp_op=%d", op))
b.Match.ArpOper = op
return b
}
// MatchIPDSCP adds match condition for matching DSCP field in the IP header. Note, OVS use TOS to present DSCP, and
// the field name is shown as "nw_tos" with OVS command line, and the value is calculated by shifting the given value
// left 2 bits.
func (b *ofFlowBuilder) MatchIPDSCP(dscp uint8) FlowBuilder {
b.matchers = append(b.matchers, fmt.Sprintf("nw_tos=%d", dscp<<2))
b.Match.IpDscp = dscp
return b
}
// MatchConjID adds match condition for matching conj_id.
func (b *ofFlowBuilder) MatchConjID(value uint32) FlowBuilder {
b.matchers = append(b.matchers, fmt.Sprintf("conj_id=%d", value))
b.Match.ConjunctionID = &value
return b
}
func (b *ofFlowBuilder) MatchPriority(priority uint16) FlowBuilder {
b.Match.Priority = priority
return b
}
// MatchProtocol adds match condition for matching protocol type.
func (b *ofFlowBuilder) MatchProtocol(protocol Protocol) FlowBuilder {
switch protocol {
case ProtocolIP:
b.Match.Ethertype = 0x0800
case ProtocolIPv6:
b.Match.Ethertype = 0x86dd
case ProtocolARP:
b.Match.Ethertype = 0x0806
case ProtocolTCP:
b.Match.Ethertype = 0x0800
b.Match.IpProto = 6
case ProtocolTCPv6:
b.Match.Ethertype = 0x86dd
b.Match.IpProto = 6
case ProtocolUDP:
b.Match.Ethertype = 0x0800
b.Match.IpProto = 17
case ProtocolUDPv6:
b.Match.Ethertype = 0x86dd
b.Match.IpProto = 17
case ProtocolSCTP:
b.Match.Ethertype = 0x0800
b.Match.IpProto = 132
case ProtocolSCTPv6:
b.Match.Ethertype = 0x86dd
b.Match.IpProto = 132
case ProtocolICMP:
b.Match.Ethertype = 0x0800
b.Match.IpProto = 1
case ProtocolICMPv6:
b.Match.Ethertype = 0x86dd
b.Match.IpProto = 58
}
b.protocol = protocol
return b
}
// MatchProtocol adds match condition for IP protocol with the intetger value.
func (b *ofFlowBuilder) MatchIPProtocolValue(isIPv6 bool, protoValue uint8) FlowBuilder {
if isIPv6 {
b.Match.Ethertype = 0x86dd
} else {
b.Match.Ethertype = 0x0800
}
b.Match.IpProto = protoValue
return b
}
// MatchDstPort adds match condition for matching destination port in transport layer. OVS will match the port exactly
// if portMask is nil.
func (b *ofFlowBuilder) MatchDstPort(port uint16, portMask *uint16) FlowBuilder {
b.Match.DstPort = port
b.Match.DstPortMask = portMask
matchStr := fmt.Sprintf("tp_dst=0x%x", port)
if portMask != nil {
matchStr = fmt.Sprintf("%s/0x%x", matchStr, portMask)
}
b.matchers = append(b.matchers, matchStr)
return b
}
// MatchSrcPort adds match condition for matching source port in transport layer. OVS will match the port exactly
// if portMask is nil.
func (b *ofFlowBuilder) MatchSrcPort(port uint16, portMask *uint16) FlowBuilder {
b.Match.SrcPort = port
b.Match.SrcPortMask = portMask
matchStr := fmt.Sprintf("tp_src=0x%x", port)
if portMask != nil {
matchStr = fmt.Sprintf("%s/0x%x", matchStr, portMask)
}
b.matchers = append(b.matchers, matchStr)
return b
}
// MatchCTSrcIP matches the source IPv4 address of the connection tracker original direction tuple. This match requires
// a match to valid connection tracking state as a prerequisite, and valid connection tracking state matches include
// "+new", "+est", "+rel" and "+trk-inv".
func (b *ofFlowBuilder) MatchCTSrcIP(ip net.IP) FlowBuilder {
b.Match.CtIpSa = &ip
b.matchers = append(b.matchers, fmt.Sprintf("ct_nw_src=%s", ip.String()))
return b
}
// MatchCTSrcIPNet is the same as MatchCTSrcIP but supports IP masking.
func (b *ofFlowBuilder) MatchCTSrcIPNet(ipNet net.IPNet) FlowBuilder {
b.matchers = append(b.matchers, fmt.Sprintf("nw_dst=%s", ipNet.String()))
b.Match.CtIpSa = &ipNet.IP
b.Match.CtIpSaMask = maskToIP(ipNet.Mask)
return b
}
// MatchCTDstIP matches the destination IPv4 address of the connection tracker original direction tuple. This match
// requires a match to valid connection tracking state as a prerequisite, and valid connection tracking state matches
// include "+new", "+est", "+rel" and "+trk-inv".
func (b *ofFlowBuilder) MatchCTDstIP(ip net.IP) FlowBuilder {
b.Match.CtIpDa = &ip
b.matchers = append(b.matchers, fmt.Sprintf("ct_nw_dst=%s", ip.String()))
return b
}
// MatchCTDstIPNet is the same as MatchCTDstIP but supports IP masking.
func (b *ofFlowBuilder) MatchCTDstIPNet(ipNet net.IPNet) FlowBuilder {
b.Match.CtIpDa = &ipNet.IP
b.Match.CtIpDaMask = maskToIP(ipNet.Mask)
b.matchers = append(b.matchers, fmt.Sprintf("ct_nw_dst=%s", ipNet.String()))
return b
}
// MatchCTSrcPort matches the transport source port of the connection tracker original direction tuple. This match requires
// a match to valid connection tracking state as a prerequisite, and valid connection tracking state matches include
// "+new", "+est", "+rel" and "+trk-inv".
func (b *ofFlowBuilder) MatchCTSrcPort(port uint16) FlowBuilder {
b.Match.CtTpSrcPort = port
b.matchers = append(b.matchers, fmt.Sprintf("ct_tp_src=%d", port))
return b
}
// MatchCTDstPort matches the transport destination port of the connection tracker original direction tuple. This match
// requires a match to valid connection tracking state as a prerequisite, and valid connection tracking state matches
// include "+new", "+est", "+rel" and "+trk-inv".
func (b *ofFlowBuilder) MatchCTDstPort(port uint16) FlowBuilder {
b.Match.CtTpDstPort = port
b.matchers = append(b.matchers, fmt.Sprintf("ct_tp_dst=%d", port))
return b
}
// MatchCTProtocol matches the IP protocol type of the connection tracker original direction tuple. This match requires
// a match to valid connection tracking state as a prerequisite, and a valid connection tracking state matches include
// "+new", "+est", "+rel" and "+trk-inv".
func (b *ofFlowBuilder) MatchCTProtocol(proto Protocol) FlowBuilder {
switch proto {
case ProtocolTCP:
b.Match.CtIpProto = 6
case ProtocolUDP:
b.Match.CtIpProto = 17
case ProtocolSCTP:
b.Match.CtIpProto = 132
case ProtocolICMP:
b.Match.CtIpProto = 1
}
b.matchers = append(b.matchers, fmt.Sprintf("ct_nw_proto=%d", b.Match.CtIpProto))
return b
}
// Cookie sets cookie ID for the flow entry.
func (b *ofFlowBuilder) Cookie(cookieID uint64) FlowBuilder {
b.Flow.CookieID = cookieID
return b
}
// CookieMask sets cookie mask for the flow entry.
func (b *ofFlowBuilder) CookieMask(cookieMask uint64) FlowBuilder {
b.Flow.CookieMask = &cookieMask
return b
}
func (b *ofFlowBuilder) Action() Action {
return &ofFlowAction{b}
}