Repository: ansible/ansible

Issue:
aci_bd: Need an option to specify a BD MAC address when dealing with BDs
<!---
Verify first that your issue/request is not already reported on GitHub.
Also test if the latest release, and master branch are affected too.
-->

##### ISSUE TYPE
 - Feature Idea

##### COMPONENT NAME
aci_bd

##### ANSIBLE VERSION
<!--- Paste verbatim output from "ansible --version" between quotes below -->
```
ansible 2.4.2.0
```

##### CONFIGURATION
<!---
If using Ansible 2.4 or above, paste the results of "ansible-config dump --only-changed"
Otherwise, mention any settings you have changed/added/removed in ansible.cfg
(or using the ANSIBLE_* environment variables).
-->

##### OS / ENVIRONMENT
<!---
Mention the OS you are running Ansible from, and the OS you are
managing, or say "N/A" for anything that is not platform-specific.
Also mention the specific version of what you are trying to control,
e.g. if this is a network bug the version of firmware on the network device.
-->

##### SUMMARY
<!--- Explain the problem briefly -->
failed: [apic -> localhost] (item=BD2) => {
    "changed": false,
    "invocation": {
        "module_args": {
            "arp_flooding": true,
            "bd": "BD2",
            "l2_unknown_unicast": "flood",
            "mac": "00:22:BD:F8:19:FD",
...
        }
    },
    "item": "BD2",
    "msg": "Unsupported parameters for (aci_bd) module: mac Supported parameters include: arp_flooding,bd,bd_type,description,enable_multicast,enable_routing,endpoint_clear,endpoint_move_detect,endpoint_retention_action,endpoint_retention_policy,gateway_ip,hostname,igmp_snoop_policy,ip_learning,ipv6_nd_policy,l2_unknown_unicast,l3_unknown_multicast,limit_ip_learn,method,multi_dest,password,protocol,scope,state,subnet_mask,tenant,timeout,use_proxy,use_ssl,username,validate_certs,vrf"
}
##### STEPS TO REPRODUCE
<!---
For bugs, show exactly how to reproduce the problem, using a minimal test-case.
For new features, show how the feature would be used.
-->

<!--- Paste example playbooks or commands between quotes below -->
```yaml

```

<!--- You can also paste gist.github.com links for larger files -->

##### EXPECTED RESULTS
<!--- What did you expect to happen when running the steps above? -->

##### ACTUAL RESULTS
<!--- What actually happened? If possible run with extra verbosity (-vvvv) -->

<!--- Paste verbatim command output between quotes below -->
```

```



Discussion:
Files identified in the description:
* [lib/ansible/modules/network/aci/aci_bd.py](https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/network/aci/aci_bd.py)

If these files are inaccurate, please update the `component name` section of the description or use the `!component` bot command.

[click here for bot help](https://github.com/ansible/ansibullbot/blob/master/ISSUE_HELP.md)
<!--- boilerplate: components_banner --->
cc @brunocalogero @dagwieers @jmcgill298 @schunduri
[click here for bot help](https://github.com/ansible/ansibullbot/blob/master/ISSUE_HELP.md)
<!--- boilerplate: notify --->
cc @jmcgill298

Resolving patch:
diff --git a/lib/ansible/modules/network/aci/aci_bd.py b/lib/ansible/modules/network/aci/aci_bd.py
--- a/lib/ansible/modules/network/aci/aci_bd.py
+++ b/lib/ansible/modules/network/aci/aci_bd.py
@@ -29,7 +29,7 @@
     description:
     - Determines if the Bridge Domain should flood ARP traffic.
     - The APIC defaults new Bridge Domains to C(no).
-    choices: [ no, yes ]
+    type: bool
     default: no
   bd:
     description:
@@ -48,20 +48,20 @@
     description:
     - Determines if PIM is enabled
     - The APIC defaults new Bridge Domains to C(no).
-    choices: [ no, yes ]
+    type: bool
     default: no
   enable_routing:
     description:
     - Determines if IP forwarding should be allowed.
     - The APIC defaults new Bridge Domains to C(yes).
-    choices: [ no, yes ]
+    type: bool
     default: yes
   endpoint_clear:
     description:
     - Clears all End Points in all Leaves when C(yes).
     - The APIC defaults new Bridge Domains to C(no).
     - The value is not reset to disabled once End Points have been cleared; that requires a second task.
-    choices: [ no, yes ]
+    type: bool
     default: no
   endpoint_move_detect:
     description:
@@ -87,7 +87,7 @@
     description:
     - Determines if the Bridge Domain should learn End Point IPs.
     - The APIC defaults new Bridge Domains to C(yes).
-    choices: [ no, yes ]
+    type: bool
   ipv6_nd_policy:
     description:
     - The name of the IPv6 Neighbor Discovery Policy the Bridge Domain should use when
@@ -108,8 +108,14 @@
     description:
     - Determines if the BD should limit IP learning to only subnets owned by the Bridge Domain.
     - The APIC defaults new Bridge Domains to C(yes).
-    choices: [ no, yes ]
+    type: bool
     default: yes
+  mac_address:
+    description:
+    - The MAC Address to assign to the C(bd) instead of using the default.
+    choices: [ mac ]
+    default: 00:22:BD:F8:19:FF
+    version_added: '2.5'
   multi_dest:
     description:
     - Determines the forwarding method for L2 multicast, broadcast, and link layer traffic.
@@ -142,6 +148,7 @@
     state: present
     tenant: prod
     bd: web_servers
+    mac_address: 00:22:BD:F8:19:FE
     vrf: prod_vrf
 
 - name: Add an FC Bridge Domain
@@ -223,6 +230,7 @@ def main():
         l2_unknown_unicast=dict(choices=['proxy', 'flood']),
         l3_unknown_multicast=dict(choices=['flood', 'opt-flood']),
         limit_ip_learn=dict(type='str', choices=['no', 'yes']),
+        mac_address=dict(type='str', aliases=['mac']),
         multi_dest=dict(choices=['bd-flood', 'drop', 'encap-flood']),
         state=dict(choices=['absent', 'present', 'query'], type='str', default='present'),
         tenant=dict(type='str', aliases=['tenant_name']),
@@ -264,6 +272,7 @@ def main():
     l2_unknown_unicast = module.params['l2_unknown_unicast']
     l3_unknown_multicast = module.params['l3_unknown_multicast']
     limit_ip_learn = module.params['limit_ip_learn']
+    mac_address = module.params['mac_address']
     multi_dest = module.params['multi_dest']
     state = module.params['state']
     tenant = module.params['tenant']
@@ -304,6 +313,7 @@ def main():
                 epMoveDetectMode=endpoint_move_detect,
                 ipLearning=ip_learning,
                 limitIpLearnToSubnets=limit_ip_learn,
+                mac=mac_address,
                 mcastAllow=enable_multicast,
                 multiDstPktAct=multi_dest,
                 name=bd,


Test patch: