From ec089bd5c832b517a6c469c74ccaf241d2fc012e Mon Sep 17 00:00:00 2001 From: Gaspard Micol Date: Thu, 12 Oct 2023 13:34:29 -0400 Subject: [PATCH] [ignore] Moved Mapping dict to constants.py file and Added APIC defaults to documentations. --- plugins/module_utils/constants.py | 4 ++++ plugins/modules/aci_bgp_best_path_policy.py | 6 +++--- plugins/modules/aci_bgp_timers_policy.py | 10 +++++++--- .../targets/aci_bgp_timers_policy/tasks/main.yml | 2 +- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/plugins/module_utils/constants.py b/plugins/module_utils/constants.py index 2a6a3e883..aa4c13ae6 100644 --- a/plugins/module_utils/constants.py +++ b/plugins/module_utils/constants.py @@ -88,3 +88,7 @@ MATCH_SMU_OPERATION_MAPPING = dict(smu_install="smuInstall", smu_uninstall="smuUninstall") MATCH_SMU_OPERATION_FLAGS_MAPPING = dict(smu_reload_immediate="smuReloadImmediate", smu_reload_skip="smuReloadSkip") + +MATCH_BEST_PATH_CONTROL_MAPPING = dict(enable="asPathMultipathRelax", disable="") + +MATCH_GRACEFUL_RESTART_CONTROLS_MAPPING = dict(helper="helper", complete="") diff --git a/plugins/modules/aci_bgp_best_path_policy.py b/plugins/modules/aci_bgp_best_path_policy.py index a037ae4c1..a8b5c0a6a 100644 --- a/plugins/modules/aci_bgp_best_path_policy.py +++ b/plugins/modules/aci_bgp_best_path_policy.py @@ -31,6 +31,7 @@ description: - The option to enable/disable to relax AS-Path restriction when choosing multipaths. - When enabled, allow load sharing across providers with different AS paths. + - The APIC defaults to C(enable) when unset during creation. type: str choices: [enable, disable] aliases: [as_path_control] @@ -217,8 +218,7 @@ from ansible.module_utils.basic import AnsibleModule from ansible_collections.cisco.aci.plugins.module_utils.aci import ACIModule, aci_argument_spec, aci_annotation_spec, aci_owner_spec - -BEST_PATH_CONTROL_MAPPING = dict(enable="asPathMultipathRelax", disable="") +from ansible_collections.cisco.aci.plugins.module_utils.constants import MATCH_BEST_PATH_CONTROL_MAPPING def main(): @@ -244,7 +244,7 @@ def main(): ) bgp_best_path_policy = module.params.get("bgp_best_path_policy") - best_path_control = BEST_PATH_CONTROL_MAPPING.get(module.params.get("best_path_control")) + best_path_control = MATCH_BEST_PATH_CONTROL_MAPPING.get(module.params.get("best_path_control")) description = module.params.get("description") state = module.params.get("state") tenant = module.params.get("tenant") diff --git a/plugins/modules/aci_bgp_timers_policy.py b/plugins/modules/aci_bgp_timers_policy.py index 4dbe434a0..c8d6c54b0 100644 --- a/plugins/modules/aci_bgp_timers_policy.py +++ b/plugins/modules/aci_bgp_timers_policy.py @@ -32,23 +32,28 @@ - The property to determine whether the entity functions only as a graceful restart helper or whether graceful restart is enabled completely. - The graceful restart helper option configures the local BGP router to support the graceful restart of a remote BGP peer. - The complete graceful restart option allows BGP graceful restart to be enabled or disable for an individual neighbor. + - The APIC defaults to C(helper) when unset during creation. type: str choices: [ helper, complete ] hold_interval: description: - The time period to wait before declaring the neighbor device down. + - The APIC defaults to C(180) when unset during creation. type: int keepalive_interval: description: - The interval time between sending keepalive messages. + - The APIC defaults to C(60) when unset during creation. type: int max_as_limit: description: - The maximum AS limit, to discard routes that have excessive AS numbers. + - The APIC defaults to C(0) when unset during creation. type: int stale_interval: description: - The maximum time that BGP keeps stale routes from the restarting BGP peer. + - The APIC defaults to C(default) which is equal to 300 sec when unset during creation. type: int description: description: @@ -237,8 +242,7 @@ from ansible.module_utils.basic import AnsibleModule from ansible_collections.cisco.aci.plugins.module_utils.aci import ACIModule, aci_argument_spec, aci_annotation_spec, aci_owner_spec - -GRACEFUL_RESTART_CONTROLS_MAPPING = dict(helper="helper", complete="") +from ansible_collections.cisco.aci.plugins.module_utils.constants import MATCH_GRACEFUL_RESTART_CONTROLS_MAPPING def main(): @@ -268,7 +272,7 @@ def main(): ) bgp_timers_policy = module.params.get("bgp_timers_policy") - graceful_restart_controls = GRACEFUL_RESTART_CONTROLS_MAPPING.get(module.params.get("graceful_restart_controls")) + graceful_restart_controls = MATCH_GRACEFUL_RESTART_CONTROLS_MAPPING.get(module.params.get("graceful_restart_controls")) hold_interval = module.params.get("hold_interval") keepalive_interval = module.params.get("keepalive_interval") max_as_limit = module.params.get("max_as_limit") diff --git a/tests/integration/targets/aci_bgp_timers_policy/tasks/main.yml b/tests/integration/targets/aci_bgp_timers_policy/tasks/main.yml index 6dc04d60f..0c7cdd77d 100644 --- a/tests/integration/targets/aci_bgp_timers_policy/tasks/main.yml +++ b/tests/integration/targets/aci_bgp_timers_policy/tasks/main.yml @@ -152,4 +152,4 @@ - name: Remove the ansible_tenant - cleanup before ending tests aci_tenant: <<: *aci_tenant_present - state: absent \ No newline at end of file + state: absent