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

Make ping endpoints deterministic #335

Draft
wants to merge 16 commits into
base: master
Choose a base branch
from

Conversation

Kuba314
Copy link
Contributor

@Kuba314 Kuba314 commented Oct 11, 2023

Description

Continued work on endpoints started in #318. Ping endpoint IPs are now taken directly from configured IPs and not from ips_filter(), + some other changes.

Previously sequentially run pings are now run in parallel.

Tests

Early testing job of all distinct production-ready recipe,perf_stream types with thresholds: J:8445495

Reviews

@LNST-project/lnst-developers

@Kuba314 Kuba314 force-pushed the ping-endpoints branch 3 times, most recently from ee7c884 to 5589bab Compare October 17, 2023 16:27
@olichtne
Copy link
Collaborator

Ipsec*Recipe: Remove perf_reverse logic

just a note on this commit... you're correct in the logic of how this CURRENTLY works, but it USED to be that this parameter was in BaseEnrt and so ipsec supported perf_reverse as well... i'm not sure why the refactor changed this but it could be seen as a bug....

HOWEVER.... we don't actually run any reversed ipsec scenarios so i guess this is fine for now and we can add the perfreverse mixin to this once we actually want this functionality back.

@Kuba314
Copy link
Contributor Author

Kuba314 commented Oct 18, 2023

@olichtne Passing ping_bidirect to ipsec would result in an error either way. The earlier refactor could've possibly introduced the bug, but we didn't use the param before. I just removed the usage of this param, which wasn't currently able to be executed anyhow.

olichtne
olichtne previously approved these changes Oct 18, 2023
Copy link
Collaborator

@olichtne olichtne left a comment

Choose a reason for hiding this comment

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

looks ok overall

def ip_version_string(ip_address: BaseIpAddress) -> str:
return "ipv4" if isinstance(ip_address, Ip4Address) else "ipv6"

for ip_version in ip_versions:
Copy link
Collaborator

Choose a reason for hiding this comment

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

these loops should imo be inverted - this organization will re-sort the endpoint_pairs based on the collection of ip versions.

imo a function filter(condition, list) should not change the sort order of the list, only skip the items which don't fit the condition.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was intentional. I felt that first filtering by IP type, then doing product, was much cleaner than doing a product over all IPs of both endpoints end returning only endpoint pairs where both IPs are of the same type.

We shouldn't rely on the returned endpoints to be sorted in any way. Should I switch to first doing product, then filtering? Is there a good reason for it?

Copy link
Collaborator

Choose a reason for hiding this comment

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

this function doesn't do the product of endpoints though... it already accepts the list of endpoints and then returns a filtered list of endpoints. so it serves as a generic filter function for a list of objects. and imo that sort of filtering should be STABLE wrt. how the input list was ordered.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, I thought we're talking about the ping_endpoint_pairs function and not filter_ip_endpoint_pairs. Sure, I agree the filter should be stable.

The reason for this is to display ipv4 and ipv6 endpoints one after the other in results/logs since all are run in parallel, but this ordering is already done in ping_endpoint_pairs. I'll change the filter to be stable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

@Kuba314
Copy link
Contributor Author

Kuba314 commented Oct 23, 2023

Up-to-date quick-check job: J:8466627

@Kuba314
Copy link
Contributor Author

Kuba314 commented Oct 24, 2023

New quick-check job: J:8469963 (had an error in my UUID-picking script, which picked tests with no thresholds instead of tests with thresholds, this time it should fail on threshold indexes).

@olichtne
Copy link
Collaborator

Up-to-date quick-check job: J:8466627

this interestingly failed for 2 tests:

for the GreTunnelRecipe:

FAIL 35_TestResult:	Packet assert unsuccessful, packets received 88, expected min(100) max(0)

for the GeneveTunnelRecipe:

FAIL 29_TestResult:	Packet assert unsuccessful, packets received 88, expected min(100) max(0)

i find it interesting that it's min(100) and max(0)?

@Kuba314
Copy link
Contributor Author

Kuba314 commented Oct 24, 2023

@olichtne only min check if effective if max is falsy. See https://github.com/LNST-project/lnst/blob/master/lnst/RecipeCommon/PacketAssert.py#L79. max is not provided and thus is 0 (falsy).

@Kuba314
Copy link
Contributor Author

Kuba314 commented Oct 31, 2023

Running tests again, this time properly in separate jobs for rhel 8 and 9:

  • RHEL8: J:8502193
  • RHEL9: J:8502194

Edit: I cancelled the jobs, because we decided to first refactor our internal threshold-index handling. This PR is blocked until that's done. This might take a while.

@olichtne
Copy link
Collaborator

postponed until we completely get rid of result index usage for baseline evaluation

Ipsec*Recipes don't inherit from PerfReversibleMixin and thus don't even
accept the perf_reverse argument.
It makes sense for this method to be a generator since it's in the name.
This just makes the class implementation shorter.
This function yields only IP endpoints of IP type requested by the
ip_versions argument.
ENRT/helpers included EnrtConfiguration from BaseEnrtRecipe which itself
imports ENRT/helpers creating a cyclic import.
AFAICT, SimpleMacsecRecipe's generate_ping_configurations differed from
BaseEnrtRecipe's implementation only in the fact that it did not
actually implement ping_bidirect. Defining ping endpoints is enough.
This parameter was used to ensure that recipes unable to run multiple
pings at the same time didn't do so. This will be handled per-recipe's
generate_ping_endpoints() configuration where each recipe now decides
which endpoint pairs it wants to ping-test in parallel.
This ensures that Ipsec*Recipes don't ever run with `ping_bidirect=True`
instead of logging a debug message and throwing out parallel endpoint
tests.
Defining generate_ping_endpoints() is enough. But we can't use
the ip_endpoint_pairs helper function, because we have to respect the
selected IPs from the subconfiguration and not just take all available
ipv4 and ipv6 addresses as the helper function does.
We are returning lists, we should typehint the methods as such.
Previously we generated collections, which are easier to put together,
because they're covariant (`x: Collection[Base] = [Derived()]` is
possible). Now this is not needed and can be achieved elsehow.
We have no use-case for testing ping endpoints sequentially.
`functools.permutations` generate even reversed endpoints (both AB and
BA). This should be controlled by `BaseEnrtRecipe`'s `ping_bidirect`.
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.

None yet

2 participants