summaryrefslogtreecommitdiffhomepage
path: root/table/path.go
diff options
context:
space:
mode:
authorHiroshi Yokoi <yokoi.hiroshi@po.ntts.co.jp>2015-05-19 19:41:40 +0900
committerHiroshi Yokoi <yokoi.hiroshi@po.ntts.co.jp>2015-05-19 20:14:43 +0900
commitb549c670b1fa749bd047e649d77091221d348c47 (patch)
tree160935a939391fe719817f3e9eb94f2c202368c4 /table/path.go
parentf91a3a61b48fb7a3aad6aac492d487fb72b32a34 (diff)
policy: support community condition
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) {