aristanetworks / aristanetworks/goeapi

VRF Type has ASN as int64 type but EAPI returns a string type

Open
#54 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
60
Forks
36
PR merge metrics
No merged PRs in 30d

Description

package main

import (
"fmt"

"github.com/aristanetworks/goeapi"
"github.com/aristanetworks/goeapi/module"
)

func main() {
node, err := goeapi.ConnectTo("sp1")
if err != nil {
panic(err)
}
s := module.Show(node)
showData, err := s.ShowIPBGPSummary()
if err != nil {
fmt.Println(err)
}
fmt.Printf("%v", showData.VRFs)
}

When running I received the following error:

1 error(s) decoding:

* 'VRFs[default].asn' expected type 'int64', got unconvertible type 'string', value: '65001'

Looking through the code base, I see the following struct:

type VRF struct {
RouterID string `json:"routerId"`
Peers map[string]BGPNeighborSummary `json:"peers"`
VRF string `json:"vrf"`
ASN int64 `json:"asn"`
}

It may be safer to expect a string type

Contributor guide

Open the contributing guide

Research direction

Start at module.Show(node).ShowIPBGPSummary and locate the VRF struct shown in the report. Reproduce the decoding failure with an EAPI response where asn is "65001", then verify the chosen ASN representation against the returned data. Done means the response decodes without the reported type error and the behavior is covered by an appropriate test.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
api
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.