Skip to content

Commit 5f0230e

Browse files
authored
Extract local AS from peer xml (#245)
1 parent df450a0 commit 5f0230e

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

pkg/features/bgp/helper.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,13 @@ func localASNForPeer(p peer) string {
4545
return strconv.FormatInt(p.OptionInformation.LocalAs, 10)
4646
}
4747

48-
return strconv.FormatInt(p.OptionInformation.LocalSystemAs, 10)
48+
if p.OptionInformation.LocalSystemAs > 0 {
49+
return strconv.FormatInt(p.OptionInformation.LocalSystemAs, 10)
50+
}
51+
52+
if p.LocalASN > 0 {
53+
return strconv.FormatInt(p.LocalASN, 10)
54+
}
55+
56+
return "unknown"
4957
}

pkg/features/bgp/rpc.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ type peer struct {
1212
CFGRTI string `xml:"peer-cfg-rti"`
1313
IP string `xml:"peer-address"`
1414
ASN string `xml:"peer-as"`
15+
LocalASN int64 `xml:"local-as"`
1516
State string `xml:"peer-state"`
1617
Group string `xml:"peer-group"`
1718
GroupIndex int64 `xml:"peer-group-index"`

0 commit comments

Comments
 (0)