From dbfc68b2fd37bc6004a79122c9ea6b3eadb52c7d Mon Sep 17 00:00:00 2001 From: Will George Date: Wed, 1 May 2024 03:37:10 -0400 Subject: [PATCH] update GoBGP to v3.26.0 --- go.mod | 10 ++-- go.sum | 58 +++++-------------- pkg/sources/gobgp/apiutil/attribute.go | 60 ++++++++++---------- pkg/sources/gobgp/apiutil/attribute_test.go | 30 +++++----- pkg/sources/gobgp/apiutil/capability.go | 16 +++--- pkg/sources/gobgp/apiutil/capability_test.go | 10 ++-- pkg/sources/gobgp/apiutil/util.go | 4 +- pkg/sources/gobgp/routes.go | 4 +- pkg/sources/gobgp/source.go | 4 +- pkg/sources/gobgp/utils.go | 4 +- 10 files changed, 85 insertions(+), 115 deletions(-) diff --git a/go.mod b/go.mod index 5c31798..54a5174 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/golang/protobuf v1.5.3 github.com/jackc/pgx/v4 v4.18.1 github.com/julienschmidt/httprouter v1.3.0 - github.com/osrg/gobgp v0.0.0-20190502094614-fd6618fed499 + github.com/osrg/gobgp/v3 v3.26.0 github.com/sirupsen/logrus v1.9.3 github.com/stretchr/testify v1.8.4 google.golang.org/grpc v1.60.1 @@ -24,11 +24,11 @@ require ( github.com/jackc/pgtype v1.14.0 // indirect github.com/jackc/puddle v1.3.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - golang.org/x/crypto v0.18.0 // indirect - golang.org/x/net v0.20.0 // indirect - golang.org/x/sys v0.16.0 // indirect + golang.org/x/crypto v0.21.0 // indirect + golang.org/x/net v0.23.0 // indirect + golang.org/x/sys v0.18.0 // indirect golang.org/x/text v0.14.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240108191215-35c7eff3a6b1 // indirect - google.golang.org/protobuf v1.32.0 // indirect + google.golang.org/protobuf v1.33.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 1678c9f..89816f2 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,5 @@ -github.com/BurntSushi/toml v0.3.0/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= -github.com/armon/go-radix v0.0.0-20170727155443-1fca145dffbc/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I= github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ= github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= @@ -10,26 +8,20 @@ github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7Do github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dgryski/go-farm v0.0.0-20171119141306-ac7624ea8da3/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= -github.com/eapache/channels v1.1.0/go.mod h1:jMm2qB5Ubtg9zLd+inMZd2/NUvXgzmWXsDaLyQIGfH0= -github.com/eapache/queue v1.0.2/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= -github.com/fsnotify/fsnotify v1.4.2/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/go-ini/ini v1.67.0 h1:z6ZrTEZqSWOTyH2FlglNbNgARyHG8oLW9gMELqKr06A= github.com/go-ini/ini v1.67.0/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8= github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/go-test/deep v1.1.0 h1:WOcxcdHcvdgThNXjw0t76K42FXTU7HpNQWHpA2HHNlg= github.com/gofrs/uuid v4.0.0+incompatible h1:1SD/1F5pU8p29ybwgQSwpQk+mwdRrXCYuPhW6m+TnJw= github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= -github.com/golang/protobuf v1.0.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/hashicorp/hcl v0.0.0-20170509225359-392dba7d905e/go.mod h1:oZtUIOe8dh44I2q6ScRibXws4Ajl+d+nod3AaR9vL5w= -github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/jackc/chunkreader v1.0.0/go.mod h1:RT6O25fNZIuasFJRyZ4R/Y2BbhasbmZXF9QQ7T3kePo= github.com/jackc/chunkreader/v2 v2.0.0/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk= github.com/jackc/chunkreader/v2 v2.0.1 h1:i+RDz65UE+mmpjTfyz0MoVTnzeYxroil2G82ki7MGG8= @@ -81,66 +73,51 @@ github.com/jackc/puddle v0.0.0-20190608224051-11cab39313c9/go.mod h1:m4B5Dj62Y0f github.com/jackc/puddle v1.1.3/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jackc/puddle v1.3.0 h1:eHK/5clGOatcjX3oWGBO/MpxpbHzSwud5EWTSCI+MX0= github.com/jackc/puddle v1.3.0/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= -github.com/jessevdk/go-flags v1.3.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/julienschmidt/httprouter v1.3.0 h1:U0609e9tgbseu3rBINet9P48AI/D3oJs4dN7jwJOQ1U= github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/kr/pretty v0.0.0-20160823170715-cfb55aafdaf3/go.mod h1:Bvhd+E3laJ0AVkG0c9rmtZcnhV0HQ3+c3YxxqTvc/gA= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw= -github.com/kr/text v0.0.0-20160504234017-7cafcd837844/go.mod h1:sjUstKUATFIcff4qlB53Kml0wQPtJVc/3fWrmuUmcfA= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.1.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.10.2 h1:AqzbZs4ZoCBp+GtejcpCpcxM3zlSMx29dXbUSeVtJb8= github.com/lib/pq v1.10.2/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= -github.com/magiconair/properties v1.7.3/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= -github.com/mitchellh/mapstructure v0.0.0-20170523030023-d0303fe80992/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/osrg/gobgp v0.0.0-20190502094614-fd6618fed499 h1:uukk7LjpCIRDOnLORZG8m39q9y47SNsi56w0oUj3Xrg= -github.com/osrg/gobgp v0.0.0-20190502094614-fd6618fed499/go.mod h1:ORFhbKMbE5PuTrFOETR32zPLBMJUGIP1uMOqVyEhTAU= -github.com/pelletier/go-buffruneio v0.2.0/go.mod h1:JkE26KsDizTr40EUHkXVtNPvgGtbSNq5BcowyYOWdKo= -github.com/pelletier/go-toml v1.0.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/osrg/gobgp/v3 v3.26.0 h1:/iHaQKNgp0dRI3/RGt/j60aUeoGng6CL0VATVfQXEPE= +github.com/osrg/gobgp/v3 v3.26.0/go.mod h1:ZGeSti9mURR/o5hf5R6T1FM5g1yiEBZbhP+TuqYJUpI= github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU= github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc= -github.com/satori/go.uuid v0.0.0-20180103174451-36e9d2ebbde5/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4= github.com/shopspring/decimal v1.2.0 h1:abSATXmQEYyShuxI4/vyW3tV1MrKAJzCZ/0zLUXYbsQ= github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= -github.com/sirupsen/logrus v0.0.0-20170713114250-a3f95b5c4235/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc= github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= -github.com/spf13/afero v0.0.0-20170217164146-9be650865eab/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= -github.com/spf13/cast v1.1.0/go.mod h1:r2rcYCSwa1IExKTDiTfzaxqT2FNHs8hODu4LnUfgKEg= -github.com/spf13/cobra v0.0.0-20170731170427-b26b538f6930/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= -github.com/spf13/jwalterweatherman v0.0.0-20170523133247-0efa5202c046/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= -github.com/spf13/pflag v1.0.0/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/viper v1.0.0/go.mod h1:A8kyI5cUJhb8N+3pkfONlcEcZbueH6nhAm0Fq7SrnBM= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -github.com/stretchr/testify v1.1.4/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= @@ -151,8 +128,6 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/vishvananda/netlink v0.0.0-20170802012344-a95659537721/go.mod h1:+SR5DhBJrl6ZM7CoCKvpw5BKroDKQ+PJqOg65H/2ktk= -github.com/vishvananda/netns v0.0.0-20170707011535-86bef332bfc3/go.mod h1:ZjcWmFBXmLKZu9Nxj3WKYEafiSqer2rnvPr0en9UNpI= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= @@ -177,8 +152,8 @@ golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= -golang.org/x/crypto v0.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc= -golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg= +golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA= +golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= @@ -190,16 +165,14 @@ golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo= -golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= -golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs= +golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190405154228-4b34438f7a67/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -212,8 +185,8 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= -golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= +golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -243,22 +216,19 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/genproto v0.0.0-20170731182057-09f6ed296fc6/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto/googleapis/rpc v0.0.0-20240108191215-35c7eff3a6b1 h1:gphdwh0npgs8elJ4T6J+DQJHPVF7RsuJHCfwztUb4J4= google.golang.org/genproto/googleapis/rpc v0.0.0-20240108191215-35c7eff3a6b1/go.mod h1:daQN87bsDqDoe316QbbvX60nMoJQa4r6Ds0ZuoAe5yA= -google.golang.org/grpc v1.5.1/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.60.1 h1:26+wFr+cNqSGFcOXcabYC0lUVJVRa2Sb2ortSK7VrEU= google.golang.org/grpc v1.60.1/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= -google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/inconshreveable/log15.v2 v2.0.0-20180818164646-67afb5ed74ec/go.mod h1:aPpfJ7XW+gOuirDoZ8gHhLh3kZ1B08FtV2bbmy7Jv3s= -gopkg.in/yaml.v2 v2.0.0-20170721122051-25c4ec802a7d/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/pkg/sources/gobgp/apiutil/attribute.go b/pkg/sources/gobgp/apiutil/attribute.go index 2985f9f..efb34df 100644 --- a/pkg/sources/gobgp/apiutil/attribute.go +++ b/pkg/sources/gobgp/apiutil/attribute.go @@ -23,8 +23,8 @@ import ( "github.com/golang/protobuf/proto" "github.com/golang/protobuf/ptypes" "github.com/golang/protobuf/ptypes/any" - api "github.com/osrg/gobgp/api" - "github.com/osrg/gobgp/pkg/packet/bgp" + api "github.com/osrg/gobgp/v3/api" + "github.com/osrg/gobgp/v3/pkg/packet/bgp" log "github.com/sirupsen/logrus" ) @@ -59,7 +59,7 @@ func UnmarshalAttribute(an *any.Any) (bgp.PathAttributeInterface, error) { if net.ParseIP(a.Address).To4() == nil { return nil, fmt.Errorf("invalid aggregator address: %s", a.Address) } - return bgp.NewPathAttributeAggregator(a.As, a.Address), nil + return bgp.NewPathAttributeAggregator(a.Asn, a.Address), nil case *api.CommunitiesAttribute: return bgp.NewPathAttributeCommunities(a.Communities), nil case *api.OriginatorIdAttribute: @@ -90,7 +90,7 @@ func NewAsPathAttributeFromNative(a *bgp.PathAttributeAsPath) *api.AsPathAttribu segments := make([]*api.AsSegment, 0, len(a.Value)) for _, param := range a.Value { segments = append(segments, &api.AsSegment{ - Type: uint32(param.GetType()), + Type: api.AsSegment_Type(param.GetType()), Numbers: param.GetAS(), }) } @@ -128,7 +128,7 @@ func NewAtomicAggregateAttributeFromNative(a *bgp.PathAttributeAtomicAggregate) // NewAggregatorAttributeFromNative creates a new aggregator attribute func NewAggregatorAttributeFromNative(a *bgp.PathAttributeAggregator) *api.AggregatorAttribute { return &api.AggregatorAttribute{ - As: a.Value.AS, + Asn: a.Value.AS, Address: a.Value.Address.String(), } } @@ -163,7 +163,7 @@ func MarshalRD(rd bgp.RouteDistinguisherInterface) *any.Any { var r proto.Message switch v := rd.(type) { case *bgp.RouteDistinguisherTwoOctetAS: - r = &api.RouteDistinguisherTwoOctetAS{ + r = &api.RouteDistinguisherTwoOctetASN{ Admin: uint32(v.Admin), Assigned: v.Assigned, } @@ -173,7 +173,7 @@ func MarshalRD(rd bgp.RouteDistinguisherInterface) *any.Any { Assigned: uint32(v.Assigned), } case *bgp.RouteDistinguisherFourOctetAS: - r = &api.RouteDistinguisherFourOctetAS{ + r = &api.RouteDistinguisherFourOctetASN{ Admin: v.Admin, Assigned: uint32(v.Assigned), } @@ -195,7 +195,7 @@ func UnmarshalRD(a *any.Any) (bgp.RouteDistinguisherInterface, error) { return nil, fmt.Errorf("failed to unmarshal route distinguisher: %s", err) } switch v := value.Message.(type) { - case *api.RouteDistinguisherTwoOctetAS: + case *api.RouteDistinguisherTwoOctetASN: return bgp.NewRouteDistinguisherTwoOctetAS(uint16(v.Admin), v.Assigned), nil case *api.RouteDistinguisherIPAddress: rd := bgp.NewRouteDistinguisherIPAddressAS(v.Admin, uint16(v.Assigned)) @@ -203,7 +203,7 @@ func UnmarshalRD(a *any.Any) (bgp.RouteDistinguisherInterface, error) { return nil, fmt.Errorf("invalid address for route distinguisher: %s", v.Admin) } return rd, nil - case *api.RouteDistinguisherFourOctetAS: + case *api.RouteDistinguisherFourOctetASN: return bgp.NewRouteDistinguisherFourOctetAS(v.Admin, uint16(v.Assigned)), nil } return nil, fmt.Errorf("invalid route distinguisher type: %s", a.TypeUrl) @@ -427,8 +427,8 @@ func MarshalNLRI(value bgp.AddrPrefixInterface) *any.Any { } case *bgp.RouteTargetMembershipNLRI: nlri = &api.RouteTargetMembershipNLRI{ - As: v.AS, - Rt: MarshalRT(v.RouteTarget), + Asn: v.AS, + Rt: MarshalRT(v.RouteTarget), } case *bgp.FlowSpecIPv4Unicast: nlri = &api.FlowSpecNLRI{ @@ -571,7 +571,7 @@ func UnmarshalNLRI(rf bgp.RouteFamily, an *any.Any) (bgp.AddrPrefixInterface, er if err != nil { return nil, err } - nlri = bgp.NewRouteTargetMembershipNLRI(v.As, rt) + nlri = bgp.NewRouteTargetMembershipNLRI(v.Asn, rt) case *api.FlowSpecNLRI: rules, err := UnmarshalFlowSpecRules(v.Rules) if err != nil { @@ -656,7 +656,7 @@ func MarshalRT(rt bgp.ExtendedCommunityInterface) *any.Any { r = &api.TwoOctetAsSpecificExtended{ IsTransitive: true, SubType: uint32(bgp.EC_SUBTYPE_ROUTE_TARGET), - As: uint32(v.AS), + Asn: uint32(v.AS), LocalAdmin: uint32(v.LocalAdmin), } case *bgp.IPv4AddressSpecificExtended: @@ -670,7 +670,7 @@ func MarshalRT(rt bgp.ExtendedCommunityInterface) *any.Any { r = &api.FourOctetAsSpecificExtended{ IsTransitive: true, SubType: uint32(bgp.EC_SUBTYPE_ROUTE_TARGET), - As: uint32(v.AS), + Asn: uint32(v.AS), LocalAdmin: uint32(v.LocalAdmin), } default: @@ -701,7 +701,7 @@ func UnmarshalRT(a *any.Any) (bgp.ExtendedCommunityInterface, error) { } switch v := value.Message.(type) { case *api.TwoOctetAsSpecificExtended: - return bgp.NewTwoOctetAsSpecificExtended(bgp.ExtendedCommunityAttrSubType(v.SubType), uint16(v.As), v.LocalAdmin, v.IsTransitive), nil + return bgp.NewTwoOctetAsSpecificExtended(bgp.ExtendedCommunityAttrSubType(v.SubType), uint16(v.Asn), v.LocalAdmin, v.IsTransitive), nil case *api.IPv4AddressSpecificExtended: rt := bgp.NewIPv4AddressSpecificExtended(bgp.ExtendedCommunityAttrSubType(v.SubType), v.Address, uint16(v.LocalAdmin), v.IsTransitive) if rt == nil { @@ -709,7 +709,7 @@ func UnmarshalRT(a *any.Any) (bgp.ExtendedCommunityInterface, error) { } return rt, nil case *api.FourOctetAsSpecificExtended: - return bgp.NewFourOctetAsSpecificExtended(bgp.ExtendedCommunityAttrSubType(v.SubType), v.As, uint16(v.LocalAdmin), v.IsTransitive), nil + return bgp.NewFourOctetAsSpecificExtended(bgp.ExtendedCommunityAttrSubType(v.SubType), v.Asn, uint16(v.LocalAdmin), v.IsTransitive), nil } return nil, fmt.Errorf("invalid route target type: %s", a.TypeUrl) } @@ -737,7 +737,7 @@ func NewExtendedCommunitiesAttributeFromNative(a *bgp.PathAttributeExtendedCommu community = &api.TwoOctetAsSpecificExtended{ IsTransitive: v.IsTransitive, SubType: uint32(v.SubType), - As: uint32(v.AS), + Asn: uint32(v.AS), LocalAdmin: uint32(v.LocalAdmin), } case *bgp.IPv4AddressSpecificExtended: @@ -751,7 +751,7 @@ func NewExtendedCommunitiesAttributeFromNative(a *bgp.PathAttributeExtendedCommu community = &api.FourOctetAsSpecificExtended{ IsTransitive: v.IsTransitive, SubType: uint32(v.SubType), - As: uint32(v.AS), + Asn: uint32(v.AS), LocalAdmin: uint32(v.LocalAdmin), } case *bgp.ValidationExtended: @@ -793,7 +793,7 @@ func NewExtendedCommunitiesAttributeFromNative(a *bgp.PathAttributeExtendedCommu } case *bgp.TrafficRateExtended: community = &api.TrafficRateExtended{ - As: uint32(v.AS), + Asn: uint32(v.AS), Rate: v.Rate, } case *bgp.TrafficActionExtended: @@ -803,7 +803,7 @@ func NewExtendedCommunitiesAttributeFromNative(a *bgp.PathAttributeExtendedCommu } case *bgp.RedirectTwoOctetAsSpecificExtended: community = &api.RedirectTwoOctetAsSpecificExtended{ - As: uint32(v.AS), + Asn: uint32(v.AS), LocalAdmin: v.LocalAdmin, } case *bgp.RedirectIPv4AddressSpecificExtended: @@ -813,7 +813,7 @@ func NewExtendedCommunitiesAttributeFromNative(a *bgp.PathAttributeExtendedCommu } case *bgp.RedirectFourOctetAsSpecificExtended: community = &api.RedirectFourOctetAsSpecificExtended{ - As: v.AS, + Asn: v.AS, LocalAdmin: uint32(v.LocalAdmin), } case *bgp.TrafficRemarkExtended: @@ -850,11 +850,11 @@ func unmarshalExComm(a *api.ExtendedCommunitiesAttribute) (*bgp.PathAttributeExt } switch v := value.Message.(type) { case *api.TwoOctetAsSpecificExtended: - community = bgp.NewTwoOctetAsSpecificExtended(bgp.ExtendedCommunityAttrSubType(v.SubType), uint16(v.As), v.LocalAdmin, v.IsTransitive) + community = bgp.NewTwoOctetAsSpecificExtended(bgp.ExtendedCommunityAttrSubType(v.SubType), uint16(v.Asn), v.LocalAdmin, v.IsTransitive) case *api.IPv4AddressSpecificExtended: community = bgp.NewIPv4AddressSpecificExtended(bgp.ExtendedCommunityAttrSubType(v.SubType), v.Address, uint16(v.LocalAdmin), v.IsTransitive) case *api.FourOctetAsSpecificExtended: - community = bgp.NewFourOctetAsSpecificExtended(bgp.ExtendedCommunityAttrSubType(v.SubType), v.As, uint16(v.LocalAdmin), v.IsTransitive) + community = bgp.NewFourOctetAsSpecificExtended(bgp.ExtendedCommunityAttrSubType(v.SubType), v.Asn, uint16(v.LocalAdmin), v.IsTransitive) case *api.ValidationExtended: community = bgp.NewValidationExtended(bgp.ValidationState(v.State)) case *api.ColorExtended: @@ -874,15 +874,15 @@ func unmarshalExComm(a *api.ExtendedCommunitiesAttribute) (*bgp.PathAttributeExt case *api.RouterMacExtended: community = bgp.NewRoutersMacExtended(v.Mac) case *api.TrafficRateExtended: - community = bgp.NewTrafficRateExtended(uint16(v.As), v.Rate) + community = bgp.NewTrafficRateExtended(uint16(v.Asn), v.Rate) case *api.TrafficActionExtended: community = bgp.NewTrafficActionExtended(v.Terminal, v.Sample) case *api.RedirectTwoOctetAsSpecificExtended: - community = bgp.NewRedirectTwoOctetAsSpecificExtended(uint16(v.As), v.LocalAdmin) + community = bgp.NewRedirectTwoOctetAsSpecificExtended(uint16(v.Asn), v.LocalAdmin) case *api.RedirectIPv4AddressSpecificExtended: community = bgp.NewRedirectIPv4AddressSpecificExtended(v.Address, uint16(v.LocalAdmin)) case *api.RedirectFourOctetAsSpecificExtended: - community = bgp.NewRedirectFourOctetAsSpecificExtended(v.As, uint16(v.LocalAdmin)) + community = bgp.NewRedirectFourOctetAsSpecificExtended(v.Asn, uint16(v.LocalAdmin)) case *api.TrafficRemarkExtended: community = bgp.NewTrafficRemarkExtended(uint8(v.Dscp)) case *api.UnknownExtended: @@ -901,7 +901,7 @@ func NewAs4PathAttributeFromNative(a *bgp.PathAttributeAs4Path) *api.As4PathAttr segments := make([]*api.AsSegment, 0, len(a.Value)) for _, param := range a.Value { segments = append(segments, &api.AsSegment{ - Type: uint32(param.Type), + Type: api.AsSegment_Type(param.Type), Numbers: param.AS, }) } @@ -913,7 +913,7 @@ func NewAs4PathAttributeFromNative(a *bgp.PathAttributeAs4Path) *api.As4PathAttr // NewAs4AggregatorAttributeFromNative creates a new aggregator path attribute func NewAs4AggregatorAttributeFromNative(a *bgp.PathAttributeAs4Aggregator) *api.As4AggregatorAttribute { return &api.As4AggregatorAttribute{ - As: a.Value.AS, + Asn: a.Value.AS, Address: a.Value.Address.String(), } } @@ -1175,7 +1175,7 @@ func unmarshalAttribute(an *any.Any) (bgp.PathAttributeInterface, error) { if net.ParseIP(a.Address).To4() == nil { return nil, fmt.Errorf("invalid aggregator address: %s", a.Address) } - return bgp.NewPathAttributeAggregator(a.As, a.Address), nil + return bgp.NewPathAttributeAggregator(a.Asn, a.Address), nil case *api.CommunitiesAttribute: return bgp.NewPathAttributeCommunities(a.Communities), nil case *api.OriginatorIdAttribute: @@ -1238,7 +1238,7 @@ func unmarshalAttribute(an *any.Any) (bgp.PathAttributeInterface, error) { if net.ParseIP(a.Address).To4() == nil { return nil, fmt.Errorf("invalid as4 aggregator address: %s", a.Address) } - return bgp.NewPathAttributeAs4Aggregator(a.As, a.Address), nil + return bgp.NewPathAttributeAs4Aggregator(a.Asn, a.Address), nil case *api.PmsiTunnelAttribute: typ := bgp.PmsiTunnelType(a.Type) var isLeafInfoRequired bool diff --git a/pkg/sources/gobgp/apiutil/attribute_test.go b/pkg/sources/gobgp/apiutil/attribute_test.go index edd50f2..e6d0127 100644 --- a/pkg/sources/gobgp/apiutil/attribute_test.go +++ b/pkg/sources/gobgp/apiutil/attribute_test.go @@ -21,8 +21,8 @@ import ( "github.com/golang/protobuf/ptypes" "github.com/golang/protobuf/ptypes/any" - api "github.com/osrg/gobgp/api" - "github.com/osrg/gobgp/pkg/packet/bgp" + api "github.com/osrg/gobgp/v3/api" + "github.com/osrg/gobgp/v3/pkg/packet/bgp" "github.com/stretchr/testify/assert" ) @@ -134,7 +134,7 @@ func Test_AggregatorAttribute(t *testing.T) { assert := assert.New(t) input := &api.AggregatorAttribute{ - As: 65000, + Asn: 65000, Address: "1.1.1.1", } @@ -144,7 +144,7 @@ func Test_AggregatorAttribute(t *testing.T) { assert.Nil(err) output := NewAggregatorAttributeFromNative(n.(*bgp.PathAttributeAggregator)) - assert.Equal(input.As, output.As) + assert.Equal(input.Asn, output.Asn) assert.Equal(input.Address, output.Address) } @@ -452,7 +452,7 @@ func Test_MpReachNLRIAttribute_EVPN_AD_Route(t *testing.T) { assert := assert.New(t) nlris := make([]*any.Any, 0, 1) - rd, err := ptypes.MarshalAny(&api.RouteDistinguisherTwoOctetAS{ + rd, err := ptypes.MarshalAny(&api.RouteDistinguisherTwoOctetASN{ Admin: 65000, Assigned: 100, }) @@ -548,7 +548,7 @@ func Test_MpReachNLRIAttribute_EVPN_MC_Route(t *testing.T) { assert := assert.New(t) nlris := make([]*any.Any, 0, 1) - rd, err := ptypes.MarshalAny(&api.RouteDistinguisherFourOctetAS{ + rd, err := ptypes.MarshalAny(&api.RouteDistinguisherFourOctetASN{ Admin: 65000, Assigned: 100, }) @@ -780,8 +780,8 @@ func Test_MpReachNLRIAttribute_RTC_UC(t *testing.T) { }) assert.Nil(err) a, err := ptypes.MarshalAny(&api.RouteTargetMembershipNLRI{ - As: 65000, - Rt: rt, + Asn: 65000, + Rt: rt, }) assert.Nil(err) nlris = append(nlris, a) @@ -1187,7 +1187,7 @@ func Test_ExtendedCommunitiesAttribute(t *testing.T) { a, err := ptypes.MarshalAny(&api.TwoOctetAsSpecificExtended{ IsTransitive: true, SubType: 0x02, // ROUTE_TARGET - As: 65001, + Asn: 65001, LocalAdmin: 100, }) assert.Nil(err) @@ -1203,7 +1203,7 @@ func Test_ExtendedCommunitiesAttribute(t *testing.T) { a, err = ptypes.MarshalAny(&api.FourOctetAsSpecificExtended{ IsTransitive: true, SubType: 0x02, // ROUTE_TARGET - As: 65003, + Asn: 65003, LocalAdmin: 300, }) assert.Nil(err) @@ -1257,7 +1257,7 @@ func Test_ExtendedCommunitiesAttribute(t *testing.T) { assert.Nil(err) communities = append(communities, a) a, err = ptypes.MarshalAny(&api.TrafficRateExtended{ - As: 65004, + Asn: 65004, Rate: 100.0, }) assert.Nil(err) @@ -1269,7 +1269,7 @@ func Test_ExtendedCommunitiesAttribute(t *testing.T) { assert.Nil(err) communities = append(communities, a) a, err = ptypes.MarshalAny(&api.RedirectTwoOctetAsSpecificExtended{ - As: 65005, + Asn: 65005, LocalAdmin: 500, }) assert.Nil(err) @@ -1281,7 +1281,7 @@ func Test_ExtendedCommunitiesAttribute(t *testing.T) { assert.Nil(err) communities = append(communities, a) a, err = ptypes.MarshalAny(&api.RedirectFourOctetAsSpecificExtended{ - As: 65007, + Asn: 65007, LocalAdmin: 700, }) assert.Nil(err) @@ -1346,7 +1346,7 @@ func Test_As4AggregatorAttribute(t *testing.T) { assert := assert.New(t) input := &api.As4AggregatorAttribute{ - As: 65000, + Asn: 65000, Address: "1.1.1.1", } @@ -1356,7 +1356,7 @@ func Test_As4AggregatorAttribute(t *testing.T) { assert.Nil(err) output := NewAs4AggregatorAttributeFromNative(n.(*bgp.PathAttributeAs4Aggregator)) - assert.Equal(input.As, output.As) + assert.Equal(input.Asn, output.Asn) assert.Equal(input.Address, output.Address) } diff --git a/pkg/sources/gobgp/apiutil/capability.go b/pkg/sources/gobgp/apiutil/capability.go index 86f541b..c847477 100644 --- a/pkg/sources/gobgp/apiutil/capability.go +++ b/pkg/sources/gobgp/apiutil/capability.go @@ -21,8 +21,8 @@ import ( proto "github.com/golang/protobuf/proto" "github.com/golang/protobuf/ptypes" "github.com/golang/protobuf/ptypes/any" - api "github.com/osrg/gobgp/api" - "github.com/osrg/gobgp/pkg/packet/bgp" + api "github.com/osrg/gobgp/v3/api" + "github.com/osrg/gobgp/v3/pkg/packet/bgp" ) // NewMultiProtocolCapability creates a new multi protocol capability @@ -74,9 +74,9 @@ func NewGracefulRestartCapability(a *bgp.CapGracefulRestart) *api.GracefulRestar } // NewFourOctetASNumberCapability creates new 32bit ASN capability -func NewFourOctetASNumberCapability(a *bgp.CapFourOctetASNumber) *api.FourOctetASNumberCapability { - return &api.FourOctetASNumberCapability{ - As: a.CapValue, +func NewFourOctetASNumberCapability(a *bgp.CapFourOctetASNumber) *api.FourOctetASNCapability { + return &api.FourOctetASNCapability{ + Asn: a.CapValue, } } @@ -87,7 +87,7 @@ func NewAddPathCapability(a *bgp.CapAddPath) *api.AddPathCapability { afi, safi := bgp.RouteFamilyToAfiSafi(t.RouteFamily) tuples = append(tuples, &api.AddPathCapabilityTuple{ Family: ToAPIFamily(afi, safi), - Mode: api.AddPathMode(t.Mode), + Mode: api.AddPathCapabilityTuple_Mode(t.Mode), }) } return &api.AddPathCapability{ @@ -218,8 +218,8 @@ func unmarshalCapability(a *any.Any) (bgp.ParameterCapabilityInterface, error) { notification = true } return bgp.NewCapGracefulRestart(restarting, notification, uint16(a.Time), tuples), nil - case *api.FourOctetASNumberCapability: - return bgp.NewCapFourOctetASNumber(a.As), nil + case *api.FourOctetASNCapability: + return bgp.NewCapFourOctetASNumber(a.Asn), nil case *api.AddPathCapability: tuples := make([]*bgp.CapAddPathTuple, 0, len(a.Tuples)) for _, t := range a.Tuples { diff --git a/pkg/sources/gobgp/apiutil/capability_test.go b/pkg/sources/gobgp/apiutil/capability_test.go index 9a703a3..34fa058 100644 --- a/pkg/sources/gobgp/apiutil/capability_test.go +++ b/pkg/sources/gobgp/apiutil/capability_test.go @@ -19,8 +19,8 @@ import ( "testing" "github.com/golang/protobuf/ptypes" - api "github.com/osrg/gobgp/api" - "github.com/osrg/gobgp/pkg/packet/bgp" + api "github.com/osrg/gobgp/v3/api" + "github.com/osrg/gobgp/v3/pkg/packet/bgp" "github.com/stretchr/testify/assert" ) @@ -142,8 +142,8 @@ func Test_GracefulRestartCapability(t *testing.T) { func Test_FourOctetASNumberCapability(t *testing.T) { assert := assert.New(t) - input := &api.FourOctetASNumberCapability{ - As: 100, + input := &api.FourOctetASNCapability{ + Asn: 100, } a, err := ptypes.MarshalAny(input) @@ -168,7 +168,7 @@ func Test_AddPathCapability(t *testing.T) { Afi: api.Family_AFI_IP, Safi: api.Family_SAFI_UNICAST, }, - Mode: api.AddPathMode_MODE_BOTH, + Mode: api.AddPathCapabilityTuple_BOTH, }, }, } diff --git a/pkg/sources/gobgp/apiutil/util.go b/pkg/sources/gobgp/apiutil/util.go index aa92e27..924864b 100644 --- a/pkg/sources/gobgp/apiutil/util.go +++ b/pkg/sources/gobgp/apiutil/util.go @@ -21,8 +21,8 @@ import ( "time" "github.com/golang/protobuf/ptypes" - api "github.com/osrg/gobgp/api" - "github.com/osrg/gobgp/pkg/packet/bgp" + api "github.com/osrg/gobgp/v3/api" + "github.com/osrg/gobgp/v3/pkg/packet/bgp" ) // Path structure: This is a workaround. diff --git a/pkg/sources/gobgp/routes.go b/pkg/sources/gobgp/routes.go index b2b55ba..e1492ec 100644 --- a/pkg/sources/gobgp/routes.go +++ b/pkg/sources/gobgp/routes.go @@ -7,8 +7,8 @@ import ( "log" "time" - gobgpapi "github.com/osrg/gobgp/api" - "github.com/osrg/gobgp/pkg/packet/bgp" + gobgpapi "github.com/osrg/gobgp/v3/api" + "github.com/osrg/gobgp/v3/pkg/packet/bgp" "github.com/alice-lg/alice-lg/pkg/api" "github.com/alice-lg/alice-lg/pkg/pools" diff --git a/pkg/sources/gobgp/source.go b/pkg/sources/gobgp/source.go index 4ef335c..82c8940 100644 --- a/pkg/sources/gobgp/source.go +++ b/pkg/sources/gobgp/source.go @@ -1,7 +1,7 @@ package gobgp import ( - gobgpapi "github.com/osrg/gobgp/api" + gobgpapi "github.com/osrg/gobgp/v3/api" "google.golang.org/grpc" "google.golang.org/grpc/credentials" @@ -179,7 +179,7 @@ func (gobgp *GoBGP) Neighbors( neigh := api.Neighbor{} neigh.Address = _resp.Peer.State.NeighborAddress - neigh.ASN = int(_resp.Peer.State.PeerAs) + neigh.ASN = int(_resp.Peer.State.PeerAsn) switch _resp.Peer.State.SessionState { case gobgpapi.PeerState_ESTABLISHED: neigh.State = "up" diff --git a/pkg/sources/gobgp/utils.go b/pkg/sources/gobgp/utils.go index 4dcb7ae..83849cf 100644 --- a/pkg/sources/gobgp/utils.go +++ b/pkg/sources/gobgp/utils.go @@ -7,13 +7,13 @@ import ( "io" // External imports - api "github.com/osrg/gobgp/api" + api "github.com/osrg/gobgp/v3/api" // Internal imports ) // PeerHash calculates a peer hash func PeerHash(peer *api.Peer) string { - return PeerHashWithASAndAddress(peer.State.PeerAs, peer.State.NeighborAddress) + return PeerHashWithASAndAddress(peer.State.PeerAsn, peer.State.NeighborAddress) } // PeerHashWithASAndAddress creates a peer hash (sha1) from -- 2.47.1