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

commands/status: show routes from all routing tables #390

Merged
merged 2 commits into from Aug 8, 2023

Conversation

daniloegea
Copy link
Collaborator

@daniloegea daniloegea commented Aug 3, 2023

Description

While working on netplan diff I realized netplan status doesn't query all the routing tables. This information will be necessary for netplan diff. But I wonder if we should show them all in netplan status... maybe it could be hidden behind a --verbose option and show only the main table by default.

Here is the change in the output:

●  5: enx00e04c680007 ethernet UP (NetworkManager: NM-52f9e3b9-be59-4b8b-98fe-a9c24d9931d5)
      MAC Address: 00:e0:4c:68:00:07 (Realtek Semiconductor Corp.)
        Addresses: 192.168.5.122/24 (dhcp)
                   fe80::df05:925a:4f33:7254/64 (link)
    DNS Addresses: 192.168.5.1
       DNS Search: tendawifi.com
           Routes: default via 192.168.5.1 from 192.168.5.122 metric 100 (dhcp)
                   192.168.5.0/24 from 192.168.5.122 metric 100 (link)
                   fe80::/64 metric 1024
●  5: enx00e04c680007 ethernet UP (NetworkManager: NM-52f9e3b9-be59-4b8b-98fe-a9c24d9931d5)
      MAC Address: 00:e0:4c:68:00:07 (Realtek Semiconductor Corp.)
        Addresses: 192.168.5.122/24 (dhcp)
                   fe80::df05:925a:4f33:7254/64 (link)
    DNS Addresses: 192.168.5.1
       DNS Search: tendawifi.com
           Routes: default via 192.168.5.1 from 192.168.5.122 metric 100 table main (dhcp)
                   192.168.5.0/24 from 192.168.5.122 metric 100 table main (link)
                   192.168.5.122 from 192.168.5.122 table local (host, local)
                   192.168.5.255 from 192.168.5.122 table local (link, broadcast)
                   fe80::/64 metric 1024 table main
                   fe80:: table local (anycast)
                   fe80::df05:925a:4f33:7254 table local (local)
                   ff00::/8 metric 256 table local (multicast)

Checklist

  • Runs make check successfully.
  • Retains 100% code coverage (make check-coverage).
  • New/changed keys in YAML format are documented.
  • (Optional) Adds example YAML for new feature.
  • (Optional) Closes an open bug in Launchpad.

Copy link
Collaborator

@slyon slyon left a comment

Choose a reason for hiding this comment

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

Thank you, I like the hiding of the extra routing table information behind a --verbose flag!

I put two small remarks inline, but nothing critical. So feel free to merge as-is if you feel like.

LGTM.

netplan_cli/cli/state.py Show resolved Hide resolved
tests/cli/test_status.py Outdated Show resolved Hide resolved
Use the := operator to make the for loop a bit simpler.
We were listing routes from only the main table. The new diff
functionality will need all routes in order to calculate the diff
properly.

The extra routes are not displayed by default.

A new parameter, --verbose, was added and the extra routes will be
displayed when netplan status is called with it.
@daniloegea daniloegea merged commit e94486a into canonical:main Aug 8, 2023
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants