Skip to content

Commit eb05dfb

Browse files
committed
[NX-OS] Add buffer-boost annotation
1 parent bde9379 commit eb05dfb

File tree

3 files changed

+34
-1
lines changed

3 files changed

+34
-1
lines changed

config/samples/cisco/nx/v1alpha1_vpcdomain.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ metadata:
4343
networking.metal.ironcore.dev/device-name: leaf1
4444
annotations:
4545
nx.cisco.networking.metal.ironcore.dev/spanning-tree-port-type: "network"
46+
nx.cisco.networking.metal.ironcore.dev/buffer-boost: "disable"
4647
name: eth1-31
4748
spec:
4849
deviceRef:
@@ -64,6 +65,7 @@ metadata:
6465
networking.metal.ironcore.dev/device-name: leaf1
6566
annotations:
6667
nx.cisco.networking.metal.ironcore.dev/spanning-tree-port-type: "network"
68+
nx.cisco.networking.metal.ironcore.dev/buffer-boost: "disable"
6769
name: eth1-32
6870
spec:
6971
deviceRef:
@@ -85,7 +87,7 @@ metadata:
8587
networking.metal.ironcore.dev/device-name: leaf1
8688
annotations:
8789
nx.cisco.networking.metal.ironcore.dev/spanning-tree-port-type: "network"
88-
nx.cisco.networking.metal.ironcore.dev/channel-group-force: ""
90+
nx.cisco.networking.metal.ironcore.dev/buffer-boost: "disable"
8991
name: po1
9092
spec:
9193
deviceRef:

internal/provider/cisco/nxos/intf.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ type PhysIf struct {
7474
TrunkVlans string `json:"trunkVlans"`
7575
UserCfgdFlags UserFlags `json:"userCfgdFlags"`
7676
RtvrfMbrItems *VrfMember `json:"rtvrfMbr-items,omitempty"`
77+
PhysExtdItems struct {
78+
BufferBoost string `json:"bufferBoost,omitempty"`
79+
} `json:"physExtd-items,omitzero"`
7780
}
7881

7982
func (*PhysIf) IsListItem() {}
@@ -160,6 +163,9 @@ type PortChannel struct {
160163
RsmbrIfsItems struct {
161164
RsMbrIfsList gnmiext.List[string, *PortChannelMember] `json:"RsMbrIfs-list,omitzero"`
162165
} `json:"rsmbrIfs-items,omitzero"`
166+
AggrExtdItems struct {
167+
BufferBoost string `json:"bufferBoost,omitempty"`
168+
} `json:"aggrExtd-items,omitzero"`
163169
}
164170

165171
type PortChannelMember struct {

internal/provider/cisco/nxos/provider.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ import (
3030

3131
const (
3232
SpanningTreePortTypeAnnotation = "nx.cisco.networking.metal.ironcore.dev/spanning-tree-port-type"
33+
// BufferBoostAnnotation is the annotation key used to enable or disable buffer boost on interfaces.
34+
// Accepted values are 'enable' and 'disable', any other value will result in the device returning an error.
35+
BufferBoostAnnotation = "nx.cisco.networking.metal.ironcore.dev/buffer-boost"
3336
)
3437

3538
var (
@@ -673,6 +676,17 @@ func (p *Provider) EnsureInterface(ctx context.Context, req *provider.EnsureInte
673676
}
674677
}
675678

679+
// TODO: remove annotation with provider-specific implementation
680+
ann, ok := req.Interface.GetAnnotations()[BufferBoostAnnotation]
681+
if ok {
682+
switch strings.ToLower(ann) {
683+
case "enable", "disable":
684+
p.PhysExtdItems.BufferBoost = strings.ToLower(ann)
685+
default:
686+
return fmt.Errorf("invalid value for annotation %q: %q. Must be %q or %q", BufferBoostAnnotation, ann, "enable", "disable")
687+
}
688+
}
689+
676690
if err := p.Validate(); err != nil {
677691
return err
678692
}
@@ -775,6 +789,17 @@ func (p *Provider) EnsureInterface(ctx context.Context, req *provider.EnsureInte
775789
}
776790
}
777791

792+
// TODO: remove annotation with provider-specific implementation
793+
ann, ok := req.Interface.GetAnnotations()[BufferBoostAnnotation]
794+
if ok {
795+
switch strings.ToLower(ann) {
796+
case "enable", "disable":
797+
pc.AggrExtdItems.BufferBoost = strings.ToLower(ann)
798+
default:
799+
return fmt.Errorf("invalid value for annotation %q: %q. Must be %q or %q", BufferBoostAnnotation, ann, "enable", "disable")
800+
}
801+
}
802+
778803
conf = append(conf, pc)
779804

780805
if req.MultiChassisID != nil {

0 commit comments

Comments
 (0)