From 9b2bdf2df637afc8eeadce6dfd8a4367c5a4d9ed Mon Sep 17 00:00:00 2001 From: Gabriele Date: Sat, 25 Mar 2017 05:02:15 -0700 Subject: [PATCH] Fixing module behavior when route_target_both is used (#20076) --- lib/ansible/modules/network/nxos/nxos_evpn_vni.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/ansible/modules/network/nxos/nxos_evpn_vni.py b/lib/ansible/modules/network/nxos/nxos_evpn_vni.py index f94412bda5..19cfcb7cf4 100644 --- a/lib/ansible/modules/network/nxos/nxos_evpn_vni.py +++ b/lib/ansible/modules/network/nxos/nxos_evpn_vni.py @@ -208,12 +208,26 @@ def apply_key_map(key_map, table): return new_dict +def fix_proposed(proposed_commands): + new_proposed = {} + for key, value in proposed_commands.items(): + if key == 'route-target both': + new_proposed['route-target export'] = value + new_proposed['route-target import'] = value + else: + new_proposed[key] = value + return new_proposed + + def state_present(module, existing, proposed): commands = list() parents = list() proposed_commands = apply_key_map(PARAM_TO_COMMAND_KEYMAP, proposed) existing_commands = apply_key_map(PARAM_TO_COMMAND_KEYMAP, existing) + if proposed_commands.get('route-target both'): + proposed_commands = fix_proposed(proposed_commands) + for key, value in proposed_commands.items(): if key.startswith('route-target'): if value == ['default']: