From bbd6d757cd6bdde6abc5a8391a4727dd6efa5a17 Mon Sep 17 00:00:00 2001 From: i521907 Date: Fri, 13 Mar 2026 15:05:56 -0400 Subject: [PATCH] fix: delete PIM rp-items before multicast group replace --- internal/provider/cisco/nxos/provider.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/internal/provider/cisco/nxos/provider.go b/internal/provider/cisco/nxos/provider.go index c12fe772..34243ce7 100644 --- a/internal/provider/cisco/nxos/provider.go +++ b/internal/provider/cisco/nxos/provider.go @@ -1662,6 +1662,17 @@ func (p *Provider) EnsurePIM(ctx context.Context, req *provider.EnsurePIMRequest del := make([]gnmiext.Configurable, 0, 3) if len(rpItems.StaticRPList) > 0 { + // NX-OS fails with "child (Rn) cannot be added to deleted object" when a + // gNMI Replace tries to update nested rpgrplist-items within a StaticRP + // in the same transaction (e.g. when multicastGroups change). Work around + // this by deleting the existing StaticRPItems first when the configuration + // has changed, so the Replace only needs to add entries. + currentRPItems := new(StaticRPItems) + if err := p.client.GetConfig(ctx, currentRPItems); err == nil && !reflect.DeepEqual(rpItems, currentRPItems) { + if err := p.client.Delete(ctx, new(StaticRPItems)); err != nil { + return err + } + } conf = append(conf, rpItems) } else { del = append(del, rpItems)