Skip to content

Commit

Permalink
Merge pull request #13 from kpetremann/fix_impossible_bgp_shutdown
Browse files Browse the repository at this point in the history
fix(bgp): peers cannot be shutdown
  • Loading branch information
kpetremann authored Aug 17, 2023
2 parents d99c075 + 51f0e11 commit 27929d3
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
4 changes: 2 additions & 2 deletions internal/convertor/bgp/bgp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func TestBGPToOpenConfig(t *testing.T) {
Description: "TO:SPINE01-01",
MaximumPrefixes: 128,
EnforceFirstAs: true,
Enabled: true,
Enabled: &flagTrue,
},
PeerB: cmdbBGP.DeviceSession{
Device: struct {
Expand Down Expand Up @@ -135,7 +135,7 @@ func TestBGPToOpenConfig(t *testing.T) {
Description: "TO:TOR01-01",
MaximumPrefixes: 10,
EnforceFirstAs: true,
Enabled: true,
Enabled: &flagTrue,
},
Password: awesomePassword,
},
Expand Down
2 changes: 1 addition & 1 deletion internal/convertor/bgp/neighbor.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func NeighborsToOpenconfig(hostname string, sessions []*bgp.Session) (map[string
NeighborAddress: &neighborAddress,
ApplyPolicy: &policy,
AfiSafi: safis,
Enabled: &localInfo.Enabled,
Enabled: localInfo.Enabled,
PeerAs: remoteInfo.LocalAsn.Number,
LocalAs: localInfo.LocalAsn.Number,
AuthPassword: &session.Password,
Expand Down
18 changes: 10 additions & 8 deletions internal/ingestor/cmdb/bgp_session_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import (

var as65000 uint32 = 65000
var as65001 uint32 = 65001
var flagTrue = true
var flagFalse = false

/*
BGP session - IPv4
Expand Down Expand Up @@ -175,7 +177,7 @@ var ipv4Ingested = map[string][]*bgp.Session{
Description: "TO:SPINE01-01",
MaximumPrefixes: 128,
EnforceFirstAs: true,
Enabled: true,
Enabled: &flagTrue,
},
PeerB: bgp.DeviceSession{
Device: struct {
Expand Down Expand Up @@ -213,7 +215,7 @@ var ipv4Ingested = map[string][]*bgp.Session{
Description: "TO:TOR01-01",
MaximumPrefixes: 10,
EnforceFirstAs: true,
Enabled: false,
Enabled: &flagFalse,
},
Password: "awesomepassword",
},
Expand Down Expand Up @@ -262,7 +264,7 @@ var ipv4Ingested = map[string][]*bgp.Session{
Description: "TO:SPINE01-01",
MaximumPrefixes: 128,
EnforceFirstAs: true,
Enabled: true,
Enabled: &flagTrue,
},
PeerB: bgp.DeviceSession{
Device: struct {
Expand Down Expand Up @@ -300,7 +302,7 @@ var ipv4Ingested = map[string][]*bgp.Session{
Description: "TO:TOR01-01",
MaximumPrefixes: 10,
EnforceFirstAs: true,
Enabled: false,
Enabled: &flagFalse,
},
Password: "awesomepassword",
},
Expand Down Expand Up @@ -454,7 +456,7 @@ var ipv6Ingested = map[string][]*bgp.Session{
Description: "TO:SPINE01-01:V6",
MaximumPrefixes: 0,
EnforceFirstAs: true,
Enabled: true,
Enabled: &flagTrue,
},
PeerB: bgp.DeviceSession{
Device: struct {
Expand Down Expand Up @@ -494,7 +496,7 @@ var ipv6Ingested = map[string][]*bgp.Session{
Description: "TO:TOR01-01:V6",
MaximumPrefixes: 0,
EnforceFirstAs: true,
Enabled: true,
Enabled: &flagTrue,
},
Password: "awesomepassword",
},
Expand Down Expand Up @@ -539,7 +541,7 @@ var ipv6Ingested = map[string][]*bgp.Session{
Description: "TO:SPINE01-01:V6",
MaximumPrefixes: 0,
EnforceFirstAs: true,
Enabled: true,
Enabled: &flagTrue,
},
PeerB: bgp.DeviceSession{
Device: struct {
Expand Down Expand Up @@ -579,7 +581,7 @@ var ipv6Ingested = map[string][]*bgp.Session{
Description: "TO:TOR01-01:V6",
MaximumPrefixes: 0,
EnforceFirstAs: true,
Enabled: true,
Enabled: &flagTrue,
},
Password: "awesomepassword",
},
Expand Down
2 changes: 1 addition & 1 deletion internal/model/cmdb/bgp/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ type DeviceSession struct {
RoutePolicyIn *routingpolicy.RoutePolicyLite `json:"route_policy_in" validate:"omitempty"`
RoutePolicyOut *routingpolicy.RoutePolicyLite `json:"route_policy_out" validate:"omitempty"`
AfiSafis []*AfiSafi `json:"afi_safis" validate:"required"`
Enabled *bool `json:"enabled" validate:"required"`
Description string `json:"description" validate:"omitempty"`
LocalAddress Address `json:"local_address" validate:"required"`
MaximumPrefixes uint32 `json:"maximum_prefixes" validate:"omitempty"`
EnforceFirstAs bool `json:"enforce_first_as" validate:"omitempty"`
Enabled bool `json:"enabled" validate:"required"`
}

type Session struct {
Expand Down

0 comments on commit 27929d3

Please sign in to comment.