Skip to content

Refactor and add route propagation tests - #59

Merged
fedepaol merged 7 commits into
openperouter:mainfrom
fedepaol:moartestsstep2
May 12, 2025
Merged

Refactor and add route propagation tests#59
fedepaol merged 7 commits into
openperouter:mainfrom
fedepaol:moartestsstep2

Conversation

@fedepaol

@fedepaol fedepaol commented May 7, 2025

Copy link
Copy Markdown
Contributor

Here we add more test checking the route propagation and we refactor the whole machinery a bit.


// This test must be the last of the ordered describe as it will remove the underlay
It("deleting the underlay removes the session with the tor", func() {
By("deleting the vni removes the session with the host")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can/should we start with validating the session is there?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can, we already validated as the first it of the spec and this is an ordered spec, but re-validating won't hurt.

Comment thread e2etests/pkg/frr/bgp.go Outdated
if len(r.Nexthops) == 0 {
continue
}
res[p] = r.Nexthops[0].IP

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why this approach instead of parsing all nexthops + going over all of them in HaveRoute? (if it has something to do with BestPath/Valid, can we make this more explicit?)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will fix it.

Comment thread e2etests/pkg/frr/bgp.go Outdated
} `json:"addressFamilyInfo"`
ConnectionsDropped int `json:"connectionsDropped"`
ConnectionsDropped int `json:"connectionsDropped"`
NoSuchNeighbor bool `json:"bgpNoSuchNeighbor"`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is never filled

Comment thread e2etests/tests/routes.go Outdated

It("receives type 5 routes from the fabric", func() {
Contains := true
checkRouteForLeaf := func(leaf infra.Leaf, vni v1alpha1.VNI, mustContain bool, prefixes []string) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can/should this be From instead of For?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't mind changing it. It's either "check the routes for that leaf" or check the routes coming from that leaf.

Comment thread e2etests/tests/routes.go
By("announcing type 5 routes on VNI 100 from leafA")
changeLeafPrefixes(infra.LeafAConfig, leafAVRFRedPrefixes, emptyPrefixes)
checkRouteForLeaf(infra.LeafAConfig, vniRed, Contains, leafAVRFRedPrefixes)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we have a !Contains for blue here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we are not advertising those routes yet, so what it would be testing? Do you have a particular reason for wanting it?

Comment thread e2etests/tests/routes.go
changeLeafPrefixes(infra.LeafBConfig, leafBVRFRedPrefixes, leafBVRFBluePrefixes)
checkRouteForLeaf(infra.LeafBConfig, vniRed, Contains, leafBVRFRedPrefixes)
checkRouteForLeaf(infra.LeafBConfig, vniBlue, Contains, leafBVRFBluePrefixes)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we keep checking leafA prefixes here?

Comment thread e2etests/tests/routes.go
changeLeafPrefixes(infra.LeafAConfig, emptyPrefixes, leafAVRFBluePrefixes)
checkRouteForLeaf(infra.LeafAConfig, vniRed, !Contains, leafAVRFRedPrefixes)
checkRouteForLeaf(infra.LeafAConfig, vniBlue, Contains, leafAVRFBluePrefixes)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same (checking leafB)

Comment thread e2etests/tests/routes.go
checkRouteForLeaf(infra.LeafAConfig, vniBlue, Contains, leafAVRFBluePrefixes)

By("removing a route from leafA on vni 200")
changeLeafPrefixes(infra.LeafAConfig, emptyPrefixes, emptyPrefixes)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing a check?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am going to add the 4 checks in every step, feels less error prone / easier to understand.

Signed-off-by: Federico Paolinelli <fpaoline@redhat.com>
@fedepaol
fedepaol force-pushed the moartestsstep2 branch 6 times, most recently from ff33085 to 2a47b29 Compare May 10, 2025 01:33
fedepaol added 6 commits May 10, 2025 08:39
It makes sense to have a more broad session validation as a separate
file.

Signed-off-by: Federico Paolinelli <fpaoline@redhat.com>
We add functions that check if a given route is received via BGP or
EVPN.

- Add logic to fetch the output from FRR
- Add the parsing functions
- Add utility functions to validate if a given route is present in
either EPVN routes or BGP routes

Signed-off-by: Federico Paolinelli <fpaoline@redhat.com>
We refresh the existing type5 routes tests with a more comprehensive one
where we add and delete routes.

Also, we add a test that validates that type5 routes are propagated to
the host via BGP.

Signed-off-by: Federico Paolinelli <fpaoline@redhat.com>
Adding the reporter library to collect crds and pod logs, and inspecting
the various frr instances both in frr-k8s, in the perouter and on the
clab leaves.

Signed-off-by: Federico Paolinelli <fpaoline@redhat.com>
We are getting warnings about MGMTD and WATCHFRR, setting the global
one.

Signed-off-by: Federico Paolinelli <fpaoline@redhat.com>
Signed-off-by: Federico Paolinelli <fpaoline@redhat.com>

@oribon oribon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@fedepaol
fedepaol merged commit e27efb8 into openperouter:main May 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants