Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jhgiii opened this issue Sep 8, 2022 · 1 comment
Open

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

jhgiii opened this issue Sep 8, 2022 · 1 comment

Comments

@jhgiii
Copy link

jhgiii commented Sep 8, 2022

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

@ljluestc
Copy link

package main

import (
	"fmt"

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

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

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)
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants