From bcfd33d9fb1476b2555b807c476d8e951c54ace9 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 24 Feb 2021 21:18:36 +0300 Subject: [PATCH] [#397] ir: Make UN-LOCODE attribute of the network map candidate optional Previously UN-LOCODE attribute was required for each network map candidate. In the absence of this attribute, the candidate was not allowed into the network map. After revising the requirements for candidates, it was decided not to require the mandatory installation of the attribute by candidates. From now inner ring does not modify location attributes of the network map candidate in the absence of UN-LOCODE attribute and does not block entry into the network map for this criterion. Signed-off-by: Leonard Lyubich --- .../processors/netmap/nodevalidation/locode/calls.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pkg/innerring/processors/netmap/nodevalidation/locode/calls.go b/pkg/innerring/processors/netmap/nodevalidation/locode/calls.go index 3c4ad6ea..fa38394b 100644 --- a/pkg/innerring/processors/netmap/nodevalidation/locode/calls.go +++ b/pkg/innerring/processors/netmap/nodevalidation/locode/calls.go @@ -6,14 +6,13 @@ import ( "github.com/pkg/errors" ) -var errMissingLocode = errors.New("missing locode attribute") - var errMissingRequiredAttr = errors.New("missing required attribute in DB record") // VerifyAndUpdate validates UN-LOCODE attribute of n // and adds a group of related attributes. // -// If n does not contain UN-LOCODE attribute or its value does not +// If n does not contain UN-LOCODE attribute, nil is returned +// without any actions. Otherwise, if UN-LOCODE value does not // match the UN/LOCODE format, an error returns. // // New attributes are formed from the record of DB instance (Prm). @@ -32,7 +31,7 @@ func (v *Validator) VerifyAndUpdate(n *netmap.NodeInfo) error { attrLocode, ok := mAttr[netmap.AttrUNLOCODE] if !ok { - return errMissingLocode + return nil } lc, err := locode.FromString(attrLocode.Value())