Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example Declarative Configuration for establishing BGP session using GoBGP #19

Merged
merged 33 commits into from
Aug 30, 2022
Merged
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
3af367c
Add fake gNMI server.
wenovus Mar 4, 2022
ae8c330
Add KNE link to README
wenovus Mar 4, 2022
a61d7f7
Add more licenses
wenovus Mar 4, 2022
e7ced85
Add unit test for gnmit's Set
wenovus Mar 4, 2022
3abc04f
Add TODOs and doc comments
wenovus Mar 4, 2022
7e8029f
Update README.md
marcushines Mar 8, 2022
a3b5495
Update README.md
marcushines Mar 8, 2022
4a5defb
Merge branch 'main' into fake-gnmi
wenovus Mar 8, 2022
c706428
Use self-generated GoStructs and PathStructs instead of depending on …
wenovus Mar 8, 2022
5e3830d
Add Generated GoStructs and PathStructs.
wenovus Mar 8, 2022
53a4757
go.mod updates
wenovus Mar 8, 2022
7031286
Resolve go.mod/sum conflict
wenovus Mar 8, 2022
2b125e1
Fix linter issues
wenovus Mar 9, 2022
614fa58
Fix @generated append
wenovus Mar 9, 2022
3bf4af7
fix bash
wenovus Mar 9, 2022
a4002b5
Merge branch 'add-gostructs' into fake-gnmi
wenovus Mar 9, 2022
210f06f
Remove unimplemented GoBGP code
wenovus Mar 9, 2022
506ae69
Merge branch 'main' into fake-gnmi
wenovus Mar 9, 2022
4bc1ff6
Draft of GoBGP integration with ability to set up peers declaratively.
wenovus Mar 17, 2022
94d0c4d
Merge branch 'gribi-devel' into gobgp
wenovus Aug 25, 2022
69f35be
remove duplicate and outdated README
wenovus Aug 25, 2022
d94dfe5
Add a comment
wenovus Aug 29, 2022
480b547
Merge branch 'main' into gobgp
wenovus Aug 29, 2022
f817e17
Change listening port to 179
wenovus Aug 29, 2022
fd8731d
Fix gnmi.Set deletion
wenovus Aug 29, 2022
f751731
Improve comments for GoBGP task's declarative config
wenovus Aug 29, 2022
78457ab
gofmt
wenovus Aug 29, 2022
0186ba2
Fix lint
wenovus Aug 29, 2022
4b17df2
Fix lint
wenovus Aug 29, 2022
ac3e2a4
re-trigger CI
wenovus Aug 29, 2022
390f520
Improve comments and add TODOs
wenovus Aug 30, 2022
e095ec0
return initialization errors
wenovus Aug 30, 2022
7d79a90
Only return errors to avoid double logging
wenovus Aug 30, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions gnmi/fakedevice/fakedevice.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func init() {

// bootTimeTask is a task that updates the boot-time leaf with the current
// time. It does not spawn any long-running threads.
func bootTimeTask(_ gnmit.Queue, updateFn gnmit.UpdateFn, target string, remove func()) error {
func bootTimeTask(_ func() *config.Device, _ gnmit.Queue, updateFn gnmit.UpdateFn, target string, remove func()) error {
defer remove()
pathBootTime, _, errs := ygot.ResolvePath(telemetrypath.DeviceRoot("").System().BootTime())
if errs != nil {
Expand Down Expand Up @@ -83,7 +83,7 @@ func bootTimeTask(_ gnmit.Queue, updateFn gnmit.UpdateFn, target string, remove

// currentDateTimeTask updates the current-datetime leaf with the current time,
// and spawns a thread that wakes up every second to update the leaf.
func currentDateTimeTask(_ gnmit.Queue, updateFn gnmit.UpdateFn, target string, remove func()) error {
func currentDateTimeTask(_ func() *config.Device, _ gnmit.Queue, updateFn gnmit.UpdateFn, target string, remove func()) error {
pathDatetime, _, err := ygot.ResolvePath(telemetrypath.DeviceRoot("").System().CurrentDatetime())
if err != nil {
return fmt.Errorf("currentDateTimeTask failed to initialize due to error: %v", err)
Expand Down Expand Up @@ -153,7 +153,7 @@ func toStatePath(configPath *gpb.Path) *gpb.Path {
}

// systemBaseTask handles most of the logic for the base systems feature profile.
func systemBaseTask(queue gnmit.Queue, updateFn gnmit.UpdateFn, target string, remove func()) error {
func systemBaseTask(_ func() *config.Device, queue gnmit.Queue, updateFn gnmit.UpdateFn, target string, remove func()) error {
hostnamePath, _, err := ygot.ResolvePath(configpath.DeviceRoot("").System().Hostname())
if err != nil {
log.Errorf("systemBaseTask failed to initialize due to error: %v", err)
Expand Down Expand Up @@ -253,7 +253,7 @@ func systemBaseTask(queue gnmit.Queue, updateFn gnmit.UpdateFn, target string, r
// syslogTask is a meaningless test task that monitors updates to the
// current-datetime leaf and writes updates to the syslog message leaf whenever
// the current-datetime leaf is updated.
func syslogTask(queue gnmit.Queue, updateFn gnmit.UpdateFn, target string, remove func()) error {
func syslogTask(_ func() *config.Device, queue gnmit.Queue, updateFn gnmit.UpdateFn, target string, remove func()) error {
pathSystemMsg, _, err := ygot.ResolvePath(telemetrypath.DeviceRoot("").System().Messages().Message().Msg())
if err != nil {
log.Errorf("syslogTask failed to initialize due to error: %v", err)
Expand Down Expand Up @@ -361,6 +361,15 @@ func tasks(target string) []gnmit.Task {
Origin: "openconfig",
Target: target,
},
}, {
Run: goBgpTask,
Paths: []ygot.PathStruct{
configpath.DeviceRoot("").NetworkInstance("default").Protocol(config.PolicyTypes_INSTALL_PROTOCOL_TYPE_BGP, "BGP").Bgp(),
},
Prefix: &gpb.Path{
Origin: "openconfig",
Target: target,
},
}}
}

Expand Down
Loading