From 57e0a5caf2e646fc22507ed7cb354eea29e43a51 Mon Sep 17 00:00:00 2001 From: Sergei Lukianov Date: Fri, 10 Nov 2023 13:37:54 -0800 Subject: [PATCH] Explicit list of switch roles and IsSpine helper --- api/wiring/v1alpha2/switch_types.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/api/wiring/v1alpha2/switch_types.go b/api/wiring/v1alpha2/switch_types.go index 8c3127ba..8a289508 100644 --- a/api/wiring/v1alpha2/switch_types.go +++ b/api/wiring/v1alpha2/switch_types.go @@ -38,6 +38,16 @@ const ( SwitchRoleBorderLeaf SwitchRole = "border-leaf" ) +var SwitchRoles = []SwitchRole{ + SwitchRoleSpine, + SwitchRoleServerLeaf, + SwitchRoleBorderLeaf, +} + +func (r SwitchRole) IsSpine() bool { + return r == SwitchRoleSpine +} + func (r SwitchRole) IsLeaf() bool { return r == SwitchRoleServerLeaf || r == SwitchRoleBorderLeaf }