Allow management of vlans when specifying mac

In the case of ipv4_interface_mac being used, it was
not following the vlan_id parameter. Add that possibility
of configuration as well.

Change-Id: I1479e464ce3c53544bc29c609a368f84cbaae2ef
This commit is contained in:
Yolanda Robla Mota 2016-09-30 13:40:01 +02:00
parent 6c7991d96b
commit 6ab45b2c76

View File

@ -45,6 +45,19 @@ def main():
networks = []
if module.params['ipv4_interface_mac']:
nic_id = module.params['ipv4_interface_mac']
if module.params['vlan_id']:
nic_id = 'vlan-%s' % module.params['ipv4_interface_mac']
links.append({
'id': nic_id,
'type': 'vlan',
'vlan_id': module.params['vlan_id'],
'vlan_link': module.params['ipv4_interface_mac'],
'vlan_mac_address': module.params['ipv4_interface_mac'],
})
links.append({
'id': module.params['ipv4_interface_mac'],
'type': 'phy',
@ -55,8 +68,8 @@ def main():
for nic in module.params['nics']:
if nic['mac'] == module.params['ipv4_interface_mac']:
networks.append({
'id': 'ipv4-%s' % nic['mac'],
'link': nic['mac'],
'id': 'ipv4-%s' % nic_id,
'link': nic_id,
'type': 'ipv4',
'ip_address': module.params['ipv4_address'],
'netmask': module.params['ipv4_subnet_mask'],