Repository navigation
Expand file tree
/
Copy pathbond.go
More file actions
702 lines (608 loc) · 20.4 KB
/
Copy pathbond.go
File metadata and controls
702 lines (608 loc) · 20.4 KB
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
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
package network
//docgen:jsonschema
import (
"errors"
"fmt"
"net/netip"
"slices"
"github.com/siderolabs/gen/optional"
"github.com/siderolabs/go-pointer"
"github.com/siderolabs/talos/pkg/machinery/config/config"
"github.com/siderolabs/talos/pkg/machinery/config/internal/registry"
"github.com/siderolabs/talos/pkg/machinery/config/types/meta"
"github.com/siderolabs/talos/pkg/machinery/config/validation"
"github.com/siderolabs/talos/pkg/machinery/nethelpers"
)
// BondKind is a Bond config document kind.
const BondKind = "BondConfig"
func init() {
registry.Register(BondKind, func(version string) config.Document {
switch version {
case "v1alpha1": //nolint:goconst
return &BondConfigV1Alpha1{}
default:
return nil
}
})
}
// Check interfaces.
var (
_ config.NetworkBondConfig = &BondConfigV1Alpha1{}
_ config.ConflictingDocument = &BondConfigV1Alpha1{}
_ config.NamedDocument = &BondConfigV1Alpha1{}
_ config.Validator = &BondConfigV1Alpha1{}
)
// BondConfigV1Alpha1 is a config document to create a bond (link aggregation) over a set of links.
//
// examples:
// - value: exampleBondConfigV1Alpha1()
// alias: BondConfig
// schemaRoot: true
// schemaMeta: v1alpha1/BondConfig
type BondConfigV1Alpha1 struct {
meta.Meta `yaml:",inline"`
// description: |
// Name of the bond link (interface) to be created.
//
// examples:
// - value: >
// "bond.ext"
// schemaRequired: true
MetaName string `yaml:"name"`
// description: |
// Override the hardware (MAC) address of the link.
//
// examples:
// - value: >
// nethelpers.HardwareAddr{0x2e, 0x3c, 0x4d, 0x5e, 0x6f, 0x70}
// schema:
// type: string
// pattern: ^[0-9a-f:]+$
HardwareAddressConfig nethelpers.HardwareAddr `yaml:"hardwareAddr,omitempty"`
// description: |
// Names of the links (interfaces) on which the bond will be created.
// Link aliases can be used here as well.
// examples:
// - value: >
// []string{"enp0s3", "enp0s8"}
// schemaRequired: true
BondLinks []string `yaml:"links,omitempty"`
// description: |
// Bond mode.
//
// examples:
// - value: >
// "802.3ad"
// values:
// - "balance-rr"
// - "active-backup"
// - "balance-xor"
// - "broadcast"
// - "802.3ad"
// - "balance-tlb"
// - "balance-alb"
// schemaRequired: true
BondMode *nethelpers.BondMode `yaml:"bondMode,omitempty"`
// description: |
// Link monitoring frequency in milliseconds.
//
// examples:
// - value: >
// 200
BondMIIMon *uint32 `yaml:"miimon,omitempty"`
// description: |
// The time, in milliseconds, to wait before enabling a slave after a link recovery has been detected.
//
// examples:
// - value: >
// 300
BondUpDelay *uint32 `yaml:"updelay,omitempty"`
// description: |
// The time, in milliseconds, to wait before disabling a slave after a link failure has been detected.
//
// examples:
// - value: >
// 100
BondDownDelay *uint32 `yaml:"downdelay,omitempty"`
// description: |
// Specifies whether or not miimon should use MII or ETHTOOL.
BondUseCarrier *bool `yaml:"useCarrier,omitempty"`
// description: |
// Selects the transmit hash policy to use for slave selection.
// examples:
// - value: >
// "layer2"
// values:
// - "layer2"
// - "layer3+4"
// - "layer2+3"
// - "encap2+3"
// - "encap3+4"
BondXmitHashPolicy *nethelpers.BondXmitHashPolicy `yaml:"xmitHashPolicy,omitempty"`
// description: |
// ARP link monitoring frequency in milliseconds.
// examples:
// - value: >
// 1000
BondARPInterval *uint32 `yaml:"arpInterval,omitempty"`
// description: |
// The list of IPv4 addresses to use for ARP link monitoring when arpInterval is set.
// Maximum of 16 targets are supported.
// examples:
// - value: >
// []netip.Addr{netip.MustParseAddr("10.15.0.1")}
// schema:
// type: array
// items:
// type: string
// pattern: ^[0-9a-f.:]+$
BondARPIPTargets []netip.Addr `yaml:"arpIpTargets,omitempty"`
// description: |
// The list of IPv6 addresses to use for NS link monitoring when arpInterval is set.
// Maximum of 16 targets are supported.
// examples:
// - value: >
// []netip.Addr{netip.MustParseAddr("fd00::1")}
// schema:
// type: array
// items:
// type: string
// pattern: ^[0-9a-f.:]+$
BondNSIP6Targets []netip.Addr `yaml:"nsIp6Targets,omitempty"`
// description: |
// Specifies whether or not ARP probes and replies should be validated.
// examples:
// - value: >
// "active"
// values:
// - "none"
// - "active"
// - "backup"
// - "all"
// - "filter"
// - "filter-active"
// - "filter-backup"
BondARPValidate *nethelpers.ARPValidate `yaml:"arpValidate,omitempty"`
// description: |
// Specifies whether ARP probes should be sent to any or all targets.
// examples:
// - value: >
// "all"
// values:
// - "any"
// - "all"
BondARPAllTargets *nethelpers.ARPAllTargets `yaml:"arpAllTargets,omitempty"`
// description: |
// LACPDU frames periodic transmission rate.
// examples:
// - value: >
// "fast"
// values:
// - "slow"
// - "fast"
BondLACPRate *nethelpers.LACPRate `yaml:"lacpRate,omitempty"`
// description: |
// Specifies whether active-backup mode should set all slaves to the same MAC address
// at enslavement, when enabled, or perform special handling.
// examples:
// - value: >
// "active"
// values:
// - "none"
// - "active"
// - "follow"
BondFailOverMAC *nethelpers.FailOverMAC `yaml:"failOverMac,omitempty"`
// description: |
// Aggregate selection policy for 802.3ad.
// examples:
// - value: >
// "stable"
// values:
// - "stable"
// - "bandwidth"
// - "count"
BondADSelect *nethelpers.ADSelect `yaml:"adSelect,omitempty"`
// description: |
// Actor system priority for 802.3ad.
//
// examples:
// - value: >
// 65535
BondADActorSysPrio *uint16 `yaml:"adActorSysPrio,omitempty"`
// description: |
// User port key (upper 10 bits) for 802.3ad.
//
// examples:
// - value: >
// 0
BondADUserPortKey *uint16 `yaml:"adUserPortKey,omitempty"`
// description: |
// Whether to send LACPDU frames periodically, defaults to "on" if mode is 802.3ad.
// examples:
// - value: >
// "on"
// values:
// - "on"
// - "off"
BondADLACPActive *nethelpers.ADLACPActive `yaml:"adLACPActive,omitempty"`
// description: |
// Name of the link (interface) which should be used as the primary slave of the bond.
//
// The primary link, when up, is always the active one; the other links are only used when the
// primary is down. Only meaningful for the "active-backup", "balance-tlb" and "balance-alb" modes.
//
// Must be one of the links listed in `links`.
// examples:
// - value: >
// "enp1s2"
BondPrimary *string `yaml:"primary,omitempty"`
// description: |
// Policy under which the primary slave should be reselected.
//
// Has no effect unless `primary` is set.
// examples:
// - value: >
// "always"
// values:
// - "always"
// - "better"
// - "failure"
BondPrimaryReselect *nethelpers.PrimaryReselect `yaml:"primaryReselect,omitempty"`
// description: |
// The number of times IGMP packets should be resent.
BondResendIGMP *uint32 `yaml:"resendIGMP,omitempty"`
// description: |
// The minimum number of active links required for the bond to be considered active.
BondMinLinks *uint32 `yaml:"minLinks,omitempty"`
// description: |
// The number of seconds between instances where the bonding driver sends learning packets to each slave's peer switch.
BondLPInterval *uint32 `yaml:"lpInterval,omitempty"`
// description: |
// The number of packets to transmit through a slave before moving to the next one.
BondPacketsPerSlave *uint32 `yaml:"packetsPerSlave,omitempty"`
// description: |
// The number of peer notifications (gratuitous ARPs and unsolicited IPv6 Neighbor Advertisements)
// to be issued after a failover event.
BondNumPeerNotif *uint8 `yaml:"numPeerNotif,omitempty"`
// description: |
// Whether dynamic shuffling of flows is enabled in tlb or alb mode.
// examples:
// - value: >
// 1
BondTLBDynamicLB *uint8 `yaml:"tlbLogicalLb,omitempty"`
// description: |
// Whether duplicate frames (received on inactive ports) should be dropped (0) or delivered (1).
// examples:
// - value: >
// 0
BondAllSlavesActive *uint8 `yaml:"allSlavesActive,omitempty"`
// description: |
// The delay, in milliseconds, between each peer notification.
BondPeerNotifyDelay *uint32 `yaml:"peerNotifDelay,omitempty"`
// description: |
// The number of arpInterval monitor checks that must fail in order for an interface to be marked down by the ARP monitor.
BondMissedMax *uint8 `yaml:"missedMax,omitempty"`
//nolint:embeddedstructfieldcheck
CommonLinkConfig `yaml:",inline"`
}
// NewBondConfigV1Alpha1 creates a new BondConfig config document.
func NewBondConfigV1Alpha1(name string) *BondConfigV1Alpha1 {
return &BondConfigV1Alpha1{
Meta: meta.Meta{
MetaKind: BondKind,
MetaAPIVersion: "v1alpha1",
},
MetaName: name,
}
}
func exampleBondConfigV1Alpha1() *BondConfigV1Alpha1 {
cfg := NewBondConfigV1Alpha1("bond.int")
cfg.BondLinks = []string{"enp1s2", "enp1s2"}
cfg.BondMode = new(nethelpers.BondMode8023AD)
cfg.BondXmitHashPolicy = new(nethelpers.BondXmitPolicyLayer34)
cfg.BondLACPRate = new(nethelpers.LACPRateSlow)
cfg.BondMIIMon = new(uint32(100))
cfg.BondUpDelay = new(uint32(200))
cfg.BondDownDelay = new(uint32(200))
cfg.BondResendIGMP = new(uint32(1))
cfg.BondPacketsPerSlave = new(uint32(1))
cfg.BondADActorSysPrio = new(uint16(65535))
cfg.LinkAddresses = []AddressConfig{
{
AddressAddress: netip.MustParsePrefix("10.15.0.3/16"),
},
}
cfg.LinkRoutes = []RouteConfig{
{
RouteDestination: meta.Prefix{Prefix: netip.MustParsePrefix("10.0.0.0/8")},
RouteGateway: meta.Addr{Addr: netip.MustParseAddr("10.15.0.1")},
},
}
return cfg
}
// Clone implements config.Document interface.
func (s *BondConfigV1Alpha1) Clone() config.Document {
return s.DeepCopy()
}
// Name implements config.NamedDocument interface.
func (s *BondConfigV1Alpha1) Name() string {
return s.MetaName
}
// BondConfig implements NetworkBondConfig interface.
func (s *BondConfigV1Alpha1) BondConfig() {}
// ConflictsWithKinds implements config.ConflictingDocument interface.
func (s *BondConfigV1Alpha1) ConflictsWithKinds() []string {
return conflictingLinkKinds(BondKind)
}
// Validate implements config.Validator interface.
func (s *BondConfigV1Alpha1) Validate(validation.RuntimeMode, ...validation.Option) ([]string, error) {
var (
errs error
warnings []string
)
if s.MetaName == "" {
errs = errors.Join(errs, errors.New("name must be specified"))
}
if len(s.BondLinks) == 0 {
errs = errors.Join(errs, errors.New("at least one link must be specified"))
}
if s.BondMode == nil {
errs = errors.Join(errs, errors.New("bond mode must be specified"))
} else if *s.BondMode == nethelpers.BondMode8023AD {
warnings = append(warnings, s.validateFor8023AD()...)
}
primaryWarnings, primaryErrs := s.validatePrimary()
errs, warnings = errors.Join(errs, primaryErrs), append(warnings, primaryWarnings...)
extraWarnings, extraErrs := s.CommonLinkConfig.Validate()
errs, warnings = errors.Join(errs, extraErrs), append(warnings, extraWarnings...)
return warnings, errs
}
// usesPrimary mirrors the kernel's bond_uses_primary(): the primary slave only has an effect in the
// modes which have a single active slave at a time.
func (s *BondConfigV1Alpha1) usesPrimary() bool {
if s.BondMode == nil {
return false
}
switch *s.BondMode {
case nethelpers.BondModeActiveBackup, nethelpers.BondModeTLB, nethelpers.BondModeALB:
return true
case nethelpers.BondModeRoundrobin, nethelpers.BondModeXOR, nethelpers.BondModeBroadcast, nethelpers.BondMode8023AD:
return false
default:
return false
}
}
func (s *BondConfigV1Alpha1) validatePrimary() ([]string, error) {
var (
errs error
warnings []string
)
if s.BondPrimary != nil {
if *s.BondPrimary == "" {
errs = errors.Join(errs, errors.New("primary link name can't be empty"))
} else if !slices.Contains(s.BondLinks, *s.BondPrimary) {
errs = errors.Join(errs, fmt.Errorf("primary link %q is not in the list of bonded links", *s.BondPrimary))
}
if s.BondMode != nil && !s.usesPrimary() {
errs = errors.Join(errs, fmt.Errorf("primary link is not supported in %q bond mode", *s.BondMode))
}
} else if s.BondPrimaryReselect != nil && s.usesPrimary() {
warnings = append(warnings, "primaryReselect has no effect unless primary is specified")
}
return warnings, errs
}
func (s *BondConfigV1Alpha1) validateFor8023AD() []string {
const warn = " was not specified for 802.3ad bond"
var warnings []string
if s.BondMIIMon == nil {
warnings = append(warnings, "miimon"+warn)
}
if s.BondUpDelay == nil {
warnings = append(warnings, "updelay"+warn)
}
if s.BondDownDelay == nil {
warnings = append(warnings, "downdelay"+warn)
}
return warnings
}
// Links implements NetworkBondConfig interface.
func (s *BondConfigV1Alpha1) Links() []string {
return s.BondLinks
}
// Mode implements NetworkBondConfig interface.
func (s *BondConfigV1Alpha1) Mode() nethelpers.BondMode {
return pointer.SafeDeref(s.BondMode)
}
// MIIMon implements NetworkBondConfig interface.
func (s *BondConfigV1Alpha1) MIIMon() optional.Optional[uint32] {
if s.BondMIIMon == nil {
return optional.None[uint32]()
}
return optional.Some(*s.BondMIIMon)
}
// UpDelay implements NetworkBondConfig interface.
func (s *BondConfigV1Alpha1) UpDelay() optional.Optional[uint32] {
if s.BondUpDelay == nil {
return optional.None[uint32]()
}
return optional.Some(*s.BondUpDelay)
}
// DownDelay implements NetworkBondConfig interface.
func (s *BondConfigV1Alpha1) DownDelay() optional.Optional[uint32] {
if s.BondDownDelay == nil {
return optional.None[uint32]()
}
return optional.Some(*s.BondDownDelay)
}
// UseCarrier implements NetworkBondConfig interface.
func (s *BondConfigV1Alpha1) UseCarrier() optional.Optional[bool] {
if s.BondUseCarrier == nil {
return optional.None[bool]()
}
return optional.Some(*s.BondUseCarrier)
}
// XmitHashPolicy implements NetworkBondConfig interface.
func (s *BondConfigV1Alpha1) XmitHashPolicy() optional.Optional[nethelpers.BondXmitHashPolicy] {
if s.BondXmitHashPolicy == nil {
return optional.None[nethelpers.BondXmitHashPolicy]()
}
return optional.Some(*s.BondXmitHashPolicy)
}
// ARPInterval implements NetworkBondConfig interface.
func (s *BondConfigV1Alpha1) ARPInterval() optional.Optional[uint32] {
if s.BondARPInterval == nil {
return optional.None[uint32]()
}
return optional.Some(*s.BondARPInterval)
}
// ARPIPTargets implements NetworkBondConfig interface.
func (s *BondConfigV1Alpha1) ARPIPTargets() []netip.Addr {
return s.BondARPIPTargets
}
// NSIP6Targets implements NetworkBondConfig interface.
func (s *BondConfigV1Alpha1) NSIP6Targets() []netip.Addr {
return s.BondNSIP6Targets
}
// ARPValidate implements NetworkBondConfig interface.
func (s *BondConfigV1Alpha1) ARPValidate() optional.Optional[nethelpers.ARPValidate] {
if s.BondARPValidate == nil {
return optional.None[nethelpers.ARPValidate]()
}
return optional.Some(*s.BondARPValidate)
}
// ARPAllTargets implements NetworkBondConfig interface.
func (s *BondConfigV1Alpha1) ARPAllTargets() optional.Optional[nethelpers.ARPAllTargets] {
if s.BondARPAllTargets == nil {
return optional.None[nethelpers.ARPAllTargets]()
}
return optional.Some(*s.BondARPAllTargets)
}
// LACPRate implements NetworkBondConfig interface.
func (s *BondConfigV1Alpha1) LACPRate() optional.Optional[nethelpers.LACPRate] {
if s.BondLACPRate == nil {
return optional.None[nethelpers.LACPRate]()
}
return optional.Some(*s.BondLACPRate)
}
// FailOverMAC implements NetworkBondConfig interface.
func (s *BondConfigV1Alpha1) FailOverMAC() optional.Optional[nethelpers.FailOverMAC] {
if s.BondFailOverMAC == nil {
return optional.None[nethelpers.FailOverMAC]()
}
return optional.Some(*s.BondFailOverMAC)
}
// ADSelect implements NetworkBondConfig interface.
func (s *BondConfigV1Alpha1) ADSelect() optional.Optional[nethelpers.ADSelect] {
if s.BondADSelect == nil {
return optional.None[nethelpers.ADSelect]()
}
return optional.Some(*s.BondADSelect)
}
// ADActorSysPrio implements NetworkBondConfig interface.
func (s *BondConfigV1Alpha1) ADActorSysPrio() optional.Optional[uint16] {
if s.BondADActorSysPrio == nil {
return optional.None[uint16]()
}
return optional.Some(*s.BondADActorSysPrio)
}
// ADUserPortKey implements NetworkBondConfig interface.
func (s *BondConfigV1Alpha1) ADUserPortKey() optional.Optional[uint16] {
if s.BondADUserPortKey == nil {
return optional.None[uint16]()
}
return optional.Some(*s.BondADUserPortKey)
}
// ADLACPActive implements NetworkBondConfig interface.
func (s *BondConfigV1Alpha1) ADLACPActive() optional.Optional[nethelpers.ADLACPActive] {
if s.BondADLACPActive == nil {
return optional.None[nethelpers.ADLACPActive]()
}
return optional.Some(*s.BondADLACPActive)
}
// Primary implements NetworkBondConfig interface.
func (s *BondConfigV1Alpha1) Primary() optional.Optional[string] {
if s.BondPrimary == nil {
return optional.None[string]()
}
return optional.Some(*s.BondPrimary)
}
// PrimaryReselect implements NetworkBondConfig interface.
func (s *BondConfigV1Alpha1) PrimaryReselect() optional.Optional[nethelpers.PrimaryReselect] {
if s.BondPrimaryReselect == nil {
return optional.None[nethelpers.PrimaryReselect]()
}
return optional.Some(*s.BondPrimaryReselect)
}
// ResendIGMP implements NetworkBondConfig interface.
func (s *BondConfigV1Alpha1) ResendIGMP() optional.Optional[uint32] {
if s.BondResendIGMP == nil {
return optional.None[uint32]()
}
return optional.Some(*s.BondResendIGMP)
}
// MinLinks implements NetworkBondConfig interface.
func (s *BondConfigV1Alpha1) MinLinks() optional.Optional[uint32] {
if s.BondMinLinks == nil {
return optional.None[uint32]()
}
return optional.Some(*s.BondMinLinks)
}
// LPInterval implements NetworkBondConfig interface.
func (s *BondConfigV1Alpha1) LPInterval() optional.Optional[uint32] {
if s.BondLPInterval == nil {
return optional.None[uint32]()
}
return optional.Some(*s.BondLPInterval)
}
// PacketsPerSlave implements NetworkBondConfig interface.
func (s *BondConfigV1Alpha1) PacketsPerSlave() optional.Optional[uint32] {
if s.BondPacketsPerSlave == nil {
return optional.None[uint32]()
}
return optional.Some(*s.BondPacketsPerSlave)
}
// NumPeerNotif implements NetworkBondConfig interface.
func (s *BondConfigV1Alpha1) NumPeerNotif() optional.Optional[uint8] {
if s.BondNumPeerNotif == nil {
return optional.None[uint8]()
}
return optional.Some(*s.BondNumPeerNotif)
}
// TLBDynamicLB implements NetworkBondConfig interface.
func (s *BondConfigV1Alpha1) TLBDynamicLB() optional.Optional[uint8] {
if s.BondTLBDynamicLB == nil {
return optional.None[uint8]()
}
return optional.Some(*s.BondTLBDynamicLB)
}
// AllSlavesActive implements NetworkBondConfig interface.
func (s *BondConfigV1Alpha1) AllSlavesActive() optional.Optional[uint8] {
if s.BondAllSlavesActive == nil {
return optional.None[uint8]()
}
return optional.Some(*s.BondAllSlavesActive)
}
// PeerNotifyDelay implements NetworkBondConfig interface.
func (s *BondConfigV1Alpha1) PeerNotifyDelay() optional.Optional[uint32] {
if s.BondPeerNotifyDelay == nil {
return optional.None[uint32]()
}
return optional.Some(*s.BondPeerNotifyDelay)
}
// MissedMax implements NetworkBondConfig interface.
func (s *BondConfigV1Alpha1) MissedMax() optional.Optional[uint8] {
if s.BondMissedMax == nil {
return optional.None[uint8]()
}
return optional.Some(*s.BondMissedMax)
}
// HardwareAddress implements NetworkDummyLinkConfig interface.
func (s *BondConfigV1Alpha1) HardwareAddress() optional.Optional[nethelpers.HardwareAddr] {
if len(s.HardwareAddressConfig) == 0 {
return optional.None[nethelpers.HardwareAddr]()
}
return optional.Some(s.HardwareAddressConfig)
}