-
Notifications
You must be signed in to change notification settings - Fork 33
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
base: master
Are you sure you want to change the base?
Dependencies linux #332
Conversation
Ethtool and pyroute2 are not required to be imported before they are actually needed and this change is required for other than linux platforms to be able to run Controller methods where these packages are not required
There was a problem hiding this 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?
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. |
Tests are passing, SimpleNetwork, L2TP and MPTCP all seem to work after the changes. |
There was a problem hiding this 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'} |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
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