summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cloudinit/net/netplan.py4
-rw-r--r--tests/unittests/test_net.py3
2 files changed, 6 insertions, 1 deletions
diff --git a/cloudinit/net/netplan.py b/cloudinit/net/netplan.py
index 56b41be4..9b71de97 100644
--- a/cloudinit/net/netplan.py
+++ b/cloudinit/net/netplan.py
@@ -345,7 +345,9 @@ class Renderer(renderer.Renderer):
'id': ifcfg.get('vlan_id'),
'link': ifcfg.get('vlan-raw-device')
}
-
+ macaddr = ifcfg.get('mac_address', None)
+ if macaddr is not None:
+ vlan['macaddress'] = macaddr.lower()
_extract_addresses(ifcfg, vlan)
vlans.update({ifname: vlan})
diff --git a/tests/unittests/test_net.py b/tests/unittests/test_net.py
index d36d0e76..68a0157a 100644
--- a/tests/unittests/test_net.py
+++ b/tests/unittests/test_net.py
@@ -558,6 +558,7 @@ iface eth0.101 inet static
dns-nameservers 192.168.0.10 10.23.23.134
dns-search barley.maas sacchromyces.maas brettanomyces.maas
gateway 192.168.0.1
+ hwaddress aa:bb:cc:dd:ee:11
mtu 1500
vlan-raw-device eth0
vlan_id 101
@@ -680,6 +681,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true
gateway4: 192.168.0.1
id: 101
link: eth0
+ macaddress: aa:bb:cc:dd:ee:11
nameservers:
addresses:
- 192.168.0.10
@@ -723,6 +725,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true
name: eth0.101
vlan_link: eth0
vlan_id: 101
+ mac_address: aa:bb:cc:dd:ee:11
mtu: 1500
subnets:
- type: static