From 0b4d858e21d0154f86b7aa8129569076ef870174 Mon Sep 17 00:00:00 2001
From: Maximilian Wilhelm <max@sdn.clinic>
Date: Tue, 3 Jul 2018 16:38:46 +0200
Subject: [PATCH] Print OriginatorID and ClusterList in BGPPath, too.

Signed-off-by: Maximilian Wilhelm <max@sdn.clinic>
---
 route/bgp_path.go | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/route/bgp_path.go b/route/bgp_path.go
index 4b0b852c..6b63916b 100644
--- a/route/bgp_path.go
+++ b/route/bgp_path.go
@@ -242,6 +242,14 @@ func (b *BGPPath) Print() string {
 	ret += fmt.Sprintf("\t\tCommunities: %v\n", b.Communities)
 	ret += fmt.Sprintf("\t\tLargeCommunities: %v\n", b.LargeCommunities)
 
+	if b.OriginatorID != 0 {
+		oid := uint32To4Byte(b.OriginatorID)
+		ret += fmt.Sprintf("\t\tOriginatorID: %d.%d.%d.%d\n", oid[0], oid[1], oid[2], oid[3])
+	}
+	if b.ClusterList != nil {
+		ret += fmt.Sprintf("\t\tClusterList %s\n", b.ClusterListString())
+	}
+
 	return ret
 }
 
@@ -334,6 +342,17 @@ func (b *BGPPath) CommunitiesString() string {
 	return strings.TrimRight(str, " ")
 }
 
+// ClusterListString returns the formated ClusterList
+func (b *BGPPath) ClusterListString() string {
+	str := ""
+	for _, cid := range b.ClusterList {
+		octes := uint32To4Byte(cid)
+		str += fmt.Sprintf("%d.%d.%d.%d ", octes[0], octes[1], octes[2], octes[3])
+	}
+
+	return strings.TrimRight(str, " ")
+}
+
 // LargeCommunitiesString returns the formated communities
 func (b *BGPPath) LargeCommunitiesString() string {
 	str := ""
-- 
GitLab