Merge "Allow management of vlans when specifying mac"

This commit is contained in:
Jenkins 2016-10-11 12:08:16 +00:00 committed by Gerrit Code Review
commit aa6c5cc4c0

View File

@ -45,6 +45,19 @@ def main():
networks = [] networks = []
if module.params['ipv4_interface_mac']: 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({ links.append({
'id': module.params['ipv4_interface_mac'], 'id': module.params['ipv4_interface_mac'],
'type': 'phy', 'type': 'phy',
@ -55,8 +68,8 @@ def main():
for nic in module.params['nics']: for nic in module.params['nics']:
if nic['mac'] == module.params['ipv4_interface_mac']: if nic['mac'] == module.params['ipv4_interface_mac']:
networks.append({ networks.append({
'id': 'ipv4-%s' % nic['mac'], 'id': 'ipv4-%s' % nic_id,
'link': nic['mac'], 'link': nic_id,
'type': 'ipv4', 'type': 'ipv4',
'ip_address': module.params['ipv4_address'], 'ip_address': module.params['ipv4_address'],
'netmask': module.params['ipv4_subnet_mask'], 'netmask': module.params['ipv4_subnet_mask'],