fix: connectivity panel rearrangement. LXD VM for repeatable tests.
This commit is contained in:
1 parent
85a1ffa21f
commit
da889b4865
15 files changed
+363
-47
No files matched your search
@@ -125,6 +125,31 @@ def routes():
|
||||
return None
|
||||
|
||||
|
||||
def interfaces():
|
||||
"""The network interfaces but loopback, each {name, state, mac, ipv4, ipv6} from ip -j addr show, with its IPv4
|
||||
and its global IPv6 addresses as address/prefix, or None when ip fails."""
|
||||
result = run('ip', '-j', 'addr', 'show')
|
||||
if result is None or result.returncode != 0:
|
||||
return None
|
||||
try:
|
||||
links = json.loads(result.stdout)
|
||||
except ValueError:
|
||||
return None
|
||||
|
||||
def addresses(link, family):
|
||||
return [f'{entry["local"]}/{entry["prefixlen"]}' for entry in link.get('addr_info', [])
|
||||
if entry.get('family') == family and 'local' in entry
|
||||
and (family == 'inet' or entry.get('scope') == 'global')]
|
||||
|
||||
return [{
|
||||
'name': link['ifname'],
|
||||
'state': link.get('operstate'),
|
||||
'mac': link.get('address'),
|
||||
'ipv4': addresses(link, 'inet'),
|
||||
'ipv6': addresses(link, 'inet6'),
|
||||
} for link in links if link.get('link_type') != 'loopback' and 'ifname' in link]
|
||||
|
||||
|
||||
def wireguard_details():
|
||||
"""The interface and the peers of wg0, with endpoints and allowed IPs; no private or preshared key."""
|
||||
result = run('wg', 'show', 'wg0', 'dump')
|
||||
@@ -214,7 +239,7 @@ def details(state):
|
||||
oidc = configuration.get('oidc', {}).get('enabled') is True
|
||||
return {
|
||||
'configuration': configuration,
|
||||
'network': dict(state.get('network', {}), routes=routes()),
|
||||
'network': dict(state.get('network', {}), interfaces=interfaces(), routes=routes()),
|
||||
'ipsec': {
|
||||
'connections': swanctl('--list-conns'),
|
||||
'sas': swanctl('--list-sas'),
|
||||
|
||||
Reference in new issue
Block a user