Fix platform agnostic network integration test cases (#32378)

* Fix platform agnostic network test cases

* Fix vyos_interface CI failure
This commit is contained in:
Ganesh Nalawade 2017-10-31 15:21:27 +05:30 committed by GitHub
parent 53fead7c96
commit 5d1ed1fc25
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
26 changed files with 659 additions and 255 deletions

View file

@ -1,7 +1,7 @@
---
- name: setup - remove login
eos_banner:
net_banner:
banner: login
state: absent
authorize: yes

View file

@ -1,7 +1,7 @@
---
- name: setup - remove motd
eos_banner:
net_banner:
banner: motd
state: absent
authorize: yes
@ -49,6 +49,43 @@
# Ensure sessions contains epoc. Will fail after 18th May 2033
- "result.session_name is not defined"
- name: Remove motd
net_banner:
banner: motd
text: |
this is my motd banner
that has a multiline
string
state: absent
authorize: yes
provider: "{{ cli }}"
register: result
- assert:
that:
- "result.changed == true"
- "'no banner motd' in result.commands"
# Ensure sessions contains epoc. Will fail after 18th May 2033
- "'ansible_1' in result.session_name"
- name: Remove motd again (idempotent)
net_banner:
banner: motd
text: |
this is my motd banner
that has a multiline
string
state: absent
authorize: yes
provider: "{{ cli }}"
register: result
- assert:
that:
- "result.changed == false"
- "result.commands | length == 0"
# Ensure sessions contains epoc. Will fail after 18th May 2033
- "result.session_name is not defined"
# FIXME add in tests for everything defined in docs
# FIXME Test state:absent + test:

View file

@ -1,6 +1,6 @@
---
- name: Setup
eos_banner:
net_banner:
banner: login
text: |
Junk login banner

View file

@ -5,7 +5,6 @@
banner: login
state: absent
authorize: yes
provider: "{{ cli }}"
- name: Set login
net_banner:
@ -16,7 +15,6 @@
string
state: present
authorize: yes
provider: "{{ cli }}"
register: result
- debug:
@ -36,7 +34,6 @@
string
state: present
authorize: yes
provider: "{{ cli }}"
register: result
- assert:

View file

@ -4,7 +4,6 @@
banner: motd
state: absent
authorize: yes
provider: "{{ cli }}"
- name: Set motd
net_banner:
@ -15,7 +14,6 @@
string
state: present
authorize: yes
provider: "{{ cli }}"
register: result
- debug:
@ -35,7 +33,6 @@
string
state: present
authorize: yes
provider: "{{ cli }}"
register: result
- assert:

View file

@ -7,14 +7,12 @@
over multiple lines
state: present
authorize: yes
provider: "{{ cli }}"
- name: remove login
net_banner:
banner: login
state: absent
authorize: yes
provider: "{{ cli }}"
register: result
- debug:
@ -30,7 +28,6 @@
banner: login
state: absent
authorize: yes
provider: "{{ cli }}"
register: result
- assert:

View file

@ -94,7 +94,7 @@
- "result.changed == false"
- name: delete motd banner
junos_banner:
net_banner:
banner: motd
state: absent
provider: "{{ netconf }}"

View file

@ -1,40 +1,69 @@
---
- debug: msg="START net_interface cli/basic.yaml"
- name: Run show version
ios_command:
commands: show version
authorize: yes
register: show_version_result
- block:
- name: Set test interface to GigabitEthernet0/1 as we are on Cisco IOS
set_fact: test_interface=GigabitEthernet0/1
- name: Set test interface 2 to GigabitEthernet0/2 as we are on Cisco IOS
set_fact: test_interface2=GigabitEthernet0/2
when: "'Cisco IOS' in show_version_result.stdout[0]"
- block:
- name: Set test interface to GigabitEthernet2 as we are on Cisco IOS-XE
set_fact: test_interface=GigabitEthernet2
- name: Disable autonegotiation on GigabitEthernet2
ios_config:
lines:
- no negotiation auto
parents: int GigabitEthernet2
authorize: yes
- name: Set test interface 2 to GigabitEthernet3 as we are on Cisco IOS-XE
set_fact: test_interface2=GigabitEthernet3
- name: Disable autonegotiation on GigabitEthernet3
ios_config:
lines:
- no negotiation auto
parents: int GigabitEthernet3
authorize: yes
when: "'Cisco IOS-XE' in show_version_result.stdout[0]"
- name: Configure interface (setup)
net_interface:
name: GigabitEthernet0/2
name: "{{ test_interface }}"
description: test-interface-1
speed: 10
duplex: full
mtu: 256
speed: 1000
mtu: 1800
state: present
authorize: yes
provider: "{{ cli }}"
register: result
- name: Confgure interface
- name: Configure interface
net_interface:
name: GigabitEthernet0/2
name: "{{ test_interface }}"
description: test-interface-initial
state: present
authorize: yes
provider: "{{ cli }}"
register: result
- assert:
that:
- 'result.changed == true'
- '"interface GigabitEthernet0/2" in result.commands'
- '"interface {{ test_interface }}" in result.commands'
- '"description test-interface-initial" in result.commands'
- name: Confgure interface (idempotent)
net_interface:
name: GigabitEthernet0/2
name: "{{ test_interface }}"
description: test-interface-initial
state: present
authorize: yes
provider: "{{ cli }}"
register: result
- assert:
@ -43,120 +72,99 @@
- name: Confgure interface parameters
net_interface:
name: GigabitEthernet0/2
name: "{{ test_interface }}"
description: test-interface
speed: 100
mtu: 512
mtu: 2000
state: present
authorize: yes
provider: "{{ cli }}"
register: result
- assert:
that:
- 'result.changed == true'
- '"interface GigabitEthernet0/2" in result.commands'
- '"interface {{ test_interface }}" in result.commands'
- '"description test-interface" in result.commands'
- '"speed 100" in result.commands'
- '"mtu 512" in result.commands'
- '"mtu 2000" in result.commands'
- name: Change interface parameters
net_interface:
name: GigabitEthernet0/2
name: "{{ test_interface }}"
description: test-interface-1
speed: 10
duplex: half
mtu: 256
mtu: 1800
state: present
authorize: yes
provider: "{{ cli }}"
register: result
- assert:
that:
- 'result.changed == true'
- '"interface GigabitEthernet0/2" in result.commands'
- '"interface {{ test_interface }}" in result.commands'
- '"description test-interface-1" in result.commands'
- '"speed 10" in result.commands'
- '"duplex half" in result.commands'
- '"mtu 256" in result.commands'
- '"mtu 1800" in result.commands'
- name: Disable interface
net_interface:
name: GigabitEthernet0/2
name: "{{ test_interface }}"
enabled: False
authorize: yes
provider: "{{ cli }}"
register: result
- assert:
that:
- 'result.changed == true'
- '"interface GigabitEthernet0/2" in result.commands'
- '"interface {{ test_interface }}" in result.commands'
- '"shutdown" in result.commands'
- name: Enable interface
net_interface:
name: GigabitEthernet0/2
name: "{{ test_interface }}"
enabled: True
authorize: yes
provider: "{{ cli }}"
register: result
- assert:
that:
- 'result.changed == true'
- '"interface GigabitEthernet0/2" in result.commands'
- '"interface {{ test_interface }}" in result.commands'
- '"no shutdown" in result.commands'
- name: Confgure second interface (setup)
net_interface:
name: GigabitEthernet0/1
name: "{{ test_interface2 }}"
description: test-interface-initial
speed: 100
duplex: half
mtu: 516
speed: 1000
mtu: 1800
state: present
authorize: yes
provider: "{{ cli }}"
register: result
- name: Add interface aggregate
net_interface:
aggregate:
- { name: GigabitEthernet0/1, mtu: 256, description: test-interface-1 }
- { name: GigabitEthernet0/2, mtu: 516, description: test-interface-2 }
duplex: full
speed: 100
- { name: "{{ test_interface }}", mtu: 2000, description: test-interface-1 }
- { name: "{{ test_interface2 }}", mtu: 2000, description: test-interface-2 }
speed: 1000
state: present
authorize: yes
provider: "{{ cli }}"
register: result
- assert:
that:
- 'result.changed == true'
- '"interface GigabitEthernet0/1" in result.commands'
- '"speed 100" in result.commands'
- '"description test-interface-1" in result.commands'
- '"duplex full" in result.commands'
- '"mtu 256" in result.commands'
- '"interface GigabitEthernet0/2" in result.commands'
- '"speed 100" in result.commands'
- '"interface {{ test_interface }}" in result.commands'
- '"mtu 2000" in result.commands'
- '"interface {{ test_interface2 }}" in result.commands'
- '"description test-interface-2" in result.commands'
- '"duplex full" in result.commands'
- '"mtu 516" in result.commands'
- '"mtu 2000" in result.commands'
- name: Add interface aggregate (idempotent)
net_interface:
aggregate:
- { name: GigabitEthernet0/1, mtu: 256, description: test-interface-1 }
- { name: GigabitEthernet0/2, mtu: 516, description: test-interface-2 }
duplex: full
speed: 100
- { name: "{{ test_interface }}", mtu: 2000, description: test-interface-1 }
- { name: "{{ test_interface2 }}", mtu: 2000, description: test-interface-2 }
speed: 1000
state: present
authorize: yes
provider: "{{ cli }}"
register: result
- assert:
@ -166,39 +174,37 @@
- name: Disable interface aggregate
net_interface:
aggregate:
- name: GigabitEthernet0/1
- name: GigabitEthernet0/2
- { name: "{{ test_interface }}" }
- { name: "{{ test_interface2 }}" }
enabled: False
state: present
authorize: yes
provider: "{{ cli }}"
register: result
- assert:
that:
- 'result.changed == true'
- '"interface GigabitEthernet0/1" in result.commands'
- '"interface {{ test_interface }}" in result.commands'
- '"shutdown" in result.commands'
- '"interface GigabitEthernet0/2" in result.commands'
- '"interface {{ test_interface2 }}" in result.commands'
- '"shutdown" in result.commands'
- name: Enable interface aggregate
net_interface:
aggregate:
- name: GigabitEthernet0/1
- name: GigabitEthernet0/2
- { name: "{{ test_interface }}" }
- { name: "{{ test_interface2 }}" }
enabled: True
state: present
authorize: yes
provider: "{{ cli }}"
register: result
- assert:
that:
- 'result.changed == true'
- '"interface GigabitEthernet0/1" in result.commands'
- '"interface {{ test_interface }}" in result.commands'
- '"no shutdown" in result.commands'
- '"interface GigabitEthernet0/2" in result.commands'
- '"interface {{ test_interface2 }}" in result.commands'
- '"no shutdown" in result.commands'
- name: loopback interface setup
@ -216,7 +222,6 @@
- name: Loopback10
state: present
authorize: yes
provider: "{{ cli }}"
register: result
- assert:
@ -232,7 +237,6 @@
- name: Loopback10
state: absent
authorize: yes
provider: "{{ cli }}"
register: result
- assert:
@ -248,7 +252,6 @@
- name: Loopback10
state: absent
authorize: yes
provider: "{{ cli }}"
register: result
- assert:

View file

@ -1,14 +1,28 @@
---
- debug: msg="START net_interface ios/intent.yaml"
- name: Run show version
ios_command:
commands: show version
authorize: yes
register: show_version_result
- name: Set test interface to GigabitEthernet0/2 if we are on Cisco IOS
set_fact: test_interface=GigabitEthernet0/2
when: "'Cisco IOS' in show_version_result.stdout[0]"
- name: Set test interface to GigabitEthernet2 if we are on Cisco IOS-XE
set_fact: test_interface=GigabitEthernet2
when: "'Cisco IOS-XE' in show_version_result.stdout[0]"
- name: Check intent arguments
net_interface:
name: GigabitEthernet0/2
name: "{{ test_interface }}"
state: up
tx_rate: ge(0)
rx_rate: le(0)
authorize: yes
provider: "{{ cli }}"
register: result
- assert:
@ -17,12 +31,11 @@
- name: Check intent arguments (failed condition)
net_interface:
name: GigabitEthernet0/2
name: "{{ test_interface }}"
state: down
tx_rate: gt(0)
rx_rate: lt(0)
authorize: yes
provider: "{{ cli }}"
ignore_errors: yes
register: result
@ -35,11 +48,10 @@
- name: Config + intent
net_interface:
name: GigabitEthernet0/2
name: "{{ test_interface }}"
enabled: False
state: down
authorize: yes
provider: "{{ cli }}"
register: result
- assert:
@ -48,11 +60,10 @@
- name: Config + intent (fail)
net_interface:
name: GigabitEthernet0/2
name: "{{ test_interface }}"
enabled: False
authorize: yes
state: up
provider: "{{ cli }}"
ignore_errors: yes
register: result
@ -61,17 +72,90 @@
- "result.failed == true"
- "'state eq(up)' in result.failed_conditions"
- name: Register show neighbors detail
ios_command:
commands:
- show lldp neighbors
authorize: yes
register: show_lldp_neighbors_result
- block:
- name: Check neighbors intent arguments
net_interface:
name: Gi0/0
neighbors:
- port: eth0
host: netdev
authorize: yes
register: result
- assert:
that:
- "result.failed == false"
- name: Check neighbors intent arguments (failed condition)
net_interface:
name: Gi0/0
neighbors:
- port: dummy_port
host: dummy_host
authorize: yes
ignore_errors: yes
register: result
- assert:
that:
- "result.failed == true"
- "'host dummy_host' in result.failed_conditions"
- "'port dummy_port' in result.failed_conditions"
when: '"netdev" in show_lldp_neighbors_result.stdout'
- name: Aggregate config + intent (pass)
net_interface:
aggregate:
- name: GigabitEthernet0/2
- name: "{{ test_interface }}"
enabled: True
state: up
authorize: yes
provider: "{{ cli }}"
ignore_errors: yes
register: result
- assert:
that:
- "result.failed == false"
- block:
- name: Aggregate neighbors intent (pass)
net_interface:
aggregate:
- name: Gi0/0
neighbors:
- port: eth0
host: netdev
authorize: yes
ignore_errors: yes
register: result
- assert:
that:
- "result.failed == false"
- name: Aggregate neighbors intent (fail)
net_interface:
aggregate:
- name: Gi0/0
neighbors:
- port: eth0
host: netdev
- port: dummy_port
host: dummy_host
authorize: yes
ignore_errors: yes
register: result
- assert:
that:
- "result.failed == true"
- "'host dummy_host' in result.failed_conditions"
- "'port dummy_port' in result.failed_conditions"
when: "'netdev' in show_lldp_neighbors_result.stdout"

View file

@ -5,7 +5,6 @@
net_interface:
name: GigabitEthernet0/0/0/2
state: absent
provider: "{{ cli }}"
register: result
@ -14,7 +13,6 @@
name: GigabitEthernet0/0/0/2
description: test-interface-initial
state: present
provider: "{{ cli }}"
register: result
- assert:
@ -27,7 +25,6 @@
name: GigabitEthernet0/0/0/2
description: test-interface-initial
state: present
provider: "{{ cli }}"
register: result
- assert:
@ -42,7 +39,6 @@
duplex: half
mtu: 512
state: present
provider: "{{ cli }}"
register: result
- assert:
@ -61,7 +57,6 @@
duplex: full
mtu: 256
state: present
provider: "{{ cli }}"
register: result
- assert:
@ -80,8 +75,8 @@
duplex: full
mtu: 256
state: present
provider: "{{ cli }}"
register: result
- assert:
that:
- 'result.changed == false'
@ -90,7 +85,6 @@
net_interface:
name: GigabitEthernet0/0/0/2
enabled: False
provider: "{{ cli }}"
register: result
- assert:
@ -102,7 +96,6 @@
net_interface:
name: GigabitEthernet0/0/0/2
enabled: True
provider: "{{ cli }}"
register: result
- assert:
@ -115,7 +108,6 @@
name: GigabitEthernet0/0/0/3
description: test-interface-initial
state: present
provider: "{{ cli }}"
register: result
- assert:
@ -138,7 +130,6 @@
speed: 100
duplex: full
state: present
provider: "{{ cli }}"
register: result
- assert:
@ -162,7 +153,6 @@
speed: 100
duplex: full
state: present
provider: "{{ cli }}"
register: result
- assert:
@ -176,7 +166,6 @@
- name: GigabitEthernet0/0/0/2
enabled: False
state: present
provider: "{{ cli }}"
register: result
- assert:
@ -192,7 +181,6 @@
- name: GigabitEthernet0/0/0/2
enabled: True
state: present
provider: "{{ cli }}"
register: result
- assert:
@ -207,7 +195,6 @@
- name: GigabitEthernet0/0/0/4
- name: GigabitEthernet0/0/0/5
description: test-interface-initial
provider: "{{ cli }}"
register: result
- name: Create interface aggregate
@ -218,7 +205,6 @@
- name: GigabitEthernet0/0/0/5
description: test_interface_2
state: present
provider: "{{ cli }}"
register: result
- assert:
@ -233,7 +219,6 @@
- name: GigabitEthernet0/0/0/4
- name: GigabitEthernet0/0/0/5
state: absent
provider: "{{ cli }}"
register: result
- assert:
@ -248,7 +233,6 @@
- name: GigabitEthernet0/0/0/4
- name: GigabitEthernet0/0/0/5
state: absent
provider: "{{ cli }}"
register: result
- assert:

View file

@ -7,7 +7,6 @@
description: test_interface_5
enabled: True
state: present
provider: "{{ cli }}"
register: result
- name: Check intent arguments
@ -15,7 +14,6 @@
name: GigabitEthernet0/0/0/5
state: up
delay: 20
provider: "{{ cli }}"
register: result
- assert:
@ -26,7 +24,6 @@
net_interface:
name: GigabitEthernet0/0/0/5
state: down
provider: "{{ cli }}"
ignore_errors: yes
register: result
@ -41,7 +38,6 @@
enabled: False
state: down
delay: 20
provider: "{{ cli }}"
register: result
- assert:
@ -53,7 +49,6 @@
name: GigabitEthernet0/0/0/5
enabled: False
state: up
provider: "{{ cli }}"
ignore_errors: yes
register: result
@ -69,7 +64,6 @@
enabled: True
state: up
delay: 20
provider: "{{ cli }}"
ignore_errors: yes
register: result

View file

@ -1,60 +1,85 @@
---
- debug: msg="START net_interface vyos/basic.yaml"
- name: Run vyos lsmod command
vyos_command:
commands:
- lsmod
register: lsmod_out
- name: Set up - delete interface
net_interface:
name: eth1
state: absent
- name: Configure interface params
- name: Set up - Create interface
net_interface:
name: eth1
state: present
description: test-interface
speed: 100
duplex: half
mtu: 256
register: result
- assert:
that:
- 'result.changed == true'
- '"set interfaces ethernet eth1" in result.commands'
- '"set interfaces ethernet eth1 description test-interface" in result.commands'
- '"set interfaces ethernet eth1 speed 100" in result.commands'
- '"set interfaces ethernet eth1 duplex half" in result.commands'
- '"set interfaces ethernet eth1 mtu 256" in result.commands'
- name: Configure interface params (idempotent)
net_interface:
name: eth1
state: present
description: test-interface
speed: 100
duplex: half
mtu: 256
register: result
- assert:
that:
- 'result.changed == false'
- name: Change interface params
- name: Configure interface params
net_interface:
name: eth1
state: present
description: test-interface-1
speed: 1000
duplex: full
mtu: 512
speed: 100
duplex: half
mtu: 256
when: "'virtio_net' not in lsmod_out.stdout[0]"
register: result
- assert:
that:
- 'result.changed == true'
- '"set interfaces ethernet eth1 description test-interface-1" in result.commands'
- '"set interfaces ethernet eth1 speed 100" in result.commands'
- '"set interfaces ethernet eth1 duplex half" in result.commands'
- '"set interfaces ethernet eth1 mtu 256" in result.commands'
when: "'virtio_net' not in lsmod_out.stdout[0]"
- name: Configure interface params (idempotent)
net_interface:
name: eth1
state: present
description: test-interface-1
speed: 100
duplex: half
mtu: 256
register: result
when: "'virtio_net' not in lsmod_out.stdout[0]"
- assert:
that:
- 'result.changed == false'
when: "'virtio' not in lsmod_out.stdout[0]"
- name: Change interface params
net_interface:
name: eth1
state: present
description: test-interface-2
speed: 1000
duplex: full
mtu: 512
register: result
when: "'virtio_net' not in lsmod_out.stdout[0]"
- assert:
that:
- 'result.changed == true'
- '"set interfaces ethernet eth1 description test-interface-2" in result.commands'
- '"set interfaces ethernet eth1 speed 1000" in result.commands'
- '"set interfaces ethernet eth1 duplex full" in result.commands'
- '"set interfaces ethernet eth1 mtu 512" in result.commands'
when: "'virtio_net' not in lsmod_out.stdout[0]"
- name: Disable interface
net_interface:
@ -111,6 +136,7 @@
- { name: eth1, description: test-interface-1, speed: 100, duplex: half, mtu: 512}
- { name: eth2, description: test-interface-2, speed: 1000, duplex: full, mtu: 256}
register: result
when: "'virtio_net' not in lsmod_out.stdout[0]"
- assert:
that:
@ -123,6 +149,7 @@
- '"set interfaces ethernet eth2 speed 1000" in result.commands'
- '"set interfaces ethernet eth2 duplex full" in result.commands'
- '"set interfaces ethernet eth2 mtu 256" in result.commands'
when: "'virtio_net' not in lsmod_out.stdout[0]"
- name: Set interface on aggregate (idempotent)
net_interface:
@ -130,16 +157,19 @@
- { name: eth1, description: test-interface-1, speed: 100, duplex: half, mtu: 512}
- { name: eth2, description: test-interface-2, speed: 1000, duplex: full, mtu: 256}
register: result
when: "'virtio_net' not in lsmod_out.stdout[0]"
- assert:
that:
- 'result.changed == false'
when: "'virtio_net' not in lsmod_out.stdout[0]"
- name: Disable interface on aggregate
net_interface:
aggregate:
- name: eth1
- name: eth2
description: test-interface
enabled: False
register: result
@ -189,4 +219,5 @@
that:
- 'result.changed == false'
- debug: msg="END net_interface vyos/basic.yaml"

View file

@ -1,30 +1,46 @@
---
- debug: msg="START net_interface vyos/intent.yaml"
- name: Run vyos lsmod command
vyos_command:
commands:
- lsmod
register: lsmod_out
- name: Setup (interface is up)
net_interface:
name: eth1
enabled: True
state: present
provider: "{{ cli }}"
register: result
- name: Check intent arguments
net_interface:
name: eth1
state: up
provider: "{{ cli }}"
register: result
- assert:
that:
- "result.failed == false"
- name: Check lldp neighbors intent arguments
net_interface:
name: eth0
neighbors:
- port: eth0
when: "'virtio_net' not in lsmod_out.stdout[0]"
register: result
- assert:
that:
- "result.failed == false"
when: "'virtio_net' not in lsmod_out.stdout[0]"
- name: Check intent arguments (failed condition)
net_interface:
name: eth1
state: down
provider: "{{ cli }}"
ignore_errors: yes
register: result
@ -33,12 +49,28 @@
- "result.failed == true"
- "'state eq(down)' in result.failed_conditions"
- name: Check lldp neighbors intent arguments (failed)
net_interface:
name: eth0
neighbors:
- port: dummy_port
host: dummy_host
ignore_errors: yes
when: "'virtio_net' not in lsmod_out.stdout[0]"
register: result
- assert:
that:
- "result.failed == true"
- "'host dummy_host' in result.failed_conditions"
- "'port dummy_port' in result.failed_conditions"
when: "'virtio_net' not in lsmod_out.stdout[0]"
- name: Config + intent
net_interface:
name: eth1
enabled: False
state: down
provider: "{{ cli }}"
register: result
- assert:
@ -50,7 +82,6 @@
name: eth1
enabled: False
state: up
provider: "{{ cli }}"
ignore_errors: yes
register: result
@ -65,10 +96,42 @@
- name: eth1
enabled: True
state: up
provider: "{{ cli }}"
ignore_errors: yes
register: result
- assert:
that:
- "result.failed == false"
- name: Check lldp neighbors intent aggregate arguments
net_interface:
aggregate:
- name: eth0
neighbors:
- port: eth0
when: "'virtio_net' not in lsmod_out.stdout[0]"
register: result
- assert:
that:
- "result.failed == false"
when: "'virtio_net' not in lsmod_out.stdout[0]"
- name: Check lldp neighbors intent aggregate arguments (failed)
net_interface:
aggregate:
- name: eth0
neighbors:
- port: eth0
- port: dummy_port
host: dummy_host
ignore_errors: yes
when: "'virtio_net' not in lsmod_out.stdout[0]"
register: result
- assert:
that:
- "result.failed == true"
- "'host dummy_host' in result.failed_conditions"
- "'port dummy_port' in result.failed_conditions"
when: "'virtio_net' not in lsmod_out.stdout[0]"

View file

@ -1,13 +1,12 @@
---
- debug: msg="START net_lldp junos/basic.yaml"
- name: setup - remove lldp
- name: setup - Disable lldp and remove it's configuration
net_lldp:
state: absent
provider: "{{ netconf }}"
- name: configure lldp
- name: Enable lldp
net_lldp:
state: present
provider: "{{ netconf }}"
@ -16,9 +15,8 @@
- assert:
that:
- "result.changed == true"
- "'- disable;' in result.diff.prepared"
- name: configure lldp (idempotent)
- name: Enable lldp (idempotent)
net_lldp:
state: present
provider: "{{ netconf }}"
@ -28,8 +26,74 @@
that:
- "result.changed == false"
- name: Disable lldp
- name: configure lldp parameters and enable lldp
net_lldp:
interval: 10
hold_multiplier: 5
transmit_delay: 2
state: present
provider: "{{ netconf }}"
register: result
- assert:
that:
- "result.changed == true"
- result.diff.prepared | search("\+ *advertisement-interval 10")
- result.diff.prepared | search("\+ *transmit-delay 2")
- result.diff.prepared | search("\+ *hold-multiplier 5")
- name: configure lldp parameters and enable lldp(idempotent)
net_lldp:
interval: 10
hold_multiplier: 5
transmit_delay: 2
state: present
provider: "{{ netconf }}"
register: result
- assert:
that:
- "result.changed == false"
- name: configure lldp parameters and disable lldp
net_lldp:
interval: 10
hold_multiplier: 5
transmit_delay: 2
state: disabled
provider: "{{ netconf }}"
register: result
- assert:
that:
- "result.changed == true"
- result.diff.prepared | search("\+ *disable")
- "'advertisement-interval 10;' not in result.diff.prepared"
- "'transmit-delay 2;' not in result.diff.prepared"
- "'hold-multiplier 5;' not in result.diff.prepared"
- name: configure lldp parameters and enable lldp
net_lldp:
interval: 10
hold_multiplier: 5
transmit_delay: 2
state: enabled
provider: "{{ netconf }}"
register: result
- assert:
that:
- "result.changed == true"
- result.diff.prepared | search("\- *disable")
- "'advertisement-interval 10;' not in result.diff.prepared"
- "'transmit-delay 2;' not in result.diff.prepared"
- "'hold-multiplier 5;' not in result.diff.prepared"
- name: Remove lldp configuration and diable lldp
net_lldp:
interval: 10
hold_multiplier: 5
transmit_delay: 2
state: absent
provider: "{{ netconf }}"
register: result
@ -37,9 +101,12 @@
- assert:
that:
- "result.changed == true"
- "'+ disable;' in result.diff.prepared"
- result.diff.prepared | search("\+ *disable")
- result.diff.prepared | search("\- *advertisement-interval 10")
- result.diff.prepared | search("\- *transmit-delay 2")
- result.diff.prepared | search("\- *hold-multiplier 5")
- name: Disable lldp (idempotent)
- name: Remove lldp (idempotent)
net_lldp:
state: absent
provider: "{{ netconf }}"

View file

@ -5,7 +5,6 @@
name: 172.16.0.1
state: present
authorize: yes
provider: "{{ cli }}"
register: result
- assert:
@ -20,7 +19,6 @@
name: 172.16.0.1
state: present
authorize: yes
provider: "{{ cli }}"
register: result
- assert:
@ -33,7 +31,6 @@
name: 172.16.0.1
state: absent
authorize: yes
provider: "{{ cli }}"
register: result
- assert:
@ -47,7 +44,6 @@
name: 172.16.0.1
state: absent
authorize: yes
provider: "{{ cli }}"
register: result
- assert:
@ -60,7 +56,6 @@
level: warnings
state: present
authorize: yes
provider: "{{ cli }}"
register: result
- assert:
@ -73,7 +68,6 @@
dest: monitor
level: debugging
authorize: yes
provider: "{{ cli }}"
register: result
- assert:
@ -87,7 +81,6 @@
- { dest: console, level: warnings, state: absent }
- { dest: monitor, level: debuggning, state: absent }
authorize: yes
provider: "{{ cli }}"
register: result
- assert:

View file

@ -4,7 +4,6 @@
dest: hostnameprefix
name: 172.16.0.1
state: present
provider: "{{ cli }}"
register: result
- assert:
@ -18,7 +17,6 @@
dest: hostnameprefix
name: 172.16.0.1
state: present
provider: "{{ cli }}"
register: result
- assert:
@ -30,7 +28,6 @@
dest: hostnameprefix
name: 172.16.0.1
state: absent
provider: "{{ cli }}"
register: result
- assert:
@ -43,7 +40,6 @@
dest: hostnameprefix
name: 172.16.0.1
state: absent
provider: "{{ cli }}"
register: result
- assert:
@ -55,7 +51,6 @@
dest: console
level: warnings
state: present
provider: "{{ cli }}"
register: result
- assert:
@ -67,7 +62,6 @@
net_logging:
dest: monitor
level: debugging
provider: "{{ cli }}"
register: result
- assert:
@ -80,7 +74,6 @@
aggregate:
- { dest: console, level: warnings, state: absent }
- { dest: monitor, level: debuggning, state: absent }
provider: "{{ cli }}"
register: result
- assert:

View file

@ -1,21 +1,21 @@
---
- debug: msg="START net_logging junos/basic.yaml"
- name: setup - remove host logging
- name: setup - remove file logging
net_logging:
dest: host
name: 1.1.1.1
dest: file
name: test
facility: pfe
level: critical
level: error
state: absent
provider: "{{ netconf }}"
- name: Create file logging
net_logging:
dest: host
name: 1.1.1.1
dest: file
name: test_file
facility: pfe
level: critical
level: error
state: present
provider: "{{ netconf }}"
register: result
@ -29,16 +29,16 @@
- assert:
that:
- "result.changed == true"
- "'<name>1.1.1.1</name>' in config.xml"
- "'<name>test_file</name>' in config.xml"
- "'<name>pfe</name>' in config.xml"
- "'<critical/>' in config.xml"
- "'<error/>' in config.xml"
- name: Create file logging (idempotent)
net_logging:
dest: host
name: 1.1.1.1
dest: file
name: test_file
facility: pfe
level: critical
level: error
state: present
provider: "{{ netconf }}"
register: result
@ -47,12 +47,59 @@
that:
- "result.changed == false"
- name: Deactivate logging configuration
net_logging:
dest: file
name: test_file
facility: pfe
level: error
state: present
active: False
provider: "{{ netconf }}"
register: result
- name: Get running configuration
junos_rpc:
rpc: get-configuration
provider: "{{ netconf }}"
register: config
- assert:
that:
- "result.changed == true"
- "'<file inactive=\"inactive\">' in config.xml"
- "'<contents inactive=\"inactive\">' in config.xml"
- name: Activate logging configuration
net_logging:
dest: file
name: test_file
facility: pfe
level: error
state: present
active: True
provider: "{{ netconf }}"
register: result
- name: Get running configuration
junos_rpc:
rpc: get-configuration
provider: "{{ netconf }}"
register: config
- assert:
that:
- "result.changed == true"
- "'<name>test_file</name>' in config.xml"
- "'<name>pfe</name>' in config.xml"
- "'<error/>' in config.xml"
- name: Delete logging configuration
net_logging:
dest: host
name: 1.1.1.1
dest: file
name: test_file
facility: pfe
level: critical
level: error
state: absent
provider: "{{ netconf }}"
register: result
@ -66,7 +113,7 @@
- assert:
that:
- "result.changed == true"
- "'<name>1.1.1.1</name>' not in config.xml"
- "'<name>test_file</name>' not in config.xml"
- name: Configure console logging
net_logging:
@ -74,6 +121,7 @@
facility: kernel
level: emergency
state: present
active: True
provider: "{{ netconf }}"
register: result
@ -91,11 +139,12 @@
- "'<emergency/>' in config.xml"
- name: Configure console logging (idempotent)
junos_logging:
net_logging:
dest: console
facility: kernel
level: emergency
state: present
active: True
provider: "{{ netconf }}"
register: result
@ -103,6 +152,27 @@
that:
- "result.changed == false"
- name: Disable console logging
net_logging:
dest: console
facility: kernel
level: emergency
state: present
active: False
provider: "{{ netconf }}"
register: result
- name: Get running configuration
junos_rpc:
rpc: get-configuration
provider: "{{ netconf }}"
register: config
- assert:
that:
- "result.changed == true"
- "'<console inactive=\"inactive\">' in config.xml"
- name: Delete console logging
net_logging:
dest: console
@ -123,17 +193,123 @@
- "result.changed == true"
- "'<console>' not in config.xml"
- name: Configure logging parameters
net_logging:
size: 65536
files: 40
rotate_frequency: 20
state: present
provider: "{{ netconf }}"
register: result
- name: Get running configuration
junos_rpc:
rpc: get-configuration
provider: "{{ netconf }}"
register: config
- assert:
that:
- "result.changed == true"
- "'<size>64k</size>' in config.xml"
- "'<files>40</files>' in config.xml"
- "'<log-rotate-frequency>20</log-rotate-frequency>' in config.xml"
- name: Configure logging parameters (idempotent)
net_logging:
size: 65536
files: 40
rotate_frequency: 20
state: present
active: True
provider: "{{ netconf }}"
register: result
- assert:
that:
- "result.changed == false"
- name: Disable logging parameters
net_logging:
size: 65536
files: 40
rotate_frequency: 20
state: present
active: False
provider: "{{ netconf }}"
register: result
- name: Get running configuration
junos_rpc:
rpc: get-configuration
provider: "{{ netconf }}"
register: config
- assert:
that:
- "result.changed == true"
- "'<size inactive=\"inactive\">64k</size>' in config.xml"
- "'<files inactive=\"inactive\">40</files>' in config.xml"
- "'<log-rotate-frequency inactive=\"inactive\">20</log-rotate-frequency>' in config.xml"
- name: Activate logging parameters
net_logging:
size: 65536
files: 40
rotate_frequency: 20
state: present
active: True
provider: "{{ netconf }}"
register: result
- name: Get running configuration
junos_rpc:
rpc: get-configuration
provider: "{{ netconf }}"
register: config
- assert:
that:
- "result.changed == true"
- "'<size>64k</size>' in config.xml"
- "'<files>40</files>' in config.xml"
- "'<log-rotate-frequency>20</log-rotate-frequency>' in config.xml"
- name: Delete logging parameters
net_logging:
size: 65536
files: 40
rotate_frequency: 20
state: absent
provider: "{{ netconf }}"
register: result
- name: Get running configuration
junos_rpc:
rpc: get-configuration
provider: "{{ netconf }}"
register: config
- assert:
that:
- "result.changed == true"
- "'<size>64k</size>' not in config.xml"
- "'<files>40</files>' not in config.xml"
- "'<log-rotate-frequency>20</log-rotate-frequency>' not in config.xml"
- name: Seup file logging using aggregate
net_logging:
aggregate:
- {dest: file, name: test-1, facility: pfe, level: critical, state: absent}
- {dest: file, name: test-2, facility: kernel, level: emergency, state: absent}
provider: "{{ netconf }}"
register: result
- name: Configure file logging using aggregate
net_logging:
aggregate:
- dest: file
name: test-1
facility: pfe
level: critical
- dest: file
name: test-2
facility: kernel
level: emergency
- {dest: file, name: test-1, facility: pfe, level: critical, active: True}
- {dest: file, name: test-2, facility: kernel, level: emergency, active: True}
provider: "{{ netconf }}"
register: result
@ -145,7 +321,7 @@
- result.diff.prepared | search("\+ *file test-2")
- result.diff.prepared | search("\+ *kernel emergency")
- name: Delete file logging using aggregate
- name: Deactivate file logging configuration using aggregate
net_logging:
aggregate:
- dest: file
@ -156,6 +332,40 @@
name: test-2
facility: kernel
level: emergency
active: False
provider: "{{ netconf }}"
register: result
- assert:
that:
- 'result.changed == true'
- result.diff.prepared | search("! *inactive[:] file test-1")
- result.diff.prepared | search("! *inactive[:] pfe")
- result.diff.prepared | search("! *inactive[:] file test-2")
- result.diff.prepared | search("! *inactive[:] kernel")
- name: activate file logging configuration using aggregate
net_logging:
aggregate:
- { dest: file, name: test-1, facility: pfe, level: critical }
- { dest: file, name: test-2, facility: kernel, level: emergency }
active: True
provider: "{{ netconf }}"
register: result
- assert:
that:
- 'result.changed == true'
- result.diff.prepared | search("! *active[:] file test-1")
- result.diff.prepared | search("! *active[:] pfe")
- result.diff.prepared | search("! *active[:] file test-2")
- result.diff.prepared | search("! *active[:] kernel")
- name: Delete file logging using aggregate
net_logging:
aggregate:
- { dest: file, name: test-1, facility: pfe, level: critical }
- { dest: file, name: test-2, facility: kernel, level: emergency }
state: absent
provider: "{{ netconf }}"
register: result
@ -171,18 +381,12 @@
- name: Delete file logging using aggregate (idempotent)
net_logging:
aggregate:
- dest: file
name: test-1
facility: pfe
level: critical
- dest: file
name: test-2
facility: kernel
level: emergency
- { dest: file, name: test-1, facility: pfe, level: critical }
- { dest: file, name: test-2, facility: kernel, level: emergency }
state: absent
provider: "{{ netconf }}"
register: result
- assert:
that:
- 'result.changed == false'
- "result.changed == false"

View file

@ -5,7 +5,6 @@
facility: all
level: info
state: present
provider: "{{ cli }}"
register: result
- assert:
@ -19,7 +18,6 @@
facility: all
level: info
state: present
provider: "{{ cli }}"
register: result
- assert:
@ -33,7 +31,6 @@
facility: all
level: notice
state: present
provider: "{{ cli }}"
register: result
- assert:
@ -48,7 +45,6 @@
facility: all
level: notice
state: present
provider: "{{ cli }}"
register: result
- assert:
@ -62,7 +58,6 @@
facility: all
level: notice
state: absent
provider: "{{ cli }}"
register: result
- assert:
@ -77,7 +72,6 @@
facility: all
level: notice
state: absent
provider: "{{ cli }}"
register: result
- assert:
@ -90,7 +84,6 @@
- { dest: file, name: test1, facility: all, level: info }
- { dest: file, name: test2, facility: news, level: debug }
state: present
provider: "{{ cli }}"
register: result
- assert:
@ -106,7 +99,6 @@
- { dest: file, name: test1, facility: all, level: info, state: absent }
- { dest: console, facility: daemon, level: warning }
state: present
provider: "{{ cli }}"
register: result
- assert:
@ -122,7 +114,6 @@
- { dest: console, facility: daemon, level: warning }
- { dest: file, name: test2, facility: news, level: debug }
state: absent
provider: "{{ cli }}"
register: result
- assert:

View file

@ -8,7 +8,6 @@
next_hop: 10.0.0.8
state: present
authorize: yes
provider: "{{ cli }}"
register: result
- assert:
@ -23,7 +22,6 @@
next_hop: 10.0.0.8
state: present
authorize: yes
provider: "{{ cli }}"
register: result
- assert:
@ -38,7 +36,6 @@
admin_distance: 2
state: present
authorize: yes
provider: "{{ cli }}"
register: result
- assert:
@ -54,7 +51,6 @@
admin_distance: 2
state: present
authorize: yes
provider: "{{ cli }}"
register: result
- assert:
@ -69,7 +65,6 @@
admin_distance: 2
state: absent
authorize: yes
provider: "{{ cli }}"
register: result
- assert:
@ -85,7 +80,6 @@
admin_distance: 2
state: absent
authorize: yes
provider: "{{ cli }}"
register: result
- assert:
@ -99,7 +93,6 @@
- { prefix: 172.16.33.0, mask: 255.255.255.0, next_hop: 10.0.0.8 }
state: present
authorize: yes
provider: "{{ cli }}"
register: result
- assert:
@ -115,7 +108,6 @@
- { prefix: 172.16.34.0, mask: 255.255.255.0, next_hop: 10.0.0.8 }
state: present
authorize: yes
provider: "{{ cli }}"
register: result
- assert:
@ -131,7 +123,6 @@
- { prefix: 172.16.34.0, mask: 255.255.255.0, next_hop: 10.0.0.8 }
state: absent
authorize: yes
provider: "{{ cli }}"
register: result
- assert:

View file

@ -4,7 +4,6 @@
prefix: 172.24.0.0/24
next_hop: 192.168.42.64
state: present
provider: "{{ cli }}"
register: result
- assert:
@ -18,7 +17,6 @@
mask: 24
next_hop: 192.168.42.64
state: present
provider: "{{ cli }}"
register: result
- assert:
@ -31,7 +29,6 @@
next_hop: 192.168.42.64
admin_distance: 1
state: present
provider: "{{ cli }}"
register: result
- assert:
@ -46,7 +43,6 @@
next_hop: 192.168.42.64
admin_distance: 1
state: present
provider: "{{ cli }}"
register: result
- assert:
@ -59,7 +55,6 @@
next_hop: 192.168.42.64
admin_distance: 1
state: absent
provider: "{{ cli }}"
register: result
- assert:
@ -73,7 +68,6 @@
next_hop: 192.168.42.64
admin_distance: 1
state: absent
provider: "{{ cli }}"
register: result
- assert:
@ -86,7 +80,6 @@
- { prefix: 172.24.1.0/24, next_hop: 192.168.42.64 }
- { prefix: 172.24.2.0, mask: 24, next_hop: 192.168.42.64 }
state: present
provider: "{{ cli }}"
register: result
- assert:
@ -102,7 +95,6 @@
- { prefix: 172.24.2.0/24, next_hop: 192.168.42.64, state: absent }
- { prefix: 172.24.3.0/24, next_hop: 192.168.42.64 }
state: present
provider: "{{ cli }}"
register: result
- assert:
@ -117,7 +109,6 @@
- { prefix: 172.24.1.0/24, next_hop: 192.168.42.64 }
- { prefix: 172.24.3.0/24, next_hop: 192.168.42.64 }
state: absent
provider: "{{ cli }}"
register: result
- assert:

View file

@ -7,7 +7,7 @@
- no ip name-server
match: none
authorize: yes
provider: "{{ cli }}"
- name: configure name_servers
net_system:
@ -16,7 +16,6 @@
- 2.2.2.2
- 3.3.3.3
authorize: yes
provider: "{{ cli }}"
register: result
- assert:
@ -34,7 +33,6 @@
- 2.2.2.2
- 3.3.3.3
authorize: yes
provider: "{{ cli }}"
register: result
- assert:
@ -47,7 +45,6 @@
- 1.1.1.1
- 2.2.2.2
authorize: yes
provider: "{{ cli }}"
register: result
- assert:
@ -62,6 +59,5 @@
- no ip domain lookup source-interface
match: none
authorize: yes
provider: "{{ cli }}"
- debug: msg="END ios/set_name_servers.yaml"

View file

@ -8,7 +8,6 @@
- no ip name-server 2.2.2.2
- no ip name-server 3.3.3.3
match: none
provider: "{{ cli }}"
- name: configure name_servers
net_system:
@ -16,7 +15,6 @@
- 1.1.1.1
- 2.2.2.2
- 3.3.3.3
provider: "{{ cli }}"
register: result
- assert:
@ -33,7 +31,6 @@
- 1.1.1.1
- 2.2.2.2
- 3.3.3.3
provider: "{{ cli }}"
register: result
- assert:
@ -45,7 +42,6 @@
name_servers:
- 1.1.1.1
- 2.2.2.2
provider: "{{ cli }}"
register: result
- assert:

View file

@ -11,7 +11,7 @@
provider: "{{ cli }}"
- name: configure name_servers
nxos_system:
net_system:
name_servers:
- 1.1.1.1
- 2.2.2.2
@ -28,7 +28,7 @@
- "'ip name-server 3.3.3.3' in result.commands"
- name: verify name_servers
nxos_system:
net_system:
name_servers:
- 1.1.1.1
- 2.2.2.2
@ -41,7 +41,7 @@
- result.changed == false
- name: remove one
nxos_system:
net_system:
name_servers:
- 1.1.1.1
- 2.2.2.2

View file

@ -8,15 +8,13 @@
- no ip name-server 2.2.2.2
- no ip name-server 3.3.3.3
match: none
provider: "{{ cli }}"
- name: configure name_servers
vyos_system:
net_system:
name_servers:
- 1.1.1.1
- 2.2.2.2
- 3.3.3.3
provider: "{{ cli }}"
register: result
- assert:
@ -28,12 +26,11 @@
- "'ip name-server 3.3.3.3' in result.commands"
- name: verify name_servers
vyos_system:
net_system:
name_servers:
- 1.1.1.1
- 2.2.2.2
- 3.3.3.3
provider: "{{ cli }}"
register: result
- assert:
@ -41,11 +38,10 @@
- result.changed == false
- name: remove one
vyos_system:
net_system:
name_servers:
- 1.1.1.1
- 2.2.2.2
provider: "{{ cli }}"
register: result
- assert:
@ -59,7 +55,6 @@
lines:
- no ip lookup source-interface
match: none
provider: "{{ cli }}"
ignore_errors: yes
# FIXME Copied from iosxr, not sure what we need here

View file

@ -2,7 +2,7 @@
- debug: msg="START net_vlan eos/basic.yaml"
- name: setup - remove vlan
eos_vlan:
net_vlan:
vlan_id: 4000
name: test-vlan
state: absent

View file

@ -1,7 +1,7 @@
---
- name: setup - remove vrf
eos_vrf:
net_vrf:
name: test
state: absent
authorize: yes