From e76cd7feb52613fb5feaf508b60c99b12512ca59 Mon Sep 17 00:00:00 2001 From: danischm Date: Sun, 24 Mar 2024 16:46:49 +0100 Subject: [PATCH] Fix flow record delete behavior --- gen/definitions/flow_record.yaml | 2 ++ internal/provider/model_iosxe_flow_record.go | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/gen/definitions/flow_record.yaml b/gen/definitions/flow_record.yaml index 5673f267..e31bfc96 100644 --- a/gen/definitions/flow_record.yaml +++ b/gen/definitions/flow_record.yaml @@ -26,8 +26,10 @@ attributes: - yang_name: collect/interface/output example: true - yang_name: collect/counter/bytes/long + delete_parent: true example: true - yang_name: collect/counter/packets/long + delete_parent: true example: true - yang_name: collect/transport/tcp/flags example: true diff --git a/internal/provider/model_iosxe_flow_record.go b/internal/provider/model_iosxe_flow_record.go index 57725e27..c152f99f 100644 --- a/internal/provider/model_iosxe_flow_record.go +++ b/internal/provider/model_iosxe_flow_record.go @@ -430,10 +430,10 @@ func (data *FlowRecord) getDeletedItems(ctx context.Context, state FlowRecord) [ deletedItems = append(deletedItems, fmt.Sprintf("%v/collect/interface/output", state.getPath())) } if !state.CollectCounterBytesLong.IsNull() && data.CollectCounterBytesLong.IsNull() { - deletedItems = append(deletedItems, fmt.Sprintf("%v/collect/counter/bytes/long", state.getPath())) + deletedItems = append(deletedItems, fmt.Sprintf("%v/collect/counter/bytes", state.getPath())) } if !state.CollectCounterPacketsLong.IsNull() && data.CollectCounterPacketsLong.IsNull() { - deletedItems = append(deletedItems, fmt.Sprintf("%v/collect/counter/packets/long", state.getPath())) + deletedItems = append(deletedItems, fmt.Sprintf("%v/collect/counter/packets", state.getPath())) } if !state.CollectTransportTcpFlags.IsNull() && data.CollectTransportTcpFlags.IsNull() { deletedItems = append(deletedItems, fmt.Sprintf("%v/collect/transport/tcp/flags", state.getPath())) @@ -527,10 +527,10 @@ func (data *FlowRecord) getDeletePaths(ctx context.Context) []string { deletePaths = append(deletePaths, fmt.Sprintf("%v/collect/interface/output", data.getPath())) } if !data.CollectCounterBytesLong.IsNull() { - deletePaths = append(deletePaths, fmt.Sprintf("%v/collect/counter/bytes/long", data.getPath())) + deletePaths = append(deletePaths, fmt.Sprintf("%v/collect/counter/bytes", data.getPath())) } if !data.CollectCounterPacketsLong.IsNull() { - deletePaths = append(deletePaths, fmt.Sprintf("%v/collect/counter/packets/long", data.getPath())) + deletePaths = append(deletePaths, fmt.Sprintf("%v/collect/counter/packets", data.getPath())) } if !data.CollectTransportTcpFlags.IsNull() { deletePaths = append(deletePaths, fmt.Sprintf("%v/collect/transport/tcp/flags", data.getPath()))