-
Notifications
You must be signed in to change notification settings - Fork 208
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
Netplan status --diff refactoring #444
Conversation
41b8a47
to
48280b0
Compare
77acb2b
to
f5fb016
Compare
Hi @rkratky, may I ask you to review the last commit of this PR, please? It's updating the |
utils.route_table_lookup: - use the new path of the configuration files. It was changed recently in iproute2. It will fallback to the old path if the iproute2 version in the system is older. - change the dictionary to map names to numbers as well - if it fails to open the file, return the standard content found in rt_tables. - mock this method all over the tests so they will not try to open the real file. state_diff._default_route_tables_name_to_number: - use utils.route_table_lookup instead of its own mapping
If the MAC address in Netplan is not a valid MAC (it can also be an option now, such as 'random' and 'permanent'), don't try to diff it against the system's MAC address.
The low level API has two new functions that will return a boolean representing the internal state of the property. In the netdef, this property is stored in an internal struct that contains two gboolean variables. To avoid having to expose this struct I decided to separate it in two functions. In the Python code, the new propserty 'link_local' will return a list containing ipv4 or ipv6 or an empty list to mimic the link-local property in the YAML.
Instead of ignoring link local IPs and routes, check the netdef 'link-local' property to see if the they should be part of the diff.
It implemented a PoC of the tabular user interface that will not be used anymore.
f5fb016
to
9c5220b
Compare
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 like the changes overall. Left some minor inline comments.
When testing the changes, it seems like IP-address diffing is broken after the link-local changes, though?
-> Sorry, configuration error on my end.
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.
LGTM with the configuration error resolved.
Update the manpage and autocomplete files.
9c5220b
to
7312392
Compare
A few improvements for
netplan status --diff
:/etc/iproute2/
were moved to/usr/share
in a recent release of iproute2. Fix unit tests to not open the real file.random
is used in the YAML.link-local
property via a new API.link-local
property. Note that currently it will not check if the system interface should have a link local address (in other words, it will not show a diff iflink-local
is enabled but the address is not present in the system). It will only check if the address is present and check thelink-local
property to see if the address is expected to be there.netplan-status
manpage and autocomplete files.Example of link-local changes:
In this case, link-local has the default configuration, which enables it only for IPv6, but the IPv4 link local address is also present so it will show up as a diff.
Description
Checklist
make check
successfully.make check-coverage
).