diff options
Diffstat (limited to 'table')
-rw-r--r-- | table/destination.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/table/destination.go b/table/destination.go index 7d3fe487..f5d30f29 100644 --- a/table/destination.go +++ b/table/destination.go @@ -22,6 +22,7 @@ import ( "fmt" log "github.com/Sirupsen/logrus" api "github.com/osrg/gobgp/api" + "github.com/osrg/gobgp/config" "github.com/osrg/gobgp/packet" "net" ) @@ -103,6 +104,18 @@ func (i *PeerInfo) String() string { return s.String() } +func NewPeerInfo(g *config.Global, p *config.Neighbor) *PeerInfo { + id := net.ParseIP(string(p.RouteReflector.RouteReflectorConfig.RouteReflectorClusterId)).To4() + return &PeerInfo{ + AS: p.NeighborConfig.PeerAs, + LocalAS: g.GlobalConfig.As, + LocalID: g.GlobalConfig.RouterId, + Address: p.NeighborConfig.NeighborAddress, + RouteReflectorClient: p.RouteReflector.RouteReflectorConfig.RouteReflectorClient, + RouteReflectorClusterID: id, + } +} + type Destination struct { routeFamily bgp.RouteFamily nlri bgp.AddrPrefixInterface |