summaryrefslogtreecommitdiffhomepage
path: root/table/path.go
diff options
context:
space:
mode:
authorISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>2015-08-27 00:04:39 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2015-08-27 00:51:19 +0900
commit319841ac5ec46c9e26517c83b56800155fb1498b (patch)
tree9b1948f83995737b2c8840fe6077e155defbb679 /table/path.go
parent51494759aded7098e151869e66dd5b2c4d96ecfd (diff)
api: add route family field to struct Path
we can't parse Path.nlri field (whose type is []byte) without route family. Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'table/path.go')
-rw-r--r--table/path.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/table/path.go b/table/path.go
index bc982cec..62f0e437 100644
--- a/table/path.go
+++ b/table/path.go
@@ -143,7 +143,9 @@ func (path *Path) IsIBGP() bool {
}
func (path *Path) ToApiStruct() *api.Path {
- nlri, _ := path.GetNlri().Serialize()
+ nlri := path.GetNlri()
+ n, _ := nlri.Serialize()
+ rf := uint32(bgp.AfiSafiToRouteFamily(nlri.AFI(), nlri.SAFI()))
pattrs := func(arg []bgp.PathAttributeInterface) [][]byte {
ret := make([][]byte, 0, len(arg))
for _, a := range arg {
@@ -153,11 +155,12 @@ func (path *Path) ToApiStruct() *api.Path {
return ret
}(path.GetPathAttrs())
return &api.Path{
- Nlri: nlri,
+ Nlri: n,
Pattrs: pattrs,
Age: int64(time.Now().Sub(path.timestamp).Seconds()),
IsWithdraw: path.IsWithdraw,
Validation: int32(path.Validation),
+ Rf: rf,
}
}