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

Dependencies linux #332

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Conversation

Axonis
Copy link
Contributor

@Axonis Axonis commented Sep 25, 2023

Description

Using LNST as dependency when you only require PerfResult structure / importing LRC files it is not required to be installing and using ethtool / pyroute2 dependencies, which are netlink specific - meaning linux specific.

There are multiple LNST users and developers that are not actively using Linux distros and it would simplify working with LNST as dependency.

Tests

8351283

Reviews

@LNST-project/lnst-developers

Closes: #331

Copy link
Member

@enhaut enhaut left a comment

Choose a reason for hiding this comment

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

Have you tried platform-specific imports e.g. https://stackoverflow.com/a/41097342 ?

I guess it broke static analysis?

@Axonis
Copy link
Contributor Author

Axonis commented Sep 25, 2023

Have you tried platform-specific imports e.g. https://stackoverflow.com/a/41097342 ?

I guess it broke static analysis?

I thought about it, but there are no alternatives on darwin kernel that would be just "plug-and-play".

I am just trying to make LNST work in minimal sense so that darwin kernel is able to load LRC files mostly, not to make it fully functional as that would require quite a lot of effort for minimal to no gain as LNST is currently only being utilized by Linux specific server setups.

Also I don't see this happening on Windows NT kernel as there are just way too many references to underlaying system (being linux based), which would break and had to be rewritten to support multiple platforms. Instead I am leveraging FreeBSD properties of Darwin, which allow us to get it somewhat functional.

Finally, we already added somewhat of a lazy loading of imports/dependencies at the time of their need/utilization, instead of being always present and this goes along with that idea.

@Axonis
Copy link
Contributor Author

Axonis commented Sep 26, 2023

Tests are passing, SimpleNetwork, L2TP and MPTCP all seem to work after the changes.

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.

minor comments

ethtool = "*"
pyroute2 = "*"
ethtool = {version = "*", platform = 'linux'}
pyroute2 = {version = "*", platform = 'linux'}
Copy link
Collaborator

Choose a reason for hiding this comment

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

i think if possible i'd also like this to be split in a way that these only install on the Agent installations... and a pure controller installation doesn't need these.

simply for situations when i want to install a pure controller on linux, this will still want to install these dependencies.

@@ -55,6 +53,11 @@ def test(self):
_mandatory_opts = ["tunnel_id", "session_id", "peer_session_id"]

def __init__(self, ifmanager, *args, **kwargs):
from pyroute2.netlink import NetlinkError
Copy link
Collaborator

Choose a reason for hiding this comment

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

i think we should have a generic Device._import_agent_dependencies method which is then extended in the derived class here to separate it a bit logically from normal instance initialization.

@@ -24,6 +23,7 @@ def normalize_hwaddr(hwaddr):


def scan_netdevs():
from pyroute2 import IPRoute
Copy link
Collaborator

Choose a reason for hiding this comment

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

i grepped this in the repo and we don't actually use this function anywhere... i think we should just remove it completely...

originally i wanted to know if this was in any way used on the controller, because this seems like an agent only function anyway.

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.

Do not import pyroute2 and ethtool until they are required
3 participants