@@ -16,7 +16,6 @@ import (
16
16
" time"
17
17
18
18
" github.com/sirupsen/logrus"
19
- apb " google.golang.org/protobuf/types/known/anypb"
20
19
21
20
api " github.com/osrg/gobgp/v3/api"
22
21
" github.com/osrg/gobgp/v3/pkg/log"
@@ -64,26 +63,26 @@ func main() {
64
63
}
65
64
66
65
// add routes
67
- nlri , _ := apb. New ( &api.IPAddressPrefix {
66
+ nlri := &api. NLRI {Nlri: &api. NLRI_Prefix {Prefix: &api.IPAddressPrefix {
68
67
Prefix: " 10.0.0.0" ,
69
68
PrefixLen: 24 ,
70
- })
69
+ }}}
71
70
72
- a1 , _ := apb. New ( &api.OriginAttribute {
71
+ a1 := &api. Attribute {Attr: &api. Attribute_Origin {Origin: &api.OriginAttribute {
73
72
Origin: 0 ,
74
- })
75
- a2 , _ := apb. New ( &api.NextHopAttribute {
73
+ }}}
74
+ a2 := &api. Attribute {Attr: &api. Attribute_NextHop {NextHop: &api.NextHopAttribute {
76
75
NextHop: " 10.0.0.1" ,
77
- })
78
- a3 , _ := apb. New ( &api.AsPathAttribute {
76
+ }}}
77
+ a3 := &api. Attribute {Attr: &api. Attribute_AsPath {AsPath: &api.AsPathAttribute {
79
78
Segments: []*api.AsSegment {
80
79
{
81
80
Type: 2 ,
82
81
Numbers: []uint32 {6762 , 39919 , 65000 , 35753 , 65000 },
83
82
},
84
83
},
85
- })
86
- attrs := []*apb. Any {a1, a2, a3}
84
+ }}}
85
+ attrs := []*api. Attribute {a1, a2, a3}
87
86
88
87
_ , err := s.AddPath (context.Background (), &api.AddPathRequest {
89
88
Path: &api.Path {
@@ -102,25 +101,25 @@ func main() {
102
101
}
103
102
104
103
// add v6 route
105
- nlri, _ = apb. New ( &api.IPAddressPrefix {
104
+ nlri = &api. NLRI {Nlri: &api. NLRI_Prefix {Prefix: &api.IPAddressPrefix {
106
105
PrefixLen: 64 ,
107
106
Prefix: " 2001:db8:1::" ,
108
- })
109
- v6Attrs , _ := apb. New ( &api.MpReachNLRIAttribute {
107
+ }}}
108
+ v6Attrs := &api. Attribute {Attr: &api. Attribute_MpReach {MpReach: &api.MpReachNLRIAttribute {
110
109
Family: v6Family,
111
110
NextHops: []string {" 2001:db8::1" },
112
- Nlris: []*apb. Any {nlri},
113
- })
111
+ Nlris: []*api. NLRI {nlri},
112
+ }}}
114
113
115
- c , _ := apb. New ( &api.CommunitiesAttribute {
114
+ c := &api. Attribute {Attr: &api. Attribute_Communities {Communities: &api.CommunitiesAttribute {
116
115
Communities: []uint32 {100 , 200 },
117
- })
116
+ }}}
118
117
119
118
_, err = s.AddPath (context.Background (), &api.AddPathRequest {
120
119
Path: &api.Path {
121
120
Family: v6Family,
122
121
Nlri: nlri,
123
- Pattrs: []*apb. Any {a1, v6Attrs, c},
122
+ Pattrs: []*api. Attribute {a1, v6Attrs, c},
124
123
},
125
124
})
126
125
if err != nil {
0 commit comments