switch to Go API v2 for protobuf

seems that sticking to Go API v1 for protobuf is headache for projects
using GoBGP.

This breaks the compatibility so bumps up the major version to 3.

Signed-off-by: FUJITA Tomonori <[email protected]>
This commit is contained in:
FUJITA Tomonori
2021-12-08 07:22:50 +00:00
parent 6248c576b1
commit c593d7c8b3
91 changed files with 23402 additions and 14748 deletions
+4 -1
View File
@@ -29,11 +29,14 @@ jobs:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@master
- uses: actions/setup-go@v2
with:
go-version: '^1.17.4'
- run: |
test -z "$(go fmt ./...)"
go vet ./...
export PATH=${PATH}:`go env GOPATH`/bin
go get -u honnef.co/go/tools/cmd/staticcheck
go install honnef.co/go/tools/cmd/staticcheck@2021.1.2
staticcheck ./...
embeded:
+7463 -4436
View File
File diff suppressed because it is too large Load Diff
+5 -3
View File
@@ -21,10 +21,12 @@
syntax = "proto3";
package apipb;
option go_package = "github.com/osrg/gobgp/v3/api;apipb";
import "google/protobuf/any.proto";
import "gobgp.proto";
package gobgpapi;
message OriginAttribute { uint32 origin = 1; }
@@ -351,7 +353,7 @@ message LsAddrPrefix {
}
message MpReachNLRIAttribute {
gobgpapi.Family family = 1;
apipb.Family family = 1;
repeated string next_hops = 2;
// Each NLRI must be one of:
// - IPAddressPrefix
@@ -374,7 +376,7 @@ message MpReachNLRIAttribute {
}
message MpUnreachNLRIAttribute {
gobgpapi.Family family = 1;
apipb.Family family = 1;
// The same as NLRI field of MpReachNLRIAttribute
repeated google.protobuf.Any nlris = 3;
}
+1051 -577
View File
File diff suppressed because it is too large Load Diff
+9 -8
View File
@@ -21,9 +21,10 @@
syntax = "proto3";
import "gobgp.proto";
package apipb;
option go_package = "github.com/osrg/gobgp/v3/api;apipb";
package gobgpapi;
import "gobgp.proto";
enum AddPathMode {
MODE_NONE = 0;
@@ -33,7 +34,7 @@ enum AddPathMode {
}
message MultiProtocolCapability {
gobgpapi.Family family = 1;
apipb.Family family = 1;
}
message RouteRefreshCapability {
@@ -43,11 +44,11 @@ message CarryingLabelInfoCapability {
}
message ExtendedNexthopCapabilityTuple {
gobgpapi.Family nlri_family = 1;
apipb.Family nlri_family = 1;
// Nexthop AFI must be either
// gobgp.IPv4 or
// gobgp.IPv6.
gobgpapi.Family nexthop_family = 2;
apipb.Family nexthop_family = 2;
}
message ExtendedNexthopCapability {
@@ -55,7 +56,7 @@ message ExtendedNexthopCapability {
}
message GracefulRestartCapabilityTuple {
gobgpapi.Family family = 1;
apipb.Family family = 1;
uint32 flags = 2;
}
@@ -70,7 +71,7 @@ message FourOctetASNumberCapability {
}
message AddPathCapabilityTuple {
gobgpapi.Family family = 1;
apipb.Family family = 1;
AddPathMode mode = 2;
}
@@ -82,7 +83,7 @@ message EnhancedRouteRefreshCapability {
}
message LongLivedGracefulRestartCapabilityTuple {
gobgpapi.Family family = 1;
apipb.Family family = 1;
uint32 flags = 2;
uint32 time = 3;
}
+11692 -9047
View File
File diff suppressed because it is too large Load Diff
+3 -1
View File
@@ -21,11 +21,13 @@
syntax = "proto3";
package apipb;
option go_package = "github.com/osrg/gobgp/v3/api;apipb";
import "google/protobuf/any.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/timestamp.proto";
package gobgpapi;
// Interface exported by the server.
+2432
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -20,8 +20,8 @@ import (
"net"
"strconv"
api "github.com/osrg/gobgp/api"
"github.com/osrg/gobgp/pkg/packet/bmp"
api "github.com/osrg/gobgp/v3/api"
"github.com/osrg/gobgp/v3/pkg/packet/bmp"
"github.com/spf13/cobra"
)
+2 -2
View File
@@ -29,8 +29,8 @@ import (
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
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"
)
const globalRIBName = "global"
+4 -4
View File
@@ -27,11 +27,11 @@ import (
"github.com/spf13/cobra"
api "github.com/osrg/gobgp/api"
"github.com/osrg/gobgp/internal/pkg/apiutil"
"github.com/osrg/gobgp/internal/pkg/table"
api "github.com/osrg/gobgp/v3/api"
"github.com/osrg/gobgp/v3/internal/pkg/apiutil"
"github.com/osrg/gobgp/v3/internal/pkg/table"
"github.com/osrg/gobgp/pkg/packet/bgp"
"github.com/osrg/gobgp/v3/pkg/packet/bgp"
)
type extCommType int
+2 -2
View File
@@ -19,8 +19,8 @@ import (
"strings"
"testing"
"github.com/osrg/gobgp/internal/pkg/apiutil"
"github.com/osrg/gobgp/pkg/packet/bgp"
"github.com/osrg/gobgp/v3/internal/pkg/apiutil"
"github.com/osrg/gobgp/v3/pkg/packet/bgp"
"github.com/stretchr/testify/assert"
)
+1 -1
View File
@@ -18,7 +18,7 @@ package main
import (
"fmt"
api "github.com/osrg/gobgp/api"
api "github.com/osrg/gobgp/v3/api"
"github.com/spf13/cobra"
)
+1 -1
View File
@@ -19,7 +19,7 @@ import (
"fmt"
"os"
"github.com/osrg/gobgp/internal/pkg/version"
"github.com/osrg/gobgp/v3/internal/pkg/version"
"google.golang.org/grpc"
)
+3 -3
View File
@@ -24,9 +24,9 @@ import (
"github.com/spf13/cobra"
api "github.com/osrg/gobgp/api"
"github.com/osrg/gobgp/internal/pkg/apiutil"
"github.com/osrg/gobgp/pkg/packet/bgp"
api "github.com/osrg/gobgp/v3/api"
"github.com/osrg/gobgp/v3/internal/pkg/apiutil"
"github.com/osrg/gobgp/v3/pkg/packet/bgp"
)
func makeMonitorRouteArgs(p *api.Path, showIdentifier bgp.BGPAddPathMode) []interface{} {
+4 -4
View File
@@ -24,10 +24,10 @@ import (
"github.com/spf13/cobra"
api "github.com/osrg/gobgp/api"
"github.com/osrg/gobgp/internal/pkg/apiutil"
"github.com/osrg/gobgp/pkg/packet/bgp"
"github.com/osrg/gobgp/pkg/packet/mrt"
api "github.com/osrg/gobgp/v3/api"
"github.com/osrg/gobgp/v3/internal/pkg/apiutil"
"github.com/osrg/gobgp/v3/pkg/packet/bgp"
"github.com/osrg/gobgp/v3/pkg/packet/mrt"
)
func injectMrt() error {
+8 -11
View File
@@ -26,13 +26,12 @@ import (
"strings"
"time"
"github.com/golang/protobuf/ptypes"
"github.com/spf13/cobra"
api "github.com/osrg/gobgp/api"
"github.com/osrg/gobgp/internal/pkg/apiutil"
"github.com/osrg/gobgp/internal/pkg/config"
"github.com/osrg/gobgp/pkg/packet/bgp"
api "github.com/osrg/gobgp/v3/api"
"github.com/osrg/gobgp/v3/internal/pkg/apiutil"
"github.com/osrg/gobgp/v3/internal/pkg/config"
"github.com/osrg/gobgp/v3/pkg/packet/bgp"
)
// used in showRoute() to determine the width of each column
@@ -173,9 +172,9 @@ func showNeighbors(vrf string) error {
}
timeStr := "never"
if n.Timers.State.Uptime != nil {
t, _ := ptypes.Timestamp(n.Timers.State.Downtime)
t := n.Timers.State.Downtime.AsTime()
if n.State.SessionState == api.PeerState_ESTABLISHED {
t, _ = ptypes.Timestamp(n.Timers.State.Uptime)
t = n.Timers.State.Uptime.AsTime()
}
timeStr = formatTimedelta(t)
}
@@ -259,8 +258,7 @@ func showNeighbor(args []string) error {
fmt.Printf(" BGP version 4, remote router ID %s\n", id)
fmt.Printf(" BGP state = %s", p.State.SessionState)
if p.Timers.State.Uptime != nil {
t, _ := ptypes.Timestamp(p.Timers.State.Uptime)
fmt.Printf(", up for %s\n", formatTimedelta(t))
fmt.Printf(", up for %s\n", formatTimedelta(p.Timers.State.Uptime.AsTime()))
} else {
fmt.Print("\n")
}
@@ -601,8 +599,7 @@ func makeShowRouteArgs(p *api.Path, idx int, now time.Time, showAge, showBest, s
// Age
if showAge {
t, _ := ptypes.Timestamp(p.Age)
args = append(args, formatTimedelta(t))
args = append(args, formatTimedelta(p.Age.AsTime()))
}
// Path Attributes
+5 -5
View File
@@ -25,14 +25,14 @@ import (
"strconv"
"strings"
"github.com/osrg/gobgp/internal/pkg/apiutil"
"github.com/osrg/gobgp/v3/internal/pkg/apiutil"
"github.com/spf13/cobra"
api "github.com/osrg/gobgp/api"
"github.com/osrg/gobgp/internal/pkg/config"
table "github.com/osrg/gobgp/internal/pkg/table"
"github.com/osrg/gobgp/pkg/packet/bgp"
api "github.com/osrg/gobgp/v3/api"
"github.com/osrg/gobgp/v3/internal/pkg/config"
table "github.com/osrg/gobgp/v3/internal/pkg/table"
"github.com/osrg/gobgp/v3/pkg/packet/bgp"
)
var (
+1 -1
View File
@@ -21,7 +21,7 @@ import (
_ "net/http/pprof"
"strconv"
api "github.com/osrg/gobgp/api"
api "github.com/osrg/gobgp/v3/api"
"github.com/spf13/cobra"
)
+3 -4
View File
@@ -21,9 +21,9 @@ import (
"net"
"strconv"
"github.com/golang/protobuf/ptypes"
api "github.com/osrg/gobgp/api"
"github.com/spf13/cobra"
api "github.com/osrg/gobgp/v3/api"
)
func showRPKIServer(args []string) error {
@@ -50,8 +50,7 @@ func showRPKIServer(args []string) error {
uptime := "never"
if r.State.Up {
s = "Up"
t, _ := ptypes.Timestamp(r.State.Uptime)
uptime = fmt.Sprint(formatTimedelta(t))
uptime = fmt.Sprint(formatTimedelta(r.State.Uptime.AsTime()))
}
fmt.Printf(format, net.JoinHostPort(r.Conf.Address, fmt.Sprintf("%d", r.Conf.RemotePort)), s, uptime, fmt.Sprintf("%d/%d", r.State.RecordIpv4, r.State.RecordIpv6))
+6 -6
View File
@@ -23,12 +23,12 @@ import (
"strconv"
"strings"
api "github.com/osrg/gobgp/api"
"github.com/osrg/gobgp/internal/pkg/apiutil"
"github.com/osrg/gobgp/pkg/packet/bgp"
"github.com/golang/protobuf/ptypes/any"
"github.com/spf13/cobra"
apb "google.golang.org/protobuf/types/known/anypb"
api "github.com/osrg/gobgp/v3/api"
"github.com/osrg/gobgp/v3/internal/pkg/apiutil"
"github.com/osrg/gobgp/v3/pkg/packet/bgp"
)
func getVrfs() ([]*api.Vrf, error) {
@@ -78,7 +78,7 @@ func showVrfs() error {
}
rdStr := rd.String()
f := func(rts []*any.Any) (string, error) {
f := func(rts []*apb.Any) (string, error) {
ret := make([]string, 0, len(rts))
for _, an := range rts {
rt, err := apiutil.UnmarshalRT(an)
+3 -3
View File
@@ -34,9 +34,9 @@ import (
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
"github.com/osrg/gobgp/internal/pkg/version"
"github.com/osrg/gobgp/pkg/config"
"github.com/osrg/gobgp/pkg/server"
"github.com/osrg/gobgp/v3/internal/pkg/version"
"github.com/osrg/gobgp/v3/pkg/config"
"github.com/osrg/gobgp/v3/pkg/server"
)
func main() {
+1
View File
@@ -13,6 +13,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//go:build !windows
// +build !windows
package main
+6 -7
View File
@@ -13,11 +13,10 @@ package main
import (
"context"
"os"
"github.com/golang/protobuf/jsonpb"
api "github.com/osrg/gobgp/api"
gobgp "github.com/osrg/gobgp/pkg/server"
"google.golang.org/protobuf/encoding/protojson"
api "github.com/osrg/gobgp/v3/api"
gobgp "github.com/osrg/gobgp/v3/pkg/server"
log "github.com/sirupsen/logrus"
)
@@ -73,9 +72,9 @@ func main() {
log.Fatal(err)
}
marshaller := jsonpb.Marshaler{
marshaller := protojson.MarshalOptions{
Indent: " ",
OrigName: true,
UseProtoNames: true,
}
// Display incoming Prefixes in JSON format.
@@ -87,7 +86,7 @@ func main() {
},
}, func(p *api.Path) {
// Your application should do something useful with the BGP-LS path here.
marshaller.Marshal(os.Stdout, p)
marshaller.Marshal(p)
}); err != nil {
log.Fatal(err)
}
+15 -16
View File
@@ -21,28 +21,27 @@ import (
"net"
"os"
"github.com/golang/protobuf/ptypes"
"github.com/golang/protobuf/ptypes/any"
api "github.com/osrg/gobgp/api"
toolbox "github.com/sbezverk/gobgptoolbox"
"google.golang.org/grpc"
"google.golang.org/protobuf/types/known/anypb"
apb "google.golang.org/protobuf/types/known/anypb"
api "github.com/osrg/gobgp/v3/api"
)
func AddSRPolicy(client api.GobgpApiClient) error {
nlrisr, _ := ptypes.MarshalAny(&api.SRPolicyNLRI{
nlrisr, _ := apb.New(&api.SRPolicyNLRI{
Length: 96,
Distinguisher: 2,
Color: 99,
Endpoint: net.ParseIP("10.0.0.15").To4(),
})
// Origin attribute
origin, _ := ptypes.MarshalAny(&api.OriginAttribute{
origin, _ := apb.New(&api.OriginAttribute{
Origin: 0,
})
// Next hop attribute
nh, _ := ptypes.MarshalAny(&api.NextHopAttribute{
nh, _ := apb.New(&api.NextHopAttribute{
NextHop: net.ParseIP("192.168.20.1").To4().String(),
})
// Extended communities attribute
@@ -51,13 +50,13 @@ func AddSRPolicy(client api.GobgpApiClient) error {
if err != nil {
return err
}
rt, _ := ptypes.MarshalAny(&api.ExtendedCommunitiesAttribute{
rt, _ := apb.New(&api.ExtendedCommunitiesAttribute{
Communities: []*any.Any{rtm},
})
// Tunnel Encapsulation Type 15 (SR Policy) sub tlvs
s := make([]byte, 4)
binary.BigEndian.PutUint32(s, 24321)
sid, err := ptypes.MarshalAny(&api.SRBindingSID{
sid, err := apb.New(&api.SRBindingSID{
SFlag: true,
IFlag: false,
Sid: s,
@@ -65,13 +64,13 @@ func AddSRPolicy(client api.GobgpApiClient) error {
if err != nil {
return err
}
bsid, err := ptypes.MarshalAny(&api.TunnelEncapSubTLVSRBindingSID{
bsid, err := apb.New(&api.TunnelEncapSubTLVSRBindingSID{
Bsid: sid,
})
if err != nil {
return err
}
segment, err := ptypes.MarshalAny(&api.SegmentTypeA{
segment, err := apb.New(&api.SegmentTypeA{
Flags: &api.SegmentFlags{
SFlag: true,
},
@@ -80,7 +79,7 @@ func AddSRPolicy(client api.GobgpApiClient) error {
if err != nil {
return err
}
seglist, err := ptypes.MarshalAny(&api.TunnelEncapSubTLVSRSegmentList{
seglist, err := apb.New(&api.TunnelEncapSubTLVSRSegmentList{
Weight: &api.SRWeight{
Flags: 0,
Weight: 12,
@@ -90,27 +89,27 @@ func AddSRPolicy(client api.GobgpApiClient) error {
if err != nil {
return err
}
pref, err := ptypes.MarshalAny(&api.TunnelEncapSubTLVSRPreference{
pref, err := apb.New(&api.TunnelEncapSubTLVSRPreference{
Flags: 0,
Preference: 11,
})
if err != nil {
return err
}
cpn, err := ptypes.MarshalAny(&api.TunnelEncapSubTLVSRCandidatePathName{
cpn, err := apb.New(&api.TunnelEncapSubTLVSRCandidatePathName{
CandidatePathName: "CandidatePathName",
})
if err != nil {
return err
}
pri, err := ptypes.MarshalAny(&api.TunnelEncapSubTLVSRPriority{
pri, err := apb.New(&api.TunnelEncapSubTLVSRPriority{
Priority: 10,
})
if err != nil {
return err
}
// Tunnel Encapsulation attribute for SR Policy
tun, err := ptypes.MarshalAny(&api.TunnelEncapAttribute{
tun, err := apb.New(&api.TunnelEncapAttribute{
Tlvs: []*api.TunnelEncapTLV{
{
Type: 15,
+14 -14
View File
@@ -15,10 +15,10 @@ import (
"context"
"time"
"github.com/golang/protobuf/ptypes"
"github.com/golang/protobuf/ptypes/any"
api "github.com/osrg/gobgp/api"
gobgp "github.com/osrg/gobgp/pkg/server"
apb "google.golang.org/protobuf/types/known/anypb"
api "github.com/osrg/gobgp/v3/api"
gobgp "github.com/osrg/gobgp/v3/pkg/server"
log "github.com/sirupsen/logrus"
)
@@ -58,18 +58,18 @@ func main() {
}
// add routes
nlri, _ := ptypes.MarshalAny(&api.IPAddressPrefix{
nlri, _ := apb.New(&api.IPAddressPrefix{
Prefix: "10.0.0.0",
PrefixLen: 24,
})
a1, _ := ptypes.MarshalAny(&api.OriginAttribute{
a1, _ := apb.New(&api.OriginAttribute{
Origin: 0,
})
a2, _ := ptypes.MarshalAny(&api.NextHopAttribute{
a2, _ := apb.New(&api.NextHopAttribute{
NextHop: "10.0.0.1",
})
a3, _ := ptypes.MarshalAny(&api.AsPathAttribute{
a3, _ := apb.New(&api.AsPathAttribute{
Segments: []*api.AsSegment{
{
Type: 2,
@@ -77,7 +77,7 @@ func main() {
},
},
})
attrs := []*any.Any{a1, a2, a3}
attrs := []*apb.Any{a1, a2, a3}
_, err := s.AddPath(context.Background(), &api.AddPathRequest{
Path: &api.Path{
@@ -96,17 +96,17 @@ func main() {
}
// add v6 route
nlri, _ = ptypes.MarshalAny(&api.IPAddressPrefix{
nlri, _ = apb.New(&api.IPAddressPrefix{
PrefixLen: 64,
Prefix: "2001:db8:1::",
})
v6Attrs, _ := ptypes.MarshalAny(&api.MpReachNLRIAttribute{
v6Attrs, _ := apb.New(&api.MpReachNLRIAttribute{
Family: v6Family,
NextHops: []string{"2001:db8::1"},
Nlris: []*any.Any{nlri},
Nlris: []*apb.Any{nlri},
})
c, _ := ptypes.MarshalAny(&api.CommunitiesAttribute{
c, _ := apb.New(&api.CommunitiesAttribute{
Communities: []uint32{100, 200},
})
@@ -114,7 +114,7 @@ func main() {
Path: &api.Path{
Family: v6Family,
Nlri: nlri,
Pattrs: []*any.Any{a1, v6Attrs, c},
Pattrs: []*apb.Any{a1, v6Attrs, c},
},
})
if err != nil {
+9 -4
View File
@@ -1,4 +1,4 @@
module github.com/osrg/gobgp
module github.com/osrg/gobgp/v3
require (
github.com/BurntSushi/toml v0.4.1
@@ -7,7 +7,6 @@ require (
github.com/eapache/channels v1.1.0
github.com/eapache/queue v1.1.0 // indirect
github.com/go-test/deep v1.0.7
github.com/golang/protobuf v1.3.2
github.com/google/uuid v1.3.0
github.com/jessevdk/go-flags v1.5.0
github.com/k-sone/critbitgo v1.4.0
@@ -17,8 +16,14 @@ require (
github.com/spf13/viper v1.7.1
github.com/stretchr/testify v1.7.0
github.com/vishvananda/netlink v1.1.1-0.20210330154013-f5de75959ad5
golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d
google.golang.org/grpc v1.21.1
golang.org/x/net v0.0.0-20211205041911-012df41ee64c
golang.org/x/sys v0.0.0-20211205182925-97ca703d548d // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/tools v0.1.8 // indirect
google.golang.org/genproto v0.0.0-20211203200212-54befc351ae9 // indirect
google.golang.org/grpc v1.42.0
google.golang.org/protobuf v1.27.1
honnef.co/go/tools v0.2.2 // indirect
)
go 1.13
+109 -8
View File
@@ -18,6 +18,7 @@ github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=
github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY=
github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
@@ -25,8 +26,17 @@ github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI=
github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=
github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
@@ -47,6 +57,13 @@ github.com/eapache/channels v1.1.0 h1:F1taHcn7/F0i8DYqKXJnyhJcVpp2kgFcNePxXtnyu4
github.com/eapache/channels v1.1.0/go.mod h1:jMm2qB5Ubtg9zLd+inMZd2/NUvXgzmWXsDaLyQIGfH0=
github.com/eapache/queue v1.1.0 h1:YOEu7KNc61ntiQlcEeUIoDTJ2o8mQznoNvUhiigpIqc=
github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I=
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ=
github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
@@ -60,7 +77,6 @@ github.com/go-test/deep v1.0.7 h1:/VSMRlnY/JSyqxQUzQLKVMAskpY/NZKFA5j2P+0pP2M=
github.com/go-test/deep v1.0.7/go.mod h1:QV8Hv/iy04NyLBxAdO9njL0iVPN1S4d/A3NVv1V36o8=
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
@@ -68,16 +84,33 @@ github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfb
github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs=
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw=
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
@@ -88,6 +121,7 @@ github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/ad
github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs=
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk=
github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw=
github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q=
github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8=
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
@@ -163,12 +197,14 @@ github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXP
github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso=
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=
github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k=
github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
@@ -203,6 +239,7 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
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.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s=
@@ -213,9 +250,12 @@ github.com/vishvananda/netlink v1.1.1-0.20210330154013-f5de75959ad5/go.mod h1:tw
github.com/vishvananda/netns v0.0.0-20200728191858-db3c7e526aae h1:4hwBBUfQCFe3Cym0ZtKyq7L16eZUtYKs+BaHDN6mAns=
github.com/vishvananda/netns v0.0.0-20200728191858-db3c7e526aae/go.mod h1:DD4vA1DwXk04H54A1oHXtwZmA0grkVMdPxx/VGLCah0=
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI=
go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
@@ -224,6 +264,8 @@ golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnf
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
@@ -242,6 +284,9 @@ golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU
golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o=
golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.5.1 h1:OJxoQ/rynoF0dcCdI7cLPktw/hR2cueqYfjm43oqK38=
golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
@@ -256,16 +301,23 @@ golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn
golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d h1:LO7XpTYMwTqxjLcGWPijK3vRXg1aWdlNOVOHRq45d7c=
golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20211205041911-012df41ee64c h1:7SfqwP5fxEtl/P02w5IhKc86ziJ+A25yFrkVgoy2FT8=
golang.org/x/net v0.0.0-20211205041911-012df41ee64c/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
@@ -281,17 +333,29 @@ golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200217220822-9197077df867/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200728102440-3e129f6d46b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da h1:b3NXsE2LusjYGGjL5bxEVZZORm/YEFFrWFjR8eFrw/c=
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211204120058-94396e421777 h1:QAkhGVjOxMa+n4mlsAWeAU+BMZmimQAaNiMu+iUi94E=
golang.org/x/sys v0.0.0-20211204120058-94396e421777/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211205182925-97ca703d548d h1:FjkYO/PPp4Wi0EAUOVLxePm7qVW4r4ctbWpURyuOD0E=
golang.org/x/sys v0.0.0-20211205182925-97ca703d548d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
@@ -304,6 +368,7 @@ golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
@@ -311,7 +376,15 @@ golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtn
golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
golang.org/x/tools v0.1.8 h1:P1HhGGuLW4aAclzjtmJdf0mJOjVUZUzOTqkAkWL+l6w=
golang.org/x/tools v0.1.8/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
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 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=
google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M=
google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg=
@@ -329,12 +402,35 @@ google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRn
google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8=
google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a h1:Ob5/580gVHBJZgXnff1cZDbG+xLtMVE5mDRTe+nIsX4=
google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
google.golang.org/genproto v0.0.0-20211203200212-54befc351ae9 h1:fU3FNfL/oBU2D5DvGqiuyVqqn40DdxvaTFHq7aivA3k=
google.golang.org/genproto v0.0.0-20211203200212-54befc351ae9/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
google.golang.org/grpc v1.21.1 h1:j6XxA85m/6txkUCHvzlV5f+HBNl/1r5cZ2A/3IEFOO8=
google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0=
google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=
google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34=
google.golang.org/grpc v1.42.0 h1:XT2/MFpuPFsEX2fWh3YQtHkZ+WYZFQRfaUgLZYj/p6A=
google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
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.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ=
google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
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=
@@ -345,6 +441,8 @@ gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo=
gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
@@ -353,5 +451,8 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
honnef.co/go/tools v0.2.2 h1:MNh1AVMyVX23VUHE2O27jm6lNj3vjO5DexS4A1xvnzk=
honnef.co/go/tools v0.2.2/go.mod h1:lPVVZ2BS5TfnjLyizF7o7hv7j9/L+8cZY2hLyjP9cGY=
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
+124 -124
View File
@@ -20,20 +20,20 @@ import (
"fmt"
"net"
"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"
log "github.com/sirupsen/logrus"
"google.golang.org/protobuf/proto"
apb "google.golang.org/protobuf/types/known/anypb"
api "github.com/osrg/gobgp/v3/api"
"github.com/osrg/gobgp/v3/pkg/packet/bgp"
)
func UnmarshalAttribute(an *any.Any) (bgp.PathAttributeInterface, error) {
var value ptypes.DynamicAny
if err := ptypes.UnmarshalAny(an, &value); err != nil {
func UnmarshalAttribute(an *apb.Any) (bgp.PathAttributeInterface, error) {
value, err := an.UnmarshalNew()
if err != nil {
return nil, fmt.Errorf("failed to unmarshal route distinguisher: %s", err)
}
switch a := value.Message.(type) {
switch a := value.(type) {
case *api.OriginAttribute:
return bgp.NewPathAttributeOrigin(uint8(a.Origin)), nil
case *api.AsPathAttribute:
@@ -158,8 +158,8 @@ func NewPrefixSIDAttributeFromNative(a *bgp.PathAttributePrefixSID) *api.PrefixS
return psid
}
func MarshalSRv6TLVs(tlvs []bgp.PrefixSIDTLVInterface) []*any.Any {
mtlvs := make([]*any.Any, len(tlvs))
func MarshalSRv6TLVs(tlvs []bgp.PrefixSIDTLVInterface) []*apb.Any {
mtlvs := make([]*apb.Any, len(tlvs))
for i, tlv := range tlvs {
var r proto.Message
switch t := tlv.(type) {
@@ -174,7 +174,7 @@ func MarshalSRv6TLVs(tlvs []bgp.PrefixSIDTLVInterface) []*any.Any {
}).Warn("invalid prefix sid tlv type to marshal")
return nil
}
a, _ := ptypes.MarshalAny(r)
a, _ := apb.New(r)
mtlvs[i] = a
}
@@ -206,11 +206,11 @@ func MarshalSRv6SubTLVs(tlvs []bgp.PrefixSIDTLVInterface) map[uint32]*api.SRv6TL
}).Warn("invalid prefix sid sub tlv type to marshal")
return nil
}
a, _ := ptypes.MarshalAny(r)
a, _ := apb.New(r)
tlvs, ok := mtlvs[key]
if !ok {
tlvs = &api.SRv6TLV{
Tlv: make([]*any.Any, 0),
Tlv: make([]*apb.Any, 0),
}
mtlvs[key] = tlvs
}
@@ -245,11 +245,11 @@ func MarshalSRv6SubSubTLVs(tlvs []bgp.PrefixSIDTLVInterface) map[uint32]*api.SRv
}).Warn("invalid prefix sid sub sub tlv type to marshal")
return nil
}
a, _ := ptypes.MarshalAny(r)
a, _ := apb.New(r)
tlvs, ok := mtlvs[key]
if !ok {
tlvs = &api.SRv6TLV{
Tlv: make([]*any.Any, 0),
Tlv: make([]*apb.Any, 0),
}
mtlvs[key] = tlvs
}
@@ -259,7 +259,7 @@ func MarshalSRv6SubSubTLVs(tlvs []bgp.PrefixSIDTLVInterface) map[uint32]*api.SRv
return mtlvs
}
func MarshalRD(rd bgp.RouteDistinguisherInterface) *any.Any {
func MarshalRD(rd bgp.RouteDistinguisherInterface) *apb.Any {
var r proto.Message
switch v := rd.(type) {
case *bgp.RouteDistinguisherTwoOctetAS:
@@ -284,16 +284,16 @@ func MarshalRD(rd bgp.RouteDistinguisherInterface) *any.Any {
}).Warn("invalid rd type to marshal")
return nil
}
a, _ := ptypes.MarshalAny(r)
a, _ := apb.New(r)
return a
}
func UnmarshalRD(a *any.Any) (bgp.RouteDistinguisherInterface, error) {
var value ptypes.DynamicAny
if err := ptypes.UnmarshalAny(a, &value); err != nil {
func UnmarshalRD(a *apb.Any) (bgp.RouteDistinguisherInterface, error) {
value, err := a.UnmarshalNew()
if err != nil {
return nil, fmt.Errorf("failed to unmarshal route distinguisher: %s", err)
}
switch v := value.Message.(type) {
switch v := value.(type) {
case *api.RouteDistinguisherTwoOctetAS:
return bgp.NewRouteDistinguisherTwoOctetAS(uint16(v.Admin), v.Assigned), nil
case *api.RouteDistinguisherIPAddress:
@@ -322,8 +322,8 @@ func unmarshalESI(a *api.EthernetSegmentIdentifier) (*bgp.EthernetSegmentIdentif
}, nil
}
func MarshalFlowSpecRules(values []bgp.FlowSpecComponentInterface) []*any.Any {
rules := make([]*any.Any, 0, len(values))
func MarshalFlowSpecRules(values []bgp.FlowSpecComponentInterface) []*apb.Any {
rules := make([]*apb.Any, 0, len(values))
for _, value := range values {
var rule proto.Message
switch v := value.(type) {
@@ -376,21 +376,21 @@ func MarshalFlowSpecRules(values []bgp.FlowSpecComponentInterface) []*any.Any {
Items: items,
}
}
a, _ := ptypes.MarshalAny(rule)
a, _ := apb.New(rule)
rules = append(rules, a)
}
return rules
}
func UnmarshalFlowSpecRules(values []*any.Any) ([]bgp.FlowSpecComponentInterface, error) {
func UnmarshalFlowSpecRules(values []*apb.Any) ([]bgp.FlowSpecComponentInterface, error) {
rules := make([]bgp.FlowSpecComponentInterface, 0, len(values))
for _, an := range values {
var rule bgp.FlowSpecComponentInterface
var value ptypes.DynamicAny
if err := ptypes.UnmarshalAny(an, &value); err != nil {
value, err := an.UnmarshalNew()
if err != nil {
return nil, fmt.Errorf("failed to unmarshal flow spec component: %s", err)
}
switch v := value.Message.(type) {
switch v := value.(type) {
case *api.FlowSpecIPPrefix:
typ := bgp.BGPFlowSpecType(v.Type)
isIPv4 := net.ParseIP(v.Prefix).To4() != nil
@@ -424,7 +424,7 @@ func UnmarshalFlowSpecRules(values []*any.Any) ([]bgp.FlowSpecComponentInterface
rule = bgp.NewFlowSpecComponent(bgp.BGPFlowSpecType(v.Type), items)
}
if rule == nil {
return nil, fmt.Errorf("invalid flow spec component: %v", value.Message)
return nil, fmt.Errorf("invalid flow spec component: %v", value)
}
rules = append(rules, rule)
}
@@ -464,16 +464,16 @@ func MarshalLsPrefixDescriptor(d *bgp.LsPrefixDescriptor) *api.LsPrefixDescripto
return p
}
func MarshalLsNodeNLRI(n *bgp.LsNodeNLRI) *any.Any {
func MarshalLsNodeNLRI(n *bgp.LsNodeNLRI) *apb.Any {
node := &api.LsNodeNLRI{
LocalNode: MarshalLsNodeDescriptor(n.LocalNodeDesc.(*bgp.LsTLVNodeDescriptor).Extract()),
}
a, _ := ptypes.MarshalAny(node)
a, _ := apb.New(node)
return a
}
func MarshalLsLinkNLRI(n *bgp.LsLinkNLRI) *any.Any {
func MarshalLsLinkNLRI(n *bgp.LsLinkNLRI) *apb.Any {
desc := &bgp.LsLinkDescriptor{}
desc.ParseTLVs(n.LinkDesc)
@@ -482,12 +482,12 @@ func MarshalLsLinkNLRI(n *bgp.LsLinkNLRI) *any.Any {
RemoteNode: MarshalLsNodeDescriptor(n.RemoteNodeDesc.(*bgp.LsTLVNodeDescriptor).Extract()),
LinkDescriptor: MarshalLsLinkDescriptor(desc),
}
a, _ := ptypes.MarshalAny(link)
a, _ := apb.New(link)
return a
}
func MarshalLsPrefixV4NLRI(n *bgp.LsPrefixV4NLRI) *any.Any {
func MarshalLsPrefixV4NLRI(n *bgp.LsPrefixV4NLRI) *apb.Any {
desc := &bgp.LsPrefixDescriptor{}
desc.ParseTLVs(n.PrefixDesc, false)
@@ -495,12 +495,12 @@ func MarshalLsPrefixV4NLRI(n *bgp.LsPrefixV4NLRI) *any.Any {
LocalNode: MarshalLsNodeDescriptor(n.LocalNodeDesc.(*bgp.LsTLVNodeDescriptor).Extract()),
PrefixDescriptor: MarshalLsPrefixDescriptor(desc),
}
a, _ := ptypes.MarshalAny(prefix)
a, _ := apb.New(prefix)
return a
}
func MarshalLsPrefixV6NLRI(n *bgp.LsPrefixV6NLRI) *any.Any {
func MarshalLsPrefixV6NLRI(n *bgp.LsPrefixV6NLRI) *apb.Any {
desc := &bgp.LsPrefixDescriptor{}
desc.ParseTLVs(n.PrefixDesc, true)
@@ -508,12 +508,12 @@ func MarshalLsPrefixV6NLRI(n *bgp.LsPrefixV6NLRI) *any.Any {
LocalNode: MarshalLsNodeDescriptor(n.LocalNodeDesc.(*bgp.LsTLVNodeDescriptor).Extract()),
PrefixDescriptor: MarshalLsPrefixDescriptor(desc),
}
a, _ := ptypes.MarshalAny(prefix)
a, _ := apb.New(prefix)
return a
}
func MarshalNLRI(value bgp.AddrPrefixInterface) *any.Any {
func MarshalNLRI(value bgp.AddrPrefixInterface) *apb.Any {
var nlri proto.Message
switch v := value.(type) {
@@ -684,27 +684,27 @@ func MarshalNLRI(value bgp.AddrPrefixInterface) *any.Any {
}
}
an, _ := ptypes.MarshalAny(nlri)
an, _ := apb.New(nlri)
return an
}
func MarshalNLRIs(values []bgp.AddrPrefixInterface) []*any.Any {
nlris := make([]*any.Any, 0, len(values))
func MarshalNLRIs(values []bgp.AddrPrefixInterface) []*apb.Any {
nlris := make([]*apb.Any, 0, len(values))
for _, value := range values {
nlris = append(nlris, MarshalNLRI(value))
}
return nlris
}
func UnmarshalNLRI(rf bgp.RouteFamily, an *any.Any) (bgp.AddrPrefixInterface, error) {
func UnmarshalNLRI(rf bgp.RouteFamily, an *apb.Any) (bgp.AddrPrefixInterface, error) {
var nlri bgp.AddrPrefixInterface
var value ptypes.DynamicAny
if err := ptypes.UnmarshalAny(an, &value); err != nil {
value, err := an.UnmarshalNew()
if err != nil {
return nil, fmt.Errorf("failed to unmarshal nlri: %s", err)
}
switch v := value.Message.(type) {
switch v := value.(type) {
case *api.IPAddressPrefix:
switch rf {
case bgp.RF_IPv4_UC:
@@ -837,13 +837,13 @@ func UnmarshalNLRI(rf bgp.RouteFamily, an *any.Any) (bgp.AddrPrefixInterface, er
}
if nlri == nil {
return nil, fmt.Errorf("invalid nlri for %s family: %s", rf.String(), value.Message)
return nil, fmt.Errorf("invalid nlri for %s family: %s", rf.String(), value)
}
return nlri, nil
}
func UnmarshalNLRIs(rf bgp.RouteFamily, values []*any.Any) ([]bgp.AddrPrefixInterface, error) {
func UnmarshalNLRIs(rf bgp.RouteFamily, values []*apb.Any) ([]bgp.AddrPrefixInterface, error) {
nlris := make([]bgp.AddrPrefixInterface, 0, len(values))
for _, an := range values {
nlri, err := UnmarshalNLRI(rf, an)
@@ -879,7 +879,7 @@ func NewMpUnreachNLRIAttributeFromNative(a *bgp.PathAttributeMpUnreachNLRI) *api
}
}
func MarshalRT(rt bgp.ExtendedCommunityInterface) *any.Any {
func MarshalRT(rt bgp.ExtendedCommunityInterface) *apb.Any {
var r proto.Message
switch v := rt.(type) {
case *bgp.TwoOctetAsSpecificExtended:
@@ -910,24 +910,24 @@ func MarshalRT(rt bgp.ExtendedCommunityInterface) *any.Any {
}).Warn("invalid rt type to marshal")
return nil
}
a, _ := ptypes.MarshalAny(r)
a, _ := apb.New(r)
return a
}
func MarshalRTs(values []bgp.ExtendedCommunityInterface) []*any.Any {
rts := make([]*any.Any, 0, len(values))
func MarshalRTs(values []bgp.ExtendedCommunityInterface) []*apb.Any {
rts := make([]*apb.Any, 0, len(values))
for _, rt := range values {
rts = append(rts, MarshalRT(rt))
}
return rts
}
func UnmarshalRT(a *any.Any) (bgp.ExtendedCommunityInterface, error) {
var value ptypes.DynamicAny
if err := ptypes.UnmarshalAny(a, &value); err != nil {
func UnmarshalRT(a *apb.Any) (bgp.ExtendedCommunityInterface, error) {
value, err := a.UnmarshalNew()
if err != nil {
return nil, fmt.Errorf("failed to unmarshal route target: %s", err)
}
switch v := value.Message.(type) {
switch v := value.(type) {
case *api.TwoOctetAsSpecificExtended:
return bgp.NewTwoOctetAsSpecificExtended(bgp.ExtendedCommunityAttrSubType(v.SubType), uint16(v.As), v.LocalAdmin, v.IsTransitive), nil
case *api.IPv4AddressSpecificExtended:
@@ -942,7 +942,7 @@ func UnmarshalRT(a *any.Any) (bgp.ExtendedCommunityInterface, error) {
return nil, fmt.Errorf("invalid route target type: %s", a.TypeUrl)
}
func UnmarshalRTs(values []*any.Any) ([]bgp.ExtendedCommunityInterface, error) {
func UnmarshalRTs(values []*apb.Any) ([]bgp.ExtendedCommunityInterface, error) {
rts := make([]bgp.ExtendedCommunityInterface, 0, len(values))
for _, an := range values {
rt, err := UnmarshalRT(an)
@@ -955,7 +955,7 @@ func UnmarshalRTs(values []*any.Any) ([]bgp.ExtendedCommunityInterface, error) {
}
func NewExtendedCommunitiesAttributeFromNative(a *bgp.PathAttributeExtendedCommunities) *api.ExtendedCommunitiesAttribute {
communities := make([]*any.Any, 0, len(a.Value))
communities := make([]*apb.Any, 0, len(a.Value))
for _, value := range a.Value {
var community proto.Message
switch v := value.(type) {
@@ -1063,7 +1063,7 @@ func NewExtendedCommunitiesAttributeFromNative(a *bgp.PathAttributeExtendedCommu
}).Warn("unsupported extended community")
return nil
}
an, _ := ptypes.MarshalAny(community)
an, _ := apb.New(community)
communities = append(communities, an)
}
return &api.ExtendedCommunitiesAttribute{
@@ -1075,11 +1075,11 @@ func unmarshalExComm(a *api.ExtendedCommunitiesAttribute) (*bgp.PathAttributeExt
communities := make([]bgp.ExtendedCommunityInterface, 0, len(a.Communities))
for _, an := range a.Communities {
var community bgp.ExtendedCommunityInterface
var value ptypes.DynamicAny
if err := ptypes.UnmarshalAny(an, &value); err != nil {
value, err := an.UnmarshalNew()
if err != nil {
return nil, fmt.Errorf("failed to unmarshal extended community: %s", err)
}
switch v := value.Message.(type) {
switch v := value.(type) {
case *api.TwoOctetAsSpecificExtended:
community = bgp.NewTwoOctetAsSpecificExtended(bgp.ExtendedCommunityAttrSubType(v.SubType), uint16(v.As), v.LocalAdmin, v.IsTransitive)
case *api.IPv4AddressSpecificExtended:
@@ -1122,7 +1122,7 @@ func unmarshalExComm(a *api.ExtendedCommunitiesAttribute) (*bgp.PathAttributeExt
community = bgp.NewUnknownExtended(bgp.ExtendedCommunityAttrType(v.Type), v.Value)
}
if community == nil {
return nil, fmt.Errorf("invalid extended community: %v", value.Message)
return nil, fmt.Errorf("invalid extended community: %v", value)
}
communities = append(communities, community)
}
@@ -1166,7 +1166,7 @@ func NewPmsiTunnelAttributeFromNative(a *bgp.PathAttributePmsiTunnel) *api.PmsiT
func NewTunnelEncapAttributeFromNative(a *bgp.PathAttributeTunnelEncap) *api.TunnelEncapAttribute {
tlvs := make([]*api.TunnelEncapTLV, 0, len(a.Value))
for _, v := range a.Value {
subTlvs := make([]*any.Any, 0, len(v.Value))
subTlvs := make([]*apb.Any, 0, len(v.Value))
for _, s := range v.Value {
var subTlv proto.Message
switch sv := s.(type) {
@@ -1227,7 +1227,7 @@ func NewTunnelEncapAttributeFromNative(a *bgp.PathAttributeTunnelEncap) *api.Tun
Segments: MarshalSRSegments(sv.Segments),
}
}
an, _ := ptypes.MarshalAny(subTlv)
an, _ := apb.New(subTlv)
subTlvs = append(subTlvs, an)
}
tlvs = append(tlvs, &api.TunnelEncapTLV{
@@ -1241,7 +1241,7 @@ func NewTunnelEncapAttributeFromNative(a *bgp.PathAttributeTunnelEncap) *api.Tun
}
func NewIP6ExtendedCommunitiesAttributeFromNative(a *bgp.PathAttributeIP6ExtendedCommunities) *api.IP6ExtendedCommunitiesAttribute {
communities := make([]*any.Any, 0, len(a.Value))
communities := make([]*apb.Any, 0, len(a.Value))
for _, value := range a.Value {
var community proto.Message
switch v := value.(type) {
@@ -1264,7 +1264,7 @@ func NewIP6ExtendedCommunitiesAttributeFromNative(a *bgp.PathAttributeIP6Extende
}).Warn("invalid ipv6 extended community")
return nil
}
an, _ := ptypes.MarshalAny(community)
an, _ := apb.New(community)
communities = append(communities, an)
}
return &api.IP6ExtendedCommunitiesAttribute{
@@ -1273,7 +1273,7 @@ func NewIP6ExtendedCommunitiesAttributeFromNative(a *bgp.PathAttributeIP6Extende
}
func NewAigpAttributeFromNative(a *bgp.PathAttributeAigp) *api.AigpAttribute {
tlvs := make([]*any.Any, 0, len(a.Values))
tlvs := make([]*apb.Any, 0, len(a.Values))
for _, value := range a.Values {
var tlv proto.Message
switch v := value.(type) {
@@ -1287,7 +1287,7 @@ func NewAigpAttributeFromNative(a *bgp.PathAttributeAigp) *api.AigpAttribute {
Value: v.Value,
}
}
an, _ := ptypes.MarshalAny(tlv)
an, _ := apb.New(tlv)
tlvs = append(tlvs, an)
}
return &api.AigpAttribute{
@@ -1444,85 +1444,85 @@ func NewUnknownAttributeFromNative(a *bgp.PathAttributeUnknown) *api.UnknownAttr
}
}
func MarshalPathAttributes(attrList []bgp.PathAttributeInterface) []*any.Any {
anyList := make([]*any.Any, 0, len(attrList))
func MarshalPathAttributes(attrList []bgp.PathAttributeInterface) []*apb.Any {
anyList := make([]*apb.Any, 0, len(attrList))
for _, attr := range attrList {
switch a := attr.(type) {
case *bgp.PathAttributeOrigin:
n, _ := ptypes.MarshalAny(NewOriginAttributeFromNative(a))
n, _ := apb.New(NewOriginAttributeFromNative(a))
anyList = append(anyList, n)
case *bgp.PathAttributeAsPath:
n, _ := ptypes.MarshalAny(NewAsPathAttributeFromNative(a))
n, _ := apb.New(NewAsPathAttributeFromNative(a))
anyList = append(anyList, n)
case *bgp.PathAttributeNextHop:
n, _ := ptypes.MarshalAny(NewNextHopAttributeFromNative(a))
n, _ := apb.New(NewNextHopAttributeFromNative(a))
anyList = append(anyList, n)
case *bgp.PathAttributeMultiExitDisc:
n, _ := ptypes.MarshalAny(NewMultiExitDiscAttributeFromNative(a))
n, _ := apb.New(NewMultiExitDiscAttributeFromNative(a))
anyList = append(anyList, n)
case *bgp.PathAttributeLocalPref:
n, _ := ptypes.MarshalAny(NewLocalPrefAttributeFromNative(a))
n, _ := apb.New(NewLocalPrefAttributeFromNative(a))
anyList = append(anyList, n)
case *bgp.PathAttributeAtomicAggregate:
n, _ := ptypes.MarshalAny(NewAtomicAggregateAttributeFromNative(a))
n, _ := apb.New(NewAtomicAggregateAttributeFromNative(a))
anyList = append(anyList, n)
case *bgp.PathAttributeAggregator:
n, _ := ptypes.MarshalAny(NewAggregatorAttributeFromNative(a))
n, _ := apb.New(NewAggregatorAttributeFromNative(a))
anyList = append(anyList, n)
case *bgp.PathAttributeCommunities:
n, _ := ptypes.MarshalAny(NewCommunitiesAttributeFromNative(a))
n, _ := apb.New(NewCommunitiesAttributeFromNative(a))
anyList = append(anyList, n)
case *bgp.PathAttributeOriginatorId:
n, _ := ptypes.MarshalAny(NewOriginatorIdAttributeFromNative(a))
n, _ := apb.New(NewOriginatorIdAttributeFromNative(a))
anyList = append(anyList, n)
case *bgp.PathAttributeClusterList:
n, _ := ptypes.MarshalAny(NewClusterListAttributeFromNative(a))
n, _ := apb.New(NewClusterListAttributeFromNative(a))
anyList = append(anyList, n)
case *bgp.PathAttributeMpReachNLRI:
n, _ := ptypes.MarshalAny(NewMpReachNLRIAttributeFromNative(a))
n, _ := apb.New(NewMpReachNLRIAttributeFromNative(a))
anyList = append(anyList, n)
case *bgp.PathAttributeMpUnreachNLRI:
n, _ := ptypes.MarshalAny(NewMpUnreachNLRIAttributeFromNative(a))
n, _ := apb.New(NewMpUnreachNLRIAttributeFromNative(a))
anyList = append(anyList, n)
case *bgp.PathAttributeExtendedCommunities:
n, _ := ptypes.MarshalAny(NewExtendedCommunitiesAttributeFromNative(a))
n, _ := apb.New(NewExtendedCommunitiesAttributeFromNative(a))
anyList = append(anyList, n)
case *bgp.PathAttributeAs4Path:
n, _ := ptypes.MarshalAny(NewAs4PathAttributeFromNative(a))
n, _ := apb.New(NewAs4PathAttributeFromNative(a))
anyList = append(anyList, n)
case *bgp.PathAttributeAs4Aggregator:
n, _ := ptypes.MarshalAny(NewAs4AggregatorAttributeFromNative(a))
n, _ := apb.New(NewAs4AggregatorAttributeFromNative(a))
anyList = append(anyList, n)
case *bgp.PathAttributePmsiTunnel:
n, _ := ptypes.MarshalAny(NewPmsiTunnelAttributeFromNative(a))
n, _ := apb.New(NewPmsiTunnelAttributeFromNative(a))
anyList = append(anyList, n)
case *bgp.PathAttributeTunnelEncap:
n, _ := ptypes.MarshalAny(NewTunnelEncapAttributeFromNative(a))
n, _ := apb.New(NewTunnelEncapAttributeFromNative(a))
anyList = append(anyList, n)
case *bgp.PathAttributeIP6ExtendedCommunities:
n, _ := ptypes.MarshalAny(NewIP6ExtendedCommunitiesAttributeFromNative(a))
n, _ := apb.New(NewIP6ExtendedCommunitiesAttributeFromNative(a))
anyList = append(anyList, n)
case *bgp.PathAttributeAigp:
n, _ := ptypes.MarshalAny(NewAigpAttributeFromNative(a))
n, _ := apb.New(NewAigpAttributeFromNative(a))
anyList = append(anyList, n)
case *bgp.PathAttributeLargeCommunities:
n, _ := ptypes.MarshalAny(NewLargeCommunitiesAttributeFromNative(a))
n, _ := apb.New(NewLargeCommunitiesAttributeFromNative(a))
anyList = append(anyList, n)
case *bgp.PathAttributeLs:
n, _ := ptypes.MarshalAny(NewLsAttributeFromNative(a))
n, _ := apb.New(NewLsAttributeFromNative(a))
anyList = append(anyList, n)
case *bgp.PathAttributePrefixSID:
n, _ := ptypes.MarshalAny(NewPrefixSIDAttributeFromNative(a))
n, _ := apb.New(NewPrefixSIDAttributeFromNative(a))
anyList = append(anyList, n)
case *bgp.PathAttributeUnknown:
n, _ := ptypes.MarshalAny(NewUnknownAttributeFromNative(a))
n, _ := apb.New(NewUnknownAttributeFromNative(a))
anyList = append(anyList, n)
}
}
return anyList
}
func UnmarshalPathAttributes(values []*any.Any) ([]bgp.PathAttributeInterface, error) {
func UnmarshalPathAttributes(values []*apb.Any) ([]bgp.PathAttributeInterface, error) {
attrList := make([]bgp.PathAttributeInterface, 0, len(values))
typeMap := make(map[bgp.BGPAttrType]struct{})
for _, an := range values {
@@ -1539,12 +1539,12 @@ func UnmarshalPathAttributes(values []*any.Any) ([]bgp.PathAttributeInterface, e
return attrList, nil
}
func unmarshalAttribute(an *any.Any) (bgp.PathAttributeInterface, error) {
var value ptypes.DynamicAny
if err := ptypes.UnmarshalAny(an, &value); err != nil {
func unmarshalAttribute(an *apb.Any) (bgp.PathAttributeInterface, error) {
value, err := an.UnmarshalNew()
if err != nil {
return nil, fmt.Errorf("failed to unmarshal route distinguisher: %s", err)
}
switch a := value.Message.(type) {
switch a := value.(type) {
case *api.OriginAttribute:
return bgp.NewPathAttributeOrigin(uint8(a.Origin)), nil
case *api.AsPathAttribute:
@@ -1662,11 +1662,11 @@ func unmarshalAttribute(an *any.Any) (bgp.PathAttributeInterface, error) {
subTlvs := make([]bgp.TunnelEncapSubTLVInterface, 0, len(tlv.Tlvs))
for _, an := range tlv.Tlvs {
var subTlv bgp.TunnelEncapSubTLVInterface
var subValue ptypes.DynamicAny
if err := ptypes.UnmarshalAny(an, &subValue); err != nil {
subValue, err := an.UnmarshalNew()
if err != nil {
return nil, fmt.Errorf("failed to unmarshal tunnel encapsulation attribute sub tlv: %s", err)
}
switch sv := subValue.Message.(type) {
switch sv := subValue.(type) {
case *api.TunnelEncapSubTLVEncapsulation:
subTlv = bgp.NewTunnelEncapSubTLVEncapsulation(sv.Key, sv.Cookie)
case *api.TunnelEncapSubTLVProtocol:
@@ -1728,7 +1728,7 @@ func unmarshalAttribute(an *any.Any) (bgp.PathAttributeInterface, error) {
case *api.TunnelEncapSubTLVUnknown:
subTlv = bgp.NewTunnelEncapSubTLVUnknown(bgp.EncapSubTLVType(sv.Type), sv.Value)
default:
return nil, fmt.Errorf("invalid tunnel encapsulation attribute sub tlv: %v type: %T", subValue.Message, sv)
return nil, fmt.Errorf("invalid tunnel encapsulation attribute sub tlv: %v type: %T", subValue, sv)
}
subTlvs = append(subTlvs, subTlv)
}
@@ -1739,18 +1739,18 @@ func unmarshalAttribute(an *any.Any) (bgp.PathAttributeInterface, error) {
communities := make([]bgp.ExtendedCommunityInterface, 0, len(a.Communities))
for _, an := range a.Communities {
var community bgp.ExtendedCommunityInterface
var value ptypes.DynamicAny
if err := ptypes.UnmarshalAny(an, &value); err != nil {
value, err := an.UnmarshalNew()
if err != nil {
return nil, fmt.Errorf("failed to unmarshal ipv6 extended community: %s", err)
}
switch v := value.Message.(type) {
switch v := value.(type) {
case *api.IPv6AddressSpecificExtended:
community = bgp.NewIPv6AddressSpecificExtended(bgp.ExtendedCommunityAttrSubType(v.SubType), v.Address, uint16(v.LocalAdmin), v.IsTransitive)
case *api.RedirectIPv6AddressSpecificExtended:
community = bgp.NewRedirectIPv6AddressSpecificExtended(v.Address, uint16(v.LocalAdmin))
}
if community == nil {
return nil, fmt.Errorf("invalid ipv6 extended community: %v", value.Message)
return nil, fmt.Errorf("invalid ipv6 extended community: %v", value)
}
communities = append(communities, community)
}
@@ -1760,18 +1760,18 @@ func unmarshalAttribute(an *any.Any) (bgp.PathAttributeInterface, error) {
tlvs := make([]bgp.AigpTLVInterface, 0, len(a.Tlvs))
for _, an := range a.Tlvs {
var tlv bgp.AigpTLVInterface
var value ptypes.DynamicAny
if err := ptypes.UnmarshalAny(an, &value); err != nil {
value, err := an.UnmarshalNew()
if err != nil {
return nil, fmt.Errorf("failed to unmarshal aigp attribute tlv: %s", err)
}
switch v := value.Message.(type) {
switch v := value.(type) {
case *api.AigpTLVIGPMetric:
tlv = bgp.NewAigpTLVIgpMetric(v.Metric)
case *api.AigpTLVUnknown:
tlv = bgp.NewAigpTLVDefault(bgp.AigpTLVType(v.Type), v.Value)
}
if tlv == nil {
return nil, fmt.Errorf("invalid aigp attribute tlv: %v", value.Message)
return nil, fmt.Errorf("invalid aigp attribute tlv: %v", value)
}
tlvs = append(tlvs, tlv)
}
@@ -1792,7 +1792,7 @@ func unmarshalAttribute(an *any.Any) (bgp.PathAttributeInterface, error) {
}
// MarshalSRBSID marshals SR Policy Binding SID Sub TLV structure
func MarshalSRBSID(bsid *bgp.TunnelEncapSubTLVSRBSID) *any.Any {
func MarshalSRBSID(bsid *bgp.TunnelEncapSubTLVSRBSID) *apb.Any {
var r proto.Message
s := &api.SRBindingSID{
Sid: make([]byte, len(bsid.BSID.Value)),
@@ -1801,17 +1801,17 @@ func MarshalSRBSID(bsid *bgp.TunnelEncapSubTLVSRBSID) *any.Any {
s.SFlag = bsid.Flags&0x80 == 0x80
s.IFlag = bsid.Flags&0x40 == 0x40
r = s
a, _ := ptypes.MarshalAny(r)
a, _ := apb.New(r)
return a
}
// UnmarshalSRBSID unmarshals SR Policy Binding SID Sub TLV and returns native TunnelEncapSubTLVInterface interface
func UnmarshalSRBSID(bsid *any.Any) (bgp.TunnelEncapSubTLVInterface, error) {
var value ptypes.DynamicAny
if err := ptypes.UnmarshalAny(bsid, &value); err != nil {
func UnmarshalSRBSID(bsid *apb.Any) (bgp.TunnelEncapSubTLVInterface, error) {
value, err := bsid.UnmarshalNew()
if err != nil {
return nil, fmt.Errorf("failed to unmarshal tunnel encap sub tlv: %s", err)
}
switch v := value.Message.(type) {
switch v := value.(type) {
case *api.SRBindingSID:
b, err := bgp.NewBSID(v.Sid)
if err != nil {
@@ -1863,8 +1863,8 @@ func UnmarshalSRBSID(bsid *any.Any) (bgp.TunnelEncapSubTLVInterface, error) {
}
// MarshalSRSegments marshals a slice of SR Policy Segment List
func MarshalSRSegments(segs []bgp.TunnelEncapSubTLVInterface) []*any.Any {
anyList := make([]*any.Any, 0, len(segs))
func MarshalSRSegments(segs []bgp.TunnelEncapSubTLVInterface) []*apb.Any {
anyList := make([]*apb.Any, 0, len(segs))
for _, seg := range segs {
var r proto.Message
switch s := seg.(type) {
@@ -1903,24 +1903,24 @@ func MarshalSRSegments(segs []bgp.TunnelEncapSubTLVInterface) []*any.Any {
// Unrecognize Segment type, skip it
continue
}
a, _ := ptypes.MarshalAny(r)
a, _ := apb.New(r)
anyList = append(anyList, a)
}
return anyList
}
// UnmarshalSRSegments unmarshals SR Policy Segments slice of structs
func UnmarshalSRSegments(s []*any.Any) ([]bgp.TunnelEncapSubTLVInterface, error) {
func UnmarshalSRSegments(s []*apb.Any) ([]bgp.TunnelEncapSubTLVInterface, error) {
if len(s) == 0 {
return nil, nil
}
segments := make([]bgp.TunnelEncapSubTLVInterface, len(s))
for i := 0; i < len(s); i++ {
var value ptypes.DynamicAny
if err := ptypes.UnmarshalAny(s[i], &value); err != nil {
value, err := s[i].UnmarshalNew()
if err != nil {
return nil, fmt.Errorf("failed to unmarshal SR Policy Segment: %s", err)
}
switch v := value.Message.(type) {
switch v := value.(type) {
case *api.SegmentTypeA:
seg := &bgp.SegmentTypeA{
TunnelEncapSubTLV: bgp.TunnelEncapSubTLV{
+155 -155
View File
@@ -20,11 +20,11 @@ import (
"net"
"testing"
"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"
"google.golang.org/protobuf/proto"
apb "google.golang.org/protobuf/types/known/anypb"
api "github.com/osrg/gobgp/v3/api"
"github.com/osrg/gobgp/v3/pkg/packet/bgp"
"github.com/stretchr/testify/assert"
)
@@ -34,7 +34,7 @@ func Test_OriginAttribute(t *testing.T) {
input := &api.OriginAttribute{
Origin: 0, // IGP
}
a, err := ptypes.MarshalAny(input)
a, err := apb.New(input)
assert.Nil(err)
n, err := unmarshalAttribute(a)
assert.Nil(err)
@@ -59,7 +59,7 @@ func Test_AsPathAttribute(t *testing.T) {
},
}
a, err := ptypes.MarshalAny(input)
a, err := apb.New(input)
assert.Nil(err)
n, err := unmarshalAttribute(a)
assert.Nil(err)
@@ -78,7 +78,7 @@ func Test_NextHopAttribute(t *testing.T) {
NextHop: "192.168.0.1",
}
a, err := ptypes.MarshalAny(input)
a, err := apb.New(input)
assert.Nil(err)
n, err := unmarshalAttribute(a)
assert.Nil(err)
@@ -94,7 +94,7 @@ func Test_MultiExitDiscAttribute(t *testing.T) {
Med: 100,
}
a, err := ptypes.MarshalAny(input)
a, err := apb.New(input)
assert.Nil(err)
n, err := unmarshalAttribute(a)
assert.Nil(err)
@@ -110,7 +110,7 @@ func Test_LocalPrefAttribute(t *testing.T) {
LocalPref: 100,
}
a, err := ptypes.MarshalAny(input)
a, err := apb.New(input)
assert.Nil(err)
n, err := unmarshalAttribute(a)
assert.Nil(err)
@@ -124,7 +124,7 @@ func Test_AtomicAggregateAttribute(t *testing.T) {
input := &api.AtomicAggregateAttribute{}
a, err := ptypes.MarshalAny(input)
a, err := apb.New(input)
assert.Nil(err)
n, err := unmarshalAttribute(a)
assert.Nil(err)
@@ -142,7 +142,7 @@ func Test_AggregatorAttribute(t *testing.T) {
Address: "1.1.1.1",
}
a, err := ptypes.MarshalAny(input)
a, err := apb.New(input)
assert.Nil(err)
n, err := unmarshalAttribute(a)
assert.Nil(err)
@@ -159,7 +159,7 @@ func Test_CommunitiesAttribute(t *testing.T) {
Communities: []uint32{100, 200},
}
a, err := ptypes.MarshalAny(input)
a, err := apb.New(input)
assert.Nil(err)
n, err := unmarshalAttribute(a)
assert.Nil(err)
@@ -175,7 +175,7 @@ func Test_OriginatorIdAttribute(t *testing.T) {
Id: "1.1.1.1",
}
a, err := ptypes.MarshalAny(input)
a, err := apb.New(input)
assert.Nil(err)
n, err := unmarshalAttribute(a)
assert.Nil(err)
@@ -191,7 +191,7 @@ func Test_ClusterListAttribute(t *testing.T) {
Ids: []string{"1.1.1.1", "2.2.2.2"},
}
a, err := ptypes.MarshalAny(input)
a, err := apb.New(input)
assert.Nil(err)
n, err := unmarshalAttribute(a)
assert.Nil(err)
@@ -203,14 +203,14 @@ func Test_ClusterListAttribute(t *testing.T) {
func Test_MpReachNLRIAttribute_IPv4_UC(t *testing.T) {
assert := assert.New(t)
nlris := make([]*any.Any, 0, 2)
a, err := ptypes.MarshalAny(&api.IPAddressPrefix{
nlris := make([]*apb.Any, 0, 2)
a, err := apb.New(&api.IPAddressPrefix{
PrefixLen: 24,
Prefix: "192.168.101.0",
})
assert.Nil(err)
nlris = append(nlris, a)
a, err = ptypes.MarshalAny(&api.IPAddressPrefix{
a, err = apb.New(&api.IPAddressPrefix{
PrefixLen: 24,
Prefix: "192.168.201.0",
})
@@ -226,7 +226,7 @@ func Test_MpReachNLRIAttribute_IPv4_UC(t *testing.T) {
Nlris: nlris,
}
a, err = ptypes.MarshalAny(input)
a, err = apb.New(input)
assert.Nil(err)
n, err := unmarshalAttribute(a)
assert.Nil(err)
@@ -246,14 +246,14 @@ func Test_MpReachNLRIAttribute_IPv4_UC(t *testing.T) {
func Test_MpReachNLRIAttribute_IPv6_UC(t *testing.T) {
assert := assert.New(t)
nlris := make([]*any.Any, 0, 2)
a, err := ptypes.MarshalAny(&api.IPAddressPrefix{
nlris := make([]*apb.Any, 0, 2)
a, err := apb.New(&api.IPAddressPrefix{
PrefixLen: 64,
Prefix: "2001:db8:1::",
})
assert.Nil(err)
nlris = append(nlris, a)
a, err = ptypes.MarshalAny(&api.IPAddressPrefix{
a, err = apb.New(&api.IPAddressPrefix{
PrefixLen: 64,
Prefix: "2001:db8:2::",
})
@@ -269,7 +269,7 @@ func Test_MpReachNLRIAttribute_IPv6_UC(t *testing.T) {
Nlris: nlris,
}
a, err = ptypes.MarshalAny(input)
a, err = apb.New(input)
assert.Nil(err)
n, err := unmarshalAttribute(a)
assert.Nil(err)
@@ -289,15 +289,15 @@ func Test_MpReachNLRIAttribute_IPv6_UC(t *testing.T) {
func Test_MpReachNLRIAttribute_IPv4_MPLS(t *testing.T) {
assert := assert.New(t)
nlris := make([]*any.Any, 0, 2)
a, err := ptypes.MarshalAny(&api.LabeledIPAddressPrefix{
nlris := make([]*apb.Any, 0, 2)
a, err := apb.New(&api.LabeledIPAddressPrefix{
Labels: []uint32{100},
PrefixLen: 24,
Prefix: "192.168.101.0",
})
assert.Nil(err)
nlris = append(nlris, a)
a, err = ptypes.MarshalAny(&api.LabeledIPAddressPrefix{
a, err = apb.New(&api.LabeledIPAddressPrefix{
Labels: []uint32{200},
PrefixLen: 24,
Prefix: "192.168.201.0",
@@ -314,7 +314,7 @@ func Test_MpReachNLRIAttribute_IPv4_MPLS(t *testing.T) {
Nlris: nlris,
}
a, err = ptypes.MarshalAny(input)
a, err = apb.New(input)
assert.Nil(err)
n, err := unmarshalAttribute(a)
assert.Nil(err)
@@ -334,15 +334,15 @@ func Test_MpReachNLRIAttribute_IPv4_MPLS(t *testing.T) {
func Test_MpReachNLRIAttribute_IPv6_MPLS(t *testing.T) {
assert := assert.New(t)
nlris := make([]*any.Any, 0, 2)
a, err := ptypes.MarshalAny(&api.LabeledIPAddressPrefix{
nlris := make([]*apb.Any, 0, 2)
a, err := apb.New(&api.LabeledIPAddressPrefix{
Labels: []uint32{100},
PrefixLen: 64,
Prefix: "2001:db8:1::",
})
assert.Nil(err)
nlris = append(nlris, a)
a, err = ptypes.MarshalAny(&api.LabeledIPAddressPrefix{
a, err = apb.New(&api.LabeledIPAddressPrefix{
Labels: []uint32{200},
PrefixLen: 64,
Prefix: "2001:db8:2::",
@@ -359,7 +359,7 @@ func Test_MpReachNLRIAttribute_IPv6_MPLS(t *testing.T) {
Nlris: nlris,
}
a, err = ptypes.MarshalAny(input)
a, err = apb.New(input)
assert.Nil(err)
n, err := unmarshalAttribute(a)
assert.Nil(err)
@@ -379,13 +379,13 @@ func Test_MpReachNLRIAttribute_IPv6_MPLS(t *testing.T) {
func Test_MpReachNLRIAttribute_IPv4_ENCAP(t *testing.T) {
assert := assert.New(t)
nlris := make([]*any.Any, 0, 2)
a, err := ptypes.MarshalAny(&api.EncapsulationNLRI{
nlris := make([]*apb.Any, 0, 2)
a, err := apb.New(&api.EncapsulationNLRI{
Address: "192.168.101.1",
})
assert.Nil(err)
nlris = append(nlris, a)
a, err = ptypes.MarshalAny(&api.EncapsulationNLRI{
a, err = apb.New(&api.EncapsulationNLRI{
Address: "192.168.201.1",
})
assert.Nil(err)
@@ -400,7 +400,7 @@ func Test_MpReachNLRIAttribute_IPv4_ENCAP(t *testing.T) {
Nlris: nlris,
}
a, err = ptypes.MarshalAny(input)
a, err = apb.New(input)
assert.Nil(err)
n, err := unmarshalAttribute(a)
assert.Nil(err)
@@ -420,13 +420,13 @@ func Test_MpReachNLRIAttribute_IPv4_ENCAP(t *testing.T) {
func Test_MpReachNLRIAttribute_IPv6_ENCAP(t *testing.T) {
assert := assert.New(t)
nlris := make([]*any.Any, 0, 2)
a, err := ptypes.MarshalAny(&api.EncapsulationNLRI{
nlris := make([]*apb.Any, 0, 2)
a, err := apb.New(&api.EncapsulationNLRI{
Address: "2001:db8:1::1",
})
assert.Nil(err)
nlris = append(nlris, a)
a, err = ptypes.MarshalAny(&api.EncapsulationNLRI{
a, err = apb.New(&api.EncapsulationNLRI{
Address: "2001:db8:2::1",
})
assert.Nil(err)
@@ -441,7 +441,7 @@ func Test_MpReachNLRIAttribute_IPv6_ENCAP(t *testing.T) {
Nlris: nlris,
}
a, err = ptypes.MarshalAny(input)
a, err = apb.New(input)
assert.Nil(err)
n, err := unmarshalAttribute(a)
assert.Nil(err)
@@ -461,8 +461,8 @@ func Test_MpReachNLRIAttribute_IPv6_ENCAP(t *testing.T) {
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{
nlris := make([]*apb.Any, 0, 1)
rd, err := apb.New(&api.RouteDistinguisherTwoOctetAS{
Admin: 65000,
Assigned: 100,
})
@@ -471,7 +471,7 @@ func Test_MpReachNLRIAttribute_EVPN_AD_Route(t *testing.T) {
Type: 0,
Value: []byte{1, 2, 3, 4, 5, 6, 7, 8, 9},
}
a, err := ptypes.MarshalAny(&api.EVPNEthernetAutoDiscoveryRoute{
a, err := apb.New(&api.EVPNEthernetAutoDiscoveryRoute{
Rd: rd,
Esi: esi,
EthernetTag: 100,
@@ -489,7 +489,7 @@ func Test_MpReachNLRIAttribute_EVPN_AD_Route(t *testing.T) {
Nlris: nlris,
}
a, err = ptypes.MarshalAny(input)
a, err = apb.New(input)
assert.Nil(err)
n, err := unmarshalAttribute(a)
assert.Nil(err)
@@ -509,8 +509,8 @@ func Test_MpReachNLRIAttribute_EVPN_AD_Route(t *testing.T) {
func Test_MpReachNLRIAttribute_EVPN_MAC_IP_Route(t *testing.T) {
assert := assert.New(t)
nlris := make([]*any.Any, 0, 1)
rd, err := ptypes.MarshalAny(&api.RouteDistinguisherIPAddress{
nlris := make([]*apb.Any, 0, 1)
rd, err := apb.New(&api.RouteDistinguisherIPAddress{
Admin: "1.1.1.1",
Assigned: 100,
})
@@ -519,7 +519,7 @@ func Test_MpReachNLRIAttribute_EVPN_MAC_IP_Route(t *testing.T) {
Type: 0,
Value: []byte{1, 2, 3, 4, 5, 6, 7, 8, 9},
}
a, err := ptypes.MarshalAny(&api.EVPNMACIPAdvertisementRoute{
a, err := apb.New(&api.EVPNMACIPAdvertisementRoute{
Rd: rd,
Esi: esi,
EthernetTag: 100,
@@ -539,7 +539,7 @@ func Test_MpReachNLRIAttribute_EVPN_MAC_IP_Route(t *testing.T) {
Nlris: nlris,
}
a, err = ptypes.MarshalAny(input)
a, err = apb.New(input)
assert.Nil(err)
n, err := unmarshalAttribute(a)
assert.Nil(err)
@@ -559,13 +559,13 @@ func Test_MpReachNLRIAttribute_EVPN_MAC_IP_Route(t *testing.T) {
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{
nlris := make([]*apb.Any, 0, 1)
rd, err := apb.New(&api.RouteDistinguisherFourOctetAS{
Admin: 65000,
Assigned: 100,
})
assert.Nil(err)
a, err := ptypes.MarshalAny(&api.EVPNInclusiveMulticastEthernetTagRoute{
a, err := apb.New(&api.EVPNInclusiveMulticastEthernetTagRoute{
Rd: rd,
EthernetTag: 100,
IpAddress: "192.168.101.1",
@@ -582,7 +582,7 @@ func Test_MpReachNLRIAttribute_EVPN_MC_Route(t *testing.T) {
Nlris: nlris,
}
a, err = ptypes.MarshalAny(input)
a, err = apb.New(input)
assert.Nil(err)
n, err := unmarshalAttribute(a)
assert.Nil(err)
@@ -602,8 +602,8 @@ func Test_MpReachNLRIAttribute_EVPN_MC_Route(t *testing.T) {
func Test_MpReachNLRIAttribute_EVPN_ES_Route(t *testing.T) {
assert := assert.New(t)
nlris := make([]*any.Any, 0, 1)
rd, err := ptypes.MarshalAny(&api.RouteDistinguisherIPAddress{
nlris := make([]*apb.Any, 0, 1)
rd, err := apb.New(&api.RouteDistinguisherIPAddress{
Admin: "1.1.1.1",
Assigned: 100,
})
@@ -612,7 +612,7 @@ func Test_MpReachNLRIAttribute_EVPN_ES_Route(t *testing.T) {
Type: 0,
Value: []byte{1, 2, 3, 4, 5, 6, 7, 8, 9},
}
a, err := ptypes.MarshalAny(&api.EVPNEthernetSegmentRoute{
a, err := apb.New(&api.EVPNEthernetSegmentRoute{
Rd: rd,
Esi: esi,
IpAddress: "192.168.101.1",
@@ -629,7 +629,7 @@ func Test_MpReachNLRIAttribute_EVPN_ES_Route(t *testing.T) {
Nlris: nlris,
}
a, err = ptypes.MarshalAny(input)
a, err = apb.New(input)
assert.Nil(err)
n, err := unmarshalAttribute(a)
assert.Nil(err)
@@ -649,8 +649,8 @@ func Test_MpReachNLRIAttribute_EVPN_ES_Route(t *testing.T) {
func Test_MpReachNLRIAttribute_EVPN_Prefix_Route(t *testing.T) {
assert := assert.New(t)
nlris := make([]*any.Any, 0, 1)
rd, err := ptypes.MarshalAny(&api.RouteDistinguisherIPAddress{
nlris := make([]*apb.Any, 0, 1)
rd, err := apb.New(&api.RouteDistinguisherIPAddress{
Admin: "1.1.1.1",
Assigned: 100,
})
@@ -659,7 +659,7 @@ func Test_MpReachNLRIAttribute_EVPN_Prefix_Route(t *testing.T) {
Type: 0,
Value: []byte{1, 2, 3, 4, 5, 6, 7, 8, 9},
}
a, err := ptypes.MarshalAny(&api.EVPNIPPrefixRoute{
a, err := apb.New(&api.EVPNIPPrefixRoute{
Rd: rd,
Esi: esi,
EthernetTag: 100,
@@ -680,7 +680,7 @@ func Test_MpReachNLRIAttribute_EVPN_Prefix_Route(t *testing.T) {
Nlris: nlris,
}
a, err = ptypes.MarshalAny(input)
a, err = apb.New(input)
assert.Nil(err)
n, err := unmarshalAttribute(a)
assert.Nil(err)
@@ -700,13 +700,13 @@ func Test_MpReachNLRIAttribute_EVPN_Prefix_Route(t *testing.T) {
func Test_MpReachNLRIAttribute_IPv4_VPN(t *testing.T) {
assert := assert.New(t)
nlris := make([]*any.Any, 0, 1)
rd, err := ptypes.MarshalAny(&api.RouteDistinguisherIPAddress{
nlris := make([]*apb.Any, 0, 1)
rd, err := apb.New(&api.RouteDistinguisherIPAddress{
Admin: "1.1.1.1",
Assigned: 100,
})
assert.Nil(err)
a, err := ptypes.MarshalAny(&api.LabeledVPNIPAddressPrefix{
a, err := apb.New(&api.LabeledVPNIPAddressPrefix{
Labels: []uint32{100, 200},
Rd: rd,
PrefixLen: 24,
@@ -724,7 +724,7 @@ func Test_MpReachNLRIAttribute_IPv4_VPN(t *testing.T) {
Nlris: nlris,
}
a, err = ptypes.MarshalAny(input)
a, err = apb.New(input)
assert.Nil(err)
n, err := unmarshalAttribute(a)
assert.Nil(err)
@@ -744,13 +744,13 @@ func Test_MpReachNLRIAttribute_IPv4_VPN(t *testing.T) {
func Test_MpReachNLRIAttribute_IPv6_VPN(t *testing.T) {
assert := assert.New(t)
nlris := make([]*any.Any, 0, 1)
rd, err := ptypes.MarshalAny(&api.RouteDistinguisherIPAddress{
nlris := make([]*apb.Any, 0, 1)
rd, err := apb.New(&api.RouteDistinguisherIPAddress{
Admin: "1.1.1.1",
Assigned: 100,
})
assert.Nil(err)
a, err := ptypes.MarshalAny(&api.LabeledVPNIPAddressPrefix{
a, err := apb.New(&api.LabeledVPNIPAddressPrefix{
Labels: []uint32{100, 200},
Rd: rd,
PrefixLen: 64,
@@ -768,7 +768,7 @@ func Test_MpReachNLRIAttribute_IPv6_VPN(t *testing.T) {
Nlris: nlris,
}
a, err = ptypes.MarshalAny(input)
a, err = apb.New(input)
assert.Nil(err)
n, err := unmarshalAttribute(a)
assert.Nil(err)
@@ -788,15 +788,15 @@ func Test_MpReachNLRIAttribute_IPv6_VPN(t *testing.T) {
func Test_MpReachNLRIAttribute_RTC_UC(t *testing.T) {
assert := assert.New(t)
nlris := make([]*any.Any, 0, 1)
rt, err := ptypes.MarshalAny(&api.IPv4AddressSpecificExtended{
nlris := make([]*apb.Any, 0, 1)
rt, err := apb.New(&api.IPv4AddressSpecificExtended{
IsTransitive: true,
SubType: 0x02, // Route Target
Address: "1.1.1.1",
LocalAdmin: 100,
})
assert.Nil(err)
a, err := ptypes.MarshalAny(&api.RouteTargetMembershipNLRI{
a, err := apb.New(&api.RouteTargetMembershipNLRI{
As: 65000,
Rt: rt,
})
@@ -812,7 +812,7 @@ func Test_MpReachNLRIAttribute_RTC_UC(t *testing.T) {
Nlris: nlris,
}
a, err = ptypes.MarshalAny(input)
a, err = apb.New(input)
assert.Nil(err)
n, err := unmarshalAttribute(a)
assert.Nil(err)
@@ -832,22 +832,22 @@ func Test_MpReachNLRIAttribute_RTC_UC(t *testing.T) {
func Test_MpReachNLRIAttribute_FS_IPv4_UC(t *testing.T) {
assert := assert.New(t)
rules := make([]*any.Any, 0, 3)
rule, err := ptypes.MarshalAny(&api.FlowSpecIPPrefix{
rules := make([]*apb.Any, 0, 3)
rule, err := apb.New(&api.FlowSpecIPPrefix{
Type: 1, // Destination Prefix
PrefixLen: 24,
Prefix: "192.168.101.0",
})
assert.Nil(err)
rules = append(rules, rule)
rule, err = ptypes.MarshalAny(&api.FlowSpecIPPrefix{
rule, err = apb.New(&api.FlowSpecIPPrefix{
Type: 2, // Source Prefix
PrefixLen: 24,
Prefix: "192.168.201.0",
})
assert.Nil(err)
rules = append(rules, rule)
rule, err = ptypes.MarshalAny(&api.FlowSpecComponent{
rule, err = apb.New(&api.FlowSpecComponent{
Type: 3, // IP Protocol
Items: []*api.FlowSpecComponentItem{
{
@@ -859,8 +859,8 @@ func Test_MpReachNLRIAttribute_FS_IPv4_UC(t *testing.T) {
assert.Nil(err)
rules = append(rules, rule)
nlris := make([]*any.Any, 0, 1)
a, err := ptypes.MarshalAny(&api.FlowSpecNLRI{
nlris := make([]*apb.Any, 0, 1)
a, err := apb.New(&api.FlowSpecNLRI{
Rules: rules,
})
assert.Nil(err)
@@ -875,7 +875,7 @@ func Test_MpReachNLRIAttribute_FS_IPv4_UC(t *testing.T) {
Nlris: nlris,
}
a, err = ptypes.MarshalAny(input)
a, err = apb.New(input)
assert.Nil(err)
n, err := unmarshalAttribute(a)
assert.Nil(err)
@@ -895,28 +895,28 @@ func Test_MpReachNLRIAttribute_FS_IPv4_UC(t *testing.T) {
func Test_MpReachNLRIAttribute_FS_IPv4_VPN(t *testing.T) {
assert := assert.New(t)
rd, err := ptypes.MarshalAny(&api.RouteDistinguisherIPAddress{
rd, err := apb.New(&api.RouteDistinguisherIPAddress{
Admin: "1.1.1.1",
Assigned: 100,
})
assert.Nil(err)
rules := make([]*any.Any, 0, 3)
rule, err := ptypes.MarshalAny(&api.FlowSpecIPPrefix{
rules := make([]*apb.Any, 0, 3)
rule, err := apb.New(&api.FlowSpecIPPrefix{
Type: 1, // Destination Prefix
PrefixLen: 24,
Prefix: "192.168.101.0",
})
assert.Nil(err)
rules = append(rules, rule)
rule, err = ptypes.MarshalAny(&api.FlowSpecIPPrefix{
rule, err = apb.New(&api.FlowSpecIPPrefix{
Type: 2, // Source Prefix
PrefixLen: 24,
Prefix: "192.168.201.0",
})
assert.Nil(err)
rules = append(rules, rule)
rule, err = ptypes.MarshalAny(&api.FlowSpecComponent{
rule, err = apb.New(&api.FlowSpecComponent{
Type: 3, // IP Protocol
Items: []*api.FlowSpecComponentItem{
{
@@ -928,8 +928,8 @@ func Test_MpReachNLRIAttribute_FS_IPv4_VPN(t *testing.T) {
assert.Nil(err)
rules = append(rules, rule)
nlris := make([]*any.Any, 0, 1)
a, err := ptypes.MarshalAny(&api.VPNFlowSpecNLRI{
nlris := make([]*apb.Any, 0, 1)
a, err := apb.New(&api.VPNFlowSpecNLRI{
Rd: rd,
Rules: rules,
})
@@ -945,7 +945,7 @@ func Test_MpReachNLRIAttribute_FS_IPv4_VPN(t *testing.T) {
Nlris: nlris,
}
a, err = ptypes.MarshalAny(input)
a, err = apb.New(input)
assert.Nil(err)
n, err := unmarshalAttribute(a)
assert.Nil(err)
@@ -965,22 +965,22 @@ func Test_MpReachNLRIAttribute_FS_IPv4_VPN(t *testing.T) {
func Test_MpReachNLRIAttribute_FS_IPv6_UC(t *testing.T) {
assert := assert.New(t)
rules := make([]*any.Any, 0, 3)
rule, err := ptypes.MarshalAny(&api.FlowSpecIPPrefix{
rules := make([]*apb.Any, 0, 3)
rule, err := apb.New(&api.FlowSpecIPPrefix{
Type: 1, // Destination Prefix
PrefixLen: 64,
Prefix: "2001:db8:1::",
})
assert.Nil(err)
rules = append(rules, rule)
rule, err = ptypes.MarshalAny(&api.FlowSpecIPPrefix{
rule, err = apb.New(&api.FlowSpecIPPrefix{
Type: 2, // Source Prefix
PrefixLen: 64,
Prefix: "2001:db8:2::",
})
assert.Nil(err)
rules = append(rules, rule)
rule, err = ptypes.MarshalAny(&api.FlowSpecComponent{
rule, err = apb.New(&api.FlowSpecComponent{
Type: 3, // Next Header
Items: []*api.FlowSpecComponentItem{
{
@@ -992,8 +992,8 @@ func Test_MpReachNLRIAttribute_FS_IPv6_UC(t *testing.T) {
assert.Nil(err)
rules = append(rules, rule)
nlris := make([]*any.Any, 0, 1)
a, err := ptypes.MarshalAny(&api.FlowSpecNLRI{
nlris := make([]*apb.Any, 0, 1)
a, err := apb.New(&api.FlowSpecNLRI{
Rules: rules,
})
assert.Nil(err)
@@ -1008,7 +1008,7 @@ func Test_MpReachNLRIAttribute_FS_IPv6_UC(t *testing.T) {
Nlris: nlris,
}
a, err = ptypes.MarshalAny(input)
a, err = apb.New(input)
assert.Nil(err)
n, err := unmarshalAttribute(a)
assert.Nil(err)
@@ -1028,28 +1028,28 @@ func Test_MpReachNLRIAttribute_FS_IPv6_UC(t *testing.T) {
func Test_MpReachNLRIAttribute_FS_IPv6_VPN(t *testing.T) {
assert := assert.New(t)
rd, err := ptypes.MarshalAny(&api.RouteDistinguisherIPAddress{
rd, err := apb.New(&api.RouteDistinguisherIPAddress{
Admin: "1.1.1.1",
Assigned: 100,
})
assert.Nil(err)
rules := make([]*any.Any, 0, 3)
rule, err := ptypes.MarshalAny(&api.FlowSpecIPPrefix{
rules := make([]*apb.Any, 0, 3)
rule, err := apb.New(&api.FlowSpecIPPrefix{
Type: 1, // Destination Prefix
PrefixLen: 64,
Prefix: "2001:db8:1::",
})
assert.Nil(err)
rules = append(rules, rule)
rule, err = ptypes.MarshalAny(&api.FlowSpecIPPrefix{
rule, err = apb.New(&api.FlowSpecIPPrefix{
Type: 2, // Source Prefix
PrefixLen: 64,
Prefix: "2001:db8:2::",
})
assert.Nil(err)
rules = append(rules, rule)
rule, err = ptypes.MarshalAny(&api.FlowSpecComponent{
rule, err = apb.New(&api.FlowSpecComponent{
Type: 3, // Next Header
Items: []*api.FlowSpecComponentItem{
{
@@ -1061,8 +1061,8 @@ func Test_MpReachNLRIAttribute_FS_IPv6_VPN(t *testing.T) {
assert.Nil(err)
rules = append(rules, rule)
nlris := make([]*any.Any, 0, 1)
a, err := ptypes.MarshalAny(&api.VPNFlowSpecNLRI{
nlris := make([]*apb.Any, 0, 1)
a, err := apb.New(&api.VPNFlowSpecNLRI{
Rd: rd,
Rules: rules,
})
@@ -1078,7 +1078,7 @@ func Test_MpReachNLRIAttribute_FS_IPv6_VPN(t *testing.T) {
Nlris: nlris,
}
a, err = ptypes.MarshalAny(input)
a, err = apb.New(input)
assert.Nil(err)
n, err := unmarshalAttribute(a)
assert.Nil(err)
@@ -1098,26 +1098,26 @@ func Test_MpReachNLRIAttribute_FS_IPv6_VPN(t *testing.T) {
func Test_MpReachNLRIAttribute_FS_L2_VPN(t *testing.T) {
assert := assert.New(t)
rd, err := ptypes.MarshalAny(&api.RouteDistinguisherIPAddress{
rd, err := apb.New(&api.RouteDistinguisherIPAddress{
Admin: "1.1.1.1",
Assigned: 100,
})
assert.Nil(err)
rules := make([]*any.Any, 0, 3)
rule, err := ptypes.MarshalAny(&api.FlowSpecMAC{
rules := make([]*apb.Any, 0, 3)
rule, err := apb.New(&api.FlowSpecMAC{
Type: 15, // Source MAC
Address: "aa:bb:cc:11:22:33",
})
assert.Nil(err)
rules = append(rules, rule)
rule, err = ptypes.MarshalAny(&api.FlowSpecMAC{
rule, err = apb.New(&api.FlowSpecMAC{
Type: 16, // Destination MAC
Address: "dd:ee:ff:11:22:33",
})
assert.Nil(err)
rules = append(rules, rule)
rule, err = ptypes.MarshalAny(&api.FlowSpecComponent{
rule, err = apb.New(&api.FlowSpecComponent{
Type: 21, // VLAN ID
Items: []*api.FlowSpecComponentItem{
{
@@ -1129,8 +1129,8 @@ func Test_MpReachNLRIAttribute_FS_L2_VPN(t *testing.T) {
assert.Nil(err)
rules = append(rules, rule)
nlris := make([]*any.Any, 0, 1)
a, err := ptypes.MarshalAny(&api.VPNFlowSpecNLRI{
nlris := make([]*apb.Any, 0, 1)
a, err := apb.New(&api.VPNFlowSpecNLRI{
Rd: rd,
Rules: rules,
})
@@ -1146,7 +1146,7 @@ func Test_MpReachNLRIAttribute_FS_L2_VPN(t *testing.T) {
Nlris: nlris,
}
a, err = ptypes.MarshalAny(input)
a, err = apb.New(input)
assert.Nil(err)
n, err := unmarshalAttribute(a)
assert.Nil(err)
@@ -1166,14 +1166,14 @@ func Test_MpReachNLRIAttribute_FS_L2_VPN(t *testing.T) {
func Test_MpUnreachNLRIAttribute_IPv4_UC(t *testing.T) {
assert := assert.New(t)
nlris := make([]*any.Any, 0, 2)
a, err := ptypes.MarshalAny(&api.IPAddressPrefix{
nlris := make([]*apb.Any, 0, 2)
a, err := apb.New(&api.IPAddressPrefix{
PrefixLen: 24,
Prefix: "192.168.101.0",
})
assert.Nil(err)
nlris = append(nlris, a)
a, err = ptypes.MarshalAny(&api.IPAddressPrefix{
a, err = apb.New(&api.IPAddressPrefix{
PrefixLen: 24,
Prefix: "192.168.201.0",
})
@@ -1188,7 +1188,7 @@ func Test_MpUnreachNLRIAttribute_IPv4_UC(t *testing.T) {
Nlris: nlris,
}
a, err = ptypes.MarshalAny(input)
a, err = apb.New(input)
assert.Nil(err)
n, err := unmarshalAttribute(a)
assert.Nil(err)
@@ -1207,8 +1207,8 @@ func Test_MpUnreachNLRIAttribute_IPv4_UC(t *testing.T) {
func Test_ExtendedCommunitiesAttribute(t *testing.T) {
assert := assert.New(t)
communities := make([]*any.Any, 0, 19)
a, err := ptypes.MarshalAny(&api.TwoOctetAsSpecificExtended{
communities := make([]*apb.Any, 0, 19)
a, err := apb.New(&api.TwoOctetAsSpecificExtended{
IsTransitive: true,
SubType: 0x02, // ROUTE_TARGET
As: 65001,
@@ -1216,7 +1216,7 @@ func Test_ExtendedCommunitiesAttribute(t *testing.T) {
})
assert.Nil(err)
communities = append(communities, a)
a, err = ptypes.MarshalAny(&api.IPv4AddressSpecificExtended{
a, err = apb.New(&api.IPv4AddressSpecificExtended{
IsTransitive: true,
SubType: 0x02, // ROUTE_TARGET
Address: "2.2.2.2",
@@ -1224,7 +1224,7 @@ func Test_ExtendedCommunitiesAttribute(t *testing.T) {
})
assert.Nil(err)
communities = append(communities, a)
a, err = ptypes.MarshalAny(&api.FourOctetAsSpecificExtended{
a, err = apb.New(&api.FourOctetAsSpecificExtended{
IsTransitive: true,
SubType: 0x02, // ROUTE_TARGET
As: 65003,
@@ -1232,96 +1232,96 @@ func Test_ExtendedCommunitiesAttribute(t *testing.T) {
})
assert.Nil(err)
communities = append(communities, a)
a, err = ptypes.MarshalAny(&api.ValidationExtended{
a, err = apb.New(&api.ValidationExtended{
State: 0, // VALID
})
assert.Nil(err)
communities = append(communities, a)
a, err = ptypes.MarshalAny(&api.ColorExtended{
a, err = apb.New(&api.ColorExtended{
Color: 400,
})
assert.Nil(err)
communities = append(communities, a)
a, err = ptypes.MarshalAny(&api.EncapExtended{
a, err = apb.New(&api.EncapExtended{
TunnelType: 8, // VXLAN
})
assert.Nil(err)
communities = append(communities, a)
a, err = ptypes.MarshalAny(&api.DefaultGatewayExtended{
a, err = apb.New(&api.DefaultGatewayExtended{
// No value
})
assert.Nil(err)
communities = append(communities, a)
a, err = ptypes.MarshalAny(&api.OpaqueExtended{
a, err = apb.New(&api.OpaqueExtended{
IsTransitive: true,
Value: []byte{0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77},
})
assert.Nil(err)
communities = append(communities, a)
a, err = ptypes.MarshalAny(&api.ESILabelExtended{
a, err = apb.New(&api.ESILabelExtended{
IsSingleActive: true,
Label: 500,
})
assert.Nil(err)
communities = append(communities, a)
a, err = ptypes.MarshalAny(&api.ESImportRouteTarget{
a, err = apb.New(&api.ESImportRouteTarget{
EsImport: "aa:bb:cc:dd:ee:ff",
})
assert.Nil(err)
communities = append(communities, a)
a, err = ptypes.MarshalAny(&api.MacMobilityExtended{
a, err = apb.New(&api.MacMobilityExtended{
IsSticky: true,
SequenceNum: 1,
})
assert.Nil(err)
communities = append(communities, a)
a, err = ptypes.MarshalAny(&api.RouterMacExtended{
a, err = apb.New(&api.RouterMacExtended{
Mac: "ff:ee:dd:cc:bb:aa",
})
assert.Nil(err)
communities = append(communities, a)
a, err = ptypes.MarshalAny(&api.TrafficRateExtended{
a, err = apb.New(&api.TrafficRateExtended{
As: 65004,
Rate: 100.0,
})
assert.Nil(err)
communities = append(communities, a)
a, err = ptypes.MarshalAny(&api.TrafficActionExtended{
a, err = apb.New(&api.TrafficActionExtended{
Terminal: true,
Sample: false,
})
assert.Nil(err)
communities = append(communities, a)
a, err = ptypes.MarshalAny(&api.RedirectTwoOctetAsSpecificExtended{
a, err = apb.New(&api.RedirectTwoOctetAsSpecificExtended{
As: 65005,
LocalAdmin: 500,
})
assert.Nil(err)
communities = append(communities, a)
a, err = ptypes.MarshalAny(&api.RedirectIPv4AddressSpecificExtended{
a, err = apb.New(&api.RedirectIPv4AddressSpecificExtended{
Address: "6.6.6.6",
LocalAdmin: 600,
})
assert.Nil(err)
communities = append(communities, a)
a, err = ptypes.MarshalAny(&api.RedirectFourOctetAsSpecificExtended{
a, err = apb.New(&api.RedirectFourOctetAsSpecificExtended{
As: 65007,
LocalAdmin: 700,
})
assert.Nil(err)
communities = append(communities, a)
a, err = ptypes.MarshalAny(&api.TrafficRemarkExtended{
a, err = apb.New(&api.TrafficRemarkExtended{
Dscp: 0x0a, // AF11
})
assert.Nil(err)
communities = append(communities, a)
a, err = ptypes.MarshalAny(&api.UnknownExtended{
a, err = apb.New(&api.UnknownExtended{
Type: 0xff, // Max of uint8
Value: []byte{1, 2, 3, 4, 5, 6, 7},
})
assert.Nil(err)
communities = append(communities, a)
a, err = ptypes.MarshalAny(&api.LinkBandiwdthExtended{
a, err = apb.New(&api.LinkBandiwdthExtended{
As: 65004,
Bandwidth: 125000.0,
})
@@ -1332,7 +1332,7 @@ func Test_ExtendedCommunitiesAttribute(t *testing.T) {
Communities: communities,
}
a, err = ptypes.MarshalAny(input)
a, err = apb.New(input)
assert.Nil(err)
n, err := unmarshalAttribute(a)
assert.Nil(err)
@@ -1362,7 +1362,7 @@ func Test_As4PathAttribute(t *testing.T) {
},
}
a, err := ptypes.MarshalAny(input)
a, err := apb.New(input)
assert.Nil(err)
n, err := unmarshalAttribute(a)
assert.Nil(err)
@@ -1382,7 +1382,7 @@ func Test_As4AggregatorAttribute(t *testing.T) {
Address: "1.1.1.1",
}
a, err := ptypes.MarshalAny(input)
a, err := apb.New(input)
assert.Nil(err)
n, err := unmarshalAttribute(a)
assert.Nil(err)
@@ -1402,7 +1402,7 @@ func Test_PmsiTunnelAttribute(t *testing.T) {
Id: net.ParseIP("1.1.1.1").To4(), // IngressReplTunnelID with IPv4
}
a, err := ptypes.MarshalAny(input)
a, err := apb.New(input)
assert.Nil(err)
n, err := unmarshalAttribute(a)
assert.Nil(err)
@@ -1417,29 +1417,29 @@ func Test_PmsiTunnelAttribute(t *testing.T) {
func Test_TunnelEncapAttribute(t *testing.T) {
assert := assert.New(t)
subTlvs := make([]*any.Any, 0, 4)
a, err := ptypes.MarshalAny(&api.TunnelEncapSubTLVEncapsulation{
subTlvs := make([]*apb.Any, 0, 4)
a, err := apb.New(&api.TunnelEncapSubTLVEncapsulation{
Key: 100,
Cookie: []byte{0x11, 0x22, 0x33, 0x44},
})
assert.Nil(err)
subTlvs = append(subTlvs, a)
a, err = ptypes.MarshalAny(&api.TunnelEncapSubTLVProtocol{
a, err = apb.New(&api.TunnelEncapSubTLVProtocol{
Protocol: 200,
})
assert.Nil(err)
subTlvs = append(subTlvs, a)
a, err = ptypes.MarshalAny(&api.TunnelEncapSubTLVColor{
a, err = apb.New(&api.TunnelEncapSubTLVColor{
Color: 300,
})
assert.Nil(err)
subTlvs = append(subTlvs, a)
a, err = ptypes.MarshalAny(&api.TunnelEncapSubTLVUDPDestPort{
a, err = apb.New(&api.TunnelEncapSubTLVUDPDestPort{
Port: 400,
})
assert.Nil(err)
subTlvs = append(subTlvs, a)
a, err = ptypes.MarshalAny(&api.TunnelEncapSubTLVUnknown{
a, err = apb.New(&api.TunnelEncapSubTLVUnknown{
Type: 0xff, // Max of uint8
Value: []byte{0x55, 0x66, 0x77, 0x88},
})
@@ -1455,7 +1455,7 @@ func Test_TunnelEncapAttribute(t *testing.T) {
},
}
a, err = ptypes.MarshalAny(input)
a, err = apb.New(input)
assert.Nil(err)
n, err := unmarshalAttribute(a)
assert.Nil(err)
@@ -1474,8 +1474,8 @@ func Test_TunnelEncapAttribute(t *testing.T) {
func Test_IP6ExtendedCommunitiesAttribute(t *testing.T) {
assert := assert.New(t)
communities := make([]*any.Any, 0, 2)
a, err := ptypes.MarshalAny(&api.IPv6AddressSpecificExtended{
communities := make([]*apb.Any, 0, 2)
a, err := apb.New(&api.IPv6AddressSpecificExtended{
IsTransitive: true,
SubType: 0xff, // Max of uint8
Address: "2001:db8:1::1",
@@ -1483,7 +1483,7 @@ func Test_IP6ExtendedCommunitiesAttribute(t *testing.T) {
})
assert.Nil(err)
communities = append(communities, a)
a, err = ptypes.MarshalAny(&api.RedirectIPv6AddressSpecificExtended{
a, err = apb.New(&api.RedirectIPv6AddressSpecificExtended{
Address: "2001:db8:2::1",
LocalAdmin: 200,
})
@@ -1494,7 +1494,7 @@ func Test_IP6ExtendedCommunitiesAttribute(t *testing.T) {
Communities: communities,
}
a, err = ptypes.MarshalAny(input)
a, err = apb.New(input)
assert.Nil(err)
n, err := unmarshalAttribute(a)
assert.Nil(err)
@@ -1511,13 +1511,13 @@ func Test_IP6ExtendedCommunitiesAttribute(t *testing.T) {
func Test_AigpAttribute(t *testing.T) {
assert := assert.New(t)
tlvs := make([]*any.Any, 0, 2)
a, err := ptypes.MarshalAny(&api.AigpTLVIGPMetric{
tlvs := make([]*apb.Any, 0, 2)
a, err := apb.New(&api.AigpTLVIGPMetric{
Metric: 50,
})
assert.Nil(err)
tlvs = append(tlvs, a)
a, err = ptypes.MarshalAny(&api.AigpTLVUnknown{
a, err = apb.New(&api.AigpTLVUnknown{
Type: 0xff, // Max of uint8
Value: []byte{0x11, 0x22, 0x33, 0x44},
})
@@ -1528,7 +1528,7 @@ func Test_AigpAttribute(t *testing.T) {
Tlvs: tlvs,
}
a, err = ptypes.MarshalAny(input)
a, err = apb.New(input)
assert.Nil(err)
n, err := unmarshalAttribute(a)
assert.Nil(err)
@@ -1560,7 +1560,7 @@ func Test_LargeCommunitiesAttribute(t *testing.T) {
},
}
a, err := ptypes.MarshalAny(input)
a, err := apb.New(input)
assert.Nil(err)
n, err := unmarshalAttribute(a)
assert.Nil(err)
@@ -1581,7 +1581,7 @@ func Test_UnknownAttribute(t *testing.T) {
Value: []byte{0x11, 0x22, 0x33, 0x44},
}
a, err := ptypes.MarshalAny(input)
a, err := apb.New(input)
assert.Nil(err)
n, err := unmarshalAttribute(a)
assert.Nil(err)
+13 -14
View File
@@ -18,11 +18,10 @@ package apiutil
import (
"fmt"
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"
proto "google.golang.org/protobuf/proto"
apb "google.golang.org/protobuf/types/known/anypb"
)
func NewMultiProtocolCapability(a *bgp.CapMultiProtocol) *api.MultiProtocolCapability {
@@ -126,7 +125,7 @@ func NewUnknownCapability(a *bgp.CapUnknown) *api.UnknownCapability {
}
}
func MarshalCapability(value bgp.ParameterCapabilityInterface) (*any.Any, error) {
func MarshalCapability(value bgp.ParameterCapabilityInterface) (*apb.Any, error) {
var m proto.Message
switch n := value.(type) {
case *bgp.CapMultiProtocol:
@@ -156,11 +155,11 @@ func MarshalCapability(value bgp.ParameterCapabilityInterface) (*any.Any, error)
default:
return nil, fmt.Errorf("invalid capability type to marshal: %+v", value)
}
return ptypes.MarshalAny(m)
return apb.New(m)
}
func MarshalCapabilities(values []bgp.ParameterCapabilityInterface) ([]*any.Any, error) {
caps := make([]*any.Any, 0, len(values))
func MarshalCapabilities(values []bgp.ParameterCapabilityInterface) ([]*apb.Any, error) {
caps := make([]*apb.Any, 0, len(values))
for _, value := range values {
a, err := MarshalCapability(value)
if err != nil {
@@ -171,12 +170,12 @@ func MarshalCapabilities(values []bgp.ParameterCapabilityInterface) ([]*any.Any,
return caps, nil
}
func unmarshalCapability(a *any.Any) (bgp.ParameterCapabilityInterface, error) {
var value ptypes.DynamicAny
if err := ptypes.UnmarshalAny(a, &value); err != nil {
func unmarshalCapability(a *apb.Any) (bgp.ParameterCapabilityInterface, error) {
value, err := a.UnmarshalNew()
if err != nil {
return nil, fmt.Errorf("failed to unmarshal capability: %s", err)
}
switch a := value.Message.(type) {
switch a := value.(type) {
case *api.MultiProtocolCapability:
return bgp.NewCapMultiProtocol(ToRouteFamily(a.Family)), nil
case *api.RouteRefreshCapability:
@@ -246,7 +245,7 @@ func unmarshalCapability(a *any.Any) (bgp.ParameterCapabilityInterface, error) {
return nil, fmt.Errorf("invalid capability type to unmarshal: %s", a.TypeUrl)
}
func UnmarshalCapabilities(values []*any.Any) ([]bgp.ParameterCapabilityInterface, error) {
func UnmarshalCapabilities(values []*apb.Any) ([]bgp.ParameterCapabilityInterface, error) {
caps := make([]bgp.ParameterCapabilityInterface, 0, len(values))
for _, value := range values {
c, err := unmarshalCapability(value)
+16 -15
View File
@@ -18,10 +18,11 @@ package apiutil
import (
"testing"
"github.com/golang/protobuf/proto"
"github.com/golang/protobuf/ptypes"
api "github.com/osrg/gobgp/api"
"github.com/osrg/gobgp/pkg/packet/bgp"
"google.golang.org/protobuf/proto"
apb "google.golang.org/protobuf/types/known/anypb"
api "github.com/osrg/gobgp/v3/api"
"github.com/osrg/gobgp/v3/pkg/packet/bgp"
"github.com/stretchr/testify/assert"
)
@@ -35,7 +36,7 @@ func Test_MultiProtocolCapability(t *testing.T) {
},
}
a, err := ptypes.MarshalAny(input)
a, err := apb.New(input)
assert.Nil(err)
n, err := unmarshalCapability(a)
assert.Nil(err)
@@ -51,7 +52,7 @@ func Test_RouteRefreshCapability(t *testing.T) {
input := &api.RouteRefreshCapability{}
a, err := ptypes.MarshalAny(input)
a, err := apb.New(input)
assert.Nil(err)
n, err := unmarshalCapability(a)
assert.Nil(err)
@@ -65,7 +66,7 @@ func Test_CarryingLabelInfoCapability(t *testing.T) {
input := &api.CarryingLabelInfoCapability{}
a, err := ptypes.MarshalAny(input)
a, err := apb.New(input)
assert.Nil(err)
n, err := unmarshalCapability(a)
assert.Nil(err)
@@ -92,7 +93,7 @@ func Test_ExtendedNexthopCapability(t *testing.T) {
},
}
a, err := ptypes.MarshalAny(input)
a, err := apb.New(input)
assert.Nil(err)
n, err := unmarshalCapability(a)
assert.Nil(err)
@@ -123,7 +124,7 @@ func Test_GracefulRestartCapability(t *testing.T) {
},
}
a, err := ptypes.MarshalAny(input)
a, err := apb.New(input)
assert.Nil(err)
n, err := unmarshalCapability(a)
assert.Nil(err)
@@ -147,7 +148,7 @@ func Test_FourOctetASNumberCapability(t *testing.T) {
As: 100,
}
a, err := ptypes.MarshalAny(input)
a, err := apb.New(input)
assert.Nil(err)
n, err := unmarshalCapability(a)
assert.Nil(err)
@@ -174,7 +175,7 @@ func Test_AddPathCapability(t *testing.T) {
},
}
a, err := ptypes.MarshalAny(input)
a, err := apb.New(input)
assert.Nil(err)
n, err := unmarshalCapability(a)
assert.Nil(err)
@@ -193,7 +194,7 @@ func Test_EnhancedRouteRefreshCapability(t *testing.T) {
input := &api.EnhancedRouteRefreshCapability{}
a, err := ptypes.MarshalAny(input)
a, err := apb.New(input)
assert.Nil(err)
n, err := unmarshalCapability(a)
assert.Nil(err)
@@ -218,7 +219,7 @@ func Test_LongLivedGracefulRestartCapability(t *testing.T) {
},
}
a, err := ptypes.MarshalAny(input)
a, err := apb.New(input)
assert.Nil(err)
n, err := unmarshalCapability(a)
assert.Nil(err)
@@ -239,7 +240,7 @@ func Test_RouteRefreshCiscoCapability(t *testing.T) {
input := &api.RouteRefreshCiscoCapability{}
a, err := ptypes.MarshalAny(input)
a, err := apb.New(input)
assert.Nil(err)
n, err := unmarshalCapability(a)
assert.Nil(err)
@@ -256,7 +257,7 @@ func Test_UnknownCapability(t *testing.T) {
Value: []byte{0x11, 0x22, 0x33, 0x44},
}
a, err := ptypes.MarshalAny(input)
a, err := apb.New(input)
assert.Nil(err)
n, err := unmarshalCapability(a)
assert.Nil(err)
+5 -7
View File
@@ -21,9 +21,9 @@ import (
"net"
"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"
tspb "google.golang.org/protobuf/types/known/timestamppb"
)
// workaround. This for the json format compatibility. Once we update senario tests, we can remove this.
@@ -51,10 +51,9 @@ func NewDestination(dst *api.Destination) *Destination {
for _, p := range dst.Paths {
nlri, _ := GetNativeNlri(p)
attrs, _ := GetNativePathAttributes(p)
t, _ := ptypes.Timestamp(p.Age)
l = append(l, &Path{
Nlri: nlri,
Age: t.Unix(),
Age: p.Age.AsTime().Unix(),
Best: p.Best,
Attrs: attrs,
Stale: p.Stale,
@@ -67,11 +66,10 @@ func NewDestination(dst *api.Destination) *Destination {
}
func NewPath(nlri bgp.AddrPrefixInterface, isWithdraw bool, attrs []bgp.PathAttributeInterface, age time.Time) *api.Path {
t, _ := ptypes.TimestampProto(age)
return &api.Path{
Nlri: MarshalNLRI(nlri),
Pattrs: MarshalPathAttributes(attrs),
Age: t,
Age: tspb.New(age),
IsWithdraw: isWithdraw,
Family: ToApiFamily(nlri.AFI(), nlri.SAFI()),
Identifier: nlri.PathIdentifier(),
+1 -1
View File
@@ -23,7 +23,7 @@ package config
import (
"fmt"
"github.com/osrg/gobgp/pkg/packet/bgp"
"github.com/osrg/gobgp/v3/pkg/packet/bgp"
)
func mapkey(index int, name string) string {
+4 -4
View File
@@ -8,10 +8,10 @@ import (
"reflect"
"strconv"
"github.com/osrg/gobgp/internal/pkg/zebra"
"github.com/osrg/gobgp/pkg/packet/bgp"
"github.com/osrg/gobgp/pkg/packet/bmp"
"github.com/osrg/gobgp/pkg/packet/rtr"
"github.com/osrg/gobgp/v3/internal/pkg/zebra"
"github.com/osrg/gobgp/v3/pkg/packet/bgp"
"github.com/osrg/gobgp/v3/pkg/packet/bmp"
"github.com/osrg/gobgp/v3/pkg/packet/rtr"
"github.com/spf13/viper"
)
+1
View File
@@ -12,6 +12,7 @@
// implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//go:build linux
// +build linux
package config
+1
View File
@@ -12,6 +12,7 @@
// implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//go:build !linux
// +build !linux
package config
+7 -8
View File
@@ -24,11 +24,11 @@ import (
"strings"
"time"
"github.com/golang/protobuf/ptypes"
"github.com/golang/protobuf/ptypes/timestamp"
api "github.com/osrg/gobgp/api"
"github.com/osrg/gobgp/internal/pkg/apiutil"
"github.com/osrg/gobgp/pkg/packet/bgp"
tspb "google.golang.org/protobuf/types/known/timestamppb"
api "github.com/osrg/gobgp/v3/api"
"github.com/osrg/gobgp/v3/internal/pkg/apiutil"
"github.com/osrg/gobgp/v3/pkg/packet/bgp"
)
// Returns config file type by retrieving extension from the given path.
@@ -427,12 +427,11 @@ func newAfiSafiFromConfigStruct(c *AfiSafi) *api.AfiSafi {
}
}
func ProtoTimestamp(secs int64) *timestamp.Timestamp {
func ProtoTimestamp(secs int64) *tspb.Timestamp {
if secs == 0 {
return nil
}
t, _ := ptypes.TimestampProto(time.Unix(secs, 0))
return t
return tspb.New(time.Unix(secs, 0))
}
func NewPeerFromConfigStruct(pconf *Neighbor) *api.Peer {
+1 -1
View File
@@ -18,7 +18,7 @@ package table
import (
"fmt"
"github.com/osrg/gobgp/pkg/packet/bgp"
"github.com/osrg/gobgp/v3/pkg/packet/bgp"
)
type AdjRib struct {
+1 -1
View File
@@ -19,7 +19,7 @@ import (
"testing"
"time"
"github.com/osrg/gobgp/pkg/packet/bgp"
"github.com/osrg/gobgp/v3/pkg/packet/bgp"
"github.com/stretchr/testify/assert"
)
+2 -2
View File
@@ -23,8 +23,8 @@ import (
"net"
"sort"
"github.com/osrg/gobgp/internal/pkg/config"
"github.com/osrg/gobgp/pkg/packet/bgp"
"github.com/osrg/gobgp/v3/internal/pkg/config"
"github.com/osrg/gobgp/v3/pkg/packet/bgp"
log "github.com/sirupsen/logrus"
)
+1 -1
View File
@@ -22,7 +22,7 @@ import (
"testing"
"time"
"github.com/osrg/gobgp/pkg/packet/bgp"
"github.com/osrg/gobgp/v3/pkg/packet/bgp"
"github.com/stretchr/testify/assert"
)
+1 -1
View File
@@ -19,7 +19,7 @@ import (
"bytes"
"reflect"
"github.com/osrg/gobgp/pkg/packet/bgp"
"github.com/osrg/gobgp/v3/pkg/packet/bgp"
log "github.com/sirupsen/logrus"
)
+1 -1
View File
@@ -21,7 +21,7 @@ import (
"testing"
"time"
"github.com/osrg/gobgp/pkg/packet/bgp"
"github.com/osrg/gobgp/v3/pkg/packet/bgp"
"github.com/stretchr/testify/assert"
)
+2 -2
View File
@@ -24,8 +24,8 @@ import (
"sort"
"time"
"github.com/osrg/gobgp/internal/pkg/config"
"github.com/osrg/gobgp/pkg/packet/bgp"
"github.com/osrg/gobgp/v3/internal/pkg/config"
"github.com/osrg/gobgp/v3/pkg/packet/bgp"
log "github.com/sirupsen/logrus"
)
+2 -2
View File
@@ -6,8 +6,8 @@ import (
"testing"
"time"
"github.com/osrg/gobgp/internal/pkg/config"
"github.com/osrg/gobgp/pkg/packet/bgp"
"github.com/osrg/gobgp/v3/internal/pkg/config"
"github.com/osrg/gobgp/v3/pkg/packet/bgp"
"github.com/stretchr/testify/assert"
)
+3 -3
View File
@@ -27,9 +27,9 @@ import (
"sync"
"github.com/k-sone/critbitgo"
api "github.com/osrg/gobgp/api"
"github.com/osrg/gobgp/internal/pkg/config"
"github.com/osrg/gobgp/pkg/packet/bgp"
api "github.com/osrg/gobgp/v3/api"
"github.com/osrg/gobgp/v3/internal/pkg/config"
"github.com/osrg/gobgp/v3/pkg/packet/bgp"
log "github.com/sirupsen/logrus"
)
+2 -2
View File
@@ -24,8 +24,8 @@ import (
"testing"
"time"
"github.com/osrg/gobgp/internal/pkg/config"
"github.com/osrg/gobgp/pkg/packet/bgp"
"github.com/osrg/gobgp/v3/internal/pkg/config"
"github.com/osrg/gobgp/v3/pkg/packet/bgp"
log "github.com/sirupsen/logrus"
"github.com/stretchr/testify/assert"
+2 -2
View File
@@ -20,8 +20,8 @@ import (
"sort"
"github.com/k-sone/critbitgo"
"github.com/osrg/gobgp/internal/pkg/config"
"github.com/osrg/gobgp/pkg/packet/bgp"
"github.com/osrg/gobgp/v3/internal/pkg/config"
"github.com/osrg/gobgp/v3/pkg/packet/bgp"
log "github.com/sirupsen/logrus"
)
+2 -2
View File
@@ -7,8 +7,8 @@ import (
"testing"
"time"
"github.com/osrg/gobgp/internal/pkg/config"
"github.com/osrg/gobgp/pkg/packet/bgp"
"github.com/osrg/gobgp/v3/internal/pkg/config"
"github.com/osrg/gobgp/v3/pkg/packet/bgp"
"github.com/stretchr/testify/assert"
)
+1 -1
View File
@@ -23,7 +23,7 @@ import (
"unsafe"
"github.com/k-sone/critbitgo"
"github.com/osrg/gobgp/pkg/packet/bgp"
"github.com/osrg/gobgp/v3/pkg/packet/bgp"
log "github.com/sirupsen/logrus"
)
+1 -1
View File
@@ -24,7 +24,7 @@ import (
farm "github.com/dgryski/go-farm"
log "github.com/sirupsen/logrus"
"github.com/osrg/gobgp/pkg/packet/bgp"
"github.com/osrg/gobgp/v3/pkg/packet/bgp"
)
const (
+1 -1
View File
@@ -21,7 +21,7 @@ import (
"testing"
"time"
"github.com/osrg/gobgp/pkg/packet/bgp"
"github.com/osrg/gobgp/v3/pkg/packet/bgp"
"github.com/stretchr/testify/assert"
)
+1 -1
View File
@@ -19,7 +19,7 @@ import (
"testing"
"time"
"github.com/osrg/gobgp/pkg/packet/bgp"
"github.com/osrg/gobgp/v3/pkg/packet/bgp"
"github.com/stretchr/testify/assert"
)
+1 -1
View File
@@ -16,7 +16,7 @@
package table
import (
"github.com/osrg/gobgp/pkg/packet/bgp"
"github.com/osrg/gobgp/v3/pkg/packet/bgp"
)
type Vrf struct {
+3 -3
View File
@@ -17,12 +17,12 @@ package version
import "fmt"
const MAJOR uint = 2
const MINOR uint = 34
const MAJOR uint = 3
const MINOR uint = 0
const PATCH uint = 0
var COMMIT string = ""
var IDENTIFIER string = ""
var IDENTIFIER string = "rc0"
var METADATA string = ""
func Version() string {
+1 -1
View File
@@ -19,7 +19,7 @@ import (
"encoding/binary"
"errors"
"fmt"
"github.com/osrg/gobgp/pkg/packet/bgp"
"github.com/osrg/gobgp/v3/pkg/packet/bgp"
log "github.com/sirupsen/logrus"
"io"
"math"
+1
View File
@@ -13,6 +13,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//go:build freebsd || netbsd || openbsd
// +build freebsd netbsd openbsd
package zebra
+9 -9
View File
@@ -1,16 +1,16 @@
package config
import (
"github.com/golang/protobuf/ptypes/any"
log "github.com/sirupsen/logrus"
"golang.org/x/net/context"
apb "google.golang.org/protobuf/types/known/anypb"
api "github.com/osrg/gobgp/api"
"github.com/osrg/gobgp/internal/pkg/apiutil"
"github.com/osrg/gobgp/internal/pkg/config"
"github.com/osrg/gobgp/internal/pkg/table"
"github.com/osrg/gobgp/pkg/packet/bgp"
"github.com/osrg/gobgp/pkg/server"
api "github.com/osrg/gobgp/v3/api"
"github.com/osrg/gobgp/v3/internal/pkg/apiutil"
"github.com/osrg/gobgp/v3/internal/pkg/config"
"github.com/osrg/gobgp/v3/internal/pkg/table"
"github.com/osrg/gobgp/v3/pkg/packet/bgp"
"github.com/osrg/gobgp/v3/pkg/server"
)
// ReadConfigFile parses a config file into a BgpConfigSet which can be applied
@@ -19,8 +19,8 @@ func ReadConfigFile(configFile, configType string) (*config.BgpConfigSet, error)
return config.ReadConfigfile(configFile, configType)
}
func marshalRouteTargets(l []string) ([]*any.Any, error) {
rtList := make([]*any.Any, 0, len(l))
func marshalRouteTargets(l []string) ([]*apb.Any, error) {
rtList := make([]*apb.Any, 0, len(l))
for _, rtString := range l {
rt, err := bgp.ParseRouteTarget(rtString)
if err != nil {
+1 -1
View File
@@ -6,7 +6,7 @@ import (
"os/signal"
"syscall"
"github.com/osrg/gobgp/pkg/server"
"github.com/osrg/gobgp/v3/pkg/server"
)
// ExampleUpdateConfig shows how InitialConfig can be used without UpdateConfig
+1
View File
@@ -13,6 +13,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//go:build race
// +build race
package bgp
+10 -11
View File
@@ -7,8 +7,7 @@ import (
"fmt"
"net"
"github.com/golang/protobuf/ptypes"
api "github.com/osrg/gobgp/api"
api "github.com/osrg/gobgp/v3/api"
)
const (
@@ -554,11 +553,11 @@ func NewPathAttributePrefixSID(psid *api.PrefixSID) (*PathAttributePrefixSID, er
TLVs: make([]PrefixSIDTLVInterface, 0),
}
for _, raw := range psid.Tlvs {
var tlv ptypes.DynamicAny
if err := ptypes.UnmarshalAny(raw, &tlv); err != nil {
tlv, err := raw.UnmarshalNew()
if err != nil {
return nil, err
}
switch v := tlv.Message.(type) {
switch v := tlv.(type) {
case *api.SRv6L3ServiceTLV:
tlvLength, tlvs, err := UnmarshalSubTLVs(v.SubTlvs)
if err != nil {
@@ -600,11 +599,11 @@ func UnmarshalSubTLVs(stlvs map[uint32]*api.SRv6TLV) (uint16, []PrefixSIDTLVInte
},
SubSubTLVs: make([]PrefixSIDTLVInterface, 0),
}
var raw ptypes.DynamicAny
if err := ptypes.UnmarshalAny(stlvRaw, &raw); err != nil {
raw, err := stlvRaw.UnmarshalNew()
if err != nil {
return 0, nil, err
}
infoProto := raw.Message.(*api.SRv6InformationSubTLV)
infoProto := raw.(*api.SRv6InformationSubTLV)
info.SID = make([]byte, len(infoProto.Sid))
copy(info.SID, infoProto.Sid)
// TODO Once RFC is published add processing of flags
@@ -652,11 +651,11 @@ func UnmarshalSubSubTLVs(stlvs map[uint32]*api.SRv6TLV) (uint16, []PrefixSIDTLVI
Length: 6,
},
}
var raw ptypes.DynamicAny
if err := ptypes.UnmarshalAny(stlvRaw, &raw); err != nil {
raw, err := stlvRaw.UnmarshalNew()
if err != nil {
return 0, nil, err
}
structureProto := raw.Message.(*api.SRv6StructureSubSubTLV)
structureProto := raw.(*api.SRv6StructureSubSubTLV)
structure.LocalBlockLength = uint8(structureProto.LocalBlockLength)
structure.LocatorNodeLength = uint8(structureProto.LocalNodeLength)
structure.FunctionLength = uint8(structureProto.FunctionLength)
-34
View File
@@ -3,9 +3,6 @@ package bgp
import (
"bytes"
"testing"
"github.com/golang/protobuf/ptypes/any"
api "github.com/osrg/gobgp/api"
)
func TestRoundTripSubSubTLV(t *testing.T) {
@@ -91,34 +88,3 @@ func TestRoundTripPrefixSID(t *testing.T) {
})
}
}
func TestNewPathAttributePrefixSID(t *testing.T) {
tests := []struct {
name string
input *api.PrefixSID
}{
{
name: "path attribute srv6 prefix sid",
input: &api.PrefixSID{
Tlvs: []*any.Any{
{
TypeUrl: "type.googleapis.com/gobgpapi.SRv6L3ServiceTLV",
Value: []byte{10, 157, 1, 8, 1, 18, 152, 1, 10, 149, 1, 10, 50, 116, 121, 112, 101, 46, 103, 111, 111, 103, 108, 101, 97, 112, 105, 115, 46, 99, 111, 109, 47, 103, 111, 98, 103, 112, 97, 112, 105, 46, 83, 82, 118, 54, 73, 110, 102, 111, 114, 109, 97, 116, 105, 111, 110, 83, 117, 98, 84, 76, 86, 18, 95, 10, 16, 32, 1, 0, 0, 0, 5, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 18, 0, 24, 17, 34, 71, 8, 1, 18, 67, 10, 65, 10, 51, 116, 121, 112, 101, 46, 103, 111, 111, 103, 108, 101, 97, 112, 105, 115, 46, 99, 111, 109, 47, 103, 111, 98, 103, 112, 97, 112, 105, 46, 83, 82, 118, 54, 83, 116, 114, 117, 99, 116, 117, 114, 101, 83, 117, 98, 83, 117, 98, 84, 76, 86, 18, 10, 8, 40, 16, 24, 24, 16, 40, 16, 48, 64},
},
},
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
p, err := NewPathAttributePrefixSID(tt.input)
if err != nil {
t.Fatalf("failed with error: %+v", err)
}
t.Logf("resulting prefix sid: %s", p.String())
b, _ := p.Serialize()
t.Logf("serialized prefix sid: %s", string(b))
})
}
}
+1 -1
View File
@@ -7,7 +7,7 @@ import (
"net"
"strconv"
api "github.com/osrg/gobgp/api"
api "github.com/osrg/gobgp/v3/api"
)
type SRPolicyNLRI struct {
+1 -1
View File
@@ -21,7 +21,7 @@ import (
"math"
"net"
"github.com/osrg/gobgp/pkg/packet/bgp"
"github.com/osrg/gobgp/v3/pkg/packet/bgp"
)
type BMPHeader struct {
+1 -1
View File
@@ -18,7 +18,7 @@ package bmp
import (
"testing"
"github.com/osrg/gobgp/pkg/packet/bgp"
"github.com/osrg/gobgp/v3/pkg/packet/bgp"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
+1 -1
View File
@@ -24,7 +24,7 @@ import (
"net"
"time"
"github.com/osrg/gobgp/pkg/packet/bgp"
"github.com/osrg/gobgp/v3/pkg/packet/bgp"
)
const (
+1 -1
View File
@@ -22,7 +22,7 @@ import (
"testing"
"time"
"github.com/osrg/gobgp/pkg/packet/bgp"
"github.com/osrg/gobgp/v3/pkg/packet/bgp"
"github.com/stretchr/testify/assert"
)
+6 -5
View File
@@ -22,12 +22,13 @@ import (
"strconv"
"time"
api "github.com/osrg/gobgp/api"
"github.com/osrg/gobgp/internal/pkg/config"
"github.com/osrg/gobgp/internal/pkg/table"
"github.com/osrg/gobgp/pkg/packet/bgp"
"github.com/osrg/gobgp/pkg/packet/bmp"
log "github.com/sirupsen/logrus"
api "github.com/osrg/gobgp/v3/api"
"github.com/osrg/gobgp/v3/internal/pkg/config"
"github.com/osrg/gobgp/v3/internal/pkg/table"
"github.com/osrg/gobgp/v3/pkg/packet/bgp"
"github.com/osrg/gobgp/v3/pkg/packet/bmp"
)
type ribout map[string][]*table.Path
+4 -4
View File
@@ -28,10 +28,10 @@ import (
"time"
"github.com/eapache/channels"
"github.com/osrg/gobgp/internal/pkg/config"
"github.com/osrg/gobgp/internal/pkg/table"
"github.com/osrg/gobgp/pkg/packet/bgp"
"github.com/osrg/gobgp/pkg/packet/bmp"
"github.com/osrg/gobgp/v3/internal/pkg/config"
"github.com/osrg/gobgp/v3/internal/pkg/table"
"github.com/osrg/gobgp/v3/pkg/packet/bgp"
"github.com/osrg/gobgp/v3/pkg/packet/bmp"
log "github.com/sirupsen/logrus"
)
+2 -2
View File
@@ -25,8 +25,8 @@ import (
"time"
"github.com/eapache/channels"
"github.com/osrg/gobgp/internal/pkg/config"
"github.com/osrg/gobgp/pkg/packet/bgp"
"github.com/osrg/gobgp/v3/internal/pkg/config"
"github.com/osrg/gobgp/v3/pkg/packet/bgp"
log "github.com/sirupsen/logrus"
"github.com/stretchr/testify/assert"
+85 -85
View File
@@ -28,24 +28,25 @@ import (
"time"
farm "github.com/dgryski/go-farm"
"github.com/golang/protobuf/ptypes"
"github.com/golang/protobuf/ptypes/any"
"github.com/golang/protobuf/ptypes/empty"
log "github.com/sirupsen/logrus"
"golang.org/x/net/context"
"google.golang.org/grpc"
apb "google.golang.org/protobuf/types/known/anypb"
"google.golang.org/protobuf/types/known/emptypb"
tspb "google.golang.org/protobuf/types/known/timestamppb"
api "github.com/osrg/gobgp/api"
"github.com/osrg/gobgp/internal/pkg/apiutil"
"github.com/osrg/gobgp/internal/pkg/config"
"github.com/osrg/gobgp/internal/pkg/table"
"github.com/osrg/gobgp/pkg/packet/bgp"
api "github.com/osrg/gobgp/v3/api"
"github.com/osrg/gobgp/v3/internal/pkg/apiutil"
"github.com/osrg/gobgp/v3/internal/pkg/config"
"github.com/osrg/gobgp/v3/internal/pkg/table"
"github.com/osrg/gobgp/v3/pkg/packet/bgp"
)
type server struct {
bgpServer *BgpServer
grpcServer *grpc.Server
hosts string
api.UnimplementedGobgpApiServer
}
func newAPIserver(b *BgpServer, g *grpc.Server, hosts string) *server {
@@ -159,13 +160,12 @@ func newValidationFromTableStruct(v *table.Validation) *api.Validation {
}
}
func toPathAPI(binNlri []byte, binPattrs [][]byte, anyNlri *any.Any, anyPattrs []*any.Any, path *table.Path, v *table.Validation) *api.Path {
func toPathAPI(binNlri []byte, binPattrs [][]byte, anyNlri *apb.Any, anyPattrs []*apb.Any, path *table.Path, v *table.Validation) *api.Path {
nlri := path.GetNlri()
t, _ := ptypes.TimestampProto(path.GetTimestamp())
p := &api.Path{
Nlri: anyNlri,
Pattrs: anyPattrs,
Age: t,
Age: tspb.New(path.GetTimestamp()),
IsWithdraw: path.IsWithdraw,
Validation: newValidationFromTableStruct(v),
Family: &api.Family{Afi: api.Family_Afi(nlri.AFI()), Safi: api.Family_Safi(nlri.SAFI())},
@@ -265,24 +265,24 @@ func (s *server) MonitorPeer(arg *api.MonitorPeerRequest, stream api.GobgpApi_Mo
return err
}
func (s *server) ResetPeer(ctx context.Context, r *api.ResetPeerRequest) (*empty.Empty, error) {
return &empty.Empty{}, s.bgpServer.ResetPeer(ctx, r)
func (s *server) ResetPeer(ctx context.Context, r *api.ResetPeerRequest) (*emptypb.Empty, error) {
return &emptypb.Empty{}, s.bgpServer.ResetPeer(ctx, r)
}
func (s *server) ShutdownPeer(ctx context.Context, r *api.ShutdownPeerRequest) (*empty.Empty, error) {
return &empty.Empty{}, s.bgpServer.ShutdownPeer(ctx, r)
func (s *server) ShutdownPeer(ctx context.Context, r *api.ShutdownPeerRequest) (*emptypb.Empty, error) {
return &emptypb.Empty{}, s.bgpServer.ShutdownPeer(ctx, r)
}
func (s *server) EnablePeer(ctx context.Context, r *api.EnablePeerRequest) (*empty.Empty, error) {
return &empty.Empty{}, s.bgpServer.EnablePeer(ctx, r)
func (s *server) EnablePeer(ctx context.Context, r *api.EnablePeerRequest) (*emptypb.Empty, error) {
return &emptypb.Empty{}, s.bgpServer.EnablePeer(ctx, r)
}
func (s *server) DisablePeer(ctx context.Context, r *api.DisablePeerRequest) (*empty.Empty, error) {
return &empty.Empty{}, s.bgpServer.DisablePeer(ctx, r)
func (s *server) DisablePeer(ctx context.Context, r *api.DisablePeerRequest) (*emptypb.Empty, error) {
return &emptypb.Empty{}, s.bgpServer.DisablePeer(ctx, r)
}
func (s *server) SetPolicies(ctx context.Context, r *api.SetPoliciesRequest) (*empty.Empty, error) {
return &empty.Empty{}, s.bgpServer.SetPolicies(ctx, r)
func (s *server) SetPolicies(ctx context.Context, r *api.SetPoliciesRequest) (*emptypb.Empty, error) {
return &emptypb.Empty{}, s.bgpServer.SetPolicies(ctx, r)
}
func newRoutingPolicyFromApiStruct(arg *api.SetPoliciesRequest) (*config.RoutingPolicy, error) {
@@ -391,16 +391,16 @@ func (s *server) AddPath(ctx context.Context, r *api.AddPathRequest) (*api.AddPa
return s.bgpServer.AddPath(ctx, r)
}
func (s *server) DeletePath(ctx context.Context, r *api.DeletePathRequest) (*empty.Empty, error) {
return &empty.Empty{}, s.bgpServer.DeletePath(ctx, r)
func (s *server) DeletePath(ctx context.Context, r *api.DeletePathRequest) (*emptypb.Empty, error) {
return &emptypb.Empty{}, s.bgpServer.DeletePath(ctx, r)
}
func (s *server) EnableMrt(ctx context.Context, r *api.EnableMrtRequest) (*empty.Empty, error) {
return &empty.Empty{}, s.bgpServer.EnableMrt(ctx, r)
func (s *server) EnableMrt(ctx context.Context, r *api.EnableMrtRequest) (*emptypb.Empty, error) {
return &emptypb.Empty{}, s.bgpServer.EnableMrt(ctx, r)
}
func (s *server) DisableMrt(ctx context.Context, r *api.DisableMrtRequest) (*empty.Empty, error) {
return &empty.Empty{}, s.bgpServer.DisableMrt(ctx, r)
func (s *server) DisableMrt(ctx context.Context, r *api.DisableMrtRequest) (*emptypb.Empty, error) {
return &emptypb.Empty{}, s.bgpServer.DisableMrt(ctx, r)
}
func (s *server) AddPathStream(stream api.GobgpApi_AddPathStreamServer) error {
@@ -428,35 +428,35 @@ func (s *server) AddPathStream(stream api.GobgpApi_AddPathStreamServer) error {
return err
}
}
return stream.SendAndClose(&empty.Empty{})
return stream.SendAndClose(&emptypb.Empty{})
}
func (s *server) AddBmp(ctx context.Context, r *api.AddBmpRequest) (*empty.Empty, error) {
return &empty.Empty{}, s.bgpServer.AddBmp(ctx, r)
func (s *server) AddBmp(ctx context.Context, r *api.AddBmpRequest) (*emptypb.Empty, error) {
return &emptypb.Empty{}, s.bgpServer.AddBmp(ctx, r)
}
func (s *server) DeleteBmp(ctx context.Context, r *api.DeleteBmpRequest) (*empty.Empty, error) {
return &empty.Empty{}, s.bgpServer.DeleteBmp(ctx, r)
func (s *server) DeleteBmp(ctx context.Context, r *api.DeleteBmpRequest) (*emptypb.Empty, error) {
return &emptypb.Empty{}, s.bgpServer.DeleteBmp(ctx, r)
}
func (s *server) AddRpki(ctx context.Context, r *api.AddRpkiRequest) (*empty.Empty, error) {
return &empty.Empty{}, s.bgpServer.AddRpki(ctx, r)
func (s *server) AddRpki(ctx context.Context, r *api.AddRpkiRequest) (*emptypb.Empty, error) {
return &emptypb.Empty{}, s.bgpServer.AddRpki(ctx, r)
}
func (s *server) DeleteRpki(ctx context.Context, r *api.DeleteRpkiRequest) (*empty.Empty, error) {
return &empty.Empty{}, s.bgpServer.DeleteRpki(ctx, r)
func (s *server) DeleteRpki(ctx context.Context, r *api.DeleteRpkiRequest) (*emptypb.Empty, error) {
return &emptypb.Empty{}, s.bgpServer.DeleteRpki(ctx, r)
}
func (s *server) EnableRpki(ctx context.Context, r *api.EnableRpkiRequest) (*empty.Empty, error) {
return &empty.Empty{}, s.bgpServer.EnableRpki(ctx, r)
func (s *server) EnableRpki(ctx context.Context, r *api.EnableRpkiRequest) (*emptypb.Empty, error) {
return &emptypb.Empty{}, s.bgpServer.EnableRpki(ctx, r)
}
func (s *server) DisableRpki(ctx context.Context, r *api.DisableRpkiRequest) (*empty.Empty, error) {
return &empty.Empty{}, s.bgpServer.DisableRpki(ctx, r)
func (s *server) DisableRpki(ctx context.Context, r *api.DisableRpkiRequest) (*emptypb.Empty, error) {
return &emptypb.Empty{}, s.bgpServer.DisableRpki(ctx, r)
}
func (s *server) ResetRpki(ctx context.Context, r *api.ResetRpkiRequest) (*empty.Empty, error) {
return &empty.Empty{}, s.bgpServer.ResetRpki(ctx, r)
func (s *server) ResetRpki(ctx context.Context, r *api.ResetRpkiRequest) (*emptypb.Empty, error) {
return &emptypb.Empty{}, s.bgpServer.ResetRpki(ctx, r)
}
func (s *server) ListRpki(r *api.ListRpkiRequest, stream api.GobgpApi_ListRpkiServer) error {
@@ -481,8 +481,8 @@ func (s *server) ListRpkiTable(r *api.ListRpkiTableRequest, stream api.GobgpApi_
return s.bgpServer.ListRpkiTable(ctx, r, fn)
}
func (s *server) EnableZebra(ctx context.Context, r *api.EnableZebraRequest) (*empty.Empty, error) {
return &empty.Empty{}, s.bgpServer.EnableZebra(ctx, r)
func (s *server) EnableZebra(ctx context.Context, r *api.EnableZebraRequest) (*emptypb.Empty, error) {
return &emptypb.Empty{}, s.bgpServer.EnableZebra(ctx, r)
}
func (s *server) ListVrf(r *api.ListVrfRequest, stream api.GobgpApi_ListVrfServer) error {
@@ -496,12 +496,12 @@ func (s *server) ListVrf(r *api.ListVrfRequest, stream api.GobgpApi_ListVrfServe
return s.bgpServer.ListVrf(ctx, r, fn)
}
func (s *server) AddVrf(ctx context.Context, r *api.AddVrfRequest) (*empty.Empty, error) {
return &empty.Empty{}, s.bgpServer.AddVrf(ctx, r)
func (s *server) AddVrf(ctx context.Context, r *api.AddVrfRequest) (*emptypb.Empty, error) {
return &emptypb.Empty{}, s.bgpServer.AddVrf(ctx, r)
}
func (s *server) DeleteVrf(ctx context.Context, r *api.DeleteVrfRequest) (*empty.Empty, error) {
return &empty.Empty{}, s.bgpServer.DeleteVrf(ctx, r)
func (s *server) DeleteVrf(ctx context.Context, r *api.DeleteVrfRequest) (*emptypb.Empty, error) {
return &emptypb.Empty{}, s.bgpServer.DeleteVrf(ctx, r)
}
func readMpGracefulRestartFromAPIStruct(c *config.MpGracefulRestart, a *api.MpGracefulRestart) {
@@ -853,36 +853,36 @@ func newPeerGroupFromAPIStruct(a *api.PeerGroup) (*config.PeerGroup, error) {
return pconf, nil
}
func (s *server) AddPeer(ctx context.Context, r *api.AddPeerRequest) (*empty.Empty, error) {
return &empty.Empty{}, s.bgpServer.AddPeer(ctx, r)
func (s *server) AddPeer(ctx context.Context, r *api.AddPeerRequest) (*emptypb.Empty, error) {
return &emptypb.Empty{}, s.bgpServer.AddPeer(ctx, r)
}
func (s *server) DeletePeer(ctx context.Context, r *api.DeletePeerRequest) (*empty.Empty, error) {
return &empty.Empty{}, s.bgpServer.DeletePeer(ctx, r)
func (s *server) DeletePeer(ctx context.Context, r *api.DeletePeerRequest) (*emptypb.Empty, error) {
return &emptypb.Empty{}, s.bgpServer.DeletePeer(ctx, r)
}
func (s *server) UpdatePeer(ctx context.Context, r *api.UpdatePeerRequest) (*api.UpdatePeerResponse, error) {
return s.bgpServer.UpdatePeer(ctx, r)
}
func (s *server) AddPeerGroup(ctx context.Context, r *api.AddPeerGroupRequest) (*empty.Empty, error) {
return &empty.Empty{}, s.bgpServer.AddPeerGroup(ctx, r)
func (s *server) AddPeerGroup(ctx context.Context, r *api.AddPeerGroupRequest) (*emptypb.Empty, error) {
return &emptypb.Empty{}, s.bgpServer.AddPeerGroup(ctx, r)
}
func (s *server) DeletePeerGroup(ctx context.Context, r *api.DeletePeerGroupRequest) (*empty.Empty, error) {
return &empty.Empty{}, s.bgpServer.DeletePeerGroup(ctx, r)
func (s *server) DeletePeerGroup(ctx context.Context, r *api.DeletePeerGroupRequest) (*emptypb.Empty, error) {
return &emptypb.Empty{}, s.bgpServer.DeletePeerGroup(ctx, r)
}
func (s *server) UpdatePeerGroup(ctx context.Context, r *api.UpdatePeerGroupRequest) (*api.UpdatePeerGroupResponse, error) {
return s.bgpServer.UpdatePeerGroup(ctx, r)
}
func (s *server) AddDynamicNeighbor(ctx context.Context, r *api.AddDynamicNeighborRequest) (*empty.Empty, error) {
return &empty.Empty{}, s.bgpServer.AddDynamicNeighbor(ctx, r)
func (s *server) AddDynamicNeighbor(ctx context.Context, r *api.AddDynamicNeighborRequest) (*emptypb.Empty, error) {
return &emptypb.Empty{}, s.bgpServer.AddDynamicNeighbor(ctx, r)
}
func (s *server) DeleteDynamicNeighbor(ctx context.Context, r *api.DeleteDynamicNeighborRequest) (*empty.Empty, error) {
return &empty.Empty{}, s.bgpServer.DeleteDynamicNeighbor(ctx, r)
func (s *server) DeleteDynamicNeighbor(ctx context.Context, r *api.DeleteDynamicNeighborRequest) (*emptypb.Empty, error) {
return &emptypb.Empty{}, s.bgpServer.DeleteDynamicNeighbor(ctx, r)
}
func newPrefixFromApiStruct(a *api.Prefix) (*table.Prefix, error) {
@@ -1044,12 +1044,12 @@ func (s *server) ListDefinedSet(r *api.ListDefinedSetRequest, stream api.GobgpAp
return s.bgpServer.ListDefinedSet(ctx, r, fn)
}
func (s *server) AddDefinedSet(ctx context.Context, r *api.AddDefinedSetRequest) (*empty.Empty, error) {
return &empty.Empty{}, s.bgpServer.AddDefinedSet(ctx, r)
func (s *server) AddDefinedSet(ctx context.Context, r *api.AddDefinedSetRequest) (*emptypb.Empty, error) {
return &emptypb.Empty{}, s.bgpServer.AddDefinedSet(ctx, r)
}
func (s *server) DeleteDefinedSet(ctx context.Context, r *api.DeleteDefinedSetRequest) (*empty.Empty, error) {
return &empty.Empty{}, s.bgpServer.DeleteDefinedSet(ctx, r)
func (s *server) DeleteDefinedSet(ctx context.Context, r *api.DeleteDefinedSetRequest) (*emptypb.Empty, error) {
return &emptypb.Empty{}, s.bgpServer.DeleteDefinedSet(ctx, r)
}
var _regexpMedActionType = regexp.MustCompile(`([+-]?)(\d+)`)
@@ -1399,7 +1399,7 @@ func newAfiSafiInConditionFromApiStruct(a []*api.Family) (*table.AfiSafiInCondit
if configType, ok := bgp.AddressFamilyNameMap[bgp.RouteFamily(rf)]; ok {
afiSafiTypes = append(afiSafiTypes, config.AfiSafiType(configType))
} else {
return nil, fmt.Errorf("unknown afi-safi-in type value: %d", aType)
return nil, fmt.Errorf("unknown afi-safi-in type value: %v", aType)
}
}
return table.NewAfiSafiInCondition(afiSafiTypes)
@@ -1613,12 +1613,12 @@ func (s *server) ListStatement(r *api.ListStatementRequest, stream api.GobgpApi_
return s.bgpServer.ListStatement(ctx, r, fn)
}
func (s *server) AddStatement(ctx context.Context, r *api.AddStatementRequest) (*empty.Empty, error) {
return &empty.Empty{}, s.bgpServer.AddStatement(ctx, r)
func (s *server) AddStatement(ctx context.Context, r *api.AddStatementRequest) (*emptypb.Empty, error) {
return &emptypb.Empty{}, s.bgpServer.AddStatement(ctx, r)
}
func (s *server) DeleteStatement(ctx context.Context, r *api.DeleteStatementRequest) (*empty.Empty, error) {
return &empty.Empty{}, s.bgpServer.DeleteStatement(ctx, r)
func (s *server) DeleteStatement(ctx context.Context, r *api.DeleteStatementRequest) (*emptypb.Empty, error) {
return &emptypb.Empty{}, s.bgpServer.DeleteStatement(ctx, r)
}
func newConfigPolicyFromApiStruct(a *api.Policy) (*config.PolicyDefinition, error) {
@@ -1695,12 +1695,12 @@ func (s *server) ListPolicy(r *api.ListPolicyRequest, stream api.GobgpApi_ListPo
return s.bgpServer.ListPolicy(ctx, r, fn)
}
func (s *server) AddPolicy(ctx context.Context, r *api.AddPolicyRequest) (*empty.Empty, error) {
return &empty.Empty{}, s.bgpServer.AddPolicy(ctx, r)
func (s *server) AddPolicy(ctx context.Context, r *api.AddPolicyRequest) (*emptypb.Empty, error) {
return &emptypb.Empty{}, s.bgpServer.AddPolicy(ctx, r)
}
func (s *server) DeletePolicy(ctx context.Context, r *api.DeletePolicyRequest) (*empty.Empty, error) {
return &empty.Empty{}, s.bgpServer.DeletePolicy(ctx, r)
func (s *server) DeletePolicy(ctx context.Context, r *api.DeletePolicyRequest) (*emptypb.Empty, error) {
return &emptypb.Empty{}, s.bgpServer.DeletePolicy(ctx, r)
}
func (s *server) ListPolicyAssignment(r *api.ListPolicyAssignmentRequest, stream api.GobgpApi_ListPolicyAssignmentServer) error {
@@ -1733,16 +1733,16 @@ func toPolicyDefinition(policies []*api.Policy) []*config.PolicyDefinition {
return l
}
func (s *server) AddPolicyAssignment(ctx context.Context, r *api.AddPolicyAssignmentRequest) (*empty.Empty, error) {
return &empty.Empty{}, s.bgpServer.AddPolicyAssignment(ctx, r)
func (s *server) AddPolicyAssignment(ctx context.Context, r *api.AddPolicyAssignmentRequest) (*emptypb.Empty, error) {
return &emptypb.Empty{}, s.bgpServer.AddPolicyAssignment(ctx, r)
}
func (s *server) DeletePolicyAssignment(ctx context.Context, r *api.DeletePolicyAssignmentRequest) (*empty.Empty, error) {
return &empty.Empty{}, s.bgpServer.DeletePolicyAssignment(ctx, r)
func (s *server) DeletePolicyAssignment(ctx context.Context, r *api.DeletePolicyAssignmentRequest) (*emptypb.Empty, error) {
return &emptypb.Empty{}, s.bgpServer.DeletePolicyAssignment(ctx, r)
}
func (s *server) SetPolicyAssignment(ctx context.Context, r *api.SetPolicyAssignmentRequest) (*empty.Empty, error) {
return &empty.Empty{}, s.bgpServer.SetPolicyAssignment(ctx, r)
func (s *server) SetPolicyAssignment(ctx context.Context, r *api.SetPolicyAssignmentRequest) (*emptypb.Empty, error) {
return &emptypb.Empty{}, s.bgpServer.SetPolicyAssignment(ctx, r)
}
func (s *server) GetBgp(ctx context.Context, r *api.GetBgpRequest) (*api.GetBgpResponse, error) {
@@ -1831,18 +1831,18 @@ func newGlobalFromAPIStruct(a *api.Global) *config.Global {
return global
}
func (s *server) StartBgp(ctx context.Context, r *api.StartBgpRequest) (*empty.Empty, error) {
return &empty.Empty{}, s.bgpServer.StartBgp(ctx, r)
func (s *server) StartBgp(ctx context.Context, r *api.StartBgpRequest) (*emptypb.Empty, error) {
return &emptypb.Empty{}, s.bgpServer.StartBgp(ctx, r)
}
func (s *server) StopBgp(ctx context.Context, r *api.StopBgpRequest) (*empty.Empty, error) {
return &empty.Empty{}, s.bgpServer.StopBgp(ctx, r)
func (s *server) StopBgp(ctx context.Context, r *api.StopBgpRequest) (*emptypb.Empty, error) {
return &emptypb.Empty{}, s.bgpServer.StopBgp(ctx, r)
}
func (s *server) GetTable(ctx context.Context, r *api.GetTableRequest) (*api.GetTableResponse, error) {
return s.bgpServer.GetTable(ctx, r)
}
func (s *server) SetLogLevel(ctx context.Context, r *api.SetLogLevelRequest) (*empty.Empty, error) {
return &empty.Empty{}, s.bgpServer.SetLogLevel(ctx, r)
func (s *server) SetLogLevel(ctx context.Context, r *api.SetLogLevelRequest) (*emptypb.Empty, error) {
return &emptypb.Empty{}, s.bgpServer.SetLogLevel(ctx, r)
}
+4 -4
View File
@@ -21,10 +21,10 @@ import (
"os"
"time"
"github.com/osrg/gobgp/internal/pkg/config"
"github.com/osrg/gobgp/internal/pkg/table"
"github.com/osrg/gobgp/pkg/packet/bgp"
"github.com/osrg/gobgp/pkg/packet/mrt"
"github.com/osrg/gobgp/v3/internal/pkg/config"
"github.com/osrg/gobgp/v3/internal/pkg/table"
"github.com/osrg/gobgp/v3/pkg/packet/bgp"
"github.com/osrg/gobgp/v3/pkg/packet/mrt"
log "github.com/sirupsen/logrus"
)
+3 -3
View File
@@ -20,9 +20,9 @@ import (
"net"
"time"
"github.com/osrg/gobgp/internal/pkg/config"
"github.com/osrg/gobgp/internal/pkg/table"
"github.com/osrg/gobgp/pkg/packet/bgp"
"github.com/osrg/gobgp/v3/internal/pkg/config"
"github.com/osrg/gobgp/v3/internal/pkg/table"
"github.com/osrg/gobgp/v3/pkg/packet/bgp"
log "github.com/sirupsen/logrus"
)
+5 -5
View File
@@ -23,13 +23,13 @@ import (
"strconv"
"time"
"github.com/osrg/gobgp/internal/pkg/config"
"github.com/osrg/gobgp/internal/pkg/table"
"github.com/osrg/gobgp/pkg/packet/bgp"
"github.com/osrg/gobgp/pkg/packet/rtr"
log "github.com/sirupsen/logrus"
"golang.org/x/net/context"
"github.com/osrg/gobgp/v3/internal/pkg/config"
"github.com/osrg/gobgp/v3/internal/pkg/table"
"github.com/osrg/gobgp/v3/pkg/packet/bgp"
"github.com/osrg/gobgp/v3/pkg/packet/rtr"
)
const (
+6 -6
View File
@@ -31,12 +31,12 @@ import (
log "github.com/sirupsen/logrus"
"google.golang.org/grpc"
api "github.com/osrg/gobgp/api"
"github.com/osrg/gobgp/internal/pkg/apiutil"
"github.com/osrg/gobgp/internal/pkg/config"
"github.com/osrg/gobgp/internal/pkg/table"
"github.com/osrg/gobgp/internal/pkg/zebra"
"github.com/osrg/gobgp/pkg/packet/bgp"
api "github.com/osrg/gobgp/v3/api"
"github.com/osrg/gobgp/v3/internal/pkg/apiutil"
"github.com/osrg/gobgp/v3/internal/pkg/config"
"github.com/osrg/gobgp/v3/internal/pkg/table"
"github.com/osrg/gobgp/v3/internal/pkg/zebra"
"github.com/osrg/gobgp/v3/pkg/packet/bgp"
)
type tcpListener struct {
+24 -25
View File
@@ -24,17 +24,16 @@ import (
"testing"
"time"
"github.com/golang/protobuf/ptypes"
"github.com/golang/protobuf/ptypes/any"
log "github.com/sirupsen/logrus"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
apb "google.golang.org/protobuf/types/known/anypb"
api "github.com/osrg/gobgp/api"
"github.com/osrg/gobgp/internal/pkg/apiutil"
"github.com/osrg/gobgp/internal/pkg/config"
"github.com/osrg/gobgp/internal/pkg/table"
"github.com/osrg/gobgp/pkg/packet/bgp"
api "github.com/osrg/gobgp/v3/api"
"github.com/osrg/gobgp/v3/internal/pkg/apiutil"
"github.com/osrg/gobgp/v3/internal/pkg/config"
"github.com/osrg/gobgp/v3/internal/pkg/table"
"github.com/osrg/gobgp/v3/pkg/packet/bgp"
)
func TestStop(t *testing.T) {
@@ -296,18 +295,18 @@ func TestListPathEnableFiltered(test *testing.T) {
Safi: api.Family_SAFI_UNICAST,
}
nlri1, _ := ptypes.MarshalAny(&api.IPAddressPrefix{
nlri1, _ := apb.New(&api.IPAddressPrefix{
Prefix: "10.1.0.0",
PrefixLen: 24,
})
a1, _ := ptypes.MarshalAny(&api.OriginAttribute{
a1, _ := apb.New(&api.OriginAttribute{
Origin: 0,
})
a2, _ := ptypes.MarshalAny(&api.NextHopAttribute{
a2, _ := apb.New(&api.NextHopAttribute{
NextHop: "10.0.0.1",
})
attrs := []*any.Any{a1, a2}
attrs := []*apb.Any{a1, a2}
t.AddPath(context.Background(), &api.AddPathRequest{
TableType: api.TableType_GLOBAL,
@@ -318,7 +317,7 @@ func TestListPathEnableFiltered(test *testing.T) {
},
})
nlri2, _ := ptypes.MarshalAny(&api.IPAddressPrefix{
nlri2, _ := apb.New(&api.IPAddressPrefix{
Prefix: "10.2.0.0",
PrefixLen: 24,
})
@@ -420,7 +419,7 @@ func TestListPathEnableFiltered(test *testing.T) {
})
assert.Nil(err)
nlri3, _ := ptypes.MarshalAny(&api.IPAddressPrefix{
nlri3, _ := apb.New(&api.IPAddressPrefix{
Prefix: "10.3.0.0",
PrefixLen: 24,
})
@@ -433,7 +432,7 @@ func TestListPathEnableFiltered(test *testing.T) {
},
})
nlri4, _ := ptypes.MarshalAny(&api.IPAddressPrefix{
nlri4, _ := apb.New(&api.IPAddressPrefix{
Prefix: "10.4.0.0",
PrefixLen: 24,
})
@@ -1382,18 +1381,18 @@ func TestAddDeletePath(t *testing.T) {
ctx := context.Background()
s := runNewServer(1, "1.1.1.1", 10179)
nlri, _ := ptypes.MarshalAny(&api.IPAddressPrefix{
nlri, _ := apb.New(&api.IPAddressPrefix{
Prefix: "10.0.0.0",
PrefixLen: 24,
})
a1, _ := ptypes.MarshalAny(&api.OriginAttribute{
a1, _ := apb.New(&api.OriginAttribute{
Origin: 0,
})
a2, _ := ptypes.MarshalAny(&api.NextHopAttribute{
a2, _ := apb.New(&api.NextHopAttribute{
NextHop: "10.0.0.1",
})
attrs := []*any.Any{a1, a2}
attrs := []*apb.Any{a1, a2}
family := &api.Family{
Afi: api.Family_AFI_IP,
@@ -1519,7 +1518,7 @@ func TestAddDeletePath(t *testing.T) {
assert.Equal(t, len(s.uuidMap), 1)
u := r.Uuid
asPath, _ := ptypes.MarshalAny(&api.AsPathAttribute{
asPath, _ := apb.New(&api.AsPathAttribute{
Segments: []*api.AsSegment{
{
Type: 1, // SET
@@ -1568,22 +1567,22 @@ func TestAddBogusPath(t *testing.T) {
ctx := context.Background()
s := runNewServer(1, "1.1.1.1", 10179)
nlri, _ := ptypes.MarshalAny(&api.IPAddressPrefix{})
nlri, _ := apb.New(&api.IPAddressPrefix{})
a, _ := ptypes.MarshalAny(&api.MpReachNLRIAttribute{})
a, _ := apb.New(&api.MpReachNLRIAttribute{})
_, err := s.AddPath(ctx, &api.AddPathRequest{
Path: &api.Path{
Family: &api.Family{Afi: api.Family_AFI_IP, Safi: api.Family_SAFI_UNICAST},
Nlri: nlri,
Pattrs: []*any.Any{a},
Pattrs: []*apb.Any{a},
},
})
assert.NotNil(t, err)
nlri, _ = ptypes.MarshalAny(&api.IPAddressPrefix{})
nlri, _ = apb.New(&api.IPAddressPrefix{})
a, _ = ptypes.MarshalAny(&api.MpReachNLRIAttribute{
a, _ = apb.New(&api.MpReachNLRIAttribute{
Family: &api.Family{Afi: api.Family_AFI_IP, Safi: api.Family_SAFI_FLOW_SPEC_UNICAST},
})
@@ -1591,7 +1590,7 @@ func TestAddBogusPath(t *testing.T) {
Path: &api.Path{
Family: &api.Family{Afi: api.Family_AFI_IP, Safi: api.Family_SAFI_UNICAST},
Nlri: nlri,
Pattrs: []*any.Any{a},
Pattrs: []*apb.Any{a},
},
})
assert.NotNil(t, err)
+1
View File
@@ -12,6 +12,7 @@
// implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//go:build !linux && !openbsd
// +build !linux,!openbsd
package server
+1
View File
@@ -12,6 +12,7 @@
// implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//go:build dragonfly || freebsd || netbsd
// +build dragonfly freebsd netbsd
package server
+1
View File
@@ -12,6 +12,7 @@
// implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//go:build darwin
// +build darwin
package server
+1
View File
@@ -12,6 +12,7 @@
// implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//go:build linux
// +build linux
package server
+1
View File
@@ -12,6 +12,7 @@
// implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//go:build linux
// +build linux
package server
+1
View File
@@ -12,6 +12,7 @@
// implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//go:build openbsd
// +build openbsd
package server
+1
View File
@@ -12,6 +12,7 @@
// implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//go:build !linux && !dragonfly && !freebsd && !netbsd && !openbsd && !darwin
// +build !linux,!dragonfly,!freebsd,!netbsd,!openbsd,!darwin
package server
+1 -1
View File
@@ -22,7 +22,7 @@ import (
"github.com/eapache/channels"
"github.com/osrg/gobgp/pkg/packet/bgp"
"github.com/osrg/gobgp/v3/pkg/packet/bgp"
)
func cleanInfiniteChannel(ch *channels.InfiniteChannel) {
+3 -3
View File
@@ -24,9 +24,9 @@ import (
"syscall"
"time"
"github.com/osrg/gobgp/internal/pkg/table"
"github.com/osrg/gobgp/internal/pkg/zebra"
"github.com/osrg/gobgp/pkg/packet/bgp"
"github.com/osrg/gobgp/v3/internal/pkg/table"
"github.com/osrg/gobgp/v3/internal/pkg/zebra"
"github.com/osrg/gobgp/v3/pkg/packet/bgp"
log "github.com/sirupsen/logrus"
)
+2 -2
View File
@@ -22,8 +22,8 @@ import (
"github.com/stretchr/testify/assert"
"github.com/osrg/gobgp/internal/pkg/table"
"github.com/osrg/gobgp/internal/pkg/zebra"
"github.com/osrg/gobgp/v3/internal/pkg/table"
"github.com/osrg/gobgp/v3/internal/pkg/zebra"
)
func Test_newPathFromIPRouteMessage(t *testing.T) {
+1 -1
View File
@@ -5,7 +5,7 @@ import (
"fmt"
"github.com/BurntSushi/toml"
"github.com/osrg/gobgp/internal/pkg/config"
"github.com/osrg/gobgp/v3/internal/pkg/config"
)
func main() {
+1 -1
View File
@@ -13,7 +13,7 @@ cd "${SCRIPT_DIR}/.."
RESULT=0
PKG_BASE=github.com/osrg/gobgp
PKG_BASE=github.com/osrg/gobgp/v3
for FUNC in ${FUNCS[@]}
do
+6 -12
View File
@@ -13,21 +13,15 @@ if ! [[ "$0" =~ "tools/grpc/genproto.sh" ]]; then
exit 255
fi
if ! [[ $(protoc --version) =~ "3.7.1" ]]; then
echo "could not find protoc 3.7.1, is it installed + in PATH?"
if ! [[ $(protoc --version) =~ "3.19.1" ]]; then
echo "could not find protoc 3.19.1, is it installed + in PATH?"
exit 255
fi
echo "installing plugins"
GO111MODULE=on go mod download
INSTALL_PKGS="github.com/golang/protobuf/protoc-gen-go"
for pkg in ${INSTALL_PKGS}; do
GO111MODULE=on go install "$pkg"
done
GOBGP="${PWD}"
go install google.golang.org/protobuf/cmd/[email protected]
go install google.golang.org/grpc/cmd/[email protected]
echo "generating code"
protoc -I "${GOBGP}"/api \
--go_out=plugins=grpc:${GOBGP}/api "${GOBGP}"/api/*.proto
protoc -I api -I /usr/local/include \
--go_out=api --go_opt=paths=source_relative --go-grpc_out=api --go-grpc_opt=paths=source_relative api/*.proto
+1 -1
View File
@@ -18,5 +18,5 @@
package tools
import (
_ "github.com/golang/protobuf/protoc-gen-go"
_ "google.golang.org/protobuf/cmd/protoc-gen-go"
)