Repository: ansible/ansible

Issue:
multiple nxos_bgp issues
<!---
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
<!--- Pick one below and delete the rest -->
 - Bug Report

##### COMPONENT NAME
<!---
Name of the module, plugin, task or feature
Do not include extra details here, e.g. "vyos_command" not "the network module vyos_command" or the full path
-->
nxos_bgp
##### ANSIBLE VERSION
<!--- Paste verbatim output from "ansible --version" between quotes below -->
```
ansible 2.5.0 (devel 788010d0f0) last updated 2018/01/08 11:49:21 (GMT -400)
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /root/agents-ci/ansible/lib/ansible
  executable location = /root/agents-ci/ansible/bin/ansible
  python version = 2.7.6 (default, Oct 26 2016, 20:30:19) [GCC 4.8.4]
```

##### 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.
-->
Ansible Server : Ubuntu 14.04
Device: N9K running 7.0(3)I7(1)
##### SUMMARY
<!--- Explain the problem briefly -->

##### 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.
-->
There are multiple issues with nxos_bgp module.
1. Documentation errors where non boolean parameters are shown as boolean (for ex. graceful_restart_timers_stalepath_time)
2. timer_bestpath_limit_always parameter is shown in documentation but there is no code for its support, needs to be removed from docs
3. suppress_fib_pending is global param but it is missing in GLOBAL_PARAMS
4. Lots of paremeters cannot be set to 'default'. They are timer_bestpath_limit, event_history_detail, maxas_limit, router_id, cluster_id, disable_policy_batching_ipv4_prefix_list, disable_policy_batching_ipv6_prefix_list, local_as and confederation_id. The only way as of now is to delete the entire router bgp which is NOT desirable.
5. Confederation_peers is really a list but it is treated as string and this is causing weird issues.
6. There are many parameters which are platform specific and also some of them are version specific. The test cases need to be enhanced to take care of these differences.

Note: I will open a PR shortly to address these above issues. 
<!--- Paste example playbooks or commands between quotes below -->
```yaml

```

<!--- You can also paste gist.github.com links for larger files -->
```



Discussion:

Resolving patch:
diff --git a/lib/ansible/modules/network/nxos/nxos_bgp.py b/lib/ansible/modules/network/nxos/nxos_bgp.py
--- a/lib/ansible/modules/network/nxos/nxos_bgp.py
+++ b/lib/ansible/modules/network/nxos/nxos_bgp.py
@@ -197,13 +197,11 @@
         description:
             - Set maximum time for a restart sent to the BGP peer.
         required: false
-        choices: ['true','false']
         default: null
     graceful_restart_timers_stalepath_time:
         description:
             - Set maximum time that BGP keeps the stale routes from the
               restarting BGP peer.
-        choices: ['true','false']
         default: null
     isolate:
         description:
@@ -265,12 +263,6 @@
               in seconds.
         required: false
         default: null
-    timer_bestpath_limit_always:
-        description:
-            - Enable/Disable update-delay-always option.
-        required: false
-        choices: ['true','false']
-        default: null
     timer_bgp_hold:
         description:
             - Set BGP hold timer.
@@ -349,11 +341,13 @@
     'fast_external_fallover',
     'flush_routes',
     'isolate',
+    'suppress_fib_pending',
     'shutdown'
 ]
 PARAM_TO_DEFAULT_KEYMAP = {
     'timer_bgp_keepalive': '60',
     'timer_bgp_hold': '180',
+    'timer_bestpath_limit': '300',
     'graceful_restart': True,
     'graceful_restart_timers_restart': '120',
     'graceful_restart_timers_stalepath_time': '300',
@@ -362,8 +356,16 @@
     'fast_external_fallover': True,
     'enforce_first_as': True,
     'event_history_cli': True,
+    'event_history_detail': False,
     'event_history_events': True,
     'event_history_periodic': True,
+    'maxas_limit': '',
+    'router_id': '',
+    'cluster_id': '',
+    'disable_policy_batching_ipv4_prefix_list': '',
+    'disable_policy_batching_ipv6_prefix_list': '',
+    'local_as': '',
+    'confederation_id': '',
 }
 PARAM_TO_COMMAND_KEYMAP = {
     'asn': 'router bgp',
@@ -521,11 +523,12 @@ def state_present(module, existing, proposed, candidate):
                 if key == 'confederation peers':
                     existing_value = ' '.join(existing_value)
                 commands.append('no {0} {1}'.format(key, existing_value))
+        elif not value:
+            existing_value = existing_commands.get(key)
+            if existing_value:
+                commands.append('no {0} {1}'.format(key, existing_value))
         elif key == 'confederation peers':
-            existing_confederation_peers = set(existing.get('confederation_peers', []))
-            new_values = set(value.split())
-            peer_string = ' '.join(existing_confederation_peers | new_values)
-            commands.append('{0} {1}'.format(key, peer_string))
+            commands.append('{0} {1}'.format(key, value))
         elif key.startswith('timers bgp'):
             command = 'timers bgp {0} {1}'.format(
                 proposed['timer_bgp_keepalive'],
@@ -580,16 +583,38 @@ def fix_commands(commands):
             confederation_peers_command = command
 
     if local_as_command and confederation_id_command:
-        commands.pop(commands.index(local_as_command))
-        commands.pop(commands.index(confederation_id_command))
-        commands.append(local_as_command)
-        commands.append(confederation_id_command)
-
-    elif confederation_peers_command and confederation_id_command:
-        commands.pop(commands.index(confederation_peers_command))
-        commands.pop(commands.index(confederation_id_command))
-        commands.append(confederation_id_command)
-        commands.append(confederation_peers_command)
+        if 'no' in confederation_id_command:
+            commands.pop(commands.index(local_as_command))
+            commands.pop(commands.index(confederation_id_command))
+            commands.append(confederation_id_command)
+            commands.append(local_as_command)
+        else:
+            commands.pop(commands.index(local_as_command))
+            commands.pop(commands.index(confederation_id_command))
+            commands.append(local_as_command)
+            commands.append(confederation_id_command)
+
+    if confederation_peers_command and confederation_id_command:
+        if local_as_command:
+            if 'no' in local_as_command:
+                commands.pop(commands.index(local_as_command))
+                commands.pop(commands.index(confederation_id_command))
+                commands.pop(commands.index(confederation_peers_command))
+                commands.append(confederation_id_command)
+                commands.append(confederation_peers_command)
+                commands.append(local_as_command)
+            else:
+                commands.pop(commands.index(local_as_command))
+                commands.pop(commands.index(confederation_id_command))
+                commands.pop(commands.index(confederation_peers_command))
+                commands.append(local_as_command)
+                commands.append(confederation_id_command)
+                commands.append(confederation_peers_command)
+        else:
+            commands.pop(commands.index(confederation_peers_command))
+            commands.pop(commands.index(confederation_id_command))
+            commands.append(confederation_id_command)
+            commands.append(confederation_peers_command)
 
     return commands
 
@@ -608,7 +633,7 @@ def main():
         bestpath_med_non_deterministic=dict(required=False, type='bool'),
         cluster_id=dict(required=False, type='str'),
         confederation_id=dict(required=False, type='str'),
-        confederation_peers=dict(required=False, type='str'),
+        confederation_peers=dict(required=False, type='list'),
         disable_policy_batching=dict(required=False, type='bool'),
         disable_policy_batching_ipv4_prefix_list=dict(required=False, type='str'),
         disable_policy_batching_ipv6_prefix_list=dict(required=False, type='str'),
@@ -672,8 +697,18 @@ def main():
         if key not in ['asn', 'vrf']:
             if str(value).lower() == 'default':
                 value = PARAM_TO_DEFAULT_KEYMAP.get(key, 'default')
-            if existing.get(key) != value:
-                proposed[key] = value
+            if key == 'confederation_peers':
+                if value[0] == 'default':
+                    if existing.get(key):
+                        proposed[key] = 'default'
+                else:
+                    v = set([int(i) for i in value])
+                    ex = set([int(i) for i in existing.get(key)])
+                    if v != ex:
+                        proposed[key] = ' '.join(str(s) for s in v)
+            else:
+                if existing.get(key) != value:
+                    proposed[key] = value
 
     candidate = CustomNetworkConfig(indent=3)
     if state == 'present':


Test patch:
diff --git a/test/integration/targets/nxos_bgp/defaults/main.yaml b/test/integration/targets/nxos_bgp/defaults/main.yaml
--- a/test/integration/targets/nxos_bgp/defaults/main.yaml
+++ b/test/integration/targets/nxos_bgp/defaults/main.yaml
@@ -1,2 +1,5 @@
 ---
 testcase: "*"
+vrfs:
+  - default
+  - myvrf
diff --git a/test/integration/targets/nxos_bgp/tests/common/dis_policy.yaml b/test/integration/targets/nxos_bgp/tests/common/dis_policy.yaml
new file mode 100644
--- /dev/null
+++ b/test/integration/targets/nxos_bgp/tests/common/dis_policy.yaml
@@ -0,0 +1,72 @@
+---
+- debug: msg="START connection={{ ansible_connection }} nxos_bgp parameter test"
+- debug: msg="Using provider={{ connection.transport }}"
+  when: ansible_connection == "local"
+
+- name: "Disable feature BGP"
+  nxos_feature:
+    feature: bgp
+    state: disabled
+    provider: "{{ connection }}"
+  ignore_errors: yes
+
+- name: "Enable feature BGP"
+  nxos_feature:
+    feature: bgp
+    state: enabled
+    provider: "{{ connection }}"
+  ignore_errors: yes
+
+- block:
+  # these tasks will fail on N3k A8 code and n7k running helsinki
+  # due to no support
+  - name: "set disable policy"
+    nxos_bgp: &set1
+      asn: 65535
+      disable_policy_batching: true
+      disable_policy_batching_ipv4_prefix_list: v4_p
+      disable_policy_batching_ipv6_prefix_list: v6_p
+      provider: "{{ connection }}"
+    register: result
+
+  - assert: &true
+      that:
+        - "result.changed == true"
+
+  - name: "Check Idempotence"
+    nxos_bgp: *set1
+    register: result
+
+  - assert: &false
+      that:
+        - "result.changed == false"
+
+  - name: "reset disable policy"
+    nxos_bgp: &reset1
+      asn: 65535
+      disable_policy_batching: false
+      disable_policy_batching_ipv4_prefix_list: default
+      disable_policy_batching_ipv6_prefix_list: default
+      provider: "{{ connection }}"
+    register: result
+
+  - assert: *true
+
+  - name: "Check Idempotence"
+    nxos_bgp: *reset1
+    register: result
+
+  - assert: *false
+
+  rescue:
+  - debug: msg="Tests can fail on A8 or helsinki images"
+
+  always:
+  - name: "Disable feature bgp"
+    nxos_feature:
+      feature: bgp
+      state: disabled
+      provider: "{{ connection }}"
+    ignore_errors: yes
+
+  - debug: msg="END connection={{ ansible_connection }} nxos_bgp parameter test"
diff --git a/test/integration/targets/nxos_bgp/tests/common/hels.yaml b/test/integration/targets/nxos_bgp/tests/common/hels.yaml
new file mode 100644
--- /dev/null
+++ b/test/integration/targets/nxos_bgp/tests/common/hels.yaml
@@ -0,0 +1,85 @@
+---
+- debug: msg="START connection={{ ansible_connection }} nxos_bgp parameter test"
+- debug: msg="Using provider={{ connection.transport }}"
+  when: ansible_connection == "local"
+
+- name: "Disable feature BGP"
+  nxos_feature:
+    feature: bgp
+    state: disabled
+    provider: "{{ connection }}"
+  ignore_errors: yes
+
+- name: "Enable feature BGP"
+  nxos_feature:
+    feature: bgp
+    state: enabled
+    provider: "{{ connection }}"
+  ignore_errors: yes
+
+- block:
+  # these tasks will fail on n7k running helsinki
+  # due to no support
+  - name: "set helsinki"
+    nxos_bgp: &set1
+      asn: 65535
+      vrf: "{{ item }}"
+      graceful_restart_timers_restart: 130
+      graceful_restart_timers_stalepath_time: 310
+      neighbor_down_fib_accelerate: true
+      reconnect_interval: 55
+      timer_bgp_hold: 110
+      timer_bgp_keepalive: 45
+      provider: "{{ connection }}"
+    with_items: "{{ vrfs }}"
+    register: result
+
+  - assert: &true
+      that:
+        - "result.changed == true"
+
+  - name: "Check Idempotence"
+    nxos_bgp: *set1
+    with_items: "{{ vrfs }}"
+    register: result
+
+  - assert: &false
+      that:
+        - "result.changed == false"
+
+  - name: "reset helsinki"
+    nxos_bgp: &reset1
+      asn: 65535
+      vrf: "{{ item }}"
+      graceful_restart: true
+      graceful_restart_timers_restart: default
+      graceful_restart_timers_stalepath_time: default
+      neighbor_down_fib_accelerate: false
+      reconnect_interval: default
+      timer_bgp_hold: default
+      timer_bgp_keepalive: default
+      provider: "{{ connection }}"
+    with_items: "{{ vrfs }}"
+    register: result
+
+  - assert: *true
+
+  - name: "Check Idempotence"
+    nxos_bgp: *reset1
+    with_items: "{{ vrfs }}"
+    register: result
+
+  - assert: *false
+
+  rescue:
+  - debug: msg="Tests can fail on helsinki images"
+
+  always:
+  - name: "Disable feature bgp"
+    nxos_feature:
+      feature: bgp
+      state: disabled
+      provider: "{{ connection }}"
+    ignore_errors: yes
+
+  - debug: msg="END connection={{ ansible_connection }} nxos_bgp parameter test"
diff --git a/test/integration/targets/nxos_bgp/tests/common/isolate.yaml b/test/integration/targets/nxos_bgp/tests/common/isolate.yaml
new file mode 100644
--- /dev/null
+++ b/test/integration/targets/nxos_bgp/tests/common/isolate.yaml
@@ -0,0 +1,68 @@
+---
+- debug: msg="START connection={{ ansible_connection }} nxos_bgp parameter test"
+- debug: msg="Using provider={{ connection.transport }}"
+  when: ansible_connection == "local"
+
+- name: "Disable feature BGP"
+  nxos_feature:
+    feature: bgp
+    state: disabled
+    provider: "{{ connection }}"
+  ignore_errors: yes
+
+- name: "Enable feature BGP"
+  nxos_feature:
+    feature: bgp
+    state: enabled
+    provider: "{{ connection }}"
+  ignore_errors: yes
+
+- block:
+  # these tasks will fail on n3k running A8
+  # due to no support
+  - name: "set isolate"
+    nxos_bgp: &set1
+      asn: 65535
+      isolate: false
+      provider: "{{ connection }}"
+    register: result
+
+  - assert: &true
+      that:
+        - "result.changed == true"
+
+  - name: "Check Idempotence"
+    nxos_bgp: *set1
+    register: result
+
+  - assert: &false
+      that:
+        - "result.changed == false"
+
+  - name: "reset isolate"
+    nxos_bgp: &reset1
+      asn: 65535
+      isolate: true
+      provider: "{{ connection }}"
+    register: result
+
+  - assert: *true
+
+  - name: "Check Idempotence"
+    nxos_bgp: *reset1
+    register: result
+
+  - assert: *false
+
+  rescue:
+  - debug: msg="Tests can fail on A8 images"
+
+  always:
+  - name: "Disable feature bgp"
+    nxos_feature:
+      feature: bgp
+      state: disabled
+      provider: "{{ connection }}"
+    ignore_errors: yes
+
+  - debug: msg="END connection={{ ansible_connection }} nxos_bgp parameter test"
diff --git a/test/integration/targets/nxos_bgp/tests/common/param.yaml b/test/integration/targets/nxos_bgp/tests/common/param.yaml
new file mode 100644
--- /dev/null
+++ b/test/integration/targets/nxos_bgp/tests/common/param.yaml
@@ -0,0 +1,276 @@
+---
+- debug: msg="START connection={{ ansible_connection }} nxos_bgp parameter test"
+- debug: msg="Using provider={{ connection.transport }}"
+  when: ansible_connection == "local"
+
+- name: "Disable feature BGP"
+  nxos_feature:
+    feature: bgp
+    state: disabled
+    provider: "{{ connection }}"
+  ignore_errors: yes
+
+- name: "Enable feature BGP"
+  nxos_feature:
+    feature: bgp
+    state: enabled
+    provider: "{{ connection }}"
+  ignore_errors: yes
+
+- block:
+  - name: "set multi vrf params"
+    nxos_bgp: &set_multi_vrf
+      asn: 65535
+      vrf: "{{ item }}"
+      router_id: 1.1.1.1
+      bestpath_always_compare_med: true
+      bestpath_aspath_multipath_relax: true
+      bestpath_compare_routerid: true
+      bestpath_cost_community_ignore: true
+      bestpath_med_confed: true
+      bestpath_med_missing_as_worst: true
+      bestpath_med_non_deterministic: true
+# grace_restart is failing with error code -32603 only on CLI transport, nxapi ok 
+#      graceful_restart: false
+      graceful_restart_helper: true
+      log_neighbor_changes: true
+      maxas_limit: 50
+      provider: "{{ connection }}"
+    with_items: "{{ vrfs }}"
+    register: result
+
+  - assert: &true
+      that:
+        - "result.changed == true"
+
+  - name: "Check Idempotence"
+    nxos_bgp: *set_multi_vrf
+    with_items: "{{ vrfs }}"
+    register: result
+
+  - assert: &false
+      that:
+        - "result.changed == false"
+
+  - name: "reset multi vrf params"
+    nxos_bgp: &reset_multi_vrf
+      asn: 65535
+      vrf: "{{ item }}"
+      bestpath_always_compare_med: false
+      bestpath_aspath_multipath_relax: false
+      bestpath_compare_routerid: false
+      bestpath_cost_community_ignore: false
+      bestpath_med_confed: false
+      bestpath_med_missing_as_worst: false
+      bestpath_med_non_deterministic: false
+      graceful_restart_helper: false
+      log_neighbor_changes: false
+      maxas_limit: default
+      router_id: default
+      provider: "{{ connection }}"
+    with_items: "{{ vrfs }}"
+    register: result
+
+  - assert: *true
+
+  - name: "Check Idempotence"
+    nxos_bgp: *reset_multi_vrf
+    with_items: "{{ vrfs }}"
+    register: result
+
+  - assert: *false
+
+  - name: "set clusterid"
+    nxos_bgp: &set_cluster_id
+      asn: 65535
+      vrf: "{{ item }}"
+      cluster_id: 10.0.0.1
+      provider: "{{ connection }}"
+    with_items: "{{ vrfs }}"
+    register: result
+
+  - assert: *true
+
+  - name: "Check Idempotence"
+    nxos_bgp: *set_cluster_id
+    with_items: "{{ vrfs }}"
+    register: result
+
+  - assert: *false
+
+  - name: "reset cluster_id"
+    nxos_bgp: &reset_cluster_id
+      asn: 65535
+      vrf: "{{ item }}"
+      cluster_id: default
+      provider: "{{ connection }}"
+    with_items: "{{ vrfs }}"
+    register: result
+
+  - assert: *true
+
+  - name: "Check Idempotence"
+    nxos_bgp: *reset_cluster_id
+    with_items: "{{ vrfs }}"
+    register: result
+
+  - assert: *false
+
+  - name: "set confederation"
+    nxos_bgp: &set_confederation
+      asn: 65535
+      confederation_id: 99
+      confederation_peers:
+        - 16
+        - 22
+        - 18
+      provider: "{{ connection }}"
+    register: result
+
+  - assert: *true
+
+  - name: "Check Idempotence"
+    nxos_bgp: *set_confederation
+    register: result
+
+  - assert: *false
+
+  - name: "reset confederation"
+    nxos_bgp: &reset_confederation
+      asn: 65535
+      confederation_id: default
+      confederation_peers: default
+      provider: "{{ connection }}"
+    register: result
+
+  - assert: *true
+
+  - name: "Check Idempotence"
+    nxos_bgp: *reset_confederation
+    register: result
+
+  - assert: *false
+
+  - name: "set confederation_local_as"
+    nxos_bgp: &set_confederation_la
+      asn: 65535
+      vrf: myvrf
+      local_as: 33
+      confederation_id: 99
+      confederation_peers:
+        - 16
+        - 22
+        - 18
+      provider: "{{ connection }}"
+    register: result
+
+  - assert: *true
+
+  - name: "Check Idempotence"
+    nxos_bgp: *set_confederation_la
+    register: result
+
+  - assert: *false
+
+  - name: "reset confederation local_as"
+    nxos_bgp: &reset_confederation_la
+      asn: 65535
+      vrf: myvrf
+      local_as: default
+      confederation_id: default
+      confederation_peers: default
+      provider: "{{ connection }}"
+    register: result
+
+  - assert: *true
+
+  - name: "Check Idempotence"
+    nxos_bgp: *reset_confederation_la
+    register: result
+
+  - assert: *false
+
+  - name: "set local_as"
+    nxos_bgp: &set_local_as
+      asn: 65535
+      vrf: myvrf
+      local_as: 33
+      confederation_id: 99
+      provider: "{{ connection }}"
+    register: result
+
+  - assert: *true
+
+  - name: "Check Idempotence"
+    nxos_bgp: *set_local_as
+    register: result
+
+  - assert: *false
+
+  - name: "reset local_as"
+    nxos_bgp: &reset_local_as
+      asn: 65535
+      vrf: myvrf
+      confederation_id: default
+      local_as: default
+      provider: "{{ connection }}"
+    register: result
+
+  - assert: *true
+
+  - name: "Check Idempotence"
+    nxos_bgp: *reset_local_as
+    register: result
+
+  - assert: *false
+
+  - name: "set default vrf params"
+    nxos_bgp: &set_def_vrf
+      asn: 65535
+      event_history_cli: size_medium
+      event_history_detail: size_large
+      event_history_events: size_medium
+      event_history_periodic: size_small
+      enforce_first_as: false
+      fast_external_fallover: false
+      flush_routes: true
+      shutdown: true
+      provider: "{{ connection }}"
+    register: result
+
+  - assert: *true
+
+  - name: "Check Idempotence"
+    nxos_bgp: *set_def_vrf
+    register: result
+
+  - assert: *false
+
+  - name: "reset default vrf params"
+    nxos_bgp: &reset_def_vrf
+      asn: 65535
+      event_history_detail: default
+      enforce_first_as: true
+      fast_external_fallover: true
+      flush_routes: false
+      shutdown: false
+      provider: "{{ connection }}"
+    register: result
+
+  - assert: *true
+
+  - name: "Check Idempotence"
+    nxos_bgp: *reset_def_vrf
+    register: result
+
+  - assert: *false
+
+  always:
+  - name: "Disable feature bgp"
+    nxos_feature:
+      feature: bgp
+      state: disabled
+      provider: "{{ connection }}"
+    ignore_errors: yes
+
+  - debug: msg="END connection={{ ansible_connection }} nxos_bgp parameter test"
diff --git a/test/integration/targets/nxos_bgp/tests/common/supp_fib.yaml b/test/integration/targets/nxos_bgp/tests/common/supp_fib.yaml
new file mode 100644
--- /dev/null
+++ b/test/integration/targets/nxos_bgp/tests/common/supp_fib.yaml
@@ -0,0 +1,106 @@
+---
+- debug: msg="START connection={{ ansible_connection }} nxos_bgp parameter test"
+- debug: msg="Using provider={{ connection.transport }}"
+  when: ansible_connection == "local"
+
+- name: "Disable feature BGP"
+  nxos_feature:
+    feature: bgp
+    state: disabled
+    provider: "{{ connection }}"
+  ignore_errors: yes
+
+- name: "Enable feature BGP"
+  nxos_feature:
+    feature: bgp
+    state: enabled
+    provider: "{{ connection }}"
+  ignore_errors: yes
+
+- block:
+  # this task will fail on n9k running I2
+  # due to no support
+  - name: "set bestpath limit"
+    nxos_bgp: &set1
+      asn: 65535
+      vrf: "{{ item }}"
+      timer_bestpath_limit: 255
+      provider: "{{ connection }}"
+    with_items: "{{ vrfs }}"
+    register: result
+
+  - assert: &true
+      that:
+        - "result.changed == true"
+
+  - name: "Check Idempotence"
+    nxos_bgp: *set1
+    with_items: "{{ vrfs }}"
+    register: result
+
+  - assert: &false
+      that:
+        - "result.changed == false"
+
+  - name: "reset bestpath limit"
+    nxos_bgp: &reset1
+      asn: 65535
+      vrf: "{{ item }}"
+      timer_bestpath_limit: default
+      provider: "{{ connection }}"
+    with_items: "{{ vrfs }}"
+    register: result
+
+  - assert: *true
+
+  - name: "Check Idempotence"
+    nxos_bgp: *reset1
+    with_items: "{{ vrfs }}"
+    register: result
+
+  - assert: *false
+
+  # this task will fail on n9k running I2 or I4
+  # due to no support
+  - name: "set suppress fib"
+    nxos_bgp: &set2
+      asn: 65535
+      suppress_fib_pending: false
+      provider: "{{ connection }}"
+    register: result
+
+  - assert: *true
+
+  - name: "Check Idempotence"
+    nxos_bgp: *set2
+    register: result
+
+  - assert: *false
+
+  - name: "reset suppress fib"
+    nxos_bgp: &reset2
+      asn: 65535
+      suppress_fib_pending: true
+      provider: "{{ connection }}"
+    register: result
+
+  - assert: *true
+
+  - name: "Check Idempotence"
+    nxos_bgp: *reset2
+    register: result
+
+  - assert: *false
+
+  rescue:
+  - debug: msg="Tests can fail on I2/I4/A8/Fretta or helsinki images"
+
+  always:
+  - name: "Disable feature bgp"
+    nxos_feature:
+      feature: bgp
+      state: disabled
+      provider: "{{ connection }}"
+    ignore_errors: yes
+
+  - debug: msg="END connection={{ ansible_connection }} nxos_bgp parameter test"