From dd44f1a79aeddca3844a44802fec4831a2472917 Mon Sep 17 00:00:00 2001 From: Sergei Lukianov Date: Wed, 13 Dec 2023 17:19:30 -0800 Subject: [PATCH] [api] ignore switch vtep ip for non spine leaf --- api/wiring/v1alpha2/switch_types.go | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/api/wiring/v1alpha2/switch_types.go b/api/wiring/v1alpha2/switch_types.go index fca5d91f..5fc2eece 100644 --- a/api/wiring/v1alpha2/switch_types.go +++ b/api/wiring/v1alpha2/switch_types.go @@ -166,13 +166,8 @@ func (sw *Switch) Validate(ctx context.Context, client validation.Client, spineL if sw.Spec.ProtocolIP == "" { return nil, errors.Errorf("protocol IP is required") } - if sw.Spec.Role.IsLeaf() { - if spineLeaf && sw.Spec.VTEPIP == "" { - return nil, errors.Errorf("VTEP IP is required for leaf switches in spine-leaf mode") - } - if !spineLeaf && sw.Spec.VTEPIP != "" { - return nil, errors.Errorf("VTEP IP is not allowed for leaf switches in non spine-leaf mode") - } + if sw.Spec.Role.IsLeaf() && spineLeaf && sw.Spec.VTEPIP == "" { + return nil, errors.Errorf("VTEP IP is required for leaf switches in spine-leaf mode") } if sw.Spec.Role.IsSpine() && sw.Spec.VTEPIP != "" { return nil, errors.Errorf("VTEP IP is not allowed for spine switches")