mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-23 05:10:22 -07:00
nxos_vxlan_vtep: Add dependency checks (#53288)
* nxos_vxlan_vtep: Add dependency checks Some of the N9k-specific attrs are failing due to hardware/feature/resources. * `global_suppress_arp` - dependency on TCAM resources * `global_mcast_group_L3` - hardware dependency on specific chassis/linecards - feature dependency on `ngmvpn` * `global_ingress_replication_bgp` - hardware dependency on specific chassis/linecards Tested on N9k with/without TCAM resources, various N9k chassis, N7k, N6k. All 100% Pass. * pylint
This commit is contained in:
parent
0f2041abbd
commit
cfe4477c10
2 changed files with 72 additions and 39 deletions
|
@ -114,6 +114,7 @@ import re
|
|||
|
||||
from ansible.module_utils.network.nxos.nxos import get_config, load_config
|
||||
from ansible.module_utils.network.nxos.nxos import nxos_argument_spec, check_args
|
||||
from ansible.module_utils.network.nxos.nxos import run_commands
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.network.common.config import CustomNetworkConfig
|
||||
|
||||
|
@ -275,6 +276,22 @@ def fix_commands(commands, module):
|
|||
return commands
|
||||
|
||||
|
||||
def gsa_tcam_check(module):
|
||||
'''
|
||||
global_suppress_arp is an N9k-only command that requires TCAM resources.
|
||||
This method checks the current TCAM allocation.
|
||||
Note that changing tcam_size requires a switch reboot to take effect.
|
||||
'''
|
||||
cmds = [{'command': 'show hardware access-list tcam region', 'output': 'json'}]
|
||||
body = run_commands(module, cmds)
|
||||
if body:
|
||||
tcam_region = body[0]['TCAM_Region']['TABLE_Sizes']['ROW_Sizes']
|
||||
if bool([i for i in tcam_region if i['type'].startswith('Ingress ARP-Ether ACL') and i['tcam_size'] == '0']):
|
||||
msg = "'show hardware access-list tcam region' indicates 'ARP-Ether' tcam size is 0 (no allocated resources). " +\
|
||||
"'global_suppress_arp' will be rejected by device."
|
||||
module.fail_json(msg=msg)
|
||||
|
||||
|
||||
def state_present(module, existing, proposed, candidate):
|
||||
commands = list()
|
||||
proposed_commands = apply_key_map(PARAM_TO_COMMAND_KEYMAP, proposed)
|
||||
|
@ -371,6 +388,9 @@ def main():
|
|||
proposed[key] = value
|
||||
|
||||
candidate = CustomNetworkConfig(indent=3)
|
||||
|
||||
if proposed.get('global_suppress_arp'):
|
||||
gsa_tcam_check(module)
|
||||
if state == 'present':
|
||||
if not existing:
|
||||
warnings.append("The proposed NVE interface did not exist. "
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue