state/status: add support for identifying bridge/bond/vrf members#420
state/status: add support for identifying bridge/bond/vrf members#420daniloegea merged 3 commits intocanonical:mainfrom
Conversation
c88ba4c to
e118dac
Compare
e118dac to
65d4c7f
Compare
e53e09f to
e3b49e4
Compare
slyon
left a comment
There was a problem hiding this comment.
Thank you, I like the looks of this very much!
Just some nitpicks about nomenclature, to keep it in line with our YAML definitions. We should probably adopt those. WDYT?
netplan_cli/cli/commands/status.py
Outdated
| lst = data.get('members', []) | ||
| for i, val in enumerate(lst): | ||
| pprint(('{title:>'+pad+'} {value}').format( | ||
| title='Members:' if i == 0 else '', |
There was a problem hiding this comment.
nitpick: We should arguably call it "Interfaces", to keep it in line with the Netplan YAML nomenclature.
netplan_cli/cli/state.py
Outdated
| if self.bond: | ||
| json['bond'] = self.bond | ||
| if self.members: | ||
| json['members'] = self.members |
There was a problem hiding this comment.
nitpick: We might call this interfaces, see above.
| return (addresses, search) | ||
|
|
||
| @classmethod | ||
| def query_members(cls, ifname: str) -> List[str]: |
There was a problem hiding this comment.
nitpick (non-blocking): A brief docstring describing what this method does would be nice.
| return members | ||
|
|
||
| @classmethod | ||
| def correlate_members_and_uplink(cls, interfaces: List[Interface]) -> None: |
There was a problem hiding this comment.
nitpick (non-blocking): A brief docstring describing what this method does would be nice.
netplan_cli/cli/state.py
Outdated
| DEVICE_TYPES = { | ||
| 'bond': 'bond', | ||
| 'bridge': 'bridge', | ||
| 'dummy': 'dummy', |
There was a problem hiding this comment.
nitpick: Should this be translated to dummy-device to stay in line with Netplan YAML?
netplan_cli/cli/state.py
Outdated
| 'wireguard': 'tunnel', | ||
| 'wlan': 'wifi', | ||
| 'wwan': 'modem', | ||
| 'veth': 'veth', |
There was a problem hiding this comment.
nitpick: Should this be translated to virtual-ethernet to stay in line with Netplan YAML?
If the interface is a bridge/bond, display its members. If it's not a bridge/bond and is a member of a bridge/bond, display the bridge/bond name.
"netplan status" will now also show information about what interfaces are members of a VRF and for each interface show what is the VRF it's associated to. It will also look for the Kind property to be more specific about the interface type. For example, instead of showing a dummy interface as being an ethernet device it will show dummy.
The name Interfaces is used in the Netplan configuration already. Also, check if the interface 'Type' is being reported as 'none'. I have an active OpenVPN tunnel and networkctl return 'none' as type, but the 'Kind' property is 'tun'. So use the Kind property in these cases. Also add a test case for that.
e3b49e4 to
3527f79
Compare
If the interface is a bridge/bond/vrf, display its members. If it is a member of a bridge/bond/vrf, display the bridge/bond/vrf name.
It will also use the "Kind" property to be more specific about the interface type.
Example
Description
Checklist
make checksuccessfully.make check-coverage).