-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Neighbor merge: clean the default values
Since we don't want the end result of merging to depend on the order, and we declare two neighbors compatible if: - they have the same values - some of the values are not set Or they are set to the default value of the field Here we clean after ensuring the compatibility, to make sure the result of the merging is stable. Signed-off-by: Federico Paolinelli <[email protected]>
- Loading branch information
Showing
2 changed files
with
60 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1331,6 +1331,46 @@ func TestMergeNeighbors(t *testing.T) { | |
}, | ||
err: nil, | ||
}, | ||
{ | ||
// This test is similar to the previous, to ensure conversion stability | ||
name: "HoldTime / KeepAlive time, one set to the default, the other set to nil", | ||
curr: []*frr.NeighborConfig{ | ||
{ | ||
IPFamily: ipfamily.IPv4, | ||
Name: "[email protected]", | ||
ASN: 65040, | ||
Addr: "192.0.1.20", | ||
HoldTime: ptr.To(uint64(180)), | ||
KeepaliveTime: ptr.To(uint64(60)), | ||
ConnectTime: ptr.To(uint64(60)), | ||
}, | ||
}, | ||
toMerge: []*frr.NeighborConfig{ | ||
{ | ||
IPFamily: ipfamily.IPv4, | ||
Name: "[email protected]", | ||
ASN: 65040, | ||
Addr: "192.0.1.20", | ||
}, | ||
}, | ||
expected: []*frr.NeighborConfig{ | ||
{ | ||
IPFamily: ipfamily.IPv4, | ||
Name: "[email protected]", | ||
ASN: 65040, | ||
Addr: "192.0.1.20", | ||
Outgoing: frr.AllowedOut{ | ||
PrefixesV4: []frr.OutgoingFilter{}, | ||
PrefixesV6: []frr.OutgoingFilter{}, | ||
}, | ||
Incoming: frr.AllowedIn{ | ||
PrefixesV4: []frr.IncomingFilter{}, | ||
PrefixesV6: []frr.IncomingFilter{}, | ||
}, | ||
}, | ||
}, | ||
err: nil, | ||
}, | ||
} | ||
|
||
for _, test := range tests { | ||
|