From d0a6b3257e9b516084f821d2acf28234bc945382 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Misbach?= Date: Tue, 14 Nov 2023 18:31:45 +0100 Subject: [PATCH] [SCD] Do not require key for accepted op intents of down USSes (#972) --- pkg/scd/models/operational_intents.go | 6 ++++++ pkg/scd/operational_intents_handler.go | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/pkg/scd/models/operational_intents.go b/pkg/scd/models/operational_intents.go index 40d89d993..b14b137e4 100644 --- a/pkg/scd/models/operational_intents.go +++ b/pkg/scd/models/operational_intents.go @@ -138,3 +138,9 @@ func (o *OperationalIntent) SetCells(cids []int64) { } o.Cells = cells } + +// RequiresKey indicates whether this OperationalIntent requires its OVN to be included in the provided keys when +// another intersecting OperationalIntent is being created or updated. +func (o *OperationalIntent) RequiresKey() bool { + return !(o.UssAvailability == UssAvailabilityStateDown && o.State == OperationalIntentStateAccepted) +} diff --git a/pkg/scd/operational_intents_handler.go b/pkg/scd/operational_intents_handler.go index f7457a867..8ff48deb4 100644 --- a/pkg/scd/operational_intents_handler.go +++ b/pkg/scd/operational_intents_handler.go @@ -551,7 +551,8 @@ func (a *Server) PutOperationalIntentReference(ctx context.Context, manager stri return stacktrace.Propagate(err, "Unable to SearchOperations") } for _, relevantOp := range relevantOps { - if _, ok := key[relevantOp.OVN]; !ok { + _, ok := key[relevantOp.OVN] + if !ok && relevantOp.RequiresKey() { if relevantOp.Manager != dssmodels.Manager(manager) { relevantOp.OVN = scdmodels.NoOvnPhrase }