diff --git a/api/core/v1alpha1/pim_types.go b/api/core/v1alpha1/pim_types.go index e3ed5e299..e8946421c 100644 --- a/api/core/v1alpha1/pim_types.go +++ b/api/core/v1alpha1/pim_types.go @@ -29,6 +29,10 @@ type PIMSpec struct { // +kubebuilder:default=Up AdminState AdminState `json:"adminState,omitempty"` + // LogNeighborChanges enables logging when a PIM neighbor is added or removed. + // +optional + LogNeighborChanges *bool `json:"logNeighborChanges,omitempty"` + // RendezvousPoints defines the list of rendezvous points for sparse mode multicast. // +optional // +listType=map diff --git a/api/core/v1alpha1/zz_generated.deepcopy.go b/api/core/v1alpha1/zz_generated.deepcopy.go index 1ab6b9e18..04897dc60 100644 --- a/api/core/v1alpha1/zz_generated.deepcopy.go +++ b/api/core/v1alpha1/zz_generated.deepcopy.go @@ -3535,6 +3535,11 @@ func (in *PIMSpec) DeepCopyInto(out *PIMSpec) { *out = new(TypedLocalObjectReference) **out = **in } + if in.LogNeighborChanges != nil { + in, out := &in.LogNeighborChanges, &out.LogNeighborChanges + *out = new(bool) + **out = **in + } if in.RendezvousPoints != nil { in, out := &in.RendezvousPoints, &out.RendezvousPoints *out = make([]RendezvousPoint, len(*in)) diff --git a/charts/network-operator/templates/crd/pim.networking.metal.ironcore.dev.yaml b/charts/network-operator/templates/crd/pim.networking.metal.ironcore.dev.yaml index 31b2dbc30..37896db65 100644 --- a/charts/network-operator/templates/crd/pim.networking.metal.ironcore.dev.yaml +++ b/charts/network-operator/templates/crd/pim.networking.metal.ironcore.dev.yaml @@ -115,6 +115,10 @@ spec: minItems: 1 type: array x-kubernetes-list-type: atomic + logNeighborChanges: + description: LogNeighborChanges enables logging when a PIM neighbor + is added or removed. + type: boolean providerConfigRef: description: |- ProviderConfigRef is a reference to a resource holding the provider-specific configuration of this interface. diff --git a/config/crd/bases/networking.metal.ironcore.dev_pim.yaml b/config/crd/bases/networking.metal.ironcore.dev_pim.yaml index 1851dcc72..1bd69e3f9 100644 --- a/config/crd/bases/networking.metal.ironcore.dev_pim.yaml +++ b/config/crd/bases/networking.metal.ironcore.dev_pim.yaml @@ -112,6 +112,10 @@ spec: minItems: 1 type: array x-kubernetes-list-type: atomic + logNeighborChanges: + description: LogNeighborChanges enables logging when a PIM neighbor + is added or removed. + type: boolean providerConfigRef: description: |- ProviderConfigRef is a reference to a resource holding the provider-specific configuration of this interface. diff --git a/docs/api-reference/index.md b/docs/api-reference/index.md index ed271ca0e..4df96891b 100644 --- a/docs/api-reference/index.md +++ b/docs/api-reference/index.md @@ -3268,6 +3268,7 @@ _Appears in:_ | `deviceRef` _[LocalObjectReference](#localobjectreference)_ | DeviceName is the name of the Device this object belongs to. The Device object must exist in the same namespace.
Immutable. | | Required: \{\}
| | `providerConfigRef` _[TypedLocalObjectReference](#typedlocalobjectreference)_ | ProviderConfigRef is a reference to a resource holding the provider-specific configuration of this interface.
This reference is used to link the PIM to its provider-specific configuration. | | Optional: \{\}
| | `adminState` _[AdminState](#adminstate)_ | AdminState indicates whether the PIM instance is administratively up or down. | Up | Enum: [Up Down]
Optional: \{\}
| +| `logNeighborChanges` _boolean_ | LogNeighborChanges enables logging when a PIM neighbor is added or removed. | | Optional: \{\}
| | `rendezvousPoints` _[RendezvousPoint](#rendezvouspoint) array_ | RendezvousPoints defines the list of rendezvous points for sparse mode multicast. | | MinItems: 1
Optional: \{\}
| | `interfaceRefs` _[PIMInterface](#piminterface) array_ | InterfaceRefs is a list of interfaces that are part of the PIM instance. | | MinItems: 1
Optional: \{\}
| diff --git a/internal/provider/cisco/nxos/pim.go b/internal/provider/cisco/nxos/pim.go index afddad0e3..e8ad8fab7 100644 --- a/internal/provider/cisco/nxos/pim.go +++ b/internal/provider/cisco/nxos/pim.go @@ -27,8 +27,9 @@ func (*PIM) XPath() string { } type PIMDom struct { - Name string `json:"name"` - AdminSt AdminSt `json:"adminSt"` + Name string `json:"name"` + AdminSt AdminSt `json:"adminSt"` + LogNbhChng *bool `json:"logNbhChng,omitempty"` } func (*PIMDom) IsListItem() {} diff --git a/internal/provider/cisco/nxos/pim_test.go b/internal/provider/cisco/nxos/pim_test.go index c1250cbaa..4a31046e1 100644 --- a/internal/provider/cisco/nxos/pim_test.go +++ b/internal/provider/cisco/nxos/pim_test.go @@ -15,4 +15,11 @@ func init() { rp := &StaticRP{Addr: "10.0.0.100/32"} rp.RpgrplistItems.RPGrpListList.Set(&StaticRPGrp{GrpListName: "224.0.0.0/4"}) Register("pim_rp", rp) + + logEnabled := true + Register("pim_dom_log", &PIMDom{ + Name: "default", + AdminSt: AdminStEnabled, + LogNbhChng: &logEnabled, + }) } diff --git a/internal/provider/cisco/nxos/provider.go b/internal/provider/cisco/nxos/provider.go index 4e1fc96b9..c8685b4b3 100644 --- a/internal/provider/cisco/nxos/provider.go +++ b/internal/provider/cisco/nxos/provider.go @@ -2389,6 +2389,7 @@ func (p *Provider) EnsurePIM(ctx context.Context, req *provider.EnsurePIMRequest if req.PIM.Spec.AdminState == v1alpha1.AdminStateDown { dom.AdminSt = AdminStDisabled } + dom.LogNbhChng = req.PIM.Spec.LogNeighborChanges sb.Patch(dom) rpItems := new(StaticRPItems) diff --git a/internal/provider/cisco/nxos/testdata/pim_dom_log.json b/internal/provider/cisco/nxos/testdata/pim_dom_log.json new file mode 100644 index 000000000..19897345f --- /dev/null +++ b/internal/provider/cisco/nxos/testdata/pim_dom_log.json @@ -0,0 +1,15 @@ +{ + "pim-items": { + "inst-items": { + "dom-items": { + "Dom-list": [ + { + "name": "default", + "adminSt": "enabled", + "logNbhChng": true + } + ] + } + } + } +} diff --git a/internal/provider/cisco/nxos/testdata/pim_dom_log.json.txt b/internal/provider/cisco/nxos/testdata/pim_dom_log.json.txt new file mode 100644 index 000000000..6e73f1ae5 --- /dev/null +++ b/internal/provider/cisco/nxos/testdata/pim_dom_log.json.txt @@ -0,0 +1 @@ +ip pim log-neighbor-changes diff --git a/test/gnmi/testdata/cisco-nxos-gnmi/pim.txtar b/test/gnmi/testdata/cisco-nxos-gnmi/pim.txtar index 2ada9693f..03c9c3986 100644 --- a/test/gnmi/testdata/cisco-nxos-gnmi/pim.txtar +++ b/test/gnmi/testdata/cisco-nxos-gnmi/pim.txtar @@ -24,6 +24,7 @@ spec: deviceRef: name: device adminState: Up + logNeighborChanges: true interfaceRefs: - name: lo-pim mode: Sparse @@ -119,6 +120,7 @@ spec: { "name": "default", "adminSt": "enabled", + "logNbhChng": true, "if-items": { "If-list": [ {