Skip to content

Commit

Permalink
[ignore] Moved Mapping dict to constants.py file and Added APIC defau…
Browse files Browse the repository at this point in the history
…lts to documentations.
  • Loading branch information
gmicol authored and lhercot committed Oct 19, 2023
1 parent b22138b commit ec089bd
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
4 changes: 4 additions & 0 deletions plugins/module_utils/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -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="")
6 changes: 3 additions & 3 deletions plugins/modules/aci_bgp_best_path_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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():
Expand All @@ -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")
Expand Down
10 changes: 7 additions & 3 deletions plugins/modules/aci_bgp_timers_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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():
Expand Down Expand Up @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,4 +152,4 @@
- name: Remove the ansible_tenant - cleanup before ending tests
aci_tenant:
<<: *aci_tenant_present
state: absent
state: absent

0 comments on commit ec089bd

Please sign in to comment.