summaryrefslogtreecommitdiffhomepage
path: root/table/path.go
diff options
context:
space:
mode:
Diffstat (limited to 'table/path.go')
-rw-r--r--table/path.go20
1 files changed, 18 insertions, 2 deletions
diff --git a/table/path.go b/table/path.go
index ffbdd902..6c2995a8 100644
--- a/table/path.go
+++ b/table/path.go
@@ -35,6 +35,7 @@ type Path interface {
GetRouteFamily() bgp.RouteFamily
GetAsPathLen() int
GetAsList() []uint32
+ GetAsSeqList() []uint32
setSource(source *PeerInfo)
GetSource() *PeerInfo
GetSourceAs() uint32
@@ -363,14 +364,29 @@ func (pd *PathDefault) GetAsPathLen() int {
}
func (pd *PathDefault) GetAsList() []uint32 {
+ return pd.getAsListofSpecificType(true, true)
+
+}
+
+func (pd *PathDefault) GetAsSeqList() []uint32 {
+ return pd.getAsListofSpecificType(true, false)
+
+}
+
+func (pd *PathDefault) getAsListofSpecificType(getAsSeq, getAsSet bool) []uint32 {
asList := []uint32{}
if _, attr := pd.getPathAttr(bgp.BGP_ATTR_TYPE_AS_PATH); attr != nil {
aspath := attr.(*bgp.PathAttributeAsPath)
for _, paramIf := range aspath.Value {
segment := paramIf.(*bgp.As4PathParam)
- asList = append(asList, segment.AS...)
+ if getAsSeq && segment.Type == bgp.BGP_ASPATH_ATTR_TYPE_SEQ{
+ asList = append(asList, segment.AS...)
+ continue
+ }
+ if getAsSet && segment.Type == bgp.BGP_ASPATH_ATTR_TYPE_SET{
+ asList = append(asList, segment.AS...)
+ }
}
-
}
return asList
}