From 596cb09ef6bbd35e06ece2bbbb4b27778107b307 Mon Sep 17 00:00:00 2001 From: Chris Marget Date: Wed, 1 Nov 2023 15:03:18 -0400 Subject: [PATCH] default missing `junos_evpn_irb_mode` in `CreateSecurityZone()` --- apstra/two_stage_l3_clos_client.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/apstra/two_stage_l3_clos_client.go b/apstra/two_stage_l3_clos_client.go index 967b11e9..117cb304 100644 --- a/apstra/two_stage_l3_clos_client.go +++ b/apstra/two_stage_l3_clos_client.go @@ -147,13 +147,17 @@ func (o *TwoStageL3ClosClient) SetInterfaceMapAssignments(ctx context.Context, a return o.setInterfaceMapAssignments(ctx, assignments) } -// CreateSecurityZone creates an Apstra Routing Zone / Security Zone / VRF +// CreateSecurityZone creates an Apstra Routing Zone / Security Zone / VRF. +// If cfg.JunosEvpnIrbMode is omitted, but the API's version-dependent behavior +// requires that field, it will be set to JunosEvpnIrbModeAsymmetric in the +// request sent to the API. func (o *TwoStageL3ClosClient) CreateSecurityZone(ctx context.Context, cfg *SecurityZoneData) (ObjectId, error) { - if cfg.JunosEvpnIrbMode == nil && securityZoneJunosEvpnIrbModeRequired().Includes(o.client.apiVersion) { - return "", errors.New(securityZoneJunosEvpnIrbModeRequiredError) + raw := cfg.raw() + if raw.JunosEvpnIrbMode == "" && securityZoneJunosEvpnIrbModeRequired().Includes(o.client.apiVersion) { + raw.JunosEvpnIrbMode = JunosEvpnIrbModeAsymmetric.Value } - response, err := o.createSecurityZone(ctx, cfg.raw()) + response, err := o.createSecurityZone(ctx, raw) if err != nil { return "", err }