2021-02-20 16:35:45 +00:00
|
|
|
defaults = {
|
|
|
|
'apt': {
|
|
|
|
'packages': {
|
2023-01-29 09:13:26 +00:00
|
|
|
'isc-dhcp-client': {
|
|
|
|
'installed': False,
|
|
|
|
},
|
2024-08-01 06:40:47 +00:00
|
|
|
'network-manager': {
|
|
|
|
'installed': False,
|
|
|
|
},
|
2021-02-20 16:35:45 +00:00
|
|
|
'resolvconf': {
|
|
|
|
'installed': False,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-01-07 17:44:38 +00:00
|
|
|
@metadata_reactor.provides(
|
|
|
|
'interfaces',
|
2021-10-11 18:46:07 +00:00
|
|
|
'systemd-networkd/bridges',
|
2021-01-07 17:44:38 +00:00
|
|
|
)
|
2020-11-13 15:29:17 +00:00
|
|
|
def add_vlan_infos_to_interface(metadata):
|
|
|
|
interfaces = {}
|
2021-10-11 18:46:07 +00:00
|
|
|
bridges = {}
|
2020-11-13 15:29:17 +00:00
|
|
|
|
2021-02-12 19:37:36 +00:00
|
|
|
for iface in metadata.get('interfaces', {}):
|
2021-10-11 18:46:07 +00:00
|
|
|
if '.' not in iface:
|
2020-11-13 15:29:17 +00:00
|
|
|
continue
|
|
|
|
|
|
|
|
interface,vlan = iface.split('.')
|
|
|
|
|
|
|
|
interfaces.setdefault(interface, {}).setdefault('vlans', set())
|
|
|
|
interfaces[interface]['vlans'].add(vlan)
|
|
|
|
|
2021-10-11 18:46:07 +00:00
|
|
|
for bridge, config in metadata.get('systemd-networkd/bridges', {}).items():
|
|
|
|
for iface in config.get('match', {}):
|
|
|
|
if '.' not in iface:
|
|
|
|
continue
|
|
|
|
|
|
|
|
interface,vlan = iface.split('.')
|
|
|
|
|
|
|
|
bridges.setdefault(interface, {}).setdefault('vlans', set())
|
|
|
|
bridges[interface]['vlans'].add(vlan)
|
|
|
|
|
|
|
|
interfaces.setdefault(iface, {'ignore': True})
|
|
|
|
|
2020-11-13 15:29:17 +00:00
|
|
|
return {
|
|
|
|
'interfaces': interfaces,
|
2021-10-11 18:46:07 +00:00
|
|
|
'systemd-networkd': {
|
|
|
|
'bridges': bridges,
|
|
|
|
},
|
2020-11-13 15:29:17 +00:00
|
|
|
}
|