Skip to content

Commit

Permalink
default missing junos_evpn_irb_mode in CreateSecurityZone()
Browse files Browse the repository at this point in the history
  • Loading branch information
chrismarget-j committed Nov 1, 2023
1 parent 81c7596 commit 596cb09
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions apstra/two_stage_l3_clos_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 596cb09

Please sign in to comment.