summaryrefslogtreecommitdiffhomepage
path: root/table/path.go
diff options
context:
space:
mode:
Diffstat (limited to 'table/path.go')
-rw-r--r--table/path.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/table/path.go b/table/path.go
index 6c2995a8..305a80e1 100644
--- a/table/path.go
+++ b/table/path.go
@@ -36,6 +36,7 @@ type Path interface {
GetAsPathLen() int
GetAsList() []uint32
GetAsSeqList() []uint32
+ GetCommunities() []uint32
setSource(source *PeerInfo)
GetSource() *PeerInfo
GetSourceAs() uint32
@@ -391,6 +392,15 @@ func (pd *PathDefault) getAsListofSpecificType(getAsSeq, getAsSet bool) []uint32
return asList
}
+func (pd *PathDefault) GetCommunities() []uint32 {
+ communityList := []uint32{}
+ if _, attr := pd.getPathAttr(bgp.BGP_ATTR_TYPE_COMMUNITIES); attr != nil {
+ communities := attr.(*bgp.PathAttributeCommunities)
+ communityList = append(communityList, communities.Value...)
+ }
+ return communityList
+}
+
// create Path object based on route family
func CreatePath(source *PeerInfo, nlri bgp.AddrPrefixInterface, attrs []bgp.PathAttributeInterface, isWithdraw bool, now time.Time) (Path, error) {