mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 12:50:22 -07:00
fix nxos_bgp_af issues (#36147)
* fix nxos_bgp_af issues * shippable fix * review comments * shippable error fix
This commit is contained in:
parent
53a314f767
commit
75a34f6668
4 changed files with 280 additions and 78 deletions
|
@ -1,2 +1,5 @@
|
|||
---
|
||||
testcase: "*"
|
||||
vrfs:
|
||||
- default
|
||||
- myvrf
|
||||
|
|
|
@ -35,10 +35,10 @@
|
|||
provider: "{{ connection }}"
|
||||
when: platform is search('N9K')
|
||||
|
||||
- name: "Configure BGP_AF defaults"
|
||||
nxos_bgp_af: &configure_default
|
||||
- name: "Configure BGP_AF 1"
|
||||
nxos_bgp_af: &configure1
|
||||
asn: 65535
|
||||
vrf: TESTING
|
||||
vrf: testing
|
||||
afi: ipv4
|
||||
safi: unicast
|
||||
advertise_l2vpn_evpn: "{{advertise_l2vpn_evpn|default(omit)}}"
|
||||
|
@ -51,7 +51,7 @@
|
|||
- "result.changed == true"
|
||||
|
||||
- name: "Check Idempotence"
|
||||
nxos_bgp_af: *configure_default
|
||||
nxos_bgp_af: *configure1
|
||||
register: result
|
||||
|
||||
- assert: &false
|
||||
|
@ -59,35 +59,91 @@
|
|||
- "result.changed == false"
|
||||
|
||||
- name: "Remove BGP"
|
||||
nxos_bgp: *remove
|
||||
nxos_bgp_af: &remove_af
|
||||
asn: 65535
|
||||
vrf: testing
|
||||
afi: ipv4
|
||||
safi: unicast
|
||||
state: absent
|
||||
provider: "{{ connection }}"
|
||||
register: result
|
||||
|
||||
- assert: *true
|
||||
|
||||
- name: "Configure BGP_AF 2"
|
||||
nxos_bgp_af: &configure2
|
||||
asn: 65535
|
||||
vrf: "{{ item }}"
|
||||
afi: ipv4
|
||||
safi: unicast
|
||||
dampening_state: True
|
||||
additional_paths_install: true
|
||||
additional_paths_receive: true
|
||||
additional_paths_selection: RouteMap
|
||||
additional_paths_send: true
|
||||
client_to_client: False
|
||||
default_information_originate: true
|
||||
state: present
|
||||
provider: "{{ connection }}"
|
||||
with_items: "{{ vrfs }}"
|
||||
register: result
|
||||
|
||||
- assert: *true
|
||||
|
||||
- name: "Check Idempotence"
|
||||
nxos_bgp: *remove
|
||||
nxos_bgp_af: *configure2
|
||||
with_items: "{{ vrfs }}"
|
||||
register: result
|
||||
|
||||
- assert: *false
|
||||
|
||||
- name: "Configure BGP_AF non defaults"
|
||||
nxos_bgp_af: &configure_non_default
|
||||
- name: "Configure BGP_AF def2"
|
||||
nxos_bgp_af: &configuredef2
|
||||
asn: 65535
|
||||
vrf: TESTING
|
||||
vrf: "{{ item }}"
|
||||
afi: ipv4
|
||||
safi: unicast
|
||||
additional_paths_install: true
|
||||
additional_paths_receive: true
|
||||
additional_paths_selection: RouteMap
|
||||
additional_paths_send: true
|
||||
advertise_l2vpn_evpn: "{{advertise_l2vpn_evpn|default(omit)}}"
|
||||
client_to_client: false
|
||||
dampen_igp_metric: 200
|
||||
dampening_half_time: 1
|
||||
dampening_max_suppress_time: 4
|
||||
dampening_reuse_time: 2
|
||||
dampening_suppress_time: 3
|
||||
default_information_originate: true
|
||||
dampening_state: False
|
||||
additional_paths_install: False
|
||||
additional_paths_receive: False
|
||||
additional_paths_selection: default
|
||||
additional_paths_send: False
|
||||
client_to_client: True
|
||||
default_information_originate: False
|
||||
state: present
|
||||
provider: "{{ connection }}"
|
||||
with_items: "{{ vrfs }}"
|
||||
register: result
|
||||
|
||||
- assert: *true
|
||||
|
||||
- name: "Check Idempotence"
|
||||
nxos_bgp_af: *configuredef2
|
||||
with_items: "{{ vrfs }}"
|
||||
register: result
|
||||
|
||||
- assert: *false
|
||||
|
||||
- name: "Remove BGP"
|
||||
nxos_bgp_af: &remove_af_vrf
|
||||
asn: 65535
|
||||
vrf: "{{ item }}"
|
||||
afi: ipv4
|
||||
safi: unicast
|
||||
state: absent
|
||||
provider: "{{ connection }}"
|
||||
with_items: "{{ vrfs }}"
|
||||
register: result
|
||||
|
||||
- assert: *true
|
||||
|
||||
- name: "Configure BGP_AF 3"
|
||||
nxos_bgp_af: &configure3
|
||||
asn: 65535
|
||||
vrf: "{{ item }}"
|
||||
afi: ipv4
|
||||
safi: unicast
|
||||
dampening_routemap: 'abcd'
|
||||
default_metric: 50
|
||||
distance_ebgp: 30
|
||||
distance_ibgp: 60
|
||||
|
@ -100,24 +156,150 @@
|
|||
table_map_filter: true
|
||||
state: present
|
||||
provider: "{{ connection }}"
|
||||
with_items: "{{ vrfs }}"
|
||||
register: result
|
||||
|
||||
- assert: *true
|
||||
|
||||
- name: "Check Idempotence"
|
||||
nxos_bgp_af: *configure_non_default
|
||||
nxos_bgp_af: *configure3
|
||||
with_items: "{{ vrfs }}"
|
||||
register: result
|
||||
|
||||
- assert: *false
|
||||
|
||||
- name: "Configure BGP_AF def3"
|
||||
nxos_bgp_af: &configuredef3
|
||||
asn: 65535
|
||||
vrf: "{{ item }}"
|
||||
afi: ipv4
|
||||
safi: unicast
|
||||
dampening_routemap: default
|
||||
default_metric: default
|
||||
distance_ebgp: default
|
||||
distance_ibgp: default
|
||||
distance_local: default
|
||||
maximum_paths: default
|
||||
maximum_paths_ibgp: default
|
||||
next_hop_route_map: default
|
||||
suppress_inactive: False
|
||||
table_map: default
|
||||
table_map_filter: False
|
||||
state: present
|
||||
provider: "{{ connection }}"
|
||||
with_items: "{{ vrfs }}"
|
||||
register: result
|
||||
|
||||
- assert: *true
|
||||
|
||||
- name: "Check Idempotence"
|
||||
nxos_bgp_af: *configuredef3
|
||||
with_items: "{{ vrfs }}"
|
||||
register: result
|
||||
|
||||
- assert: *false
|
||||
|
||||
- name: "Remove BGP"
|
||||
nxos_bgp: *remove
|
||||
nxos_bgp_af: *remove_af_vrf
|
||||
with_items: "{{ vrfs }}"
|
||||
register: result
|
||||
|
||||
- assert: *true
|
||||
|
||||
- name: "Configure BGP_AF 4"
|
||||
nxos_bgp_af: &configure4
|
||||
asn: 65535
|
||||
vrf: "{{ item }}"
|
||||
afi: ipv4
|
||||
safi: unicast
|
||||
dampen_igp_metric: 200
|
||||
dampening_half_time: 1
|
||||
dampening_max_suppress_time: 4
|
||||
dampening_reuse_time: 2
|
||||
dampening_suppress_time: 3
|
||||
inject_map: [['lax_inject_map', 'lax_exist_map'], ['nyc_inject_map', 'nyc_exist_map', 'copy-attributes'], ['fsd_inject_map', 'fsd_exist_map']]
|
||||
networks: [['10.0.0.0/16', 'routemap_LA'], ['192.168.1.1/32', 'Chicago'], ['192.168.2.0/24'], ['192.168.3.0/24', 'routemap_NYC']]
|
||||
redistribute: [['direct', 'rm_direct'], ['lisp', 'rm_lisp']]
|
||||
state: present
|
||||
provider: "{{ connection }}"
|
||||
with_items: "{{ vrfs }}"
|
||||
register: result
|
||||
|
||||
- assert: *true
|
||||
|
||||
- name: "Check Idempotence"
|
||||
nxos_bgp: *remove
|
||||
nxos_bgp_af: *configure4
|
||||
with_items: "{{ vrfs }}"
|
||||
register: result
|
||||
|
||||
- assert: *false
|
||||
|
||||
- name: "Configure BGP_AF 5"
|
||||
nxos_bgp_af: &configure5
|
||||
asn: 65535
|
||||
vrf: "{{ item }}"
|
||||
afi: ipv4
|
||||
safi: unicast
|
||||
dampen_igp_metric: 300
|
||||
dampening_half_time: 10
|
||||
dampening_max_suppress_time: 40
|
||||
dampening_reuse_time: 20
|
||||
dampening_suppress_time: 30
|
||||
inject_map: [['fsd_inject_map', 'fsd_exist_map']]
|
||||
networks: [['192.168.2.0/24']]
|
||||
redistribute: [['lisp', 'rm_lisp']]
|
||||
state: present
|
||||
provider: "{{ connection }}"
|
||||
with_items: "{{ vrfs }}"
|
||||
register: result
|
||||
|
||||
- assert: *true
|
||||
|
||||
- name: "Check Idempotence"
|
||||
nxos_bgp_af: *configure5
|
||||
with_items: "{{ vrfs }}"
|
||||
register: result
|
||||
|
||||
- assert: *false
|
||||
|
||||
- name: "Configure BGP_AF def5"
|
||||
nxos_bgp_af: &configuredef5
|
||||
asn: 65535
|
||||
vrf: "{{ item }}"
|
||||
afi: ipv4
|
||||
safi: unicast
|
||||
dampen_igp_metric: default
|
||||
dampening_half_time: default
|
||||
dampening_max_suppress_time: default
|
||||
dampening_reuse_time: default
|
||||
dampening_suppress_time: default
|
||||
inject_map: default
|
||||
networks: default
|
||||
redistribute: default
|
||||
state: present
|
||||
provider: "{{ connection }}"
|
||||
with_items: "{{ vrfs }}"
|
||||
register: result
|
||||
|
||||
- assert: *true
|
||||
|
||||
- name: "Check Idempotence"
|
||||
nxos_bgp_af: *configuredef5
|
||||
with_items: "{{ vrfs }}"
|
||||
register: result
|
||||
|
||||
- assert: *false
|
||||
|
||||
- name: "Remove BGP"
|
||||
nxos_bgp_af: *remove_af_vrf
|
||||
with_items: "{{ vrfs }}"
|
||||
register: result
|
||||
|
||||
- assert: *true
|
||||
|
||||
- name: "Check Idempotence"
|
||||
nxos_bgp_af: *remove_af_vrf
|
||||
with_items: "{{ vrfs }}"
|
||||
register: result
|
||||
|
||||
- assert: *false
|
||||
|
@ -141,6 +323,12 @@
|
|||
provider: "{{ connection }}"
|
||||
ignore_errors: yes
|
||||
|
||||
# Some platforms will timeout if the
|
||||
# 'no nv overlay evpn' command is sent
|
||||
# too quickly following bgp disablement.
|
||||
- pause:
|
||||
seconds: 5
|
||||
|
||||
- name: "Remove nv overlay evpn"
|
||||
nxos_config:
|
||||
lines:
|
||||
|
|
|
@ -89,7 +89,7 @@ class TestNxosBgpAfModule(TestNxosModule):
|
|||
dampening_half_time=5, dampening_suppress_time=2000,
|
||||
dampening_reuse_time=1900, dampening_max_suppress_time=10))
|
||||
result = self.execute_module(failed=True)
|
||||
self.assertEqual(result['msg'], 'dampening_routemap cannot be used with the dampening_half_time param')
|
||||
self.assertEqual(result['msg'], 'parameters are mutually exclusive: dampening_routemap, dampening_half_time')
|
||||
|
||||
def test_nxos_bgp_af_client(self):
|
||||
set_module_args(dict(asn=65535, afi='ipv4', safi='unicast',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue