From 6359852e061dc8400f650f96317ec8c729404d2d Mon Sep 17 00:00:00 2001 From: Chris Marget Date: Thu, 24 Oct 2024 14:12:21 -0400 Subject: [PATCH] add missing VNI extraction in VN unmarshal --- apstra/two_stage_l3_clos_virtual_networks.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/apstra/two_stage_l3_clos_virtual_networks.go b/apstra/two_stage_l3_clos_virtual_networks.go index 053fff4..88e4692 100644 --- a/apstra/two_stage_l3_clos_virtual_networks.go +++ b/apstra/two_stage_l3_clos_virtual_networks.go @@ -307,6 +307,14 @@ func (o *VirtualNetwork) UnmarshalJSON(bytes []byte) error { o.Data.VirtualGatewayIpv6Enabled = raw.VirtualGatewayIpv6Enabled o.Data.VnBindings = raw.VnBindings + if raw.VnId != "" { + vnId, err := strconv.Atoi(raw.VnId) + if err != nil { + return fmt.Errorf("while parsing virtual network data vn_id %q - %w", raw.VnId, err) + } + o.Data.VnId = (*VNI)(toPtr(uint32(vnId))) + } + err = o.Data.VnType.FromString(raw.VnType) if err != nil { return fmt.Errorf("while parsing virtual network data vn_type %q - %w", raw.VnType, err)