summaryrefslogtreecommitdiffhomepage
path: root/table/path.go
diff options
context:
space:
mode:
Diffstat (limited to 'table/path.go')
-rw-r--r--table/path.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/table/path.go b/table/path.go
index 0b8f732a..1fd15308 100644
--- a/table/path.go
+++ b/table/path.go
@@ -16,6 +16,8 @@
package table
import (
+ "bytes"
+ "encoding/json"
"fmt"
log "github.com/Sirupsen/logrus"
"github.com/osrg/gobgp/api"
@@ -456,3 +458,18 @@ func (path *Path) SetMed(med int64, doReplace bool) error {
}
return nil
}
+
+func (lhs *Path) Equal(rhs *Path) bool {
+ if rhs == nil {
+ return false
+ } else if lhs == rhs {
+ return true
+ }
+ f := func(p *Path) []byte {
+ s := p.ToApiStruct()
+ s.Age = 0
+ buf, _ := json.Marshal(s)
+ return buf
+ }
+ return bytes.Equal(f(lhs), f(rhs))
+}