Add PIM logNeighborChanges field - #552
Conversation
b8ce2c2 to
7a70279
Compare
- Added `logNeighborChanges *bool` field to `PIMSpec` in `api/core/v1alpha1/pim_types.go` - Added `LogNbhChng *bool` (`json:"logNbhChng,omitempty"`) to the NX-OS `PIMDom` struct in `internal/provider/cisco/nxos/pim.go` — field is omitted when nil (user did not configure it), avoiding spurious gNMI Sets - Wired the field in `EnsurePIM` (`internal/provider/cisco/nxos/provider.go`): `dom.LogNbhChng = req.PIM.Spec.LogNeighborChanges` - Added `pim_dom_log` test fixture + golden file in `internal/provider/cisco/nxos/pim_test.go` and `testdata/pim_dom_log.json` - Updated `test/gnmi/testdata/cisco-nxos-gnmi/pim.txtar` with `logNeighborChanges: true` in spec and `"logNbhChng": true` in expected gNMI state Co-authored-by: Claude <claude@anthropic.com> Signed-off-by: Robert Gildein <rgildein@users.noreply.github.com>
7a70279 to
1bd7310
Compare
Merging this branch changes the coverage (1 decrease, 1 increase)
Coverage by fileChanged files (no unit tests)
Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code. Changed unit test files
|
|
@rgildein did you check whether this field is some vendor-agnostic standard that we want to add to the "core" api types or something Cisco-specific hence should rather go to a provider config? ref/ network-operator/docs/designs/0002-provider-interface.md Lines 50 to 62 in eb3ad0c |
Good call, you are right. I check it and there is no alternative for this in OpenConfig. What would be an option here? Going with custom resource for Cisco or refer Cisco specific resource in PIM? |
Add PIM log-neighbor-changes to CRD
Description
Add PIM logNeighborChanges field
logNeighborChanges *boolfield toPIMSpecinapi/core/v1alpha1/pim_types.goLogNbhChng *bool(json:"logNbhChng,omitempty") to the NX-OSPIMDomstruct ininternal/provider/cisco/nxos/pim.go— field is omitted when nil (user did not configure it), avoiding spurious gNMI SetsEnsurePIM(internal/provider/cisco/nxos/provider.go):dom.LogNbhChng = req.PIM.Spec.LogNeighborChangespim_dom_logtest fixture + golden file ininternal/provider/cisco/nxos/pim_test.goandtestdata/pim_dom_log.jsontest/gnmi/testdata/cisco-nxos-gnmi/pim.txtarwithlogNeighborChanges: truein spec and"logNbhChng": truein expected gNMI stateTest results
Phase 1 — local checks
Phase 2 — real device (Cisco NX-OS,
10.1.1.1:57403)Applied
PIMCR withlogNeighborChanges: truereferencing loopbacklo99.Operator reconcile log (first apply):
gnmic GET response (
System/pim-items/inst-items/dom-items/Dom-list[name=default]):[ { "source": "10.1.1.1:57403", "timestamp": 1788878844530406667, "time": "2026-09-08T16:47:24.530406667+02:00", "updates": [ { "Path": "System/pim-items/inst-items/dom-items/Dom-list[name=default]", "values": { "System/pim-items/inst-items/dom-items/Dom-list": [ { "adminSt": "enabled", "if-items": { "If-list": [ { "id": "lo99", "ipAddr": "10.99.99.99/32", "pimSparseMode": true } ] }, "jpDelay": 100, "logNbhChng": true, "mtu": 1500, "name": "default" } ] } } ] } ]Idempotency: On subsequent reconciles (after
logNbhChngwas already set), the operator emitted:No gNMI Set was issued — idempotency confirmed.
Notes
The NX-OS YANG field name is
logNbhChng(bool), not a string enum. The platform default isfalse.Since the field is a pointer with
omitempty, omittinglogNeighborChangesfrom the CR spec sends no value to the device, leaving the platform default intact.