Skip to content

Commit

Permalink
Do not generate sequence numbers in prefix list to prevent route chur…
Browse files Browse the repository at this point in the history
…n on every changed prefix
  • Loading branch information
mreiger committed Jul 14, 2021
1 parent 5350575 commit 81f79f0
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ go 1.16
require (
github.com/emicklei/go-restful-openapi/v2 v2.3.0
github.com/emicklei/go-restful/v3 v3.5.1
github.com/go-openapi/errors v0.20.0
github.com/go-openapi/errors v0.20.0 // indirect
github.com/go-openapi/runtime v0.19.28
github.com/go-openapi/spec v0.20.3
github.com/go-openapi/strfmt v0.20.1
github.com/go-openapi/swag v0.19.15
github.com/go-openapi/validate v0.20.2
github.com/go-openapi/swag v0.19.15 // indirect
github.com/go-openapi/validate v0.20.2 // indirect
github.com/google/gopacket v1.1.19
github.com/kelseyhightower/envconfig v1.4.0
github.com/metal-stack/go-hal v0.3.4
Expand Down
2 changes: 1 addition & 1 deletion internal/event/reconfigureSwitch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func TestBuildSwitcherConfig(t *testing.T) {
IPPrefixLists: []switcher.IPPrefixList{
{
Name: "vrf104001-in-prefixes",
Spec: "seq 10 permit 10.244.0.0/16 le 32",
Spec: "permit 10.244.0.0/16 le 32",
},
},
RouteMaps: []switcher.RouteMap{
Expand Down
8 changes: 4 additions & 4 deletions internal/switcher/test_data/customtpl/frr.conf
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ route-map LOCALS permit 12
match interface vlan4000
!
# route-maps for firewall@swp3
ip prefix-list fw-swp3-in-prefixes seq 10 permit 10.0.2.1/32 le 32
ip prefix-list fw-swp3-in-prefixes permit 10.0.2.1/32 le 32
route-map fw-swp3-in permit 10
match ip address prefix-list fw-swp3-in-prefixes
route-map fw-swp3-vni permit 10
Expand Down Expand Up @@ -99,9 +99,9 @@ router bgp 4200000010 vrf vrf104001
exit-address-family
!
# route-maps for vrf104001
ip prefix-list vrf104001-in-prefixes seq 10 permit 100.127.131.0/24 le 32
ip prefix-list vrf104001-in-prefixes seq 11 permit 212.17.234.17/32 le 32
ip prefix-list vrf104001-in-prefixes seq 12 permit 10.244.0.0/16 le 32
ip prefix-list vrf104001-in-prefixes permit 100.127.131.0/24 le 32
ip prefix-list vrf104001-in-prefixes permit 212.17.234.17/32 le 32
ip prefix-list vrf104001-in-prefixes permit 10.244.0.0/16 le 32
route-map vrf104001-in permit 10
match ip address prefix-list vrf104001-in-prefixes
!
Expand Down
8 changes: 4 additions & 4 deletions internal/switcher/test_data/dev/frr.conf
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ route-map LOOPBACKS permit 10
match interface lo
!
# route-maps for firewall@swp3
ip prefix-list fw-swp3-in-prefixes seq 10 permit 10.0.2.1/32 le 32
ip prefix-list fw-swp3-in-prefixes permit 10.0.2.1/32 le 32
route-map fw-swp3-in permit 10
match ip address prefix-list fw-swp3-in-prefixes
route-map fw-swp3-vni permit 10
Expand Down Expand Up @@ -98,9 +98,9 @@ router bgp 4200000010 vrf vrf104001
exit-address-family
!
# route-maps for vrf104001
ip prefix-list vrf104001-in-prefixes seq 10 permit 100.127.131.0/24 le 32
ip prefix-list vrf104001-in-prefixes seq 11 permit 212.17.234.17/32 le 32
ip prefix-list vrf104001-in-prefixes seq 12 permit 10.244.0.0/16 le 32
ip prefix-list vrf104001-in-prefixes permit 100.127.131.0/24 le 32
ip prefix-list vrf104001-in-prefixes permit 212.17.234.17/32 le 32
ip prefix-list vrf104001-in-prefixes permit 10.244.0.0/16 le 32
route-map vrf104001-in permit 10
match ip address prefix-list vrf104001-in-prefixes
!
Expand Down
4 changes: 2 additions & 2 deletions internal/switcher/test_data/lab/frr.conf
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ route-map LOOPBACKS permit 10
match interface lo
!
# route-maps for firewall@swp3
ip prefix-list fw-swp3-in-prefixes seq 10 permit 10.0.2.1/32 le 32
ip prefix-list fw-swp3-in-prefixes permit 10.0.2.1/32 le 32
route-map fw-swp3-in permit 10
match ip address prefix-list fw-swp3-in-prefixes
route-map fw-swp3-vni permit 10
Expand Down Expand Up @@ -98,7 +98,7 @@ router bgp 4200000010 vrf vrf104001
exit-address-family
!
# route-maps for vrf104001
ip prefix-list vrf104001-in-prefixes seq 10 permit 10.244.0.0/16 le 32
ip prefix-list vrf104001-in-prefixes permit 10.244.0.0/16 le 32
route-map vrf104001-in permit 10
match ip address prefix-list vrf104001-in-prefixes
!
Expand Down
4 changes: 2 additions & 2 deletions internal/switcher/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ func (s *Filter) Assemble(rmPrefix string, vnis, cidrs []string) {
}
s.RouteMaps = append(s.RouteMaps, rm)

for j, cidr := range cidrs {
spec := fmt.Sprintf("seq %d permit %s le 32", 10+j, cidr)
for _, cidr := range cidrs {
spec := fmt.Sprintf("permit %s le 32", cidr)
prefixList := IPPrefixList{
Name: prefixListName,
Spec: spec,
Expand Down

0 comments on commit 81f79f0

Please sign in to comment.