From ed2013c9b802281aceb741dc9893294acce194f8 Mon Sep 17 00:00:00 2001 From: Kevin Petremann Date: Tue, 20 Feb 2024 15:27:25 +0100 Subject: [PATCH 1/2] refactor: peer group is now optional Peer group support is deprecated in AFK. We keep them only to help to migrate. --- internal/convertor/device/device.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/convertor/device/device.go b/internal/convertor/device/device.go index 7f7af72..55a4752 100644 --- a/internal/convertor/device/device.go +++ b/internal/convertor/device/device.go @@ -14,6 +14,7 @@ import ( "github.com/criteo/data-aggregation-api/internal/model/dcim" "github.com/criteo/data-aggregation-api/internal/model/openconfig" "github.com/openconfig/ygot/ygot" + "github.com/rs/zerolog/log" ) const AFKEnabledTag = "afk-enabled" @@ -73,7 +74,7 @@ func NewDevice(dcimInfo *dcim.NetworkDevice, devicesData *repository.AssetsPerDe device.PeerGroups, ok = devicesData.PeerGroups[dcimInfo.Hostname] if !ok { - return nil, fmt.Errorf("no peer-groups found for %s", dcimInfo.Hostname) + log.Warn().Msgf("no peer-groups found for %s", dcimInfo.Hostname) } device.PrefixLists, ok = devicesData.PrefixLists[dcimInfo.Hostname] From f292db6d1ab85592a4e521599600dce81c7a7ced Mon Sep 17 00:00:00 2001 From: Kevin Petremann Date: Tue, 20 Feb 2024 15:28:33 +0100 Subject: [PATCH 2/2] refactor: routerID is optional RouterID is optional in the CMDB but was not in the data aggregation api, causing potential build failure. --- internal/model/cmdb/bgp/global.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/model/cmdb/bgp/global.go b/internal/model/cmdb/bgp/global.go index 3775409..238ef12 100644 --- a/internal/model/cmdb/bgp/global.go +++ b/internal/model/cmdb/bgp/global.go @@ -14,5 +14,5 @@ type BGPGlobal struct { GracefulRestartTime *uint16 `json:"graceful_restart_time" validate:"omitempty"` EcmpEnabled *bool `json:"ecmp" validate:"required"` EcmpMaximumPaths *uint32 `json:"ecmp_maximum_paths" validate:"omitempty"` - RouterID string `json:"router_id" validate:"required"` + RouterID string `json:"router_id" validate:"omitempty"` }