diff options
author | Wataru Ishida <ishida.wataru@lab.ntt.co.jp> | 2016-09-18 05:06:18 +0000 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2017-07-04 15:02:10 +0900 |
commit | 87f0b0bdc52945ae98ef6d44b7f118216bde95ca (patch) | |
tree | 668e91c266c290ea0130dd71b7f8403ab62e6d30 /api/util.go | |
parent | 454fd93ef707c530b3ece04ef4727ad1f7371d4b (diff) |
api/cli: support showing path-identifier
$ gobgp neighbor <neighbor address>
ID Network Next Hop AS_PATH Age Attrs
2 10.0.0.10/32 10.10.1.2 01:05:35 [{Origin: i} {LocalPref: 100}]
1 10.0.0.10/32 10.10.1.1 01:05:35 [{Origin: i} {LocalPref: 100}]
3 10.1.0.10/32 10.10.1.3 01:05:35 [{Origin: i} {LocalPref: 100}]
Signed-off-by: Wataru Ishida <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'api/util.go')
-rw-r--r-- | api/util.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/api/util.go b/api/util.go index ea385862..dabb65b7 100644 --- a/api/util.go +++ b/api/util.go @@ -70,7 +70,13 @@ func (d *Destination) ToNativeDestination(option ...ToNativeOption) (*table.Dest }) paths := make([]*table.Path, 0, len(d.Paths)) for _, p := range d.Paths { - path, err := p.ToNativePath(option...) + var path *table.Path + var err error + if p.Identifier > 0 { + path, err = p.ToNativePath() + } else { + path, err = p.ToNativePath(option...) + } if err != nil { return nil, err } @@ -113,6 +119,7 @@ func (p *Path) ToNativePath(option ...ToNativeOption) (*table.Path, error) { pattr = append(pattr, p) } t := time.Unix(p.Age, 0) + nlri.SetPathIdentifier(p.Identifier) path := table.NewPath(info, nlri, p.IsWithdraw, pattr, t, false) path.SetValidation(config.IntToRpkiValidationResultTypeMap[int(p.Validation)]) path.MarkStale(p.Stale) |