mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 21:32:49 +00:00
nxos_interface_ospf: Add bfd support (#56807)
* nxos_interface_ospf: Add bfd support Add support for `bfd` state in `nxos_interface_ospf` - Feature Pull Request `nxos_interface_ospf` * Fix pep issues * sanity loop: syntax * bfd states changed from T/F to enable/disable/default * doc hdr fixes
This commit is contained in:
committed by
Trishna Guha
parent
b9a0086aac
commit
bd844bc11c
@@ -5,19 +5,20 @@
|
||||
|
||||
- set_fact: testint="{{ nxos_int1 }}"
|
||||
|
||||
- name: "Setup - Disable feature OSPF"
|
||||
nxos_feature: &disable
|
||||
feature: ospf
|
||||
- name: Setup - Disable features
|
||||
nxos_feature:
|
||||
feature: "{{ item }}"
|
||||
provider: "{{ connection }}"
|
||||
state: disabled
|
||||
loop: ['ospf', 'bfd']
|
||||
ignore_errors: yes
|
||||
|
||||
- name: "Setup - Enable feature OSPF"
|
||||
nxos_feature: &enable
|
||||
feature: ospf
|
||||
- name: Setup - Enable features
|
||||
nxos_feature:
|
||||
feature: "{{ item }}"
|
||||
provider: "{{ connection }}"
|
||||
state: enabled
|
||||
ignore_errors: yes
|
||||
loop: ['ospf', 'bfd']
|
||||
|
||||
- name: "Put interface into default state"
|
||||
nxos_config: &intdefault
|
||||
@@ -51,6 +52,7 @@
|
||||
interface: "{{ nxos_int1|upper }}"
|
||||
ospf: 1
|
||||
area: 12345678
|
||||
bfd: enable
|
||||
cost: 55
|
||||
passive_interface: true
|
||||
hello_interval: 15
|
||||
@@ -99,6 +101,7 @@
|
||||
interface: "{{ testint }}"
|
||||
ospf: 1
|
||||
area: 12345678
|
||||
bfd: default
|
||||
cost: default
|
||||
hello_interval: 10
|
||||
dead_interval: default
|
||||
@@ -266,6 +269,7 @@
|
||||
interface: "{{ testint }}"
|
||||
ospf: 1
|
||||
area: 12345678
|
||||
bfd: disable
|
||||
cost: 55
|
||||
passive_interface: true
|
||||
hello_interval: 15
|
||||
@@ -282,22 +286,21 @@
|
||||
|
||||
- assert: *false
|
||||
|
||||
- name: "Disable feature OSPF"
|
||||
nxos_feature: *disable
|
||||
always:
|
||||
- name: Disable features
|
||||
nxos_feature:
|
||||
feature: "{{ item }}"
|
||||
provider: "{{ connection }}"
|
||||
state: disabled
|
||||
loop: ['ospf', 'bfd']
|
||||
ignore_errors: yes
|
||||
|
||||
- name: "Interface cleanup"
|
||||
nxos_config: *intdefault
|
||||
|
||||
rescue:
|
||||
- name: "Disable feature OSPF"
|
||||
nxos_feature: *disable
|
||||
|
||||
- name: "Interface cleanup"
|
||||
nxos_config: *intdefault
|
||||
ignore_errors: yes
|
||||
|
||||
- name: "Remove port-channel and loopback ints"
|
||||
nxos_config: *removepcandlb
|
||||
ignore_errors: yes
|
||||
|
||||
always:
|
||||
- debug: msg="END connection={{ ansible_connection }} nxos_interface_ospf sanity test"
|
||||
|
||||
@@ -1,7 +1,17 @@
|
||||
interface Ethernet1/33
|
||||
interface Ethernet1/33.101
|
||||
ip router ospf 1 area 0.0.0.1
|
||||
interface Ethernet1/34
|
||||
ip router ospf 1 area 0.0.0.1
|
||||
ip ospf passive-interface
|
||||
interface Ethernet1/35
|
||||
ip router ospf 1 area 0.0.0.1
|
||||
no ip ospf passive-interface
|
||||
|
||||
interface Ethernet1/36
|
||||
ip router ospf 1 area 0.0.0.1
|
||||
ip ospf bfd
|
||||
|
||||
interface Ethernet1/37
|
||||
ip router ospf 1 area 0.0.0.1
|
||||
ip ospf bfd disable
|
||||
|
||||
@@ -51,6 +51,59 @@ class TestNxosInterfaceOspfModule(TestNxosModule):
|
||||
set_module_args(dict(interface='ethernet1/32', ospf=1, area=1))
|
||||
self.execute_module(changed=True, commands=['interface Ethernet1/32', 'ip router ospf 1 area 0.0.0.1'])
|
||||
|
||||
def test_bfd_1(self):
|
||||
# default -> enable
|
||||
set_module_args(dict(interface='ethernet1/33', ospf=1, area=1, bfd='enable'))
|
||||
self.execute_module(changed=True, commands=['interface Ethernet1/33', 'ip router ospf 1 area 0.0.0.1', 'ip ospf bfd'])
|
||||
|
||||
# default -> disable
|
||||
set_module_args(dict(interface='ethernet1/33', ospf=1, area=1, bfd='disable'))
|
||||
self.execute_module(changed=True, commands=['interface Ethernet1/33', 'ip router ospf 1 area 0.0.0.1', 'ip ospf bfd disable'])
|
||||
|
||||
def test_bfd_2(self):
|
||||
# default -> default
|
||||
set_module_args(dict(interface='ethernet1/33.101', ospf=1, area=1, bfd='default'))
|
||||
self.execute_module(changed=False)
|
||||
|
||||
# enable -> default
|
||||
set_module_args(dict(interface='ethernet1/36', ospf=1, area=1, bfd='default'))
|
||||
self.execute_module(changed=True, commands=['interface Ethernet1/36', 'no ip ospf bfd'])
|
||||
|
||||
# disable -> default
|
||||
set_module_args(dict(interface='ethernet1/37', ospf=1, area=1, bfd='default'))
|
||||
self.execute_module(changed=True, commands=['interface Ethernet1/37', 'no ip ospf bfd'])
|
||||
|
||||
def test_bfd_3(self):
|
||||
# enable -> idempotence
|
||||
set_module_args(dict(interface='ethernet1/36', ospf=1, area=1, bfd='enable'))
|
||||
self.execute_module(changed=False)
|
||||
|
||||
# disable -> idempotence
|
||||
set_module_args(dict(interface='ethernet1/37', ospf=1, area=1, bfd='disable'))
|
||||
self.execute_module(changed=False)
|
||||
|
||||
def test_bfd_4(self):
|
||||
# None -> absent
|
||||
set_module_args(dict(interface='ethernet1/33.101', ospf=1, area=1, state='absent'))
|
||||
self.execute_module(changed=True, commands=['interface Ethernet1/33.101', 'no ip router ospf 1 area 0.0.0.1'])
|
||||
|
||||
# enable -> absent
|
||||
set_module_args(dict(interface='ethernet1/36', ospf=1, area=1, bfd='enable', state='absent'))
|
||||
self.execute_module(changed=True, commands=['interface Ethernet1/36', 'no ip router ospf 1 area 0.0.0.1', 'no ip ospf bfd'])
|
||||
|
||||
# disable -> absent
|
||||
set_module_args(dict(interface='ethernet1/37', ospf=1, area=1, bfd='disable', state='absent'))
|
||||
self.execute_module(changed=True, commands=['interface Ethernet1/37', 'no ip router ospf 1 area 0.0.0.1', 'no ip ospf bfd'])
|
||||
|
||||
def test_absent_1(self):
|
||||
# area only -> absent
|
||||
set_module_args(dict(interface='ethernet1/33.101', ospf=1, area=1, state='absent'))
|
||||
self.execute_module(changed=True, commands=['interface Ethernet1/33.101', 'no ip router ospf 1 area 0.0.0.1'])
|
||||
|
||||
# None -> absent
|
||||
set_module_args(dict(interface='ethernet1/33', ospf=1, area=1, state='absent'))
|
||||
self.execute_module(changed=False)
|
||||
|
||||
def test_loopback_interface_failed(self):
|
||||
set_module_args(dict(interface='loopback0', ospf=1, area=0, passive_interface=True))
|
||||
self.execute_module(failed=True, changed=False)
|
||||
|
||||
Reference in New Issue
Block a user