Skip to content

Commit e2e7831

Browse files
Add description field to VRF resource (#114)
1 parent f03a545 commit e2e7831

File tree

8 files changed

+29
-4
lines changed

8 files changed

+29
-4
lines changed

api/core/v1alpha1/vrf_types.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ type VRFSpec struct {
2626
// +kubebuilder:validation:MaxLength=32
2727
Name string `json:"name"`
2828

29+
// Description provides a human-readable description of the VRF.
30+
// +optional
31+
// +kubebuilder:validation:MinLength=1
32+
// +kubebuilder:validation:MaxLength=255
33+
Description string `json:"description,omitempty"`
34+
2935
// VNI is the VXLAN Network Identifier for the VRF (always an L3).
3036
// +optional
3137
// +kubebuilder:validation:Minimum=1

charts/network-operator/templates/crd/networking.metal.ironcore.dev_vrfs.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@ spec:
6060
spec defines the desired state of VRF
6161
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
6262
properties:
63+
description:
64+
description: Description provides a human-readable description of
65+
the VRF.
66+
maxLength: 255
67+
minLength: 1
68+
type: string
6369
deviceRef:
6470
description: |-
6571
DeviceName is the name of the Device this object belongs to. The Device object must exist in the same namespace.

config/crd/bases/networking.metal.ironcore.dev_vrfs.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ spec:
5454
spec defines the desired state of VRF
5555
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
5656
properties:
57+
description:
58+
description: Description provides a human-readable description of
59+
the VRF.
60+
maxLength: 255
61+
minLength: 1
62+
type: string
5763
deviceRef:
5864
description: |-
5965
DeviceName is the name of the Device this object belongs to. The Device object must exist in the same namespace.

internal/provider/cisco/nxos/provider.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1567,6 +1567,9 @@ func (p *Provider) DeleteSyslog(ctx context.Context) error {
15671567
func (p *Provider) EnsureVRF(ctx context.Context, req *provider.VRFRequest) error {
15681568
v := new(VRF)
15691569
v.Name = req.VRF.Spec.Name
1570+
if req.VRF.Spec.Description != "" {
1571+
v.Descr = NewOption(req.VRF.Spec.Description)
1572+
}
15701573

15711574
if req.VRF.Spec.VNI > 0 {
15721575
v.L3Vni = true

internal/provider/cisco/nxos/testdata/vrf.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"encap": "vxlan-101",
66
"l3vni": true,
77
"name": "CC-CLOUD01",
8+
"descr": "CC-CLOUD01 VRF",
89
"dom-items": {
910
"Dom-list": [
1011
{

internal/provider/cisco/nxos/testdata/vrf.json.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
vrf context CC-CLOUD01
22
vni 101 l3
3+
description CC-CLOUD01 VRF
34
rd 4269539332:101
45
address-family ipv4 unicast
56
route-target import 65148:1101

internal/provider/cisco/nxos/vrf.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@ const DefaultVRFName = "default"
1111
var _ gnmiext.Configurable = (*VRF)(nil)
1212

1313
type VRF struct {
14-
Encap string `json:"encap"`
15-
L3Vni bool `json:"l3vni"`
16-
Name string `json:"name"`
17-
DomItems *VRFDomItems `json:"dom-items,omitempty"`
14+
Encap string `json:"encap"`
15+
L3Vni bool `json:"l3vni"`
16+
Name string `json:"name"`
17+
Descr Option[string] `json:"descr"`
18+
DomItems *VRFDomItems `json:"dom-items,omitempty"`
1819
}
1920

2021
func (*VRF) IsListItem() {}

internal/provider/cisco/nxos/vrf_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ func init() {
4343
Name: "CC-CLOUD01",
4444
L3Vni: true,
4545
Encap: "vxlan-101",
46+
Descr: NewOption("CC-CLOUD01 VRF"),
4647
DomItems: &VRFDomItems{DomList: []*VRFDom{dom}},
4748
}
4849

0 commit comments

Comments
 (0)